REF Finance
Supported Chains
Available on Near Mainnet and Testnet
Available Endpoints:
Click on the endpoint to jump to the section with full details
/getprice
GET- Returns the swap quotation for a given token pair on Cetus./getuserliquidity
GET- Returns the balance of a particular token pair of accounts./getpoolliquidity
GET- Returns the total liquidity for a specified pool./gettokenliquidity
GET- Returns the individual token liquidity within the specified liquidity pool./swap
POST- Initiate a swap transaction on a specified DEX./addliquidity
POST- Add liquidity to a specified pool in a specified DEX./removeliquidity
POST- Remove liquidity from a specified pool for a specified DEX.
DEX IDs
Many endpoints have a parameter where you can provide a DEX ID.
Below is a list of DEX IDs related to Cetus. For a complete list and more information, please see the DEX ID page.
REF Finance
Near Mainnet
3400
REF Finance
Near Testnet
3401
Endpoint Details
/getprice
Returns the swap quotation for a given token pair.
GET https://api.expand.network/dex/getprice
Query Parameter
rpc
String
Remote procedural call URL.
amountIn*
String
Amount of token.
path*
String
Comma separated values of token addresses whose price is to be fetched.
https://api.expand.network/dex/getprice?path=17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1%2Cwrap.near&amountIn=100000000&dexId=3400{
"status": 200,
"msg": "success",
"data": {
"amountIn": "100000000",
"path": [
"17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1",
"wrap.near"
],
"amountsOut": [
"100000000",
"31456689936699508113692653"
]
}
}/getuserliquidity
Returns the balance of a particular token pair of an account.
GET https://api.expand.network/dex/getuserliquidity
Query Parameter
rpc
String
Remote procedural call URL.
address*
String
Public address of liquidity provider.
poolAddress*
String
Pool address whose liquidity is to be fetched.
https://api.expand.network/dex/getuserliquidity?poolAddress=17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1%7Cwrap.near%7C100&address=g20_dex.near&dexId=3400{
"status": 200,
"msg": "success",
"data": {
"pairAddress": "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1|wrap.near|100",
"liquidity": "7123964496422730"
}
}/getpoolliquidity
Returns the total liquidity for a specified pool.
GET https://api.expand.network/dex/getpoolliquidity
Query Parameter
rpc
String
Remote procedural call URL.
poolAddress*
String
Pool address whose liquidity is to be fetched.
https://api.expand.network/dex/getpoolliquidity?poolAddress=17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1%7Cwrap.near%7C100&dexId=3400{
"status": 200,
"msg": "success",
"data": {
"totalLiquidity": "492779401499816349"
}
}/gettokenliquidity
Returns the individual token liquidity within the specified liquidity pool.
GET https://api.expand.network/dex/gettokenliquidity
Query Parameter
rpc
String
Remote procedural call URL.
poolAddress*
String
Pool address whose liquidity is to be fetched.
https://api.expand.network/dex/gettokenliquidity?poolAddress=17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1%7Cwrap.near%7C100&dexId=3400{
"status": 200,
"msg": "success",
"data": {
"17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1": "816215156745",
"wrap.near": "553177251133018373561114031157"
}
}/swap
Initiate a swap transaction on a specified DEX.
POST https://api.expand.network/dex/swap
Request Body
rpc
String
Remote procedural call URL.
path*
String
Comma separated values of token addresses.
amountIn*
String
Amount of token to be swapped.
from*
String
Address of the sender of the token.
{
"from": "trader-near.near",
"path": [
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near",
"wrap.near"
],
"amountIn": "100000000000",
"dexId": "3400"
}{
"status": 200,
"msg": "success",
"data": {
"chainId": "1200",
"from": "trader-near.near",
"to": "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near",
"data": [
"eyJyZWNlaXZlcklkIjoiYTBiODY5OTFjNjIxOGIzNmMxZDE5ZDRhMmU5ZWIwY2UzNjA2ZWI0OC5mYWN0b3J5LmJyaWRnZS5uZWFyIiwiZnVuY3Rpb25DYWxscyI6W3sibWV0aG9kTmFtZSI6ImZ0X3RyYW5zZmVyX2NhbGwiLCJhcmdzIjp7InJlY2VpdmVyX2lkIjoiZGNsdjIucmVmLWxhYnMubmVhciIsImFtb3VudCI6IjEwMDAwMDAwMDAwMCIsIm1zZyI6IntcIlN3YXBcIjp7XCJwb29sX2lkc1wiOltcImEwYjg2OTkxYzYyMThiMzZjMWQxOWQ0YTJlOWViMGNlMzYwNmViNDguZmFjdG9yeS5icmlkZ2UubmVhcnx3cmFwLm5lYXJ8MjAwMFwiXSxcIm91dHB1dF90b2tlblwiOlwid3JhcC5uZWFyXCIsXCJtaW5fb3V0cHV0X2Ftb3VudFwiOlwiMFwiLFwiY2xpZW50X2lkXCI6XCJcIn19In0sImdhcyI6IjE4MDAwMDAwMDAwMDAwMCIsImFtb3VudCI6IjAuMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxIn1dfQ=="
],
"referenceId": "af32b034389e4f42941f488c856ec04e"
}
}/addliquidity
Add liquidity to a specified pool in a specified DEX.
POST https://api.expand.network/dex/addliquidity
Request Body
rpc
String
Remote procedural call URL.
path*
String
Comma separated values of token addresses.
amountIn
String
Amount of token to be swapped.
amountAMin*
String
Minimum amount of token0.
amountBMin*
String
Minimum amount of token1.
from*
String
Address of the sender of the token.
{
"from": "trader-near.near",
"path": [
"17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1",
"wrap.near"
],
"amountIn": [
"1000000000",
"1000000000"
],
"amountAMin": "0",
"amountBMin": "0",
"dexId": "3400"
}{
"status": 200,
"msg": "success",
"data": {
"chainId": "1200",
"from": "trader-near.near",
"to": "dclv2.ref-labs.near",
"value": "0",
"data": [
"eyJzaWduZXJJZCI6InRyYWRlci1uZWFyLm5lYXIiLCJyZWNlaXZlcklkIjoiZGNsdjIucmVmLWxhYnMubmVhciIsImFjdGlvbnMiOlt7InR5cGUiOiJGdW5jdGlvbkNhbGwiLCJwYXJhbXMiOnsibWV0aG9kTmFtZSI6InN0b3JhZ2VfZGVwb3NpdCIsImFyZ3MiOnsiYWNjb3VudF9pZCI6InRyYWRlci1uZWFyLm5lYXIiLCJyZW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AiLCJtc2ciOiJcIkRlcG9zaXRcIiJ9LCJnYXMiOiIxNTAwMDAwMDAwMDAwMDAiLCJkZXBvc2l0IjoiMSJ9fV19",
"eyJzaWduZXJJZCI6InRyYWRlci1uZWFyLm5lYXIiLCJyZWNlaXZlcklkIjoiZGNsdjIucmVmLWxhYnMubmVhciIsImFjdGlvbnMiOlt7InR5cGUiOiJGdW5jdGlvbkNhbGwiLCJwYXJhbXMiOnsibWV0aG9kTmFtZSI6ImFkZF9saXF1aWRpdHkiLCJhcmdzIjp7InBvb2xfaWQiOiIxNzIwODYyOGY4NGY1ZDZhZDMzZjBkYTNiYmJlYjI3ZmZjYjM5OGVhYzUwMWEzMWJkNmFkMjAxMWUzNjEzM2ExfHdyYXAubmVhcnwxMDAiLCJsZWZ0X3BvaW50Ijo0MDI5MjgsInJpZ2h0X3BvaW50Ijo0MDI5MzIsImFtb3VudF94IjoiMTAwMDAwMDAwMCIsImFtb3VudF95IjoiMTAwMDAwMDAwMCIsIm1pbl9hbW91bnRfeCI6IjAiLCJtaW5fYW1vdW50X3kiOiIwIn0sImdhcyI6IjE1MDAwMDAwMDAwMDAwMCIsImRlcG9zaXQiOiIwIn19XX0="
],
"referenceId": "7af3999b9d0f46399e4ff06c2e47c29b"
}
}/removeliquidity
Remove liquidity from a specified pool for a specified DEX.
POST https://api.expand.network/dex/removeliquidity
Request Body
rpc
String
Remote procedural call URL.
poolAddress*
String
Pool address whose liquidity is to be removed.
from*
String
Address of the sender of the token.
liquidity*
String
The liquidity to be removed.
amountAMin*
String
Minimum amount of Token0
amountBMin*
String
Minimum amount of Token1
{
"from": "g20_dex.near",
"poolAddress": "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1|wrap.near|100",
"liquidity": "100000",
"amountAMin": "0",
"amountBMin": "0",
"dexId": "3400"
}{
"status": 200,
"msg": "success",
"data": {
"chainId": "1200",
"from": "g20_dex.near",
"to": "dclv2.ref-labs.near",
"data": [
"eyJyZWNlaXZlcklkIjoiZGNsdjIucmVmLWxhYnMubmVhciIsImZ1bmN0aW9uQ2FsbHMiOlt7Im1ldGhvZE5hbWUiOiJiYXRjaF9yZW1vdmVfbGlxdWlkaXR5IiwiYXJncyI6eyJyZW1vdmVfbGlxdWlkaXR5X2luZm9zIjpbeyJscHRfaWQiOiIxNzIwODYyOGY4NGY1ZDZhZDMzZjBkYTNiYmJlYjI3ZmZjYjM5OGVhYzUwMWEzMWJkNmFkMjAxMWUzNjEzM2ExfHdyYXAubmVhcnwxMDAjODg2MCIsImFtb3VudCI6IjEwMDAwMCIsIm1pbl9hbW91bnRfeCI6IjAiLCJtaW5fYW1vdW50X3kiOiIwIn1dfSwiZ2FzIjoiMjUwMDAwMDAwMDAwMDAwIn1dfQ=="
],
"referenceId": "a637cf04fee54c288925a8d80a312c1f"
}
}Last updated

