Creates a new VoltrClient instance
Solana connection instance
Optional
wallet: KeypairOptional keypair for signing transactions
Calculates the amount of assets that would be received for a given LP token amount
Public key of the vault
Amount of LP tokens to calculate for
Promise resolving to the amount of assets that would be received
Calculates the amount of LP tokens that would be received for a given asset deposit
Amount of assets to deposit
Public key of the vault
Promise resolving to the amount of LP tokens that would be received
Creates an instruction to add an adaptor to a vault
Parameters for adding adaptor to vault
Public key of the payer
Public key of the vault
Transaction instruction for adding adaptor to vault
Creates a deposit instruction
Amount of tokens to deposit
Deposit parameters
Public key of the asset token program
Public key of the user's transfer authority
Public key of the vault
Public key of the vault asset mint
Transaction instruction for depositing tokens
Creates an instruction to deposit assets into a strategy
Deposit arguments
Strategy deposit parameters
Public key of the asset token program
Remaining accounts for the instruction
Public key of the strategy
Public key of the vault
Public key of the vault asset mint
Transaction instruction for depositing assets into strategy
const ix = await client.createDepositStrategyIx(
{
depositAmount: new BN('1000000000'),
instructionDiscriminator: Buffer.from('...'),
additionalArgs: Buffer.from('...')
},
{
vault: vaultPubkey,
vaultAssetMint: mintPubkey,
strategy: strategyPubkey,
assetTokenProgram: tokenProgramPubkey,
remainingAccounts: []
}
);
Creates an instruction to initialize a strategy to a vault
Arguments for strategy initialization
Optional
params: { manager: PublicKey; payer: PublicKey; strategy: PublicKey; vault: PublicKey }Parameters for initializing strategy to vault
Public key of the manager
Public key of the payer
Public key of the strategy
Public key of the vault
Transaction instruction for initializing strategy to vault
Creates an instruction to initialize a new vault
Configuration parameters for the vault
Additional parameters for initializing the vault
Public key of the vault admin
Public key of the vault manager
Public key of the fee payer
Keypair for the new vault
Public key of the vault's asset mint
Transaction instruction for initializing the vault
const ix = await client.createInitializeVaultIx(
{
config: {
maxCap: new BN('1000000000'),
startAtTs: new BN(Math.floor(Date.now() / 1000)),
managerManagementFee: 50, // 0.5%
managerPerformanceFee: 1000, // 10%
adminManagementFee: 50, // 0.5%
adminPerformanceFee: 1000, // 10%
},
name: "My Vault",
description: "Example vault"
},
{
vault: vaultKeypair,
vaultAssetMint: new PublicKey('...'),
admin: adminPubkey,
manager: managerPubkey,
payer: payerPubkey
}
);
Creates an instruction to remove a strategy from a vault
Parameters for removing strategy
Public key of the vault
Transaction instruction for removing strategy from vault
Creates a withdraw instruction
Amount of LP tokens to withdraw
Withdraw parameters
Public key of the asset token program
Public key of the user authority
Public key of the vault
Public key of the vault asset mint
Transaction instruction for withdrawal
Creates an instruction to withdraw assets from a strategy
Withdrawal arguments
Strategy withdrawal parameters
Public key of the asset token program
Remaining accounts for the instruction
Public key of the strategy
Public key of the vault
Public key of the vault asset mint
Transaction instruction for withdrawing assets from strategy
const ix = await client.createWithdrawStrategyIx(
{
withdrawAmount: new BN('1000000000'),
instructionDiscriminator: Buffer.from('...'),
additionalArgs: Buffer.from('...')
},
{
vault: vaultPubkey,
vaultAssetMint: mintPubkey,
strategy: strategyPubkey,
assetTokenProgram: tokenProgramPubkey,
remainingAccounts: []
}
);
Fetches an adaptor add receipt account's data
Public key of the adaptor add receipt account
Promise resolving to the adaptor add receipt account data
Fetches all adaptor add receipt accounts of a vault
Public key of the vault
Promise resolving to an array of adaptor add receipt accounts
Fetches all strategy accounts
Promise resolving to an array of strategy accounts
Fetches all strategy init receipt accounts
Promise resolving to an array of strategy init receipt accounts
Fetches all strategy init receipt accounts of a vault
Public key of the vault
Promise resolving to an array of strategy init receipt accounts
Fetches a strategy account's data
Public key of the strategy
Promise resolving to the strategy account data
Fetches a strategy init receipt account's data
Public key of the strategy init receipt account
Promise resolving to the strategy init receipt account data
Fetches a vault account's data
Public key of the vault
Promise resolving to the vault account data
Finds all vault-related addresses
Public key of the vault
Object containing all vault-related PDAs
Main client for interacting with the Voltr protocol
Remarks
The VoltrClient provides methods for initializing and managing vaults, handling strategies, and performing deposits/withdrawals. It requires a Solana connection and optionally accepts a wallet for signing transactions.
Example