The Single-step API provides two endpoints for getting a quote and creating transactions, quote and swap endpoints.
In the quote endpoint, you should include the referrerFee field, which represents the fee amount you want to charge the user as a percentage (1.12 means 1.12 percent). Note that the maximum amount fee you could charge the user is 3 percent. It is required to calculated quote fee correctly for the user. The default fee is 10 bps or 0.1 percent.
In the swap endpoint, you should pass both referrerAddress and referrerFee fields. The referrerFee is the same as the field in quote endpoint, and the referrerAddress is the wallet address which you wish to receive your collected fees.
For the referrerAddress, you can use EVM, Starknet, or Osmosis wallet addresses depending on the route. While we also support fee charging on the Solana blockchain, this feature is not yet available for all dApps due to its complexity and is not ready for public use.
Here is a sample code for setting affiliate fee parameters in quote method:
constquote=awaitrango.quote({ from: {"blockchain":"BSC","symbol":"BNB","address":null}, to: {"blockchain":"AVAX_CCHAIN","symbol":"USDT.E","address":"0xc7198437980c041c805a1edcba50c1ce5db95118"}, amount:"100000000000000000",// 0.1 BSC.BNB slippage:"1.0", referrerFee:"0.1"// charge users 0.1% fee for the input token })