EVMTransaction.fromJson constructor
EVMTransaction.fromJson( - 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,
'gas': int? gas,
'gasPrice': Map? gasPrice,
'gasUsed': int? gasUsed,
'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,
gas: gas,
recipient: recipient,
gasUsed: gasUsed,
gasPrice: gasPrice != null ? Amount.fromJson(gasPrice) : null,
transferMethod: TransactionTransferMethod.fromJson(transferMethod),
status: ConfirmationStatus.fromJson(status),
input: input.hexToBytesOrNull ?? Uint8List(0),
token: CoinEntity.fromJson(token),
decodedInput: decodedInput != null
? ContractFunctionWithValues.fromJson(decodedInput)
: null,
);
}
throw Exception("Could not parse EVMTransaction from $json");
}