Multichain
  • Getting Started
    • Introduction
      • Supported Chains
      • Supported Tokens
    • How it works
      • Cross-Chain Bridge
      • Cross-Chain Router
    • Governance Token
      • VeMulti
      • How to Convert ANY to MULTI
    • Security
      • Security model
      • Bug bounty (Immunefi)
      • Bug bounty (alternative)
    • How to Use
      • Fees
    • Road Map
    • FAQ
    • Careers
      • Front-end developer
      • Back-end developer
      • Test Engineer
      • Test Development Engineer
      • Security Engineer (Code Auditing)
      • Blockchain Development Engineer
      • Senior Content Editor
      • Event Manager
  • Listing and Integration
    • Token Listing
      • ERC20 Cross-chain Options
      • Difference between V2&V3
    • Chain Integration
      • EVM Networks Integration
      • Non-EVM Networks Integration
    • FAQ
  • Developer Guide
    • How to Integrate Front-end Router
    • Bridge API (Token list/Tx Status)
    • Scan API (Tx Status/Account History)
    • Token Router Testnet
    • anyCall V7
      • How to integrate anyCall V7?
      • API/Explorer
      • Quickstart (Cross-chain text example)
      • Estimate Fee/Pay Fees on destination chain
    • anyCall V6
      • How to integrate anyCall V6?
      • anyFallback
      • anyCall V6 Testnet Environments
      • Fees Paid on Source Chain
      • Context (Verify msg.sender)
    • $USDC CCTP X anyCall
      • Contract Addresses and example
    • anyCall NFT Bridge
    • Permissionless Token bridging
    • How to develop under Anyswap ERC20 standards
    • Bridge funds and anyCall (Router V7)
      • Mainnet
      • Testnet (Quick Start Example)
    • How to Integrate Front-end Bridges
Powered by GitBook
On this page
  • Token Information End point:
  • Tx Status Endpoint:
  • How to integrate the router contract
  • Liquidity Pool Model
  1. Developer Guide

Bridge API (Token list/Tx Status)

PreviousHow to Integrate Front-end RouterNextScan API (Tx Status/Account History)

Last updated 2 years ago

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:

  1. To query token and router contract information.

  2. To query cross-chain tx status

Token Information End point:

(new)

You can replace "all" with a specific chain id. Such as:

Get all chain ids list from this endpoint:

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:

{
  "chainId" : "chainId", // Source Chain ID
  "address": "address", //  token address
  "name": "name", // token name
  "symbol": "symbol", // token symbol
  "decimals": "decimals", // token decimals
  "price" : "price",  // token price
  "logoUrl" : "logoUrl", // token logo url
  "tokenType": "tokenType", // This is either "NATIVE" for native gas token or "TOKEN" for all other tokens
  "destChains": { // An object with all possible destination chains as keys.
    "chainId": { // Destination Chain ID
      "key": { // Unique hash for each pair
        "address": "address", // Destination token address
        "name": "name", // Destination token name
        "symbol": "symbol", // Destination token symbol
        "decimals": "decimals", // Destination token decimals
        "anytoken": { // Destination anytoken information
          "address": "address", // 
          "symbol": "symbol", // 
          "decimals": "decimals", // 
        },
        "fromanytoken": { // Source Chain anytoken information
          "address": "address", // 
          "symbol": "symbol", // 
          "decimals": "decimals", // 
        },
        "underlying": { // Destination underlying information, if it doesn't exist, return false.
          "address": "address", // 
          "symbol": "symbol", // 
          "decimals": "decimals", // 
        },
        "type": "type", // The type of bridge tx. It would say router for most tokens. And it'd say swapin or swapout for older V2 setup.
        "router": "router", // router address. The address you interace with.
        "tokenid": "tokenid", // tokenid
        "routerABI": "routerABI", // The abi and function you cal to bridge this token.
        "isLiquidity": "isLiquidity", // If liquidity is needed.
        "isApprove": "isApprove", // Is approval needed.
        "isFromLiquidity": "isFromLiquidity", // Is source chain liquidity shown on frontend.
  
        "BigValueThreshold": "BigValueThreshold", // Big value threshold. It'd take longer over this threshold.
        "MaximumSwap": "MaximumSwap", // Maximum amount to bridge
        "MaximumSwapFee": "MaximumSwapFee", // 
        "MinimumSwap": "MinimumSwap", // Minimal amount to bridge. Lower than this won't be processed.
        "MinimumSwapFee": "MinimumSwapFee", // 
        "SwapFeeRatePerMillion": "SwapFeeRatePerMillion", // % of fee. 0.1 means 0.1% fee of the total amount.
  
        "pairid": "pairid", // pairid
        "DepositAddress": "DepositAddress", // Deposit address for older V2 bridge setup.
        "BaseFeePercent": "BaseFeePercent", // Fee percentage for V2 bridge.
        "sortId": "sortId", //
        "chainId": "chainId", // chainId
        "tokenType": "tokenType", // token type.
      }
    }
  }
}

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

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.

Please check

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://bridgeapi.multichain.org/v4/tokenlistv4/
all
https://bridgeapi.anyswap.exchange/v4/tokenlistv4/all
https://bridgeapi.anyswap.exchange/v4/tokenlistv4/1
https://bridgeapi.anyswap.exchange/data/bridgeChainInfo
https://scan.multichain.org/#/tx?params=0x8318755719c85110c3c95b635392a380b11c9dd58ae3cedcbc9c5607e3f40df3
https://github.com/anyswap/CrossChain-Router/wiki/How-to-integrate-AnySwap-Router#cross-chain-steps
https://ftmscan.com/address/0x95bf7e307bc1ab0ba38ae10fc27084bc36fcd605