createScriptTransaction method

Future<AptosRawTransaction> createScriptTransaction({
  1. required AptosAddress sender,
  2. required List<int> byteCode,
  3. required List<AptosScriptArguments> arguments,
  4. List<AptosTypeTag> typeArgs = const [],
  5. AptosApiBuildTransactionParams? params,
})

Creates a script transaction to execute custom bytecode on the Aptos blockchain.

  • sender: The sender's address.
  • byteCode: The compiled bytecode to execute.
  • arguments: The script arguments required by the bytecode.
  • typeArgs (optional): Type arguments for the script, if applicable.
  • params (optional): Additional transaction settings.

Implementation

Future<AptosRawTransaction> createScriptTransaction({
  required AptosAddress sender,
  required List<int> byteCode,
  required List<AptosScriptArguments<dynamic>> arguments,
  List<AptosTypeTag> typeArgs = const [],
  AptosApiBuildTransactionParams? params,
}) {
  final transactionPayload = AptosTransactionPayloadScript(
    script: AptosScript(
      arguments: arguments,
      typeArgs: typeArgs,
      byteCode: byteCode,
    ),
  );

  return buildTransaction(
    sender: sender,
    transactionPayload: transactionPayload,
    params: params,
  );
}