4️⃣Check Status

Checking Transaction Status

After signing the transaction by the user and receiving transaction hash, you could periodically call Rango check-status API to track the transaction status. In Rango, each swap step could have 3 different states: running, failed and success. You only need to keep checking the status until you find out whether the transaction failed or succeeded.

Here's a sample request for the check-status API, along with the corresponding response it receives:

const transaction = await rangoClient.status({
    requestId: "b3a12c6d-86b8-4c21-97e4-809151dd4036",
    txId: '0xfa88b705a5b4049adac7caff50c887d9600ef023ef1a937f8f8b6f44e90042b5',
})

And in response you get:

{
  "status": "success",
  "error": null,
  "diagnosisUrl": null,
  "explorerUrl": [
    {
      "url": "https://polygonscan.com/tx/0xfa88b705a5b4049adac7caff50c887d9600ef023ef1a937f8f8b6f44e90042b5",
      "description": "swap"
    }
  ],
  "output": {
    "amount": "99668",
    "receivedToken": {
      "blockchain": "POLYGON",
      "symbol": "USDT",
      "name": null,
      "isPopular": false,
      "chainId": "137",
      "address": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
      "decimals": 6,
      "image": "https://api.rango.exchange/tokens/ETH/USDT.png",
      "blockchainImage": "https://api.rango.exchange/blockchains/polygon.svg",
      "usdPrice": null,
      "supportedSwappers": []
    },
    "type": "DESIRED_OUTPUT"
  },
  "bridgeData": {
    "srcChainId": 137,
    "srcTxHash": "0xfa88b705a5b4049adac7caff50c887d9600ef023ef1a937f8f8b6f44e90042b5",
    "srcToken": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
    "srcTokenAmt": "100000",
    "srcTokenDecimals": 6,
    "srcTokenPrice": "1.001",
    "destChainId": 137,
    "destTxHash": null,
    "destToken": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
    "destTokenDecimals": 6,
    "destTokenAmt": "99668",
    "destTokenPrice": "0.999992"
  }
}

Output Token

When your transaction status is marked as successful, it indicates that the bridge or swap process has been successfully completed, and the user has received the intended DESIRED_OUTPUT token as part of the output. In the context of a cross-chain swap, the process combines up to three transactions ([dex]+bridge+[dex]) into a single transaction. Consequently, several scenarios could arise if a user ends up receiving a token that differs from their initial expectation. These cases encompass:

  • REVERTED_TO_INPUT If user transaction reverted on first dex step, transaction will be reverted on the blockchain and user will receive back the input token.

  • MIDDLE_ASSET_IN_SRC If the dex step succeeded but the bridge step failed because of slippage or lack of liquidity or ...

  • MIDDLE_ASSET_IN_DEST If the [dex]+bridge step succeeded but, the last dex step failed because of slippage.

Bridge Data

Currently this section is only filled for EVM-to-EVM routes which contains both data of inbound and outbound transactions/tokens.

Explorer URL

This field contains the list of the URLs for this route which contains swap transaction for an on-chain route and inbound/outbound transaction for a cross-chain route.

Diagnosis URL

If a transaction becomes stuck within a bridge, requiring user intervention to initiate a refund through the bridge's user interface, we offer a diagnosis URL. This URL directs the user to a guide detailing the steps they need to take in order to successfully refund their tokens.

Last updated