EVMTransaction.fromJson constructor

EVMTransaction.fromJson(
  1. Map json
)

Implementation

factory EVMTransaction.fromJson(Map<dynamic, dynamic> json) {
  if (json
      case {
        'hash': String hash,
        'block': int block,
        'confirmations': int confirmations,
        'timeMilli': int timeMilli,
        'amount': Map amount,
        'fee': Map? fee,
        'sender': String sender,
        'recipient': String recipient,
        'transferMethod': int transferMethod,
        'status': int status,
        'token': Map token,
        'input': String input,
        'decodedInput': Map? decodedInput,
      }) {
    return EVMTransaction(
      hash: hash,
      block: block,
      confirmations: confirmations,
      timeMilli: timeMilli,
      amount: Amount.fromJson(amount),
      fee: fee != null ? Amount.fromJson(fee) : null,
      sender: sender,
      recipient: recipient,
      transferMethod: TransactionTransferMethod.fromJson(transferMethod),
      status: ConfirmationStatus.fromJson(status),
      input: input.hexToBytesOrNull ?? Uint8List(0),
      token: CoinEntity.fromJson(token),
      decodedInput: decodedInput != null
          ? ExternalContractFunctionWithValues.fromJson(decodedInput)
          : null,
    );
  }
  throw Exception("Could not parse EVMTransaction from $json");
}