lp-integration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLP Integration
LP 集成
Integrate Uniswap liquidity provisioning into frontends, backends, and bots using the Uniswap LP API.
The LP API is a transaction-building service. You send position parameters; the API fetches live pool state, computes the dependent token amount, and returns a fully-formed, unsigned transaction. Your application signs and broadcasts it. The API never holds keys, never moves funds, and never broadcasts.
使用 Uniswap LP API 将 Uniswap 流动性提供功能集成到前端、后端和机器人中。
LP API 是一项交易构建服务。你发送头寸参数,API 获取实时池状态,计算对应的代币数量,并返回完整的未签名交易。你的应用负责签名并广播该交易。API 永远不会持有密钥、转移资金或进行广播。
Prerequisites
前置条件
This skill assumes familiarity with viem basics (client setup, account management, contract interactions, transaction signing). Install the uniswap-viem plugin for comprehensive viem/wagmi guidance:
claude plugin add @uniswap/uniswap-viemFor token swaps (not liquidity), see the sibling swap-integration skill in this plugin.
本技能假设你熟悉 viem 基础知识(客户端设置、账户管理、合约交互、交易签名)。安装 uniswap-viem 插件以获取全面的 viem/wagmi 指导:
claude plugin add @uniswap/uniswap-viem关于代币兑换(非流动性相关),请参阅本插件中的姊妹技能 swap-integration。
Base URL
基础 URL
text
LP_API_BASE_URL = https://liquidity.api.uniswap.orgAll LP endpoints are POST requests under the prefix (e.g. ).
/lp/https://liquidity.api.uniswap.org/lp/createThe LP API host is intentionally different from the swap Trading API. Liquidity provisioning lives at(nohttps://liquidity.api.uniswap.orgprefix), not the/v1host used for swaps. Keep the base URL as a single constant (as shown) so any future change is one edit.https://trade-api.gateway.uniswap.org/v1
text
LP_API_BASE_URL = https://liquidity.api.uniswap.org所有 LP 端点均为 前缀下的 POST 请求(例如 )。
/lp/https://liquidity.api.uniswap.org/lp/createLP API 的主机地址与兑换交易 API 有意不同。 流动性提供功能部署在(无https://liquidity.api.uniswap.org前缀),而非用于兑换的/v1主机。请将基础 URL 设为单个常量(如上所示),以便未来变更时只需修改一处。https://trade-api.gateway.uniswap.org/v1
Authentication
身份验证
Every write/approval endpoint requires an API key sent as the header; a missing or invalid key returns with . ( is a read endpoint and does not strictly enforce the key, but always send it for consistency and rate-limit attribution.)
x-api-key401{"code":"unauthenticated"}/lp/pool_infotext
Content-Type: application/json
Accept: application/json
x-api-key: <your-api-key>Getting a key: Register at the Uniswap Developer Platform dashboard. The same key works across swapping and liquidity provisioning. Never hardcode the key; load it from an environment variable.
每个写入/授权端点都需要在 请求头中携带 API 密钥;缺失或无效的密钥将返回 401 状态码及 。( 是读取端点,不强制要求密钥,但为了一致性和速率限制归因,请始终携带该密钥。)
x-api-key{"code":"unauthenticated"}/lp/pool_infotext
Content-Type: application/json
Accept: application/json
x-api-key: <your-api-key>获取密钥: 在 Uniswap 开发者平台仪表盘 注册。同一密钥可同时用于兑换和流动性提供功能。切勿硬编码密钥,应从环境变量中加载。
Quick Decision Guide
快速决策指南
| You want to... | Endpoint | Protocols |
|---|---|---|
| Check/grant token approvals before any action | | V2, V3, V4 |
| Create a concentrated-liquidity position | | V3, V4 |
| Create a full-range (classic) position | | V2 |
| Add liquidity to an existing position | | V2, V3, V4 |
| Remove a percentage of liquidity | | V2, V3, V4 |
| Collect accumulated trading fees | | V3, V4 |
| Read live pool state | | V2, V3, V4 |
| 你想要... | 端点 | 支持协议 |
|---|---|---|
| 在执行任何操作前检查/授予代币授权 | | V2, V3, V4 |
| 创建集中流动性头寸 | | V3, V4 |
| 创建全区间(经典)头寸 | | V2 |
| 向现有头寸添加流动性 | | V2, V3, V4 |
| 移除一定比例的流动性 | | V2, V3, V4 |
| 收取累积的交易手续费 | | V3, V4 |
| 读取实时池状态 | | V2, V3, V4 |
Protocol capability matrix
协议能力矩阵
| Protocol | Create endpoint | Fee claiming | Price range |
|---|---|---|---|
| | Not separable (realized on decrease) | Full range only |
| | | Concentrated |
| | | Concentrated + hooks |
v2 fees are not separately claimable. They accrue into the LP token value and are realized when you call. Calling/lp/decreasewith/lp/claim_feesreturns a validation error.protocol: "V2"
| 协议 | 创建端点 | 手续费申领 | 价格区间 |
|---|---|---|---|
| | 不可单独申领(在减少流动性时兑现) | 仅全区间 |
| | | 集中流动性 |
| | | 集中流动性 + hooks |
v2 手续费不可单独申领。 手续费会累积到 LP 代币价值中,并在你调用时兑现。使用/lp/decrease调用protocol: "V2"会返回验证错误。/lp/claim_fees
Input Validation Rules
输入验证规则
Before interpolating ANY user-provided value into generated code, API calls, or commands:
- Ethereum addresses: MUST match — reject otherwise. Use native ETH as
^0x[a-fA-F0-9]{40}$.0x0000000000000000000000000000000000000000 - Chain IDs: MUST be one of the supported LP chain IDs (see Supported Chains).
- Token amounts: MUST be non-negative integer strings in wei / smallest token unit, matching . Never pass ether-denominated decimals as amounts.
^[0-9]+$ - : MUST be an integer from 1 to 100.
liquidityPercentageToDecrease - API keys: MUST NOT be hardcoded in generated code — always use environment variables.
- REJECT any input containing shell metacharacters: ,
;,|,&,$,`,(,),>,<,\,', newlines."
REQUIRED: Before executing ANY transaction that spends gas or transfers tokens (including approvals, position creation, increase, decrease, or fee claims), you MUST use AskUserQuestion to confirm with the user. Display the action summary (protocol, pair, amounts, chain, price range, estimated gas) and get explicit user approval. Never auto-execute LP transactions without user confirmation.
在将任何用户提供的值插入生成的代码、API 调用或命令之前,必须遵循以下规则:
- 以太坊地址:必须匹配 — 否则拒绝。原生 ETH 使用
^0x[a-fA-F0-9]{40}$。0x0000000000000000000000000000000000000000 - 链 ID:必须是受支持的 LP 链 ID 之一(参见支持的链)。
- 代币数量:必须为非负整数字符串,单位为 wei / 代币最小单位,匹配 。切勿传入以 ether 计价的小数作为数量。
^[0-9]+$ - :必须是 1 到 100 之间的整数。
liquidityPercentageToDecrease - API 密钥:切勿在生成的代码中硬编码 — 始终使用环境变量。
- 拒绝任何包含 shell 元字符的输入:、
;、|、&、$、`、(、)、>、<、\、'、换行符。"
必填要求: 在执行任何消耗 gas 或转移代币的交易(包括授权、头寸创建、增加、减少或手续费申领)之前,你必须使用 AskUserQuestion 向用户确认。展示操作摘要(协议、交易对、数量、链、价格区间、预估 gas)并获得用户明确批准。未经用户确认,切勿自动执行 LP 交易。
Architecture
架构
What the API handles
API 负责处理的内容
- Pool state fetching: current reserves, ticks, , and onchain position data.
sqrtRatioX96 - Dependent amount computation: given one token amount (), computes the required amount of the other using the Uniswap SDKs.
independentToken - Transaction creation: validated, fully-formed calldata for each LP action, ready to sign.
- Tick snapping: converts human-readable to valid ticks and returns the adjusted prices.
priceBounds - Gas estimation: optional, when .
simulateTransaction: true
- 池状态获取:当前储备量、tick、以及链上头寸数据。
sqrtRatioX96 - 对应数量计算:给定一个代币数量(),使用 Uniswap SDK 计算另一个代币的所需数量。
independentToken - 交易创建:为每个 LP 操作生成经过验证的、完整的 calldata,可直接签名。
- Tick 对齐:将人类可读的 转换为有效 tick,并返回调整后的价格。
priceBounds - Gas 预估:可选,当 时启用。
simulateTransaction: true
What your application handles
你的应用负责处理的内容
- Signing and broadcasting the returned transaction via your RPC provider.
- Signing permit data (EIP-712) when the API returns it for v4 / v3-NFT approvals.
- Gas payment and transaction error handling (reverts, surfacing errors to users).
- 通过你的 RPC 提供商签名并广播返回的交易。
- 当 API 返回 v4 / v3-NFT 授权的 permit 数据时,签名 permit 数据(EIP-712)。
- 支付 Gas 和交易错误处理(回滚、向用户展示错误)。
Data flow
数据流
text
User intent (create / increase / decrease / claim)
|
Your application
|-- POST /lp/check_approval -> returns approval transactions and/or permit data
|-- (execute approval txns; sign permit if returned)
|-- POST /lp/create | increase | decrease | claim_fees
|-- validate the returned transaction payload (non-empty data, valid addresses)
|-- user signature (wallet)
+-- broadcast (your RPC)
|
Blockchaintext
User intent (create / increase / decrease / claim)
|
Your application
|-- POST /lp/check_approval -> returns approval transactions and/or permit data
|-- (execute approval txns; sign permit if returned)
|-- POST /lp/create | increase | decrease | claim_fees
|-- validate the returned transaction payload (non-empty data, valid addresses)
|-- user signature (wallet)
+-- broadcast (your RPC)
|
BlockchainEndpoint Reference
端点参考
All field names below come from the LP API OpenAPI contract. Where the public integration guide uses different names, the contract names here are authoritative.
以下所有字段名均来自 LP API OpenAPI 合约。若公开集成指南使用了不同的名称,以本处的合约名称为准。
POST /lp/check_approval
POST /lp/check_approval
Always call this first. Returns the approval transactions (and/or permit data) needed before an LP action. If the response array is empty and no permit data is returned, all approvals are already in place — unless is non-empty, which means the pool contains a permissioned token and the wallet is not allowlisted. In that case the response is still ; render the KYC call-to-action from each warning's instead of attempting the LP action.
transactionskycRequiredWarnings200kycUrlRequest
json
{
"walletAddress": "0x...",
"protocol": "V4",
"chainId": 1,
"lpTokens": [
{ "tokenAddress": "0x...", "amount": "1000000000000000000" },
{ "tokenAddress": "0x...", "amount": "500000000" }
],
"action": "CREATE"
}| Field | Required | Notes |
|---|---|---|
| Yes | The position owner |
| Yes | |
| Yes | Supported chain ID |
| Yes | Array of |
| Yes | |
| No | Include gas estimates |
| No | Include gas info on returned approvals |
| No | If |
| No | |
| No | v3 NFT id when approving a position-manager NFT |
Response
ts
interface CheckApprovalResponse {
requestId: string;
transactions: ApprovalTransactionRequest[]; // sign each .transaction; empty (with kycRequiredWarnings also empty) = nothing to approve
v4BatchPermitData?: NullablePermit; // v4: sign and pass into /lp/create or /lp/increase
v3NftPermitData?: NullablePermit; // v3 NFT permit
kycRequiredWarnings: KycRequiredWarning[]; // permissioned pools: non-empty when the wallet is NOT allowlisted. Always present (usually []).
}
interface ApprovalTransactionRequest {
transaction: TransactionRequest; // the tx to sign and broadcast
cancelApproval: boolean;
action: 'CREATE' | 'INCREASE' | 'DECREASE' | 'MIGRATE';
gasFee?: string;
}
interface KycRequiredWarning {
kycUrl: string;
tokenAddress: string;
chainId: number;
}The response field is, nottransactions. Each element WRAPS a transaction. Signapprovals, never the element object itself. There are no top-levelelement.transaction/tokenfields.spender
始终首先调用此端点。返回 LP 操作前所需的授权交易(和/或 permit 数据)。如果响应中的 数组为空且未返回 permit 数据,则所有授权均已完成 — 除非 非空,这意味着池包含权限型代币且钱包不在白名单中。这种情况下响应仍为 200;你应展示每个警告中 指向的 KYC 行动号召,而非尝试执行 LP 操作。
transactionskycRequiredWarningskycUrl请求
json
{
"walletAddress": "0x...",
"protocol": "V4",
"chainId": 1,
"lpTokens": [
{ "tokenAddress": "0x...", "amount": "1000000000000000000" },
{ "tokenAddress": "0x...", "amount": "500000000" }
],
"action": "CREATE"
}| 字段 | 必填 | 说明 |
|---|---|---|
| 是 | 头寸所有者 |
| 是 | |
| 是 | 受支持的链 ID |
| 是 | 要花费的 |
| 是 | |
| 否 | 包含 gas 预估 |
| 否 | 在返回的授权信息中包含 gas 信息 |
| 否 | 若为 |
| 否 | |
| 否 | 授权头寸管理器 NFT 时的 v3 NFT ID |
响应
ts
interface CheckApprovalResponse {
requestId: string;
transactions: ApprovalTransactionRequest[]; // sign each .transaction; empty (with kycRequiredWarnings also empty) = nothing to approve
v4BatchPermitData?: NullablePermit; // v4: sign and pass into /lp/create or /lp/increase
v3NftPermitData?: NullablePermit; // v3 NFT permit
kycRequiredWarnings: KycRequiredWarning[]; // permissioned pools: non-empty when the wallet is NOT allowlisted. Always present (usually []).
}
interface ApprovalTransactionRequest {
transaction: TransactionRequest; // the tx to sign and broadcast
cancelApproval: boolean;
action: 'CREATE' | 'INCREASE' | 'DECREASE' | 'MIGRATE';
gasFee?: string;
}
interface KycRequiredWarning {
kycUrl: string;
tokenAddress: string;
chainId: number;
}响应字段名为,而非transactions。 每个元素都包裹着一个交易。请对approvals签名,切勿对元素对象本身签名。响应没有顶层的element.transaction/token字段。spender
POST /lp/create
POST /lp/create
Create a v3 or v4 concentrated-liquidity position. Specify a price range and one token amount; the API computes the other from live pool state.
Pool specification — provide exactly one of:
- :
existingPoolwhere{ token0Address, token1Address, poolReference }is the pool address (v3) or pool ID (v4).poolReference - :
newPoolwhere{ token0Address, token1Address, fee, tickSpacing, hooks?, initialPrice }is ainitialPricestring (sqrtRatioX96is v4-only).hooks
Price range — provide exactly one of:
- :
priceBounds—{ minPrice, maxPrice, quotedTokenAddress }/minPriceare decimal price strings andmaxPriceis required (it must equalquotedTokenAddressortoken0Address).token1Addresssets which token the prices are denominated in; there is no default, and omitting it returns aquotedTokenAddress. The API snaps to valid ticks and returns the adjusted prices.400 - :
tickBoundsraw integers.{ tickLower, tickUpper }
Request
json
{
"walletAddress": "0x...",
"chainId": 1,
"protocol": "V3",
"existingPool": {
"token0Address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"token1Address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"poolReference": "0x3470447f3cecffac709d3e783a307790b0208d60"
},
"independentToken": {
"tokenAddress": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"amount": "198251669183062942"
},
"priceBounds": {
"minPrice": "0.00000000000324",
"maxPrice": "0.00000000000393",
"quotedTokenAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7"
},
"simulateTransaction": false
}| Field | Required | Notes |
|---|---|---|
| Yes | |
| One required | See pool specification above |
| One required | See price range above |
| No | Override the computed dependent amount |
| No | Decimal percent (e.g. |
| No | Unix seconds |
| No | Include |
| No | |
| No | v4 permit from |
| No | Used when one side is native ETH |
| No | Include approval pre-calls in the gas simulation (only with |
Response
ts
interface CreatePositionResponse {
requestId: string;
token0: LPToken; // { tokenAddress, amount }
token1: LPToken;
adjustedMinPrice: string; // show THIS to the user, not your input minPrice
adjustedMaxPrice: string;
tickLower: number;
tickUpper: number;
create: TransactionRequest;
gasFee?: string; // present when simulateTransaction: true
slippage?: number; // effective slippage the API applied (e.g. native-token v4 cases)
}Display/adjustedMinPrice(the tick-snapped values), not the originaladjustedMaxPriceyou sent.priceBounds
创建 v3 或 v4 集中流动性头寸。指定价格区间和一个代币数量;API 将根据实时池状态计算另一个代币的数量。
池规范 — 提供以下其中一项:
- :
existingPool,其中{ token0Address, token1Address, poolReference }是池地址(v3)或池 ID(v4)。poolReference - :
newPool,其中{ token0Address, token1Address, fee, tickSpacing, hooks?, initialPrice }是initialPrice字符串(sqrtRatioX96仅 v4 支持)。hooks
价格区间 — 提供以下其中一项:
- :
priceBounds—{ minPrice, maxPrice, quotedTokenAddress }/minPrice是小数价格字符串,且maxPrice为必填(必须等于quotedTokenAddress或token0Address)。token1Address指定价格以哪种代币计价;无默认值,省略该字段将返回 400 错误。API 会将价格对齐到有效 tick 并返回调整后的价格。quotedTokenAddress - :
tickBounds原始整数。{ tickLower, tickUpper }
请求
json
{
"walletAddress": "0x...",
"chainId": 1,
"protocol": "V3",
"existingPool": {
"token0Address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"token1Address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"poolReference": "0x3470447f3cecffac709d3e783a307790b0208d60"
},
"independentToken": {
"tokenAddress": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"amount": "198251669183062942"
},
"priceBounds": {
"minPrice": "0.00000000000324",
"maxPrice": "0.00000000000393",
"quotedTokenAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7"
},
"simulateTransaction": false
}| 字段 | 必填 | 说明 |
|---|---|---|
| 是 | |
| 二选一必填 | 参见上方池规范 |
| 二选一必填 | 参见上方价格区间 |
| 否 | 覆盖计算得出的对应代币数量 |
| 否 | 滑点容忍度,百分比小数(例如 |
| 否 | Unix 时间戳(秒) |
| 否 | 在响应中包含 |
| 否 | |
| 否 | 来自 |
| 否 | 当一侧是原生 ETH 时使用 |
| 否 | 在 gas 模拟中包含授权预调用(仅当 |
响应
ts
interface CreatePositionResponse {
requestId: string;
token0: LPToken; // { tokenAddress, amount }
token1: LPToken;
adjustedMinPrice: string; // show THIS to the user, not your input minPrice
adjustedMaxPrice: string;
tickLower: number;
tickUpper: number;
create: TransactionRequest;
gasFee?: string; // present when simulateTransaction: true
slippage?: number; // effective slippage the API applied (e.g. native-token v4 cases)
}请向用户展示/adjustedMinPrice(tick 对齐后的值),而非你发送的原始adjustedMaxPrice。priceBounds
POST /lp/create_classic
POST /lp/create_classic
Create a v2 (full-range) position. Provide one amount; the API computes the from current pair reserves.
independentTokendependentTokenRequest
json
{
"walletAddress": "0x...",
"poolParameters": {
"token0Address": "0xc02fe7317d4eb8753a02c35fe019786854a92001",
"token1Address": "0x0000000000000000000000000000000000000000",
"chainId": 130
},
"independentToken": {
"tokenAddress": "0xc02fe7317d4eb8753a02c35fe019786854a92001",
"amount": "1000000000000000"
},
"simulateTransaction": false
}| Field | Required | Notes |
|---|---|---|
| Yes | |
| Yes | |
| Yes | |
| No | If omitted, computed from reserves. Required when creating a brand-new pool. |
| No |
Response: . Note the create_classic response names the tokens / (not / ).
{ requestId, independentToken, dependentToken, create: TransactionRequest, gasFee? }independentTokendependentTokentoken0token1创建 v2(全区间)头寸。提供一个 数量;API 将根据当前交易对储备量计算 的数量。
independentTokendependentToken请求
json
{
"walletAddress": "0x...",
"poolParameters": {
"token0Address": "0xc02fe7317d4eb8753a02c35fe019786854a92001",
"token1Address": "0x0000000000000000000000000000000000000000",
"chainId": 130
},
"independentToken": {
"tokenAddress": "0xc02fe7317d4eb8753a02c35fe019786854a92001",
"amount": "1000000000000000"
},
"simulateTransaction": false
}| 字段 | 必填 | 说明 |
|---|---|---|
| 是 | |
| 是 | |
| 是 | |
| 否 | 若省略,则根据储备量计算。创建全新池时为必填。 |
| 否 |
响应:。注意 create_classic 响应中的代币命名为 / (而非 / )。
{ requestId, independentToken, dependentToken, create: TransactionRequest, gasFee? }independentTokendependentTokentoken0token1POST /lp/increase
POST /lp/increase
Add liquidity to an existing v2/v3/v4 position. Provide one token amount; the API computes the other.
Request
json
{
"walletAddress": "0x...",
"chainId": 130,
"protocol": "V4",
"token0Address": "0x0000000000000000000000000000000000000000",
"token1Address": "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
"nftTokenId": "1833079",
"independentToken": {
"tokenAddress": "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
"amount": "8223"
},
"simulateTransaction": false
}| Field | Required | Notes |
|---|---|---|
| Yes | |
| v3/v4 | NFT id identifying the position |
| No | |
| No | v4 permit from |
| No | |
Response: .
{ requestId, token0, token1, increase: TransactionRequest, gasFee?, slippage? }Native ETH: use. The API generates a multicall including0x0000000000000000000000000000000000000000to return any excess.refundETH
向现有 v2/v3/v4 头寸添加流动性。提供一个代币数量;API 计算另一个的数量。
请求
json
{
"walletAddress": "0x...",
"chainId": 130,
"protocol": "V4",
"token0Address": "0x0000000000000000000000000000000000000000",
"token1Address": "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
"nftTokenId": "1833079",
"independentToken": {
"tokenAddress": "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
"amount": "8223"
},
"simulateTransaction": false
}| 字段 | 必填 | 说明 |
|---|---|---|
| 是 | |
| v3/v4 必填 | 标识头寸的 NFT ID |
| 否 | |
| 否 | 来自 |
| 否 | 当一侧是原生 ETH 时使用 |
响应:。
{ requestId, token0, token1, increase: TransactionRequest, gasFee?, slippage? }原生 ETH:使用。API 会生成包含0x0000000000000000000000000000000000000000的 multicall 以退还多余的 ETH。refundETH
POST /lp/decrease
POST /lp/decrease
Remove a percentage of liquidity from a v2/v3/v4 position.
Request
json
{
"walletAddress": "0x...",
"chainId": 130,
"protocol": "V4",
"token0Address": "0x0000000000000000000000000000000000000000",
"token1Address": "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
"liquidityPercentageToDecrease": 25,
"nftTokenId": "1833079",
"simulateTransaction": false
}| Field | Required | Notes |
|---|---|---|
| Yes | Percentage is an integer 1-100 |
| v3/v4 | NFT id identifying the position |
| No | Applies to V2 and V3 (ignored on V4). Default / |
| No | Routes to the permissioned PositionManager (KYC-gated pools). |
| No |
Response: .
{ requestId, token0, token1, decrease: TransactionRequest, gasFee? }v3 fee collection on decrease: for v3, the returnedcalldata bundles uncollected fees into the withdrawal automatically, so you do not need to calldecreaseseparately. Note the response/lp/claim_fees/token0amounts reflect only the pro-rata liquidity removed — the swept fees are encoded in the calldata, not added to those response amounts.token1
从 v2/v3/v4 头寸中移除一定比例的流动性。
请求
json
{
"walletAddress": "0x...",
"chainId": 130,
"protocol": "V4",
"token0Address": "0x0000000000000000000000000000000000000000",
"token1Address": "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
"liquidityPercentageToDecrease": 25,
"nftTokenId": "1833079",
"simulateTransaction": false
}| 字段 | 必填 | 说明 |
|---|---|---|
| 是 | 百分比为 1-100 的整数 |
| v3/v4 必填 | 标识头寸的 NFT ID |
| 否 | 适用于 V2 和 V3(V4 上忽略)。默认/ |
| 否 | 路由到权限型 PositionManager(KYC 门控池)。 |
| 否 |
响应:。
{ requestId, token0, token1, decrease: TransactionRequest, gasFee? }v3 减少流动性时的手续费收取:对于 v3,返回的calldata 会自动将未收取的手续费打包到提款中,因此你无需单独调用decrease。注意,响应中的/lp/claim_fees/token0数量仅反映按比例移除的流动性 — 归集的手续费编码在 calldata 中,不会添加到这些响应数量里。token1
POST /lp/claim_fees
POST /lp/claim_fees
Collect accumulated trading fees from a v3 or v4 position. Not available for v2.
Request
json
{
"protocol": "V4",
"walletAddress": "0x...",
"chainId": 130,
"tokenId": "1833079",
"simulateTransaction": false
}| Field | Required | Notes |
|---|---|---|
| Yes | |
| No | v3 only. If |
| No | Routes to the permissioned PositionManager (KYC-gated pools). |
| No |
Response: .
{ requestId, token0, token1, claim: TransactionRequest, gasFee? }从 v3 或 v4 头寸收取累积的交易手续费。v2 不支持。
请求
json
{
"protocol": "V4",
"walletAddress": "0x...",
"chainId": 130,
"tokenId": "1833079",
"simulateTransaction": false
}| 字段 | 必填 | 说明 |
|---|---|---|
| 是 | |
| 否 | 仅 v3 支持。若为 |
| 否 | 路由到权限型 PositionManager(KYC 门控池)。 |
| 否 |
响应:。
{ requestId, token0, token1, claim: TransactionRequest, gasFee? }POST /lp/pool_info
POST /lp/pool_info
Read live pool state (reserves, tick, , liquidity) for one or more pools.
sqrtRatioX96Request: (only is strictly required; supply or to identify pools).
{ protocol, poolParameters?, poolReferences?, chainId?, pageSize?, currentPage? }protocolpoolParameters{ tokenAddressA, tokenAddressB, fee?, tickSpacing?, hookAddress? }poolReferencesResponse: where each includes (note: address/amount/decimals fields use the / suffix, but the two reserve fields use /). Optional fields (e.g. amounts, , reserves) are omitted when not applicable to the pool.
{ requestId, pools: PoolInformation[], pageSize, currentPage }PoolInformationpoolReferenceIdentifier, poolProtocol, tokenAddressA, tokenAddressB, tickSpacing, fee, hookAddress, chainId, tokenAmountA, tokenAmountB, tokenDecimalsA, tokenDecimalsB, poolLiquidity, sqrtRatioX96, currentTick, token0Reserves, token1ReservesAB01hookAddress读取一个或多个池的实时状态(储备量、tick、、流动性)。
sqrtRatioX96请求:(仅 为强制必填;提供 或 来标识池)。
{ protocol, poolParameters?, poolReferences?, chainId?, pageSize?, currentPage? }protocolpoolParameters{ tokenAddressA, tokenAddressB, fee?, tickSpacing?, hookAddress? }poolReferences响应:,其中每个 包含 (注意:地址/数量/小数位字段使用 / 后缀,但两个储备字段使用 /)。不适用于池的可选字段(例如数量、、储备量)将被省略。
{ requestId, pools: PoolInformation[], pageSize, currentPage }PoolInformationpoolReferenceIdentifier, poolProtocol, tokenAddressA, tokenAddressB, tickSpacing, fee, hookAddress, chainId, tokenAmountA, tokenAmountB, tokenDecimalsA, tokenDecimalsB, poolLiquidity, sqrtRatioX96, currentTick, token0Reserves, token1ReservesAB01hookAddressField-name quirks to preserve
需要注意的字段名差异
The same concept is named differently across endpoints. Use the exact name per endpoint:
| Concept | | | |
|---|---|---|---|
| Position NFT id | | | |
| Concept | | |
|---|---|---|
| v4 permit payload | | |
同一概念在不同端点中的命名不同。请按端点使用确切的字段名:
| 概念 | | | |
|---|---|---|---|
| 头寸 NFT ID | | | |
| 概念 | | |
|---|---|---|
| v4 permit 载荷 | | |
Approval and Permit Flow
授权与 Permit 流程
Always call before any LP action, even when approvals were previously granted (allowances can be revoked or consumed).
/lp/check_approval在任何 LP 操作前始终调用 ,即使之前已授予授权(授权额度可能被撤销或消耗)。
/lp/check_approvalOnchain approvals
链上授权
ts
const res = await fetch(`${LP_API_BASE_URL}/lp/check_approval`, {
method: 'POST',
headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json', Accept: 'application/json' },
body: JSON.stringify({ walletAddress, protocol: 'V4', chainId: 1, lpTokens, action: 'CREATE' }),
});
if (!res.ok) throw new Error(`check_approval failed: ${res.status}`);
const { transactions, v4BatchPermitData, kycRequiredWarnings } = await res.json();
// A permissioned pool gates LPing on KYC: a non-empty kycRequiredWarnings means render the
// KYC CTA (warning.kycUrl) and stop — do NOT treat empty transactions as "approved" here.
if (kycRequiredWarnings?.length)
throw new Error('Wallet not allowlisted for this permissioned pool');
// transactions is an array of ApprovalTransactionRequest. Empty (and no KYC warnings) => already approved.
for (const approval of transactions) {
validateLpTransaction(approval.transaction); // see Critical Notes
const hash = await walletClient.sendTransaction(approval.transaction);
await publicClient.waitForTransactionReceipt({ hash });
}ts
const res = await fetch(`${LP_API_BASE_URL}/lp/check_approval`, {
method: 'POST',
headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json', Accept: 'application/json' },
body: JSON.stringify({ walletAddress, protocol: 'V4', chainId: 1, lpTokens, action: 'CREATE' }),
});
if (!res.ok) throw new Error(`check_approval failed: ${res.status}`);
const { transactions, v4BatchPermitData, kycRequiredWarnings } = await res.json();
// A permissioned pool gates LPing on KYC: a non-empty kycRequiredWarnings means render the
// KYC CTA (warning.kycUrl) and stop — do NOT treat empty transactions as "approved" here.
if (kycRequiredWarnings?.length)
throw new Error('Wallet not allowlisted for this permissioned pool');
// transactions is an array of ApprovalTransactionRequest. Empty (and no KYC warnings) => already approved.
for (const approval of transactions) {
validateLpTransaction(approval.transaction); // see Critical Notes
const hash = await walletClient.sendTransaction(approval.transaction);
await publicClient.waitForTransactionReceipt({ hash });
}v4 permit (EIP-712 sign-and-return)
v4 permit(EIP-712 签名并返回)
For v4, returns a (a gasless Permit2 batch approval) — often alongside onchain ERC-20 → Permit2 approval , not instead of them. Execute any returned first (Permit2 needs the ERC-20 allowance), then sign the permit offchain and pass it into the next call.
check_approvalv4BatchPermitDatatransactionstransactionsThe permit payload is proto-encoded and is NOT directly viem-ready. Normalize two fields before signing — the un-normalized object is still what you send back to the API:
arrives as the chain enum-name string (e.g.domain.chainId), not a number — replace it with the numeric chain ID."UNICHAIN"- each
entry is wrapped astypes; viem (and the EIP-712 spec) expect a bare array — unwrap{ fields: [...] }..fields
ts
let signature: string | undefined;
if (v4BatchPermitData) {
// Normalize the proto-encoded permit into viem's TypedData shape (for signing only).
const types = Object.fromEntries(
Object.entries(v4BatchPermitData.types).map(([k, v]) => [k, (v as any).fields])
);
const domain = { ...v4BatchPermitData.domain, chainId }; // numeric chainId (e.g. 130), NOT "UNICHAIN"
signature = await walletClient.signTypedData({
domain,
types,
message: v4BatchPermitData.values,
primaryType: 'PermitBatch',
});
}
// Send the ORIGINAL (un-normalized) permit back to the API, with the signature.
// /lp/create (uses batchPermitData) ...
const createBody = { ...createParams, batchPermitData: v4BatchPermitData, signature };
// ... or /lp/increase (uses v4BatchPermitData)
const increaseBody = { ...increaseParams, v4BatchPermitData, signature };For full typed implementations (v3 NFT permit, edge cases, migration), see Advanced Patterns Reference.
EIP712Domain对于 v4, 会返回 (一种无 gas 的 Permit2 批量授权)— 通常与链上 ERC-20 → Permit2 授权 一起返回,而非替代它们。先执行所有返回的 (Permit2 需要 ERC-20 授权额度),然后离线签名 permit 并将其传入下一个调用。
check_approvalv4BatchPermitDatatransactionstransactionspermit 载荷是 proto 编码的,不能直接在 viem 中使用。 签名前需要标准化两个字段 — 但发送回 API 时仍需使用未标准化的对象:
返回时是链的枚举名称字符串(例如domain.chainId),而非数字 — 将其替换为数字链 ID。"UNICHAIN"- 每个
条目都被包裹为types;viem(以及 EIP-712 规范)期望裸数组 — 解包{ fields: [...] }。.fields
ts
let signature: string | undefined;
if (v4BatchPermitData) {
// Normalize the proto-encoded permit into viem's TypedData shape (for signing only).
const types = Object.fromEntries(
Object.entries(v4BatchPermitData.types).map(([k, v]) => [k, (v as any).fields])
);
const domain = { ...v4BatchPermitData.domain, chainId }; // numeric chainId (e.g. 130), NOT "UNICHAIN"
signature = await walletClient.signTypedData({
domain,
types,
message: v4BatchPermitData.values,
primaryType: 'PermitBatch',
});
}
// Send the ORIGINAL (un-normalized) permit back to the API, with the signature.
// /lp/create (uses batchPermitData) ...
const createBody = { ...createParams, batchPermitData: v4BatchPermitData, signature };
// ... or /lp/increase (uses v4BatchPermitData)
const increaseBody = { ...increaseParams, v4BatchPermitData, signature };有关完整的类型化实现(v3 NFT permit、 边缘情况、迁移),请参见高级模式参考。
EIP712DomainCritical Implementation Notes
关键实现注意事项
1. Sign the wrapped transaction, not the wrapper
1. 对被包裹的交易签名,而非包裹对象
/lp/check_approvaltransactions: ApprovalTransactionRequest[]{ transaction, cancelApproval, action, gasFee? }ts
// WRONG — signs the wrapper object, not a transaction
for (const a of transactions) await walletClient.sendTransaction(a);
// CORRECT
for (const a of transactions) await walletClient.sendTransaction(a.transaction);/lp/check_approvaltransactions: ApprovalTransactionRequest[]{ transaction, cancelApproval, action, gasFee? }ts
// WRONG — signs the wrapper object, not a transaction
for (const a of transactions) await walletClient.sendTransaction(a);
// CORRECT
for (const a of transactions) await walletClient.sendTransaction(a.transaction);2. Use the contract's response field names
2. 使用合约定义的响应字段名
ts
// WRONG — these names come from the narrative guide, not the contract
const { approvals } = await checkApprovalRes.json();
const { minPrice, maxPrice } = createResponse;
// CORRECT
const { transactions } = await checkApprovalRes.json();
const { adjustedMinPrice, adjustedMaxPrice } = createResponse;ts
// WRONG — these names come from the narrative guide, not the contract
const { approvals } = await checkApprovalRes.json();
const { minPrice, maxPrice } = createResponse;
// CORRECT
const { transactions } = await checkApprovalRes.json();
const { adjustedMinPrice, adjustedMaxPrice } = createResponse;3. Never modify, always validate the data
field
data3. 切勿修改 data
字段,始终进行验证
dataThe / / / field holds pre-validated calldata.
createincreasedecreaseclaimts
function validateLpTransaction(tx: TransactionRequest): void {
if (!tx.data || tx.data === '' || tx.data === '0x') throw new Error('Empty transaction data');
if (!tx.to || !isAddress(tx.to)) throw new Error('Invalid recipient address');
if (!tx.from || !isAddress(tx.from)) throw new Error('Invalid sender address');
if (tx.maxFeePerGas && tx.gasPrice) throw new Error('Cannot set both maxFeePerGas and gasPrice');
}Never edit the calldata — modifying it can cause reverts or loss of funds.
createincreasedecreaseclaimts
function validateLpTransaction(tx: TransactionRequest): void {
if (!tx.data || tx.data === '' || tx.data === '0x') throw new Error('Empty transaction data');
if (!tx.to || !isAddress(tx.to)) throw new Error('Invalid recipient address');
if (!tx.from || !isAddress(tx.from)) throw new Error('Invalid sender address');
if (tx.maxFeePerGas && tx.gasPrice) throw new Error('Cannot set both maxFeePerGas and gasPrice');
}切勿编辑 calldata — 修改它可能导致交易回滚或资金损失。
4. Transactions are time-sensitive
4. 交易具有时效性
Pool price moves. If the user takes more than ~30 seconds to review, refetch the transaction before broadcasting.
ts
const TX_EXPIRY_MS = 30_000;
const builtAt = Date.now();
// ... user reviews ...
if (Date.now() - builtAt > TX_EXPIRY_MS) lpTx = await refetchLpTransaction(params);池价格会波动。如果用户审核时间超过约 30 秒,广播前请重新获取交易。
ts
const TX_EXPIRY_MS = 30_000;
const builtAt = Date.now();
// ... user reviews ...
if (Date.now() - builtAt > TX_EXPIRY_MS) lpTx = await refetchLpTransaction(params);5. Amounts are wei strings
5. 数量为 wei 字符串
All fields are integer strings in the token's smallest unit. Convert with — never send ether-denominated decimals.
amountparseUnits(value, decimals).toString()所有 字段均为代币最小单位的整数字符串。使用 进行转换 — 切勿发送以 ether 计价的小数。
amountparseUnits(value, decimals).toString()6. Strip undefined optional fields
6. 移除未定义的可选字段
Send permit fields as a matched pair ( + ) or omit both. Do not send alongside a present permit, or vice versa.
batchPermitDatasignaturesignature: undefinedpermit 字段应成对发送( + ),或都不发送。不要在 permit 存在的情况下发送 ,反之亦然。
batchPermitDatasignaturesignature: undefinedWorked Example: Create a v3 Position (viem)
示例:使用 viem 创建 v3 头寸
ts
import { createWalletClient, createPublicClient, http, isAddress, parseUnits } from 'viem';
import { mainnet } from 'viem/chains';
import { privateKeyToAccount } from 'viem/accounts';
const LP_API_BASE_URL = 'https://liquidity.api.uniswap.org';
const API_KEY = process.env.UNISWAP_API_KEY!; // never hardcode
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const walletClient = createWalletClient({
account,
chain: mainnet,
transport: http(process.env.RPC_URL),
});
const publicClient = createPublicClient({ chain: mainnet, transport: http(process.env.RPC_URL) });
const headers = {
'x-api-key': API_KEY,
'Content-Type': 'application/json',
Accept: 'application/json',
};
async function lpFetch(path: string, body: object) {
const res = await fetch(`${LP_API_BASE_URL}${path}`, {
method: 'POST',
headers,
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`${path} failed: ${res.status} ${await res.text()}`);
return res.json();
}
// Same checks as the canonical validateLpTransaction in "Critical Implementation Notes" above.
function validateLpTransaction(tx: any) {
if (!tx || !tx.data || tx.data === '' || tx.data === '0x')
throw new Error('Empty transaction data');
if (!tx.to || !isAddress(tx.to)) throw new Error('Invalid recipient address');
if (!tx.from || !isAddress(tx.from)) throw new Error('Invalid sender address');
if (tx.maxFeePerGas && tx.gasPrice) throw new Error('Cannot set both maxFeePerGas and gasPrice');
}
async function createV3Position() {
const protocol = 'V3';
const chainId = 1;
const token0Address = '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'; // UNI
const token1Address = '0xdAC17F958D2ee523a2206206994597C13D831ec7'; // USDT
const independentToken = { tokenAddress: token0Address, amount: parseUnits('10', 18).toString() };
// 1. Approvals
const { transactions } = await lpFetch('/lp/check_approval', {
walletAddress: account.address,
protocol,
chainId,
lpTokens: [independentToken],
action: 'CREATE',
});
for (const a of transactions) {
validateLpTransaction(a.transaction);
const hash = await walletClient.sendTransaction(a.transaction);
await publicClient.waitForTransactionReceipt({ hash });
}
// 2. Build the create transaction
const created = await lpFetch('/lp/create', {
walletAddress: account.address,
chainId,
protocol,
independentToken,
existingPool: {
token0Address,
token1Address,
poolReference: '0x3470447f3cecffac709d3e783a307790b0208d60',
},
priceBounds: {
minPrice: '0.00000000000324',
maxPrice: '0.00000000000393',
quotedTokenAddress: token1Address,
},
simulateTransaction: true,
});
// 3. CONFIRM WITH USER before broadcasting (use AskUserQuestion in the skill flow):
// pair, amounts (created.token0 / created.token1), adjusted range
// (created.adjustedMinPrice / created.adjustedMaxPrice), created.gasFee
validateLpTransaction(created.create);
const hash = await walletClient.sendTransaction(created.create);
return publicClient.waitForTransactionReceipt({ hash });
}ts
import { createWalletClient, createPublicClient, http, isAddress, parseUnits } from 'viem';
import { mainnet } from 'viem/chains';
import { privateKeyToAccount } from 'viem/accounts';
const LP_API_BASE_URL = 'https://liquidity.api.uniswap.org';
const API_KEY = process.env.UNISWAP_API_KEY!; // never hardcode
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const walletClient = createWalletClient({
account,
chain: mainnet,
transport: http(process.env.RPC_URL),
});
const publicClient = createPublicClient({ chain: mainnet, transport: http(process.env.RPC_URL) });
const headers = {
'x-api-key': API_KEY,
'Content-Type': 'application/json',
Accept: 'application/json',
};
async function lpFetch(path: string, body: object) {
const res = await fetch(`${LP_API_BASE_URL}${path}`, {
method: 'POST',
headers,
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`${path} failed: ${res.status} ${await res.text()}`);
return res.json();
}
// Same checks as the canonical validateLpTransaction in "Critical Implementation Notes" above.
function validateLpTransaction(tx: any) {
if (!tx || !tx.data || tx.data === '' || tx.data === '0x')
throw new Error('Empty transaction data');
if (!tx.to || !isAddress(tx.to)) throw new Error('Invalid recipient address');
if (!tx.from || !isAddress(tx.from)) throw new Error('Invalid sender address');
if (tx.maxFeePerGas && tx.gasPrice) throw new Error('Cannot set both maxFeePerGas and gasPrice');
}
async function createV3Position() {
const protocol = 'V3';
const chainId = 1;
const token0Address = '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'; // UNI
const token1Address = '0xdAC17F958D2ee523a2206206994597C13D831ec7'; // USDT
const independentToken = { tokenAddress: token0Address, amount: parseUnits('10', 18).toString() };
// 1. Approvals
const { transactions } = await lpFetch('/lp/check_approval', {
walletAddress: account.address,
protocol,
chainId,
lpTokens: [independentToken],
action: 'CREATE',
});
for (const a of transactions) {
validateLpTransaction(a.transaction);
const hash = await walletClient.sendTransaction(a.transaction);
await publicClient.waitForTransactionReceipt({ hash });
}
// 2. Build the create transaction
const created = await lpFetch('/lp/create', {
walletAddress: account.address,
chainId,
protocol,
independentToken,
existingPool: {
token0Address,
token1Address,
poolReference: '0x3470447f3cecffac709d3e783a307790b0208d60',
},
priceBounds: {
minPrice: '0.00000000000324',
maxPrice: '0.00000000000393',
quotedTokenAddress: token1Address,
},
simulateTransaction: true,
});
// 3. CONFIRM WITH USER before broadcasting (use AskUserQuestion in the skill flow):
// pair, amounts (created.token0 / created.token1), adjusted range
// (created.adjustedMinPrice / created.adjustedMaxPrice), created.gasFee
validateLpTransaction(created.create);
const hash = await walletClient.sendTransaction(created.create);
return publicClient.waitForTransactionReceipt({ hash });
}Companion SDKs
配套 SDK
The API returns ready-to-sign transactions, so a protocol SDK is not required. For client-side pool/position math, tick conversions, and validation, developers commonly pair the LP API with:
- — chains,
@uniswap/sdk-core,Token,CurrencyAmount,Percent(foundational).Price - — v3 tick math (
@uniswap/v3-sdk,TickMath),nearestUsableTick,Pool.Position - — v4 pool keys, hooks-aware
@uniswap/v4-sdkmodeling.Position - — v2 pair/liquidity math.
@uniswap/v2-sdk - (or ethers) — sign and broadcast the returned
viem, and sign EIP-712 permit data.{ to, data, value }
API 返回可直接签名的交易,因此无需协议 SDK。对于客户端池/头寸计算、tick 转换和验证,开发者通常将 LP API 与以下工具搭配使用:
- — 链、
@uniswap/sdk-core、Token、CurrencyAmount、Percent(基础库)。Price - — v3 tick 计算(
@uniswap/v3-sdk、TickMath)、nearestUsableTick、Pool。Position - — v4 池密钥、支持 hooks 的
@uniswap/v4-sdk建模。Position - — v2 交易对/流动性计算。
@uniswap/v2-sdk - (或 ethers)— 签名并广播返回的
viem,以及签名 EIP-712 permit 数据。{ to, data, value }
Error Handling
错误处理
| Code | Meaning | Action |
|---|---|---|
| 400 | Validation error | Fix request fields (see common errors below) |
| 401 | Invalid API key | Check the |
| 429 | Rate limited | Exponential backoff; cache repeated reads |
| 500 | API error | Retry with backoff |
| 503 | Temporary unavailability | Retry |
Error body (Connect protocol): — e.g. . is a Connect error-code string (, , , , …), not an HTTP number, and there is no top-level field. Read / , not .
{ code: string, message: string, details?: Array<{ type: string; value: string }> }{"code":"invalid_argument","message":"RequestValidationError: ...","details":[...]}codeinvalid_argumentunauthenticatedfailed_preconditioninternalerrorbody.codebody.messagebody.errorCommon errors
- v2 fee claim attempt: calling with
/lp/claim_fees. Useprotocol: "V2"to realize v2 fees./lp/decrease - Pool not found: verify token addresses, the , and the chain; or use
poolReferenceto initialize.newPool - Insufficient liquidity: the computed dependent amount exceeds balances; reduce or widen the range.
independentToken.amount - Validation error: ensure all required fields for the chosen , checksummed addresses, wei-denominated amounts, and
protocolin 1-100.liquidityPercentageToDecrease
For retry/backoff, request caching, monitoring, and the full pre-broadcast checklist, see Advanced Patterns Reference.
| 状态码 | 含义 | 处理方式 |
|---|---|---|
| 400 | 验证错误 | 修复请求字段(参见下方常见错误) |
| 401 | API 密钥无效 | 检查 |
| 429 | 速率受限 | 指数退避;缓存重复的读取请求 |
| 500 | API 错误 | 退避重试 |
| 503 | 临时不可用 | 重试 |
错误体(Connect 协议): — 例如 。 是 Connect 错误码字符串(、、、 等),不是 HTTP 状态码,且没有顶层 字段。请读取 / ,而非 。
{ code: string, message: string, details?: Array<{ type: string; value: string }> }{"code":"invalid_argument","message":"RequestValidationError: ...","details":[...]}codeinvalid_argumentunauthenticatedfailed_preconditioninternalerrorbody.codebody.messagebody.error常见错误
- 尝试申领 v2 手续费:使用 调用
protocol: "V2"。请使用/lp/claim_fees来兑现 v2 手续费。/lp/decrease - 池未找到:验证代币地址、和链;或使用
poolReference初始化。newPool - 流动性不足:计算出的对应代币数量超过余额;减少 或扩大价格区间。
independentToken.amount - 验证错误:确保所选 的所有必填字段齐全、地址为校验和格式、数量以 wei 计价、
protocol在 1-100 之间。liquidityPercentageToDecrease
有关重试/退避、请求缓存、监控以及完整的广播前检查清单,请参见高级模式参考。
Supported Chains
支持的链
The LP API supports a fixed set of chain IDs. Validate against this set before sending:
chainIdtext
1, 10, 56, 130, 137, 143, 196, 324, 480, 1868, 4217, 4326, 4663, 5042,
8453, 10143, 42161, 42220, 43114, 59144, 81457, 7777777, 1301, 84532, 11155111(Mainnet 1, Optimism 10, BNB 56, Unichain 130, Polygon 137, Base 8453, Arbitrum 42161, Avalanche 43114, Linea 59144, Blast 81457, Zora 7777777, Sepolia 11155111, and others.) Confirm the live set against availability or the supported chains docs.
/lp/pool_infoLP API 支持固定的一组链 ID。发送请求前请验证 是否在该集合中:
chainIdtext
1, 10, 56, 130, 137, 143, 196, 324, 480, 1868, 4217, 4326, 4663, 5042,
8453, 10143, 42161, 42220, 43114, 59144, 81457, 7777777, 1301, 84532, 11155111(主网 1、Optimism 10、BNB 56、Unichain 130、Polygon 137、Base 8453、Arbitrum 42161、Avalanche 43114、Linea 59144、Blast 81457、Zora 7777777、Sepolia 11155111 等。)请通过 可用性或支持的链文档确认最新的支持列表。
/lp/pool_infoAdditional Resources
更多资源
- LP API: Getting Started — official conceptual overview
- LP API: Integration Guide — official guide
- Uniswap Developer Platform dashboard — get an API key
- swap-integration — sibling skill for token swaps via the Trading API
- Advanced Patterns Reference — permit deep-dive, migration, NFT-position quirks, reliability
- LP API:入门指南 — 官方概念概述
- LP API:集成指南 — 官方指南
- Uniswap 开发者平台仪表盘 — 获取 API 密钥
- swap-integration — 用于通过交易 API 进行代币兑换的姊妹技能
- 高级模式参考 — permit 深度解析、迁移、NFT 头寸注意事项、可靠性