wp-solana-pool-traits 0.1.1

Traits and utilities for Solana liquidity pool operations: PoolViewer, PoolInfuser, PositionViewer
Documentation
//! Types for Whirlpool operations

use solana_sdk::pubkey::Pubkey;

use crate::types::CurrencyAmount;

/// A generic wrapper that pairs data with its public key.
#[derive(Debug, Clone)]
pub struct DataWithPubkey<T> {
    /// The deserialized data.
    pub data: T,
    /// The on-chain public key of the account.
    pub pubkey: Pubkey,
}

/// Quote data for fees and rewards of a single position.
#[derive(Debug, Clone)]
pub struct QuoteData {
    /// Position mint (NFT) address.
    pub position_mint: Pubkey,
    /// Pool address this position belongs to.
    pub pool: Pubkey,
    /// Pending fee amounts.
    pub fees: FeeQuoteData,
    /// Pending reward amounts.
    pub rewards: RewardQuoteData,
}

/// Reward quote data containing pending reward amounts.
#[derive(Debug, Clone)]
pub struct RewardQuoteData {
    /// Pending reward amounts, one per reward token (up to 3). `None` means
    /// the reward slot is unused.
    pub rewards: Vec<Option<CurrencyAmount>>,
}

/// Fee quote data containing pending fee amounts for both tokens.
#[derive(Debug, Clone)]
pub struct FeeQuoteData {
    /// Pending fee amount in token A.
    pub currency_amount_a: CurrencyAmount,
    /// Pending fee amount in token B.
    pub currency_amount_b: CurrencyAmount,
}