ETHTransaction.fromJson constructor
Factory constructor to create an ETHTransaction from JSON.
Implementation
factory ETHTransaction.fromJson(Map<String, dynamic> json) {
return ETHTransaction(
nonce: PluginIntUtils.hexToInt(json['nonce']),
gasLimit: PluginBigintUtils.hexToBigint(json['gasLimit']),
data: BytesUtils.tryFromHexString(json['data']) ?? const <int>[],
value: PluginBigintUtils.hexToBigint(json['value']),
chainId: PluginBigintUtils.hexToBigint(json['chainId']),
gasPrice: PluginBigintUtils.tryHexToBigint(json['gasPrice']),
maxFeePerGas: PluginBigintUtils.tryHexToBigint(json['maxFeePerGas']),
maxPriorityFeePerGas:
PluginBigintUtils.tryHexToBigint(json['maxPriorityFeePerGas']),
from: ETHAddress(json['from']),
to: json['to'] == null ? null : ETHAddress(json['to']),
type: json['type'] == null
? null
: ETHTransactionType.fromPrefix(
PluginIntUtils.hexToInt(json['type'])),
accessList: (json['accessList'] as List?)
?.map((e) => AccessListEntry.fromJson(e))
.toList(),
signature: json['signature'] == null
? null
: ETHSignature(BigInt.parse(json['signature']['r']),
BigInt.parse(json['signature']['s']), json['signature']['v']));
}