The price sub-client handles vault asset pricing, which is required before fulfilling subscription/redemption requests or crystallizing fees.
For an overview of pricing concepts, see Pricing.
Do not read FeeParams from the GLAM State Account to display current AUM or NAV. Those fields are fee-accounting checkpoints. Use pricing instructions, AUM validation, or vault holdings for current valuation data.
Pricing Instructions
Generate all necessary pricing instructions for a vault. The method automatically detects which integrations are enabled and builds the appropriate set of instructions:
import { GlamClient } from "@glamsystems/glam-sdk";
const glamClient = new GlamClient();
// Get all pricing instructions for the vault
const pricingIxs = await glamClient.price.priceVaultIxs();
The returned instructions cover:
- Vault tokens — Prices all token balances in the vault
- Kamino obligations — Prices Kamino Lending collateral and debt positions
- Kamino vault shares — Prices Kamino Vault share holdings
- Stake accounts — Prices native stake account balances
SingleAssetVault
For SingleAssetVault types, pricing is simplified since the vault holds only one asset:
// priceVaultIxs() automatically detects the vault type
// and returns a single priceSingleAssetVault instruction
const pricingIxs = await glamClient.price.priceVaultIxs();
For SingleAssetVault vaults, current priced AUM is based on the current balance of the vault’s base-asset token account. FeeParams.last_aum may differ after subscriptions because it records the AUM checkpoint used during the last fee crystallization.
Validate AUM
After pricing, validate the computed AUM:
const validateIx = await glamClient.price.validateAumIx();
Vault Holdings
Fetch all vault holdings with current prices for display or analysis:
const holdings = await glamClient.price.getVaultHoldings("confirmed");
// Access individual holdings
for (const holding of holdings) {
console.log(holding.mintAddress, holding.uiAmount, holding.price);
}
Pricing Workflow
A typical pricing workflow before fulfilling requests:
// 1. Build pricing instructions
const pricingIxs = await glamClient.price.priceVaultIxs();
// 2. Build validate AUM instruction
const validateIx = await glamClient.price.validateAumIx();
// 3. Send pricing + validation as a transaction
const tx = new Transaction().add(...pricingIxs, validateIx);
const vTx = await glamClient.intoVersionedTransaction(tx);
await glamClient.sendAndConfirm(vTx);
// 4. Now fulfill pending requests
await glamClient.invest.fulfill(null);
Pricing transactions can be large when a vault has many assets or DeFi positions. Use address lookup tables to reduce transaction size.