dex

Remove Liquidity

Facilitates the withdrawal of liquidity from cross-chain bridges with customizable gas settings and amount specifications.

💡 Compute Unit Value: 115 (Fixed)

post/defi/v1/dex/removeliquidity

Request

  • Base URL
    https://svc.blockdaemon.com
  • URL
    https://svc.blockdaemon.com/defi/v1/dex/removeliquidity
  • Auth
    API key in header X-API-Key

Request body

dexId'1000' | '1001' | '1300' | '1301' | '1305' | '1306' | '1307' | '1308' | '1309' | '1310' | '1100' | '1101' | '1200' | '1201' | '2900' | '2901' | '2800' | '2808' | '2809' | '1500' | '1400' | '1402' | '2300' | '2100' | '2101' | '2500' | '2501' | '2700' | '2400' | '2401' | '3000' | '3001' | '3300' | '3301' | '3500' | '3501' | '3400' | '3401' | '3600'

The unique ID to specify the decentralized exchange (DEX) within a particular blockchain. Find more here.

tokenAstring required

Address of the first token being removed.

tokenBstring required

Address of the second token being removed.

liquiditystring required

Amount of liquidity pool (LP) tokens to remove, specified in the token's smallest denomination (base units). Examples: 1 LP token (18 decimals) = "1000000000000000000".

amountAMinstring required

Minimum acceptable amount of token A in the token's smallest denomination (base units). Provides slippage protection — the transaction reverts if the deposited amount falls below this value. Set to "0" to disable slippage protection.

amountBMinstring required

Minimum acceptable amount of token B in the token's smallest denomination (base units). Provides slippage protection — the transaction reverts if the deposited amount falls below this value. Set to "0" to disable slippage protection.

deadlinestring required

Deadline for the transaction to be executed (UNIX Timestamp).

tostring required

Address of the recipient of the token.

fromstring required

Address of the sender of the token.

gasstring required

Maximum number of gas units to allocate for the transaction, as an integer string (e.g., '200000'). If omitted, gas is estimated automatically. Note: this is gas units, not wei or gwei.

gasPrioritystring

Specifies the priority level for gas fees (e.g., 'low', 'medium', or 'high'), which influences the transaction speed and cost.

slippagestring

Percentage of total value allowed for slippage. Default is 1. Range: 0 <= slippage <= 100.

enableFeeboolean

Flag to include a basis points fee transaction alongside the main transaction when set to true.

tokenIdstring required

The token ID for Uniswap V3 liquidity position.

amountAMaxstring

Maximum amount of token A in the token's smallest denomination (base units).

amountBMaxstring

Maximum amount of token B in the token's smallest denomination (base units).

recipientstring

Recipient for sweep tokens.

amountADesiredstring required

Desired amount of token A to add as liquidity, specified in the token's smallest denomination (base units). Do not send human-readable decimal values. Examples: 1 WETH (18 decimals) = "1000000000000000000"; 1 USDC (6 decimals) = "1000000".

amountBDesiredstring required

Desired amount of token B to add as liquidity, specified in the token's smallest denomination (base units). Do not send human-readable decimal values. Examples: 1 WETH (18 decimals) = "1000000000000000000"; 1 USDC (6 decimals) = "1000000".

pathstring[] required

Array of token contract addresses for the liquidity pool. Provide [tokenAAddress, tokenBAddress]. Example (LINK/USDC): ['0x514910771AF9Ca656af840dff83E8264EcF986CA', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'].

amountInstring required

Amount of tokens to add as liquidity, specified in the token's smallest denomination (base units). Do not send human-readable decimal values. Examples: 1 WETH (18 decimals) = "1000000000000000000"; 1 USDC (6 decimals) = "1000000".

amountOutstring required

Amount of the output token to receive, specified in the token's smallest denomination (base units). Do not send human-readable decimal values. Examples: 1 WETH (18 decimals) = "1000000000000000000"; 1 USDC (6 decimals) = "1000000".

toInternalBalancestring required

True if receiving tokens as internal token balances. False if receiving as ERC20.

binStepstring required

Difference between two consecutive bins.

idsstring required

Bin IDs that liquidity should be removed from.

amountsstring required

Array of token amounts to remove as liquidity, each specified in the token's smallest denomination (base units). Examples: 1 WETH (18 decimals) = "1000000000000000000"; 1 USDC (6 decimals) = "1000000".

positionNFTstring required

LP token that represents a position in a pool.

poolAddressstring required

The address of the pool.

amountOutMinstring

Minimum acceptable output amount in the token's smallest denomination (base units). Provides slippage protection — the transaction reverts if the output falls below this value. Set to "0" to disable slippage protection. Examples: to require at least 0.99 USDC (6 decimals), use "990000"; to require at least 0.99 WETH (18 decimals), use "990000000000000000".

poolFeesstring

Different pool based on the fees. By default, it is selected as 2500.

Example request

{
  "dexId": "1000",
  "tokenA": "0x514910771AF9Ca656af840dff83E8264EcF986CA",
  "tokenB": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "liquidity": "1000000000000000000",
  "amountAMin": "0",
  "amountBMin": "0",
  "deadline": "1707313948",
  "to": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "gas": "100000",
  "gasPriority": "low",
  "slippage": "10",
  "enableFee": false,
  "tokenId": "3238",
  "amountAMax": "1000000000000000000",
  "amountBMax": "1000000000000000000",
  "recipient": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "amountADesired": "1000000000000000000",
  "amountBDesired": "1000000000000000000",
  "path": [
    "0x514910771AF9Ca656af840dff83E8264EcF986CA",
    "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
  ],
  "amountIn": "1000000000000000000",
  "amountOut": "1000000000000000000",
  "toInternalBalance": false,
  "binStep": "20",
  "ids": "8375816,8375817",
  "amounts": "10000",
  "positionNFT": "45z3G8PxyTuFa9tbr9QMmscGVHvZir4vQK1U5LRKeSQd",
  "poolAddress": "0xfad57d2039c21811c8f2b5d5b65308aa99d31559",
  "amountOutMin": "0",
  "poolFees": "3000"
}

Response

Successful response

statusinteger
msgstring
dataobject

Example response

{
  "status": 200,
  "msg": "success",
  "data": {
    "chainId": "1",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "to": "0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F",
    "value": "0",
    "gas": "400000",
    "data": "0xbaa2abde000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000000000566f4b5624f4230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000063056e00436da25bcf48a40dfbbdcc708935100600000000000000000000000000000000000000000000000000000000634e5192",
    "estimationCheck": true,
    "referenceId": "838c56cd8ee9402b96cc1e9939fa1e75"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.