TransactionRaw.fromJson constructor

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

Create a new TransactionRaw instance by parsing a JSON map.

Implementation

factory TransactionRaw.fromJson(Map<String, dynamic> json) {
  final contractList = (json['contract'] as List)
      .map((contract) => TransactionContract.fromJson(contract))
      .toList();

  return TransactionRaw(
    contract: contractList,
    refBlockBytes: BytesUtils.fromHexString(json['ref_block_bytes']),
    refBlockHash: BytesUtils.fromHexString(json['ref_block_hash']),
    expiration: BigintUtils.parse(json['expiration']),
    timestamp: BigintUtils.parse(json['timestamp']),
    data: StringUtils.tryEncode(json["data"]),
    feeLimit: BigintUtils.tryParse(json["fee_limit"]),
    refBlockNum: BigintUtils.tryParse(json["ref_block_num"]),
    scripts: BytesUtils.tryFromHexString(json['scripts']),
    auths:
        (json["auths"] as List?)?.map((e) => Authority.fromJson(e)).toList(),
  );
}