📃Chainge 2.0 API Documentation

In 2.0, Submit order request is deprecated. Now you need to call contract ABI's for a swap order.

  1. Supported Chains & Tokens

Get Chainge Supported Chains

GET https://api2.chainge.finance/v1/getChain

{
  "code": 0,
  "data": {
    "version": 0,
    "list": [...]
  },
  "msg": "string",
}

Get Chainge Supported Tokens

GET https://api2.chainge.finance/v1/getAssets

{
  "code": 0,
  "data": {
    "version": 0,
    "list": [...]
  },
  "msg": "string",
}

Get Chainge Supported Tokens for a specified chain

GET https://api2.chainge.finance/v1/getAssetsByChain

Query Parameters

{
  "code": 0,
  "data": {
    "version": 0,
    "list": [...]
  },
  "msg": "string",
}
  1. Quote

Get a quote for a cross chain transaction

GET https://api2.chainge.finance/v1/getBridgeQuote

Query Parameters

{
    "code": 0,
    "msg": "success",
    "data": {
        "price": "2959.73491527866",
        "outAmount": "1000000000000000000",
        "outAmountUsd": "2959.734915278660082549",
        "serviceFee": "500000000000000",
        "gasFee": "101360428750341"
    }
}

Get a quote for a cross chain aggregator transaction

GET https://api2.chainge.finance/v1/getAggregateQuote

Query Parameters

{
    "code": 0,
    "msg": "success",
    "data": {
        "chain": "1", 
        "chainDecimal": 18,
        "aggregator": "1inch",
        "outAmount": "2979357481475661701461",
        "outAmountUsd": "2936.584874",
        "minOutAmount": "",
        "serviceFee": "0",
        "gasFee": "13633955537026351104",
        "priceImpact": "-0.40"
    }
}
  1. Swap

Get direct exchange trading information

GET https://api2.chainge.finance/v1/getAggregateSwap

Query Parameters

{
    "code": 0,
    "msg": "success",
    "data": {
        "amountOut": "84640",
        "from": "0xbda05e4421bf7e682635b7b18978f2dad4ecc059",
        "to": "0x62bc5327868a998e1b3d9fe6037273e642a137ae",
        "gas": "0",
        "value": "0",
        "data": "0x38ed17390000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000001475200000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000bda05e4421bf7e682635b7b18978f2dad4ecc0590000000000000000000000000000000000000000000000000000000065d9d6140000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ab1f7e5bf2587543fe41f268c59d35da95f046e00000000000000000000000008a20c13b42d7fe418f10f922f2cee06246c24269"
    }
}
  1. Order

Submit order

POST https://api2.chainge.finance/v1/submitOrder

Headers

Request Body

{
    "code": 0,
    "msg": "success",
    "data": {
        "id": "19026",
    }
}

Check order status

GET https://api2.chainge.finance/v1/checkOrder

Query Parameters

{
    "code": 0,
    "msg": "success",
    "data": {
        "status": "Succeeded",
        "timestamp": 1708675586,
        "execHash": "0x5bc094751492e27d9e32f388432b943dbf19388ea3b6091bac5c0722a90d4f86",
        "reason": "",
        "amountOut": "4897500"
    }
}
  1. Other helpful APIs

Get user balance

GET https://api2.chainge.finance/v1/getBalance

Query Parameters

{
    "code": 0,
    "msg": "success",
    "data": {
        "balance": "0",
        "hrpBalance": "0"
    }
}

Get token price

GET https://api2.chainge.finance/v1/getPrice

Query Parameters

{
    "code": 0,
    "msg": "success",
    "data": {
        "price": "382.09024375746236",
        "updateTime": "2024-02-22 18:29:06.444159295 +0800 GMT",
        "source": "cmc"
    }
}
  1. Ticket

Submit ticket

POST https://api2.chainge.finance/v1/submitTicket

Headers

Request Body

{
    "code":0,
    "msg":"success",
    "data":{
        "ticketId":10000464
    }
}

Get tickets for user address

GET https://api2.chainge.finance/v1/getAllTicketByAddress

Query Parameters

{
    "code": 0,
    "msg": "success",
    "data": {
        "list": [
            {
                "ticketId": 10000175,
                "address": "0x42a6685ef29886Cbcb595Aa903f00dea0d1787d8",
                "chain": "POLYGON",
                "hash": "0xd1c5fd95357b651c871e72d396500d97e7bf8208589624f58502162a58e26a5f",
                "succeeded": true,
                "solution": "refund"
            }
        ]
    }
}

Check ticket status

GET https://api2.chainge.finance/v1/checkTicket

Query Parameters

{
    "code": 0,
    "msg": "success",
    "data": {
        "succeeded": true,
        "solution": "refund"
    }
}

Last updated