This guide provides instructions on how to get started with the Dynamic Vault TypeScript SDK.

Before you begin, here are some important resources:

  • Program ID (Mainnet & Devnet): 24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi
  • TypeScript SDK Repository: @meteora-ag/vault-sdk

Installation

To use the SDK in your project, install it using your preferred package manager:

npm install @meteora-ag/vault-sdk @solana/web3.js
# or
pnpm install @meteora-ag/vault-sdk @solana/web3.js
# or
yarn add @meteora-ag/vault-sdk @solana/web3.js

Initialization

Once installed, you can initialize the SDK in your TypeScript/JavaScript project like this:

import { Connection } from "@solana/web3.js";
import VaultImpl from '@meteora-ag/vault-sdk';
import { StaticTokenListResolutionStrategy, TokenInfo } from "@solana/spl-token-registry";

// Initialize a connection to the Solana network (e.g., Mainnet)
const connection = new Connection("https://api.mainnet-beta.solana.com");

// Retrieve the token info for the vault (example: SOL)
const tokenMap = new StaticTokenListResolutionStrategy().resolve();
const SOL_TOKEN_INFO = tokenMap.find(token => token.symbol === 'SOL') as TokenInfo;

// Getting a Vault Implementation instance (SOL)
const vault: VaultImpl = await VaultImpl.create(
    connection,
    SOL_TOKEN_INFO,
    {
        cluster: 'mainnet-beta'
    }
);

Testing the SDK (for contributors)

If you have cloned the SDK repository and want to run the built-in tests:

# Install dependencies
cd ts-client
bun install

# Run tests
bun test

Development Resources

Faucets