Skip to content
TokenFlight SDK

Token Pre-selection

You can pre-select the source token (fromToken), destination token (toToken), or both, so users land on a ready-to-go screen.

Three formats are accepted anywhere a TokenIdentifier is expected:

app.js
config: {
fromToken: { chainId: 1, address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' },
toToken: { chainId: 8453, address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' },
}

CAIP-10 String (HTML attributes & imperative)

Section titled “CAIP-10 String (HTML attributes & imperative)”
eip155:<chainId>:<contractAddress>
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp:<mintAddress>
index.html
<!-- EVM tokens -->
<tokenflight-widget
to-token="eip155:8453:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
trade-type="EXACT_OUTPUT"
amount="100"
from-token="eip155:1:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
></tokenflight-widget>
<!-- Solana token (USDC on Solana) -->
<tokenflight-widget
to-token="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
trade-type="EXACT_OUTPUT"
amount="100"
></tokenflight-widget>
index.html
<tokenflight-widget
to-token="eip155:8453:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
trade-type="EXACT_OUTPUT"
amount="100"
from-token='{"chainId":1,"address":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"}'
></tokenflight-widget>
CAIP-10 PrefixChain
eip155:1Ethereum
eip155:137Polygon
eip155:42161Arbitrum One
eip155:8453Base
eip155:10Optimism
eip155:56BNB Chain
eip155:43114Avalanche C-Chain
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpSolana

Any EVM eip155:<chainId> reference is accepted — the table above lists chains with built-in shortcuts.

app.js
const widget = new TokenFlightWidget({
container: '#widget',
config: {
toToken: { chainId: 8453, address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' },
tradeType: 'EXACT_OUTPUT',
amount: '100',
theme: 'dark',
fromToken: { chainId: 1, address: '0x0000000000000000000000000000000000000000' },
},
});
widget.initialize();
app.js
const widget = new TokenFlightWidget({
container: '#widget',
config: {
toToken: { chainId: 8453, address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' },
tradeType: 'EXACT_OUTPUT',
amount: '50',
fromToken: 'eip155:1:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
theme: 'dark',
},
});
widget.initialize();
index.html
<tokenflight-widget
to-token="eip155:8453:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
trade-type="EXACT_OUTPUT"
amount="100"
theme="dark"
from-token="eip155:1:0x0000000000000000000000000000000000000000"
></tokenflight-widget>

Use the zero address to refer to a chain’s native token:

ChainNative Address
EVM0x0000000000000000000000000000000000000000
Solana11111111111111111111111111111111