@deloraprotocol/widget and the optional @deloraprotocol/widget-wallet-management adapter package.
Most integrations center on the trading widget surface:
TradeWidgetTradeWidgetWalletProvideruseTradeWidgetWalletManagement
MyWidget demo component and shared theming props.
@deloraprotocol/widget 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 |
MyWidgetVars fields include:
radiusfor shared surface radiusactionButtonRadiusfor the main CTA radiusfontFamily,fontSize,lineHeight, andletterSpacingfor typography- color and surface tokens such as
bg,fg,border,surface, andsurfaceAlt
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 | Optional Delora API base. If omitted, the widget uses https://api.delora.build. You can point this to your own backend proxy. |
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. Recommended only for trusted environments. |
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 directly from the client. Keep it on your backend and proxy /v1/chains, /v1/tokens, /v1/tools, and /v1/quotes through config.apiUrl.
If your proxy does not serve Delora-relative image assets, set assetBaseUrl explicitly or proxy those asset paths as well.
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.
@deloraprotocol/widget-wallet-management exports
This package is optional. Install it when you want Delora to reuse wallet state from common host wallet libraries instead of writing a TradeWidgetManagedWallet object by hand.
Subpath exports:
| Import | Exports |
|---|---|
@deloraprotocol/widget-wallet-management/provider | DeloraWalletManagementProvider, DeloraWalletManagementProviderProps |
@deloraprotocol/widget-wallet-management/auto | DeloraAutoWalletManagementProvider, DeloraAutoWalletManagementProviderProps |
@deloraprotocol/widget-wallet-management/wagmi | useWagmiManagedWallet, UseWagmiManagedWalletOptions |
@deloraprotocol/widget-wallet-management/solana | useSolanaWalletAdapterManagedWallet, UseSolanaWalletAdapterManagedWalletOptions |
@deloraprotocol/widget-wallet-management/composite | useCompositeManagedWallet, UseCompositeManagedWalletOptions |
DeloraOpenConnectModalDeloraOpenConnectModalParamsManagedWallet
DeloraWalletManagementProvider
DeloraWalletManagementProvider is a convenience wrapper around TradeWidgetWalletProvider.
origin or destination is omitted, that side receives wallet. Pass explicit origin and destination when sell-side and receiver-side wallet ownership should differ.
DeloraAutoWalletManagementProvider
DeloraAutoWalletManagementProvider detects host Wagmi and Solana Wallet Adapter contexts and wires them into the widget.
usePartialWalletManagement:trueforceInternalWalletManagement:false
evm={false} or solana={false} to opt out of one namespace. Set forceInternalWalletManagement to ignore all detected host contexts.
useWagmiManagedWallet
TradeWidgetManagedWallet for the EVM namespace. It reads account state from Wagmi, resolves an EIP-1193 provider from the active connector, and delegates connect and disconnect actions to Wagmi.
useSolanaWalletAdapterManagedWallet
TradeWidgetManagedWallet for the SVM namespace. It reads account state from Solana Wallet Adapter and exposes a Solana provider wrapper for transaction signing.
useCompositeManagedWallet
TradeWidgetManagedWallet. It sets managedNamespaces, fills walletsByNamespace, merges wallet options, and routes connect/provider calls to the namespace-specific adapter.
Shared connect modal types
openConnectModal when the Delora connect button should open a host wallet modal, such as RainbowKit or Solana Wallet Adapter UI.
