buildRawTransaction function
Implementation
Transaction_raw buildRawTransaction(
TronContractData contractData, {
int feeLimit = 10000000,
required TronBlockInfo block,
}) {
final blockId = block.blockId.hexToBytes;
final refBlockHash = blockId.sublist(8, 16);
final blockNumberBytes = block.blockNumber.toBigInt.bigIntToBytes;
final refBlockBytes = blockNumberBytes.sublist(
blockNumberBytes.length < 2 ? 0 : blockNumberBytes.length - 2,
blockNumberBytes.length,
);
final now = DateTime.now();
final timestamp = now.millisecondsSinceEpoch;
final expiration = now.add(Duration(minutes: 10)).millisecondsSinceEpoch;
final rawTx = createRawTransaction(
data: contractData,
refBlockBytes: refBlockBytes,
refBlockHash: refBlockHash,
expiration: expiration,
timestamp: timestamp,
feeLimit: feeLimit, // 10 TRX
);
return rawTx;
}