Skip to content

Portfolio Data ​

The API provides endpoints for tracking user LP positions and swap history.

LP Positions ​

GET https://mainnet.api.ryze.pro/api/portfolio/pools/:address

Returns the user's liquidity pool positions (LP token balances).

bash
curl "https://mainnet.api.ryze.pro/api/portfolio/pools/0xYourAddress?page=1&limit=15"
json
{
  "address": "0xYourAddress",
  "positions": [
    {
      "address": "0xYourAddress",
      "poolAddress": "0x22f902cEfcF8b0bEc6489Cb8ac11FdDa9B2aF125",
      "poolShares": "99500000000000000000",
      "updatedAt": "2026-04-15T12:00:00.000Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 15,
    "totalItems": 1,
    "totalPages": 1,
    "hasNext": false,
    "hasPrev": false
  }
}
FieldTypeDescription
poolAddressstringPool contract address
poolSharesstringLP token balance (18 decimals)
updatedAtstringLast update timestamp
ParameterTypeDefaultDescription
pagestring"1"Page number
limitstring"15"Items per page (max 15)

Position Value (On-Chain) ​

poolShares above is the raw LP token balance. To convert it into the underlying token amounts (and from there, USD value), read the WeightedPoolQueries contract directly — see Contract Addresses for the deployed address.

Underlying assets for a wallet ​

queryProportionalExitForUser returns the token amounts a wallet would receive if it burned its entire LP balance proportionally — i.e. the current underlying value of the position.

javascript
const WEIGHTED_POOL_QUERIES = '0x...'; // see Contract Addresses

const queriesAbi = [
  {
    type: 'function',
    name: 'queryProportionalExitForUser',
    stateMutability: 'view',
    inputs: [
      { name: 'pool', type: 'address' },
      { name: 'user', type: 'address' },
    ],
    outputs: [
      {
        name: 'result',
        type: 'tuple',
        components: [
          { name: 'tokens', type: 'address[]' },
          { name: 'amountsOut', type: 'uint256[]' },
        ],
      },
    ],
  },
];

const { tokens, amountsOut } = await publicClient.readContract({
  address: WEIGHTED_POOL_QUERIES,
  abi: queriesAbi,
  functionName: 'queryProportionalExitForUser',
  args: [poolAddress, userAddress],
});
// tokens[i] holds amountsOut[i] (raw token units, per-token decimals)
FieldTypeDescription
tokensaddress[]Pool asset token addresses
amountsOutuint256[]Underlying amount per token for the wallet's full LP balance (raw units)

Returns zero-filled amountsOut if the wallet holds no LP. Multiply each amountsOut[i] by the token's USD price (see Fetch Prices) and sum for the wallet's USD value in that pool.

Total pool value (TVL) ​

getPoolTotalValueUSD returns the whole pool's value in USD (WAD, 18 decimals) given a price for every asset.

javascript
const tvlAbi = [
  {
    type: 'function',
    name: 'getPoolTotalValueUSD',
    stateMutability: 'view',
    inputs: [
      { name: 'pool', type: 'address' },
      {
        name: 'tokenPrices',
        type: 'tuple[]',
        components: [
          { name: 'token', type: 'address' },
          { name: 'priceWad', type: 'uint256' },
        ],
      },
    ],
    outputs: [{ name: 'totalValueWad', type: 'uint256' }],
  },
];

const totalValueWad = await publicClient.readContract({
  address: WEIGHTED_POOL_QUERIES,
  abi: tvlAbi,
  functionName: 'getPoolTotalValueUSD',
  args: [
    poolAddress,
    [
      { token: WETH_ADDRESS, priceWad: 1600000000000000000000n },
      { token: USDC_ADDRESS, priceWad: 1000000000000000000n },
    ],
  ],
});
// totalValueWad / 1e18 = pool TVL in USD

tokenPrices must include a non-zero priceWad for every asset in the pool. Prices are per full token unit in WAD (1e18 = $1).

Order History ​

GET https://mainnet.api.ryze.pro/api/portfolio/order-history/:address

Returns paginated swap history with full fee breakdowns.

bash
curl "https://mainnet.api.ryze.pro/api/portfolio/order-history/0xYourAddress?page=1&limit=15"
json
{
  "address": "0xYourAddress",
  "swaps": [
    {
      "id": "0xYourAddress:0xTxHash:42",
      "userAddress": "0xYourAddress",
      "poolAddress": "0x22f902cEfcF8b0bEc6489Cb8ac11FdDa9B2aF125",
      "txHash": "0xTxHash",
      "tokenIn": "0x8335...2913",
      "tokenOut": "0x4200...0006",
      "amountIn": "100000000",
      "amountOut": "62500000000000000",
      "feeDetails": {
        "swapFee": { "token": "0x8335...2913", "amount": "30000" },
        "takerFee": { "token": "0x8335...2913", "amount": "10000" },
        "wbfFee": { "token": "0x8335...2913", "amount": "0" },
        "slippageFee": { "token": "0x8335...2913", "amount": "5000" },
        "wbrFee": { "token": "0x8335...2913", "amount": "0" }
      },
      "timestamp": "2026-04-15T12:00:00.000Z",
      "blockNumber": 44700000,
      "logIndex": 42,
      "isMultiHop": false,
      "createdAt": "2026-04-15T12:00:00.000Z"
    }
  ],
  "pagination": { ... }
}

Multi-Hop Swaps ​

Multi-hop swaps include the route:

json
{
  "isMultiHop": true,
  "multiHopRoute": [
    { "pool": "0xPool1...", "tokenIn": "0xToken1...", "tokenOut": "0xToken2..." },
    { "pool": "0xPool2...", "tokenIn": "0xToken2...", "tokenOut": "0xToken3..." }
  ]
}
ParameterTypeDefaultDescription
pagestring"1"Page number
limitstring"15"Items per page (max 15)