toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  return {
    if (from != null) 'from': from,
    if (to != null) 'to': to,
    if (data != null) 'data': HexUtils.encode(data!),
    if (value != null) 'value': '0x${value!.toRadixString(16)}',
    if (gasLimit != null) 'gas': '0x${gasLimit!.toRadixString(16)}',
    if (gasPrice != null) 'gasPrice': '0x${gasPrice!.toRadixString(16)}',
    if (maxFeePerGas != null)
      'maxFeePerGas': '0x${maxFeePerGas!.toRadixString(16)}',
    if (maxPriorityFeePerGas != null)
      'maxPriorityFeePerGas': '0x${maxPriorityFeePerGas!.toRadixString(16)}',
  };
}