Skip to main content
Earn revenue on every swap by adding integrator fees. Fees are specified in basis points and sent directly to your recipient address on-chain.

Parameters

integratorFees
bigint
required
Fee in basis points as bigint (10n = 0.1%, 100n = 1%)
integratorFeeRecipient
string
required
Address to receive fee payments
integratorName
string
required
Your protocol/platform identifier (for analytics)

SDK Example

import { getQuotes, executeSwap } from '@avnu/avnu-sdk';
import { parseUnits } from 'ethers';

const quotes = await getQuotes({
  sellTokenAddress: ethAddress,
  buyTokenAddress: usdcAddress,
  sellAmount: parseUnits('1', 18),
  takerAddress: account.address,
  integratorFees: 10n, // 0.1% (10 bps)
  integratorFeeRecipient: '0xYourFeeRecipientAddress',
  integratorName: 'YourProtocolName',
});

// Execute swap with fees
const result = await executeSwap({
  provider: account,
  quote: quotes[0],
  slippage: 0.001,
});

console.log('Swap executed:', result.transactionHash);

How It Works

Fee Calculation:
  • Fees are specified in basis points (bps)
  • Transferred directly to your recipient address on-chain
Fee Token Selection: The contract automatically selects the best token to collect fees using an on-chain priority mechanism. Stablecoins are preferred, followed by major assets (ETH, wstETH, WBTC, STRK, etc.).
The fee token is selected automatically based on the swap route - you don’t need to specify it.

Best Practices

Setting your integrator name helps with:
  • Analytics and volume tracking
  • Support and troubleshooting
  • Potential partnership opportunities