wallet.transfer
Transfers a TIP-20 token.
This action invokes the wallet_transfer JSON-RPC method on the connected wallet.
Usage
import { Actions } from 'viem/tempo'
import { client } from './viem.config'
const { chainId, receipt } = await Actions.wallet.transfer(client, {
amount: '1.5',
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
token: 'pathUSD',
})
console.log('Transaction hash:', receipt.transactionHash)import { Provider } from 'accounts'
import { createClient, custom } from 'viem/tempo'
const provider = Provider.create()
export const client = createClient({
transport: custom(provider),
})Editable mode
By default, wallet.transfer is read-only — the wallet signs and submits the transfer programmatically (using an access key when one matches, otherwise prompting the user with a confirm dialog).
Pass editable: true to open the wallet's send UI instead, with any supplied fields pre-filled for the user to confirm or edit before signing. In this mode all fields are optional.
import { Actions } from 'viem/tempo'
import { client } from './viem.config'
await Actions.wallet.transfer(client, {
editable: true,
token: 'pathUSD',
})Return Type
type ReturnType = {
/** Chain ID the transfer was submitted to. */
chainId: number
/** Receipt of the submitted transfer. */
receipt: TransactionReceipt
}Parameters
editable (optional)
- Type:
boolean - Default:
false
When omitted or false, the call is read-only. When true, the wallet UI is shown with the supplied fields pre-filled.
amount
- Type:
string - Required when
editableis omitted orfalse.
Human-readable amount to transfer (for example, "1.5").
to
- Type:
Address - Required when
editableis omitted orfalse.
Recipient address.
token
- Type:
Address | string - Required when
editableis omitted orfalse.
Token to transfer, accepted as either a token address or a curated tokenlist symbol (case-insensitive, for example "pathusd"). Symbols are resolved against the curated tokenlist on the active chain. Omit (in editable mode) to let the user choose.
from (optional)
- Type:
Address - Read-only mode only.
Address to transfer tokens from. Defaults to the active account. When set to a different address, the call uses transferFrom and requires the active account to have an allowance from from.
memo (optional)
- Type:
string
UTF-8 memo to attach to the transfer (max 32 bytes when encoded as UTF-8). Sent via transferWithMemo / transferFromWithMemo. The wallet rejects the request if the selected token does not support memos (non-TIP-20).
chainId (optional)
- Type:
number
Chain id. Defaults to the active chain.
feePayer (optional)
- Type:
boolean | string
Fee payer override. Pass false to disable the wallet's default fee payer, or a URL string to use a custom fee payer service.