There are no protocol fees for AshSwap Aggregator or platform fees on AshSwap UI, however, UI providers may implement platform fees. If a platform fee is set, AshSwap will take 10% of the platform fees charged by integrators.
First, register with us the wallet you use for collecting the fees and the fees you would like to set for your platform. Then, use that wallet as the protocol argument in your integration.
const swapWithPaths = async () => {
const integrator = 'erd...'; // your fee wallet
const agService = new Aggregator({chainId: ChainId.Mainnet, protocol: integrator});
// use the response to display on the UI
const sorswap = await agService.getPaths('EGLD', 'ASH-a642d1', 1e18);
if (!sorswap) throw new Error(`Could not find any paths for EGLD to ASH`);
const interaction = await agService.aggregateFromPaths(sorswap, 100);
// remember to set the sender (caller) before sending the tx
const tx = interaction.withSender(new Address('erd...')).check().buildTransaction();
// sign and send tx to the network
// sendTransactions({
// transactions: [tx],
// })
}
Fees are taken from token inputs, so over time, fees can consist of multiple tokens, so we allow you to query by indexes. The numbers 0 and 100 at the end of the query are the start index and end index, respectively.
When the number of fee tokens is too large, to make sure the transaction doesn't go over the gas limit or it doesn't make sense economically to claim small fee tokens, you can claim fees by tokens.