@velora-dex/widget. For task-oriented walkthroughs, see Configure, Wallet management, Monetize, and Events & callbacks.
Public exports
Everything below can be imported from@velora-dex/widget:
ApiConfig is not re-exported by name even though it’s the shape of the apiConfig prop. Infer it via WidgetProps["apiConfig"] if you need a named type.<Widget /> props
WidgetConfig
ApiConfig
EIP1193ProviderLax
Many wallets don’t satisfy viem’s strict EIP1193Provider signature, so the widget accepts a looser shape:
widgetMode: "dapp". See Wallet management.
FormInputProps
Pre-populate the form on mount, useful for deep links and programmatic control.
selectedForm
"swap" | "limit" | "otc" | "twap" — defaults to "swap". Corresponds to tradeMode in events.
tokenFromAddress
Address — the source-token address to pre-select. Pair with srcChainId.
srcChainId
SupportedChainId — chain for the source token. Required when tokenFromAddress is provided.
tokenToAddress
Address — the destination-token address to pre-select. Pair with destChainId (or omit for same-chain).
destChainId
SupportedChainId — chain for the destination token. Only functional when selectedForm is "swap" (crosschain). For limit and OTC, it’s forced to match srcChainId.
sendAmount
string — initial amount to send, in token units (not wei). Must parse as a number.
receiveAmount
string — initial amount to receive, in token units. Mutually exclusive with sendAmount for the same trade-side.
side
"BUY" | "SELL" — only for selectedForm: "swap" or "twap". If omitted, defaults to "SELL" when sendAmount is set and "BUY" when receiveAmount is set. If both or neither amounts are present, the user’s UI selection wins.
orderDeadline
string — Unix timestamp (seconds), as a numeric string. Only functional when selectedForm is "limit" or "otc". For Delta Limit Orders, the minimum recommended expiry is now + 10 minutes. For OTC, "0" means no expiry. The widget doesn’t reject invalid values at prop time — they surface in the trade flow.
For native ETH, pass the special address
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE".WidgetEventCallbacks
{ event, state } where event is a discriminated union on event.name and state is a snapshot of the full widget state.
Detailed sub-event names, params, and lifecycle ordering live on Events & callbacks.
defaults
Related pages
- Configure —
WidgetConfigfield walkthroughs. - Wallet management —
widgetMode,provider, optional Privy connector. - Monetize —
partnerConfig,referrerConfig. - Events & callbacks — per-callback sub-events and params.