Skip to content

App fees

There are two parameters, and you can use either or both:

  • fees charges your own fee on the swap, split between up to 4 accounts.
  • referrer_id passes your account to DEXs that track referrals or pay a share of their own fees. Without it, the aggregator’s own account dex-aggregator.intear.near is used.

Add fees to your requests: a JSON object of the accounts to pay and the fee each one charges, as a fraction of the swap, where 0.005 is 0.5%. URL-encode it:

https://router.intear.tech/route?token_in=near&token_out=nep141:usdt.tether-token.near&amount_in=1000000000000000000000000&slippage_type=Fixed&slippage=0.01&fees=%7B%22alice.near%22%3A0.005%2C%22bob.near%22%3A0.001%7D

That’s {"alice.near":0.005,"bob.near":0.001}: 0.5% to alice.near and 0.1% to bob.near.

  • Up to 4 accounts, charging up to 5% together, each fee in steps of 0.000001 (0.0001%). Requests over the limits are rejected with a 400 error. A fee of 0 charges nothing.
  • The fee is charged once, on the input, on every DEX.
  • Each account gets 80% of its fee, and 20% goes to the aggregator (dex-aggregator.intear.near).
  • The fee is set per request, so each app or user can pay a different one. Nothing is stored, and there’s nothing to set up first.
  • Routes register the accounts to receive the input token where they need it, and the trader pays for that storage, in the quote’s storage_deposits. So the first swap of a token that pays an account can cost a little more.

Where the fee goes depends on the DEX:

DEX How it’s charged Paid to What the route registers
IntearDex, Plach Intear DEX takes it out of the swap’s input, before the DEX gets the rest The account’s Intear DEX inner balance of the input token, which it withdraws to its wallet The input token on Intear DEX, with register_assets. Only with trader_account_id: without it, an account that doesn’t have the token registered isn’t paid, and the trader keeps its fee
Rhea, Rhea DCL An ft_transfer of the input token in a fee transaction after the swap The account’s wallet, NEAR as wNEAR Storage on the token contract (wrap.near for NEAR), in the fee transaction
Rhea, from and to Rhea balances (rhea-nep141:) An mft_transfer in the same transaction as the swap The account’s Rhea inner balance Storage on Rhea for the token, in the same transaction
Wrap Not charged — —

On IntearDex and Plach, the fee is in the swap’s input token, NEAR included. On Rhea and Rhea DCL, NEAR is wrapped whole, so its fee is paid in wNEAR. dex.intea.rs/developers shows what an account collected on each DEX, and withdraws it to its wallet.

On Rhea and Rhea DCL, the fees go out in fee transactions, marked with is_fee_transaction: true, at the end of the route. A failed swap still lets its transaction succeed, so send them only if /route/outcome of the transactions before them says charge_fee: true. The swap is done at that point, so your app can show it as complete right away. The Rhea route from and to Rhea balances is the exception: its mft_transfers are in the swap’s own transaction, so they’re paid only if the swap succeeds. IntearDex and Plach routes have no fee transactions: Intear DEX pays the fees in the swap itself, and lists them in its swap event.

Every fee transfer, ft_transfer and mft_transfer, carries the memo Trading fee (<referrer_id>), with the request’s referrer_id, or dex-aggregator.intear.near without one. Explorers show it along with the transfer.

referrer_id=<your account> is passed to all DEXs and can be tracked with trade-indexer or Developers page on Intear DEX (tracks all DEXs, not only Intear DEX).