Send Transactions
Send native tokens on EVM chains with EIP-1559 or legacy gas settings.
This guide explains how to send EVM transactions with EIP-1559 gas parameters, send legacy gas transactions, sign without broadcasting, estimate fees, and use dynamic fee rates.
BigInt Usage: Always use BigInt (the n suffix) for monetary values to avoid precision loss with large numbers.
Send with EIP-1559 Gas Parameters
You can use account.sendTransaction() to send an EIP-1559 transaction. EIP-1559 transactions provide more predictable gas fees and faster inclusion times.
const result = await account.sendTransaction({
to: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
value: 1000000000000000000n, // 1 ETH in wei
maxFeePerGas: 30000000000,
maxPriorityFeePerGas: 2000000000
})
console.log('Transaction hash:', result.hash)
console.log('Transaction fee:', result.fee, 'wei')Send with Legacy Gas Parameters
You can also use account.sendTransaction() with legacy gas settings for chains that do not support EIP-1559.
const legacyResult = await account.sendTransaction({
to: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
value: 1000000000000000000n,
gasPrice: 20000000000n,
gasLimit: 21000
})
console.log('Transaction hash:', legacyResult.hash)Sign Without Broadcasting
Use account.signTransaction() when you need a signed raw transaction but want to submit it through a separate relay, service, or review flow.
const signedTransaction = await account.signTransaction({
to: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
value: 1000000000000000000n,
chainId: 1,
maxFeePerGas: 30000000000n,
maxPriorityFeePerGas: 2000000000n
})
console.log('Signed transaction:', signedTransaction)signTransaction() returns the signed transaction payload and does not broadcast it. Use sendTransaction() when WDK should sign, broadcast, and return the transaction hash.
Estimate Transaction Fees
Use account.quoteSendTransaction() to get a fee estimate before sending.
const quote = await account.quoteSendTransaction({
to: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
value: 1000000000000000000n
})
console.log('Estimated fee:', quote.fee, 'wei')Use Dynamic Fee Rates
Retrieve current fee rates using wallet.getFeeRates() and apply them to your transaction.
const feeRates = await wallet.getFeeRates()
console.log('Normal fee rate:', feeRates.normal, 'wei')
console.log('Fast fee rate:', feeRates.fast, 'wei')
const result = await account.sendTransaction({
to: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
value: 1000000000000000000n,
data: '0x',
gasLimit: 21000,
maxFeePerGas: feeRates.fast,
maxPriorityFeePerGas: 2000000000n
})
console.log('Transaction sent:', result.hash)
console.log('Fee paid:', result.fee, 'wei')Gas Estimation: The maxFeePerGas and maxPriorityFeePerGas fields enable EIP-1559 transactions, ensuring more predictable gas fees and faster inclusion times.
Next Steps
To transfer ERC-20 tokens instead of native tokens, see Transfer ERC-20 Tokens.