Appearance
Transfer plan
A transfer plan (WalletTransferPlan) is how a connected wallet + token becomes the session deposit. You pass the source (walletId, network, symbol, tokenAddress). The SDK picks the route — you do not.
plan.flow | Meaning |
|---|---|
direct | Session already receives this token on this network. User sends it. |
swap | Same chain, different token. SDK swaps into the session asset. |
bridge | Different chain. SDK bridges into the session token/network. |
unavailable | No route for this token. |
Priority: direct → swap → bridge → unavailable.
plan.source is what the user spends. plan.destination is what the session receives. For bridge, the destination is picked automatically (first supported destination) unless you pass bridgeDestination.
Plan
| Method | Returns |
|---|---|
getPlanSync(request) | A WalletTransferPlan if it can be built without network I/O, else null. Sync. Does not call swap/bridge APIs |
getPlan(request) | Promise<WalletTransferPlan>. Uses getPlanSync first; otherwise loads swap/bridge support |
prefetchTransferCurrencies() | Optional. Warms swap/bridge currency lists so a later non-direct getPlan can reuse cache |
ts
const request = {
walletId,
network: token.network,
symbol: token.symbol,
tokenAddress: token.tokenAddress,
};
const plan =
client.wallets.transfer.getPlanSync(request) ??
(await client.wallets.transfer.getPlan(request));GetWalletTransferPlanRequest:
| Field | Meaning |
|---|---|
walletId | Connected instance |
network / symbol / tokenAddress | Source token (tokenAddress is null for native) |
bridgeDestination? | Optional preferred bridge destination (network + symbol). When omitted, the SDK picks the first supported destination automatically |
A wallet / token mismatch (wrong walletId, network, or token) throws WALLET_TRANSFER_INVALID_TOKEN or WALLET_TRANSFER_NAMESPACE_MISMATCH.
WalletTransferPlan
Integrator fields:
| Field | Meaning |
|---|---|
flow | 'direct' | 'swap' | 'bridge' | 'unavailable' |
source | Wallet + token being spent (walletId, network, symbol, tokenAddress, address, provider, transport, decimals?) |
destination | Where funds land, or null when unavailable. For bridge, picked automatically unless you passed bridgeDestination |
destination:
| Field | Meaning |
|---|---|
network / symbol / tokenAddress | Destination token |
address | Merchant / session withdraw address when known |
decimals? | Destination decimals |
minAmount? | Minimum deposit in destination token units |
When the route is constrained, issues[0].message is a user-facing string you can show. Other diagnostics (reason, restrictions, issue codes, bridgeDestinations) are on the type for advanced use — see the API reference.
prefetchTransferCurrencies() is optional. Skipping it only means the first non-direct getPlan waits on the network.
ts
await client.wallets.transfer.prefetchTransferCurrencies();