On this page
Transactions
Connect the provider before signing and confirm the selected network. The direct injected provider and the Aptos Wallet Standard adapter have different argument types; do not interchange their examples. Replace abbreviated addresses and provide an SDK client for read-only calls.
Learn how to sign and submit transactions on Aptos.
Sign and Submit Transaction
// Simple APT transfer
const payload = {
type: 'entry_function_payload',
function: '0x1::aptos_account::transfer',
type_arguments: [],
arguments: [
'0x1234...', // Recipient address
'100000000', // Amount in Octas (1 APT = 100000000 Octas)
],
}
const response = await provider.signAndSubmitTransaction(payload)
console.log('Transaction hash:', response.hash)Sign Transaction (Without Submitting)
const payload = {
type: 'entry_function_payload',
function: '0x1::coin::transfer',
type_arguments: ['0x1::aptos_coin::AptosCoin'],
arguments: ['0x1234...', '100000000'],
}
const signedTxn = await provider.signTransaction(payload)
// Submit later using Aptos SDK
// const pendingTxn = await client.submitTransaction(signedTxn)Sign Transaction V2 (BCS Serialized)
For advanced use cases with BCS-serialized transactions:
const rawTransaction = '<BCS_SERIALIZED_TRANSACTION>'; // Use the encoding expected by your wallet version
const signedTxn = await provider.signTransactionV2({
transaction: rawTransaction,
transactionType: 'simple', // 'simple' or 'multi_agent'
asFeePayer: false,
})Transaction Options
const payload = {
type: 'entry_function_payload',
function: '0x1::aptos_account::transfer',
type_arguments: [],
arguments: ['0x1234...', '100000000'],
}
// The legacy direct method takes only a payload.
const response = await provider.signAndSubmitTransaction(payload)
// For gas options, use signAndSubmitTransactionV2 with the matching Wallet Standard input.Smart Contract Interaction
Call View Function
// View functions don't require signing
const result = await client.view({
function: '0x1::coin::balance',
type_arguments: ['0x1::aptos_coin::AptosCoin'],
arguments: [accountAddress],
})
console.log('Balance:', result[0])Call Entry Function
// Mint NFT example
const payload = {
type: 'entry_function_payload',
function: '0x3::token::create_collection_script',
type_arguments: [],
arguments: [
'My Collection', // Collection name
'Description', // Description
'https://example.com', // URI
'1000', // Maximum supply
[false, false, false], // Mutability config
],
}
const response = await provider.signAndSubmitTransaction(payload)Multi-Agent Transactions
For transactions requiring multiple signers:
const signedTxn = await provider.signTransactionV2({
transaction: rawTransaction,
transactionType: 'multi_agent',
})Fee Payer Transactions
Sign as a fee payer for sponsored transactions:
const signedTxn = await provider.signTransactionV2({
transaction: rawTransaction,
transactionType: 'simple',
asFeePayer: true,
})Last updated on