freaky.fi
Integrations

Swap Widget

Embed the freaky.fi swap execution interface on your site via iframe or link to it directly.

Overview

The /swap page is a standalone execution interface. It accepts URL parameters to pre-configure the swap and can run in widget mode (no header/footer) for iframe embedding.

Parameters

ParameterDescriptionExample
chainChain ID or name10, optimism, 8453, base
sellToken to sell (symbol or address)USDC, 0xA0b8...
buyToken to buy (symbol or address)ETH, WETH, 0x6B17...
amountSell amount100, 1.5
aAggregator filterkyberswap, cowswap, odos
slippageSlippage tolerance (0-100)0.5, 1
widgetHide header/footer for iframe usetrue
quoteStored quote ID (from CLI/Telegram)a1b2c3d4...

chain, sell, buy, and amount are required unless quote is provided. A stored quote contains all swap parameters.

https://freaky.fi/swap?chain=base&sell=USDC&buy=ETH&amount=100

With a specific aggregator:

https://freaky.fi/swap?chain=optimism&sell=USDC&buy=ETH&amount=50&a=kyberswap

Iframe Embedding

Add widget=true to hide the site header and footer:

<iframe
  src="https://freaky.fi/swap?chain=base&sell=USDC&buy=ETH&amount=100&widget=true"
  width="480"
  height="700"
  frameborder="0"
  allow="clipboard-write"
/>

Execution Flow

The widget guides the user through each step:

  1. Connect wallet - if not connected
  2. Switch chain - if wallet is on the wrong network
  3. Approve - token approval if needed
  4. Sign - for permit-based swaps (CowSwap, 0x Gasless, Permit2)
  5. Execute - submit the transaction

The quote refreshes every 30 seconds to stay current.

Stored Quotes

The CLI and Telegram bot can store a quote on the server and generate a /swap?quote=<id> link. Stored quotes preserve the swap configuration (chain, tokens, amount, aggregator) for 30 minutes. The widget fetches a fresh quote on load and refreshes every 30 seconds to keep pricing current.

On this page