Notus API
Liquidity pools

Get Liquidity Amounts

Get the amounts of tokens needed to provide liquidity to a pool based on the maximum you want to spend in one token. You can pass the max amount for both tokens and receive quotes for the two possible scenarios, this way you can check in a single call what option works based on the amounts your user has. E.g. your user wants to provide liquidity to the ETH-USDC pool, and they have 100 USDC and 100 ETH in their wallet. By passing both as the max amounts in `tokenXMaxAmount` you'll get two quotes. One telling how much ETH you need to provided if you send 100 USDC and another telling how much USDC you need to provide given 100 ETH. Then you can choose which one actually fits the liquidity your user has. **Note**: If only one of them is returned it means the price range is outside the current price, so only one token can be provided to create liquidity, the other will always be zero.

GET
/api/v1/liquidity/amounts
x-api-key<token>

In: header

Query Parameters

liquidityProvider?string

Optional provider for entering a liquidity pool. If not provided, Uniswap v3 will be used.

Value in"UNISWAP_V3"
chainIdnumber

The blockchain network where the liquidity will be provided. Supported EVM chains:

  • Arbitrum One: 42161
  • Avalanche: 43114
  • Base: 8453
  • BNB Smart Chain: 56
  • Ethereum: 1
  • Gnosis: 100
  • OP Mainnet: 10
  • Polygon: 137
token0string

The address (in hexadecimal format) of one of the tokens of the pool.

Match^0x[a-fA-F0-9]{40}$
token1string

The address (in hexadecimal format) of the other token of the pool.

Match^0x[a-fA-F0-9]{40}$
poolFeePercentnumber

Defines the fee earned by providing liquidity. Lower values are recommended for more stable tokens, while higher values are better suited for volatile assets. The values allowed depend on the provider, so check the provider docs too to know which fee tiers are allowed.

Range0.01 <= value <= 100
token0MaxAmount?string

The maximum amount of token0 to add to the liquidity pool, expressed as a decimal string.

Default"1"
token1MaxAmount?string

The maximum amount of token1 to add to the liquidity pool, expressed as a decimal string.

Default"1"
minPricenumber

Minimum price the liquidity will be active. If the price goes below this, the liquidity won't be active and will generate no revenues. This will allow to concentrate the liquidity to a price range, thus enhancing the gains. Price is always p = token1 / token0

Range0 <= value <= 3.4026e+38
maxPricenumber

Maximum price the liquidity will be active. If the price goes above this, the liquidity won't be active and will generate no revenues. This will allow to concentrate the liquidity to a price range, thus enhancing the gains. Price is always p = token1 / token0

Range0 <= value <= 3.4026e+38
payGasFeeTokenstring

The token address (in hexadecimal format) used to pay the transaction fee.

Match^0x[a-fA-F0-9]{40}$
gasFeePaymentMethodstring

Defines how the fee will be paid: "ADD_TO_AMOUNT" adds it to the input amount, while "DEDUCT_FROM_AMOUNT" subtracts it from the input amount.

Value in"ADD_TO_AMOUNT" | "DEDUCT_FROM_AMOUNT"

Response Body

curl -X GET "https://api.notus.team/api/v1/liquidity/amounts?liquidityProvider=UNISWAP_V3&chainId=42161&token0=0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f&token1=0xaf88d065e77c8cc2239327c5edb3a432268e5831&poolFeePercent=1&token0MaxAmount=26.2345&token1MaxAmount=1823.2&minPrice=83475.12&maxPrice=102300.5&payGasFeeToken=0x82af49447d8a07e3bd95bd0d56f35241523fbab1&gasFeePaymentMethod=ADD_TO_AMOUNT"
{
  "poolPrice": "18342.234512",
  "amounts": {
    "token0MaxAmount": {
      "token0Amount": "2345.91",
      "token1Amount": "723.123"
    },
    "token1MaxAmount": {
      "token0Amount": "2345.91",
      "token1Amount": "723.123"
    }
  }
}
{
  "statusCode": 400,
  "id": "NOT_AUTHORIZED_TOKENS",
  "message": ""
}
{
  "statusCode": 403,
  "id": "UNAVAILABLE_COMPUTE_UNITS",
  "message": "The project doesn't have enough compute units to perform this action. Please upgrade your plan."
}
{
  "statusCode": 500,
  "id": "BLOCKCHAIN_ERROR",
  "message": "We had a problem fetching the data from the blockchain. If the problem persists, contact our support."
}