GlamClient
TheGlamClient class is the main entry point for the GLAM SDK. It uses lazy initialization to load sub-clients only when needed, optimizing performance and resource usage.
GlamClient extends BaseClient and provides:
- Connection Management: Handles Solana RPC connections
- Transaction Processing: Sign, send, and confirm transactions
- Program Integration: Interfaces with GLAM Protocol programs
- Sub-client Access: Lazy-loaded specialized clients
Initialization
InitializeGlamClient with the default Anchor provider and wallet:
GlamClientConfig object:
Sub-clients
Sub-clients are lazily loaded on first access. For a comprehensive list, see client.ts.| Sub-client | Category | Description |
|---|---|---|
drift | Protocol Integration | Drift protocol integration |
driftVaults | Protocol Integration | Drift vaults integration |
jupiterSwap | Protocol Integration | Jupiter swap integration |
kaminoLending | Protocol Integration | Kamino lending integration |
kaminoFarm | Protocol Integration | Kamino farming integration |
kaminoVaults | Protocol Integration | Kamino vaults integration |
cctp | Protocol Integration | Cross-Chain Transfer Protocol |
vault | Core Operations | Vault management |
access | Core Operations | ACL management |
timelock | Core Operations | Time lock management |
invest | Core Operations | Investment flows (for tokenized vaults) |
fees | Core Operations | Fee management (for tokenized vaults) |
price | Core Operations | Pricing tokens and positions (for tokenized vaults) |
state | Utilities | Vault state queries |
Transaction Builder
Each sub-client provides aTxBuilder instance for constructing instructions and transactions.
Building Instructions
To build an instruction that enables Jupiter Swap on a vault:Building Transactions
To build a complete transaction:Sending Transactions
Convert a legacy transaction to a versioned transaction and send it:Transaction Options
Most client methods accept an optionalTxOptions parameter:
TxOptions type provides additional configuration for transactions:
signer: Override the default signercomputeUnitLimit: Set the compute unit limitgetPriorityFeeMicroLamports: Callback function to calculate dynamic priority feesmaxFeeLamports: Set the maximum priority feeuseMaxFee: Use the maximum priority feepreInstructions: Add instructions before the main instructionlookupTables: Include address lookup tablessimulate: Simulate the transaction before sending
State Model
The SDK abstracts on-chain vault state using theStateModel class, which defines the vault’s configuration at creation time.
state-model.ts
Fetching Vault State
Fetch the state of the active vault:Mint Model
The SDK represents on-chain mint data using theMintModel class, which defines the tokenized vault’s configuration at creation time.
mint-model.ts
Accessing Mint Model
Access theMintModel of a tokenized vault via its stateModel: