/// import { HubbleConfig, SolanaCluster } from '@hubbleprotocol/hubble-config'; import { AccountInfo, Connection, PublicKey, TransactionInstruction, AddressLookupTableAccount, MessageV0, Keypair } from '@solana/web3.js'; import { GlobalConfig, TermsSignature, WhirlpoolStrategy } from './kamino-client/accounts'; import Decimal from 'decimal.js'; import { Position, Whirlpool } from './whirpools-client'; import { KaminoPosition, ShareData, ShareDataWithAddress, StrategyHolder, TokenAmounts, TotalStrategyVaultTokens } from './models'; import { OraclePrices } from '@hubbleprotocol/scope-sdk'; import { DepositAmountsForSwap, Dex, GenericPoolInfo, GenericPositionRangeInfo, LiquidityDistribution, RebalanceFieldInfo, StrategiesFilters, VaultParameters, PositionRange, TokensBalances, SwapperIxBuilder, InstructionsWithLookupTables, ProfiledFunctionExecution, MaybeTokensBalances, PerformanceFees, PriceReferenceType, InputRebalanceFieldInfo, WithdrawAllAndCloseIxns } from './utils'; import BN from 'bn.js'; import StrategyWithAddress from './models/StrategyWithAddress'; import { Idl, Program } from '@project-serum/anchor'; import { CollateralInfo, ExecutiveWithdrawActionKind, RebalanceTypeKind, ReferencePriceTypeKind, StrategyStatusKind } from './kamino-client/types'; import { AmmConfig, PersonalPositionState, PoolState } from './raydium_client'; import { Whirlpool as OrcaPool, WhirlpoolAprApy } from './services'; import { Pool } from './services/RaydiumPoolsResponse'; import { RebalanceMethod } from './utils/CreationParameters'; import { SimulationPercentagePoolParameters } from './services/PoolSimulationService'; import { StrategyPrices } from './models/StrategyPrices'; import WhirlpoolWithAddress from './models/WhirlpoolWithAddress'; export declare const KAMINO_IDL: { version: string; name: string; instructions: ({ name: string; accounts: ({ name: string; isMut: boolean; isSigner: boolean; docs?: undefined; } | { name: string; isMut: boolean; isSigner: boolean; docs: string[]; })[]; args: { name: string; type: string; }[]; docs?: undefined; } | { name: string; accounts: { name: string; isMut: boolean; isSigner: boolean; }[]; args: ({ name: string; type: string; } | { name: string; type: { array: (string | number)[]; }; })[]; docs?: undefined; } | { name: string; docs: string[]; accounts: { name: string; isMut: boolean; isSigner: boolean; }[]; args: { name: string; type: string; }[]; })[]; accounts: ({ name: string; docs: string[]; type: { kind: string; fields: ({ name: string; type: string; } | { name: string; type: { array: (string | number)[]; }; } | { name: string; type: { array: (number | { defined: string; })[]; }; })[]; }; } | { name: string; type: { kind: string; fields: ({ name: string; docs: string[]; type: string; } | { name: string; type: string; docs?: undefined; } | { name: string; docs: string[]; type: { array: (string | number)[]; }; } | { name: string; type: { array: (number | { defined: string; })[]; }; docs?: undefined; } | { name: string; type: { array: (string | number)[]; }; docs?: undefined; })[]; }; docs?: undefined; } | { name: string; type: { kind: string; fields: ({ name: string; type: string; docs?: undefined; } | { name: string; type: { defined: string; array?: undefined; }; docs?: undefined; } | { name: string; type: { array: (number | { defined: string; })[]; defined?: undefined; }; docs?: undefined; } | { name: string; docs: string[]; type: string; } | { name: string; type: { array: (string | number)[]; defined?: undefined; }; docs?: undefined; })[]; }; docs?: undefined; } | { name: string; type: { kind: string; fields: { name: string; type: { array: (number | { array: (string | number)[]; })[]; }; }[]; }; docs?: undefined; })[]; types: ({ name: string; type: { kind: string; fields: { name: string; docs: string[]; type: string; }[]; variants?: undefined; }; } | { name: string; type: { kind: string; fields: ({ name: string; type: { array: (string | number)[]; }; } | { name: string; type: string; })[]; variants?: undefined; }; } | { name: string; type: { kind: string; variants: ({ name: string; fields: string[]; } | { name: string; fields?: undefined; })[]; fields?: undefined; }; } | { name: string; type: { kind: string; variants: ({ name: string; fields: string[]; } | { name: string; fields: ({ name: string; docs: string[]; type: string; } | { name: string; type: string; docs?: undefined; })[]; })[]; fields?: undefined; }; })[]; errors: { code: number; name: string; msg: string; }[]; }; export declare class Kamino { private readonly _cluster; private readonly _connection; readonly _config: HubbleConfig; private _globalConfig; private readonly _scope; private readonly _provider; private readonly _kaminoProgram; private readonly _kaminoProgramId; private readonly _orcaService; private readonly _raydiumService; private readonly _jupService; /** * Create a new instance of the Kamino SDK class. * @param cluster Name of the Solana cluster * @param connection Connection to the Solana cluster * @param globalConfig override kamino global config * @param programId override kamino program id * @param whirlpoolProgramId override whirlpool program id * @param raydiumProgramId override raydium program id */ constructor(cluster: SolanaCluster, connection: Connection, globalConfig?: PublicKey, programId?: PublicKey, whirlpoolProgramId?: PublicKey, raydiumProgramId?: PublicKey); getConnection: () => Connection; getProgramID: () => PublicKey; getProgram: () => Program; setGlobalConfig: (globalConfig: PublicKey) => void; getGlobalConfig: () => PublicKey; getDepositableTokens: () => Promise; getCollateralInfos: () => Promise; getSupportedDexes: () => Dex[]; getFeeTiersForDex: (dex: Dex) => Decimal[]; getRebalanceMethods: () => RebalanceMethod[]; getPriceReferenceTypes: () => PriceReferenceType[]; getDefaultRebalanceMethod: () => RebalanceMethod; getDefaultParametersForNewVault: () => Promise; getRebalanceTypeFromRebalanceFields: (rebalanceFields: RebalanceFieldInfo[]) => RebalanceTypeKind; getRebalanceMethodFromRebalanceFields: (rebalanceFields: RebalanceFieldInfo[]) => RebalanceMethod; getFieldsForRebalanceMethod: (rebalanceMethod: RebalanceMethod, dex: Dex, fieldOverrides: RebalanceFieldInfo[], tokenAMint: PublicKey, tokenBMint: PublicKey, poolPrice?: Decimal) => Promise; getFieldsForManualRebalanceMethod: (dex: Dex, fieldOverrides: RebalanceFieldInfo[], tokenAMint: PublicKey, tokenBMint: PublicKey, poolPrice?: Decimal) => Promise; getFieldsForPricePercentageMethod: (dex: Dex, fieldOverrides: RebalanceFieldInfo[], tokenAMint: PublicKey, tokenBMint: PublicKey, poolPrice?: Decimal) => Promise; getFieldsForPricePercentageWithResetMethod: (dex: Dex, fieldOverrides: RebalanceFieldInfo[], tokenAMint: PublicKey, tokenBMint: PublicKey, poolPrice?: Decimal) => Promise; getFieldsForDriftRebalanceMethod: (dex: Dex, fieldOverrides: RebalanceFieldInfo[], tokenAMint: PublicKey, tokenBMint: PublicKey, poolPrice?: Decimal) => Promise; getFieldsForTakeProfitRebalanceMethod: (dex: Dex, fieldOverrides: RebalanceFieldInfo[], tokenAMint: PublicKey, tokenBMint: PublicKey, poolPrice?: Decimal) => Promise; getFieldsForPeriodicRebalanceMethod: (dex: Dex, fieldOverrides: RebalanceFieldInfo[], tokenAMint: PublicKey, tokenBMint: PublicKey, poolPrice?: Decimal) => Promise; getFieldsForExpanderRebalanceMethod: (dex: Dex, fieldOverrides: RebalanceFieldInfo[], tokenAMint: PublicKey, tokenBMint: PublicKey, poolPrice?: Decimal) => Promise; getPriceForPair: (dex: Dex, poolTokenA: PublicKey, poolTokenB: PublicKey) => Promise; getDefaultRebalanceFields: (dex: Dex, poolTokenA: PublicKey, poolTokenB: PublicKey, rebalanceMethod: RebalanceMethod) => Promise; getPoolInitializedForDexPairTier: (dex: Dex, poolTokenA: PublicKey, poolTokenB: PublicKey, feeBPS: Decimal) => Promise; getExistentPoolsForPair(dex: Dex, tokenMintA: PublicKey, tokenMintB: PublicKey): Promise; getOrcaPoolsForTokens: (poolTokenA: PublicKey, poolTokenB: PublicKey) => Promise; getRaydiumPoolsForTokens: (poolTokenA: PublicKey, poolTokenB: PublicKey) => Promise; /** * Return a list of all Kamino whirlpool strategies * @param strategies Limit results to these strategy addresses */ getStrategies: (strategies?: Array) => Promise>; /** * Return a list of all Kamino whirlpool strategies with their addresses * @param strategies Limit results to these strategy addresses */ getStrategiesWithAddresses: (strategies?: Array) => Promise>; getAllStrategiesWithFilters: (strategyFilters: StrategiesFilters) => Promise>; /** * Get a Kamino whirlpool strategy by its public key address * @param address */ getStrategyByAddress: (address: PublicKey) => Promise; /** * Get a Kamino whirlpool strategy by its kToken mint address * @param kTokenMint - mint address of the kToken */ getStrategyByKTokenMint: (kTokenMint: PublicKey) => Promise; /** * Get the strategy share data (price + balances) of the specified Kamino whirlpool strategy * @param strategy * @param scopePrices */ getStrategyShareData: (strategy: PublicKey | StrategyWithAddress, scopePrices?: OraclePrices) => Promise; getStrategiesForSharedData: (strategyFilters: StrategiesFilters | PublicKey[]) => Promise>; /** * Batch fetch share data for all or a filtered list of strategies * @param strategyFilters strategy filters or a list of strategy public keys */ getStrategiesShareData: (strategyFilters: StrategiesFilters | PublicKey[]) => Promise>; getStrategiesShareDataWithFn: (strategyFilters: StrategiesFilters | PublicKey[], getStrategiesFn: (strategyFilters: StrategiesFilters | PublicKey[]) => Promise>) => Promise>; private getBalance; private getRaydiumBalances; private getRaydiumTokensBalances; private getOrcaBalances; private getOrcaTokensBalances; /** * Get the strategies share data (price + balances) of the Kamino whirlpool strategies that match the filters * @param strategyFilters */ getStrategyShareDataForStrategies: (strategyFilters: StrategiesFilters) => Promise>; /** * Get the strategy share price of the specified Kamino whirlpool strategy * @param strategy */ getStrategySharePrice: (strategy: PublicKey | StrategyWithAddress) => Promise; private getTokenAccountBalance; private getTokenAccountBalanceOrZero; private getStrategyBalances; private getStrategyTokensBalances; /** * Get amount of specified token in all Kamino live strategies * @param tokenMint token mint pubkey */ getTotalTokensInStrategies: (tokenMint: PublicKey | string) => Promise; private getStrategyBalancesOrca; private getStrategyBalancesRaydium; private getStrategyHoldingsUsd; getAllPrices: () => Promise; /** * Get the prices of all tokens in the specified strategy, or null if the reward token does not exist * @param strategy * @param collateralInfos * @param scopePrices */ getStrategyPrices: (strategy: WhirlpoolStrategy, collateralInfos: CollateralInfo[], scopePrices?: OraclePrices) => Promise; /** * Get all token accounts for the specified share mint */ getShareTokenAccounts: (shareMint: PublicKey) => Promise<{ pubkey: PublicKey; account: AccountInfo; }[]>; /** * Get all token accounts for the specified wallet */ getAllTokenAccounts: (wallet: PublicKey) => Promise<{ pubkey: PublicKey; account: AccountInfo; }[]>; /** * Get all token accounts that are holding a specific Kamino whirlpool strategy */ getStrategyTokenAccounts: (strategy: PublicKey | StrategyWithAddress) => Promise<{ pubkey: PublicKey; account: AccountInfo; }[]>; /** * Get strategy range in which liquidity is deposited */ getStrategyRange: (strategy: PublicKey | StrategyWithAddress) => Promise; getStrategyRangeOrca: (strategy: PublicKey | StrategyWithAddress) => Promise; getStrategyRangeRaydium: (strategy: PublicKey | StrategyWithAddress) => Promise; getPositionRange: (dex: Dex, position: PublicKey, decimalsA: number, decimalsB: number) => Promise; getPositionRangeOrca: (positionPk: PublicKey, decimalsA: number, decimalsB: number) => Promise; getPositionRangeRaydium: (positionPk: PublicKey, decimalsA: number, decimalsB: number) => Promise; /** * Get all strategy token holders * @param strategy */ getStrategyHolders: (strategy: PublicKey | StrategyWithAddress) => Promise; /** * Get a list of Orca whirlpools from public keys * @param whirlpools */ getWhirlpools: (whirlpools: PublicKey[]) => Promise<(Whirlpool | null)[]>; /** * Get a list of Orca positions from public keys * @param positions */ getOrcaPositions: (positions: PublicKey[]) => Promise<(Position | null)[]>; /** * Get a list of Raydium positions from public keys * @param positions */ getRaydiumPositions: (positions: PublicKey[]) => Promise<(PersonalPositionState | null)[]>; /** * Get whirlpool from public key * @param whirlpool pubkey of the orca whirlpool */ getWhirlpoolByAddress: (whirlpool: PublicKey) => Promise; /** * Get a list of Raydium pools from public keys * @param pools */ getRaydiumPools: (pools: PublicKey[]) => Promise<(PoolState | null)[]>; getRaydiumAmmConfig: (config: PublicKey) => Promise; /** * Get Raydium pool from public key * @param pool pubkey of the orca whirlpool */ getRaydiumPoolByAddress: (pool: PublicKey) => Promise; /** * Return transaction instruction to withdraw shares from a strategy owner (wallet) and get back token A and token B * @param strategy strategy public key * @param sharesAmount amount of shares (decimal representation), NOT in lamports * @param owner shares owner (wallet with shares) * @returns transaction instruction */ withdrawShares: (strategy: PublicKey | StrategyWithAddress, sharesAmount: Decimal, owner: PublicKey) => Promise; /** * Get transaction instructions that create associated token accounts if they don't exist (token A, B and share) * @param owner wallet owner (shareholder) * @param strategyState kamino strategy state * @param tokenAData token A data of the owner's wallet * @param tokenAAta associated token account for token B * @param tokenBData token B data of the owner's wallet * @param tokenBAta associated token account for token B * @param sharesMintData shares data of the owner's wallet * @param sharesAta associated token account for shares * @returns list of transaction instructions (empty if all accounts already exist) */ getCreateAssociatedTokenAccountInstructionsIfNotExist: (owner: PublicKey, strategyState: StrategyWithAddress, tokenAData: AccountInfo | null, tokenAAta: PublicKey, tokenBData: AccountInfo | null, tokenBAta: PublicKey, sharesMintData: AccountInfo | null, sharesAta: PublicKey) => Promise; /** * Check if strategy has already been fetched (is StrategyWithAddress type) and return that, * otherwise fetch it first from PublicKey and return it * @param strategy * @private */ private getStrategyStateIfNotFetched; private getWhirlpoolStateIfNotFetched; private getRaydiumPoolStateIfNotFetched; /** * Get treasury fee vault program addresses from for token A and B mints * @param tokenAMint * @param tokenBMint * @private */ private getTreasuryFeeVaultPDAs; /** * Get a transaction instruction to withdraw all strategy shares from a specific wallet into token A and B * @param strategy public key of the strategy * @param owner public key of the owner (shareholder) * @returns transaction instruction or null if no shares or no sharesMint ATA present in the wallet */ withdrawAllShares: (strategy: PublicKey | StrategyWithAddress, owner: PublicKey) => Promise; /** * Get transaction instruction to deposit token A and B into a strategy. * @param strategy Kamino strategy public key or on-chain object * @param amountA Amount of token A to deposit into strategy * @param amountB Amount of token B to deposit into strategy * @param owner Owner (wallet, shareholder) public key * @returns transaction instruction for depositing tokens into a strategy */ deposit: (strategy: PublicKey | StrategyWithAddress, amountA: Decimal, amountB: Decimal, owner: PublicKey) => Promise; singleSidedDepositTokenA: (strategy: PublicKey | StrategyWithAddress, amountToDeposit: Decimal, owner: PublicKey, slippageBps: Decimal, profiler?: ProfiledFunctionExecution, swapIxsBuilder?: SwapperIxBuilder, initialUserTokenAtaBalances?: TokensBalances, priceAInB?: Decimal, includeAtaIxns?: boolean) => Promise; singleSidedDepositTokenB: (strategy: PublicKey | StrategyWithAddress, amountToDeposit: Decimal, owner: PublicKey, slippageBps: Decimal, profiler?: ProfiledFunctionExecution, swapIxsBuilder?: SwapperIxBuilder, initialUserTokenAtaBalances?: TokensBalances, priceAInB?: Decimal, includeAtaIxns?: boolean) => Promise; getInitialUserTokenBalances: (owner: PublicKey, tokenAMint: PublicKey, tokenBMint: PublicKey, initialUserTokenBalances?: MaybeTokensBalances) => Promise; private getSingleSidedDepositIxs; static retryAsync(fn: () => Promise, retriesLeft?: number, interval?: number): Promise; getJupSwapIxsWithMaxAccounts: (input: DepositAmountsForSwap, tokenAMint: PublicKey, tokenBMint: PublicKey, owner: PublicKey, slippageBps: Decimal, useOnlyLegacyTransaction: boolean, existingAccounts: PublicKey[], maxAccounts: number, profiler?: ProfiledFunctionExecution) => Promise<[TransactionInstruction[], PublicKey[]]>; getJupSwapIxsV4: (input: DepositAmountsForSwap, tokenAMint: PublicKey, tokenBMint: PublicKey, owner: PublicKey, slippageBps: Decimal, useOnlyLegacyTransaction: boolean, existingAccounts: PublicKey[], profiler?: ProfiledFunctionExecution) => Promise<[TransactionInstruction[], PublicKey[]]>; getJupSwapIxsV6: (input: DepositAmountsForSwap, tokenAMint: PublicKey, tokenBMint: PublicKey, owner: PublicKey, slippageBps: Decimal, useOnlyLegacyTransaction: boolean, existingAccounts: PublicKey[], profiledFunctionExecution?: ProfiledFunctionExecution) => Promise<[TransactionInstruction[], PublicKey[]]>; getCheckExpectedVaultsBalancesIx: (strategy: StrategyWithAddress, user: PublicKey, tokenAAta: PublicKey, tokenBAta: PublicKey, expectedTokensBalances?: MaybeTokensBalances) => Promise; /** * Get transaction instruction to create a new Kamino strategy. * Current limitations: * - strategy can only be created by the owner (admin) of the global config, we will need to allow non-admins to bypass this check * - after the strategy is created, only the owner (admin) can update the treasury fee vault with token A/B, we need to allow non-admins to be able to do (and require) this as well * @param strategy public key of the new strategy to create * @param pool public key of the CLMM pool (either Orca or Raydium) * @param owner public key of the strategy owner (admin authority) * @param dex decentralized exchange specifier * @returns transaction instruction for Kamino strategy creation */ createStrategy: (strategy: PublicKey, pool: PublicKey, owner: PublicKey, dex: Dex) => Promise; /** * Get transaction instruction to close Kamino strategy, including its position if there is any * and strategy token accounts. * @param strategy public key of the strategy * @returns instruction to close the strategy */ withdrawAllAndCloseStrategy: (strategy: PublicKey) => Promise; /** * Get transaction instruction to close Kamino strategy, including its position if there is any * and strategy token accounts. * @param strategy public key of the strategy * @returns instruction to close the strategy */ closeStrategy: (strategy: PublicKey) => Promise; /** * Find program adresses required for kamino strategy creation * @param strategy * @param tokenMintA * @param tokenMintB * @private * @returns object with program addresses for kamino strategy creation */ private getStrategyProgramAddresses; /** * Get transaction instruction to create a new rent exempt strategy account * @param payer transaction payer (signer) public key * @param newStrategy public key of the new strategy * @returns transaction instruction to create the account */ createStrategyAccount: (payer: PublicKey, newStrategy: PublicKey) => Promise; createAccountRentExempt: (payer: PublicKey, newAccountPubkey: PublicKey, size: number) => Promise; /** * Get transaction instruction to collect strategy fees from the treasury fee * vaults and rewards from the reward vaults. * @param strategy strategy public key or already fetched object * @param owner signer of the tx * @returns transaction instruction to collect strategy fees and rewards */ collectFeesAndRewards: (strategy: PublicKey | StrategyWithAddress, owner?: PublicKey) => Promise; /** * Get orca position metadata program addresses * @param positionMint mint account of the position */ getMetadataProgramAddressesOrca: (positionMint: PublicKey) => { position: PublicKey; positionBump: number; positionMetadata: PublicKey; positionMetadataBump: number; }; getMetadataProgramAddressesRaydium: (positionMint: PublicKey, pool: PublicKey, tickLowerIndex: number, tickUpperIndex: number) => { position: PublicKey; positionBump: number; protocolPosition: PublicKey; positionMetadata: PublicKey; positionMetadataBump: number; }; private getStartEndTicketIndexProgramAddressesOrca; private getStartEndTicketIndexProgramAddressesRaydium; /** * Get a transaction to open liquidity position for a Kamino strategy * @param strategy strategy you want to open liquidity position for * @param positionMint position mint pubkey * @param priceLower new position's lower price of the range * @param priceUpper new position's upper price of the range * @param status strategy status */ openPosition: (strategy: PublicKey | StrategyWithAddress, positionMint: PublicKey, priceLower: Decimal, priceUpper: Decimal, status?: StrategyStatusKind) => Promise; /** * Get a transaction to open liquidity position for a Kamino strategy * @param strategy strategy you want to open liquidity position for * @param positionMint new liquidity position account pubkey * @param priceLower new position's lower price of the range * @param priceUpper new position's upper price of the range * @param status strategy status */ openPositionOrca: (adminAuthority: PublicKey, strategy: PublicKey, baseVaultAuthority: PublicKey, pool: PublicKey, positionMint: PublicKey, priceLower: Decimal, priceUpper: Decimal, tokenAVault: PublicKey, tokenBVault: PublicKey, oldPositionOrBaseVaultAuthority: PublicKey, oldPositionMintOrBaseVaultAuthority: PublicKey, oldPositionTokenAccountOrBaseVaultAuthority: PublicKey, oldTickArrayLowerOrBaseVaultAuthority: PublicKey, oldTickArrayUpperOrBaseVaultAuthority: PublicKey, status?: StrategyStatusKind) => Promise; /** * Get a transaction to open liquidity position for a Kamino strategy * @param strategy strategy you want to open liquidity position for * @param positionMint new liquidity position account pubkey * @param priceLower new position's lower price of the range * @param priceUpper new position's upper price of the range * @param status strategy status */ openPositionRaydium: (adminAuthority: PublicKey, strategy: PublicKey, baseVaultAuthority: PublicKey, pool: PublicKey, positionMint: PublicKey, priceLower: Decimal, priceUpper: Decimal, tokenAVault: PublicKey, tokenBVault: PublicKey, oldTickArrayLowerOrBaseVaultAuthority: PublicKey, oldTickArrayUpperOrBaseVaultAuthority: PublicKey, oldPositionOrBaseVaultAuthority: PublicKey, oldPositionMintOrBaseVaultAuthority: PublicKey, oldPositionTokenAccountOrBaseVaultAuthority: PublicKey, oldProtocolPositionOrBaseVaultAuthority: PublicKey, status?: StrategyStatusKind, strategyRewardOVault?: PublicKey, strategyReward1Vault?: PublicKey, strategyReward2Vault?: PublicKey) => Promise; /** * Get a transaction for executive withdrawal from a Kamino strategy. * @param strategy strategy pubkey or object * @param action withdrawal action * @returns transaction for executive withdrawal */ executiveWithdraw: (strategy: PublicKey | StrategyWithAddress, action: ExecutiveWithdrawActionKind) => Promise; /** * Get a an instruction to update the reference price type of a strategy * @param strategy strategy pubkey or object * @param referencePriceType new reference price type */ getUpdateReferencePriceTypeIx: (strategy: PublicKey | StrategyWithAddress, referencePriceType: ReferencePriceTypeKind) => Promise; /** * Get a transaction to invest funds from the Kamino vaults and put them into the DEX pool as liquidity. * @param strategy strategy pubkey or object * @param payer transaction payer */ invest: (strategy: PublicKey, payer: PublicKey) => Promise; /** * Get a list of instructions to collect the pending fees and invest them into the Kamino strategy's position. * @param strategy strategy pubkey or object * @param payer transaction payer */ compound: (strategy: PublicKey, payer: PublicKey) => Promise; getUpdateRebalancingParamsFromRebalanceFieldsIx: (strategyAdmin: PublicKey, strategy: PublicKey, rebalanceFieldInfos: RebalanceFieldInfo[]) => Promise; getUpdateRebalancingParmsIxns: (strategyAdmin: PublicKey, strategy: PublicKey, rebalanceParams: Decimal[], rebalanceType?: RebalanceTypeKind, tokenADecimals?: number, tokenBDecimals?: number) => Promise; getUpdateRebalancingParamsForUninitializedStratIx: (strategyAdmin: PublicKey, strategy: PublicKey, rebalanceParams: Decimal[], rebalanceType: RebalanceTypeKind, tokenADecimals: number, tokenBDecimals: number) => Promise; buildStrategyRebalanceParams: (strategy: PublicKey | StrategyWithAddress) => Promise; /** * Get a list of instructions to initialize and set up a strategy * @param dex the dex to use (Orca or Raydium) * @param feeTierBps which fee tier for that specific pair should be used (in BPS) * @param tokenAMint the mint of TokenA in the pool * @param tokenBMint the mint of TokenB in the pool * @param depositCap the maximum amount in USD in lamports (6 decimals) that can be deposited into the strategy * @param depositCapPerIx the maximum amount in USD in lamports (6 decimals) that can be deposited into the strategy per instruction */ getBuildStrategyIxns: (dex: Dex, feeTierBps: Decimal, strategy: PublicKey, positionMint: PublicKey, strategyAdmin: PublicKey, rebalanceType: Decimal, rebalanceParams: Decimal[], tokenAMint: PublicKey, tokenBMint: PublicKey, depositCap?: Decimal, depositCapPerIx?: Decimal, withdrawFeeBps?: Decimal, depositFeeBps?: Decimal, performanceFeeBps?: Decimal) => Promise<[TransactionInstruction, TransactionInstruction[], TransactionInstruction, TransactionInstruction]>; private getRebalancePositionRange; getCurrentPrice(strategy: PublicKey | StrategyWithAddress): Promise; getCurrentPriceFromPool(dex: Dex, pool: PublicKey): Promise; getPriceRangePercentageBasedFromPool(dex: Dex, pool: PublicKey, lowerPriceBpsDifference: Decimal, upperPriceBpsDifference: Decimal): Promise<[Decimal, Decimal]>; /** * Get the raw rebalancing params given the strategy type */ readRebalancingParamsFromChain(strategy: PublicKey | StrategyWithAddress): Promise; /** * Get the raw rebalancing params given the strategy type */ readRebalancingStateFromChain(strategy: PublicKey | StrategyWithAddress): Promise; /** * Get the prices for rebalancing params (range and reset range, if strategy involves a reset range) */ readRebalancingParams(strategy: PublicKey | StrategyWithAddress): Promise; /** * Get the rebalancing params from chain, alongside the current details of the position, reset range, etc */ readRebalancingParamsWithState(strategy: PublicKey | StrategyWithAddress): Promise; /** * Get a list of updated rebalance field infos. * @param initialRebalanceFieldInfos the initial list of rebalance field infos * @param updatedFields the fields to be updated, with label and value * @returns list of RebalanceFieldInfo with updated values */ getUpdatedRebalanceFieldInfos(initialRebalanceFieldInfos: RebalanceFieldInfo[], updatedFields: InputRebalanceFieldInfo[]): RebalanceFieldInfo[]; getPriceRangePercentageBasedFromPrice(price: Decimal, lowerPriceBpsDifference: Decimal, upperPriceBpsDifference: Decimal): [Decimal, Decimal]; getOrcaPoolPrice(pool: PublicKey): Promise; getRaydiumPoolPrice(pool: PublicKey): Promise; getGenericPoolInfo(dex: Dex, pool: PublicKey): Promise; mintIsSupported: (collateralInfos: CollateralInfo[], tokenMint: PublicKey) => boolean; getCollateralInfoFromMint: (mint: PublicKey, collateralInfos: CollateralInfo[]) => CollateralInfo | undefined; getCollateralIdFromMint: (mint: PublicKey, collateralInfos: CollateralInfo[]) => number; getMainLookupTable: () => Promise; getInitLookupTableIx: (authority: PublicKey, slot?: number) => Promise<[TransactionInstruction, PublicKey]>; getPopulateLookupTableIxs: (authority: PublicKey, lookupTable: PublicKey, strategy: PublicKey | StrategyWithAddress) => Promise; getAddLookupTableEntriesIxs: (authority: PublicKey, lookupTable: PublicKey, entries: PublicKey[]) => TransactionInstruction[]; getLookupTable: (tablePk: PublicKey) => Promise; setupStrategyLookupTable: (authority: Keypair, strategy: PublicKey, slot?: number) => Promise; getTransactionV2Message: (payer: PublicKey, instructions: Array, lookupTables?: Array) => Promise; getTransactionV2MessageWithFetchedLookupTables: (payer: PublicKey, instructions: Array, lookupTables?: Array) => Promise; getEstimatedApyAndVolumeOnRange: (dex: Dex, pool: PublicKey, lowerPrice: Decimal, upperPrice: Decimal, _startDate: Date, _endDate: Date) => Promise; getEstimatedApyAndVolumeOnRangeOrca: (pool: PublicKey, lowerPrice: Decimal, upperPrice: Decimal) => Promise; getEstimatedApyAndVolumeOnRangeRaydium: (pool: PublicKey, lowerPrice: Decimal, upperPrice: Decimal) => Promise; getManualPoolSimulatedValues: (params: { pool: PublicKey; priceLower: Decimal; priceUpper: Decimal; startDate: string; endDate: string; }) => Promise; getPercentagePoolSimulatedValues: (params: SimulationPercentagePoolParameters) => Promise; /** * Get a list of transactions to rebalance a Kamino strategy. * @param strategy strategy pubkey or object * @param newPosition new liquidity position account pubkey * @param priceLower new position's lower price of the range * @param priceUpper new position's upper price of the range * @param payer transaction payer pubkey * @returns list of transactions to rebalance (executive withdraw, collect fees/rewards, open new position, invest) */ rebalance: (strategy: PublicKey | StrategyWithAddress, newPosition: PublicKey, priceLower: Decimal, priceUpper: Decimal, payer: PublicKey) => Promise; /** * Get a list of user's Kamino strategy positions * @param wallet user wallet address * @param strategyFilters * @returns list of kamino strategy positions */ getUserPositions: (wallet: PublicKey, strategyFilters?: StrategiesFilters) => Promise; /** * Get Kamino strategy vault APY/APR * @param strategy strategy pubkey or onchain state * @param orcaPools not required, but you can add orca whirlpools if you're caching them, and we don't refetch every time * @param raydiumPools not required, but you can add raydium pools if you're caching them, and we don't refetch every time */ getStrategyAprApy: (strategy: PublicKey | StrategyWithAddress, orcaPools?: OrcaPool[], raydiumPools?: Pool[]) => Promise; getStrategyPerformanceFees: (strategy: PublicKey | StrategyWithAddress, globalConfig?: GlobalConfig) => Promise; getLiquidityDistributionRaydiumPool: (pool: PublicKey, keepOrder?: boolean, lowestTick?: number, highestTick?: number) => Promise; getLiquidityDistributionOrcaWhirlpool: (pool: PublicKey, keepOrder?: boolean, lowestTick?: number, highestTick?: number) => Promise; getLiquidityDistribution: (dex: Dex, pool: PublicKey, keepOrder?: boolean, lowestTick?: number, highestTick?: number) => Promise; getPositionsCountForPool: (dex: Dex, pool: PublicKey) => Promise; getStrategyTokensHoldings: (strategy: PublicKey | StrategyWithAddress) => Promise; /** * Get ratio of total_a_in_strategy/total_b_in_strategy; if the total_b_in_strategy is 0 throws; * @param strategy * @param amountA */ getStrategyTokensRatio: (strategy: PublicKey | StrategyWithAddress) => Promise; calculateAmountsToBeDepositedWithSwap: (strategy: PublicKey | StrategyWithAddress, tokenAAmountUserDeposit: Decimal, tokenBAmountUserDeposit: Decimal, profiler?: ProfiledFunctionExecution, priceAInB?: Decimal) => Promise; calculateAmountsDistributionWithPriceRange: (dex: Dex, pool: PublicKey, lowerPrice: Decimal, upperPrice: Decimal) => Promise<[Decimal, Decimal]>; calculateAmountsToBeDeposited: (strategy: PublicKey | StrategyWithAddress, tokenAAmount?: Decimal, tokenBAmount?: Decimal, profiledFunctionExecution?: ProfiledFunctionExecution) => Promise<[Decimal, Decimal]>; calculateDepositAmountsProportional: (strategy: PublicKey | StrategyWithAddress, tokenAAmount?: Decimal, tokenBAmount?: Decimal, profiler?: ProfiledFunctionExecution) => Promise<[Decimal, Decimal]>; private calculateDepositAmountsProportionalWithTotalTokens; calculateDepostAmountsDollarBased: (strategy: PublicKey | StrategyWithAddress, tokenAAmount?: Decimal, tokenBAmount?: Decimal, profiledFunctionExecution?: ProfiledFunctionExecution) => Promise<[Decimal, Decimal]>; calculateAmountsOrca: ({ whirlpoolConfig, tokenAMint, tokenBMint, positionAddress, tokenAAmount, tokenBAmount, }: { whirlpoolConfig: PublicKey; tokenAMint: PublicKey; tokenBMint: PublicKey; positionAddress: PublicKey; tokenAAmount?: Decimal | undefined; tokenBAmount?: Decimal | undefined; }) => Promise<[Decimal, Decimal]>; calculateAmountsRaydium: ({ strategyState, tokenAAmount, tokenBAmount, }: { strategyState: WhirlpoolStrategy; tokenAAmount?: Decimal | undefined; tokenBAmount?: Decimal | undefined; }) => Promise<[Decimal, Decimal]>; /** * Get amounts of tokenA and tokenB to be deposited * @param strategy * @param amountA */ getDepositRatioFromTokenA: (strategy: PublicKey | StrategyWithAddress, amountA: BN) => Promise<{ amountSlippageA: BN; amountSlippageB: BN; }>; /** * Get amounts of tokenA and tokenB to be deposited * @param strategy * @param amountB */ getDepositRatioFromTokenB: (strategy: PublicKey | StrategyWithAddress, amountB: BN) => Promise<{ amountSlippageA: BN; amountSlippageB: BN; }>; /** * Get the on-chain state of the terms&conditions signature for the owner * @param owner */ getUserTermsSignatureState(owner: PublicKey): Promise; /** * Get the instruction to store the on chain owner signature of terms&conditions * @param owner * @param signature */ getUserTermsSignatureIx(owner: PublicKey, signature: Uint8Array): Promise; private getDepositRatioFromAOrca; private getDepositRatioFromBOrca; private getDepositRatioFromARaydium; private getDepositRatioFromBRaydium; getCollateralInfo: (collateralInfo: PublicKey) => Promise; getStrategyVaultBalances: (strategy: PublicKey | StrategyWithAddress) => Promise<{ aVault: Decimal; bVault: Decimal; }>; getUpdateStrategyParamsIxs: (strategyAdmin: PublicKey, strategy: PublicKey, rebalanceType: Decimal, depositCap?: Decimal, depositCapPerIx?: Decimal, depositFeeBps?: Decimal, withdrawFeeBps?: Decimal, performanceFeeBps?: Decimal) => Promise; getUpdateRewardsIxs: (strategyOwner: PublicKey, strategy: PublicKey) => Promise<[TransactionInstruction, Keypair][]>; initializeTickForOrcaPool: (payer: PublicKey, pool: PublicKey | WhirlpoolWithAddress, price: Decimal) => Promise; } export default Kamino;