/** * This file contains the underlying implementations for exposed submission API surface in * the {@link api/transaction}. By moving the methods out into a separate file, * other namespaces and processes can access these methods without depending on the entire * transaction namespace and without having a dependency cycle error. * @group Implementation */ import { AptosConfig } from "../api/aptosConfig.js"; import { Account } from "../account/index.js"; import { AccountAddressInput } from "../core/accountAddress.js"; import { AccountAuthenticator } from "../transactions/authenticator/account.js"; import { InputGenerateTransactionData, AnyRawTransaction, InputSimulateTransactionData, InputGenerateTransactionOptions, InputSubmitTransactionData, InputGenerateMultiAgentRawTransactionData, InputGenerateSingleSignerRawTransactionData, AnyTransactionPayloadInstance, InputTransactionPluginData } from "../transactions/types.js"; import { UserTransactionResponse, PendingTransactionResponse, HexInput } from "../types/index.js"; import { SimpleTransaction } from "../transactions/instances/simpleTransaction.js"; import { MultiAgentTransaction } from "../transactions/instances/multiAgentTransaction.js"; /** * We are defining function signatures, each with its specific input and output. * These are the possible function signature for `generateTransaction` function. * When we call `generateTransaction` function with the relevant type properties, * Typescript can infer the return type based on the appropriate function overload. * @group Implementation */ export declare function generateTransaction(args: { aptosConfig: AptosConfig; } & InputGenerateSingleSignerRawTransactionData): Promise; export declare function generateTransaction(args: { aptosConfig: AptosConfig; } & InputGenerateMultiAgentRawTransactionData): Promise; /** * Builds a transaction payload based on the provided configuration and input data. * This function is essential for preparing transaction data for execution on the Aptos blockchain. * * @param args - The arguments for building the transaction payload. * @param args.aptosConfig - Configuration settings for the Aptos network. * @param args.data - Input data required to generate the transaction payload, which may include bytecode, multisig address, * function name, function arguments, type arguments, and ABI. * @returns A promise that resolves to the generated transaction payload instance. * @group Implementation */ export declare function buildTransactionPayload(args: { aptosConfig: AptosConfig; } & InputGenerateTransactionData): Promise; /** * Builds a raw transaction based on the provided configuration and payload. * This function helps in creating a transaction that can be sent to the Aptos blockchain. * * @param args - The arguments for generating the transaction. * @param args.aptosConfig - The configuration settings for Aptos. * @param args.sender - The address of the sender of the transaction. * @param args.options - Additional options for the transaction. * @param payload - The payload of the transaction, which defines the action to be performed. * @group Implementation */ export declare function buildRawTransaction(args: { aptosConfig: AptosConfig; } & InputGenerateTransactionData, payload: AnyTransactionPayloadInstance): Promise; /** * Builds a signing message that can be signed by external signers. * * Note: Please prefer using `signTransaction` unless signing outside the SDK. * * @param args - The arguments for generating the signing message. * @param args.transaction - AnyRawTransaction, as generated by `generateTransaction()`. * * @returns The message to be signed. * @group Implementation */ export declare function getSigningMessage(args: { transaction: AnyRawTransaction; }): Uint8Array; /** * Sign a transaction that can later be submitted to the chain. * * @param args The arguments for signing the transaction. * @param args.signer The signer account to sign the transaction. * @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses. * * @return The signer AccountAuthenticator. * @group Implementation */ export declare function signTransaction(args: { signer: Account; transaction: AnyRawTransaction; }): AccountAuthenticator; export declare function signAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction; }): AccountAuthenticator; /** * Error thrown when {@link simulateTransaction} is called with an encrypted payload. * Simulation is not supported for encrypted transactions; build the same entry function without * `encrypted: true`, simulate that transaction, then build with encryption for submit. * @group Implementation */ export declare const ENCRYPTED_TRANSACTION_SIMULATION_NOT_SUPPORTED_MESSAGE = "Transaction simulation is not supported for encrypted payloads. Build a plaintext transaction with the same entry function and simulate it, then build with options.encrypted true for submission."; /** * Throws if the transaction cannot be simulated because its payload is encrypted. * @group Implementation */ export declare function assertSimulatableTransaction(transaction: AnyRawTransaction): void; /** * Simulates a transaction before signing it to evaluate its potential outcome. * * @param args The arguments for simulating the transaction. * @param args.aptosConfig The configuration for the Aptos network. * @param args.transaction The raw transaction to simulate. Must not use an encrypted payload * (`options.encrypted` when building); otherwise this function throws before contacting the node. * @param args.signerPublicKey Optional. The signer public key. * @param args.secondarySignersPublicKeys Optional. For when the transaction involves multiple signers. * @param args.feePayerPublicKey Optional. For when the transaction is sponsored by a fee payer. * @param args.options Optional. A configuration object to customize the simulation process. * @param args.options.estimateGasUnitPrice Optional. Indicates whether to estimate the gas unit price. * @param args.options.estimateMaxGasAmount Optional. Indicates whether to estimate the maximum gas amount. * @param args.options.estimatePrioritizedGasUnitPrice Optional. Indicates whether to estimate the prioritized gas unit price. * * @throws Error if `transaction` has an encrypted payload (see {@link assertSimulatableTransaction}). * @group Implementation */ export declare function simulateTransaction(args: { aptosConfig: AptosConfig; } & InputSimulateTransactionData): Promise>; /** * Submit a transaction to the Aptos blockchain. * * @param args - The arguments for submitting the transaction. * @param args.aptosConfig - The configuration for connecting to the Aptos network. * @param args.transaction - The Aptos transaction data to be submitted. * @param args.senderAuthenticator - The account authenticator of the transaction sender. * @param args.secondarySignerAuthenticators - Optional. Authenticators for additional signers in a multi-signer transaction. * * @returns PendingTransactionResponse - The response containing the status of the submitted transaction. * @group Implementation */ export declare function submitTransaction(args: { aptosConfig: AptosConfig; } & InputSubmitTransactionData): Promise; export type FeePayerOrFeePayerAuthenticatorOrNeither = { feePayer: Account; feePayerAuthenticator?: never; } | { feePayer?: never; feePayerAuthenticator: AccountAuthenticator; } | { feePayer?: never; feePayerAuthenticator?: never; }; export declare function signAndSubmitTransaction(args: FeePayerOrFeePayerAuthenticatorOrNeither & { aptosConfig: AptosConfig; signer: Account; transaction: AnyRawTransaction; } & InputTransactionPluginData): Promise; export declare function signAndSubmitAsFeePayer(args: { aptosConfig: AptosConfig; feePayer: Account; senderAuthenticator: AccountAuthenticator; transaction: AnyRawTransaction; } & InputTransactionPluginData): Promise; /** * Publishes a package transaction to the Aptos blockchain. * This function allows you to create and send a transaction that publishes a package with the specified metadata and bytecode. * * @param args - The arguments for the package transaction. * @param args.aptosConfig - The configuration settings for the Aptos client. * @param args.account - The address of the account sending the transaction. * @param args.metadataBytes - The metadata associated with the package, represented as hexadecimal input. * @param args.moduleBytecode - An array of module bytecode, each represented as hexadecimal input. * @param args.options - Optional parameters for generating the transaction. * @group Implementation */ export declare function publicPackageTransaction(args: { aptosConfig: AptosConfig; account: AccountAddressInput; metadataBytes: HexInput; moduleBytecode: Array; options?: InputGenerateTransactionOptions; }): Promise; //# sourceMappingURL=transactionSubmission.d.ts.map