Bridge API (Token list/Tx Status)
This section explains the Multichain api and how to interact with it. This api organizes data about bridge pairs, router contracts ,tx status and more.
There are two api endpoints you can use:
To query token and router contract information.
To query cross-chain tx status
Token Information End point:
https://bridgeapi.multichain.org/v4/tokenlistv4/all (new)
https://bridgeapi.anyswap.exchange/v4/tokenlistv4/all
You can replace "all" with a specific chain id. Such as: https://bridgeapi.anyswap.exchange/v4/tokenlistv4/1
Get all chain ids list from this endpoint: https://bridgeapi.anyswap.exchange/data/bridgeChainInfo
Architecture:
Multichain Router has three parts:
Underlying token address: it's the native token you're bridging.
anyToken contract: it's a wrapped LP token for the native token, used as a liquidity pool to hold the native token.
Router contract: The contract you interact with for cross-chain swaps.
Sample Response and Explanation:
Tx Status Endpoint:
Get transaction status from this API (updated every 5s)
Code | Status |
---|---|
0 | Pending |
3 | ExceedLimit (LessThenMinAmount) |
8 | Confirming |
9 | Swapping |
10 | Success |
12 | BigAmount(Wait24hours) |
14 | Failure |
How to integrate the router contract
Please check https://github.com/anyswap/CrossChain-Router/wiki/How-to-integrate-AnySwap-Router#cross-chain-steps
Liquidity Pool Model
Router front-end needs to check the dest chain's underlying token liquidity. If the liquidity of the dest chain is insufficient, users will receive anyUSDC LP token, then user needs to check the balance in the liquidity pool and redeem USDC from the pool when has enough underlying liquidity.
Take USDC as an example, if the user wants to bridge USDC to Fantom, front-end needs to check the underlying USDC balance on anyUSDC(Fantom) contract: https://ftmscan.com/address/0x95bf7e307bc1ab0ba38ae10fc27084bc36fcd605
Last updated