SDK Reference

Complete reference for the Voltr Vault SDK (@voltr/vault-sdk).

Installation

npm install @voltr/vault-sdk
# or
yarn add @voltr/vault-sdk

Client Initialization

import { VoltrClient } from "@voltr/vault-sdk";
import { Connection, Keypair } from "@solana/web3.js";

const connection = new Connection("https://api.mainnet-beta.solana.com");

// Basic initialization (for read-only operations)
const client = new VoltrClient(connection);

// With wallet (for signing transactions)
const wallet = Keypair.fromSecretKey(/* your secret key */);
const client = new VoltrClient(connection, wallet);

Constants


Types

VaultConfig

Configuration for initializing or updating a vault:

VaultParams

Parameters for vault initialization:

RequestWithdrawVaultArgs

Arguments for requesting a withdrawal:

VaultConfigField

Enum for updating individual vault configuration fields:


PDA Finding Methods

findVaultLpMint

Finds the vault's LP mint address.

findVaultAssetIdleAuth

Finds the vault's asset idle authority address.

findVaultAddresses

Finds all vault-related addresses.

findVaultStrategyAuth

Finds the vault strategy authority address.

findStrategyInitReceipt

Finds the strategy init receipt address.

findDirectWithdrawInitReceipt

Finds the direct withdraw init receipt address.

findVaultStrategyAddresses

Finds all vault-strategy related addresses.

findRequestWithdrawVaultReceipt

Finds the request withdraw vault receipt address for a user.

findLpMetadataAccount

Finds the LP metadata account address.


Vault Instructions

createInitializeVaultIx

Creates an instruction to initialize a new vault.

createUpdateVaultConfigIx

Creates an instruction to update a specific vault configuration field.

createDepositVaultIx

Creates an instruction to deposit assets into a vault.

createRequestWithdrawVaultIx

Creates an instruction to request a withdrawal from a vault (Phase 1).

createCancelRequestWithdrawVaultIx

Creates an instruction to cancel a pending withdrawal request.

createWithdrawVaultIx

Creates an instruction to complete a withdrawal (Phase 2, after waiting period).


Strategy Instructions

createAddAdaptorIx

Creates an instruction to add an adaptor to a vault.

createRemoveAdaptorIx

Creates an instruction to remove an adaptor from a vault.

createInitializeStrategyIx

Creates an instruction to initialize a strategy for a vault.

createDepositStrategyIx

Creates an instruction to deposit assets into a strategy.

createWithdrawStrategyIx

Creates an instruction to withdraw assets from a strategy.

createInitializeDirectWithdrawStrategyIx

Creates an instruction to initialize direct withdrawal for a strategy.

createDirectWithdrawStrategyIx

Creates an instruction for users to directly withdraw from a strategy.

createCloseStrategyIx

Creates an instruction to close a strategy.


Fee Management

createHarvestFeeIx

Creates an instruction to harvest accumulated fees.

createCalibrateHighWaterMarkIx

Creates an instruction to calibrate the high water mark.

createCreateLpMetadataIx

Creates an instruction to create LP token metadata.


Query Methods

Account Fetching

Bulk Fetching

Helper Methods


Calculation Helpers

calculateAssetsForWithdraw

Calculates the amount of assets that would be received for a given LP token amount.

calculateLpForWithdraw

Calculates the amount of LP tokens that would be burned for a given asset amount.

calculateLpForDeposit

Calculates the amount of LP tokens that would be received for a given asset deposit.


Deprecated Methods

createUpdateVaultIx (Deprecated)

Use createUpdateVaultConfigIx instead for more granular configuration updates.

Last updated