SmartContract.fromJson constructor

SmartContract.fromJson(
  1. Map<String, dynamic> json
)

Create a new SmartContract instance by parsing a JSON map.

Implementation

factory SmartContract.fromJson(Map<String, dynamic> json) {
  return SmartContract(
      originAddress: TronAddress(json["origin_address"]),
      bytecode: BytesUtils.fromHexString(json["bytecode"]),
      callValue: BigintUtils.tryParse(json["call_value"]),
      abi: SmartContractABI.fromJson(json["abi"]),
      consumeUserResourcePercent:
          BigintUtils.tryParse(json["consume_user_resource_percent"]),
      name: json["name"],
      originEnergyLimit: BigintUtils.tryParse(json["origin_energy_limit"]),
      trxHash: BytesUtils.tryFromHexString(json["trx_hash"]),
      codeHash: BytesUtils.tryFromHexString(json["code_hash"]),
      version: IntUtils.tryParse(json["version"]),
      contractAddress: json["contract_address"] == null
          ? null
          : TronAddress(json["contract_address"]));
}