Documentation Index
Fetch the complete documentation index at: https://docs.glam.systems/llms.txt
Use this file to discover all available pages before exploring further.
The vault sub-client provides methods for managing vault assets, including depositing tokens, transferring assets, wrapping/unwrapping SOL, and managing token accounts.
Depositing Assets
Deposit Tokens
Deposit tokens from the signer’s wallet into the vault:
import { GlamClient, WSOL } from "@glamsystems/glam-sdk";
const glamClient = new GlamClient();
// Deposit 100 USDC (6 decimals) into the vault
const txSig = await glamClient.vault.deposit(
new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), // USDC mint
100_000_000, // 100 USDC in base units
);
Deposit SOL
Deposit SOL directly into the vault. Optionally wrap it to wSOL:
// Deposit 1 SOL and wrap it to wSOL
const txSig = await glamClient.vault.depositSol(
1_000_000_000, // 1 SOL in lamports
true, // wrap to wSOL
);
// Deposit 1 SOL without wrapping
const txSig = await glamClient.vault.depositSol(
1_000_000_000,
false,
);
SOL Wrapping
Wrap SOL
Wrap vault SOL into wSOL:
import { BN } from "@coral-xyz/anchor";
// Wrap 5 SOL to wSOL
const txSig = await glamClient.vault.wrap(new BN(5_000_000_000));
Unwrap wSOL
Unwrap all vault wSOL back to SOL:
const txSig = await glamClient.vault.unwrap();
Transfers
Transfer SOL
Transfer SOL from the vault to another account:
const txSig = await glamClient.vault.systemTransfer(
1_000_000_000, // 1 SOL
new PublicKey("Recipient111111111111111111111111"),
);
Transfer Tokens
Transfer tokens from the vault to another account:
const txSig = await glamClient.vault.tokenTransfer(
new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), // USDC mint
50_000_000, // 50 USDC
new PublicKey("Recipient111111111111111111111111"),
);
Token Account Management
Close Token Accounts
Close vault token accounts to reclaim rent. Pass an array of token account public keys:
const txSig = await glamClient.vault.closeTokenAccounts([
new PublicKey("TokenAcc111111111111111111111111"),
new PublicKey("TokenAcc211111111111111111111111"),
]);