TradeWidget props to control the widget’s runtime behavior, preselected assets, and available networks or tokens.
Runtime configuration
All runtime options live under the requiredconfig prop.
https://api.delora.build. Set apiUrl when you want a custom upstream, such as your own backend proxy:
rpcUrls to provide preferred endpoints for a supported chain. Map each numeric chain ID to an ordered URL array; the widget tries those URLs first and keeps its default endpoints as fallbacks. For supported chain IDs, see Connected chains.
If
assetBaseUrl is not set, it falls back to config.apiUrl and then to https://api.delora.build.
For browser-based widget integrations, prefer not to pass apiKey directly from the client. Instead:
- keep your Delora API key on your backend
- expose a proxy that forwards
/v1/chains,/v1/tokens,/v1/tools, and/v1/quotestohttps://api.delora.build - point
config.apiUrlto that proxy - if your proxy does not also serve Delora relative image assets, set
assetBaseUrl: "https://api.delora.build"or proxy those asset paths as well
TradeWidget already supports this pattern because all Delora API reads go through config.apiUrl.
If termsUrl or privacyPolicyUrl is omitted, the connect modal falls back to:
${window.location.origin}/documentation/termsofuse${window.location.origin}/documentation/privacypolicy
requireWalletConsent is false, termsUrl and privacyPolicyUrl are not
rendered because the entire consent footer is hidden.
Configure built-in wallets
Useconfig.wallets to control the widget-managed wallet picker. These three
fields have independent purposes:
includeis an allowlist. When present, only listed wallets are eligible.excludeis a denylist. It removes listed wallets and takes precedence overinclude.ordermoves listed, enabled wallets to the front in the specified order. It does not hide unlisted wallets.
metamaskrabby-walletwalletconnectbackpackphantomsolflaretrust-walletokx-walletcoinbase-walletmagic-eden
config.wallets controls only built-in wallet management. When the host supplies
walletOptions through external wallet management, that host-provided array
remains the source of truth.
Initial selections
You can preselect both networks and tokens.onError. The same happens when a host-provided initial selection becomes invalid after filters are applied.
Lock tokens or networks
Use lock props when you want the host app to keep part of the form fixed.lockSellTokenlockBuyTokenlockSellNetworklockBuyNetwork
- Locking a token also locks its network, because the token already implies a chain
- Locking a network still allows token changes inside that network
- Any lock disables the center “swap sides” button to avoid breaking host-provided constraints
Filter available networks and tokens
Usefilters to restrict the sell and buy sides independently.
includeNetworkIdsexcludeNetworkIdsincludeTokensexcludeTokens
- Filters are applied per side, so sell and buy restrictions can be different
- Networks that end up with no available tokens are removed automatically
- Conflicting filters produce
onErrorevents withsource: "configuration" - If no networks remain on a side after filtering, the widget enters a configuration error state
Custom token lookup
When a side does not useincludeTokens, the token selector can import a token by contract or mint address if the address is valid for the active network. Imported tokens become part of the current browser session and can also be restored from persisted selection state.
When includeTokens is set for a side, custom token import is disabled on that side.
Persistence
The widget stores the latest selected sell and buy networks and tokens in browserlocalStorage, so the next mount can restore the previous selection when the host app does not explicitly override it.
Slippage and internal wallet choices are also persisted separately.
Quote lifecycle and refresh behavior
The widget does not request a quote on every keystroke. Quote loading has a small client-side lifecycle:- sell input is debounced by about 1 second before a quote request is sent
- successful quotes auto-refresh every 60 seconds while the current selection stays stable
- auto-refresh stops after 5 consecutive refresh cycles until the user changes the selection or amount
- the quote countdown ring in the UI can also be clicked to request a manual refresh immediately
- more than 15 quote requests within 5 seconds starts a local cooldown
- the cooldown lasts 5 seconds
- during that window, the widget can emit
onError({ source: "quote", statusCode: 429 })even if the backend did not return 429

