import { AccountMeta, AddressLookupTableAccount, Commitment, PublicKey, TransactionInstruction } from "@solana/web3.js"; import { BN } from "@coral-xyz/anchor"; import { KaminoLendingClient, KaminoVaultsClient } from "./kamino"; import { BaseClient } from "./base"; import { StateModel } from "../models"; import { PkMap, PkSet } from "../utils"; import { KVaultState, Reserve } from "../deser"; import { JupiterApiClient, TokenListItem } from "../utils/jupiterApi"; import { BridgeClient } from "./bridge"; import { EpiClient } from "./epi"; import { LoopscaleBorrowClient, LoopscaleLendClient, LoopscaleVaultClient } from "./loopscale"; /** * Represents a single asset holding within a vault. * * @param mintAddress - The SPL token mint address of the held asset * @param decimals - Number of decimal places for the token (e.g., 6 for USDC, 9 for SOL) * @param amount - Unsigned token amount in native units; direction (deposit/borrow) is in protocolMeta * @param price - Current price of the asset denominated in the base asset (e.g., USD, SOL) * @param priceMeta - Additional pricing context (e.g., source, slot, base asset). Default base asset, if not specified, is USD. * @param protocol - Protocol identifier where the asset is allocated * @param protocolMeta - Protocol-specific metadata (e.g., market index, position direction, reserve address) */ export declare class Holding { readonly mintAddress: PublicKey; readonly decimals: number; readonly amount: BN; readonly price: number; readonly priceMeta: Record; readonly protocol: string; readonly protocolMeta: Record; readonly uiAmount: number; constructor(mintAddress: PublicKey, decimals: number, amount: BN, price: number, priceMeta: Record | undefined, protocol: string, protocolMeta?: Record); } /** * Aggregates all holdings for a GLAM vault. * Includes token balances and supported DeFi positions. * * @param vaultState - The vault's state account address (stores vault configuration) * @param vaultPda - The vault's PDA that holds tokens and positions * @param priceBaseAssetMint - The base asset mint used for pricing (e.g., PublicKey.default for USD, So11111111111111111111111111111111111111112 for SOL) * @param slot - The Solana slot at which holdings were fetched * @param timestamp - Unix timestamp (seconds) when holdings were fetched * @param commitment - The Solana commitment level used for fetching account data */ export declare class VaultHoldings { readonly vaultState: PublicKey; readonly vaultPda: PublicKey; readonly priceBaseAssetMint: PublicKey; readonly slot: number; readonly timestamp: number; readonly commitment: Commitment; holdings: Holding[]; constructor(vaultState: PublicKey, vaultPda: PublicKey, priceBaseAssetMint: PublicKey, slot: number, timestamp: number, commitment: Commitment); add(holding: Holding): void; toJson(): string; } type PricingChunk = { ixs: TransactionInstruction[]; kaminoReserves: PublicKey[]; }; export declare class PriceClient { readonly base: BaseClient; readonly klend: KaminoLendingClient; readonly kvaults: KaminoVaultsClient; readonly bridge: BridgeClient; readonly epi: EpiClient; readonly loopscaleBorrow: LoopscaleBorrowClient; readonly loopscaleLend: LoopscaleLendClient; readonly loopscaleVault: LoopscaleVaultClient; private readonly getJupiterApi; private _stateModel; private _lookupTables; private _kaminoVaults; private _priceVaultIxsQueue; constructor(base: BaseClient, klend: KaminoLendingClient, kvaults: KaminoVaultsClient, bridge: BridgeClient, epi: EpiClient, loopscaleBorrow: LoopscaleBorrowClient, loopscaleLend: LoopscaleLendClient, loopscaleVault: LoopscaleVaultClient, getJupiterApi: () => JupiterApiClient); get jupiterApi(): JupiterApiClient; get cachedStateModel(): StateModel | null; set cachedStateModel(stateModel: StateModel); get lookupTables(): AddressLookupTableAccount[]; get kaminoVaults(): PublicKey[]; private getKaminoObligationReserveSets; /** * Fetches all holdings in the vault. * * The source of truth for external positions is the `externalPositions` array * from the state account, which tracks: * - Kamino obligation accounts (lending positions) * - Kamino vault share ATAs (shares in kamino vaults) * * @param commitment Commitment level for fetching accounts * @param priceBaseAssetMint Price reference/numeraire asset mint (default: PublicKey.default for USD). * Pass a token mint (e.g., WSOL) to get prices denominated in that asset. * @returns VaultHoldings object containing all holdings */ getVaultHoldings(commitment: Commitment, priceBaseAssetMint?: PublicKey): Promise; getPubkeysForTokenHoldings(externalPositionsSet: PkSet, commitment?: Commitment): Promise; /** * Gets kamino obligation reserves from known obligation pubkeys. */ getPubkeysForKaminoHoldings(obligationPubkeys: PublicKey[], commitment?: Commitment): Promise>; /** * Gets kamino vault states from known share ATA pubkeys. * Used by getVaultHoldingsV2 to process vault shares from externalPositions. */ getKaminoVaultStatesFromAtas(shareAtaPubkeys: PublicKey[], commitment?: Commitment): Promise>; /** * Fetches token price from the prefetched map, falling back to Jupiter API if not found. * @throws Error if price cannot be fetched from either source */ private getTokenPrice; private getHoldingTokenPrice; private getTokenMintDecimals; getTokenHoldings(tokenAccountPubkeys: PublicKey[], accountsDataMap: PkMap, tokenPricesMap: PkMap, tokenMintDecimalsMap: PkMap, priceSource: string): Promise; getKaminoLendHoldings(obligationPubkeys: Iterable, reservesMap: PkMap, accountsDataMap: PkMap, tokenPricesMap: PkMap, priceSource: string): Promise; getKaminoVaultsHoldings(kvaultAtasAndStates: PkMap, reservesMap: PkMap, accountsDataMap: PkMap, tokenPricesMap: PkMap, priceSource: string): Promise; /** * Returns an instruction that prices Kamino obligations. * If there are no Kamino obligations, returns null. */ priceKaminoObligationsIxs(): Promise; priceKaminoVaultSharesIx(): Promise; /** * Returns an instruction that prices vault balance and tokens */ priceVaultTokensIx(): Promise; /** * Returns an instruction that prices stake accounts. * If there are no stake accounts, returns null. */ priceStakeAccountsIx(): Promise; private findPhoenixTraderAccounts; private getPhoenixPerpAssetMap; /** * Returns the program instruction that prices Phoenix trader external positions. * If there are no registered Phoenix trader accounts, returns null. */ pricePhoenixTradersIx(stateModel?: StateModel | null): Promise; /** * Returns Phoenix trader pricing instructions with required compute budget pre-instructions. * If there are no registered Phoenix trader accounts, returns null. */ pricePhoenixTradersIxs(stateModel?: StateModel | null): Promise; /** * Returns the program instruction that prices Loopscale loan external positions. * If there are no registered Loopscale loans, returns null. * * Remaining accounts are laid out as N loan accounts followed by the oracle * accounts needed to price the loans' collateral and debt. */ priceLoopscaleLoansIx(): Promise; /** * Returns the program instruction that prices Loopscale strategy external positions. * If there are no registered Loopscale strategies, returns null. * * Remaining accounts are laid out as N strategy accounts followed by the * oracle accounts needed to price the strategies' principal mints. */ priceLoopscaleStrategiesIx(): Promise; /** * Returns the program instruction that prices registered Loopscale vault LP * token accounts and registered staked LP positions. * If there are no registered Loopscale vault LP positions, returns null. * * Remaining accounts are laid out as N (vault, vault strategy, GLAM vault LP * ATA) groups for vaults with tracked LP or stake positions, followed by * VaultStake accounts, followed by oracle accounts. */ priceLoopscaleVaultPositionsIx(): Promise; priceOrcaWhirlpoolPositionsIxs(stateModel?: StateModel | null): Promise; priceVaultIxs(): Promise; private enqueuePriceVaultIxs; private priceManagedTransfersIxs; private priceEpiValidatedPositionsIx; private _priceVaultIxsImpl; validateAumIx(): Promise; getBaseAssetOracle(): Promise; remainingAccountsForPricingVaultAssets(): Promise<[ AccountMeta[], PublicKey[] ]>; } export {};