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

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. getPlan also throws WALLET_TRANSFER_INVALID_TOKEN when the token is missing from cached balances (needed for source.decimals). Fetch balances before resolving a plan. getPlanSync returns null in that case.

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()

Tron ​

Tron deposits are direct sends only: native TRX, or a TRC-20 token when tokenAddress is the contract. Leave tokenAddress unset for TRX. Swap and bridge stay unavailable for a Tron source, and the send is never sponsored.

The chain id is tron:0x2b6653dc. The account address is base58 (T…).

How the wallet connectsWallets
InjectedTrust, Bitget, OKX, Bybit
WalletConnectTrust, Bitget, Binance, Bybit

A completed direct send can fill a TRX network fee. See Summary.

Fee check before submit ​

Before the user confirms, call transfer.getFeeCheck({ plan, amount }) (debounced in React via useWalletTransferFeeCheck). It mirrors the Swapped widget: native TRX/EVM sends may return exceeds_balance_with_fee with a suggestedAmount (the SDK does not change the amount for you). TRC-20 / ERC-20 sends return insufficient_fee when there is not enough native token for gas.

submit always re-runs the check with forceRefetch: true and throws WALLET_TRANSFER_INSUFFICIENT_FEE if the user cannot cover fees. Details: Amount & quote — Fee check.