WDK logoWDK documentation

Send Transactions

Send gasless transactions and estimate fees.

This guide explains how to send a gasless transaction, estimate fees, and use a custom paymaster token.

Send a Gasless Transaction

You can send a transaction with gas fees paid in the paymaster token using account.sendTransaction():

Send Gasless Transaction
const result = await account.sendTransaction({
  to: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
  value: 1000000000000000n // 0.001 ETH in wei
})
console.log('Transaction hash:', result.hash)
console.log('Fee paid in paymaster token:', result.fee)

ERC-4337 transactions are gasless for the end user. Gas fees are paid through the configured paymaster using the specified paymaster token (e.g., USD₮).

Estimate Fees

You can estimate the fee for a transaction without broadcasting it using account.quoteSendTransaction():

Estimate Fee
const quote = await account.quoteSendTransaction({
  to: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
  value: 1000000000000000n
})
console.log('Estimated fee:', quote.fee)

Send with Custom Paymaster Token

You can override the default paymaster token for a specific transaction by passing a config object to account.sendTransaction():

Custom Paymaster Token
const result = await account.sendTransaction({
  to: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
  value: 1000000000000000n
}, {
  paymasterToken: {
    address: '0x68749665FF8D2d112Fa859AA293F07A622782F38' // XAUT
  }
})

Next Steps

Learn how to transfer ERC-20 tokens.

On this page