Concepts
Fees & channels
LayerHop's fee per channel (web, widget, api, bot), how it is applied through each provider, and how it is reported.
The fee is on top, and shown separately#
LayerHop earns a fee on each trade, charged through the provider's own integrator-fee mechanism. It is always reported on the quote as fees.ourFeeBps — basis points of the input amount — separately from provider fees (fees.providerFeeUsd) and gas (fees.gasUsd). dstAmount already accounts for all of them.
Channels#
The fee depends on where the trade comes from. Pass channel to GET /v1/quote (the SDK sends its channel option, default api).
| Channel | Default fee | Used by |
|---|---|---|
api |
20 bps (0.20%) | Direct API and SDK integrations |
web |
30 bps (0.30%) | The LayerHop web app |
widget |
30 bps (0.30%) | The embeddable widget (/embed) |
bot |
90 bps (0.90%) | The LayerHop Telegram bot |
The defaults come from DEFAULT_FEE_BPS in packages/shared/src/fees.ts. Operators can override each with FEE_BPS_API, FEE_BPS_WEB, FEE_BPS_WIDGET and FEE_BPS_BOT.
When ourFeeBps is lower than the channel fee#
The fee actually applied can be lower — often 0 — because each provider has its own rules:
| Provider | Mechanism | Limits |
|---|---|---|
| Jupiter | Referral fee via a Jupiter referral account | 50–255 bps. Below 50 bps no fee is charged (so api at 20 bps earns 0 on Solana same-chain). Jupiter keeps 20%. |
| Relay | appFees to an EVM address |
Accrues as USDC, claimable on Base. |
| deBridge | Affiliate fee on the source chain | Up to 1000 bps. Paid automatically on EVM; withdrawn manually on Solana. |
| 0x | swapFeeBps taken in the sell token |
Up to 1000 bps. |
| LI.FI | Integrator fee | Only once the integrator is registered with LI.FI; otherwise 0. LI.FI also charges its own fee. |
A fee also needs a configured recipient (FEE_RECIPIENT_EVM, FEE_RECIPIENT_SVM, JUPITER_REFERRAL_ACCOUNT). If the operator has not set one, quotes report ourFeeBps: 0. Trust the number on the quote; it is what the user pays.
Integrator fees#
Coming soon
your own integrator fee on top of LayerHop's (affiliate address + bps) and an earnings dashboard. Today the
integratorparameter on the embed is attribution only.
Fee math#
Amounts are integers in base units, so fees are computed with integer math and rounded down:
import { applyBps, minAfterSlippage } from "@layerhop/shared";
applyBps("100000000", 20); // "200000" → 0.2 USDC of a 100 USDC input
minAfterSlippage("612345678", 50); // "609283949"