[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A6BQQ93901KTZ19PAS3PRR":3,"skill-same:01M7A6BQQ93901KTZ19PAS3PRR":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M7A6BQQ93901KTZ19PAS3PRR","lp-integration",null,"Integrate Uniswap liquidity provisioning (LP) into applications via the LP REST API. Use when the user says \"LP API\", \"liquidity provisioning API\", \"provide liquidity programmatically\", \"create LP position via API\", \"add liquidity via API\", \"increase liquidity\", \"decrease liquidity\", \"remove liquidity\", \"claim LP fees\", \"collect LP fees\", \"manage LP positions in code\", or mentions building a backend, bot, or frontend that creates or manages Uniswap v2\u002Fv3\u002Fv4 liquidity positions through an API. Also use when debugging LP API calls (e.g. \u002Flp\u002Fcreate, \u002Flp\u002Fcheck_approval, \u002Flp\u002Fincrease, \u002Flp\u002Fdecrease, \u002Flp\u002Fclaim_fees), unexpected response fields, the approval or EIP-712 permit flow, or transaction-building errors for liquidity positions. For generating deep links to the Uniswap web app instead of calling the API, use the liquidity-planner skill; for using the Uniswap v4 SDK directly rather than the REST API, use the v4-sdk-integration skill.","themusebook\u002Fskills","themusebook","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F349927247?v=4","01M7A5C1RV5S3V5FF6ZACVDNRN","musebook","01M7A5C1SFC3KRZAXNN60XJ7KM",0,"MIT","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fpublic\u002Fapi\u002Fskills\u002Flp-integration\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: lp-integration\ndescription: Integrate Uniswap liquidity provisioning (LP) into applications via the LP REST API. Use when the user says \"LP API\", \"liquidity provisioning API\", \"provide liquidity programmatically\", \"create LP position via API\", \"add liquidity via API\", \"increase liquidity\", \"decrease liquidity\", \"remove liquidity\", \"claim LP fees\", \"collect LP fees\", \"manage LP positions in code\", or mentions building a backend, bot, or frontend that creates or manages Uniswap v2\u002Fv3\u002Fv4 liquidity positions through an API. Also use when debugging LP API calls (e.g. \u002Flp\u002Fcreate, \u002Flp\u002Fcheck_approval, \u002Flp\u002Fincrease, \u002Flp\u002Fdecrease, \u002Flp\u002Fclaim_fees), unexpected response fields, the approval or EIP-712 permit flow, or transaction-building errors for liquidity positions. For generating deep links to the Uniswap web app instead of calling the API, use the liquidity-planner skill; for using the Uniswap v4 SDK directly rather than the REST API, use the v4-sdk-integration skill.\nallowed-tools: Read, Write, Edit, Glob, Grep, Bash(npm:*), Bash(npx:*), Bash(yarn:*), Bash(curl:*), WebFetch, Task(subagent_type:swap-integration-expert)\nmodel: opus\nlicense: MIT\nmetadata:\n  author: uniswap\n  version: '0.1.0'\n---\n\n# LP Integration\n\nIntegrate Uniswap liquidity provisioning into frontends, backends, and bots using the Uniswap LP API.\n\nThe 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.\n\n## Prerequisites\n\nThis skill assumes familiarity with viem basics (client setup, account management, contract interactions, transaction signing). Install the **uniswap-viem** plugin for comprehensive viem\u002Fwagmi guidance: `claude plugin add @uniswap\u002Funiswap-viem`\n\nFor token swaps (not liquidity), see the sibling **swap-integration** skill in this plugin.\n\n## Base URL\n\n```text\nLP_API_BASE_URL = https:\u002F\u002Fliquidity.api.uniswap.org\n```\n\nAll LP endpoints are POST requests under the `\u002Flp\u002F` prefix (e.g. `https:\u002F\u002Fliquidity.api.uniswap.org\u002Flp\u002Fcreate`).\n\n> **The LP API host is intentionally different from the swap Trading API.** Liquidity provisioning lives at `https:\u002F\u002Fliquidity.api.uniswap.org` (no `\u002Fv1` prefix), not the `https:\u002F\u002Ftrade-api.gateway.uniswap.org\u002Fv1` host used for swaps. Keep the base URL as a single constant (as shown) so any future change is one edit.\n\n## Authentication\n\nEvery write\u002Fapproval endpoint requires an API key sent as the `x-api-key` header; a missing or invalid key returns `401` with `{\"code\":\"unauthenticated\"}`. (`\u002Flp\u002Fpool_info` is a read endpoint and does not strictly enforce the key, but always send it for consistency and rate-limit attribution.)\n\n```text\nContent-Type: application\u002Fjson\nAccept: application\u002Fjson\nx-api-key: \u003Cyour-api-key>\n```\n\n**Getting a key:** Register at the [Uniswap Developer Platform dashboard](https:\u002F\u002Fdevelopers.uniswap.org\u002Fdashboard). The same key works across swapping and liquidity provisioning. Never hardcode the key; load it from an environment variable.\n\n## Quick Decision Guide\n\n| You want to...                                | Endpoint             | Protocols  |\n| --------------------------------------------- | -------------------- | ---------- |\n| Check\u002Fgrant token approvals before any action | `\u002Flp\u002Fcheck_approval` | V2, V3, V4 |\n| Create a concentrated-liquidity position      | `\u002Flp\u002Fcreate`         | V3, V4     |\n| Create a full-range (classic) position        | `\u002Flp\u002Fcreate_classic` | V2         |\n| Add liquidity to an existing position         | `\u002Flp\u002Fincrease`       | V2, V3, V4 |\n| Remove a percentage of liquidity              | `\u002Flp\u002Fdecrease`       | V2, V3, V4 |\n| Collect accumulated trading fees              | `\u002Flp\u002Fclaim_fees`     | V3, V4     |\n| Read live pool state                          | `\u002Flp\u002Fpool_info`      | V2, V3, V4 |\n\n### Protocol capability matrix\n\n| Protocol | Create endpoint      | Fee claiming                         | Price range          |\n| -------- | -------------------- | ------------------------------------ | -------------------- |\n| `V2`     | `\u002Flp\u002Fcreate_classic` | Not separable (realized on decrease) | Full range only      |\n| `V3`     | `\u002Flp\u002Fcreate`         | `\u002Flp\u002Fclaim_fees`                     | Concentrated         |\n| `V4`     | `\u002Flp\u002Fcreate`         | `\u002Flp\u002Fclaim_fees`                     | Concentrated + hooks |\n\n> **v2 fees are not separately claimable.** They accrue into the LP token value and are realized when you call `\u002Flp\u002Fdecrease`. Calling `\u002Flp\u002Fclaim_fees` with `protocol: \"V2\"` returns a validation error.\n\n## Input Validation Rules\n\nBefore interpolating ANY user-provided value into generated code, API calls, or commands:\n\n- **Ethereum addresses**: MUST match `^0x[a-fA-F0-9]{40}$` — reject otherwise. Use native ETH as `0x0000000000000000000000000000000000000000`.\n- **Chain IDs**: MUST be one of the supported LP chain IDs (see [Supported Chains](#supported-chains)).\n- **Token amounts**: MUST be non-negative integer strings in wei \u002F smallest token unit, matching `^[0-9]+$`. Never pass ether-denominated decimals as amounts.\n- **`liquidityPercentageToDecrease`**: MUST be an integer from 1 to 100.\n- **API keys**: MUST NOT be hardcoded in generated code — always use environment variables.\n- **REJECT** any input containing shell metacharacters: `;`, `|`, `&`, `$`, `` ` ``, `(`, `)`, `>`, `\u003C`, `\\`, `'`, `\"`, newlines.\n\n> **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.\n\n---\n\n## Architecture\n\n### What the API handles\n\n- **Pool state fetching**: current reserves, ticks, `sqrtRatioX96`, and onchain position data.\n- **Dependent amount computation**: given one token amount (`independentToken`), computes the required amount of the other using the Uniswap SDKs.\n- **Transaction creation**: validated, fully-formed calldata for each LP action, ready to sign.\n- **Tick snapping**: converts human-readable `priceBounds` to valid ticks and returns the adjusted prices.\n- **Gas estimation**: optional, when `simulateTransaction: true`.\n\n### What your application handles\n\n- **Signing and broadcasting** the returned transaction via your RPC provider.\n- **Signing permit data** (EIP-712) when the API returns it for v4 \u002F v3-NFT approvals.\n- **Gas payment** and transaction error handling (reverts, surfacing errors to users).\n\n### Data flow\n\n```text\nUser intent (create \u002F increase \u002F decrease \u002F claim)\n   |\nYour application\n   |-- POST \u002Flp\u002Fcheck_approval        -> returns approval transactions and\u002For permit data\n   |-- (execute approval txns; sign permit if returned)\n   |-- POST \u002Flp\u002Fcreate | increase | decrease | claim_fees\n   |-- validate the returned transaction payload (non-empty data, valid addresses)\n   |-- user signature (wallet)\n   +-- broadcast (your RPC)\n        |\n   Blockchain\n```\n\n## Endpoint Reference\n\nAll field names below come from the LP API OpenAPI contract. Where the public integration guide uses different names, the contract names here are authoritative.\n\n### POST \u002Flp\u002Fcheck_approval\n\nAlways call this first. Returns the approval transactions (and\u002For permit data) needed before an LP action. If the response `transactions` array is empty and no permit data is returned, all approvals are already in place — **unless** `kycRequiredWarnings` is non-empty, which means the pool contains a permissioned token and the wallet is not allowlisted. In that case the response is still `200`; render the KYC call-to-action from each warning's `kycUrl` instead of attempting the LP action.\n\n**Request**\n\n```json\n{\n  \"walletAddress\": \"0x...\",\n  \"protocol\": \"V4\",\n  \"chainId\": 1,\n  \"lpTokens\": [\n    { \"tokenAddress\": \"0x...\", \"amount\": \"1000000000000000000\" },\n    { \"tokenAddress\": \"0x...\", \"amount\": \"500000000\" }\n  ],\n  \"action\": \"CREATE\"\n}\n```\n\n| Field                         | Required | Notes                                                                       |\n| ----------------------------- | -------- | --------------------------------------------------------------------------- |\n| `walletAddress`               | Yes      | The position owner                                                          |\n| `protocol`                    | Yes      | `V2` \\| `V3` \\| `V4`                                                        |\n| `chainId`                     | Yes      | Supported chain ID                                                          |\n| `lpTokens`                    | Yes      | Array of `{ tokenAddress, amount }` to be spent                             |\n| `action`                      | Yes      | `CREATE` \\| `INCREASE` \\| `DECREASE` \\| `MIGRATE`                           |\n| `simulateTransaction`         | No       | Include gas estimates                                                       |\n| `includeGasInfo`              | No       | Include gas info on returned approvals                                      |\n| `generatePermitAsTransaction` | No       | If `true`, return permit as an executable transaction instead of typed data |\n| `urgency`                     | No       | `NORMAL` \\| `FAST` \\| `URGENT`                                              |\n| `v3NftTokenId`                | No       | v3 NFT id when approving a position-manager NFT                             |\n\n**Response**\n\n```ts\ninterface CheckApprovalResponse {\n  requestId: string;\n  transactions: ApprovalTransactionRequest[]; \u002F\u002F sign each .transaction; empty (with kycRequiredWarnings also empty) = nothing to approve\n  v4BatchPermitData?: NullablePermit; \u002F\u002F v4: sign and pass into \u002Flp\u002Fcreate or \u002Flp\u002Fincrease\n  v3NftPermitData?: NullablePermit; \u002F\u002F v3 NFT permit\n  kycRequiredWarnings: KycRequiredWarning[]; \u002F\u002F permissioned pools: non-empty when the wallet is NOT allowlisted. Always present (usually []).\n}\n\ninterface ApprovalTransactionRequest {\n  transaction: TransactionRequest; \u002F\u002F the tx to sign and broadcast\n  cancelApproval: boolean;\n  action: 'CREATE' | 'INCREASE' | 'DECREASE' | 'MIGRATE';\n  gasFee?: string;\n}\n\ninterface KycRequiredWarning {\n  kycUrl: string;\n  tokenAddress: string;\n  chainId: number;\n}\n```\n\n> **The response field is `transactions`, not `approvals`.** Each element WRAPS a transaction. Sign `element.transaction`, never the element object itself. There are no top-level `token`\u002F`spender` fields.\n\n### POST \u002Flp\u002Fcreate\n\nCreate a v3 or v4 concentrated-liquidity position. Specify a price range and one token amount; the API computes the other from live pool state.\n\n**Pool specification** — provide exactly one of:\n\n- `existingPool`: `{ token0Address, token1Address, poolReference }` where `poolReference` is the pool address (v3) or pool ID (v4).\n- `newPool`: `{ token0Address, token1Address, fee, tickSpacing, hooks?, initialPrice }` where `initialPrice` is a `sqrtRatioX96` string (`hooks` is v4-only).\n\n**Price range** — provide exactly one of:\n\n- `priceBounds`: `{ minPrice, maxPrice, quotedTokenAddress }` — `minPrice`\u002F`maxPrice` are decimal price strings and `quotedTokenAddress` is **required** (it must equal `token0Address` or `token1Address`). `quotedTokenAddress` sets which token the prices are denominated in; there is no default, and omitting it returns a `400`. The API snaps to valid ticks and returns the adjusted prices.\n- `tickBounds`: `{ tickLower, tickUpper }` raw integers.\n\n**Request**\n\n```json\n{\n  \"walletAddress\": \"0x...\",\n  \"chainId\": 1,\n  \"protocol\": \"V3\",\n  \"existingPool\": {\n    \"token0Address\": \"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984\",\n    \"token1Address\": \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n    \"poolReference\": \"0x3470447f3cecffac709d3e783a307790b0208d60\"\n  },\n  \"independentToken\": {\n    \"tokenAddress\": \"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984\",\n    \"amount\": \"198251669183062942\"\n  },\n  \"priceBounds\": {\n    \"minPrice\": \"0.00000000000324\",\n    \"maxPrice\": \"0.00000000000393\",\n    \"quotedTokenAddress\": \"0xdAC17F958D2ee523a2206206994597C13D831ec7\"\n  },\n  \"simulateTransaction\": false\n}\n```\n\n| Field                                                      | Required     | Notes                                                                                    |\n| ---------------------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------- |\n| `walletAddress`, `chainId`, `protocol`, `independentToken` | Yes          | `independentToken` is `{ tokenAddress, amount }`                                         |\n| `existingPool` \\| `newPool`                                | One required | See pool specification above                                                             |\n| `priceBounds` \\| `tickBounds`                              | One required | See price range above                                                                    |\n| `dependentToken`                                           | No           | Override the computed dependent amount                                                   |\n| `slippageTolerance`                                        | No           | Decimal percent (e.g. `0.5`)                                                             |\n| `deadline`                                                 | No           | Unix seconds                                                                             |\n| `simulateTransaction`                                      | No           | Include `gasFee` in response                                                             |\n| `urgency`                                                  | No           | `NORMAL` \\| `FAST` \\| `URGENT`                                                           |\n| `batchPermitData` + `signature`                            | No           | v4 permit from `\u002Flp\u002Fcheck_approval` (note: create uses `batchPermitData`)                |\n| `nativeTokenBalance`                                       | No           | Used when one side is native ETH                                                         |\n| `includeApprovalSimulation`                                | No           | Include approval pre-calls in the gas simulation (only with `simulateTransaction: true`) |\n\n**Response**\n\n```ts\ninterface CreatePositionResponse {\n  requestId: string;\n  token0: LPToken; \u002F\u002F { tokenAddress, amount }\n  token1: LPToken;\n  adjustedMinPrice: string; \u002F\u002F show THIS to the user, not your input minPrice\n  adjustedMaxPrice: string;\n  tickLower: number;\n  tickUpper: number;\n  create: TransactionRequest;\n  gasFee?: string; \u002F\u002F present when simulateTransaction: true\n  slippage?: number; \u002F\u002F effective slippage the API applied (e.g. native-token v4 cases)\n}\n```\n\n> **Display `adjustedMinPrice` \u002F `adjustedMaxPrice`** (the tick-snapped values), not the original `priceBounds` you sent.\n\n### POST \u002Flp\u002Fcreate_classic\n\nCreate a v2 (full-range) position. Provide one `independentToken` amount; the API computes the `dependentToken` from current pair reserves.\n\n**Request**\n\n```json\n{\n  \"walletAddress\": \"0x...\",\n  \"poolParameters\": {\n    \"token0Address\": \"0xc02fe7317d4eb8753a02c35fe019786854a92001\",\n    \"token1Address\": \"0x0000000000000000000000000000000000000000\",\n    \"chainId\": 130\n  },\n  \"independentToken\": {\n    \"tokenAddress\": \"0xc02fe7317d4eb8753a02c35fe019786854a92001\",\n    \"amount\": \"1000000000000000\"\n  },\n  \"simulateTransaction\": false\n}\n```\n\n| Field                                                                                          | Required | Notes                                                                        |\n| ---------------------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------- |\n| `walletAddress`                                                                                | Yes      |                                                                              |\n| `poolParameters`                                                                               | Yes      | `{ token0Address, token1Address, chainId }`                                  |\n| `independentToken`                                                                             | Yes      | `{ tokenAddress, amount }`                                                   |\n| `dependentToken`                                                                               | No       | If omitted, computed from reserves. Required when creating a brand-new pool. |\n| `slippageTolerance`, `deadline`, `simulateTransaction`, `urgency`, `includeApprovalSimulation` | No       |                                                                              |\n\n**Response**: `{ requestId, independentToken, dependentToken, create: TransactionRequest, gasFee? }`. Note the create_classic response names the tokens `independentToken` \u002F `dependentToken` (not `token0` \u002F `token1`).\n\n### POST \u002Flp\u002Fincrease\n\nAdd liquidity to an existing v2\u002Fv3\u002Fv4 position. Provide one token amount; the API computes the other.\n\n**Request**\n\n```json\n{\n  \"walletAddress\": \"0x...\",\n  \"chainId\": 130,\n  \"protocol\": \"V4\",\n  \"token0Address\": \"0x0000000000000000000000000000000000000000\",\n  \"token1Address\": \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\",\n  \"nftTokenId\": \"1833079\",\n  \"independentToken\": {\n    \"tokenAddress\": \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\",\n    \"amount\": \"8223\"\n  },\n  \"simulateTransaction\": false\n}\n```\n\n| Field                                                                                        | Required | Notes                                                                                                                         |\n| -------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- |\n| `walletAddress`, `chainId`, `protocol`, `token0Address`, `token1Address`, `independentToken` | Yes      | `token0Address`\u002F`token1Address` must match the order in the existing position                                                 |\n| `nftTokenId`                                                                                 | v3\u002Fv4    | NFT id identifying the position                                                                                               |\n| `slippageTolerance`, `deadline`, `simulateTransaction`, `urgency`                            | No       |                                                                                                                               |\n| `v4BatchPermitData` + `signature`                                                            | No       | v4 permit from `\u002Flp\u002Fcheck_approval` (note: increase uses `v4BatchPermitData`, create uses `batchPermitData`)                  |\n| `nativeTokenBalance`, `includeApprovalSimulation`, `permissioned`                            | No       | `nativeTokenBalance` when one side is native ETH; `permissioned` routes to the permissioned PositionManager (KYC-gated pools) |\n\n**Response**: `{ requestId, token0, token1, increase: TransactionRequest, gasFee?, slippage? }`.\n\n> **Native ETH**: use `0x0000000000000000000000000000000000000000`. The API generates a multicall including `refundETH` to return any excess.\n\n### POST \u002Flp\u002Fdecrease\n\nRemove a percentage of liquidity from a v2\u002Fv3\u002Fv4 position.\n\n**Request**\n\n```json\n{\n  \"walletAddress\": \"0x...\",\n  \"chainId\": 130,\n  \"protocol\": \"V4\",\n  \"token0Address\": \"0x0000000000000000000000000000000000000000\",\n  \"token1Address\": \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\",\n  \"liquidityPercentageToDecrease\": 25,\n  \"nftTokenId\": \"1833079\",\n  \"simulateTransaction\": false\n}\n```\n\n| Field                                                                                                     | Required | Notes                                                                                                  |\n| --------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------ |\n| `walletAddress`, `chainId`, `protocol`, `token0Address`, `token1Address`, `liquidityPercentageToDecrease` | Yes      | Percentage is an integer 1-100                                                                         |\n| `nftTokenId`                                                                                              | v3\u002Fv4    | NFT id identifying the position                                                                        |\n| `withdrawAsWeth`                                                                                          | No       | Applies to V2 and V3 (ignored on V4). Default \u002F `true` keeps WETH; `false` unwraps WETH to native ETH. |\n| `permissioned`                                                                                            | No       | Routes to the permissioned PositionManager (KYC-gated pools).                                          |\n| `slippageTolerance`, `deadline`, `simulateTransaction`, `urgency`                                         | No       |                                                                                                        |\n\n**Response**: `{ requestId, token0, token1, decrease: TransactionRequest, gasFee? }`.\n\n> **v3 fee collection on decrease**: for v3, the returned `decrease` calldata bundles uncollected fees into the withdrawal automatically, so you do not need to call `\u002Flp\u002Fclaim_fees` separately. Note the response `token0` \u002F `token1` amounts reflect only the pro-rata liquidity removed — the swept fees are encoded in the calldata, not added to those response amounts.\n\n### POST \u002Flp\u002Fclaim_fees\n\nCollect accumulated trading fees from a v3 or v4 position. Not available for v2.\n\n**Request**\n\n```json\n{\n  \"protocol\": \"V4\",\n  \"walletAddress\": \"0x...\",\n  \"chainId\": 130,\n  \"tokenId\": \"1833079\",\n  \"simulateTransaction\": false\n}\n```\n\n| Field                                             | Required | Notes                                                                                         |\n| ------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------- |\n| `protocol`, `walletAddress`, `chainId`, `tokenId` | Yes      | `protocol` of `V2` returns a validation error. Note: claim uses `tokenId` (not `nftTokenId`). |\n| `collectAsWeth`                                   | No       | v3 only. If `false`, unwraps WETH to native ETH.                                              |\n| `permissioned`                                    | No       | Routes to the permissioned PositionManager (KYC-gated pools).                                 |\n| `simulateTransaction`                             | No       |                                                                                               |\n\n**Response**: `{ requestId, token0, token1, claim: TransactionRequest, gasFee? }`.\n\n### POST \u002Flp\u002Fpool_info\n\nRead live pool state (reserves, tick, `sqrtRatioX96`, liquidity) for one or more pools.\n\n**Request**: `{ protocol, poolParameters?, poolReferences?, chainId?, pageSize?, currentPage? }` (only `protocol` is strictly required; supply `poolParameters` `{ tokenAddressA, tokenAddressB, fee?, tickSpacing?, hookAddress? }` or `poolReferences` to identify pools).\n\n**Response**: `{ requestId, pools: PoolInformation[], pageSize, currentPage }` where each `PoolInformation` includes `poolReferenceIdentifier, poolProtocol, tokenAddressA, tokenAddressB, tickSpacing, fee, hookAddress, chainId, tokenAmountA, tokenAmountB, tokenDecimalsA, tokenDecimalsB, poolLiquidity, sqrtRatioX96, currentTick, token0Reserves, token1Reserves` (note: address\u002Famount\u002Fdecimals fields use the `A`\u002F`B` suffix, but the two reserve fields use `0`\u002F`1`). Optional fields (e.g. amounts, `hookAddress`, reserves) are omitted when not applicable to the pool.\n\n### Field-name quirks to preserve\n\nThe same concept is named differently across endpoints. Use the exact name per endpoint:\n\n| Concept         | `\u002Flp\u002Fclaim_fees` | `\u002Flp\u002Fincrease`, `\u002Flp\u002Fdecrease` | `\u002Flp\u002Fcheck_approval`     |\n| --------------- | ---------------- | ------------------------------ | ------------------------ |\n| Position NFT id | `tokenId`        | `nftTokenId`                   | `v3NftTokenId` (integer) |\n\n| Concept           | `\u002Flp\u002Fcreate`      | `\u002Flp\u002Fincrease`      |\n| ----------------- | ----------------- | ------------------- |\n| v4 permit payload | `batchPermitData` | `v4BatchPermitData` |\n\n## Approval and Permit Flow\n\nAlways call `\u002Flp\u002Fcheck_approval` before any LP action, even when approvals were previously granted (allowances can be revoked or consumed).\n\n### Onchain approvals\n\n```ts\nconst res = await fetch(`${LP_API_BASE_URL}\u002Flp\u002Fcheck_approval`, {\n  method: 'POST',\n  headers: { 'x-api-key': API_KEY, 'Content-Type': 'application\u002Fjson', Accept: 'application\u002Fjson' },\n  body: JSON.stringify({ walletAddress, protocol: 'V4', chainId: 1, lpTokens, action: 'CREATE' }),\n});\nif (!res.ok) throw new Error(`check_approval failed: ${res.status}`);\nconst { transactions, v4BatchPermitData, kycRequiredWarnings } = await res.json();\n\n\u002F\u002F A permissioned pool gates LPing on KYC: a non-empty kycRequiredWarnings means render the\n\u002F\u002F KYC CTA (warning.kycUrl) and stop — do NOT treat empty transactions as \"approved\" here.\nif (kycRequiredWarnings?.length)\n  throw new Error('Wallet not allowlisted for this permissioned pool');\n\n\u002F\u002F transactions is an array of ApprovalTransactionRequest. Empty (and no KYC warnings) => already approved.\nfor (const approval of transactions) {\n  validateLpTransaction(approval.transaction); \u002F\u002F see Critical Notes\n  const hash = await walletClient.sendTransaction(approval.transaction);\n  await publicClient.waitForTransactionReceipt({ hash });\n}\n```\n\n### v4 permit (EIP-712 sign-and-return)\n\nFor v4, `check_approval` returns a `v4BatchPermitData` (a gasless Permit2 batch approval) — often **alongside** onchain ERC-20 → Permit2 approval `transactions`, not instead of them. Execute any returned `transactions` first (Permit2 needs the ERC-20 allowance), then sign the permit offchain and pass it into the next call.\n\n> **The 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:\n>\n> - `domain.chainId` arrives as the chain **enum-name string** (e.g. `\"UNICHAIN\"`), not a number — replace it with the numeric chain ID.\n> - each `types` entry is wrapped as `{ fields: [...] }`; viem (and the EIP-712 spec) expect a bare array — unwrap `.fields`.\n\n```ts\nlet signature: string | undefined;\nif (v4BatchPermitData) {\n  \u002F\u002F Normalize the proto-encoded permit into viem's TypedData shape (for signing only).\n  const types = Object.fromEntries(\n    Object.entries(v4BatchPermitData.types).map(([k, v]) => [k, (v as any).fields])\n  );\n  const domain = { ...v4BatchPermitData.domain, chainId }; \u002F\u002F numeric chainId (e.g. 130), NOT \"UNICHAIN\"\n\n  signature = await walletClient.signTypedData({\n    domain,\n    types,\n    message: v4BatchPermitData.values,\n    primaryType: 'PermitBatch',\n  });\n}\n\n\u002F\u002F Send the ORIGINAL (un-normalized) permit back to the API, with the signature.\n\u002F\u002F \u002Flp\u002Fcreate (uses batchPermitData) ...\nconst createBody = { ...createParams, batchPermitData: v4BatchPermitData, signature };\n\u002F\u002F ... or \u002Flp\u002Fincrease (uses v4BatchPermitData)\nconst increaseBody = { ...increaseParams, v4BatchPermitData, signature };\n```\n\nFor full typed implementations (v3 NFT permit, `EIP712Domain` edge cases, migration), see [Advanced Patterns Reference](.\u002Freferences\u002Fadvanced-patterns.md#permit-and-approval-deep-dive).\n\n## Critical Implementation Notes\n\n### 1. Sign the wrapped transaction, not the wrapper\n\n`\u002Flp\u002Fcheck_approval` returns `transactions: ApprovalTransactionRequest[]`. Each element is `{ transaction, cancelApproval, action, gasFee? }`.\n\n```ts\n\u002F\u002F WRONG — signs the wrapper object, not a transaction\nfor (const a of transactions) await walletClient.sendTransaction(a);\n\n\u002F\u002F CORRECT\nfor (const a of transactions) await walletClient.sendTransaction(a.transaction);\n```\n\n### 2. Use the contract's response field names\n\n```ts\n\u002F\u002F WRONG — these names come from the narrative guide, not the contract\nconst { approvals } = await checkApprovalRes.json();\nconst { minPrice, maxPrice } = createResponse;\n\n\u002F\u002F CORRECT\nconst { transactions } = await checkApprovalRes.json();\nconst { adjustedMinPrice, adjustedMaxPrice } = createResponse;\n```\n\n### 3. Never modify, always validate the `data` field\n\nThe `create` \u002F `increase` \u002F `decrease` \u002F `claim` field holds pre-validated calldata.\n\n```ts\nfunction validateLpTransaction(tx: TransactionRequest): void {\n  if (!tx.data || tx.data === '' || tx.data === '0x') throw new Error('Empty transaction data');\n  if (!tx.to || !isAddress(tx.to)) throw new Error('Invalid recipient address');\n  if (!tx.from || !isAddress(tx.from)) throw new Error('Invalid sender address');\n  if (tx.maxFeePerGas && tx.gasPrice) throw new Error('Cannot set both maxFeePerGas and gasPrice');\n}\n```\n\nNever edit the calldata — modifying it can cause reverts or loss of funds.\n\n### 4. Transactions are time-sensitive\n\nPool price moves. If the user takes more than ~30 seconds to review, refetch the transaction before broadcasting.\n\n```ts\nconst TX_EXPIRY_MS = 30_000;\nconst builtAt = Date.now();\n\u002F\u002F ... user reviews ...\nif (Date.now() - builtAt > TX_EXPIRY_MS) lpTx = await refetchLpTransaction(params);\n```\n\n### 5. Amounts are wei strings\n\nAll `amount` fields are integer strings in the token's smallest unit. Convert with `parseUnits(value, decimals).toString()` — never send ether-denominated decimals.\n\n### 6. Strip undefined optional fields\n\nSend permit fields as a matched pair (`batchPermitData` + `signature`) or omit both. Do not send `signature: undefined` alongside a present permit, or vice versa.\n\n## Worked Example: Create a v3 Position (viem)\n\n```ts\nimport { createWalletClient, createPublicClient, http, isAddress, parseUnits } from 'viem';\nimport { mainnet } from 'viem\u002Fchains';\nimport { privateKeyToAccount } from 'viem\u002Faccounts';\n\nconst LP_API_BASE_URL = 'https:\u002F\u002Fliquidity.api.uniswap.org';\nconst API_KEY = process.env.UNISWAP_API_KEY!; \u002F\u002F never hardcode\n\nconst account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);\nconst walletClient = createWalletClient({\n  account,\n  chain: mainnet,\n  transport: http(process.env.RPC_URL),\n});\nconst publicClient = createPublicClient({ chain: mainnet, transport: http(process.env.RPC_URL) });\n\nconst headers = {\n  'x-api-key': API_KEY,\n  'Content-Type': 'application\u002Fjson',\n  Accept: 'application\u002Fjson',\n};\n\nasync function lpFetch(path: string, body: object) {\n  const res = await fetch(`${LP_API_BASE_URL}${path}`, {\n    method: 'POST',\n    headers,\n    body: JSON.stringify(body),\n  });\n  if (!res.ok) throw new Error(`${path} failed: ${res.status} ${await res.text()}`);\n  return res.json();\n}\n\n\u002F\u002F Same checks as the canonical validateLpTransaction in \"Critical Implementation Notes\" above.\nfunction validateLpTransaction(tx: any) {\n  if (!tx || !tx.data || tx.data === '' || tx.data === '0x')\n    throw new Error('Empty transaction data');\n  if (!tx.to || !isAddress(tx.to)) throw new Error('Invalid recipient address');\n  if (!tx.from || !isAddress(tx.from)) throw new Error('Invalid sender address');\n  if (tx.maxFeePerGas && tx.gasPrice) throw new Error('Cannot set both maxFeePerGas and gasPrice');\n}\n\nasync function createV3Position() {\n  const protocol = 'V3';\n  const chainId = 1;\n  const token0Address = '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'; \u002F\u002F UNI\n  const token1Address = '0xdAC17F958D2ee523a2206206994597C13D831ec7'; \u002F\u002F USDT\n  const independentToken = { tokenAddress: token0Address, amount: parseUnits('10', 18).toString() };\n\n  \u002F\u002F 1. Approvals\n  const { transactions } = await lpFetch('\u002Flp\u002Fcheck_approval', {\n    walletAddress: account.address,\n    protocol,\n    chainId,\n    lpTokens: [independentToken],\n    action: 'CREATE',\n  });\n  for (const a of transactions) {\n    validateLpTransaction(a.transaction);\n    const hash = await walletClient.sendTransaction(a.transaction);\n    await publicClient.waitForTransactionReceipt({ hash });\n  }\n\n  \u002F\u002F 2. Build the create transaction\n  const created = await lpFetch('\u002Flp\u002Fcreate', {\n    walletAddress: account.address,\n    chainId,\n    protocol,\n    independentToken,\n    existingPool: {\n      token0Address,\n      token1Address,\n      poolReference: '0x3470447f3cecffac709d3e783a307790b0208d60',\n    },\n    priceBounds: {\n      minPrice: '0.00000000000324',\n      maxPrice: '0.00000000000393',\n      quotedTokenAddress: token1Address,\n    },\n    simulateTransaction: true,\n  });\n\n  \u002F\u002F 3. CONFIRM WITH USER before broadcasting (use AskUserQuestion in the skill flow):\n  \u002F\u002F    pair, amounts (created.token0 \u002F created.token1), adjusted range\n  \u002F\u002F    (created.adjustedMinPrice \u002F created.adjustedMaxPrice), created.gasFee\n  validateLpTransaction(created.create);\n  const hash = await walletClient.sendTransaction(created.create);\n  return publicClient.waitForTransactionReceipt({ hash });\n}\n```\n\n## Companion SDKs\n\nThe API returns ready-to-sign transactions, so a protocol SDK is not required. For client-side pool\u002Fposition math, tick conversions, and validation, developers commonly pair the LP API with:\n\n- `@uniswap\u002Fsdk-core` — chains, `Token`, `CurrencyAmount`, `Percent`, `Price` (foundational).\n- `@uniswap\u002Fv3-sdk` — v3 tick math (`TickMath`, `nearestUsableTick`), `Pool`, `Position`.\n- `@uniswap\u002Fv4-sdk` — v4 pool keys, hooks-aware `Position` modeling.\n- `@uniswap\u002Fv2-sdk` — v2 pair\u002Fliquidity math.\n- `viem` (or ethers) — sign and broadcast the returned `{ to, data, value }`, and sign EIP-712 permit data.\n\n## Error Handling\n\n| Code | Meaning                  | Action                                       |\n| ---- | ------------------------ | -------------------------------------------- |\n| 400  | Validation error         | Fix request fields (see common errors below) |\n| 401  | Invalid API key          | Check the `x-api-key` header                 |\n| 429  | Rate limited             | Exponential backoff; cache repeated reads    |\n| 500  | API error                | Retry with backoff                           |\n| 503  | Temporary unavailability | Retry                                        |\n\nError body (Connect protocol): `{ code: string, message: string, details?: Array\u003C{ type: string; value: string }> }` — e.g. `{\"code\":\"invalid_argument\",\"message\":\"RequestValidationError: ...\",\"details\":[...]}`. `code` is a Connect error-code string (`invalid_argument`, `unauthenticated`, `failed_precondition`, `internal`, …), **not** an HTTP number, and there is no top-level `error` field. Read `body.code` \u002F `body.message`, not `body.error`.\n\n**Common errors**\n\n- **v2 fee claim attempt**: calling `\u002Flp\u002Fclaim_fees` with `protocol: \"V2\"`. Use `\u002Flp\u002Fdecrease` to realize v2 fees.\n- **Pool not found**: verify token addresses, the `poolReference`, and the chain; or use `newPool` to initialize.\n- **Insufficient liquidity**: the computed dependent amount exceeds balances; reduce `independentToken.amount` or widen the range.\n- **Validation error**: ensure all required fields for the chosen `protocol`, checksummed addresses, wei-denominated amounts, and `liquidityPercentageToDecrease` in 1-100.\n\nFor retry\u002Fbackoff, request caching, monitoring, and the full pre-broadcast checklist, see [Advanced Patterns Reference](.\u002Freferences\u002Fadvanced-patterns.md#error-recovery-and-reliability).\n\n## Supported Chains\n\nThe LP API supports a fixed set of chain IDs. Validate `chainId` against this set before sending:\n\n```text\n1, 10, 56, 130, 137, 143, 196, 324, 480, 1868, 4217, 4326, 4663, 5042,\n8453, 10143, 42161, 42220, 43114, 59144, 81457, 7777777, 1301, 84532, 11155111\n```\n\n(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 `\u002Flp\u002Fpool_info` availability or the [supported chains docs](https:\u002F\u002Fdevelopers.uniswap.org\u002Fdocs\u002Fliquidity\u002Fliquidity-provisioning-api\u002Fgetting-started).\n\n## Additional Resources\n\n- [LP API: Getting Started](https:\u002F\u002Fdevelopers.uniswap.org\u002Fdocs\u002Fliquidity\u002Fliquidity-provisioning-api\u002Fgetting-started) — official conceptual overview\n- [LP API: Integration Guide](https:\u002F\u002Fdevelopers.uniswap.org\u002Fdocs\u002Fliquidity\u002Fliquidity-provisioning-api\u002Fintegration-guide) — official guide\n- [Uniswap Developer Platform dashboard](https:\u002F\u002Fdevelopers.uniswap.org\u002Fdashboard) — get an API key\n- [swap-integration](..\u002Fswap-integration\u002FSKILL.md) — sibling skill for token swaps via the Trading API\n- [Advanced Patterns Reference](.\u002Freferences\u002Fadvanced-patterns.md) — permit deep-dive, migration, NFT-position quirks, reliability\n","# LP Integration\n\nIntegrate Uniswap liquidity provisioning into frontends, backends, and bots using the Uniswap LP API.\n\nThe 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.\n\n## Prerequisites\n\nThis skill assumes familiarity with viem basics (client setup, account management, contract interactions, transaction signing). Install the **uniswap-viem** plugin for comprehensive viem\u002Fwagmi guidance: `claude plugin add @uniswap\u002Funiswap-viem`\n\nFor token swaps (not liquidity), see the sibling **swap-integration** skill in this plugin.\n\n## Base URL\n\n```text\nLP_API_BASE_URL = https:\u002F\u002Fliquidity.api.uniswap.org\n```\n\nAll LP endpoints are POST requests under the `\u002Flp\u002F` prefix (e.g. `https:\u002F\u002Fliquidity.api.uniswap.org\u002Flp\u002Fcreate`).\n\n> **The LP API host is intentionally different from the swap Trading API.** Liquidity provisioning lives at `https:\u002F\u002Fliquidity.api.uniswap.org` (no `\u002Fv1` prefix), not the `https:\u002F\u002Ftrade-api.gateway.uniswap.org\u002Fv1` host used for swaps. Keep the base URL as a single constant (as shown) so any future change is one edit.\n\n## Authentication\n\nEvery write\u002Fapproval endpoint requires an API key sent as the `x-api-key` header; a missing or invalid key returns `401` with `{\"code\":\"unauthenticated\"}`. (`\u002Flp\u002Fpool_info` is a read endpoint and does not strictly enforce the key, but always send it for consistency and rate-limit attribution.)\n\n```text\nContent-Type: application\u002Fjson\nAccept: application\u002Fjson\nx-api-key: \u003Cyour-api-key>\n```\n\n**Getting a key:** Register at the [Uniswap Developer Platform dashboard](https:\u002F\u002Fdevelopers.uniswap.org\u002Fdashboard). The same key works across swapping and liquidity provisioning. Never hardcode the key; load it from an environment variable.\n\n## Quick Decision Guide\n\n| You want to...                                | Endpoint             | Protocols  |\n| --------------------------------------------- | -------------------- | ---------- |\n| Check\u002Fgrant token approvals before any action | `\u002Flp\u002Fcheck_approval` | V2, V3, V4 |\n| Create a concentrated-liquidity position      | `\u002Flp\u002Fcreate`         | V3, V4     |\n| Create a full-range (classic) position        | `\u002Flp\u002Fcreate_classic` | V2         |\n| Add liquidity to an existing position         | `\u002Flp\u002Fincrease`       | V2, V3, V4 |\n| Remove a percentage of liquidity              | `\u002Flp\u002Fdecrease`       | V2, V3, V4 |\n| Collect accumulated trading fees              | `\u002Flp\u002Fclaim_fees`     | V3, V4     |\n| Read live pool state                          | `\u002Flp\u002Fpool_info`      | V2, V3, V4 |\n\n### Protocol capability matrix\n\n| Protocol | Create endpoint      | Fee claiming                         | Price range          |\n| -------- | -------------------- | ------------------------------------ | -------------------- |\n| `V2`     | `\u002Flp\u002Fcreate_classic` | Not separable (realized on decrease) | Full range only      |\n| `V3`     | `\u002Flp\u002Fcreate`         | `\u002Flp\u002Fclaim_fees`                     | Concentrated         |\n| `V4`     | `\u002Flp\u002Fcreate`         | `\u002Flp\u002Fclaim_fees`                     | Concentrated + hooks |\n\n> **v2 fees are not separately claimable.** They accrue into the LP token value and are realized when you call `\u002Flp\u002Fdecrease`. Calling `\u002Flp\u002Fclaim_fees` with `protocol: \"V2\"` returns a validation error.\n\n## Input Validation Rules\n\nBefore interpolating ANY user-provided value into generated code, API calls, or commands:\n\n- **Ethereum addresses**: MUST match `^0x[a-fA-F0-9]{40}$` — reject otherwise. Use native ETH as `0x0000000000000000000000000000000000000000`.\n- **Chain IDs**: MUST be one of the supported LP chain IDs (see [Supported Chains](#supported-chains)).\n- **Token amounts**: MUST be non-negative integer strings in wei \u002F smallest token unit, matching `^[0-9]+$`. Never pass ether-denominated decimals as amounts.\n- **`liquidityPercentageToDecrease`**: MUST be an integer from 1 to 100.\n- **API keys**: MUST NOT be hardcoded in generated code — always use environment variables.\n- **REJECT** any input containing shell metacharacters: `;`, `|`, `&`, `$`, `` ` ``, `(`, `)`, `>`, `\u003C`, `\\`, `'`, `\"`, newlines.\n\n> **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.\n\n---\n\n## Architecture\n\n### What the API handles\n\n- **Pool state fetching**: current reserves, ticks, `sqrtRatioX96`, and onchain position data.\n- **Dependent amount computation**: given one token amount (`independentToken`), computes the required amount of the other using the Uniswap SDKs.\n- **Transaction creation**: validated, fully-formed calldata for each LP action, ready to sign.\n- **Tick snapping**: converts human-readable `priceBounds` to valid ticks and returns the adjusted prices.\n- **Gas estimation**: optional, when `simulateTransaction: true`.\n\n### What your application handles\n\n- **Signing and broadcasting** the returned transaction via your RPC provider.\n- **Signing permit data** (EIP-712) when the API returns it for v4 \u002F v3-NFT approvals.\n- **Gas payment** and transaction error handling (reverts, surfacing errors to users).\n\n### Data flow\n\n```text\nUser intent (create \u002F increase \u002F decrease \u002F claim)\n   |\nYour application\n   |-- POST \u002Flp\u002Fcheck_approval        -> returns approval transactions and\u002For permit data\n   |-- (execute approval txns; sign permit if returned)\n   |-- POST \u002Flp\u002Fcreate | increase | decrease | claim_fees\n   |-- validate the returned transaction payload (non-empty data, valid addresses)\n   |-- user signature (wallet)\n   +-- broadcast (your RPC)\n        |\n   Blockchain\n```\n\n## Endpoint Reference\n\nAll field names below come from the LP API OpenAPI contract. Where the public integration guide uses different names, the contract names here are authoritative.\n\n### POST \u002Flp\u002Fcheck_approval\n\nAlways call this first. Returns the approval transactions (and\u002For permit data) needed before an LP action. If the response `transactions` array is empty and no permit data is returned, all approvals are already in place — **unless** `kycRequiredWarnings` is non-empty, which means the pool contains a permissioned token and the wallet is not allowlisted. In that case the response is still `200`; render the KYC call-to-action from each warning's `kycUrl` instead of attempting the LP action.\n\n**Request**\n\n```json\n{\n  \"walletAddress\": \"0x...\",\n  \"protocol\": \"V4\",\n  \"chainId\": 1,\n  \"lpTokens\": [\n    { \"tokenAddress\": \"0x...\", \"amount\": \"1000000000000000000\" },\n    { \"tokenAddress\": \"0x...\", \"amount\": \"500000000\" }\n  ],\n  \"action\": \"CREATE\"\n}\n```\n\n| Field                         | Required | Notes                                                                       |\n| ----------------------------- | -------- | --------------------------------------------------------------------------- |\n| `walletAddress`               | Yes      | The position owner                                                          |\n| `protocol`                    | Yes      | `V2` \\| `V3` \\| `V4`                                                        |\n| `chainId`                     | Yes      | Supported chain ID                                                          |\n| `lpTokens`                    | Yes      | Array of `{ tokenAddress, amount }` to be spent                             |\n| `action`                      | Yes      | `CREATE` \\| `INCREASE` \\| `DECREASE` \\| `MIGRATE`                           |\n| `simulateTransaction`         | No       | Include gas estimates                                                       |\n| `includeGasInfo`              | No       | Include gas info on returned approvals                                      |\n| `generatePermitAsTransaction` | No       | If `true`, return permit as an executable transaction instead of typed data |\n| `urgency`                     | No       | `NORMAL` \\| `FAST` \\| `URGENT`                                              |\n| `v3NftTokenId`                | No       | v3 NFT id when approving a position-manager NFT                             |\n\n**Response**\n\n```ts\ninterface CheckApprovalResponse {\n  requestId: string;\n  transactions: ApprovalTransactionRequest[]; \u002F\u002F sign each .transaction; empty (with kycRequiredWarnings also empty) = nothing to approve\n  v4BatchPermitData?: NullablePermit; \u002F\u002F v4: sign and pass into \u002Flp\u002Fcreate or \u002Flp\u002Fincrease\n  v3NftPermitData?: NullablePermit; \u002F\u002F v3 NFT permit\n  kycRequiredWarnings: KycRequiredWarning[]; \u002F\u002F permissioned pools: non-empty when the wallet is NOT allowlisted. Always present (usually []).\n}\n\ninterface ApprovalTransactionRequest {\n  transaction: TransactionRequest; \u002F\u002F the tx to sign and broadcast\n  cancelApproval: boolean;\n  action: 'CREATE' | 'INCREASE' | 'DECREASE' | 'MIGRATE';\n  gasFee?: string;\n}\n\ninterface KycRequiredWarning {\n  kycUrl: string;\n  tokenAddress: string;\n  chainId: number;\n}\n```\n\n> **The response field is `transactions`, not `approvals`.** Each element WRAPS a transaction. Sign `element.transaction`, never the element object itself. There are no top-level `token`\u002F`spender` fields.\n\n### POST \u002Flp\u002Fcreate\n\nCreate a v3 or v4 concentrated-liquidity position. Specify a price range and one token amount; the API computes the other from live pool state.\n\n**Pool specification** — provide exactly one of:\n\n- `existingPool`: `{ token0Address, token1Address, poolReference }` where `poolReference` is the pool address (v3) or pool ID (v4).\n- `newPool`: `{ token0Address, token1Address, fee, tickSpacing, hooks?, initialPrice }` where `initialPrice` is a `sqrtRatioX96` string (`hooks` is v4-only).\n\n**Price range** — provide exactly one of:\n\n- `priceBounds`: `{ minPrice, maxPrice, quotedTokenAddress }` — `minPrice`\u002F`maxPrice` are decimal price strings and `quotedTokenAddress` is **required** (it must equal `token0Address` or `token1Address`). `quotedTokenAddress` sets which token the prices are denominated in; there is no default, and omitting it returns a `400`. The API snaps to valid ticks and returns the adjusted prices.\n- `tickBounds`: `{ tickLower, tickUpper }` raw integers.\n\n**Request**\n\n```json\n{\n  \"walletAddress\": \"0x...\",\n  \"chainId\": 1,\n  \"protocol\": \"V3\",\n  \"existingPool\": {\n    \"token0Address\": \"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984\",\n    \"token1Address\": \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n    \"poolReference\": \"0x3470447f3cecffac709d3e783a307790b0208d60\"\n  },\n  \"independentToken\": {\n    \"tokenAddress\": \"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984\",\n    \"amount\": \"198251669183062942\"\n  },\n  \"priceBounds\": {\n    \"minPrice\": \"0.00000000000324\",\n    \"maxPrice\": \"0.00000000000393\",\n    \"quotedTokenAddress\": \"0xdAC17F958D2ee523a2206206994597C13D831ec7\"\n  },\n  \"simulateTransaction\": false\n}\n```\n\n| Field                                                      | Required     | Notes                                                                                    |\n| ---------------------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------- |\n| `walletAddress`, `chainId`, `protocol`, `independentToken` | Yes          | `independentToken` is `{ tokenAddress, amount }`                                         |\n| `existingPool` \\| `newPool`                                | One required | See pool specification above                                                             |\n| `priceBounds` \\| `tickBounds`                              | One required | See price range above                                                                    |\n| `dependentToken`                                           | No           | Override the computed dependent amount                                                   |\n| `slippageTolerance`                                        | No           | Decimal percent (e.g. `0.5`)                                                             |\n| `deadline`                                                 | No           | Unix seconds                                                                             |\n| `simulateTransaction`                                      | No           | Include `gasFee` in response                                                             |\n| `urgency`                                                  | No           | `NORMAL` \\| `FAST` \\| `URGENT`                                                           |\n| `batchPermitData` + `signature`                            | No           | v4 permit from `\u002Flp\u002Fcheck_approval` (note: create uses `batchPermitData`)                |\n| `nativeTokenBalance`                                       | No           | Used when one side is native ETH                                                         |\n| `includeApprovalSimulation`                                | No           | Include approval pre-calls in the gas simulation (only with `simulateTransaction: true`) |\n\n**Response**\n\n```ts\ninterface CreatePositionResponse {\n  requestId: string;\n  token0: LPToken; \u002F\u002F { tokenAddress, amount }\n  token1: LPToken;\n  adjustedMinPrice: string; \u002F\u002F show THIS to the user, not your input minPrice\n  adjustedMaxPrice: string;\n  tickLower: number;\n  tickUpper: number;\n  create: TransactionRequest;\n  gasFee?: string; \u002F\u002F present when simulateTransaction: true\n  slippage?: number; \u002F\u002F effective slippage the API applied (e.g. native-token v4 cases)\n}\n```\n\n> **Display `adjustedMinPrice` \u002F `adjustedMaxPrice`** (the tick-snapped values), not the original `priceBounds` you sent.\n\n### POST \u002Flp\u002Fcreate_classic\n\nCreate a v2 (full-range) position. Provide one `independentToken` amount; the API computes the `dependentToken` from current pair reserves.\n\n**Request**\n\n```json\n{\n  \"walletAddress\": \"0x...\",\n  \"poolParameters\": {\n    \"token0Address\": \"0xc02fe7317d4eb8753a02c35fe019786854a92001\",\n    \"token1Address\": \"0x0000000000000000000000000000000000000000\",\n    \"chainId\": 130\n  },\n  \"independentToken\": {\n    \"tokenAddress\": \"0xc02fe7317d4eb8753a02c35fe019786854a92001\",\n    \"amount\": \"1000000000000000\"\n  },\n  \"simulateTransaction\": false\n}\n```\n\n| Field                                                                                          | Required | Notes                                                                        |\n| ---------------------------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------- |\n| `walletAddress`                                                                                | Yes      |                                                                              |\n| `poolParameters`                                                                               | Yes      | `{ token0Address, token1Address, chainId }`                                  |\n| `independentToken`                                                                             | Yes      | `{ tokenAddress, amount }`                                                   |\n| `dependentToken`                                                                               | No       | If omitted, computed from reserves. Required when creating a brand-new pool. |\n| `slippageTolerance`, `deadline`, `simulateTransaction`, `urgency`, `includeApprovalSimulation` | No       |                                                                              |\n\n**Response**: `{ requestId, independentToken, dependentToken, create: TransactionRequest, gasFee? }`. Note the create_classic response names the tokens `independentToken` \u002F `dependentToken` (not `token0` \u002F `token1`).\n\n### POST \u002Flp\u002Fincrease\n\nAdd liquidity to an existing v2\u002Fv3\u002Fv4 position. Provide one token amount; the API computes the other.\n\n**Request**\n\n```json\n{\n  \"walletAddress\": \"0x...\",\n  \"chainId\": 130,\n  \"protocol\": \"V4\",\n  \"token0Address\": \"0x0000000000000000000000000000000000000000\",\n  \"token1Address\": \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\",\n  \"nftTokenId\": \"1833079\",\n  \"independentToken\": {\n    \"tokenAddress\": \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\",\n    \"amount\": \"8223\"\n  },\n  \"simulateTransaction\": false\n}\n```\n\n| Field                                                                                        | Required | Notes                                                                                                                         |\n| -------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- |\n| `walletAddress`, `chainId`, `protocol`, `token0Address`, `token1Address`, `independentToken` | Yes      | `token0Address`\u002F`token1Address` must match the order in the existing position                                                 |\n| `nftTokenId`                                                                                 | v3\u002Fv4    | NFT id identifying the position                                                                                               |\n| `slippageTolerance`, `deadline`, `simulateTransaction`, `urgency`                            | No       |                                                                                                                               |\n| `v4BatchPermitData` + `signature`                                                            | No       | v4 permit from `\u002Flp\u002Fcheck_approval` (note: increase uses `v4BatchPermitData`, create uses `batchPermitData`)                  |\n| `nativeTokenBalance`, `includeApprovalSimulation`, `permissioned`                            | No       | `nativeTokenBalance` when one side is native ETH; `permissioned` routes to the permissioned PositionManager (KYC-gated pools) |\n\n**Response**: `{ requestId, token0, token1, increase: TransactionRequest, gasFee?, slippage? }`.\n\n> **Native ETH**: use `0x0000000000000000000000000000000000000000`. The API generates a multicall including `refundETH` to return any excess.\n\n### POST \u002Flp\u002Fdecrease\n\nRemove a percentage of liquidity from a v2\u002Fv3\u002Fv4 position.\n\n**Request**\n\n```json\n{\n  \"walletAddress\": \"0x...\",\n  \"chainId\": 130,\n  \"protocol\": \"V4\",\n  \"token0Address\": \"0x0000000000000000000000000000000000000000\",\n  \"token1Address\": \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\",\n  \"liquidityPercentageToDecrease\": 25,\n  \"nftTokenId\": \"1833079\",\n  \"simulateTransaction\": false\n}\n```\n\n| Field                                                                                                     | Required | Notes                                                                                                  |\n| --------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------ |\n| `walletAddress`, `chainId`, `protocol`, `token0Address`, `token1Address`, `liquidityPercentageToDecrease` | Yes      | Percentage is an integer 1-100                                                                         |\n| `nftTokenId`                                                                                              | v3\u002Fv4    | NFT id identifying the position                                                                        |\n| `withdrawAsWeth`                                                                                          | No       | Applies to V2 and V3 (ignored on V4). Default \u002F `true` keeps WETH; `false` unwraps WETH to native ETH. |\n| `permissioned`                                                                                            | No       | Routes to the permissioned PositionManager (KYC-gated pools).                                          |\n| `slippageTolerance`, `deadline`, `simulateTransaction`, `urgency`                                         | No       |                                                                                                        |\n\n**Response**: `{ requestId, token0, token1, decrease: TransactionRequest, gasFee? }`.\n\n> **v3 fee collection on decrease**: for v3, the returned `decrease` calldata bundles uncollected fees into the withdrawal automatically, so you do not need to call `\u002Flp\u002Fclaim_fees` separately. Note the response `token0` \u002F `token1` amounts reflect only the pro-rata liquidity removed — the swept fees are encoded in the calldata, not added to those response amounts.\n\n### POST \u002Flp\u002Fclaim_fees\n\nCollect accumulated trading fees from a v3 or v4 position. Not available for v2.\n\n**Request**\n\n```json\n{\n  \"protocol\": \"V4\",\n  \"walletAddress\": \"0x...\",\n  \"chainId\": 130,\n  \"tokenId\": \"1833079\",\n  \"simulateTransaction\": false\n}\n```\n\n| Field                                             | Required | Notes                                                                                         |\n| ------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------- |\n| `protocol`, `walletAddress`, `chainId`, `tokenId` | Yes      | `protocol` of `V2` returns a validation error. Note: claim uses `tokenId` (not `nftTokenId`). |\n| `collectAsWeth`                                   | No       | v3 only. If `false`, unwraps WETH to native ETH.                                              |\n| `permissioned`                                    | No       | Routes to the permissioned PositionManager (KYC-gated pools).                                 |\n| `simulateTransaction`                             | No       |                                                                                               |\n\n**Response**: `{ requestId, token0, token1, claim: TransactionRequest, gasFee? }`.\n\n### POST \u002Flp\u002Fpool_info\n\nRead live pool state (reserves, tick, `sqrtRatioX96`, liquidity) for one or more pools.\n\n**Request**: `{ protocol, poolParameters?, poolReferences?, chainId?, pageSize?, currentPage? }` (only `protocol` is strictly required; supply `poolParameters` `{ tokenAddressA, tokenAddressB, fee?, tickSpacing?, hookAddress? }` or `poolReferences` to identify pools).\n\n**Response**: `{ requestId, pools: PoolInformation[], pageSize, currentPage }` where each `PoolInformation` includes `poolReferenceIdentifier, poolProtocol, tokenAddressA, tokenAddressB, tickSpacing, fee, hookAddress, chainId, tokenAmountA, tokenAmountB, tokenDecimalsA, tokenDecimalsB, poolLiquidity, sqrtRatioX96, currentTick, token0Reserves, token1Reserves` (note: address\u002Famount\u002Fdecimals fields use the `A`\u002F`B` suffix, but the two reserve fields use `0`\u002F`1`). Optional fields (e.g. amounts, `hookAddress`, reserves) are omitted when not applicable to the pool.\n\n### Field-name quirks to preserve\n\nThe same concept is named differently across endpoints. Use the exact name per endpoint:\n\n| Concept         | `\u002Flp\u002Fclaim_fees` | `\u002Flp\u002Fincrease`, `\u002Flp\u002Fdecrease` | `\u002Flp\u002Fcheck_approval`     |\n| --------------- | ---------------- | ------------------------------ | ------------------------ |\n| Position NFT id | `tokenId`        | `nftTokenId`                   | `v3NftTokenId` (integer) |\n\n| Concept           | `\u002Flp\u002Fcreate`      | `\u002Flp\u002Fincrease`      |\n| ----------------- | ----------------- | ------------------- |\n| v4 permit payload | `batchPermitData` | `v4BatchPermitData` |\n\n## Approval and Permit Flow\n\nAlways call `\u002Flp\u002Fcheck_approval` before any LP action, even when approvals were previously granted (allowances can be revoked or consumed).\n\n### Onchain approvals\n\n```ts\nconst res = await fetch(`${LP_API_BASE_URL}\u002Flp\u002Fcheck_approval`, {\n  method: 'POST',\n  headers: { 'x-api-key': API_KEY, 'Content-Type': 'application\u002Fjson', Accept: 'application\u002Fjson' },\n  body: JSON.stringify({ walletAddress, protocol: 'V4', chainId: 1, lpTokens, action: 'CREATE' }),\n});\nif (!res.ok) throw new Error(`check_approval failed: ${res.status}`);\nconst { transactions, v4BatchPermitData, kycRequiredWarnings } = await res.json();\n\n\u002F\u002F A permissioned pool gates LPing on KYC: a non-empty kycRequiredWarnings means render the\n\u002F\u002F KYC CTA (warning.kycUrl) and stop — do NOT treat empty transactions as \"approved\" here.\nif (kycRequiredWarnings?.length)\n  throw new Error('Wallet not allowlisted for this permissioned pool');\n\n\u002F\u002F transactions is an array of ApprovalTransactionRequest. Empty (and no KYC warnings) => already approved.\nfor (const approval of transactions) {\n  validateLpTransaction(approval.transaction); \u002F\u002F see Critical Notes\n  const hash = await walletClient.sendTransaction(approval.transaction);\n  await publicClient.waitForTransactionReceipt({ hash });\n}\n```\n\n### v4 permit (EIP-712 sign-and-return)\n\nFor v4, `check_approval` returns a `v4BatchPermitData` (a gasless Permit2 batch approval) — often **alongside** onchain ERC-20 → Permit2 approval `transactions`, not instead of them. Execute any returned `transactions` first (Permit2 needs the ERC-20 allowance), then sign the permit offchain and pass it into the next call.\n\n> **The 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:\n>\n> - `domain.chainId` arrives as the chain **enum-name string** (e.g. `\"UNICHAIN\"`), not a number — replace it with the numeric chain ID.\n> - each `types` entry is wrapped as `{ fields: [...] }`; viem (and the EIP-712 spec) expect a bare array — unwrap `.fields`.\n\n```ts\nlet signature: string | undefined;\nif (v4BatchPermitData) {\n  \u002F\u002F Normalize the proto-encoded permit into viem's TypedData shape (for signing only).\n  const types = Object.fromEntries(\n    Object.entries(v4BatchPermitData.types).map(([k, v]) => [k, (v as any).fields])\n  );\n  const domain = { ...v4BatchPermitData.domain, chainId }; \u002F\u002F numeric chainId (e.g. 130), NOT \"UNICHAIN\"\n\n  signature = await walletClient.signTypedData({\n    domain,\n    types,\n    message: v4BatchPermitData.values,\n    primaryType: 'PermitBatch',\n  });\n}\n\n\u002F\u002F Send the ORIGINAL (un-normalized) permit back to the API, with the signature.\n\u002F\u002F \u002Flp\u002Fcreate (uses batchPermitData) ...\nconst createBody = { ...createParams, batchPermitData: v4BatchPermitData, signature };\n\u002F\u002F ... or \u002Flp\u002Fincrease (uses v4BatchPermitData)\nconst increaseBody = { ...increaseParams, v4BatchPermitData, signature };\n```\n\nFor full typed implementations (v3 NFT permit, `EIP712Domain` edge cases, migration), see [Advanced Patterns Reference](.\u002Freferences\u002Fadvanced-patterns.md#permit-and-approval-deep-dive).\n\n## Critical Implementation Notes\n\n### 1. Sign the wrapped transaction, not the wrapper\n\n`\u002Flp\u002Fcheck_approval` returns `transactions: ApprovalTransactionRequest[]`. Each element is `{ transaction, cancelApproval, action, gasFee? }`.\n\n```ts\n\u002F\u002F WRONG — signs the wrapper object, not a transaction\nfor (const a of transactions) await walletClient.sendTransaction(a);\n\n\u002F\u002F CORRECT\nfor (const a of transactions) await walletClient.sendTransaction(a.transaction);\n```\n\n### 2. Use the contract's response field names\n\n```ts\n\u002F\u002F WRONG — these names come from the narrative guide, not the contract\nconst { approvals } = await checkApprovalRes.json();\nconst { minPrice, maxPrice } = createResponse;\n\n\u002F\u002F CORRECT\nconst { transactions } = await checkApprovalRes.json();\nconst { adjustedMinPrice, adjustedMaxPrice } = createResponse;\n```\n\n### 3. Never modify, always validate the `data` field\n\nThe `create` \u002F `increase` \u002F `decrease` \u002F `claim` field holds pre-validated calldata.\n\n```ts\nfunction validateLpTransaction(tx: TransactionRequest): void {\n  if (!tx.data || tx.data === '' || tx.data === '0x') throw new Error('Empty transaction data');\n  if (!tx.to || !isAddress(tx.to)) throw new Error('Invalid recipient address');\n  if (!tx.from || !isAddress(tx.from)) throw new Error('Invalid sender address');\n  if (tx.maxFeePerGas && tx.gasPrice) throw new Error('Cannot set both maxFeePerGas and gasPrice');\n}\n```\n\nNever edit the calldata — modifying it can cause reverts or loss of funds.\n\n### 4. Transactions are time-sensitive\n\nPool price moves. If the user takes more than ~30 seconds to review, refetch the transaction before broadcasting.\n\n```ts\nconst TX_EXPIRY_MS = 30_000;\nconst builtAt = Date.now();\n\u002F\u002F ... user reviews ...\nif (Date.now() - builtAt > TX_EXPIRY_MS) lpTx = await refetchLpTransaction(params);\n```\n\n### 5. Amounts are wei strings\n\nAll `amount` fields are integer strings in the token's smallest unit. Convert with `parseUnits(value, decimals).toString()` — never send ether-denominated decimals.\n\n### 6. Strip undefined optional fields\n\nSend permit fields as a matched pair (`batchPermitData` + `signature`) or omit both. Do not send `signature: undefined` alongside a present permit, or vice versa.\n\n## Worked Example: Create a v3 Position (viem)\n\n```ts\nimport { createWalletClient, createPublicClient, http, isAddress, parseUnits } from 'viem';\nimport { mainnet } from 'viem\u002Fchains';\nimport { privateKeyToAccount } from 'viem\u002Faccounts';\n\nconst LP_API_BASE_URL = 'https:\u002F\u002Fliquidity.api.uniswap.org';\nconst API_KEY = process.env.UNISWAP_API_KEY!; \u002F\u002F never hardcode\n\nconst account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);\nconst walletClient = createWalletClient({\n  account,\n  chain: mainnet,\n  transport: http(process.env.RPC_URL),\n});\nconst publicClient = createPublicClient({ chain: mainnet, transport: http(process.env.RPC_URL) });\n\nconst headers = {\n  'x-api-key': API_KEY,\n  'Content-Type': 'application\u002Fjson',\n  Accept: 'application\u002Fjson',\n};\n\nasync function lpFetch(path: string, body: object) {\n  const res = await fetch(`${LP_API_BASE_URL}${path}`, {\n    method: 'POST',\n    headers,\n    body: JSON.stringify(body),\n  });\n  if (!res.ok) throw new Error(`${path} failed: ${res.status} ${await res.text()}`);\n  return res.json();\n}\n\n\u002F\u002F Same checks as the canonical validateLpTransaction in \"Critical Implementation Notes\" above.\nfunction validateLpTransaction(tx: any) {\n  if (!tx || !tx.data || tx.data === '' || tx.data === '0x')\n    throw new Error('Empty transaction data');\n  if (!tx.to || !isAddress(tx.to)) throw new Error('Invalid recipient address');\n  if (!tx.from || !isAddress(tx.from)) throw new Error('Invalid sender address');\n  if (tx.maxFeePerGas && tx.gasPrice) throw new Error('Cannot set both maxFeePerGas and gasPrice');\n}\n\nasync function createV3Position() {\n  const protocol = 'V3';\n  const chainId = 1;\n  const token0Address = '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'; \u002F\u002F UNI\n  const token1Address = '0xdAC17F958D2ee523a2206206994597C13D831ec7'; \u002F\u002F USDT\n  const independentToken = { tokenAddress: token0Address, amount: parseUnits('10', 18).toString() };\n\n  \u002F\u002F 1. Approvals\n  const { transactions } = await lpFetch('\u002Flp\u002Fcheck_approval', {\n    walletAddress: account.address,\n    protocol,\n    chainId,\n    lpTokens: [independentToken],\n    action: 'CREATE',\n  });\n  for (const a of transactions) {\n    validateLpTransaction(a.transaction);\n    const hash = await walletClient.sendTransaction(a.transaction);\n    await publicClient.waitForTransactionReceipt({ hash });\n  }\n\n  \u002F\u002F 2. Build the create transaction\n  const created = await lpFetch('\u002Flp\u002Fcreate', {\n    walletAddress: account.address,\n    chainId,\n    protocol,\n    independentToken,\n    existingPool: {\n      token0Address,\n      token1Address,\n      poolReference: '0x3470447f3cecffac709d3e783a307790b0208d60',\n    },\n    priceBounds: {\n      minPrice: '0.00000000000324',\n      maxPrice: '0.00000000000393',\n      quotedTokenAddress: token1Address,\n    },\n    simulateTransaction: true,\n  });\n\n  \u002F\u002F 3. CONFIRM WITH USER before broadcasting (use AskUserQuestion in the skill flow):\n  \u002F\u002F    pair, amounts (created.token0 \u002F created.token1), adjusted range\n  \u002F\u002F    (created.adjustedMinPrice \u002F created.adjustedMaxPrice), created.gasFee\n  validateLpTransaction(created.create);\n  const hash = await walletClient.sendTransaction(created.create);\n  return publicClient.waitForTransactionReceipt({ hash });\n}\n```\n\n## Companion SDKs\n\nThe API returns ready-to-sign transactions, so a protocol SDK is not required. For client-side pool\u002Fposition math, tick conversions, and validation, developers commonly pair the LP API with:\n\n- `@uniswap\u002Fsdk-core` — chains, `Token`, `CurrencyAmount`, `Percent`, `Price` (foundational).\n- `@uniswap\u002Fv3-sdk` — v3 tick math (`TickMath`, `nearestUsableTick`), `Pool`, `Position`.\n- `@uniswap\u002Fv4-sdk` — v4 pool keys, hooks-aware `Position` modeling.\n- `@uniswap\u002Fv2-sdk` — v2 pair\u002Fliquidity math.\n- `viem` (or ethers) — sign and broadcast the returned `{ to, data, value }`, and sign EIP-712 permit data.\n\n## Error Handling\n\n| Code | Meaning                  | Action                                       |\n| ---- | ------------------------ | -------------------------------------------- |\n| 400  | Validation error         | Fix request fields (see common errors below) |\n| 401  | Invalid API key          | Check the `x-api-key` header                 |\n| 429  | Rate limited             | Exponential backoff; cache repeated reads    |\n| 500  | API error                | Retry with backoff                           |\n| 503  | Temporary unavailability | Retry                                        |\n\nError body (Connect protocol): `{ code: string, message: string, details?: Array\u003C{ type: string; value: string }> }` — e.g. `{\"code\":\"invalid_argument\",\"message\":\"RequestValidationError: ...\",\"details\":[...]}`. `code` is a Connect error-code string (`invalid_argument`, `unauthenticated`, `failed_precondition`, `internal`, …), **not** an HTTP number, and there is no top-level `error` field. Read `body.code` \u002F `body.message`, not `body.error`.\n\n**Common errors**\n\n- **v2 fee claim attempt**: calling `\u002Flp\u002Fclaim_fees` with `protocol: \"V2\"`. Use `\u002Flp\u002Fdecrease` to realize v2 fees.\n- **Pool not found**: verify token addresses, the `poolReference`, and the chain; or use `newPool` to initialize.\n- **Insufficient liquidity**: the computed dependent amount exceeds balances; reduce `independentToken.amount` or widen the range.\n- **Validation error**: ensure all required fields for the chosen `protocol`, checksummed addresses, wei-denominated amounts, and `liquidityPercentageToDecrease` in 1-100.\n\nFor retry\u002Fbackoff, request caching, monitoring, and the full pre-broadcast checklist, see [Advanced Patterns Reference](.\u002Freferences\u002Fadvanced-patterns.md#error-recovery-and-reliability).\n\n## Supported Chains\n\nThe LP API supports a fixed set of chain IDs. Validate `chainId` against this set before sending:\n\n```text\n1, 10, 56, 130, 137, 143, 196, 324, 480, 1868, 4217, 4326, 4663, 5042,\n8453, 10143, 42161, 42220, 43114, 59144, 81457, 7777777, 1301, 84532, 11155111\n```\n\n(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 `\u002Flp\u002Fpool_info` availability or the [supported chains docs](https:\u002F\u002Fdevelopers.uniswap.org\u002Fdocs\u002Fliquidity\u002Fliquidity-provisioning-api\u002Fgetting-started).\n\n## Additional Resources\n\n- [LP API: Getting Started](https:\u002F\u002Fdevelopers.uniswap.org\u002Fdocs\u002Fliquidity\u002Fliquidity-provisioning-api\u002Fgetting-started) — official conceptual overview\n- [LP API: Integration Guide](https:\u002F\u002Fdevelopers.uniswap.org\u002Fdocs\u002Fliquidity\u002Fliquidity-provisioning-api\u002Fintegration-guide) — official guide\n- [Uniswap Developer Platform dashboard](https:\u002F\u002Fdevelopers.uniswap.org\u002Fdashboard) — get an API key\n- [swap-integration](..\u002Fswap-integration\u002FSKILL.md) — sibling skill for token swaps via the Trading API\n- [Advanced Patterns Reference](.\u002Freferences\u002Fadvanced-patterns.md) — permit deep-dive, migration, NFT-position quirks, reliability\n",{"name":5,"model":24,"license":15,"metadata":25,"description":7,"allowed-tools":28},"opus",{"author":26,"version":27},"uniswap","0.1.0","Read, Write, Edit, Glob, Grep, Bash(npm:*), Bash(npx:*), Bash(yarn:*), Bash(curl:*), WebFetch, Task(subagent_type:swap-integration-expert)","main","1c523aba5cdf867a79f078847075492d7778092a","public\u002Fapi\u002Fskills\u002Flp-integration",1,"https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills","https:\u002F\u002Fskills.x402.wtf","https:\u002F\u002Fgithub.com\u002Fthemusebook","https:\u002F\u002Fmusebook.trade","The official Github of musebook","2026-11-02 23:42:26",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add themusebook\u002Fskills --skill lp-integration",{"tool":45,"command":46},"bunx","bunx skills add themusebook\u002Fskills --skill lp-integration",{"tool":48,"command":49},"pnpm","pnpm dlx skills add themusebook\u002Fskills --skill lp-integration","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fpublic\u002Fapi\u002Fskills\u002Flp-integration\u002FSKILL.md",true,[53,59,63],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"metadata.json","REFERENCE","参考文档",1134,"https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fpublic\u002Fapi\u002Fskills\u002Flp-integration\u002Fmetadata.json",{"path":60,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":61,"sourceHtmlUrl":62},"references\u002Fadvanced-patterns.md",8372,"https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fpublic\u002Fapi\u002Fskills\u002Flp-integration\u002Freferences\u002Fadvanced-patterns.md",{"path":64,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":65,"sourceHtmlUrl":66},"verification.json",1998,"https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fpublic\u002Fapi\u002Fskills\u002Flp-integration\u002Fverification.json",[68,76,83,90,97,104],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":72,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7AB34SPKVSDRRG009PM1CZH","youtube-clipper","YouTube 视频智能剪辑工具。下载视频和字幕，AI 分析生成精细章节（几分钟级别）， 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频，并生成总结文案。 使用场景：当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词：视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fyoutube-clipper\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7AB18BH6N7KR7939HRNWVMQ","viem-integration","Integrate EVM blockchains using viem. Use when user says \"read blockchain data\", \"send transaction\", \"interact with smart contract\", \"connect to Ethereum\", \"use viem\", \"use wagmi\", \"wallet integration\", \"viem setup\", or mentions blockchain\u002FEVM development with TypeScript.","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fviem-integration\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7AB12GHGP48WCNXDQQ9222H","v4-security-foundations","Security-first Uniswap v4 hook development. Use when user mentions \"v4 hooks\", \"hook security\", \"PoolManager\", \"beforeSwap\", \"afterSwap\", or asks about V4 hook best practices, vulnerabilities, or audit requirements.","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fv4-security-foundations\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M7AB0XM3PSR7V3Q2ZRR0Q0FB","v4-sdk-integration","App-layer SDK guide for building swap and liquidity experiences directly with the Uniswap v4 SDK. Use when user asks about \"v4 sdk\", \"uniswap v4\", \"v4 swap\", \"v4 liquidity\", \"PoolManager\", \"V4Planner\", \"StateView\", \"PositionManager\", \"pool state\", \"v4 position\", \"uniswap sdk\", or when building swap\u002Fliquidity UX directly with SDKs rather than via the Trading API.","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fv4-sdk-integration\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M7AB0SGA93ASA588DJW4P9WT","v4-hook-generator","Generate Uniswap v4 hook contracts via OpenZeppelin MCP. Use when building custom swap logic, async swaps, hook-owned liquidity, custom curves, dynamic fees, MEV protection, limit orders, or oracle hooks.","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fv4-hook-generator\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":19},"01M7AAZYH75H4CS03WSW2EZ8DM","testing","For testing with Light Protocol programs and clients on localnet, devnet, and mainnet validation.","https:\u002F\u002Fgithub.com\u002Fthemusebook\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Ftesting\u002FSKILL.md",[],[]]