Skip to main content
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.

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
  • Drift positions — Prices Drift Protocol user accounts (spot and perp positions)
  • Drift vault depositors — Prices Drift Vault depositor positions
  • 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();

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.