Adding Fees
Last updated
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],
// })
}mxpy contract query erd1qqqqqqqqqqqqqpgqcc69ts8409p3h77q5chsaqz57y6hugvc4fvs64k74v --proxy https://gateway.multiversx.com --function getProtocolFeePercent --arguments 0x$(mxpy wallet bech32 --decode [YOUR FEE WALLET])mxpy contract query erd1qqqqqqqqqqqqqpgqcc69ts8409p3h77q5chsaqz57y6hugvc4fvs64k74v --proxy https://gateway.multiversx.com --function getClaimabeProtocolFee --arguments 0x$(mxpy wallet bech32 --decode [YOUR FEE WALLET]) 0 100mxpy contract call erd1qqqqqqqqqqqqqpgqcc69ts8409p3h77q5chsaqz57y6hugvc4fvs64k74v --proxy=https://gateway.multiversx.com --chain=1 --gas-limit=600000000 --pem=[YOUR FEE WALLET PEM FILE] --recall-nonce --send --wait-result --function=claimProtocolFee --arguments 0x$(mxpy wallet bech32 --decode [YOUR FEE WALLET])mxpy contract call erd1qqqqqqqqqqqqqpgqcc69ts8409p3h77q5chsaqz57y6hugvc4fvs64k74v --proxy=https://gateway.multiversx.com --chain=1 --gas-limit=600000000 --pem=[YOUR FEE WALLET PEM FILE] --recall-nonce --send --wait-result --function=claimProtocolFeeByTokens --arguments 0x$(mxpy wallet bech32 --decode [YOUR FEE WALLET]) 0x$(echo -n "WEGLD-bd4d79" | xxd -p -u | tr -d '\n') 0x$(echo -n "USDC-c76f1f" | xxd -p -u | tr -d '\n')