Skip to content

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.flowMeaning
directSession already receives this token on this network. User sends it.
swapSame chain, different token. SDK swaps into the session asset.
bridgeDifferent chain. SDK bridges into the session token/network.
unavailableNo route for this token.

Priority: directswapbridgeunavailable.

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

MethodReturns
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:

FieldMeaning
walletIdConnected instance
network / symbol / tokenAddressSource 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:

FieldMeaning
flow'direct' | 'swap' | 'bridge' | 'unavailable'
sourceWallet + token being spent (walletId, network, symbol, tokenAddress, address, provider, transport, decimals?)
destinationWhere funds land, or null when unavailable. For bridge, picked automatically unless you passed bridgeDestination

destination:

FieldMeaning
network / symbol / tokenAddressDestination token
addressMerchant / 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();