TokenFlight
Open app

Options

Everything you can set, grouped by what it is for.

All of these are passed to new TokenFlightWidget({ … }), the first three directly and the rest inside config. Only the first three are required.

Set up

Option
containerElement or selector the frame is placed in.
walletAdapterYour site's wallet. See Wallet.
pageUrlThe address of a deployment of the page that allows your origin. https, or http on localhost.

Start from a pair

config
fromToken, toTokenWhere to start. A CAIP-10 string like eip155:8453:0x… or { chainId, address }. EVM tokens only.
amountDecimal text, for example "10.50". The user can change it.
tradeTypeEXACT_INPUT (amount is what is paid, the default) or EXACT_OUTPUT (amount is what is received; then it is fixed).
orderIdOpen this order's tracking view instead of the form.

Fix an address or a token

By default the user can change everything. These keep what you set.

config
recipientWhere the converted funds go (default: the connected wallet). Once set, the user cannot change it.
recipientEditabletrue lets the user change a preset recipient.
refundToWhere a refund goes (default: the connected wallet). Once set, the user cannot change it.
refundToEditabletrue lets the user change a preset refundTo.
lockFromToken, lockToTokenKeep fromToken / toToken as given: that picker is closed and the direction cannot be swapped.

Look

config
themeauto (the default), light or dark.
customColorsColours, radii, shadows and font. See Styling.
noBackground, noBorderDrop the card's fill / its edge so your own background shows through.
hidePoweredByHide the "Powered by TokenFlight" line. Shown by default.
showWalletSet false to hide the page's own connect button when your site already has one (default true).

More

Option
readyTimeoutMsHow long to wait for the page (default 15 000).
lazytrue creates the frame only when the container is about to scroll into view. For a widget placed below the first screen.
minHeight, maxHeightBounds for the frame's height in px. Above maxHeight the page scrolls inside the frame.
localeAccepted, but the page is English only; any other language logs a console warning.

Change it later

ts

widget.update({ config: { amount: "25", theme: "dark" } }); // only the keys you pass change
widget.destroy(); // remove the frame

showWallet, locale and the wallet adapter are read once, when you call initialize(); to change them, destroy the widget and create it again. Options from tokenflight-embed that this widget does not have (referrer, methods, fromTokens, ...) are ignored, with a console warning.