generateRawTransaction method
Future<RawTransaction>
generateRawTransaction(
- String accountFrom,
- TransactionPayload payload, {
- BigInt? maxGasAmount,
- BigInt? gasUnitPrice,
- BigInt? expireTimestamp,
Implementation
Future<RawTransaction> generateRawTransaction(
String accountFrom,
TransactionPayload payload,{
BigInt? maxGasAmount,
BigInt? gasUnitPrice,
BigInt? expireTimestamp
}) async {
final account = await getAccount(accountFrom);
final chainId = await getChainId();
maxGasAmount ??= BigInt.from(20000);
gasUnitPrice ??= BigInt.from(await estimateGasPrice());
expireTimestamp ??= BigInt.from(DateTime.now().add(const Duration(seconds: 20)).millisecondsSinceEpoch);
return RawTransaction(
AccountAddress.fromHex(accountFrom),
BigInt.parse(account.sequenceNumber),
payload,
maxGasAmount,
gasUnitPrice,
expireTimestamp,
ChainId(chainId),
);
}