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.

  • /removeliquidityPOST - 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.

DEX Name
Chain
DEX ID

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

Name
Type
Description

rpc

String

Remote procedural call URL.

dexId*

String

Refer to the DEX ID page for details.

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

/getuserliquidity

Returns the balance of a particular token pair of an account.

GET https://api.expand.network/dex/getuserliquidity

Query Parameter

Name
Type
Description

rpc

String

Remote procedural call URL.

dexId*

String

Refer to the DEX ID page for details.

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

/getpoolliquidity

Returns the total liquidity for a specified pool.

GET https://api.expand.network/dex/getpoolliquidity

Query Parameter

Name
Type
Description

rpc

String

Remote procedural call URL.

dexId*

String

Refer to the DEX ID page for details.

poolAddress*

String

Pool address whose liquidity is to be fetched.

https://api.expand.network/dex/getpoolliquidity?poolAddress=17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1%7Cwrap.near%7C100&dexId=3400

/gettokenliquidity

Returns the individual token liquidity within the specified liquidity pool.

GET https://api.expand.network/dex/gettokenliquidity

Query Parameter

Name
Type
Description

rpc

String

Remote procedural call URL.

dexId*

String

Refer to the DEX ID page for details.

poolAddress*

String

Pool address whose liquidity is to be fetched.

https://api.expand.network/dex/gettokenliquidity?poolAddress=17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1%7Cwrap.near%7C100&dexId=3400

/swap

Initiate a swap transaction on a specified DEX.

POST https://api.expand.network/dex/swap

Request Body

Name
Type
Description

rpc

String

Remote procedural call URL.

dexId*

String

Refer to the DEX ID page for details.

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

/addliquidity

Add liquidity to a specified pool in a specified DEX.

POST https://api.expand.network/dex/addliquidity

Request Body

Name
Type
Description

rpc

String

Remote procedural call URL.

dexId*

String

Refer to the DEX ID page for details.

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

/removeliquidity

Remove liquidity from a specified pool for a specified DEX.

POST https://api.expand.network/dex/removeliquidity

Request Body

Name
Type
Description

rpc

String

Remote procedural call URL.

dexId*

String

Refer to the DEX ID page for details.

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

Last updated