# API Usage

Welcome to the TAPP Exchange API documentation. This API allows you to interact with our Aptos-based decentralized exchange. You can use it to swap tokens, create liquidity pools, and query pool/token data.

## 📚 Table of Contents

* [API Access Methods](#api-access-methods)
* [Signing Write Operations](#signing-write-operations)
* [List Endpoint](#list-endpoints)
  * [Pool List](#pool-list)
  * [Token List](#token-list)
  * [Pool Info](#pool-info)
  * [Pool Stats](#pool-stats)
  * [Pool TVL Chart](#pool-tvl-chart)
  * [Pool Volume Chart](#pool-volume-chart)
  * [Position](#position)
  * [User Transaction](#user-transaction)
  * [Swap](#swap)
  * [Create Pool and Add Liquidity](#create-pool-and-add-liquidity)
  * [Add Liquidity](#add-liquidity)
  * [Remove Liquidity](#remove-liquidity)
  * [Remove Multi Liquidity](#remove-multi-liquidity)
  * [Collect Fee](#collect-fee)

## API Access Methods

TAPP Exchange supports interaction through multiple transport layers:

* **HTTP POST** – Standard and recommended for all JSON-RPC operations
* **WebSocket** – Coming soon

All interfaces use a unified protocol: **JSON-RPC 2.0**

***

> **Base URL**: <https://api.tapp.exchange/api/v1>

***

## Signing Write Operations

All **write operations** (such as `swap`, `create pool`, `add liquidity`, `remove liquidity` and `collect fee`) require the user to **sign the transaction** using their Aptos wallet.

The signed payload ensures authenticity and authorization.

### 🔐 Step-by-Step: Signing with Wallet

1. **Client** calls an api to get an **unsigned payload**.
2. **Client** signs and submit the payload using their wallet (Petra, Martian, etc.).

### ✅ Example: Sign and Submit Swap Transaction

#### Step 1 – Get Unsigned Payload from API

See [`public/swap`](#swap), [`public/create-pool-add-liquidity`](#create-pool-and-add-liquidity), [`public/add-liquidity`](#add-liquidity), [`public/remove-liquidity`](#remove-liquidity), [`public/remove-multi-liquidity`](#remove-multi-liquidity) and [`public/collect-fee`](#collect-fee) for generating the unsigned payload.

#### Step 2 - sign and submit transactions to the blockchain using our backend's hex string payload.

Signing Example Using `JavaScript`

```javascript
const hexPayload = "this value received from our backend"

// Convert bytes to BCS
const txSer = Deserializer.fromHex(hexPayload);

// Convert BCS to raw transaction
const rawTxn = RawTransaction.deserialize(txSer)

// Sign and Submit Transaction
const simpleTxn = new SimpleTransaction(rawTxn)
const response = await aptos.signAndSubmitTransaction({signer: sender, transaction: simpleTxn});
```

***

Signing Example Using `Golang`

```golang
payloadHex := “this value received from our backend”
txBytes, err := hex.DecodeString(payloadHex)
if err != nil { // Handle error here }

// Convert to raw transaction
deserializer := bcs.NewDeserializer(txBytes)
rawTxn := &aptos.RawTransaction{}
rawTxn.UnmarshalBCS(deserializer)
if deserializer.Error() != nil { // handle error here }

// Sign and Submit transaction
signedTxn, err := rawTxn.SignedTransaction(sender)
if err != nil { // handle error here }

submittedTxn, err := client.SubmitTransaction(signedTxn)
if err != nil { // handle error here}
```

***

Signing Example Using `Javascript (useWallet)`

```javascript
const hexPayload = "this value received from our backend"

// Convert bytes to BCS
const txSer = Deserializer.fromHex(hexPayload);

// Convert BCS to raw transaction
const rawTxn = RawTransaction.deserialize(txSer)

// Sign and Submit Transaction
const simpleTxn = new SimpleTransaction(rawTxn)

// Use the wallet's signTransaction method to get account authentication
const accAuth = await signTransaction(simpleTxn)

// Create the transaction builder
const signedTxn = new SignedTransaction(rawTxn, accAuth);

// full signed transaction
const signedTxnBytes = signedTxn.bcsToBytes(); 

// Convert to hex string
const txHex = Buffer.from(signedTxnBytes).toString('hex');

// submit the signed transaction to the backend
const response = await fetch('https://api.tapp.exchange/api/v1', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    method: 'public/sc_submit',
    jsonrpc: '2.0',
    id: 1,
    params: {
      hash: txHex
    }
  })
});

```

***

## List Endpoints

### Pool List

**Method** `public/pool`

Returns a list of available pools with pagination.

**Params**

* `poolType`: `string` Specifies pool category. Available options: AMM, CLMM, STABLE.
* `page`: `number` Specifies the page number for pagination. Default: 1.
* `pageSize`: `number` Defines the number of records per page. Default: 10.

**Request:**

```json
{
  "method": "public/pool",
  "jsonrpc": "2.0",
  "id": 3,
  "params": {
    "query": {
      "poolType": "CLMM",
      "page": 1,
      "pageSize": 20
    }
  }
}
```

#### Response Fields

* `poolId`: string – Unique pool address/id on Aptos.
* `poolType`: string – Pool type, one of `AMM`, `CLMM`, `STABLE`.
* `createdAt`: string – ISO-8601 timestamp when the pool was first seen.
* `fee`: string – Fee tier in basis points (e.g., `"3000"` = 0.30%).
* `feeTier`: string – Human-readable fee percentage (e.g., `"0.0100"` = 1.00%).
* `tvl`: string – Total value locked in USD (decimal string).
* `txns`: number|string – Transaction count over the recent period.
* `volume`: string – Aggregate trade volume in USD (decimal string).
* `volumeData`: object – Raw volume metrics.
  * `volume24h`: number – 24h volume in USD.
  * `volume7d`: number – 7d volume in USD.
  * `volume30d`: number – 30d volume in USD.
  * `volumeprev24h`: number – Previous 24h volume (for change calculations).
* `volumePercentage24h`: string – 24h volume change percentage, as a string.
* `volumePercentage7d`: string – 7d volume change percentage, as a string.
* `volumePercentage30d`: string – 30d volume change percentage, as a string.
* `apr`: object – APR breakdown for the pool.
  * `feeAprPercentage`: number – APR from trading fees.
  * `boostedAprPercentage`: number – Additional APR from boosts/incentives.
  * `campaignAprs`: array – Optional list of campaign APR components.
  * `totalAprPercentage`: number – Total APR (fee + boosted + campaigns).
* `tokens`: array – Summary of tokens composing the pool.
  * `addr`: string – Token address/type.
  * `symbol`: string – Token symbol/ticker.
  * `img`: string – URL to token logo.
  * `verified`: boolean – Whether the token is verified.
  * `amount`: number – Proportional amount used for display/calculations.
  * `reserve`: number – Token reserve in the pool (see decimals below).
  * `color`: string – Hex color hint used for UI visuals (if present).

Notes:

* Numeric monetary values are often represented as strings to preserve precision.
* Token reserves may require applying token `decimals` (available via other endpoints) to format human-readable amounts.

**Response:**

```json
{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "public/pool",
    "result": {
        "data": [
            {
                "apr": {
                    "boostedAprPercentage": 0,
                    "campaignAprs": [],
                    "feeAprPercentage": 0,
                    "totalAprPercentage": 0
                },
                "createdAt": "2025-09-07T22:01:57.067296Z",
                "fee": "0",
                "feeTier": "0.0100",
                "poolId": "0xpool",
                "poolType": "CLMM",
                "tokens": [
                    {
                        "addr": "0xaddr",
                        "amount": 0.01,
                        "color": "#2775CA",
                        "img": "https://img.svg",
                        "reserve": 10000,
                        "symbol": "USDT",
                        "verified": true
                    },
                    {
                        "addr": "0xaddr2",
                        "amount": 0.0001,
                        "color": "#8916D4",
                        "img": "https://img.svg",
                        "reserve": 10000,
                        "symbol": "stAPT",
                        "verified": true
                    }
                ],
                "tvl": "0.009999642600",
                "txns": "0",
                "volume": "0",
                "volumeData": {
                    "volume24h": 0,
                    "volume30d": 0,
                    "volume7d": 0,
                    "volumeprev24h": 0
                },
                "volumePercentage24h": "0",
                "volumePercentage30d": "0",
                "volumePercentage7d": "0"
            },
        ],
        "total": 1
    },
    "usIn": 1757327097180790,
    "usOut": 1757327097418431,
    "usDiff": 237641
}
```

***

### Pool Stats

**Method** `public/pool_stats`

Returns aggregate TVL, volume, and fee statistics for a specific pool along with token-level breakdowns.

**Params**

* `poolId`: `string` Pool unique identifier. Required.

**Request:**

```json
{
  "method": "public/pool_stats",
  "jsonrpc": "2.0",
  "id": 3,
  "params": {
    "query": {
      "poolId": "0xpool"
    }
  }
}
```

#### Response Fields

* `poolId`: string – Unique pool address/id on Aptos.
* `poolType`: string – Pool type, one of `AMM`, `CLMM`, `STABLE`.
* `feeTier`: string – Fee tier for the pool (percentage string or bps formatted).
* `tvl`: string – Total value locked in USD (decimal string).
* `volume24h`: string – Last 24h trading volume in USD (decimal string).
* `fee24h`: string – Fees accrued in the last 24h in USD (decimal string).
* `apr`: object – APR breakdown for the pool.
  * `feeAprPercentage`: number – APR from trading fees.
  * `boostedAprPercentage`: number – Additional APR from boosts/incentives.
  * `campaignAprs`: array – Optional list of campaign APR components.
  * `totalAprPercentage`: number – Total APR (fee + boosted + campaigns).
* `tokens`: array – Token-level breakdown of balances and TVL.
  * `idx`: number – Token index within the pool (0, 1, ...).
  * `addr`: string – Token type/address.
  * `symbol`: string – Token symbol.
  * `img`: string – Logo URL.
  * `amount`: number – Current reserve amount for this token (apply token decimals for UI formatting).
  * `amount_change`: number – Net token amount change over the recent window used in stats.
  * `tvl`: number – Token TVL contribution in USD.
  * `tvl_change`: number – Change in token TVL contribution over the recent window.

Notes:

* Monetary values use strings to preserve precision; convert to numbers only for presentation.
* Apply token decimals from token metadata when formatting `amount` for display.

**Response:**

```json
{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "public/pool_stats",
    "result": {
        "apr": {
            "boostedAprPercentage": 0,
            "campaignAprs": [],
            "feeAprPercentage": 0,
            "totalAprPercentage": 0
        },
        "fee24h": null,
        "feeTier": "0.0100",
        "poolId": "0xpool",
        "poolType": "CLMM",
        "tokens": [
            {
                "addr": "0xaddr",
                "amount": 0.01,
                "color": "#2775CA",
                "idx": 0,
                "img": "https://img.svg",
                "symbol": "USDT",
                "verified": true
            },
            {
                "addr": "0xaddr2",
                "amount": 0.0001,
                "color": "#8916D4",
                "idx": 1,
                "img": "https://img.svg",
                "symbol": "stAPT",
                "verified": true
            }
        ],
        "tvl": "0.009999643600",
        "volume24h": null
    },
    "usIn": 1757326792474722,
    "usOut": 1757326794039291,
    "usDiff": 1564569
}
```

***

### Pool TVL Chart

**Method** `public/pool_tvl_chart`

Returns historical TVL data for a specified time range and interval.

**Params**

* `poolId`: `string` Pool unique identifier. Required.
* `startTime`: `number` Start time in milliseconds. Required.
* `endTime`: `number` End time in milliseconds. Required.
* `interval`: `string` Interval. Supported values: hours (h) and days (d). For example: "4h" or "1d". Required.

**Request:**

```json
{
    "method": "public/pool_tvl_chart",
    "jsonrpc": "2.0",
    "id": 182471089,
    "params": {
        "query": {
            "poolId": "0x82e0b52f95ae57b35220726a32c3415919389aa5b8baa33a058d7125797535cc",
            "startTime": 1762992000000,
            "endTime": 1763006400000,
            "interval": "1h"
        }
    }
}
```

#### Response Fields

* `result`: Array of Object.
  * `x`: string - ISO-8601 timestamp for the data point
  * `y`: string - TVL value at the given timestamp

**Response:**

```json
{
	"jsonrpc": "2.0",
	"id": 18,
	"method": "public/pool_tvl_chart",
	"result": [
		{
			"x": "2025-11-13T00:00:00Z",
			"y": "1821259.3123844039442100"
		},
		{
			"x": "2025-11-13T01:00:00Z",
			"y": "1822260.1849783625584200"
		},
		{
			"x": "2025-11-13T02:00:00Z",
			"y": "1815391.3167287182791100"
		},
		{
			"x": "2025-11-13T03:00:00Z",
			"y": "1816641.5889304911693100"
		},
		{
			"x": "2025-11-13T04:00:00Z",
			"y": "1815141.1441724232760300"
		}
	],
	"usIn": 1763955136316366,
	"usOut": 1763955136371291,
	"usDiff": 54925
}
```

***

### Pool Volume Chart

**Method** `public/pool_volume_chart`

Returns historical volume data for a specified time range and interval.

**Params**

* `poolId`: `string` Pool unique identifier. Required.
* `startTime`: `number` Start time in milliseconds. Required.
* `endTime`: `number` End time in milliseconds. Required.
* `interval`: `string` Interval. Supported values: hours (h) and days (d). For example: "4h" or "1d". Required.

**Request:**

```json
{
    "method": "public/pool_volume_chart",
    "jsonrpc": "2.0",
    "id": 182471089,
    "params": {
        "query": {
            "poolId": "0x82e0b52f95ae57b35220726a32c3415919389aa5b8baa33a058d7125797535cc",
            "startTime": 1762992000000,
            "endTime": 1763006400000,
            "interval": "1h"
        }
    }
}
```

#### Response Fields

* `result`: Array of Object.
  * `x`: string - ISO-8601 timestamp for the data point
  * `y`: string - Volume value at the given timestamp

**Response:**

```json
{
	"jsonrpc": "2.0",
	"id": 18,
	"method": "public/pool_volume_chart",
	"result": [
		{
			"x": "2025-11-13T00:00:00Z",
			"y": "28.60447418"
		},
		{
			"x": "2025-11-13T01:00:00Z",
			"y": "997.21648969"
		},
		{
			"x": "2025-11-13T02:00:00Z",
			"y": "121.68166247"
		},
		{
			"x": "2025-11-13T03:00:00Z",
			"y": "151.29595968"
		},
		{
			"x": "2025-11-13T04:00:00Z",
			"y": "0"
		}
	],
	"usIn": 1763955624354449,
	"usOut": 1763955624483435,
	"usDiff": 128986
}
```

***

### Token List

**Method** `public/token`

Returns a list of available tokens with pagination.

**Params**

* `keyword`: `string` Ability to search by token address, name, or symbol.
* `page`: `number` Specifies the page number for pagination. Default: 1.
* `pageSize`: `number` Defines the number of records per page. Default: 10.
* `startTime`: `number` Start timestamp for filtering tokens by creation time.
* `endTime`: `number` End timestamp for filtering tokens by creation time.

**Request:**

```json
{
  "method": "public/token",
  "jsonrpc": "2.0",
  "id": 3,
  "params": {
    "query": {
      "keyword": "APT",
      "page": 1,
      "pageSize": 20,
      "startTime": 1742428856000,
      "endTime": 1742287927782
    }
  }
}
```

#### Response Fields

* `addr`: string – Token type/address on Aptos.
* `name`: string – Token display name.
* `ticker`: string – Token symbol.
* `decimals`: number – Fractional decimals for formatting balances.
* `img`: string – URL to a token logo image.
* `isVerified`: boolean – Whether the token is verified by TAPP.
* `price`: string – Latest price in USD (decimal string).
* `tvl`: string – Token TVL in USD across pools (decimal string).
* `txnCount`: number – Recent transaction count used in Explore views.
* `volume`: string – Aggregated trading volume in USD (decimal string).
* `createdAt`: string – ISO-8601 timestamp when the token was first indexed.
* `price1hPercentage`: string – 1h price change percentage.
* `price24hPercentage`: string – 24h price change percentage.
* `price7dPercentage`: string – 7d price change percentage.
* `price30dPercentage`: string – 30d price change percentage.

Notes:

* Monetary values are strings to preserve precision.
* Use `decimals` when converting on-chain amounts to human-readable format.

**Response:**

```json
{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "public/token",
    "result": {
        "data": [
            {
                "addr": "0x000000000000000000000000000000000000000000000000000000000000000a",
                "color": "#FFFFFF",
                "createdAt": "2025-06-11T11:12:27.335744Z",
                "decimals": 8,
                "img": "https://img.svg",
                "isVerified": true,
                "name": "Aptos Coin",
                "price": "4.26695366",
                "price1hPercentage": "-0.12190433029990174000",
                "price24hPercentage": "1.22319129106911677100",
                "price30dPercentage": "-8.63054261241970021400",
                "price7dPercentage": "0.83888631681684170900",
                "priceData": {
                    "price1h": 4.27216161,
                    "price24h": 4.21539136,
                    "price30d": 4.67,
                    "price7d": 4.23145655
                },
                "ticker": "APT",
                "tvl": "1499139.547246734356",
                "txnCount": "0",
                "volume": "0"
            },
        ],
        "total": 1
    },
    "usIn": 1757293142784413,
    "usOut": 1757293143256432,
    "usDiff": 472019
}

```

***

### Pool Info

**Method** `public/pool_info`

Retrieves liquidity pool information using either two token addresses or a specific pool ID. For swap transactions, users can submit two token addresses and extract the pool ID from the response.

**Params**

* `poolId`: `string` Pool unique identifier.
* `tokenAddrs`: `string[]` An array containing exactly two token addresses that define the liquidity pool.

**Request with PoolId:**

```json
{
  "method": "public/pool_info",
  "jsonrpc": "2.0",
  "id": 3,
  "params": {
    "query": {
      "poolId": "0xpool"
    }
  }
}
```

**Request with Token Address:**

```json
{
  "method": "public/pool_info",
  "jsonrpc": "2.0",
  "id": 3,
  "params": {
    "query": {
      "tokenAddrs": [
        "0xtoken0",
        "0xtoken1"
      ]
    }
  }
}
```

#### Response Fields

* `poolId`: string – Unique pool address/id on Aptos.
* `poolType`: string – Pool type, one of `AMM`, `CLMM`, `STABLE`.
* `feeTier`: string – Fee tier in bps or percent string depending on pool.
* `sqrtPrice`: string – Current square root price (Q64.64-style fixed point for CLMM).
* `tickSpacing`: number – CLMM tick spacing (only for CLMM pools).
* `tokens`: array – Tokens in the pool.
  * `addr`: string – Token address/type.
  * `decimals`: number – Token decimals.
  * `reserve`: number – Current reserve amount (apply decimals for UI).
  * `ticker`: string – Token symbol.
  * `color`: string - Color of token in hex format.
  * `verified`: boolean – Whether the token is verified by TAPP.
* `totalShare`: string – Total LP shares minted for the pool.

Notes:

* `tickSpacing` is only present for CLMM pools; AMM/Stable may omit it.
* Use `sqrtPrice` and `tickSpacing` to derive price and ticks in CLMM.

**Response:**

```json
{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "public/pool_info",
    "result": {
        "feeTier": "0.0100",
        "poolId": "0xpool1",
        "poolType": "CLMM",
        "sqrtPrice": "18446744073709551616",
        "status": "ACTIVE",
        "tickSpacing": 1,
        "tokens": [
            {
                "addr": "0xaddr1",
                "color": "#2775CA",
                "decimals": 6,
                "reserve": 10000,
                "ticker": "USDT",
                "verified": true
            },
            {
                "addr": "0xaddr2",
                "color": "#8916D4",
                "decimals": 8,
                "reserve": 10000,
                "ticker": "stAPT",
                "verified": true
            }
        ],
        "totalShare": "10000"
    },
    "usIn": 1757293224166478,
    "usOut": 1757293224223869,
    "usDiff": 57391
}
```

***

### Position

**Method** `public/position`

Retrieves a paginated list of user's liquidity positions, organized by pool. A user may have multiple positions within a single pool.

**Params**

* `nftAddrs`: `string[]` Optional. The blockchain addresses of the NFT whose positions will be retrieved.
* `page`: `number` Specifies the page number for pagination. Default: 1.
* `pageSize`: `number` Defines the number of records per page. Default: 10.

**Request:**

```json
{
  "method": "public/position",
  "jsonrpc": "2.0",
  "id": 3,
  "params": {
    "query": {
      "page": 1,
      "pageSize": 10,
      "nftAddrs": ["0x1234", "0x5678"]
    }
  }
}
```

#### Response Fields

* `apr`: object – APR breakdown for the position.
  * boostedAprPercentage: number – APR from boosts/incentives.
  * campaignAprs: array – Optional list of campaign APR components.
  * feeAprPercentage: number – APR from trading fees.
  * totalAprPercentage: number – Total APR (fee + boosted + campaigns).
* `collectedFees`: string – Collected fees for the position.
* `createdAt`: string – ISO-8601 timestamp when the position was created.
* `estimatedCollectFees`: array – Estimated collect fees.
  * addr: string – collect fee token address.
  * amount: string – collect fee amount.
  * color: string – collect fee token color.
  * decimals: number – collect fee token decimals.
  * idx: number – collect fee token index.
  * img: string – collect fee token image.
  * symbol: string – collect fee token symbol.
  * usd: string – collect fee in USD.
  * verified: boolean – whether the collect fee token is verified.
* `estimatedIncentives`: array – Estimated incentives.
  * addr: string – incentive token address.
  * amount: string – incentive amount.
  * color: string – incentive token color.
  * decimals: number – incentive token decimals.
  * idx: number – incentive token index.
  * img: string – incentive token image.
  * symbol: string – incentive token symbol.
  * usd: string – incentive in USD.
  * verified: boolean – whether the incentive token is verified.
* `estimatedWithdrawals`: array – Estimated withdrawals.
  * addr: string – withdrawal token address.
  * amount: string – withdrawal amount.
  * color: string – withdrawal token color.
  * decimals: number – withdrawal token decimals.
  * idx: number – withdrawal token index.
  * img: string – withdrawal token image.
  * symbol: string – withdrawal token symbol.
  * usd: string – withdrawal in USD.
  * verified: boolean – whether the withdrawal is verified.
* `feeTier`: string – Pool fee tier (bps) for this position's pool.
* `initialDeposits`: array – Initial deposits.
  * addr: string – initial deposit token address.
  * amount: string – initial deposit amount.
  * color: string – initial deposit token color.
  * decimals: number – initial deposit token decimals.
  * idx: number – initial deposit token index.
  * img: string – initial deposit token image.
  * symbol: string – initial deposit token symbol.
  * usd: string – initial deposit in USD.
  * verified: boolean – whether the initial deposit token is verified.
* `max`: string – Max price for the position.
* `min`: string – Min price for the position.
* `mintedShare`: string – Minted share for the position.
* `poolId`: string – Pool address for the position.
* `poolType`: string – Pool type for the position.
* `positionAddr`: string – Position address for the position.
* `positionIdx`: string – Position index for the position.
* `shareOfPool`: string – Share of pool for the position.
* `sqrtPrice`: string – Square root price for the position.
* `timeWeightedTvl`: string – Time weighted TVL for the position.
* `totalEarnings`: array – Total earnings for the position.
  * addr: string – earning token address.
  * amount: string – earning amount.
  * color: string – earning token color.
  * decimals: number – earning token decimals.
  * idx: number – earning token index.
  * img: string – earning token image.
  * symbol: string – earning token symbol.
  * usd: string – earning in USD.
  * verified: boolean – whether the earning token is verified.
* `tvl`: string – TVL for the position.
* `userAddr`: string – User address for the position.

**Response:**

```json
{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "public/position",
    "result": {
        "data": [
            {
                "apr": {
                    "boostedAprPercentage": "11.8762139379439780526392657412958746681517539133477195240532571877065432914738929279576999339061467300",
                    "campaignAprs": [
                        {
                            "aprPercentage": "11.8762139379439780526392657412958746681517539133477195240532571877065432914738929279576999339061467300",
                            "campaignIdx": "5",
                            "token": {
                                "addr": "0xabc",
                                "color": "#E4FE54",
                                "decimals": 8,
                                "img": "https://img.svg",
                                "symbol": "kAPT",
                                "verified": true
                            }
                        }
                    ],
                    "feeAprPercentage": "0.162086325719364321429338815505616366863250732421875",
                    "totalAprPercentage": "12.0383002636633428181578144068641072044676718820977195240532571877065432914738929279576999339061467300"
                },
                "collectedFees": "0",
                "createdAt": "2025-07-31T14:06:24.905776Z",
                "estimatedCollectFees": [
                    {
                      "addr": "0xabc",
                      "amount": "0",
                      "color": "#FFFFFF",
                      "decimals": 8,
                      "idx": 0,
                      "img": "https://img.svg",
                      "symbol": "APT",
                      "usd": "0",
                      "verified": true
                    },
                ],
                "estimatedIncentives": [
                    {
                        "addr": "0xcds",
                        "amount": "183.07116803",
                        "color": "#E4FE54",
                        "decimals": 8,
                        "idx": -1,
                        "img": "https://img.svg",
                        "symbol": "kAPT",
                        "usd": "801.1811482514462736",
                        "verified": true
                    },
     
                ],
                "estimatedWithdrawals": [
                    {
                        "addr": "0x000000000000000000000000000000000000000000000000000000000000000a",
                        "amount": "47050.6479724828355005803057689224",
                        "color": "#FFFFFF",
                        "decimals": 8,
                        "idx": 0,
                        "img": "https://img.svg",
                        "symbol": "APT",
                        "usd": "206018.207764169780946499039499785239842929778277635932681732811033725738525390625000",
                        "verified": true
                    },
                ],
                "feeTier": "0.0100",
                "initialDeposits": [
                    {
                        "addr": "0x000000000000000000000000000000000000000000000000000000000000000a",
                        "amount": "51000",
                        "color": "#FFFFFF",
                        "decimals": 8,
                        "idx": 0,
                        "img": "https://img.svg",
                        "symbol": "APT",
                        "usd": "223311.028619999997317790985107421875",
                        "verified": true
                    },
                ],
                "max": "1",
                "min": "1",
                "mintedShare": "101978146189073509526129",
                "parent": "0xparent",
                "poolId": "0xpool",
                "poolType": "STABLE",
                "positionAddr": "0xposition",
                "positionIdx": "531",
                "shareOfPool": "0.29575145209971007733",
                "sqrtPrice": "0",
                "timeWeightedTvl": "453900",
                "totalEarnings": [
                    {
                        "addr": "0x000000000000000000000000000000000000000000000000000000000000000a",
                        "amount": "-3949.3520275171644994196942310776",
                        "color": "#FFFFFF",
                        "decimals": 8,
                        "idx": 0,
                        "img": "https://img.svg",
                        "symbol": "APT",
                        "usd": "-17292.820855830216371291945607636635157070221722364067318267188966274261474609375000",
                        "verified": true
                    },
                ],
                "tvl": "1509992.67884299",
                "userAddr": "0xuser"
            }
        ],
        "total": 1
    },
    "usIn": 1757327336013746,
    "usOut": 1757327337522736,
    "usDiff": 1508990
}
```

***

### User Transaction

**Method** `public/txns`

Retrieves a paginated list of user transactions on the platform.

**Params**

* `userAddr`: `string` The blockchain address of the user whose positions will be retrieved.
* `txType`: `string` Filters transactions by type. Available options: Swap, Add, Remove.
* `page`: `number` Specifies the page number for pagination. Default: 1.
* `pageSize`: `number` Defines the number of records per page. Default: 10.

**Request:**

```json
{
  "method": "public/txns",
  "jsonrpc": "2.0",
  "id": 3,
  "params": {
    "query": {
      "userAddr": "0xuser",
      "txType": "Add",
      "page": 1,
      "pageSize": 10
    }
  }
}
```

#### Response Fields

* `createdAt`: string – ISO-8601 timestamp of the transaction.
* `createdBy`: string – Sender/creator address.
* `txType`: string – One of `Swap`, `Add`, `Remove`, `Claim`.
* `transactionVersion`: number – Aptos transaction version.
* `volume`: string – Effective USD volume for the transaction.
* `swapData`: object|null – Present for `Swap` transactions.
  * `amountIn`: string – Input token amount (apply decimals for UI).
  * `amountOut`: string – Output token amount.
  * `fromIdx`: number – Pool token index sold (0 or 1).
  * `toIdx`: number – Pool token index bought (0 or 1).
* `tokens`: array – Token details involved in the transaction.
  * `tokenIdx`: number – Index of the token in the pool (0 or 1).
  * `tokenAddr`: string – Token address/type.
  * `ticker`: string – Symbol.
  * `decimals`: number – Decimals.
  * `img`: string – Logo URL.
  * `isVerified`: boolean – Token verification flag.
  * `amount`: string – Amount moved for this token (may be positive/negative depending on direction).

Notes:

* For `Add`/`Remove`, `swapData` is `null`; amounts reflect liquidity added/removed.
* Amount strings preserve precision; apply decimals for formatting.

**Response:**

```json
{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "public/txns",
    "result": {
        "data": [
            {
                "createdAt": "2025-07-31T14:06:23.894852Z",
                "createdBy": "0xaddr1",
                "incentiveTokens": [],
                "swapData": null,
                "tokens": [
                    {
                        "amount": "51000",
                        "decimals": 8,
                        "img": "https://img.svg",
                        "isVerified": true,
                        "ticker": "APT",
                        "tokenAddr": "0x1234",
                        "tokenIdx": 0
                    },
                    {
                        "amount": "51000",
                        "decimals": 8,
                        "img": "https://img.svg",
                        "isVerified": true,
                        "ticker": "kAPT",
                        "tokenAddr": "0xaddr2",
                        "tokenIdx": 1
                    }
                ],
                "transactionVersion": 3153001878,
                "txType": "Add",
                "volume": "453900"
            },
            {
                "createdAt": "2025-07-31T14:05:28.374192Z",
                "createdBy": "",
                "incentiveTokens": [],
                "swapData": {
                    "amountIn": "6999.769",
                    "amountOut": "6991.94746557",
                    "fromIdx": 1,
                    "toIdx": 0
                },
                "tokens": [
                    {
                        "amount": "0",
                        "decimals": 8,
                        "img": "https://img.svg",
                        "isVerified": true,
                        "ticker": "APT",
                        "tokenAddr": "0xasdf",
                        "tokenIdx": 0
                    },
                    {
                        "amount": "0",
                        "decimals": 8,
                        "img": "https://img.svg",
                        "isVerified": true,
                        "ticker": "kAPT",
                        "tokenAddr": "0xfdsa",
                        "tokenIdx": 1
                    }
                ],
                "transactionVersion": 3152998075,
                "txType": "Swap",
                "volume": "31148.9700"
            },
            {
                "createdAt": "2025-07-31T14:00:53.020418Z",
                "createdBy": "0xaddr",
                "incentiveTokens": [],
                "swapData": null,
                "tokens": [
                    {
                        "amount": "-40846.91730739",
                        "decimals": 8,
                        "img": "https://img.svg",
                        "isVerified": true,
                        "ticker": "APT",
                        "tokenAddr": "0xasdf",
                        "tokenIdx": 0
                    },
                    {
                        "amount": "-59223.02664137",
                        "decimals": 8,
                        "img": "https://img.svg",
                        "isVerified": true,
                        "ticker": "kAPT",
                        "tokenAddr": "0xfdsa",
                        "tokenIdx": 1
                    }
                ],
                "transactionVersion": 3152977998,
                "txType": "Remove",
                "volume": "446311.9500"
            },
        ],
        "total": 5
    },
    "usIn": 1757295289107834,
    "usOut": 1757295289161899,
    "usDiff": 54065
}

```

***

### Swap

**Method** `public/swap`

Generates a transaction payload for client signature to perform token swaps across V2, V3, and Stable pools.

#### AMM

**Params**

* `poolId`: `string` Unique identifier of the liquidity pool to use for the swap.
* `a2b`: `boolean` Set to true when swapping from token0 to token1 in the pool.
* `fixedAmountIn`: `boolean` Indicates whether the input amount will remain fixed during the swap.
* `amountIn`: `number` Quantity of input tokens to swap, denominated in microunits.
* `amountOut`: `number` Minimum quantity of output tokens expected from the swap, denominated in microunits.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.

**Request:**

```json
{
  "method": "public/swap",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "poolId": "0xpool",
      "a2b": true,
      "fixedAmountIn": true,
      "amountIn": 100000000,
      "amountOut": 295873010,
      "accountAddress": "0xaccount",
      "version": "v2"
    }
  }
}
```

#### Response Fields (same response for swap / add liquidity / remove liqudity)

* `payload`: string – Hex-encoded BCS bytes of the `RawTransaction`.

Next steps:

* Deserialize, sign, and submit the payload using your wallet as shown in the Signing section.

**Response:**

```json
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "public/swap",
    "result": {
        "payload": "025dd0cf28acfca412d756115a03fe4b2c787a8a796e33d2a3edf1a8e60cb85f4d0200000000000002487e905f899ccb6d46fdaec56ba1e0c4cf119862a16c409904b8c78fab1f5e8a06726f7574657204737761700001333252320d17f01756f3d010f80ff46d6baf842207ed2732cdbab6b87a8270c69da3010100e1f50500000000f2a9a2110000000058020000000000006400000000000000ae35be680000000001"
    },
    "usIn": 1757295745828734,
    "usOut": 1757295746079874,
    "usDiff": 251140
}
```

#### CLMM

**Params**

* `poolId`: `string` Unique identifier of the liquidity pool to use for the swap.
* `a2b`: `boolean` Set to true when swapping from token0 to token1 in the pool.
* `fixedAmountIn`: `boolean` Indicates whether the input amount will remain fixed during the swap.
* `minAmountOut`: `number` Minimum quantity of output tokens expected from the swap, denominated in microunits.
* `sqrtPrice`: `number` Target square root price for v3.
* `amountIn`: `number` Quantity of input tokens to swap, denominated in microunits.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.

**Request:**

```json
{
  "method": "public/swap",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "poolId": "0xpool",
      "a2b": true,
      "fixedAmountIn": true,
      "minAmountOut": 0,
      "sqrtPrice": 4124817371235595,
      "amountIn": 100000000,
      "accountAddress": "0xaccount",
      "version": "v3"
    }
  }
}
```

#### Stable

**Params**

* `poolId`: `string` Unique identifier of the liquidity pool to use for the swap.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `tokenIn`: `number` Index of the token which wants to be sold.
* `tokenOut`: `number` Index of the token which wants to be bought.
* `amountIn`: `number` Quantity of input tokens to swap, denominated in microunits.
* `minAmountOut`: `number` Minimum quantity of output tokens expected from the swap, denominated in microunits.
* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.

**Request:**

```json
{
  "method": "public/swap",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "poolId": "0xpool",
      "accountAddress": "0xaccount",
      "tokenIn": 0,
      "tokenOut": 1,
      "amountIn": 100000,
      "minAmountOut": 99000,
      "version": "stable"
    }
  }
}
```

***

### Create Pool and Add Liquidity

**Method** `public/create_pool_add_liquidity`

Generates a transaction payload for client signature to create a new liquidity pool and add initial liquidity across V2, V3, and Stable pool types.

#### AMM

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `coins`: `string[]` Token addresses that will form the liquidity pool.
* `amounts`: `string[]` Quantities of each token to add as initial liquidity.
* `minAmounts`: `string[]` Minimum quantities each token to add as initial liquidity.
* `fee`: `number` Fee tier for the pool. Available options: 100 (0.01%), 500 (0.05%), 3000 (0.3%), 10000 (1%).

**Request:**

```json
{
  "method": "public/create_pool_add_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "v2",
      "accountAddress": "0xaccount",
      "coins": [
        "0xcoin0",
        "0xcoin1"
      ],
      "amounts": [
        "100000",
        "200000"
      ],
      "minAmounts": [
        "0",
        "0"
      ],
      "fee": 10000
    }
  }
}
```

#### CLMM

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `coins`: `string[]` Token addresses that will form the liquidity pool.
* `amounts`: `string[]` Quantities of each token to add as initial liquidity.
* `minAmounts`: `string[]` Minimum quantities each token to add as initial liquidity.
* `fee`: `number` Fee tier for the pool. Available options: 100 (0.01%), 500 (0.05%), 3000 (0.3%), 10000 (1%).
* `sqrtPrice`: `string` Initial square root price of the pool.
* `lowerTick`: `string` Lower tick boundary of the price range.
* `upperTick`: `string` Upper tick boundary of the price range
* `fixedAmountA`: `boolean` Indicator whether the first token amount remains fixed during position creation.

**Request:**

```json
{
  "method": "public/create_pool_add_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "v3",
      "accountAddress": "0xaccount",
      "coins": [
        "0xcoin0",
        "0xcoin1"
      ],
      "amounts": [
        "100000",
        "200000"
      ],
      "minAmounts": [
        "0",
        "0"
      ],
      "fee": 10000,
      "sqrtPrice": "4124817371235595",
      "lowerTick": "0",
      "upperTick": "23040",
      "fixedAmountA": true
    }
  }
}
```

#### Stable

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `coins`: `string[]` Token addresses that will form the liquidity pool.
* `amounts`: `string[]` Quantities of each token to add as initial liquidity.
* `fee`: `number` Fee tier for the pool. Available options: 100 (0.01%), 500 (0.05%), 3000 (0.3%), 10000 (1%).
* `amplification`: `string` Between 100 to max 1000.
* `offPegMultiplier`: `string` Off peg multiplier.
* `minMintAmount`: `string` Minimum minted LP amount.

**Request:**

```json
{
  "method": "public/create_pool_add_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "stable",
      "accountAddress": "0xaccount",
      "coins": [
        "0xcoin0",
        "0xcoin1"
      ],
      "amounts": [
        "100000",
        "200000"
      ],
      "fee": 10000,
      "amplification": "1000",
      "offPegMultiplier": "20000000000",
      "minMintAmount": "0"
    }
  }
}
```

***

### Add Liquidity

**Method** `public/add_liquidity`

Generates a transaction payload for client signature to add liquidity across V2, V3, and Stable pool types.

#### AMM

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `poolId`: `string` Unique identifier for the liquidity pool.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `amounts`: `string[]` Quantities of each token to add as initial liquidity.
* `minAmounts`: `string[]` Minimum quantities each token to add as initial liquidity.

**Request:**

```json
{
  "method": "public/add_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "v2",
      "poolId": "0xpool",
      "accountAddress": "0xaccount",
      "amounts": [
        "100000",
        "200000"
      ],
      "minAmounts": [
        "0",
        "0"
      ]
    }
  }
}
```

#### CLMM

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `poolId`: `string` Unique identifier for the liquidity pool.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `amounts`: `string[]` Quantities of each token to add as initial liquidity.
* `minAmounts`: `string[]` Minimum quantities each token to add as initial liquidity.
* `lowerTick`: `string` Lower tick boundary of the price range.
* `upperTick`: `string` Upper tick boundary of the price range
* `fixedAmountA`: `boolean` Indicator whether the first token amount remains fixed during position creation.

**Request:**

```json
{
  "method": "public/add_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "v3",
      "poolId": "0xpool",
      "accountAddress": "0xaccount",
      "amounts": [
        "100000",
        "200000"
      ],
      "minAmounts": [
        "0",
        "0"
      ],
      "lowerTick": "0",
      "upperTick": "23040",
      "fixedAmountA": true
    }
  }
}
```

#### Stable

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `poolId`: `string` Unique identifier for the liquidity pool.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `amounts`: `string[]` Quantities of each token to add as initial liquidity.
* `minMintAmount`: `string` Minimum minted LP amount.

**Request:**

```json
{
  "method": "public/add_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "stable",
      "poolId": "0xpool",
      "accountAddress": "0xaccount",
      "amounts": [
        "100000",
        "200000"
      ],
      "minMintAmount": "0"
    }
  }
}
```

***

### Remove Liquidity

**Method** `public/remove_liquidity`

Generates a transaction payload for client signature to remove liquidity across V2, V3, and Stable pool types.

#### AMM

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `poolId`: `string` Unique identifier for the liquidity pool.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `positionAddress`: `string` The on-chain address identifier of the specific liquidity position to be withdrawn.
* `minAmounts`: `string[]` Minimum token amounts to receive when removing liquidity, protecting against slippage.
* `burnedShare`: `string` Amount of liquidity provider (LP) tokens or shares to burn/remove from the pool.

**Request:**

```json
{
  "method": "public/remove_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "v2",
      "poolId": "0xpool",
      "accountAddress": "0xaccount",
      "positionAddress": "0xposition",
      "minAmounts": [
        "100000",
        "200000"
      ],
      "burnedShare": "14620"
    }
  }
}
```

#### CLMM

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `poolId`: `string` Unique identifier for the liquidity pool.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `positionAddress`: `string` The on-chain address identifier of the specific liquidity position to be withdrawn.
* `minAmounts`: `string[]` Minimum token amounts to receive when removing liquidity, protecting against slippage.
* `burnedShare`: `string` Amount of liquidity provider (LP) tokens or shares to burn/remove from the pool.

**Request:**

```json
{
  "method": "public/remove_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "v3",
      "poolId": "0xpool",
      "accountAddress": "0xaccount",
      "positionAddress": "0xposition",
      "minAmounts": [
        "100000",
        "200000"
      ],
      "burnedShare": "14620"
    }
  }
}
```

#### Stable

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `poolId`: `string` Unique identifier for the liquidity pool.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `positionAddress`: `string` The on-chain address identifier of the specific liquidity position to be withdrawn.
* `minAmounts`: `string[]` Minimum token amounts to receive when removing liquidity, protecting against slippage.
* `burnedShare`: `string` Amount of liquidity provider (LP) tokens or shares to burn/remove from the pool.
* `type`: `number` type 1 = remove\_liquidity\_one\_coin, type 2 =remove\_liquidity\_imbalance, type 3 = remove\_liquidity\_ratio.

**Request for stable:**

```json
{
  "method": "public/remove_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "v3",
      "poolId": "0xpool",
      "accountAddress": "0xaccount",
      "positionAddress": "0xposition",
      "minAmounts": [
        "100000",
        "200000"
      ],
      "burnedShare": "14620",
      "type": 1
    }
  }
}
```

***

### Remove Multi Liquidity

**Method** `public/remove_multi_liquidity`

Generates a transaction payload for client signature to remove multiple liquidities across V2, V3, and Stable pool types.

#### AMM

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `poolId`: `string` Unique identifier for the liquidity pool.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `positions`: An array of objects, each describing a position with:
  * `positionAddress`: `string` The on-chain address identifier of the specific liquidity position to be withdrawn.
  * `minAmounts`: `string[]` Minimum token amounts to receive when removing liquidity, protecting against slippage.
  * `burnedShare`: `string` Amount of liquidity provider (LP) tokens or shares to burn/remove from the pool.

**Request:**

```json
{
  "method": "public/remove_multi_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "v2",
      "poolId": "0xpool",
      "accountAddress": "0xaccount",
      "positions": [
        {
          "positionAddress": "0xposition",
          "minAmounts": [
            "100000",
            "200000"
          ],
          "burnedShare": "14620"
        }
      ]
    }
  }
}
```

#### CLMM

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `poolId`: `string` Unique identifier for the liquidity pool.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `positions`: An array of objects, each describing a position with:
  * `positionAddress`: `string` The on-chain address identifier of the specific liquidity position to be withdrawn.
  * `minAmounts`: `string[]` Minimum token amounts to receive when removing liquidity, protecting against slippage.
  * `burnedShare`: `string` Amount of liquidity provider (LP) tokens or shares to burn/remove from the pool.

**Request:**

```json
{
  "method": "public/remove_multi_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "v3",
      "poolId": "0xpool",
      "accountAddress": "0xaccount",
      "positions": [
        {
          "positionAddress": "0xposition",
          "minAmounts": [
            "100000",
            "200000"
          ],
          "burnedShare": "14620"
        }
      ]
    }
  }
}
```

#### Stable

**Params**

* `version`: `string` Specifies the pool version protocol. Available options: v2, v3, stable.
* `poolId`: `string` Unique identifier for the liquidity pool.
* `accountAddress`: `string` Blockchain address of the transaction sender.
* `positions`: An array of objects, each describing a position with:
  * `positionAddress`: `string` The on-chain address identifier of the specific liquidity position to be withdrawn.
  * `minAmounts`: `string[]` Minimum token amounts to receive when removing liquidity, protecting against slippage.
  * `burnedShare`: `string` Amount of liquidity provider (LP) tokens or shares to burn/remove from the pool.
  * `type`: `number` type 1 = remove\_liquidity\_one\_coin, type 2 =remove\_liquidity\_imbalance, type 3 = remove\_liquidity\_ratio.

**Request:**

```json
{
  "method": "public/remove_multi_liquidity",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "stable",
      "poolId": "0xpool",
      "accountAddress": "0xaccount",
      "positions": [
        {
          "positionAddress": "0xposition",
          "minAmounts": [
            "100000",
            "200000"
          ],
          "burnedShare": "14620",
          "type": 1
        }
      ]
    }
  }
}
```

***

### Collect Fee

**Method** `public/collect_fee`

Generates a transaction payload for client signature to collect fees for V3 pool type.

**Params**

* `version`: `string` Specifies the pool version protocol. Must be V3 for this operation.
* `poolId`: `string` Unique identifier for the liquidity pool.
* `accountAddress`: `string` The blockchain address of the account.
* `positionAddress`: `string` The on-chain address identifier of the specific liquidity position to be withdrawn.

**Request:**

```json
{
  "method": "public/collect_fee",
  "jsonrpc": "2.0",
  "id": 1,
  "params": {
    "query": {
      "version": "v3",
      "poolId": "0xpool",
      "accountAddress": "0xaccount",
      "positionAddress": "0xposition"
    }
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tapp-exchange.gitbook.io/tapp-exchange/developer-docs/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
