build method

RawTransaction build(
  1. String func,
  2. List<String> tyTags,
  3. List args
)

Implementation

RawTransaction build(String func, List<String> tyTags, List<dynamic> args) {
  if (builderConfig.gasUnitPrice == null) {
    throw ArgumentError("No gasUnitPrice provided.");
  }

  final senderAccount = builderConfig.sender is AccountAddress ? builderConfig.sender : AccountAddress.fromHex(builderConfig.sender);
  final nowSeconds = BigInt.from(DateTime.now().millisecondsSinceEpoch ~/ Duration.millisecondsPerSecond);
  final addSeconds = builderConfig.expSecFromNow ?? BigInt.from(DEFAULT_TXN_EXP_SEC_FROM_NOW);
  final expTimestampSec = nowSeconds + addSeconds;
  final payload = buildTransactionPayload(func, tyTags, args);

  return RawTransaction(
    senderAccount,
    builderConfig.sequenceNumber!,
    payload,
    builderConfig.maxGasAmount!,
    builderConfig.gasUnitPrice!,
    expTimestampSec,
    ChainId(builderConfig.chainId!),
  );
}