@deloraprotocol/widget.
Most integrations center on the trading widget surface:
TradeWidgetTradeWidgetWalletProvideruseTradeWidgetWalletManagement
MyWidget demo component and shared theming props.
Main exports
Components and hooks:MyWidgetTradeWidgetTradeWidgetWalletProvideruseTradeWidgetWalletManagement
MyWidgetPropsMyWidgetThemeMyWidgetVars
TradeWidgetPropsTradeWidgetConfigTradeWidgetRpcUrlsByChainIdWalletNamespaceTradeWidgetStatusTradeWidgetFiltersTradeWidgetSideFiltersTradeWidgetTokenSelectionTradeWidgetQuotePayloadTradeWidgetActionPayloadTradeWidgetConnectPayloadTradeWidgetTransactionPayloadTradeWidgetErrorPayloadTokenNetwork
TradeWidgetManagedWalletTradeWidgetManagedWalletConnectParamsTradeWidgetWalletManagementTradeWidgetWalletProviderPropsEip1193ProviderKnownWalletOptionIdSolanaInjectedProviderSolanaProviderWalletConnectionStatusWalletOptionDescriptorWalletOptionIdWalletOptionTypeWalletVisualIdWalletStandardSolanaAccountWalletStandardSolanaProvider
MyWidget and MyWidgetProps
MyWidget is a minimal example export that shares the same root theming surface as TradeWidget.
If you are embedding the production trade experience, use TradeWidget. If you need the lightweight demo component that ships with the package, use MyWidget.
MyWidgetProps extends normal root div props.
| Prop | Type | Description |
|---|---|---|
theme | "light" | "dark" | Built-in theme. Default: "light" |
vars | Partial<MyWidgetVars> | Theme token overrides |
className | string | Applied to the widget root element |
style | React.CSSProperties | Inline root styles applied after generated CSS variables |
TradeWidgetProps
TradeWidgetProps extends normal root div props, except the DOM onError prop is replaced by the widget error callback.
| Prop | Type | Description |
|---|---|---|
config | TradeWidgetConfig | Required widget runtime config object |
filters | TradeWidgetFilters | Optional sell-side and buy-side filtering rules |
theme | "light" | "dark" | Built-in theme. Default: "dark" |
vars | Partial<MyWidgetVars> | Theme token overrides |
className | string | Applied to the widget root element |
style | React.CSSProperties | Inline root styles applied after generated CSS variables |
initialSellToken | TradeWidgetTokenSelection | Preselect sell token |
initialBuyToken | TradeWidgetTokenSelection | Preselect buy token |
initialSellNetworkId | number | Preselect sell network |
initialBuyNetworkId | number | Preselect buy network |
lockSellToken | boolean | Prevent changing the sell token |
lockBuyToken | boolean | Prevent changing the buy token |
lockSellNetwork | boolean | Prevent changing the sell network |
lockBuyNetwork | boolean | Prevent changing the buy network |
onQuote | (payload) => void | Quote resolved callback |
onConnect | (payload) => void | Wallet connected callback |
onApprove | (payload) => void | Approval transaction submitted callback |
onSwap | (payload) => void | Swap transaction submitted callback |
onTxSubmitted | (payload) => void | Generic transaction submitted callback |
onTxConfirmed | (payload) => void | Generic transaction confirmed callback |
onError | (payload) => void | Error callback |
TradeWidgetConfig
| Field | Type | Description |
|---|---|---|
apiUrl | string | Delora API base |
rpcUrls | TradeWidgetRpcUrlsByChainId | RPC override map by chain id |
integrator | string | Quote request integrator id |
apiKey | string | Optional Delora API key sent as x-api-key |
fee | number | Quote fee value, range 0..0.1 |
slippage | number | Initial slippage, range 0..1 |
excludeBridges | string[] | Bridge denylist for quote requests |
excludeExchanges | string[] | Exchange denylist for quote requests |
assetBaseUrl | string | Base URL for relative image paths |
termsUrl | string | Terms of Use link in the connect modal |
privacyPolicyUrl | string | Privacy Policy link in the connect modal |
walletConnectProjectId | string | WalletConnect Cloud project id |
apiKey is sent from the browser as an x-api-key header. Do not treat it as a secret.
If termsUrl or privacyPolicyUrl is omitted, the connect modal falls back to:
${window.location.origin}/documentation/termsofuse${window.location.origin}/documentation/privacypolicy
Filters
TradeWidgetStatus
Event payloads
Wallet management types
origin or destination object into TradeWidgetWalletProvider, that side is treated as externally managed. To keep the built-in wallet flow for a side, omit that side from the provider value entirely.
useTradeWidgetWalletManagement is a thin helper hook for reading the same wallet-management context that powers TradeWidgetWalletProvider.
