TransactionRaw.deserialize constructor

TransactionRaw.deserialize(
  1. List<int> bytes
)

Implementation

factory TransactionRaw.deserialize(List<int> bytes) {
  final decode = TronProtocolBufferImpl.decode(bytes);
  final contracts = decode
      .getFields<List<int>>(11)
      .map((e) => TransactionContract.deserialize(e))
      .toList();
  if (contracts.length != 1) {
    throw const TronPluginException(
        "Transaction must contain exactly one contract.");
  }
  return TransactionRaw(
      refBlockBytes: decode.getField(1),
      refBlockNum: decode.getField(3),
      refBlockHash: decode.getField(4),
      expiration: decode.getField(8),
      auths: decode
          .getFields<List<int>>(9)
          .map((e) => Authority.deserialize(e))
          .toList(),
      data: decode.getField(10),
      contract: contracts,
      scripts: decode.getField(12),
      timestamp: decode.getField(14),
      feeLimit: decode.getField(18));
}