Skip to main content
The GlamClient 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, which provides:
  • Connection Management: Handles Solana RPC connections
  • Transaction Processing: Sign, send, and confirm transactions
  • Program Integration: Interfaces with GLAM Protocol programs

Initialization

Initialize GlamClient with the default Anchor provider and wallet:
The client can be customized by providing a GlamClientConfig object:
For example, if Jupiter functionality is used, the Jupiter API key should be configured as follows:
Refer to Custom Wallet for more information on how to use a custom wallet.

Sub-clients

Sub-clients are lazily loaded on first access. For a comprehensive list, see client.ts.

Transaction Builder

Each sub-client provides a TxBuilder 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 optional TxOptions parameter:
The TxOptions type provides additional configuration for transactions:
Available options:
  • signer: Override the default signer
  • computeUnitLimit: Set the compute unit limit
  • getPriorityFeeMicroLamports: Callback function to calculate dynamic priority fees
  • maxFeeLamports: Set the maximum priority fee
  • useMaxFee: Use the maximum priority fee
  • preInstructions: Add instructions before the main instruction
  • lookupTables: Include address lookup tables
  • simulate: Simulate the transaction before sending

State Model

The SDK abstracts on-chain vault state using the StateModel class, which defines the vault’s configuration at creation time.
state-model.ts

Fetching Vault State

Fetch the state of the active vault:
Or fetch the state of a specific vault by passing its state account public key:

Mint Model

The SDK represents on-chain mint data using the MintModel class, which defines the tokenized vault’s configuration at creation time.
mint-model.ts

Accessing Mint Model

Access the MintModel of a tokenized vault via its stateModel:

Use Staging Programs

GLAM mainnet staging programs are available for testing and development purposes. They contain unaudited code and features that are not yet ready for production.
To use staging programs, make sure env variable NEXT_PUBLIC_GLAM_STAGING or GLAM_STAGING, is set to true.