Pure Swap API

On this page you can check the endpoints for the Fanbase Pure Swap API which delivers you the best price from Fanbase Swap liquidity pools. Next, check 'Networks Supported' for a comprehensive list.

quotes

Fetch Quotes

GET https://pure20.fanbase.io/v1/quote

Get quotes of a pair from available exchanges. In case of getting quotes between Native Coin (e.g. Ethereum) pass asinputAddress or outputAddress the following: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE.

Query Parameters

Name
Type
Description

chainId*

String

Network ID e.g.:1

inputAddress*

String

Contract address of a token to sell e.g.: 0xdAC17F958D2ee523a2206206994597C13D831ec7

outputAddress*

String

Contract address of a token to buy e.g.: 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984

inputAmount*

Big Number

Amount of input token to sell, in WEI e.g.: 1000000000000000000

[
    {
        "fromToken": {
            "name": string,
            "symbol": string,
            "decimals": number
        },
        "toToken": {
            "name": string,
            "symbol": string,
            "decimals": number
        },
        "fromTokenAmount": string - amoun in WEI,
        "toTokenAmount": BigNumber,
        "dexName": "string"
    },
    ...
]

reverseQuote

Fetch Reverse Quote

GET https://pure20.fanbase.io/v1/reverseQuote

Fetch input amount of token from output token amount

Request Body

Name
Type
Description

chainId*

Number

Network ID e.g.:1

inputAddress*

String

Contract address of a token to sell e.g.: 0xdAC17F958D2ee523a2206206994597C13D831ec7

outputAddress*

String

Contract address of a token to buy e.g.: 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984

outputAmount*

Big Number

Amount of input token to sell, in WEI e.g.: 1000000000000000000

JSON Object

{
    "statusCode": 200,
    "message": "Successfully",
    "data": 0
}

createExchange

Generate and fetch Swap Data

POST https://pure20.fanbase.io/v1/swap

Swap a pair of tokens. In case of Native -> Token there's no need for an /approve to happen before /swap. In any other case it's required.

Request Body

Name
Type
Description

chainId*

Number

Network ID e.g.:1

inputAddress*

String

Contract address of a token to sell e.g.: 0xdAC17F958D2ee523a2206206994597C13D831ec7

outputAddress*

String

Contract address of a token to buy e.g.: 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984

slippage*

Number

slippage tolerance eg: 1

inputAmount*

Big Number

Amount of input token to sell, in WEI e.g.: 1000000000000000000

fromAddress*

String

Operator address e.g.: 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045

JSON Object

{
    "statusCode": 200,
    "message": "Successfully",
    "data": {
        "data": string,
        "to": string
    }
}

addLiquidity

Add Liquidity

POST https://pure20.fanbase.io/v1/addLiquidity

Not functional - Soon

Request Body

Name
Type
Description

chainId*

number

Network ID

amountB*

big number

token B amount

amountA*

big number

token A amount

fromAddress*

string

operator address

tokenB*

string

token B address

tokenA*

string

token A address

Last updated