From 1d42507022b2f49c25c3a3fdf6bb42522b11de4a Mon Sep 17 00:00:00 2001 From: Christian Krueger Date: Mon, 23 Dec 2024 10:04:32 -0700 Subject: [PATCH] updated clients --- clients/js/vault_client/errors/jitoVault.ts | 120 ++++----- .../instructions/initializeVault.ts | 73 +++++- .../src/generated/errors/jito_vault.rs | 235 +++++++++--------- .../instructions/initialize_vault.rs | 172 ++++++++++++- 4 files changed, 407 insertions(+), 193 deletions(-) diff --git a/clients/js/vault_client/errors/jitoVault.ts b/clients/js/vault_client/errors/jitoVault.ts index f930eb68..5ecee29f 100644 --- a/clients/js/vault_client/errors/jitoVault.ts +++ b/clients/js/vault_client/errors/jitoVault.ts @@ -16,122 +16,124 @@ import { JITO_VAULT_PROGRAM_ADDRESS } from '../programs'; /** VaultSlashUnderflow: VaultSlashUnderflow */ export const JITO_VAULT_ERROR__VAULT_SLASH_UNDERFLOW = 0x3e8; // 1000 +/** VaultInitialAmountFailed: VaultInitialAmountFailed */ +export const JITO_VAULT_ERROR__VAULT_INITIAL_AMOUNT_FAILED = 0x3e9; // 1001 /** VaultInsufficientFunds: VaultInsufficientFunds */ -export const JITO_VAULT_ERROR__VAULT_INSUFFICIENT_FUNDS = 0x3e9; // 1001 +export const JITO_VAULT_ERROR__VAULT_INSUFFICIENT_FUNDS = 0x3ea; // 1002 /** VaultOverflow: VaultOverflow */ -export const JITO_VAULT_ERROR__VAULT_OVERFLOW = 0x3ea; // 1002 +export const JITO_VAULT_ERROR__VAULT_OVERFLOW = 0x3eb; // 1003 /** VaultOperatorAdminInvalid: VaultOperatorAdminInvalid */ -export const JITO_VAULT_ERROR__VAULT_OPERATOR_ADMIN_INVALID = 0x3eb; // 1003 +export const JITO_VAULT_ERROR__VAULT_OPERATOR_ADMIN_INVALID = 0x3ec; // 1004 /** VaultAdminInvalid: VaultAdminInvalid */ -export const JITO_VAULT_ERROR__VAULT_ADMIN_INVALID = 0x3ec; // 1004 +export const JITO_VAULT_ERROR__VAULT_ADMIN_INVALID = 0x3ed; // 1005 /** VaultCapacityAdminInvalid: VaultCapacityAdminInvalid */ -export const JITO_VAULT_ERROR__VAULT_CAPACITY_ADMIN_INVALID = 0x3ed; // 1005 +export const JITO_VAULT_ERROR__VAULT_CAPACITY_ADMIN_INVALID = 0x3ee; // 1006 /** VaultMintBurnAdminInvalid: VaultMintBurnAdminInvalid */ -export const JITO_VAULT_ERROR__VAULT_MINT_BURN_ADMIN_INVALID = 0x3ee; // 1006 +export const JITO_VAULT_ERROR__VAULT_MINT_BURN_ADMIN_INVALID = 0x3ef; // 1007 /** VaultDelegationAdminInvalid: VaultDelegationAdminInvalid */ -export const JITO_VAULT_ERROR__VAULT_DELEGATION_ADMIN_INVALID = 0x3ef; // 1007 +export const JITO_VAULT_ERROR__VAULT_DELEGATION_ADMIN_INVALID = 0x3f0; // 1008 /** VaultDelegateAssetAdminInvalid: VaultDelegateAssetAdminInvalid */ -export const JITO_VAULT_ERROR__VAULT_DELEGATE_ASSET_ADMIN_INVALID = 0x3f0; // 1008 +export const JITO_VAULT_ERROR__VAULT_DELEGATE_ASSET_ADMIN_INVALID = 0x3f1; // 1009 /** VaultCapacityExceeded: VaultCapacityExceeded */ -export const JITO_VAULT_ERROR__VAULT_CAPACITY_EXCEEDED = 0x3f1; // 1009 +export const JITO_VAULT_ERROR__VAULT_CAPACITY_EXCEEDED = 0x3f2; // 1010 /** VaultSlasherAdminInvalid: VaultSlasherAdminInvalid */ -export const JITO_VAULT_ERROR__VAULT_SLASHER_ADMIN_INVALID = 0x3f2; // 1010 +export const JITO_VAULT_ERROR__VAULT_SLASHER_ADMIN_INVALID = 0x3f3; // 1011 /** VaultNcnAdminInvalid: VaultNcnAdminInvalid */ -export const JITO_VAULT_ERROR__VAULT_NCN_ADMIN_INVALID = 0x3f3; // 1011 +export const JITO_VAULT_ERROR__VAULT_NCN_ADMIN_INVALID = 0x3f4; // 1012 /** VaultFeeAdminInvalid: VaultFeeAdminInvalid */ -export const JITO_VAULT_ERROR__VAULT_FEE_ADMIN_INVALID = 0x3f4; // 1012 +export const JITO_VAULT_ERROR__VAULT_FEE_ADMIN_INVALID = 0x3f5; // 1013 /** ConfigAdminInvalid: ConfigAdminInvalid */ -export const JITO_VAULT_ERROR__CONFIG_ADMIN_INVALID = 0x3f5; // 1013 +export const JITO_VAULT_ERROR__CONFIG_ADMIN_INVALID = 0x3f6; // 1014 /** ConfigFeeAdminInvalid: ConfigFeeAdminInvalid */ -export const JITO_VAULT_ERROR__CONFIG_FEE_ADMIN_INVALID = 0x3f6; // 1014 +export const JITO_VAULT_ERROR__CONFIG_FEE_ADMIN_INVALID = 0x3f7; // 1015 /** VaultFeeCapExceeded: VaultFeeCapExceeded */ -export const JITO_VAULT_ERROR__VAULT_FEE_CAP_EXCEEDED = 0x3f7; // 1015 +export const JITO_VAULT_ERROR__VAULT_FEE_CAP_EXCEEDED = 0x3f8; // 1016 /** VaultFeeChangeTooSoon: VaultFeeChangeTooSoon */ -export const JITO_VAULT_ERROR__VAULT_FEE_CHANGE_TOO_SOON = 0x3f8; // 1016 +export const JITO_VAULT_ERROR__VAULT_FEE_CHANGE_TOO_SOON = 0x3f9; // 1017 /** VaultFeeBumpTooLarge: VaultFeeBumpTooLarge */ -export const JITO_VAULT_ERROR__VAULT_FEE_BUMP_TOO_LARGE = 0x3f9; // 1017 +export const JITO_VAULT_ERROR__VAULT_FEE_BUMP_TOO_LARGE = 0x3fa; // 1018 /** VaultUnderflow: VaultUnderflow */ -export const JITO_VAULT_ERROR__VAULT_UNDERFLOW = 0x3fa; // 1018 +export const JITO_VAULT_ERROR__VAULT_UNDERFLOW = 0x3fb; // 1019 /** VaultUpdateNeeded: VaultUpdateNeeded */ -export const JITO_VAULT_ERROR__VAULT_UPDATE_NEEDED = 0x3fb; // 1019 +export const JITO_VAULT_ERROR__VAULT_UPDATE_NEEDED = 0x3fc; // 1020 /** VaultIsUpdated: VaultIsUpdated */ -export const JITO_VAULT_ERROR__VAULT_IS_UPDATED = 0x3fc; // 1020 +export const JITO_VAULT_ERROR__VAULT_IS_UPDATED = 0x3fd; // 1021 /** VaultOperatorDelegationUpdateNeeded: VaultOperatorDelegationUpdateNeeded */ -export const JITO_VAULT_ERROR__VAULT_OPERATOR_DELEGATION_UPDATE_NEEDED = 0x3fd; // 1021 +export const JITO_VAULT_ERROR__VAULT_OPERATOR_DELEGATION_UPDATE_NEEDED = 0x3fe; // 1022 /** VaultOperatorDelegationIsUpdated: VaultOperatorDelegationIsUpdated */ -export const JITO_VAULT_ERROR__VAULT_OPERATOR_DELEGATION_IS_UPDATED = 0x3fe; // 1022 +export const JITO_VAULT_ERROR__VAULT_OPERATOR_DELEGATION_IS_UPDATED = 0x3ff; // 1023 /** VaultUpdateIncorrectIndex: VaultUpdateIncorrectIndex */ -export const JITO_VAULT_ERROR__VAULT_UPDATE_INCORRECT_INDEX = 0x3ff; // 1023 +export const JITO_VAULT_ERROR__VAULT_UPDATE_INCORRECT_INDEX = 0x400; // 1024 /** VaultUpdateStateNotFinishedUpdating: VaultUpdateStateNotFinishedUpdating */ -export const JITO_VAULT_ERROR__VAULT_UPDATE_STATE_NOT_FINISHED_UPDATING = 0x400; // 1024 +export const JITO_VAULT_ERROR__VAULT_UPDATE_STATE_NOT_FINISHED_UPDATING = 0x401; // 1025 /** VaultSecurityOverflow: VaultSecurityOverflow */ -export const JITO_VAULT_ERROR__VAULT_SECURITY_OVERFLOW = 0x401; // 1025 +export const JITO_VAULT_ERROR__VAULT_SECURITY_OVERFLOW = 0x402; // 1026 /** VaultSlashIncomplete: VaultSlashIncomplete */ -export const JITO_VAULT_ERROR__VAULT_SLASH_INCOMPLETE = 0x402; // 1026 +export const JITO_VAULT_ERROR__VAULT_SLASH_INCOMPLETE = 0x403; // 1027 /** VaultSecurityUnderflow: VaultSecurityUnderflow */ -export const JITO_VAULT_ERROR__VAULT_SECURITY_UNDERFLOW = 0x403; // 1027 +export const JITO_VAULT_ERROR__VAULT_SECURITY_UNDERFLOW = 0x404; // 1028 /** SlippageError: SlippageError */ -export const JITO_VAULT_ERROR__SLIPPAGE_ERROR = 0x404; // 1028 +export const JITO_VAULT_ERROR__SLIPPAGE_ERROR = 0x405; // 1029 /** VaultStakerWithdrawalTicketNotWithdrawable: VaultStakerWithdrawalTicketNotWithdrawable */ -export const JITO_VAULT_ERROR__VAULT_STAKER_WITHDRAWAL_TICKET_NOT_WITHDRAWABLE = 0x405; // 1029 +export const JITO_VAULT_ERROR__VAULT_STAKER_WITHDRAWAL_TICKET_NOT_WITHDRAWABLE = 0x406; // 1030 /** VaultNcnSlasherTicketFailedCooldown: VaultNcnSlasherTicketFailedCooldown */ -export const JITO_VAULT_ERROR__VAULT_NCN_SLASHER_TICKET_FAILED_COOLDOWN = 0x406; // 1030 +export const JITO_VAULT_ERROR__VAULT_NCN_SLASHER_TICKET_FAILED_COOLDOWN = 0x407; // 1031 /** VaultNcnSlasherTicketFailedWarmup: VaultNcnSlasherTicketFailedWarmup */ -export const JITO_VAULT_ERROR__VAULT_NCN_SLASHER_TICKET_FAILED_WARMUP = 0x407; // 1031 +export const JITO_VAULT_ERROR__VAULT_NCN_SLASHER_TICKET_FAILED_WARMUP = 0x408; // 1032 /** VaultNcnTicketFailedCooldown: VaultNcnTicketFailedCooldown */ -export const JITO_VAULT_ERROR__VAULT_NCN_TICKET_FAILED_COOLDOWN = 0x408; // 1032 +export const JITO_VAULT_ERROR__VAULT_NCN_TICKET_FAILED_COOLDOWN = 0x409; // 1033 /** VaultNcnTicketFailedWarmup: VaultNcnTicketFailedWarmup */ -export const JITO_VAULT_ERROR__VAULT_NCN_TICKET_FAILED_WARMUP = 0x409; // 1033 +export const JITO_VAULT_ERROR__VAULT_NCN_TICKET_FAILED_WARMUP = 0x40a; // 1034 /** VaultNcnTicketUnslashable: VaultNcnTicketUnslashable */ -export const JITO_VAULT_ERROR__VAULT_NCN_TICKET_UNSLASHABLE = 0x40a; // 1034 +export const JITO_VAULT_ERROR__VAULT_NCN_TICKET_UNSLASHABLE = 0x40b; // 1035 /** OperatorVaultTicketUnslashable: OperatorVaultTicketUnslashable */ -export const JITO_VAULT_ERROR__OPERATOR_VAULT_TICKET_UNSLASHABLE = 0x40b; // 1035 +export const JITO_VAULT_ERROR__OPERATOR_VAULT_TICKET_UNSLASHABLE = 0x40c; // 1036 /** NcnOperatorStateUnslashable: NcnOperatorStateUnslashable */ -export const JITO_VAULT_ERROR__NCN_OPERATOR_STATE_UNSLASHABLE = 0x40c; // 1036 +export const JITO_VAULT_ERROR__NCN_OPERATOR_STATE_UNSLASHABLE = 0x40d; // 1037 /** VaultNcnSlasherTicketUnslashable: VaultNcnSlasherTicketUnslashable */ -export const JITO_VAULT_ERROR__VAULT_NCN_SLASHER_TICKET_UNSLASHABLE = 0x40d; // 1037 +export const JITO_VAULT_ERROR__VAULT_NCN_SLASHER_TICKET_UNSLASHABLE = 0x40e; // 1038 /** NcnVaultTicketUnslashable: NcnVaultTicketUnslashable */ -export const JITO_VAULT_ERROR__NCN_VAULT_TICKET_UNSLASHABLE = 0x40e; // 1038 +export const JITO_VAULT_ERROR__NCN_VAULT_TICKET_UNSLASHABLE = 0x40f; // 1039 /** NcnVaultSlasherTicketUnslashable: NcnVaultSlasherTicketUnslashable */ -export const JITO_VAULT_ERROR__NCN_VAULT_SLASHER_TICKET_UNSLASHABLE = 0x40f; // 1039 +export const JITO_VAULT_ERROR__NCN_VAULT_SLASHER_TICKET_UNSLASHABLE = 0x410; // 1040 /** VaultMaxSlashedPerOperatorExceeded: VaultMaxSlashedPerOperatorExceeded */ -export const JITO_VAULT_ERROR__VAULT_MAX_SLASHED_PER_OPERATOR_EXCEEDED = 0x410; // 1040 +export const JITO_VAULT_ERROR__VAULT_MAX_SLASHED_PER_OPERATOR_EXCEEDED = 0x411; // 1041 /** VaultStakerWithdrawalTicketInvalidStaker: VaultStakerWithdrawalTicketInvalidStaker */ -export const JITO_VAULT_ERROR__VAULT_STAKER_WITHDRAWAL_TICKET_INVALID_STAKER = 0x411; // 1041 +export const JITO_VAULT_ERROR__VAULT_STAKER_WITHDRAWAL_TICKET_INVALID_STAKER = 0x412; // 1042 /** SlasherOverflow: SlasherOverflow */ -export const JITO_VAULT_ERROR__SLASHER_OVERFLOW = 0x412; // 1042 +export const JITO_VAULT_ERROR__SLASHER_OVERFLOW = 0x413; // 1043 /** NcnOverflow: NcnOverflow */ -export const JITO_VAULT_ERROR__NCN_OVERFLOW = 0x413; // 1043 +export const JITO_VAULT_ERROR__NCN_OVERFLOW = 0x414; // 1044 /** OperatorOverflow: OperatorOverflow */ -export const JITO_VAULT_ERROR__OPERATOR_OVERFLOW = 0x414; // 1044 +export const JITO_VAULT_ERROR__OPERATOR_OVERFLOW = 0x415; // 1045 /** VaultDelegationZero: VaultDelegationZero */ -export const JITO_VAULT_ERROR__VAULT_DELEGATION_ZERO = 0x415; // 1045 +export const JITO_VAULT_ERROR__VAULT_DELEGATION_ZERO = 0x416; // 1046 /** VaultCooldownZero: VaultCooldownZero */ -export const JITO_VAULT_ERROR__VAULT_COOLDOWN_ZERO = 0x416; // 1046 +export const JITO_VAULT_ERROR__VAULT_COOLDOWN_ZERO = 0x417; // 1047 /** VaultBurnZero: VaultBurnZero */ -export const JITO_VAULT_ERROR__VAULT_BURN_ZERO = 0x417; // 1047 +export const JITO_VAULT_ERROR__VAULT_BURN_ZERO = 0x418; // 1048 /** VaultEnqueueWithdrawalAmountZero: VaultEnqueueWithdrawalAmountZero */ -export const JITO_VAULT_ERROR__VAULT_ENQUEUE_WITHDRAWAL_AMOUNT_ZERO = 0x418; // 1048 +export const JITO_VAULT_ERROR__VAULT_ENQUEUE_WITHDRAWAL_AMOUNT_ZERO = 0x419; // 1049 /** VaultMintZero: VaultMintZero */ -export const JITO_VAULT_ERROR__VAULT_MINT_ZERO = 0x419; // 1049 +export const JITO_VAULT_ERROR__VAULT_MINT_ZERO = 0x41a; // 1050 /** VaultIsPaused: VaultIsPaused */ -export const JITO_VAULT_ERROR__VAULT_IS_PAUSED = 0x41a; // 1050 +export const JITO_VAULT_ERROR__VAULT_IS_PAUSED = 0x41b; // 1051 /** InvalidDepositor: InvalidDepositor */ -export const JITO_VAULT_ERROR__INVALID_DEPOSITOR = 0x41b; // 1051 +export const JITO_VAULT_ERROR__INVALID_DEPOSITOR = 0x41c; // 1052 /** InvalidDepositTokenAccount: InvalidDepositTokenAccount */ -export const JITO_VAULT_ERROR__INVALID_DEPOSIT_TOKEN_ACCOUNT = 0x41c; // 1052 +export const JITO_VAULT_ERROR__INVALID_DEPOSIT_TOKEN_ACCOUNT = 0x41d; // 1053 /** NoSupportedMintBalanceChange: NoSupportedMintBalanceChange */ -export const JITO_VAULT_ERROR__NO_SUPPORTED_MINT_BALANCE_CHANGE = 0x41d; // 1053 +export const JITO_VAULT_ERROR__NO_SUPPORTED_MINT_BALANCE_CHANGE = 0x41e; // 1054 /** InvalidEpochLength: InvalidEpochLength */ -export const JITO_VAULT_ERROR__INVALID_EPOCH_LENGTH = 0x41e; // 1054 +export const JITO_VAULT_ERROR__INVALID_EPOCH_LENGTH = 0x41f; // 1055 /** VaultRewardFeeDeltaTooLarge: VaultRewardFeeDeltaTooLarge */ -export const JITO_VAULT_ERROR__VAULT_REWARD_FEE_DELTA_TOO_LARGE = 0x41f; // 1055 +export const JITO_VAULT_ERROR__VAULT_REWARD_FEE_DELTA_TOO_LARGE = 0x420; // 1056 /** VaultRewardFeeIsZero: VaultRewardFeeIsZero */ -export const JITO_VAULT_ERROR__VAULT_REWARD_FEE_IS_ZERO = 0x420; // 1056 +export const JITO_VAULT_ERROR__VAULT_REWARD_FEE_IS_ZERO = 0x421; // 1057 /** VrtOutCannotBeZero: VrtOutCannotBeZero */ -export const JITO_VAULT_ERROR__VRT_OUT_CANNOT_BE_ZERO = 0x421; // 1057 +export const JITO_VAULT_ERROR__VRT_OUT_CANNOT_BE_ZERO = 0x422; // 1058 /** NonZeroAdditionalAssetsNeededForWithdrawalAtEndOfUpdate: NonZeroAdditionalAssetsNeededForWithdrawalAtEndOfUpdate */ -export const JITO_VAULT_ERROR__NON_ZERO_ADDITIONAL_ASSETS_NEEDED_FOR_WITHDRAWAL_AT_END_OF_UPDATE = 0x422; // 1058 +export const JITO_VAULT_ERROR__NON_ZERO_ADDITIONAL_ASSETS_NEEDED_FOR_WITHDRAWAL_AT_END_OF_UPDATE = 0x423; // 1059 /** ArithmeticOverflow: ArithmeticOverflow */ export const JITO_VAULT_ERROR__ARITHMETIC_OVERFLOW = 0xbb8; // 3000 /** ArithmeticUnderflow: ArithmeticUnderflow */ @@ -171,6 +173,7 @@ export type JitoVaultError = | typeof JITO_VAULT_ERROR__VAULT_FEE_BUMP_TOO_LARGE | typeof JITO_VAULT_ERROR__VAULT_FEE_CAP_EXCEEDED | typeof JITO_VAULT_ERROR__VAULT_FEE_CHANGE_TOO_SOON + | typeof JITO_VAULT_ERROR__VAULT_INITIAL_AMOUNT_FAILED | typeof JITO_VAULT_ERROR__VAULT_INSUFFICIENT_FUNDS | typeof JITO_VAULT_ERROR__VAULT_IS_PAUSED | typeof JITO_VAULT_ERROR__VAULT_IS_UPDATED @@ -237,6 +240,7 @@ if (process.env.NODE_ENV !== 'production') { [JITO_VAULT_ERROR__VAULT_FEE_BUMP_TOO_LARGE]: `VaultFeeBumpTooLarge`, [JITO_VAULT_ERROR__VAULT_FEE_CAP_EXCEEDED]: `VaultFeeCapExceeded`, [JITO_VAULT_ERROR__VAULT_FEE_CHANGE_TOO_SOON]: `VaultFeeChangeTooSoon`, + [JITO_VAULT_ERROR__VAULT_INITIAL_AMOUNT_FAILED]: `VaultInitialAmountFailed`, [JITO_VAULT_ERROR__VAULT_INSUFFICIENT_FUNDS]: `VaultInsufficientFunds`, [JITO_VAULT_ERROR__VAULT_IS_PAUSED]: `VaultIsPaused`, [JITO_VAULT_ERROR__VAULT_IS_UPDATED]: `VaultIsUpdated`, diff --git a/clients/js/vault_client/instructions/initializeVault.ts b/clients/js/vault_client/instructions/initializeVault.ts index 5d7e4bc0..b52bc738 100644 --- a/clients/js/vault_client/instructions/initializeVault.ts +++ b/clients/js/vault_client/instructions/initializeVault.ts @@ -12,6 +12,8 @@ import { getStructEncoder, getU16Decoder, getU16Encoder, + getU64Decoder, + getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder, @@ -47,6 +49,10 @@ export type InitializeVaultInstruction< TAccountStMint extends string | IAccountMeta = string, TAccountAdminStTokenAccount extends string | IAccountMeta = string, TAccountVaultStTokenAccount extends string | IAccountMeta = string, + TAccountBurnVault extends string | IAccountMeta = string, + TAccountBurnVaultVrtTokenAccount extends + | string + | IAccountMeta = string, TAccountAdmin extends string | IAccountMeta = string, TAccountBase extends string | IAccountMeta = string, TAccountSystemProgram extends @@ -55,6 +61,7 @@ export type InitializeVaultInstruction< TAccountTokenProgram extends | string | IAccountMeta = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', + TAccountAssociatedTokenProgram extends string | IAccountMeta = string, TRemainingAccounts extends readonly IAccountMeta[] = [], > = IInstruction & IInstructionWithData & @@ -79,6 +86,12 @@ export type InitializeVaultInstruction< TAccountVaultStTokenAccount extends string ? WritableAccount : TAccountVaultStTokenAccount, + TAccountBurnVault extends string + ? ReadonlyAccount + : TAccountBurnVault, + TAccountBurnVaultVrtTokenAccount extends string + ? WritableAccount + : TAccountBurnVaultVrtTokenAccount, TAccountAdmin extends string ? WritableSignerAccount & IAccountSignerMeta @@ -92,6 +105,9 @@ export type InitializeVaultInstruction< TAccountTokenProgram extends string ? ReadonlyAccount : TAccountTokenProgram, + TAccountAssociatedTokenProgram extends string + ? ReadonlyAccount + : TAccountAssociatedTokenProgram, ...TRemainingAccounts, ] >; @@ -102,6 +118,7 @@ export type InitializeVaultInstructionData = { withdrawalFeeBps: number; rewardFeeBps: number; decimals: number; + initializeTokenAmount: bigint; }; export type InitializeVaultInstructionDataArgs = { @@ -109,6 +126,7 @@ export type InitializeVaultInstructionDataArgs = { withdrawalFeeBps: number; rewardFeeBps: number; decimals: number; + initializeTokenAmount: number | bigint; }; export function getInitializeVaultInstructionDataEncoder(): Encoder { @@ -119,6 +137,7 @@ export function getInitializeVaultInstructionDataEncoder(): Encoder ({ ...value, discriminator: INITIALIZE_VAULT_DISCRIMINATOR }) ); @@ -131,6 +150,7 @@ export function getInitializeVaultInstructionDataDecoder(): Decoder = { config: Address; vault: Address; @@ -162,14 +185,18 @@ export type InitializeVaultInput< stMint: Address; adminStTokenAccount: Address; vaultStTokenAccount: Address; + burnVault: Address; + burnVaultVrtTokenAccount: Address; admin: TransactionSigner; base: TransactionSigner; systemProgram?: Address; tokenProgram?: Address; + associatedTokenProgram: Address; depositFeeBps: InitializeVaultInstructionDataArgs['depositFeeBps']; withdrawalFeeBps: InitializeVaultInstructionDataArgs['withdrawalFeeBps']; rewardFeeBps: InitializeVaultInstructionDataArgs['rewardFeeBps']; decimals: InitializeVaultInstructionDataArgs['decimals']; + initializeTokenAmount: InitializeVaultInstructionDataArgs['initializeTokenAmount']; }; export function getInitializeVaultInstruction< @@ -179,10 +206,13 @@ export function getInitializeVaultInstruction< TAccountStMint extends string, TAccountAdminStTokenAccount extends string, TAccountVaultStTokenAccount extends string, + TAccountBurnVault extends string, + TAccountBurnVaultVrtTokenAccount extends string, TAccountAdmin extends string, TAccountBase extends string, TAccountSystemProgram extends string, TAccountTokenProgram extends string, + TAccountAssociatedTokenProgram extends string, >( input: InitializeVaultInput< TAccountConfig, @@ -191,10 +221,13 @@ export function getInitializeVaultInstruction< TAccountStMint, TAccountAdminStTokenAccount, TAccountVaultStTokenAccount, + TAccountBurnVault, + TAccountBurnVaultVrtTokenAccount, TAccountAdmin, TAccountBase, TAccountSystemProgram, - TAccountTokenProgram + TAccountTokenProgram, + TAccountAssociatedTokenProgram > ): InitializeVaultInstruction< typeof JITO_VAULT_PROGRAM_ADDRESS, @@ -204,10 +237,13 @@ export function getInitializeVaultInstruction< TAccountStMint, TAccountAdminStTokenAccount, TAccountVaultStTokenAccount, + TAccountBurnVault, + TAccountBurnVaultVrtTokenAccount, TAccountAdmin, TAccountBase, TAccountSystemProgram, - TAccountTokenProgram + TAccountTokenProgram, + TAccountAssociatedTokenProgram > { // Program address. const programAddress = JITO_VAULT_PROGRAM_ADDRESS; @@ -226,10 +262,19 @@ export function getInitializeVaultInstruction< value: input.vaultStTokenAccount ?? null, isWritable: true, }, + burnVault: { value: input.burnVault ?? null, isWritable: false }, + burnVaultVrtTokenAccount: { + value: input.burnVaultVrtTokenAccount ?? null, + isWritable: true, + }, admin: { value: input.admin ?? null, isWritable: true }, base: { value: input.base ?? null, isWritable: false }, systemProgram: { value: input.systemProgram ?? null, isWritable: false }, tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }, + associatedTokenProgram: { + value: input.associatedTokenProgram ?? null, + isWritable: false, + }, }; const accounts = originalAccounts as Record< keyof typeof originalAccounts, @@ -258,10 +303,13 @@ export function getInitializeVaultInstruction< getAccountMeta(accounts.stMint), getAccountMeta(accounts.adminStTokenAccount), getAccountMeta(accounts.vaultStTokenAccount), + getAccountMeta(accounts.burnVault), + getAccountMeta(accounts.burnVaultVrtTokenAccount), getAccountMeta(accounts.admin), getAccountMeta(accounts.base), getAccountMeta(accounts.systemProgram), getAccountMeta(accounts.tokenProgram), + getAccountMeta(accounts.associatedTokenProgram), ], programAddress, data: getInitializeVaultInstructionDataEncoder().encode( @@ -275,10 +323,13 @@ export function getInitializeVaultInstruction< TAccountStMint, TAccountAdminStTokenAccount, TAccountVaultStTokenAccount, + TAccountBurnVault, + TAccountBurnVaultVrtTokenAccount, TAccountAdmin, TAccountBase, TAccountSystemProgram, - TAccountTokenProgram + TAccountTokenProgram, + TAccountAssociatedTokenProgram >; return instruction; @@ -296,10 +347,13 @@ export type ParsedInitializeVaultInstruction< stMint: TAccountMetas[3]; adminStTokenAccount: TAccountMetas[4]; vaultStTokenAccount: TAccountMetas[5]; - admin: TAccountMetas[6]; - base: TAccountMetas[7]; - systemProgram: TAccountMetas[8]; - tokenProgram: TAccountMetas[9]; + burnVault: TAccountMetas[6]; + burnVaultVrtTokenAccount: TAccountMetas[7]; + admin: TAccountMetas[8]; + base: TAccountMetas[9]; + systemProgram: TAccountMetas[10]; + tokenProgram: TAccountMetas[11]; + associatedTokenProgram: TAccountMetas[12]; }; data: InitializeVaultInstructionData; }; @@ -312,7 +366,7 @@ export function parseInitializeVaultInstruction< IInstructionWithAccounts & IInstructionWithData ): ParsedInitializeVaultInstruction { - if (instruction.accounts.length < 10) { + if (instruction.accounts.length < 13) { // TODO: Coded error. throw new Error('Not enough accounts'); } @@ -331,10 +385,13 @@ export function parseInitializeVaultInstruction< stMint: getNextAccount(), adminStTokenAccount: getNextAccount(), vaultStTokenAccount: getNextAccount(), + burnVault: getNextAccount(), + burnVaultVrtTokenAccount: getNextAccount(), admin: getNextAccount(), base: getNextAccount(), systemProgram: getNextAccount(), tokenProgram: getNextAccount(), + associatedTokenProgram: getNextAccount(), }, data: getInitializeVaultInstructionDataDecoder().decode(instruction.data), }; diff --git a/clients/rust/vault_client/src/generated/errors/jito_vault.rs b/clients/rust/vault_client/src/generated/errors/jito_vault.rs index 2b83d2cc..18c67454 100644 --- a/clients/rust/vault_client/src/generated/errors/jito_vault.rs +++ b/clients/rust/vault_client/src/generated/errors/jito_vault.rs @@ -12,180 +12,183 @@ pub enum JitoVaultError { /// 1000 - VaultSlashUnderflow #[error("VaultSlashUnderflow")] VaultSlashUnderflow = 0x3E8, - /// 1001 - VaultInsufficientFunds + /// 1001 - VaultInitialAmountFailed + #[error("VaultInitialAmountFailed")] + VaultInitialAmountFailed = 0x3E9, + /// 1002 - VaultInsufficientFunds #[error("VaultInsufficientFunds")] - VaultInsufficientFunds = 0x3E9, - /// 1002 - VaultOverflow + VaultInsufficientFunds = 0x3EA, + /// 1003 - VaultOverflow #[error("VaultOverflow")] - VaultOverflow = 0x3EA, - /// 1003 - VaultOperatorAdminInvalid + VaultOverflow = 0x3EB, + /// 1004 - VaultOperatorAdminInvalid #[error("VaultOperatorAdminInvalid")] - VaultOperatorAdminInvalid = 0x3EB, - /// 1004 - VaultAdminInvalid + VaultOperatorAdminInvalid = 0x3EC, + /// 1005 - VaultAdminInvalid #[error("VaultAdminInvalid")] - VaultAdminInvalid = 0x3EC, - /// 1005 - VaultCapacityAdminInvalid + VaultAdminInvalid = 0x3ED, + /// 1006 - VaultCapacityAdminInvalid #[error("VaultCapacityAdminInvalid")] - VaultCapacityAdminInvalid = 0x3ED, - /// 1006 - VaultMintBurnAdminInvalid + VaultCapacityAdminInvalid = 0x3EE, + /// 1007 - VaultMintBurnAdminInvalid #[error("VaultMintBurnAdminInvalid")] - VaultMintBurnAdminInvalid = 0x3EE, - /// 1007 - VaultDelegationAdminInvalid + VaultMintBurnAdminInvalid = 0x3EF, + /// 1008 - VaultDelegationAdminInvalid #[error("VaultDelegationAdminInvalid")] - VaultDelegationAdminInvalid = 0x3EF, - /// 1008 - VaultDelegateAssetAdminInvalid + VaultDelegationAdminInvalid = 0x3F0, + /// 1009 - VaultDelegateAssetAdminInvalid #[error("VaultDelegateAssetAdminInvalid")] - VaultDelegateAssetAdminInvalid = 0x3F0, - /// 1009 - VaultCapacityExceeded + VaultDelegateAssetAdminInvalid = 0x3F1, + /// 1010 - VaultCapacityExceeded #[error("VaultCapacityExceeded")] - VaultCapacityExceeded = 0x3F1, - /// 1010 - VaultSlasherAdminInvalid + VaultCapacityExceeded = 0x3F2, + /// 1011 - VaultSlasherAdminInvalid #[error("VaultSlasherAdminInvalid")] - VaultSlasherAdminInvalid = 0x3F2, - /// 1011 - VaultNcnAdminInvalid + VaultSlasherAdminInvalid = 0x3F3, + /// 1012 - VaultNcnAdminInvalid #[error("VaultNcnAdminInvalid")] - VaultNcnAdminInvalid = 0x3F3, - /// 1012 - VaultFeeAdminInvalid + VaultNcnAdminInvalid = 0x3F4, + /// 1013 - VaultFeeAdminInvalid #[error("VaultFeeAdminInvalid")] - VaultFeeAdminInvalid = 0x3F4, - /// 1013 - ConfigAdminInvalid + VaultFeeAdminInvalid = 0x3F5, + /// 1014 - ConfigAdminInvalid #[error("ConfigAdminInvalid")] - ConfigAdminInvalid = 0x3F5, - /// 1014 - ConfigFeeAdminInvalid + ConfigAdminInvalid = 0x3F6, + /// 1015 - ConfigFeeAdminInvalid #[error("ConfigFeeAdminInvalid")] - ConfigFeeAdminInvalid = 0x3F6, - /// 1015 - VaultFeeCapExceeded + ConfigFeeAdminInvalid = 0x3F7, + /// 1016 - VaultFeeCapExceeded #[error("VaultFeeCapExceeded")] - VaultFeeCapExceeded = 0x3F7, - /// 1016 - VaultFeeChangeTooSoon + VaultFeeCapExceeded = 0x3F8, + /// 1017 - VaultFeeChangeTooSoon #[error("VaultFeeChangeTooSoon")] - VaultFeeChangeTooSoon = 0x3F8, - /// 1017 - VaultFeeBumpTooLarge + VaultFeeChangeTooSoon = 0x3F9, + /// 1018 - VaultFeeBumpTooLarge #[error("VaultFeeBumpTooLarge")] - VaultFeeBumpTooLarge = 0x3F9, - /// 1018 - VaultUnderflow + VaultFeeBumpTooLarge = 0x3FA, + /// 1019 - VaultUnderflow #[error("VaultUnderflow")] - VaultUnderflow = 0x3FA, - /// 1019 - VaultUpdateNeeded + VaultUnderflow = 0x3FB, + /// 1020 - VaultUpdateNeeded #[error("VaultUpdateNeeded")] - VaultUpdateNeeded = 0x3FB, - /// 1020 - VaultIsUpdated + VaultUpdateNeeded = 0x3FC, + /// 1021 - VaultIsUpdated #[error("VaultIsUpdated")] - VaultIsUpdated = 0x3FC, - /// 1021 - VaultOperatorDelegationUpdateNeeded + VaultIsUpdated = 0x3FD, + /// 1022 - VaultOperatorDelegationUpdateNeeded #[error("VaultOperatorDelegationUpdateNeeded")] - VaultOperatorDelegationUpdateNeeded = 0x3FD, - /// 1022 - VaultOperatorDelegationIsUpdated + VaultOperatorDelegationUpdateNeeded = 0x3FE, + /// 1023 - VaultOperatorDelegationIsUpdated #[error("VaultOperatorDelegationIsUpdated")] - VaultOperatorDelegationIsUpdated = 0x3FE, - /// 1023 - VaultUpdateIncorrectIndex + VaultOperatorDelegationIsUpdated = 0x3FF, + /// 1024 - VaultUpdateIncorrectIndex #[error("VaultUpdateIncorrectIndex")] - VaultUpdateIncorrectIndex = 0x3FF, - /// 1024 - VaultUpdateStateNotFinishedUpdating + VaultUpdateIncorrectIndex = 0x400, + /// 1025 - VaultUpdateStateNotFinishedUpdating #[error("VaultUpdateStateNotFinishedUpdating")] - VaultUpdateStateNotFinishedUpdating = 0x400, - /// 1025 - VaultSecurityOverflow + VaultUpdateStateNotFinishedUpdating = 0x401, + /// 1026 - VaultSecurityOverflow #[error("VaultSecurityOverflow")] - VaultSecurityOverflow = 0x401, - /// 1026 - VaultSlashIncomplete + VaultSecurityOverflow = 0x402, + /// 1027 - VaultSlashIncomplete #[error("VaultSlashIncomplete")] - VaultSlashIncomplete = 0x402, - /// 1027 - VaultSecurityUnderflow + VaultSlashIncomplete = 0x403, + /// 1028 - VaultSecurityUnderflow #[error("VaultSecurityUnderflow")] - VaultSecurityUnderflow = 0x403, - /// 1028 - SlippageError + VaultSecurityUnderflow = 0x404, + /// 1029 - SlippageError #[error("SlippageError")] - SlippageError = 0x404, - /// 1029 - VaultStakerWithdrawalTicketNotWithdrawable + SlippageError = 0x405, + /// 1030 - VaultStakerWithdrawalTicketNotWithdrawable #[error("VaultStakerWithdrawalTicketNotWithdrawable")] - VaultStakerWithdrawalTicketNotWithdrawable = 0x405, - /// 1030 - VaultNcnSlasherTicketFailedCooldown + VaultStakerWithdrawalTicketNotWithdrawable = 0x406, + /// 1031 - VaultNcnSlasherTicketFailedCooldown #[error("VaultNcnSlasherTicketFailedCooldown")] - VaultNcnSlasherTicketFailedCooldown = 0x406, - /// 1031 - VaultNcnSlasherTicketFailedWarmup + VaultNcnSlasherTicketFailedCooldown = 0x407, + /// 1032 - VaultNcnSlasherTicketFailedWarmup #[error("VaultNcnSlasherTicketFailedWarmup")] - VaultNcnSlasherTicketFailedWarmup = 0x407, - /// 1032 - VaultNcnTicketFailedCooldown + VaultNcnSlasherTicketFailedWarmup = 0x408, + /// 1033 - VaultNcnTicketFailedCooldown #[error("VaultNcnTicketFailedCooldown")] - VaultNcnTicketFailedCooldown = 0x408, - /// 1033 - VaultNcnTicketFailedWarmup + VaultNcnTicketFailedCooldown = 0x409, + /// 1034 - VaultNcnTicketFailedWarmup #[error("VaultNcnTicketFailedWarmup")] - VaultNcnTicketFailedWarmup = 0x409, - /// 1034 - VaultNcnTicketUnslashable + VaultNcnTicketFailedWarmup = 0x40A, + /// 1035 - VaultNcnTicketUnslashable #[error("VaultNcnTicketUnslashable")] - VaultNcnTicketUnslashable = 0x40A, - /// 1035 - OperatorVaultTicketUnslashable + VaultNcnTicketUnslashable = 0x40B, + /// 1036 - OperatorVaultTicketUnslashable #[error("OperatorVaultTicketUnslashable")] - OperatorVaultTicketUnslashable = 0x40B, - /// 1036 - NcnOperatorStateUnslashable + OperatorVaultTicketUnslashable = 0x40C, + /// 1037 - NcnOperatorStateUnslashable #[error("NcnOperatorStateUnslashable")] - NcnOperatorStateUnslashable = 0x40C, - /// 1037 - VaultNcnSlasherTicketUnslashable + NcnOperatorStateUnslashable = 0x40D, + /// 1038 - VaultNcnSlasherTicketUnslashable #[error("VaultNcnSlasherTicketUnslashable")] - VaultNcnSlasherTicketUnslashable = 0x40D, - /// 1038 - NcnVaultTicketUnslashable + VaultNcnSlasherTicketUnslashable = 0x40E, + /// 1039 - NcnVaultTicketUnslashable #[error("NcnVaultTicketUnslashable")] - NcnVaultTicketUnslashable = 0x40E, - /// 1039 - NcnVaultSlasherTicketUnslashable + NcnVaultTicketUnslashable = 0x40F, + /// 1040 - NcnVaultSlasherTicketUnslashable #[error("NcnVaultSlasherTicketUnslashable")] - NcnVaultSlasherTicketUnslashable = 0x40F, - /// 1040 - VaultMaxSlashedPerOperatorExceeded + NcnVaultSlasherTicketUnslashable = 0x410, + /// 1041 - VaultMaxSlashedPerOperatorExceeded #[error("VaultMaxSlashedPerOperatorExceeded")] - VaultMaxSlashedPerOperatorExceeded = 0x410, - /// 1041 - VaultStakerWithdrawalTicketInvalidStaker + VaultMaxSlashedPerOperatorExceeded = 0x411, + /// 1042 - VaultStakerWithdrawalTicketInvalidStaker #[error("VaultStakerWithdrawalTicketInvalidStaker")] - VaultStakerWithdrawalTicketInvalidStaker = 0x411, - /// 1042 - SlasherOverflow + VaultStakerWithdrawalTicketInvalidStaker = 0x412, + /// 1043 - SlasherOverflow #[error("SlasherOverflow")] - SlasherOverflow = 0x412, - /// 1043 - NcnOverflow + SlasherOverflow = 0x413, + /// 1044 - NcnOverflow #[error("NcnOverflow")] - NcnOverflow = 0x413, - /// 1044 - OperatorOverflow + NcnOverflow = 0x414, + /// 1045 - OperatorOverflow #[error("OperatorOverflow")] - OperatorOverflow = 0x414, - /// 1045 - VaultDelegationZero + OperatorOverflow = 0x415, + /// 1046 - VaultDelegationZero #[error("VaultDelegationZero")] - VaultDelegationZero = 0x415, - /// 1046 - VaultCooldownZero + VaultDelegationZero = 0x416, + /// 1047 - VaultCooldownZero #[error("VaultCooldownZero")] - VaultCooldownZero = 0x416, - /// 1047 - VaultBurnZero + VaultCooldownZero = 0x417, + /// 1048 - VaultBurnZero #[error("VaultBurnZero")] - VaultBurnZero = 0x417, - /// 1048 - VaultEnqueueWithdrawalAmountZero + VaultBurnZero = 0x418, + /// 1049 - VaultEnqueueWithdrawalAmountZero #[error("VaultEnqueueWithdrawalAmountZero")] - VaultEnqueueWithdrawalAmountZero = 0x418, - /// 1049 - VaultMintZero + VaultEnqueueWithdrawalAmountZero = 0x419, + /// 1050 - VaultMintZero #[error("VaultMintZero")] - VaultMintZero = 0x419, - /// 1050 - VaultIsPaused + VaultMintZero = 0x41A, + /// 1051 - VaultIsPaused #[error("VaultIsPaused")] - VaultIsPaused = 0x41A, - /// 1051 - InvalidDepositor + VaultIsPaused = 0x41B, + /// 1052 - InvalidDepositor #[error("InvalidDepositor")] - InvalidDepositor = 0x41B, - /// 1052 - InvalidDepositTokenAccount + InvalidDepositor = 0x41C, + /// 1053 - InvalidDepositTokenAccount #[error("InvalidDepositTokenAccount")] - InvalidDepositTokenAccount = 0x41C, - /// 1053 - NoSupportedMintBalanceChange + InvalidDepositTokenAccount = 0x41D, + /// 1054 - NoSupportedMintBalanceChange #[error("NoSupportedMintBalanceChange")] - NoSupportedMintBalanceChange = 0x41D, - /// 1054 - InvalidEpochLength + NoSupportedMintBalanceChange = 0x41E, + /// 1055 - InvalidEpochLength #[error("InvalidEpochLength")] - InvalidEpochLength = 0x41E, - /// 1055 - VaultRewardFeeDeltaTooLarge + InvalidEpochLength = 0x41F, + /// 1056 - VaultRewardFeeDeltaTooLarge #[error("VaultRewardFeeDeltaTooLarge")] - VaultRewardFeeDeltaTooLarge = 0x41F, - /// 1056 - VaultRewardFeeIsZero + VaultRewardFeeDeltaTooLarge = 0x420, + /// 1057 - VaultRewardFeeIsZero #[error("VaultRewardFeeIsZero")] - VaultRewardFeeIsZero = 0x420, - /// 1057 - VrtOutCannotBeZero + VaultRewardFeeIsZero = 0x421, + /// 1058 - VrtOutCannotBeZero #[error("VrtOutCannotBeZero")] - VrtOutCannotBeZero = 0x421, - /// 1058 - NonZeroAdditionalAssetsNeededForWithdrawalAtEndOfUpdate + VrtOutCannotBeZero = 0x422, + /// 1059 - NonZeroAdditionalAssetsNeededForWithdrawalAtEndOfUpdate #[error("NonZeroAdditionalAssetsNeededForWithdrawalAtEndOfUpdate")] - NonZeroAdditionalAssetsNeededForWithdrawalAtEndOfUpdate = 0x422, + NonZeroAdditionalAssetsNeededForWithdrawalAtEndOfUpdate = 0x423, /// 3000 - ArithmeticOverflow #[error("ArithmeticOverflow")] ArithmeticOverflow = 0xBB8, diff --git a/clients/rust/vault_client/src/generated/instructions/initialize_vault.rs b/clients/rust/vault_client/src/generated/instructions/initialize_vault.rs index 54ee99e4..4466ab96 100644 --- a/clients/rust/vault_client/src/generated/instructions/initialize_vault.rs +++ b/clients/rust/vault_client/src/generated/instructions/initialize_vault.rs @@ -20,6 +20,10 @@ pub struct InitializeVault { pub vault_st_token_account: solana_program::pubkey::Pubkey, + pub burn_vault: solana_program::pubkey::Pubkey, + + pub burn_vault_vrt_token_account: solana_program::pubkey::Pubkey, + pub admin: solana_program::pubkey::Pubkey, pub base: solana_program::pubkey::Pubkey, @@ -27,6 +31,8 @@ pub struct InitializeVault { pub system_program: solana_program::pubkey::Pubkey, pub token_program: solana_program::pubkey::Pubkey, + + pub associated_token_program: solana_program::pubkey::Pubkey, } impl InitializeVault { @@ -42,7 +48,7 @@ impl InitializeVault { args: InitializeVaultInstructionArgs, remaining_accounts: &[solana_program::instruction::AccountMeta], ) -> solana_program::instruction::Instruction { - let mut accounts = Vec::with_capacity(10 + remaining_accounts.len()); + let mut accounts = Vec::with_capacity(13 + remaining_accounts.len()); accounts.push(solana_program::instruction::AccountMeta::new( self.config, false, @@ -66,6 +72,14 @@ impl InitializeVault { self.vault_st_token_account, false, )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.burn_vault, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.burn_vault_vrt_token_account, + false, + )); accounts.push(solana_program::instruction::AccountMeta::new( self.admin, true, )); @@ -80,6 +94,10 @@ impl InitializeVault { self.token_program, false, )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.associated_token_program, + false, + )); accounts.extend_from_slice(remaining_accounts); let mut data = InitializeVaultInstructionData::new().try_to_vec().unwrap(); let mut args = args.try_to_vec().unwrap(); @@ -117,6 +135,7 @@ pub struct InitializeVaultInstructionArgs { pub withdrawal_fee_bps: u16, pub reward_fee_bps: u16, pub decimals: u8, + pub initialize_token_amount: u64, } /// Instruction builder for `InitializeVault`. @@ -129,10 +148,13 @@ pub struct InitializeVaultInstructionArgs { /// 3. `[]` st_mint /// 4. `[writable]` admin_st_token_account /// 5. `[writable]` vault_st_token_account -/// 6. `[writable, signer]` admin -/// 7. `[signer]` base -/// 8. `[optional]` system_program (default to `11111111111111111111111111111111`) -/// 9. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`) +/// 6. `[]` burn_vault +/// 7. `[writable]` burn_vault_vrt_token_account +/// 8. `[writable, signer]` admin +/// 9. `[signer]` base +/// 10. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 11. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`) +/// 12. `[]` associated_token_program #[derive(Clone, Debug, Default)] pub struct InitializeVaultBuilder { config: Option, @@ -141,14 +163,18 @@ pub struct InitializeVaultBuilder { st_mint: Option, admin_st_token_account: Option, vault_st_token_account: Option, + burn_vault: Option, + burn_vault_vrt_token_account: Option, admin: Option, base: Option, system_program: Option, token_program: Option, + associated_token_program: Option, deposit_fee_bps: Option, withdrawal_fee_bps: Option, reward_fee_bps: Option, decimals: Option, + initialize_token_amount: Option, __remaining_accounts: Vec, } @@ -193,6 +219,19 @@ impl InitializeVaultBuilder { self } #[inline(always)] + pub fn burn_vault(&mut self, burn_vault: solana_program::pubkey::Pubkey) -> &mut Self { + self.burn_vault = Some(burn_vault); + self + } + #[inline(always)] + pub fn burn_vault_vrt_token_account( + &mut self, + burn_vault_vrt_token_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.burn_vault_vrt_token_account = Some(burn_vault_vrt_token_account); + self + } + #[inline(always)] pub fn admin(&mut self, admin: solana_program::pubkey::Pubkey) -> &mut Self { self.admin = Some(admin); self @@ -215,6 +254,14 @@ impl InitializeVaultBuilder { self } #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] pub fn deposit_fee_bps(&mut self, deposit_fee_bps: u16) -> &mut Self { self.deposit_fee_bps = Some(deposit_fee_bps); self @@ -234,6 +281,11 @@ impl InitializeVaultBuilder { self.decimals = Some(decimals); self } + #[inline(always)] + pub fn initialize_token_amount(&mut self, initialize_token_amount: u64) -> &mut Self { + self.initialize_token_amount = Some(initialize_token_amount); + self + } /// Add an aditional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -265,6 +317,10 @@ impl InitializeVaultBuilder { vault_st_token_account: self .vault_st_token_account .expect("vault_st_token_account is not set"), + burn_vault: self.burn_vault.expect("burn_vault is not set"), + burn_vault_vrt_token_account: self + .burn_vault_vrt_token_account + .expect("burn_vault_vrt_token_account is not set"), admin: self.admin.expect("admin is not set"), base: self.base.expect("base is not set"), system_program: self @@ -273,6 +329,9 @@ impl InitializeVaultBuilder { token_program: self.token_program.unwrap_or(solana_program::pubkey!( "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" )), + associated_token_program: self + .associated_token_program + .expect("associated_token_program is not set"), }; let args = InitializeVaultInstructionArgs { deposit_fee_bps: self @@ -288,6 +347,10 @@ impl InitializeVaultBuilder { .clone() .expect("reward_fee_bps is not set"), decimals: self.decimals.clone().expect("decimals is not set"), + initialize_token_amount: self + .initialize_token_amount + .clone() + .expect("initialize_token_amount is not set"), }; accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) @@ -308,6 +371,10 @@ pub struct InitializeVaultCpiAccounts<'a, 'b> { pub vault_st_token_account: &'b solana_program::account_info::AccountInfo<'a>, + pub burn_vault: &'b solana_program::account_info::AccountInfo<'a>, + + pub burn_vault_vrt_token_account: &'b solana_program::account_info::AccountInfo<'a>, + pub admin: &'b solana_program::account_info::AccountInfo<'a>, pub base: &'b solana_program::account_info::AccountInfo<'a>, @@ -315,6 +382,8 @@ pub struct InitializeVaultCpiAccounts<'a, 'b> { pub system_program: &'b solana_program::account_info::AccountInfo<'a>, pub token_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>, } /// `initialize_vault` CPI instruction. @@ -334,6 +403,10 @@ pub struct InitializeVaultCpi<'a, 'b> { pub vault_st_token_account: &'b solana_program::account_info::AccountInfo<'a>, + pub burn_vault: &'b solana_program::account_info::AccountInfo<'a>, + + pub burn_vault_vrt_token_account: &'b solana_program::account_info::AccountInfo<'a>, + pub admin: &'b solana_program::account_info::AccountInfo<'a>, pub base: &'b solana_program::account_info::AccountInfo<'a>, @@ -341,6 +414,8 @@ pub struct InitializeVaultCpi<'a, 'b> { pub system_program: &'b solana_program::account_info::AccountInfo<'a>, pub token_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>, /// The arguments for the instruction. pub __args: InitializeVaultInstructionArgs, } @@ -359,10 +434,13 @@ impl<'a, 'b> InitializeVaultCpi<'a, 'b> { st_mint: accounts.st_mint, admin_st_token_account: accounts.admin_st_token_account, vault_st_token_account: accounts.vault_st_token_account, + burn_vault: accounts.burn_vault, + burn_vault_vrt_token_account: accounts.burn_vault_vrt_token_account, admin: accounts.admin, base: accounts.base, system_program: accounts.system_program, token_program: accounts.token_program, + associated_token_program: accounts.associated_token_program, __args: args, } } @@ -399,7 +477,7 @@ impl<'a, 'b> InitializeVaultCpi<'a, 'b> { bool, )], ) -> solana_program::entrypoint::ProgramResult { - let mut accounts = Vec::with_capacity(10 + remaining_accounts.len()); + let mut accounts = Vec::with_capacity(13 + remaining_accounts.len()); accounts.push(solana_program::instruction::AccountMeta::new( *self.config.key, false, @@ -424,6 +502,14 @@ impl<'a, 'b> InitializeVaultCpi<'a, 'b> { *self.vault_st_token_account.key, false, )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.burn_vault.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.burn_vault_vrt_token_account.key, + false, + )); accounts.push(solana_program::instruction::AccountMeta::new( *self.admin.key, true, @@ -440,6 +526,10 @@ impl<'a, 'b> InitializeVaultCpi<'a, 'b> { *self.token_program.key, false, )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.associated_token_program.key, + false, + )); remaining_accounts.iter().for_each(|remaining_account| { accounts.push(solana_program::instruction::AccountMeta { pubkey: *remaining_account.0.key, @@ -456,7 +546,7 @@ impl<'a, 'b> InitializeVaultCpi<'a, 'b> { accounts, data, }; - let mut account_infos = Vec::with_capacity(10 + 1 + remaining_accounts.len()); + let mut account_infos = Vec::with_capacity(13 + 1 + remaining_accounts.len()); account_infos.push(self.__program.clone()); account_infos.push(self.config.clone()); account_infos.push(self.vault.clone()); @@ -464,10 +554,13 @@ impl<'a, 'b> InitializeVaultCpi<'a, 'b> { account_infos.push(self.st_mint.clone()); account_infos.push(self.admin_st_token_account.clone()); account_infos.push(self.vault_st_token_account.clone()); + account_infos.push(self.burn_vault.clone()); + account_infos.push(self.burn_vault_vrt_token_account.clone()); account_infos.push(self.admin.clone()); account_infos.push(self.base.clone()); account_infos.push(self.system_program.clone()); account_infos.push(self.token_program.clone()); + account_infos.push(self.associated_token_program.clone()); remaining_accounts .iter() .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); @@ -490,10 +583,13 @@ impl<'a, 'b> InitializeVaultCpi<'a, 'b> { /// 3. `[]` st_mint /// 4. `[writable]` admin_st_token_account /// 5. `[writable]` vault_st_token_account -/// 6. `[writable, signer]` admin -/// 7. `[signer]` base -/// 8. `[]` system_program -/// 9. `[]` token_program +/// 6. `[]` burn_vault +/// 7. `[writable]` burn_vault_vrt_token_account +/// 8. `[writable, signer]` admin +/// 9. `[signer]` base +/// 10. `[]` system_program +/// 11. `[]` token_program +/// 12. `[]` associated_token_program #[derive(Clone, Debug)] pub struct InitializeVaultCpiBuilder<'a, 'b> { instruction: Box>, @@ -509,14 +605,18 @@ impl<'a, 'b> InitializeVaultCpiBuilder<'a, 'b> { st_mint: None, admin_st_token_account: None, vault_st_token_account: None, + burn_vault: None, + burn_vault_vrt_token_account: None, admin: None, base: None, system_program: None, token_program: None, + associated_token_program: None, deposit_fee_bps: None, withdrawal_fee_bps: None, reward_fee_bps: None, decimals: None, + initialize_token_amount: None, __remaining_accounts: Vec::new(), }); Self { instruction } @@ -567,6 +667,22 @@ impl<'a, 'b> InitializeVaultCpiBuilder<'a, 'b> { self } #[inline(always)] + pub fn burn_vault( + &mut self, + burn_vault: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.burn_vault = Some(burn_vault); + self + } + #[inline(always)] + pub fn burn_vault_vrt_token_account( + &mut self, + burn_vault_vrt_token_account: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.burn_vault_vrt_token_account = Some(burn_vault_vrt_token_account); + self + } + #[inline(always)] pub fn admin(&mut self, admin: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { self.instruction.admin = Some(admin); self @@ -593,6 +709,14 @@ impl<'a, 'b> InitializeVaultCpiBuilder<'a, 'b> { self } #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] pub fn deposit_fee_bps(&mut self, deposit_fee_bps: u16) -> &mut Self { self.instruction.deposit_fee_bps = Some(deposit_fee_bps); self @@ -612,6 +736,11 @@ impl<'a, 'b> InitializeVaultCpiBuilder<'a, 'b> { self.instruction.decimals = Some(decimals); self } + #[inline(always)] + pub fn initialize_token_amount(&mut self, initialize_token_amount: u64) -> &mut Self { + self.instruction.initialize_token_amount = Some(initialize_token_amount); + self + } /// Add an additional account to the instruction. #[inline(always)] pub fn add_remaining_account( @@ -674,6 +803,11 @@ impl<'a, 'b> InitializeVaultCpiBuilder<'a, 'b> { .decimals .clone() .expect("decimals is not set"), + initialize_token_amount: self + .instruction + .initialize_token_amount + .clone() + .expect("initialize_token_amount is not set"), }; let instruction = InitializeVaultCpi { __program: self.instruction.__program, @@ -696,6 +830,13 @@ impl<'a, 'b> InitializeVaultCpiBuilder<'a, 'b> { .vault_st_token_account .expect("vault_st_token_account is not set"), + burn_vault: self.instruction.burn_vault.expect("burn_vault is not set"), + + burn_vault_vrt_token_account: self + .instruction + .burn_vault_vrt_token_account + .expect("burn_vault_vrt_token_account is not set"), + admin: self.instruction.admin.expect("admin is not set"), base: self.instruction.base.expect("base is not set"), @@ -709,6 +850,11 @@ impl<'a, 'b> InitializeVaultCpiBuilder<'a, 'b> { .instruction .token_program .expect("token_program is not set"), + + associated_token_program: self + .instruction + .associated_token_program + .expect("associated_token_program is not set"), __args: args, }; instruction.invoke_signed_with_remaining_accounts( @@ -727,14 +873,18 @@ struct InitializeVaultCpiBuilderInstruction<'a, 'b> { st_mint: Option<&'b solana_program::account_info::AccountInfo<'a>>, admin_st_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>, vault_st_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>, + burn_vault: Option<&'b solana_program::account_info::AccountInfo<'a>>, + burn_vault_vrt_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>, admin: Option<&'b solana_program::account_info::AccountInfo<'a>>, base: Option<&'b solana_program::account_info::AccountInfo<'a>>, system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + associated_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, deposit_fee_bps: Option, withdrawal_fee_bps: Option, reward_fee_bps: Option, decimals: Option, + initialize_token_amount: Option, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. __remaining_accounts: Vec<( &'b solana_program::account_info::AccountInfo<'a>,