Skip to main content

Overview

GlamClient is the main entrypoint for the GLAM SDK. It extends BaseClient and provides access to all specialized client modules through lazy-loaded getters.

Constructor

new GlamClient(config?: GlamClientConfig)
config
GlamClientConfig
Configuration options for the client

Example

import { GlamClient } from "@glam/sdk";
import { Connection, Keypair } from "@solana/web3.js";
import { AnchorProvider, Wallet } from "@coral-xyz/anchor";

const connection = new Connection("https://api.mainnet-beta.solana.com");
const wallet = new Wallet(Keypair.generate());
const provider = new AnchorProvider(connection, wallet, {});

const client = new GlamClient({ provider });

Core client modules

These properties provide access to core GLAM functionality. All modules are lazy-loaded on first access.

vault

client.vault: VaultClient
Access vault operations like deposits, withdrawals, and token transfers.
// Deposit SOL to vault
await client.vault.depositSol(1000000); // 0.001 SOL

// Transfer tokens from vault
await client.vault.tokenTransfer(usdcMint, 1000000, recipient);

state

client.state: StateClient
Manage vault state including initialization and updates.
// Initialize a new vault
await client.state.initialize({
  accountType: StateAccountType.TOKENIZED_VAULT,
  name: stringToChars("My Fund"),
  baseAssetMint: NATIVE_MINT,
});

// Update vault configuration
await client.state.update({
  reduceOnly: true,
  timelockDuration: 86400, // 1 day
});

invest

client.invest: InvestClient
Handle investor subscriptions and redemptions.
// Subscribe to the fund
await client.invest.subscribe(new BN(1000000));

// Queue a redemption
await client.invest.queuedRedeem(new BN(500000));

// Claim pending request
await client.invest.claim();

price

client.price: PriceClient
Fetch pricing data for assets and calculate NAV.

fees

client.fees: FeesClient
Manage and collect management and performance fees.

mint

client.mint: MintClient
Manage vault share token minting and metadata.

access

client.access: AccessClient
Control access permissions and ACLs.

timelock

client.timelock: TimelockClient
Manage time-delayed state updates.

Protocol integration modules

These properties provide access to DeFi protocol integrations.

jupiterSwap

client.jupiterSwap: JupiterSwapClient
Execute token swaps via Jupiter.
await client.jupiterSwap.swap({
  inputMint: WSOL,
  outputMint: USDC,
  amount: new BN(1000000),
});

drift

client.drift: DriftProtocolClient
Interact with Drift Protocol for perpetuals trading.

driftVaults

client.driftVaults: DriftVaultsClient
Manage Drift vault positions.

kaminoLending

client.kaminoLending: KaminoLendingClient
Deposit and borrow assets via Kamino lending markets.

kaminoFarm

client.kaminoFarm: KaminoFarmClient
Stake LP tokens in Kamino farms.

kaminoVaults

client.kaminoVaults: KaminoVaultsClient
Manage Kamino vault positions.

marinade

client.marinade: MarinadeClient
Stake SOL via Marinade Finance.

stake

client.stake: StakeClient
Manage native Solana staking.

stakePool

client.stakePool: StakePoolClient
Interact with SPL stake pools.

cctp

client.cctp: CctpClient
Cross-chain USDC transfers via Circle’s CCTP.
All client modules are lazy-loaded, meaning they are only instantiated when first accessed. This improves initialization performance.

Inherited properties

GlamClient extends BaseClient and inherits all its properties and methods. See BaseClient for the full API.

Key inherited properties

client.provider: anchor.Provider
client.connection: Connection
client.signer: PublicKey
client.wallet: Wallet
client.cluster: ClusterNetwork
client.statePda: PublicKey
client.vaultPda: PublicKey
client.mintPda: PublicKey

Build docs developers (and LLMs) love