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
Public key of the vault
Amount of assets to deposit
Promise resolving to the amount of LP tokens that would be received
Calculates the amount of LP tokens that would be burned for a given asset amount
Public key of the vault
Amount of assets to calculate for
Promise resolving to the amount of LP tokens that would be burned
Creates an instruction to add an adaptor to a vault
Parameters for adding adaptor to vault
Optional
adaptorProgram?: PublicKeyPublic key of the adaptor program
Public key of the admin
Public key of the payer
Public key of the vault
Transaction instruction for adding adaptor to vault
Creates a cancel withdraw instruction for a vault
Cancel withdraw request parameters
Public key of the user authority
Public key of the vault
Transaction instruction for withdrawal
Creates an instruction to deposit assets into a strategy
Deposit arguments
Strategy deposit parameters
Optional
adaptorProgram?: PublicKeyPublic key of the adaptor program
Public key of the asset token program
Public key of the manager
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('...')
},
{
manager: managerPubkey,
vault: vaultPubkey,
vaultAssetMint: mintPubkey,
strategy: strategyPubkey,
assetTokenProgram: tokenProgramPubkey,
adaptorProgram: adaptorProgramPubkey,
remainingAccounts: []
}
);
Creates a deposit instruction for a vault
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 withdraw assets from a direct withdraw strategy
Withdrawal arguments
Optional
userArgs?: null | Buffer<ArrayBufferLike>Optional user arguments for the instruction
Parameters for withdrawing assets from direct withdraw strategy
Optional
adaptorProgram?: PublicKeyPublic key of the adaptor program
Public key of the asset token program
Remaining accounts for the instruction
Public key of the strategy
Public key of the user
Public key of the vault
Public key of the vault asset mint
Transaction instruction for withdrawing assets from direct withdraw strategy
Creates an instruction to initialize a direct withdraw strategy
Arguments for initializing direct withdraw strategy
Parameters for initializing direct withdraw strategy
Optional
adaptorProgram?: PublicKeyPublic key of the adaptor program
Public key of the admin
Public key of the payer
Public key of the strategy
Public key of the vault
Transaction instruction for initializing direct withdraw strategy
const ix = await client.createInitializeDirectWithdrawStrategyIx(
{
instructionDiscriminator: Buffer.from('...'),
additionalArgs: Buffer.from('...'),
allowUserArgs: true
},
{
payer: payerPubkey,
admin: adminPubkey,
vault: vaultPubkey,
strategy: strategyPubkey,
adaptorProgram: adaptorProgramPubkey
}
);
Creates an instruction to initialize a strategy to a vault
Arguments for strategy initialization
Optional
params: {Parameters for initializing strategy to vault
Optional
adaptorProgram?: PublicKeyPublic key of the adaptor program
Public key of the manager
Public key of the payer
Remaining accounts for the instruction
Public key of the strategy
Public key of the vault
Transaction instruction for initializing strategy to vault
const ix = await client.createInitializeStrategyIx(
{
instructionDiscriminator: Buffer.from('...'), // optional
additionalArgs: Buffer.from('...') // optional
},
{
payer: payerPubkey,
vault: vaultPubkey,
manager: managerPubkey,
strategy: strategyPubkey,
adaptorProgram: adaptorProgramPubkey,
remainingAccounts: []
}
);
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)),
lockedProfitDegradationDuration: new BN(3600), // 1 hour
redemptionFee: 10,
issuanceFee: 10,
withdrawalWaitingPeriod: new BN(3600), // 1 hour
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
Optional
adaptorProgram?: PublicKeyPublic key of the adaptor program
Public key of the admin
Public key of the vault
Transaction instruction for removing adaptor from vault
Creates a request withdraw instruction for a vault
Arguments for withdrawing from the vault
Request withdraw parameters
Public key of the payer
Public key of the user authority
Public key of the vault
Transaction instruction for withdrawal
Creates an instruction to update a vault
Configuration parameters for the vault
Parameters for updating the vault
Public key of the vault admin
Public key of the vault
Transaction instruction for updating the vault
Creates an instruction to withdraw assets from a strategy
Withdrawal arguments
Strategy withdrawal parameters
Optional
adaptorProgram?: PublicKeyPublic key of the adaptor program
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,
adaptorProgram: adaptorProgramPubkey,
remainingAccounts: []
}
);
Creates a withdraw instruction for a vault
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
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 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 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
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