📃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

Name
Type
Description

chain*

String

chain name string from getChain API

{
  "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

Name
Type
Description

amount*

String

User input quantity(Ex: 100000, 1 USDT)

symbol*

String

from token symbol from supported Tokens API request result

fromChain*

String

from chain nickName from supported Chains API request result

toChain*

String

from chain nickName from supported Chains API request result

{
    "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

Name
Type
Description

fromAmount*

String

User input quantity(Ex: 100000, 1 USDT)

fromTokenAddress*

String

from token contract address from supported Tokens API request result

fromDecimal*

String

from token contract decimal from supported Tokens API request result

fromChain*

String

from chain nickName from supported Chains API request result

toTokenAddress*

String

from token contract address from supported Tokens API request result

toDecimal*

String

from token contract decimal from supported Tokens API request result

toChain*

String

from chain nickName from supported Chains API request result

{
    "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

Name
Type
Description

fromAmount*

String

User input quantity(eg: 100000, 1 USDT)

fromTokenAddress*

String

from token contract address from supported Tokens API request result

fromDecimal*

String

from token contract decimal from supported Tokens API request result

toTokenAddress*

String

from token contract address from supported Tokens API request result

toDecimal*

String

from token contract decimal from supported Tokens API request result

chain*

String

from chain nickName from supported Chains API request result

aggregator

String

from Aggregator Quote API request result

sender*

String

User address

recipient*

String

Receiver address

slippage*

String

slippage(eg: 100 === 1%)

allowPartialFill*

Boolean

true

routeSummary

String

from Aggregator Quote API request result

{
    "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

Name
Type
Description

Evmaddress*

String

Current user address

Signature*

String

Signature info

Request Body

Name
Type
Description

channel*

String

Apply to Chaing.Finance

execStrategy*

String

Default Value: ""

extra*

String

Default Value: ""

orderType*

String

Cross Chain: 1

Aggregate:2

slippage*

String

Cross Chain: 0

Aggregate: (eg: 100 == 1%)

sourceCerts*

String

Order information,Hex string

timeout*

String

Default: 0

toAddr*

String

Receiver address

toChain

String

from supported Chains API request result

toIndex*

String

from token index from supported Tokens API request result

triggerPrice*

String

Default: 0

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

Check order status

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

Query Parameters

Name
Type
Description

id*

String

from Submit order API request result

{
    "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

Name
Type
Description

chain*

String

from supported Chains API request result

contractAddress*

String

from supportd Tokens API request result

address*

String

user address

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

Get token price

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

Query Parameters

Name
Type
Description

chain*

String

from supported Chains API request result

contractAddress*

String

from supportd Tokens API request result

symbol*

String

from supportd Tokens API request result

{
    "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

Name
Type
Description

EvmAddress*

String

User address

Signature*

String

Signature Info

Request Body

Name
Type
Description

hash

String

Problematic transaction hash

chain

String

from supported Chains API request result

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

Get tickets for user address

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

Query Parameters

Name
Type
Description

address*

String

user address

filter*

String

status(eg: Unknown, Pending, Succeeded)

{
    "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

Name
Type
Description

ticketId*

String

from getAllTicketByAddress Api return result

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

Last updated