Voltr SDK
    Preparing search index...

    Class VoltrClient

    Main client for interacting with the Voltr protocol

    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.

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

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

    Hierarchy

    • AccountUtils
      • VoltrClient
    Index

    Constructors

    Properties

    Methods

    calculateAssetsForWithdraw calculateAssetsForWithdrawHelper calculateLockedProfit calculateLpForDeposit calculateLpForWithdraw createAcceptProtocolAdminIx createAcceptVaultAdminIx createAddAdaptorIx createCalibrateHighWaterMarkIx createCalibrateHighWaterMarkUnsafeIx createCancelRequestWithdrawVaultIx createCloseStrategyIx createCreateLpMetadataIx createDepositStrategyIx createDepositVaultIx createDirectWithdrawStrategyIx createDirectWithdrawStrategyWithToleranceIx createHarvestFeeIx createInitializeDirectWithdrawStrategyIx createInitializeStrategyIx createInitializeVaultIx createInitProtocolIx createInstantWithdrawStrategyIx createInstantWithdrawStrategyWithToleranceIx createInstantWithdrawVaultIx createRemoveAdaptorIx createRequestWithdrawVaultIx createUpdateProtocolIx createUpdateVaultConfigIx createUpdateVaultProtocolFeeIx createWithdrawStrategyIx createWithdrawVaultIx fetchAdaptorAddReceiptAccount fetchAllAdaptorAddReceiptAccountsOfVault fetchAllRequestWithdrawVaultReceiptsOfVault fetchAllStrategyInitReceiptAccounts fetchAllStrategyInitReceiptAccountsOfVault fetchProtocolAccount fetchRequestWithdrawVaultReceiptAccount fetchStrategyInitReceiptAccount fetchVaultAccount findDirectWithdrawInitReceipt findLpMetadataAccount findProtocol findRequestWithdrawVaultReceipt findStrategyInitReceipt findVaultAddresses findVaultAssetIdleAuth findVaultLpMint findVaultStrategyAddresses findVaultStrategyAuth getAccumulatedAdminFeesForVault getAccumulatedManagerFeesForVault getAccumulatedProtocolFeesForVault getAllPendingWithdrawalsForVault getBalance getCurrentAssetPerLpForVault getHighWaterMarkForVault getPendingWithdrawalForUser getPositionAndTotalValuesForVault getVaultLpSupplyBreakdown

    Constructors

    • Creates a new VoltrClient instance

      Parameters

      • conn: Connection

        Solana connection instance

      • Optionalwallet: Keypair

        Optional keypair for signing transactions

      • Optionalopts: ConfirmOptions

      Returns VoltrClient

    Properties

    conn: Connection
    provider: AnchorProvider
    vaultIdl: Idl
    vaultProgram: Program<VoltrVault>

    Methods

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

      Parameters

      • vaultPk: PublicKey

        Public key of the vault

      • lpAmount: BN

        Amount of LP tokens to calculate for

      Returns Promise<BN>

      Promise resolving to the amount of assets that would be received

      If LP supply or total assets are invalid

      If math overflow occurs during calculation

      const assetsToReceive = await client.calculateAssetsForWithdraw(
      vaultPubkey,
      new BN('1000000000')
      );
    • Parameters

      • vaultTotalValue: BN
      • vaultLastUpdatedLockedProfit: BN
      • vaultLockedProfitDegradationDuration: BN
      • vaultAccumulatedLpAdminFees: BN
      • vaultAccumulatedLpManagerFees: BN
      • vaultAccumulatedLpProtocolFees: BN
      • vaultRedemptionFeeBps: number
      • vaultManagementFeeBps: number
      • vaultLastManagementFeeUpdateTs: BN
      • lpSupply: BN
      • lpAmount: BN
      • deadWeight: BN = ...

      Returns BN

    • Parameters

      • lastUpdatedLockedProfit: BN
      • lockedProfitDegradationDuration: BN
      • currentTime: BN

      Returns BN

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

      Parameters

      • vaultPk: PublicKey

        Public key of the vault

      • assetAmount: BN

        Amount of assets to deposit

      Returns Promise<BN>

      Promise resolving to the amount of LP tokens that would be received

      If math overflow occurs during calculation

      const lpTokens = await client.calculateLpTokensForDeposit(
      vaultPubkey
      new BN('1000000000'),
      );
    • Calculates the amount of LP tokens that would be burned for a given asset amount

      Parameters

      • vaultPk: PublicKey

        Public key of the vault

      • assetAmount: BN

        Amount of assets to calculate for

      Returns Promise<BN>

      Promise resolving to the amount of LP tokens that would be burned

      If LP supply or total assets are invalid

      If math overflow occurs during calculation

      const lpTokensToBurn = await client.calculateLpForWithdraw(
      vaultPubkey,
      new BN('1000000000')
      );
    • Creates an instruction to accept a protocol admin transfer (2-step admin transfer)

      Parameters

      • params: { pendingAdmin: PublicKey }

        Parameters for accepting protocol admin

        • pendingAdmin: PublicKey

          Public key of the pending admin (must be signer)

      Returns Promise<TransactionInstruction>

      Transaction instruction for accepting protocol admin

      const ix = await client.createAcceptProtocolAdminIx({
      pendingAdmin: pendingAdminPubkey,
      });
    • Creates an instruction for the pending admin to accept the vault admin role

      Parameters

      • params: { pendingAdmin: PublicKey; vault: PublicKey }

        Parameters for accepting vault admin

        • pendingAdmin: PublicKey

          Public key of the pending admin (must be signer)

        • vault: PublicKey

          Public key of the vault

      Returns Promise<TransactionInstruction>

      Transaction instruction for accepting vault admin

      If instruction creation fails

      const ix = await client.createAcceptVaultAdminIx({
      pendingAdmin: pendingAdminPubkey,
      vault: vaultPubkey,
      });
    • Creates an instruction to add an adaptor to a vault

      Parameters

      • params: {
            adaptorProgram: PublicKey;
            admin: PublicKey;
            payer: PublicKey;
            vault: PublicKey;
        }

        Parameters for adding adaptor to vault

        • adaptorProgram: PublicKey

          Public key of the adaptor program

        • admin: PublicKey

          Public key of the admin

        • payer: PublicKey

          Public key of the payer

        • vault: PublicKey

          Public key of the vault

      Returns Promise<TransactionInstruction>

      Transaction instruction for adding adaptor to vault

      If the instruction creation fails

      const ix = await client.createAddAdaptorIx({
      vault: vaultPubkey,
      payer: payerPubkey,
      admin: adminPubkey,
      adaptorProgram: adaptorProgramPubkey
      });
    • Creates an instruction to calibrate the high water mark

      Parameters

      • params: { admin: PublicKey; vault: PublicKey }

        Parameters for calibrating the high water mark

        • admin: PublicKey

          Public key of the admin

        • vault: PublicKey

          Public key of the vault

      Returns Promise<TransactionInstruction>

      Transaction instruction for calibrating the high water mark

      If instruction creation fails

      const ix = await client.createCalibrateHighWaterMarkIx({
      vault: vaultPubkey,
      admin: adminPubkey,
      });
    • Creates an instruction to calibrate the high water mark without fee clawback (unsafe)

      Parameters

      • params: { admin: PublicKey; vault: PublicKey }

        Parameters for calibrating the high water mark

        • admin: PublicKey

          Public key of the admin

        • vault: PublicKey

          Public key of the vault (must be whitelisted)

      Returns Promise<TransactionInstruction>

      Transaction instruction for unsafe calibration

      If instruction creation fails or vault is not whitelisted

      const ix = await client.createCalibrateHighWaterMarkUnsafeIx({
      vault: vaultPubkey,
      admin: adminPubkey,
      });
    • Creates a cancel withdraw instruction for a vault

      Parameters

      • params: { userTransferAuthority: PublicKey; vault: PublicKey }

        Cancel withdraw request parameters

        • userTransferAuthority: PublicKey

          Public key of the user authority

        • vault: PublicKey

          Public key of the vault

      Returns Promise<TransactionInstruction>

      Transaction instruction for withdrawal

      If the instruction creation fails

      const ix = await client.createCancelRequestWithdrawVaultIx(
      {
      userTransferAuthority: userPubkey,
      vault: vaultPubkey,
      }
      );
    • Creates an instruction to close a strategy

      Parameters

      • params: { manager: PublicKey; payer: PublicKey; strategy: PublicKey; vault: PublicKey }

        Parameters for closing strategy

        • manager: PublicKey

          Public key of the manager

        • payer: PublicKey

          Public key of the payer

        • strategy: PublicKey

          Public key of the strategy

        • vault: PublicKey

          Public key of the vault

      Returns Promise<TransactionInstruction>

      Transaction instruction for closing strategy

      If instruction creation fails

      const ix = await client.createCloseStrategyIx({
      payer: payerPubkey,
      manager: managerPubkey,
      vault: vaultPubkey,
      strategy: strategyPubkey,
      });
    • Creates an instruction to create LP metadata

      Parameters

      • createLpMetadataArgs: { name: string; symbol: string; uri: string }

        Parameters for creating LP metadata

        • name: string

          Name of the LP

        • symbol: string

          Symbol of the LP

        • uri: string

          URI of the LP metadata

      • params: { admin: PublicKey; payer: PublicKey; vault: PublicKey }

        Parameters for creating LP metadata

        • admin: PublicKey

          Public key of the admin

        • payer: PublicKey

          Public key of the payer

        • vault: PublicKey

          Public key of the vault

      Returns Promise<TransactionInstruction>

      Transaction instruction for creating LP metadata

      If instruction creation fails

      const ix = await client.createCreateLpMetadataIx({
      name: "My LP",
      symbol: "MYLP",
      uri: "https://mylp.com/metadata",
      });
    • Creates an instruction to deposit assets into a strategy

      Parameters

      • depositArgs: DepositStrategyArgs

        Deposit arguments

        • OptionaladditionalArgs?: null | Buffer<ArrayBufferLike>
        • depositAmount: BN
        • OptionalinstructionDiscriminator?: null | Buffer<ArrayBufferLike>
      • params: {
            adaptorProgram: PublicKey;
            assetTokenProgram: PublicKey;
            manager: PublicKey;
            remainingAccounts: {
                isSigner: boolean;
                isWritable: boolean;
                pubkey: PublicKey;
            }[];
            strategy: PublicKey;
            vault: PublicKey;
            vaultAssetMint: PublicKey;
        }

        Strategy deposit parameters

        • adaptorProgram: PublicKey

          Public key of the adaptor program

        • assetTokenProgram: PublicKey

          Public key of the asset token program

        • manager: PublicKey

          Public key of the manager

        • remainingAccounts: { isSigner: boolean; isWritable: boolean; pubkey: PublicKey }[]

          Remaining accounts for the instruction

        • strategy: PublicKey

          Public key of the strategy

        • vault: PublicKey

          Public key of the vault

        • vaultAssetMint: PublicKey

          Public key of the vault asset mint

      Returns Promise<TransactionInstruction>

      Transaction instruction for depositing assets into strategy

      If the instruction creation fails

      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

      Parameters

      • amount: BN

        Amount of tokens to deposit

      • params: {
            assetTokenProgram: PublicKey;
            userTransferAuthority: PublicKey;
            vault: PublicKey;
            vaultAssetMint: PublicKey;
        }

        Deposit parameters

        • assetTokenProgram: PublicKey

          Public key of the asset token program

        • userTransferAuthority: PublicKey

          Public key of the user's transfer authority

        • vault: PublicKey

          Public key of the vault

        • vaultAssetMint: PublicKey

          Public key of the vault asset mint

      Returns Promise<TransactionInstruction>

      Transaction instruction for depositing tokens

      If instruction creation fails

      const ix = await client.createDepositVaultIx(
      new BN('1000000000'),
      {
      userTransferAuthority: userPubkey,
      vault: vaultPubkey,
      vaultAssetMint: mintPubkey,
      assetTokenProgram: tokenProgramPubkey
      }
      );
    • Creates an instruction to withdraw assets from a direct withdraw strategy

      Parameters

      • directWithdrawArgs: { userArgs?: null | Buffer<ArrayBufferLike> }

        Withdrawal arguments

        • OptionaluserArgs?: null | Buffer<ArrayBufferLike>

          Optional user arguments for the instruction

      • params: {
            adaptorProgram: PublicKey;
            assetTokenProgram: PublicKey;
            remainingAccounts: {
                isSigner: boolean;
                isWritable: boolean;
                pubkey: PublicKey;
            }[];
            strategy: PublicKey;
            user: PublicKey;
            vault: PublicKey;
            vaultAssetMint: PublicKey;
        }

        Parameters for withdrawing assets from direct withdraw strategy

        • adaptorProgram: PublicKey

          Public key of the adaptor program

        • assetTokenProgram: PublicKey

          Public key of the asset token program

        • remainingAccounts: { isSigner: boolean; isWritable: boolean; pubkey: PublicKey }[]

          Remaining accounts for the instruction

        • strategy: PublicKey

          Public key of the strategy

        • user: PublicKey

          Public key of the user

        • vault: PublicKey

          Public key of the vault

        • vaultAssetMint: PublicKey

          Public key of the vault asset mint

      Returns Promise<TransactionInstruction>

      Transaction instruction for withdrawing assets from direct withdraw strategy

      If instruction creation fails

      const ix = await client.createDirectWithdrawStrategyIx(
      {
      userArgs: Buffer.from('...')
      },
      {
      user: userPubkey,
      vault: vaultPubkey,
      strategy: strategyPubkey,
      vaultAssetMint: mintPubkey,
      assetTokenProgram: tokenProgramPubkey,
      adaptorProgram: adaptorProgramPubkey,
      remainingAccounts: []
      }
      );
    • Creates an instruction to withdraw assets from a direct withdraw strategy with slippage tolerance

      Parameters

      • directWithdrawArgs: { tolerance: BN; userArgs?: null | Buffer<ArrayBufferLike> }

        Withdrawal arguments

        • tolerance: BN

          Slippage tolerance in asset amount (max difference between requested and actual)

        • OptionaluserArgs?: null | Buffer<ArrayBufferLike>

          Optional user arguments for the instruction

      • params: {
            adaptorProgram: PublicKey;
            assetTokenProgram: PublicKey;
            remainingAccounts: {
                isSigner: boolean;
                isWritable: boolean;
                pubkey: PublicKey;
            }[];
            strategy: PublicKey;
            user: PublicKey;
            vault: PublicKey;
            vaultAssetMint: PublicKey;
        }

        Parameters for withdrawing assets from direct withdraw strategy

        • adaptorProgram: PublicKey

          Public key of the adaptor program (defaults to lending adaptor)

        • assetTokenProgram: PublicKey

          Public key of the asset token program

        • remainingAccounts: { isSigner: boolean; isWritable: boolean; pubkey: PublicKey }[]

          Remaining accounts for the instruction

        • strategy: PublicKey

          Public key of the strategy

        • user: PublicKey

          Public key of the user

        • vault: PublicKey

          Public key of the vault

        • vaultAssetMint: PublicKey

          Public key of the vault asset mint

      Returns Promise<TransactionInstruction>

      Transaction instruction for direct withdraw with tolerance

      If instruction creation fails

      const ix = await client.createDirectWithdrawStrategyWithToleranceIx(
      {
      userArgs: Buffer.from('...'),
      tolerance: new BN(1000),
      },
      {
      user: userPubkey,
      vault: vaultPubkey,
      strategy: strategyPubkey,
      vaultAssetMint: mintPubkey,
      assetTokenProgram: tokenProgramPubkey,
      remainingAccounts: [],
      }
      );
    • Creates an instruction to harvest fees from a vault

      Parameters

      • params: {
            harvester: PublicKey;
            protocolAdmin: PublicKey;
            vault: PublicKey;
            vaultAdmin: PublicKey;
            vaultManager: PublicKey;
        }

        Parameters for harvesting fees

        • harvester: PublicKey

          Public key of the harvester

        • protocolAdmin: PublicKey

          Public key of the protocol admin

        • vault: PublicKey

          Public key of the vault

        • vaultAdmin: PublicKey

          Public key of the vault admin

        • vaultManager: PublicKey

          Public key of the vault manager

      Returns Promise<TransactionInstruction>

      Transaction instruction for harvesting fees

      If instruction creation fails

      const ix = await client.createHarvestFeeIx({
      harvester: harvesterPubkey,
      vaultManager: vaultManagerPubkey,
      vaultAdmin: vaultAdminPubkey,
      protocolAdmin: protocolAdminPubkey,
      vault: vaultPubkey,
      });
    • Creates an instruction to initialize a direct withdraw strategy

      Parameters

      • initArgs: InitializeDirectWithdrawStrategyArgs

        Arguments for initializing direct withdraw strategy

        • OptionaladditionalArgs?: null | Buffer<ArrayBufferLike>
        • OptionalallowUserArgs?: boolean
        • OptionalinstructionDiscriminator?: null | Buffer<ArrayBufferLike>
      • params: {
            adaptorProgram: PublicKey;
            admin: PublicKey;
            payer: PublicKey;
            strategy: PublicKey;
            vault: PublicKey;
        }

        Parameters for initializing direct withdraw strategy

        • adaptorProgram: PublicKey

          Public key of the adaptor program

        • admin: PublicKey

          Public key of the admin

        • payer: PublicKey

          Public key of the payer

        • strategy: PublicKey

          Public key of the strategy

        • vault: PublicKey

          Public key of the vault

      Returns Promise<TransactionInstruction>

      Transaction instruction for initializing direct withdraw strategy

      If instruction creation fails

      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

      Parameters

      • initArgs: InitializeStrategyArgs

        Arguments for strategy initialization

        • OptionaladditionalArgs?: null | Buffer<ArrayBufferLike>
        • OptionalinstructionDiscriminator?: null | Buffer<ArrayBufferLike>
      • Optionalparams: {
            adaptorProgram: PublicKey;
            manager: PublicKey;
            payer: PublicKey;
            remainingAccounts: {
                isSigner: boolean;
                isWritable: boolean;
                pubkey: PublicKey;
            }[];
            strategy: PublicKey;
            vault: PublicKey;
        }

        Parameters for initializing strategy to vault

        • adaptorProgram: PublicKey

          Public key of the adaptor program

        • manager: PublicKey

          Public key of the manager

        • payer: PublicKey

          Public key of the payer

        • remainingAccounts: { isSigner: boolean; isWritable: boolean; pubkey: PublicKey }[]

          Remaining accounts for the instruction

        • strategy: PublicKey

          Public key of the strategy

        • vault: PublicKey

          Public key of the vault

      Returns Promise<TransactionInstruction>

      Transaction instruction for initializing strategy to vault

      If the instruction creation fails

      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

      Parameters

      • vaultParams: VaultParams

        Configuration parameters for the vault

      • params: {
            admin: PublicKey;
            manager: PublicKey;
            payer: PublicKey;
            vault: PublicKey;
            vaultAssetMint: PublicKey;
        }

        Additional parameters for initializing the vault

        • admin: PublicKey

          Public key of the vault admin

        • manager: PublicKey

          Public key of the vault manager

        • payer: PublicKey

          Public key of the fee payer

        • vault: PublicKey

          Keypair for the new vault

        • vaultAssetMint: PublicKey

          Public key of the vault's asset mint

      Returns Promise<TransactionInstruction>

      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 initialize the protocol

      Parameters

      • operationalState: number

        Bitflags for allowed operations (e.g., CREATE_VAULT = 1, DEPOSIT_VAULT = 2, etc.)

      • params: { admin: PublicKey; payer: PublicKey }

        Parameters for initializing the protocol

        • admin: PublicKey

          Public key of the protocol admin

        • payer: PublicKey

          Public key of the fee payer

      Returns Promise<TransactionInstruction>

      Transaction instruction for initializing the protocol

      const ix = await client.createInitProtocolIx(
      0xFFFF, // enable all operations
      {
      payer: payerPubkey,
      admin: adminPubkey,
      }
      );
    • Creates an instant withdraw instruction for a strategy (no waiting period, withdraws directly from strategy)

      Parameters

      • args: InstantWithdrawStrategyArgs

        Instant withdrawal arguments

        • amount: BN
        • isAmountInLp: boolean
        • isWithdrawAll: boolean
        • OptionaluserArgs?: null | Buffer<ArrayBufferLike>
      • params: {
            adaptorProgram: PublicKey;
            assetTokenProgram: PublicKey;
            remainingAccounts: {
                isSigner: boolean;
                isWritable: boolean;
                pubkey: PublicKey;
            }[];
            strategy: PublicKey;
            userTransferAuthority: PublicKey;
            vault: PublicKey;
            vaultAssetMint: PublicKey;
        }

        Instant withdraw strategy parameters

        • adaptorProgram: PublicKey

          Public key of the adaptor program (defaults to lending adaptor)

        • assetTokenProgram: PublicKey

          Public key of the asset token program

        • remainingAccounts: { isSigner: boolean; isWritable: boolean; pubkey: PublicKey }[]

          Remaining accounts for the instruction

        • strategy: PublicKey

          Public key of the strategy

        • userTransferAuthority: PublicKey

          Public key of the user's transfer authority

        • vault: PublicKey

          Public key of the vault

        • vaultAssetMint: PublicKey

          Public key of the vault asset mint

      Returns Promise<TransactionInstruction>

      Transaction instruction for instant strategy withdrawal

      If the vault's withdrawal waiting period is not zero

      const ix = await client.createInstantWithdrawStrategyIx(
      {
      amount: new BN('1000000000'),
      isAmountInLp: true,
      isWithdrawAll: false,
      },
      {
      userTransferAuthority: userPubkey,
      vault: vaultPubkey,
      strategy: strategyPubkey,
      vaultAssetMint: mintPubkey,
      assetTokenProgram: tokenProgramPubkey,
      remainingAccounts: [],
      }
      );
    • Creates an instant withdraw instruction for a strategy with slippage tolerance

      Parameters

      • args: InstantWithdrawStrategyArgs & { tolerance: BN }

        Instant withdrawal arguments with tolerance

        • amount: BN
        • isAmountInLp: boolean
        • isWithdrawAll: boolean
        • OptionaluserArgs?: null | Buffer<ArrayBufferLike>
        • tolerance: BN

          Slippage tolerance in asset amount (max difference between requested and actual)

      • params: {
            adaptorProgram: PublicKey;
            assetTokenProgram: PublicKey;
            remainingAccounts: {
                isSigner: boolean;
                isWritable: boolean;
                pubkey: PublicKey;
            }[];
            strategy: PublicKey;
            userTransferAuthority: PublicKey;
            vault: PublicKey;
            vaultAssetMint: PublicKey;
        }

        Instant withdraw strategy parameters

        • adaptorProgram: PublicKey

          Public key of the adaptor program (defaults to lending adaptor)

        • assetTokenProgram: PublicKey

          Public key of the asset token program

        • remainingAccounts: { isSigner: boolean; isWritable: boolean; pubkey: PublicKey }[]

          Remaining accounts for the instruction

        • strategy: PublicKey

          Public key of the strategy

        • userTransferAuthority: PublicKey

          Public key of the user's transfer authority

        • vault: PublicKey

          Public key of the vault

        • vaultAssetMint: PublicKey

          Public key of the vault asset mint

      Returns Promise<TransactionInstruction>

      Transaction instruction for instant strategy withdrawal with tolerance

      If the vault's withdrawal waiting period is not zero

      const ix = await client.createInstantWithdrawStrategyWithToleranceIx(
      {
      amount: new BN('1000000000'),
      isAmountInLp: true,
      isWithdrawAll: false,
      tolerance: new BN(1000),
      },
      {
      userTransferAuthority: userPubkey,
      vault: vaultPubkey,
      strategy: strategyPubkey,
      vaultAssetMint: mintPubkey,
      assetTokenProgram: tokenProgramPubkey,
      remainingAccounts: [],
      }
      );
    • Creates an instant withdraw instruction for a vault (no waiting period required)

      Parameters

      • args: InstantWithdrawVaultArgs

        Instant withdrawal arguments

        • amount: BN
        • isAmountInLp: boolean
        • isWithdrawAll: boolean
      • params: {
            assetTokenProgram: PublicKey;
            userTransferAuthority: PublicKey;
            vault: PublicKey;
            vaultAssetMint: PublicKey;
        }

        Instant withdraw parameters

        • assetTokenProgram: PublicKey

          Public key of the asset token program

        • userTransferAuthority: PublicKey

          Public key of the user's transfer authority

        • vault: PublicKey

          Public key of the vault

        • vaultAssetMint: PublicKey

          Public key of the vault asset mint

      Returns Promise<TransactionInstruction>

      Transaction instruction for instant withdrawal

      If the vault's withdrawal waiting period is not zero

      const ix = await client.createInstantWithdrawVaultIx(
      {
      amount: new BN('1000000000'),
      isAmountInLp: true,
      isWithdrawAll: false,
      },
      {
      userTransferAuthority: userPubkey,
      vault: vaultPubkey,
      vaultAssetMint: mintPubkey,
      assetTokenProgram: tokenProgramPubkey,
      }
      );
    • Creates an instruction to remove a strategy from a vault

      Parameters

      • params: { adaptorProgram: PublicKey; admin: PublicKey; vault: PublicKey }

        Parameters for removing strategy

        • adaptorProgram: PublicKey

          Public key of the adaptor program

        • admin: PublicKey

          Public key of the admin

        • vault: PublicKey

          Public key of the vault

      Returns Promise<TransactionInstruction>

      Transaction instruction for removing adaptor from vault

      If instruction creation fails

      const ix = await client.createRemoveAdaptorIx({
      vault: vaultPubkey,
      admin: adminPubkey,
      adaptorProgram: adaptorProgramPubkey
      });
    • Creates a request withdraw instruction for a vault

      Parameters

      • requestWithdrawArgs: RequestWithdrawVaultArgs

        Arguments for withdrawing from the vault

        • amount: BN
        • isAmountInLp: boolean
        • isWithdrawAll: boolean
      • params: { payer: PublicKey; userTransferAuthority: PublicKey; vault: PublicKey }

        Request withdraw parameters

        • payer: PublicKey

          Public key of the payer

        • userTransferAuthority: PublicKey

          Public key of the user authority

        • vault: PublicKey

          Public key of the vault

      Returns Promise<TransactionInstruction>

      Transaction instruction for withdrawal

      If the instruction creation fails

      const ix = await client.createRequestWithdrawVaultIx(
      {
      amount: new BN('1000000000'),
      isAmountInLp: true,
      isWithdrawAll: false,
      },
      {
      payer: payerPubkey,
      userTransferAuthority: userPubkey,
      vault: vaultPubkey,
      }
      );
    • Creates an instruction to update the protocol configuration

      Parameters

      • field: ProtocolConfigField

        The protocol configuration field to update

      • data: Buffer

        The serialized data for the new value

      • params: { admin: PublicKey }

        Parameters for updating the protocol

        • admin: PublicKey

          Public key of the protocol admin

      Returns Promise<TransactionInstruction>

      Transaction instruction for updating the protocol

      If the field is unknown

      const data = Buffer.alloc(2);
      data.writeUInt16LE(0xFFFF, 0);
      const ix = await client.createUpdateProtocolIx(
      ProtocolConfigField.OperationalState,
      data,
      { admin: adminPubkey }
      );
      const data = newAdmin.toBuffer();
      const ix = await client.createUpdateProtocolIx(
      ProtocolConfigField.PendingAdmin,
      data,
      { admin: adminPubkey }
      );
    • Creates an instruction to update a specific vault configuration field

      Parameters

      • field: VaultConfigField

        The configuration field to update

      • data: Buffer

        The serialized data for the new value

      • params: { admin: PublicKey; vault: PublicKey; vaultLpMint?: PublicKey }

        Parameters for updating the vault config

        • admin: PublicKey

          Public key of the vault admin

        • vault: PublicKey

          Public key of the vault

        • OptionalvaultLpMint?: PublicKey

          Required when updating management fees

      Returns Promise<TransactionInstruction>

      Transaction instruction for updating the vault config

      If the field requires LP mint but it's not provided

      const newMaxCap = new BN(20_000_000_000_000);
      const data = newMaxCap.toArrayLike(Buffer, "le", 8);

      const ix = await client.createUpdateVaultConfigIx(
      VaultConfigField.MaxCap,
      data,
      {
      vault: vaultPubkey,
      admin: adminPubkey
      }
      );
      const newManagerManagementFee = 1000; // 10%
      const data = Buffer.alloc(2);
      data.writeUInt16LE(newManagerManagementFee, 0);

      const vaultLpMint = client.findVaultLpMint(vaultPubkey);

      const ix = await client.createUpdateVaultConfigIx(
      VaultConfigField.ManagerManagementFee,
      data,
      {
      vault: vaultPubkey,
      admin: adminPubkey,
      vaultLpMint: vaultLpMint
      }
      );
      const newManager = new PublicKey('...');
      const data = newManager.toBuffer();

      const ix = await client.createUpdateVaultConfigIx(
      VaultConfigField.Manager,
      data,
      {
      vault: vaultPubkey,
      admin: adminPubkey
      }
      );
    • Creates an instruction to update per-vault protocol fees (admin-only, protocol level)

      Parameters

      • field: ProtocolFeeField

        The protocol fee field to update

      • feeBps: number

        The new fee value in basis points

      • params: { admin: PublicKey; vault: PublicKey }

        Parameters for updating the protocol fee

        • admin: PublicKey

          Public key of the protocol admin

        • vault: PublicKey

          Public key of the vault

      Returns Promise<TransactionInstruction>

      Transaction instruction for updating the protocol fee

      If the total fee (protocol + admin + manager) exceeds 10000 BPS

      const ix = await client.createUpdateVaultProtocolFeeIx(
      ProtocolFeeField.ProtocolPerformanceFee,
      500, // 5%
      {
      admin: protocolAdminPubkey,
      vault: vaultPubkey,
      }
      );
    • Creates an instruction to withdraw assets from a strategy

      Parameters

      • withdrawArgs: WithdrawStrategyArgs

        Withdrawal arguments

        • OptionaladditionalArgs?: null | Buffer<ArrayBufferLike>
        • OptionalinstructionDiscriminator?: null | Buffer<ArrayBufferLike>
        • withdrawAmount: BN
      • params: {
            adaptorProgram: PublicKey;
            assetTokenProgram: PublicKey;
            manager: PublicKey;
            remainingAccounts: {
                isSigner: boolean;
                isWritable: boolean;
                pubkey: PublicKey;
            }[];
            strategy: PublicKey;
            vault: PublicKey;
            vaultAssetMint: PublicKey;
        }

        Strategy withdrawal parameters

        • adaptorProgram: PublicKey

          Public key of the adaptor program

        • assetTokenProgram: PublicKey

          Public key of the asset token program

        • manager: PublicKey
        • remainingAccounts: { isSigner: boolean; isWritable: boolean; pubkey: PublicKey }[]

          Remaining accounts for the instruction

        • strategy: PublicKey

          Public key of the strategy

        • vault: PublicKey

          Public key of the vault

        • vaultAssetMint: PublicKey

          Public key of the vault asset mint

      Returns Promise<TransactionInstruction>

      Transaction instruction for withdrawing assets from strategy

      If the instruction creation fails

      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

      Parameters

      • params: {
            assetTokenProgram: PublicKey;
            userTransferAuthority: PublicKey;
            vault: PublicKey;
            vaultAssetMint: PublicKey;
        }

        Withdraw parameters

        • assetTokenProgram: PublicKey

          Public key of the asset token program

        • userTransferAuthority: PublicKey

          Public key of the user authority

        • vault: PublicKey

          Public key of the vault

        • vaultAssetMint: PublicKey

          Public key of the vault asset mint

      Returns Promise<TransactionInstruction>

      Transaction instruction for withdrawal

      If the instruction creation fails

      const ix = await client.createWithdrawVaultIx(
      {
      userTransferAuthority: userPubkey,
      vault: vaultPubkey,
      vaultAssetMint: mintPubkey,
      assetTokenProgram: tokenProgramPubkey
      }
      );
    • Fetches an adaptor add receipt account's data

      Parameters

      • adaptorAddReceipt: PublicKey

        Public key of the adaptor add receipt account

      Returns Promise<
          {
              adaptorProgram: PublicKey;
              bump: number;
              lastUpdatedEpoch: BN;
              padding0: number[];
              reserved: number[];
              vault: PublicKey;
              version: number;
          },
      >

      Promise resolving to the adaptor add receipt account data

      const adaptorAddReceiptAccount = await client.fetchAdaptorAddReceiptAccount(adaptorAddReceiptPubkey);
      
    • Fetches all adaptor add receipt accounts of a vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns Promise<
          ProgramAccount<
              {
                  adaptorProgram: PublicKey;
                  bump: number;
                  lastUpdatedEpoch: BN;
                  padding0: number[];
                  reserved: number[];
                  vault: PublicKey;
                  version: number;
              },
          >[],
      >

      Promise resolving to an array of adaptor add receipt accounts

      const adaptorAddReceiptAccounts = await client.fetchAllAdaptorAddReceiptAccountsOfVault(vaultPubkey);
      
    • Fetches all request withdraw vault receipt accounts of a vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns Promise<
          ProgramAccount<
              {
                  amountAssetToWithdrawDecimalBits: BN;
                  amountLpEscrowed: BN;
                  bump: number;
                  user: PublicKey;
                  vault: PublicKey;
                  version: number;
                  withdrawableFromTs: BN;
              },
          >[],
      >

      Promise resolving to an array of request withdraw vault receipt accounts

      const requestWithdrawVaultReceiptAccounts = await client.fetchAllRequestWithdrawVaultReceiptsOfVault(vaultPubkey);
      
    • Fetches all strategy init receipt accounts

      Returns Promise<
          ProgramAccount<
              {
                  adaptorProgram: PublicKey;
                  bump: number;
                  lastUpdatedTs: BN;
                  padding0: number[];
                  positionValue: BN;
                  reserved: number[];
                  strategy: PublicKey;
                  vault: PublicKey;
                  vaultStrategyAuthBump: number;
                  version: number;
              },
          >[],
      >

      Promise resolving to an array of strategy init receipt accounts

      const strategyInitReceiptAccounts = await client.fetchAllStrategyInitReceiptAccounts();
      
    • Fetches all strategy init receipt accounts of a vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns Promise<
          ProgramAccount<
              {
                  adaptorProgram: PublicKey;
                  bump: number;
                  lastUpdatedTs: BN;
                  padding0: number[];
                  positionValue: BN;
                  reserved: number[];
                  strategy: PublicKey;
                  vault: PublicKey;
                  vaultStrategyAuthBump: number;
                  version: number;
              },
          >[],
      >

      Promise resolving to an array of strategy init receipt accounts

      const strategyInitReceiptAccounts = await client.fetchAllStrategyInitReceiptAccountsOfVault(vaultPubkey);
      
    • Fetches the protocol account's data

      Returns Promise<
          {
              admin: PublicKey;
              bump: number;
              operationalState: number;
              padding0: number[];
              padding1: number[];
              pendingAdmin: PublicKey;
              reserved: number[];
          },
      >

      Promise resolving to the protocol account data

      const protocolAccount = await client.fetchProtocolAccount();
      
    • Fetches a request withdraw vault receipt account's data

      Parameters

      • requestWithdrawVaultReceipt: PublicKey

        Public key of the request withdraw vault receipt account

      Returns Promise<
          {
              amountAssetToWithdrawDecimalBits: BN;
              amountLpEscrowed: BN;
              bump: number;
              user: PublicKey;
              vault: PublicKey;
              version: number;
              withdrawableFromTs: BN;
          },
      >

      Promise resolving to the request withdraw vault receipt account data

      const requestWithdrawVaultReceiptAccount = await client.fetchRequestWithdrawVaultReceiptAccount(requestWithdrawVaultReceiptPubkey);
      
    • Fetches a strategy init receipt account's data

      Parameters

      • strategyInitReceipt: PublicKey

        Public key of the strategy init receipt account

      Returns Promise<
          {
              adaptorProgram: PublicKey;
              bump: number;
              lastUpdatedTs: BN;
              padding0: number[];
              positionValue: BN;
              reserved: number[];
              strategy: PublicKey;
              vault: PublicKey;
              vaultStrategyAuthBump: number;
              version: number;
          },
      >

      Promise resolving to the strategy init receipt account data

      const strategyInitReceiptAccount = await client.fetchStrategyInitReceiptAccount(strategyInitReceiptPubkey);
      
    • Parameters

      • vault: PublicKey

      Returns Promise<
          {
              admin: PublicKey;
              asset: {
                  idleAta: PublicKey;
                  idleAtaAuthBump: number;
                  mint: PublicKey;
                  reserved: number[];
                  totalValue: BN;
              };
              deadWeight: BN;
              description: number[];
              feeConfiguration: {
                  adminManagementFee: number;
                  adminPerformanceFee: number;
                  issuanceFee: number;
                  managerManagementFee: number;
                  managerPerformanceFee: number;
                  protocolManagementFee: number;
                  protocolPerformanceFee: number;
                  redemptionFee: number;
                  reserved: number[];
              };
              feeState: {
                  accumulatedLpAdminFees: BN;
                  accumulatedLpManagerFees: BN;
                  accumulatedLpProtocolFees: BN;
                  reserved: number[];
              };
              feeUpdate: {
                  lastManagementFeeUpdateTs: BN;
                  lastPerformanceFeeUpdateTs: BN;
              };
              highWaterMark: {
                  highestAssetPerLpDecimalBits: BN;
                  lastUpdatedTs: BN;
                  reserved: number[];
              };
              lastUpdatedTs: BN;
              lockedProfitState: { lastReport: BN; lastUpdatedLockedProfit: BN };
              lp: {
                  mint: PublicKey;
                  mintAuthBump: number;
                  mintBump: number;
                  reserved: number[];
              };
              manager: PublicKey;
              name: number[];
              padding0: number[];
              pendingAdmin: PublicKey;
              reserved: number[];
              vaultConfiguration: {
                  disabledOperations: number;
                  lockedProfitDegradationDuration: BN;
                  maxCap: BN;
                  reserved: number[];
                  startAtTs: BN;
                  withdrawalWaitingPeriod: BN;
              };
              version: number;
          },
      >

    • Finds the direct withdraw init receipt address

      Parameters

      • vault: PublicKey

        Public key of the vault

      • strategy: PublicKey

        Public key of the strategy

      Returns PublicKey

      The PDA for the direct withdraw init receipt

      const directWithdrawInitReceipt = client.findDirectWithdrawInitReceipt(vaultPubkey, strategyPubkey);
      
    • Finds the LP metadata account for a given vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns PublicKey

      The PDA for the LP metadata account

      const lpMetadataAccount = client.findLpMetadataAccount(vaultPubkey);
      
    • Finds the protocol PDA address

      Returns PublicKey

      The PDA for the protocol account

      const protocol = client.findProtocol();
      
    • Finds the request withdraw vault receipt address

      Parameters

      • vault: PublicKey

        Public key of the vault

      • user: PublicKey

        Public key of the user

      Returns PublicKey

      The PDA for the request withdraw vault receipt

      const requestWithdrawVaultReceipt = client.findRequestWithdrawVaultReceipt(vaultPubkey, userPubkey);
      
    • Finds the strategy init receipt address

      Parameters

      • vault: PublicKey

        Public key of the vault

      • strategy: PublicKey

        Public key of the strategy

      Returns PublicKey

      The PDA for the strategy init receipt

      const strategyInitReceipt = client.findStrategyInitReceipt(vaultPubkey, strategyPubkey);
      
    • Finds all vault-related addresses

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns { vaultAssetIdleAuth: PublicKey; vaultLpMint: PublicKey }

      Object containing all vault-related PDAs

      const addresses = client.findVaultAddresses(vaultPubkey);
      console.log(addresses.vaultLpMint.toBase58());
      console.log(addresses.vaultAssetIdleAuth.toBase58());
      console.log(addresses.vaultLpFeeAuth.toBase58());
    • Finds the vault's asset idle authority address

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns PublicKey

      The PDA for the vault's asset idle authority

    • Finds the vault LP mint address for a given vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns PublicKey

      The PDA for the vault's LP mint

    • Parameters

      • vault: PublicKey
      • strategy: PublicKey

      Returns {
          directWithdrawInitReceipt: PublicKey;
          strategyInitReceipt: PublicKey;
          vaultStrategyAuth: PublicKey;
      }

    • Finds the vault strategy auth address

      Parameters

      • vault: PublicKey

        Public key of the vault

      • strategy: PublicKey

        Public key of the strategy

      Returns PublicKey

      The PDA for the vault strategy auth

      const vaultStrategyAuth = client.findVaultStrategyAuth(vaultPubkey, strategyPubkey);
      
    • Fetches the accumulated admin fees for a vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns Promise<BN>

      Promise resolving to the accumulated admin fees

      const accumulatedAdminFees = await client.getAccumulatedAdminFeesForVault(vaultPubkey);
      
    • Fetches the accumulated manager fees for a vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns Promise<BN>

      Promise resolving to the accumulated manager fees

      const accumulatedManagerFees = await client.getAccumulatedManagerFeesForVault(vaultPubkey);
      
    • Fetches the accumulated protocol fees for a vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns Promise<BN>

      Promise resolving to the accumulated protocol fees

      const accumulatedProtocolFees = await client.getAccumulatedProtocolFeesForVault(vaultPubkey);
      
    • Fetches all pending withdrawals for a vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns Promise<
          {
              amountAssetToWithdrawAtPresent: number;
              amountAssetToWithdrawAtRequest: number;
              amountAssetToWithdrawEffective: number;
              amountLpEscrowed: number;
              user: PublicKey;
              withdrawableFromTs: number;
          }[],
      >

      Promise resolving to an array of pending withdrawals

      const pendingWithdrawals = await client.getAllPendingWithdrawalsForVault(vaultPubkey);
      
    • Gets the balance of a Solana account

      Parameters

      • publicKey: PublicKey

        Public key to check balance for

      Returns Promise<number>

      Promise resolving to the account balance in lamports

      If fetching balance fails

    • Fetches the current asset per LP for a vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns Promise<number>

      Promise resolving to the current asset per LP

      const currentAssetPerLp = await client.getCurrentAssetPerLpForVault(vaultPubkey);
      
    • Fetches the high water mark for a vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns Promise<{ highestAssetPerLp: number; lastUpdatedTs: number }>

      Promise resolving to the high water mark

      const highWaterMark = await client.getHighWaterMarkForVault(vaultPubkey);
      
    • Fetches the pending withdrawal for a user

      Parameters

      • vault: PublicKey

        Public key of the vault

      • user: PublicKey

        Public key of the user

      Returns Promise<
          {
              amountAssetToWithdrawAtPresent: number;
              amountAssetToWithdrawAtRequest: number;
              amountAssetToWithdrawEffective: number;
              amountLpEscrowed: number;
              user: PublicKey;
              withdrawableFromTs: number;
          },
      >

      Promise resolving to the pending withdrawal

      const pendingWithdrawal = await client.getPendingWithdrawalForUser(vaultPubkey, userPubkey);
      
    • Fetches the position and total values for a vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns Promise<
          {
              strategies: { amount: number; strategyId: string }[];
              totalValue: number;
          },
      >

      Promise resolving to the position and total values

      const positionAndTotalValues = await client.getPositionAndTotalValuesForVault(vaultPubkey);
      
    • Fetches the breakdown of the LP supply for a vault

      Parameters

      • vault: PublicKey

        Public key of the vault

      Returns Promise<{ circulating: BN; total: BN; unharvestedFees: BN; unrealisedFees: BN }>

      Promise resolving to the breakdown of the LP supply

      const lpSupplyBreakdown = await client.getVaultLpSupplyBreakdown(vaultPubkey);