GenericTransaction.fromJson constructor

GenericTransaction.fromJson(
  1. Map json
)

Implementation

factory GenericTransaction.fromJson(Map json) {
  return switch (json) {
    {
      'hash': String _,
      'block': int _,
      'confirmations': int _,
      'timeMilli': int _,
      'amount': Map _,
      'fee': Map? _,
      'sender': String _,
      'recipient': String _,
      'transferMethod': int _,
      'status': int _,
      'token': Map _,
      'input': String _,
      'decodedInput': Map? _,
    } =>
      EVMTransaction.fromJson(json),
    {
      'hash': String _,
      'block': int _,
      'confirmations': int _,
      'timeMilli': int _,
      'amount': Map _,
      'fee': Map? _,
      'sender': String _,
      'recipient': String _,
      'transferMethod': int _,
      'status': int _,
      'token': Map _,
      'id': String _,
      'version': int _,
      'inputs': JsonList _,
      'outputs': JsonList _,
    } =>
      UTXOTransaction.fromJson(json),
    _ => throw UnimplementedError("Unknown json: $json"),
  };
}