toJson method

  1. @override
Map<String, dynamic> toJson()
override

Convert the SmartContract object to a JSON representation.

Implementation

@override
Map<String, dynamic> toJson() {
  return {
    "origin_address": originAddress.toString(),
    "contract_address": contractAddress?.toString(),
    "abi": abi?.toJson(),
    "bytecode": BytesUtils.toHexString(bytecode),
    "call_value": callValue?.toString(),
    "consume_user_resource_percent": consumeUserResourcePercent?.toString(),
    "name": name,
    "origin_energy_limit": originEnergyLimit?.toString(),
    "code_hash": BytesUtils.tryToHexString(codeHash),
    "trx_hash": BytesUtils.tryToHexString(trxHash),
    "version": version,
  }..removeWhere((key, value) => value == null);
}