DelegateResourceContract.fromJson constructor

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

Create a new DelegateResourceContract instance by parsing a JSON map.

Implementation

factory DelegateResourceContract.fromJson(Map<String, dynamic> json) {
  return DelegateResourceContract(
      ownerAddress: OnChainUtils.parseTronAddress(
          value: json["owner_address"], name: "owner_address"),
      balance:
          OnChainUtils.parseBigInt(value: json["balance"], name: "balance"),
      receiverAddress: OnChainUtils.parseTronAddress(
          value: json["receiver_address"], name: "receiver_address"),
      lock: OnChainUtils.parseBoolean(value: json["lock"], name: "lock"),
      resource: ResourceCode.fromName(
          OnChainUtils.parseString(value: json["resource"], name: "resource"),
          orElse: ResourceCode.bandWidth),
      lockPeriod: OnChainUtils.parseBigInt(
          value: json["lock_period"], name: "lock_period"));
}