Liquidity Provider (LP) API
Query and subscribe to liquidity pool data including vaults, deposits, withdrawals, and revenue tracking.
Table of Contents
Queries
vaults
List all liquidity vaults with their metrics.
Signature:
vaults(
where: LpVaultsFilter
limit: Int
offset: Int
order_by: LpVaultsOrder
order_desc: Boolean
): [LpVault!]!Parameters:
where: Filter object (optional)address: Filter by vault address
limit: Max resultsoffset: Skip resultsorder_by: Sort byaddressorder_desc: Sort descending
Returns: Array of LpVault objects
Example - Get All Vaults:
query GetAllVaults {
lp {
vaults {
address
collateralDenom
collateralToken {
symbol
name
logoUrl
decimals
}
tvl
sharePrice
apy
availableAssets
currentEpoch
epochStart
sharesDenom
sharesERC20
collateralERC20
revenueInfo {
RevenueCumulative
NetProfit
TraderLosses
ClosedPnl
CurrentEpochPositiveOpenPnl
Liabilities
Rewards
}
}
}
}Example - Get Specific Vault:
query GetVault($address: String!) {
lp {
vaults(where: { address: $address }) {
address
tvl
sharePrice
apy
availableAssets
}
}
}Key Fields Explained:
tvl: Total value locked in the vaultsharePrice: Current value of one vault shareapy: Annual percentage yield (annualized return)availableAssets: Assets not currently in open positionscurrentEpoch: Current epoch numberepochStart: Unix timestamp when current epoch started
Use Cases:
Display vault list with metrics
Compare vault performance
Show available liquidity
Calculate potential returns
deposits
Get user deposits in vaults.
Signature:
deposits(
where: LpDepositsFilter
limit: Int
offset: Int
order_by: LpDepositsOrder
order_desc: Boolean
): [LpDeposit!]!Parameters:
where: Filter object (optional)depositor: Filter by depositor addressvault: Filter by vault address
limit: Max resultsoffset: Skip resultsorder_by: Sort bydepositororvaultorder_desc: Sort descending
Returns: Array of LpDeposit objects
Example - Get User Deposits:
query GetUserDeposits($user: String!) {
lp {
deposits(where: { depositor: $user }) {
depositor
shares
vault {
address
collateralToken { symbol }
sharePrice
tvl
apy
}
}
}
}Example - Calculate Deposit Value:
query CalculateDepositValue($user: String!) {
lp {
deposits(where: { depositor: $user }) {
shares
vault {
sharePrice
collateralToken {
symbol
decimals
}
}
}
}
}To calculate value:
const value = (shares * sharePrice) / (10 ** decimals)Use Cases:
Display user's LP positions
Calculate total deposited value
Track share ownership
Portfolio management
depositHistory
Get historical deposit and withdrawal events.
Signature:
depositHistory(
where: LpDepositHistoryFilter
limit: Int
offset: Int
order_by: LpDepositHistoryOrder
order_desc: Boolean
): [LpDepositHistoryItem!]!Parameters:
where: Filter object (optional)depositor: Filter by depositor addressvault: Filter by vault address
limit: Max resultsoffset: Skip resultsorder_by: Sort bydepositor,sequence, orvaultorder_desc: Sort descending
Returns: Array of LpDepositHistoryItem objects
Example - Get Deposit History:
query GetDepositHistory($user: String!) {
lp {
depositHistory(
where: { depositor: $user }
order_by: sequence
order_desc: true
limit: 50
) {
id
depositor
amount
shares
isWithdraw
vault {
address
collateralToken { symbol }
}
block {
block
block_ts
}
}
}
}Example - Filter Vault History:
query GetVaultHistory($vaultAddress: String!) {
lp {
depositHistory(
where: { vault: $vaultAddress }
order_by: sequence
order_desc: true
limit: 100
) {
depositor
amount
shares
isWithdraw
block { block_ts }
}
}
}Key Fields:
isWithdraw:truefor withdrawals,falsefor depositsamount: Amount of collateral deposited/withdrawnshares: Shares minted (deposit) or burned (withdrawal)
Use Cases:
Build activity timeline
Track deposit/withdrawal events
Audit vault operations
Calculate historical returns
withdrawRequests
Get pending withdrawal requests.
Signature:
withdrawRequests(
where: LpWithdrawRequestsFilter
limit: Int
offset: Int
order_by: LpWithdrawRequestsOrder
order_desc: Boolean
): [LpWithdrawRequest!]!Parameters:
where: Filter object (optional)depositor: Filter by depositor addressvault: Filter by vault address
limit: Max resultsoffset: Skip resultsorder_by: Sort bydepositor,unlock_epoch, orvaultorder_desc: Sort descending
Returns: Array of LpWithdrawRequest objects
Example - Get User Withdrawals:
query GetWithdrawRequests($user: String!) {
lp {
withdrawRequests(where: { depositor: $user }) {
depositor
shares
status
unlockEpoch
autoRedeem
vault {
address
collateralToken { symbol }
currentEpoch
sharePrice
}
}
}
}Example - Check Withdrawal Status:
query CheckWithdrawalReady($user: String!) {
lp {
withdrawRequests(where: { depositor: $user }) {
shares
unlockEpoch
autoRedeem
vault {
currentEpoch
sharePrice
}
}
}
}To check if ready:
const isReady = vault.currentEpoch >= unlockEpoch
const estimatedValue = (shares * vault.sharePrice) / (10 ** decimals)Key Fields:
status: Withdrawal request statusunlockEpoch: Epoch when withdrawal becomes availableautoRedeem: Iftrue, automatically redeemed when unlocked
Use Cases:
Display pending withdrawals
Calculate withdrawal timing
Show estimated withdrawal value
Notify when ready
epochDurationDays
Get epoch duration in days.
Signature:
epochDurationDays: Int!Example:
query GetEpochDuration {
lp {
epochDurationDays
epochDurationHours
}
}epochDurationHours
Get epoch duration in hours.
Signature:
epochDurationHours: Int!Subscriptions
Subscribe to real-time LP data updates.
lpVaults
Subscribe to all vault updates.
Signature:
subscription {
lpVaults: [LpVault!]!
}Example:
subscription WatchVaults {
lpVaults {
address
tvl
sharePrice
apy
availableAssets
currentEpoch
}
}Use Cases:
Real-time TVL tracking
Live APY updates
Monitor available liquidity
Track epoch changes
lpDeposits
Subscribe to user deposit updates.
Signature:
subscription {
lpDeposits(where: SubLpDepositsFilter!): [LpDeposit!]!
}Example:
subscription WatchUserDeposits($user: String!) {
lpDeposits(where: { depositor: $user }) {
depositor
shares
vault {
address
sharePrice
}
}
}Use Cases:
Update user portfolio in real-time
Track share balance changes
Monitor position value
lpDepositHistory
Subscribe to deposit/withdrawal events.
Signature:
subscription {
lpDepositHistory(where: SubLpDepositHistoryFilter!): [LpDepositHistoryItem!]!
}Example:
subscription WatchDepositEvents($user: String!, $vault: String!) {
lpDepositHistory(where: { depositor: $user, vault: $vault }) {
id
amount
shares
isWithdraw
block { block_ts }
}
}Use Cases:
Real-time activity feed
Instant transaction notifications
Live history updates
lpWithdrawRequests
Subscribe to withdrawal request updates.
Signature:
subscription {
lpWithdrawRequests(where: SubLpWithdrawRequestsFilter!): [LpWithdrawRequest!]!
}Example:
subscription WatchWithdrawals($user: String!, $vault: String!) {
lpWithdrawRequests(where: { depositor: $user, vault: $vault }) {
shares
status
unlockEpoch
vault {
currentEpoch
}
}
}Use Cases:
Notify when withdrawal ready
Track withdrawal status
Update UI when unlocked
Types Reference
LpVault
type LpVault {
address: String!
collateralDenom: String!
collateralToken: Token!
collateralERC20: String!
sharesDenom: String!
sharesERC20: String!
tvl: Int!
sharePrice: Float!
apy: Float
availableAssets: Int!
currentEpoch: Int!
epochStart: Int!
revenueInfo: RevenueInfo!
}LpDeposit
type LpDeposit {
depositor: String!
shares: Int!
vault: LpVault!
}LpDepositHistoryItem
type LpDepositHistoryItem {
id: Int!
depositor: String!
amount: Int!
shares: Int!
isWithdraw: Boolean!
vault: LpVault!
block: Block!
}LpWithdrawRequest
type LpWithdrawRequest {
depositor: String!
shares: Int!
status: String!
unlockEpoch: Int!
autoRedeem: Boolean!
vault: LpVault!
}RevenueInfo
Tracks vault revenue and performance.
type RevenueInfo {
RevenueCumulative: Int! # Total revenue earned
NetProfit: Int! # Current net profit
TraderLosses: Int! # Profits from trader losses
ClosedPnl: Int! # Realized PnL from closed positions
CurrentEpochPositiveOpenPnl: Int! # Current epoch unrealized gains
Liabilities: Int! # Current liabilities (trader profits)
Rewards: Int! # Rewards received
}Calculations
Deposit Value
// Calculate current value of deposit
const depositValue = (shares * sharePrice) / (10 ** decimals)Estimated Withdrawal Value
// For pending withdrawal
const estimatedValue = (shares * currentSharePrice) / (10 ** decimals)Time Until Withdrawal
// Calculate epochs remaining
const epochsRemaining = unlockEpoch - currentEpoch
// Calculate time remaining (assuming epoch duration)
const hoursRemaining = epochsRemaining * epochDurationHoursAPY Calculation
APY is calculated from historical revenue:
// Simplified APY calculation
const apy = (revenueInfo.NetProfit / tvl) * (365 / epochDurationDays)Next: Oracle API Reference | Previous | Back to Introduction
Last updated