Wallet
Pass the wallet your site already uses.
Pass the wallet your site already uses as walletAdapter. Pick the line that matches it; the adapters are the same ones the @tokenflight/swap widget takes.
ts
// Already use wagmi?
import { createWagmiAdapter } from "@tokenflight/adapter-wagmi";
const walletAdapter = await createWagmiAdapter({ wagmiConfig });
// Reown AppKit?
import { createAppKitAdapter } from "@tokenflight/adapter-appkit";
const walletAdapter = await createAppKitAdapter({ appKit });
// ethers, or any EIP-1193 provider?
import { EthersWalletAdapter } from "@tokenflight/adapter-ethers";
const walletAdapter = new EthersWalletAdapter(window.ethereum);
// No library at all, just window.ethereum?
import { eip1193Adapter } from "@tokenflight/widget";
const walletAdapter = eip1193Adapter(window.ethereum);If your adapter knows which chains the wallet supports, the widget offers only source tokens on those chains. With eip1193Adapter you can say so: eip1193Adapter(window.ethereum, { supportedChainIds: [1, 8453] }).
Only EVM wallets are supported as the source of a conversion.
Writing your own adapter
Only if none of the above fits. It needs connect, disconnect, isConnected, getAddress, executeWalletAction and on / off; getCurrentChainId, name and supportedChainIds are optional. The widget asks it for four EIP-1193 requests only: wallet_switchEthereumChain, wallet_addEthereumChain, eth_sendTransaction (from the connected account) and eth_chainId.