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. For bridge, the destination is picked automatically (first supported destination) unless you pass bridgeDestination.
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. These hooks do not require WalletsProvider, but you still need a connected walletId. Full field list: Transfer plan (Core).
useWalletTransferPlan
tsx
import { useWalletTransferPlan } from '@swapped/connect-sdk/react'
function Plan({
walletId,
token,
}: {
walletId: string
token: { network: Network; symbol: TokenSymbol; tokenAddress: string | null }
}) {
const { plan, isLoading, error, refetch } = useWalletTransferPlan({
walletId,
network: token.network,
symbol: token.symbol,
tokenAddress: token.tokenAddress,
})
return (
<div>
{isLoading ? <p>Resolving…</p> : null}
{plan ? <p>{plan.flow}</p> : null}
{plan?.destination ? (
<p>
→ {plan.destination.symbol} on {plan.destination.network}
</p>
) : null}
{error ? <p>{error.message}</p> : null}
</div>
)
}Pass null while you have no token selected — the hook stays idle.
Options
| Option | Meaning |
|---|---|
walletId | Connected instance |
network | Source token network |
symbol | Source token symbol |
tokenAddress | Source token contract, or null for native |
bridgeDestination? | Optional preferred bridge destination. When omitted, the SDK picks automatically |
Returns
| Field | Meaning |
|---|---|
plan | WalletTransferPlan or null |
isLoading | Loading |
error | Last getPlan error |
refetch | Re-run getPlan |
Use plan.flow, plan.source, and plan.destination in UI. issues[0].message is a user-facing string when the route is constrained. Other diagnostics: Transfer plan (Core).
usePrepareWalletTransfer
Optional warm-up when entering a wallets / deposit screen.
tsx
import { usePrepareWalletTransfer, useSession } from '@swapped/connect-sdk/react'
function WalletsPage() {
const { session } = useSession()
usePrepareWalletTransfer({ enabled: Boolean(session) })
return null
}Options
| Option | Meaning |
|---|---|
enabled? | Skip prefetch when false. Default true |