Transaction.fromJson constructor

Transaction.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Transaction.fromJson(Map<String, dynamic> json) {
  TransactionType type;
  switch (json['transactionType']) {
    case 'RGB_SEND':
      type = TransactionType.rgbSend;
      break;
    case 'DRAIN':
      type = TransactionType.drain;
      break;
    case 'CREATE_UTXOS':
      type = TransactionType.createUtxos;
      break;
    case 'USER':
      type = TransactionType.user;
      break;
    default:
      type = TransactionType.user;
  }

  return Transaction(
    transactionType: type,
    txid: json['txid'],
    received: json['received'],
    sent: json['sent'],
    fee: json['fee'],
    confirmationTime: json['confirmationTime'],
  );
}