origin) and the optional receiver-side wallet (destination).
Current wallet connection and execution flows are implemented for:
- EVM wallets
- Solana wallets
When to use TradeWidgetWalletProvider
You only need TradeWidgetWalletProvider if your application already owns wallet state and connection logic.
Use plain TradeWidget when:
- the widget should detect wallets on its own
- the widget should show its own wallet picker
- the widget should manage connect and disconnect internally
TradeWidgetWalletProvider when:
- your app already has its own wallet modal
- your app already knows the connected address and namespace
- your app already owns EVM or Solana provider instances
- the widget should reuse your wallet state instead of creating its own
TradeWidgetWalletProvider is not a blockchain provider by itself. It is a bridge between your wallet system and the widget.
Built-in wallet management
If you renderTradeWidget by itself, the widget shows its own wallet connection UI and manages transaction execution internally.
The built-in wallet list currently includes:
- MetaMask
- Rabby Wallet
- Wallet Connect
- Backpack
- Phantom
- Solflare
- Trust Wallet
- OKX Wallet
- Coinbase Wallet
- Magic Eden
- EVM wallets use injected providers or WalletConnect
- Solana wallets use injected providers or Wallet Standard providers
- the connect modal requires the user to accept Terms and Privacy Policy before connection
- wallet selection is persisted in browser
localStorage
config.termsUrl or config.privacyPolicyUrl is omitted, the modal falls back to same-origin /documentation/termsofuse and /documentation/privacypolicy links. For embedded third-party apps, passing explicit URLs is recommended.
walletConnectProjectId can be set through config to override the WalletConnect Cloud project id used by the EVM QR flow.
Host-managed wallets
If your app already owns wallet state, wrap the widget inTradeWidgetWalletProvider.
How it works
TradeWidgetWalletProvider is a React context provider. It does not connect to wallets by itself and it does not replace an EVM or Solana provider.
Its job is to expose two optional wallet adapters to TradeWidget:
originfor the sell-side walletdestinationfor the receiver-side wallet
TradeWidget mounts, it reads that context and passes origin and destination into its wallet hooks. If one side is present, that side switches into externally managed mode. If one side is missing, the widget falls back to its built-in wallet flow for that side.
This is presence-based, not connection-based.
If you pass an origin or destination object at all, that side is considered externally managed even when namespace and address are currently null.
If you want the widget to keep its built-in wallet flow for a side, omit that side from the provider value entirely.
What the widget reads from your wallet adapter
For each externally managed side, the widget reads values such as:namespaceaddressstatuswalletNameconnectedWalletIdconnectedWalletVisualIdconnectedWalletIconUrlerrorMessage
originfor the sell-side walletdestinationfor the receiver-side wallet
Managed wallet shape
At minimum, a managed wallet can expose:namespaceaddress
connectWalletOptionconnectPreferredconnect
evmProviderorsolanaProviderevmBrowserProviderwalletStandardSolanaAccountconnectanddisconnectconnectPreferredconnectWalletOptionwalletOptionsfor a widget-owned selection modal backed by host logicconnectedWalletId,connectedWalletVisualId, andconnectedWalletIconUrlfor custom wallet brandingerrorMessage,clearError, andpeekLastConnectionErrorfor host-controlled error UX- getter helpers such as
getEvmProvider,getEvmBrowserProvider,getSolanaProvider, orgetConnectedWalletStandardSolanaAccount
How connect is delegated
When the widget needs to connect an externally managed wallet, it delegates that work back to your app. It does that in this order:connectWalletOption(walletId, namespace)if the user selected a specific wallet option in the widget UIconnectPreferred(namespace)if the widget knows which namespace it needsconnect(params)as the generic fallback
When the widget shows its own connect modal
There are two external-wallet modes:- If you provide
walletOptions, the widget can still render its own connect modal, but the modal is only a UI shell. After the user chooses a wallet, the widget calls yourconnectWalletOption(...). - If you do not provide
walletOptions, the widget skips its own chooser and directly calls your external connect handler.
- fully host-owned connect UX
- widget-owned wallet picker backed by host-owned wallet logic
Receiver and destination behavior
The widget has a separate receiver flow on the buy side. At runtime, users can:- receive to the origin wallet when the buy-side namespace matches
- connect a separate destination wallet
- paste a receiver address directly in the UI
- fully built-in wallet management
- host-managed
destinationwallet adapters throughTradeWidgetWalletProvider
How provider access works
After a wallet is connected, the widget still needs provider access to execute transactions. For EVM, it resolves providers in this order:evmBrowserProvidergetEvmBrowserProvider()getEvmProvider()evmProvider
ethers BrowserProvider when needed.
For an externally managed EVM side that should execute trades, you should provide at least one of these:
evmBrowserProvidergetEvmBrowserProvider()getEvmProvider()evmProvider
getSolanaProvider()solanaProvider
walletStandardSolanaAccountgetConnectedWalletStandardSolanaAccount()
getSolanaProvider()orsolanaProvider- and, for Wallet Standard flows,
walletStandardSolanaAccountorgetConnectedWalletStandardSolanaAccount()
Partial management
You can mix internal and external flows. Examples:- manage only
originexternally and let the widget managedestination - manage only
destinationexternally for a custom receiver-wallet flow - manage both sides externally
walletOptions, the widget calls the host’s connect function directly. When walletOptions are present, the widget can still show its own wallet chooser and call the host’s connectWalletOption logic.
Execution details
Even in externally managed mode, transaction orchestration still lives insideTradeWidget.
That means the widget still handles:
- metadata and quote loading
- allowance checks
- approve vs swap state transitions
- transaction submission callbacks
- confirmation callbacks
- switches to the selected sell chain with
wallet_switchEthereumChain - falls back to
wallet_addEthereumChainif the chain is missing - tries EIP-5792 batching for approve + swap when the wallet supports it
- Wallet Standard
signAndSendTransactionwhen available - otherwise the injected wallet’s
signTransaction
Mental model
The easiest way to think about it is:TradeWidgetowns the trading flow- your app can own the wallet state
TradeWidgetWalletProvideris the adapter layer between the two
TradeWidgetWalletProvider. If you just want an embeddable trading widget with built-in wallet handling, use plain TradeWidget.
For the full list of exported wallet-management types, see Widget API Reference.
