TransactionContract.fromJson constructor

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

Create a new TransactionContract instance by parsing a JSON map.

Implementation

factory TransactionContract.fromJson(Map<String, dynamic> json) {
  final type = TransactionContractType.findByName(json["type"]);
  final any = Any.fromJson(json["parameter"]);
  final int? permissionId =
      IntUtils.tryParse(json["permission_id"] ?? json["Permission_id"]);
  return TransactionContract(
    type: type,
    parameter: any,
    permissionId: permissionId,
    provider: StringUtils.tryEncode(json["provider"]),
    contractName: StringUtils.tryEncode(json["contract_name"]),
  );
}