toJson method

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

Convert the TransactionRaw object to a JSON representation.

Implementation

@override
Map<String, dynamic> toJson() {
  return {
    'ref_block_bytes': BytesUtils.toHexString(refBlockBytes),
    'ref_block_num': refBlockNum?.toString(),
    'ref_block_hash': BytesUtils.toHexString(refBlockHash),
    'expiration': expiration.toString(),
    'auths': auths?.map((auth) => auth.toJson()).toList(),
    'data': StringUtils.tryDecode(data),
    'contract': contract.map((c) => c.toJson()).toList(),
    'scripts': BytesUtils.tryToHexString(scripts),
    'timestamp': timestamp.toString(),
    'fee_limit': feeLimit?.toString(),
  }..removeWhere((key, value) => value == null);
}