1.2 Cross-chain Quota and Fees

1.2.1. Querying Cross-chain Quota

The available quota for each token must be queried separately. The API endpoint is as follows:

<https://bridge-api.wanchain.org/api/quota?fromChainType=[fromChainType]&toChainType=[toChainType]&symbol=[symbol]>

Use the values returned by the tokenPairs API for fromChainType, toChainType, and symbol in the request parameters.

Example:

https://bridge-api.wanchain.org/api/quota?fromChainType=WAN&toChainType=ARETH&symbol=USDC

Response Example:

{
  "success": true,
  "data": {
    "symbol": "USDC",
    "minQuota": "0",
    "maxQuota": "5000000000"
  }
}

Usage Notes

  • Choose the appropriate chainType based on the desired cross-chain direction.

  • For instance, when transferring from Arbitrum to BSC, set fromChainType=ARETH and toChainType=BNB. Conversely, when transferring from BSC to Arbitrum, use fromChainType=BNB and toChainType=ARETH.

  • The maxQuota value in the response is expressed using the decimals of fromToken.

1.2.2 Querying Cross-chain Fees

The fee API returns two types of fees:

  • networkFee: Charged in the native token of the blockchain (e.g., ETH on Ethereum, BNB on BSC).

  • operationFee: Charged in the token being transferred (e.g., USDT is charged when it is being transferred).

Fee Calculation Rules

  • If isPercent is false, the fee is charged as a fixed amount based on the value field.

  • If isPercent is true, the value represents a percentage and must be multiplied by the transfer amount.

  • When fees are percentage-based, minFeeLimit and maxFeeLimit define the minimum and maximum fee thresholds.

API Endpoint:

<https://bridge-api.wanchain.org/api/fee?fromChainType=[fromChainType]&toChainType=[toChainType]&tokenPairID=[tokenPairID]>

Use the values from tokenPairs for fromChainType, toChainType, and tokenPairID.

Example 1: Querying Fees for USDT Transfer from Arbitrum to Ethereum

<https://bridge-api.wanchain.org/api/fee?fromChainType=ARETH&toChainType=ETH&tokenPairID=191>

Response Example:

{
  "success": true,
  "data": {
    "networkFee": {
      "value": "7000000000000000",
      "isPercent": false
    },
    "operationFee": {
      "value": "0",
      "isPercent": true
    }
  }
}

This means a network fee of 7000000000000000 wei (0.007 ETH) is charged on Arbitrum.

Example 2: Querying Fees for BTC Transfer from Ethereum to Bitcoin

<https://bridge-api.wanchain.org/api/fee?fromChainType=ETH&toChainType=BTC&tokenPairID=14>

Response Example:

{
  "success": true,
  "data": {
    "networkFee": {
      "value": "0",
      "isPercent": false
    },
    "operationFee": {
      "value": "0.006",
      "isPercent": true,
      "minFeeLimit": "35000",
      "maxFeeLimit": "50000000"
    }
  }
}

This means no network fee is charged, and BTC is charged at 0.6% of the transfer amount, with a minimum fee of 35000 satoshis (0.00035 BTC) and a maximum fee of 50000000 satoshis (0.5 BTC).

1.2.3 Aggregated Query for Cross-chain Quota and Fees (quotaAndFee API)

API Endpoint:

https://bridge-api.wanchain.org/api/quotaAndFee?fromChainType=[fromChainType]&toChainType=[toChainType]&tokenPairID=[tokenPairID]&symbol=[symbol]

Example:

<https://bridge-api.wanchain.org/api/quotaAndFee?fromChainType=ETH&toChainType=BTC&tokenPairID=14&symbol=BTC>

Response Example:

{
  "success": true,
  "data": {
    "symbol": "BTC",
    "minQuota": "0",
    "maxQuota": "5061694752",
    "networkFee": {
      "value": "0",
      "isPercent": false
    },
    "operationFee": {
      "value": "0.006",
      "isPercent": true,
      "minFeeLimit": "35000",
      "maxFeeLimit": "50000000"
    }
  }
}

Last updated