Send Fees

Fees cover our portion of the smart contract interactions

Fees. To account for the costs of each blockchain, fees must be paid on both the original network and the destination network. This covers SafeSwap's portion of the smart contract interactions.

Find the Current Fees

SafeSwap has an API endpoint that will tell you what the fees need to be. Call this API and then have the user send these fees.

Important: The fees must be sent by the same user who made the Swap in the smart contract in Initiate a Swap.

Get the addresses for SAFESWAP_FEE_ADDRESS_... here, they are the same as the SWAP_ADDRESSES

For Vechain: the fee is to be paid in VTHO, not VET.

Example

const apiResponse = await fetch(`${SWAP_API_URL}/gas-estimate?sourceChain=VECHAIN&targetChain=ETHEREUM`, {
    headers: {
      'Content-Type': 'application/json',
      'X-API-KEY': 'MY_API_KEY'
    }
});

const fees = await apiResponse.json();

const originalChainFee = fees.sourceChain;
const destinationChainFee = fees.targetChain;

const originalTx = await signerOnOriginalChain.sendTransaction({to: SAFESWAP_FEE_ADDRESS_VECHAIN, value: originalChainFee})
const destinationTx = await signerOnDestinationChain.sendTransaction({to: SAFESWAP_FEE_ADDRESS_ETHEREUM, value: destinationChainFee})

const originalFeeTxId = originalTx.hash;
const destinationFeeTxId = destinationTx.hash;

Last updated