dex

Add Liquidity

Allows users to deposit token pairs into decentralized exchange pools with adjustable slippage protection and gas settings. The response includes essential transaction details (chain ID, addresses, transaction data, and a reference ID) for verifying and tracking the liquidity deposit.

💡 Compute Unit Value: 115 (Fixed)

post/defi/v1/dex/addliquidity

Request

  • Base URL
    https://svc.blockdaemon.com
  • URL
    https://svc.blockdaemon.com/defi/v1/dex/addliquidity
  • 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 added.

tokenBstring required

Address of the second token being added.

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

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 swap value allowed for slippage. By default, 1.

enableFeeboolean

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

poolFeesstring required

Different pool based on the fees.

tokenIdstring

The token ID for Uniswap V3 liquidity position.

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

fromInternalBalanceboolean required

True if sending from internal token balances, otherwise False for ERC20.

amountAstring required

Amount of token A, specified in the token's smallest denomination (base units). Examples: 1 WETH (18 decimals) = "1000000000000000000"; 1 USDC (6 decimals) = "1000000".

amountBstring required

Amount of token B, specified in the token's smallest denomination (base units). Examples: 1 WETH (18 decimals) = "1000000000000000000"; 1 USDC (6 decimals) = "1000000".

strategy'stable' | 'uncorrelated'

Liquidity strategy to be used: spotUniform, curve, or bidask. Default is spotUniform.

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

Example request

{
  "dexId": "1000",
  "tokenA": "0x514910771AF9Ca656af840dff83E8264EcF986CA",
  "tokenB": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "amountADesired": "1000000000000000000",
  "amountBDesired": "1000000000000000000",
  "amountAMin": "0",
  "amountBMin": "0",
  "deadline": "1707313948",
  "to": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "gas": "100000",
  "gasPriority": "low",
  "slippage": "10",
  "enableFee": false,
  "poolFees": "3000",
  "tokenId": "3238",
  "path": [
    "0x514910771AF9Ca656af840dff83E8264EcF986CA",
    "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
  ],
  "amountIn": "1000000000000000000",
  "amountOut": "1000000000000000000",
  "fromInternalBalance": false,
  "amountA": "1000000000000000000",
  "amountB": "1000000000000000000",
  "strategy": "stable",
  "amountOutMin": "0"
}

Response

Successful response

statusinteger
msgstring
dataobject

Example response

{
  "status": 200,
  "msg": "success",
  "data": {
    "chainId": "1400",
    "from": "0xa182b65f4bf10be7ef870496893c170af3079a2540c63b470445417fcfb21c5b",
    "to": "0x61d2c22a6cb7831bee0f48363b0eec92369357aece0d1142062f7d5d85c7bef8",
    "data": "oYK2X0vxC+fvhwSWiTwXCvMHmiVAxjtHBEVBf8+yHFsOAAAAAAAAAAIBY980/MvwA84hnT8dnnDRQLYGIsud1HWZwl+y95e6bgdzY3JpcHRzDWFkZF9saXF1aWRpdHkDB1OjCm5ZNsCkxRQNrtNN450Xyn/K4I+UfALpec75ijcZBGNvaW4DTFNEAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQphcHRvc19jb2luCUFwdG9zQ29pbgAHAWPfNPzL8APOIZ0/HZ5w0UC2BiLLndR1mcJfsveXum4GY3VydmVzBlN0YWJsZQAECBQUCAAAAAAACAoKBAAAAAAACAQyCwAAAAAACAKZBQAAAAAAECcAAAAAAABkAAAAAAAAAMlkaWcAAAAAAQ==",
    "referenceId": "4125a4481a984782b9077efd85275e83"
  }
}

Changes

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