@streamflow/staking 11.2.1 → 11.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3465,6 +3465,10 @@ interface FundPoolArgs extends BaseStakePoolArgs, TokenProgram, RewardPoolProgra
3465
3465
  rewardMint: Address;
3466
3466
  feeValue: Address | null;
3467
3467
  }
3468
+ interface ClawbackRewardPoolArgs extends BaseStakePoolArgs, TokenProgram {
3469
+ nonce: number;
3470
+ rewardMint: Address;
3471
+ }
3468
3472
  interface CreateRewardEntryArgs extends BaseStakePoolArgs, TokenProgram, RewardPoolProgram {
3469
3473
  depositNonce: number;
3470
3474
  rewardPoolNonce: number;
@@ -3627,6 +3631,10 @@ declare class SolanaStakingClient {
3627
3631
  prepareFundPoolInstructions({ amount, tokenProgramId, rewardMint, stakePool, feeValue, nonce, rewardPoolType, }: FundPoolArgs, extParams: IInteractExt): Promise<{
3628
3632
  ixs: TransactionInstruction[];
3629
3633
  }>;
3634
+ clawback(data: ClawbackRewardPoolArgs, extParams: IInteractExt): Promise<ITransactionResult>;
3635
+ prepareClawbackInstructions({ nonce, rewardMint, stakePool, tokenProgramId }: ClawbackRewardPoolArgs, extParams: IInteractExt): Promise<{
3636
+ ixs: TransactionInstruction[];
3637
+ }>;
3630
3638
  createRewardEntry(data: CreateRewardEntryArgs, extParams: IInteractExt): Promise<ITransactionResult>;
3631
3639
  prepareCreateRewardEntryInstructions({ stakePool, rewardPoolNonce, depositNonce, rewardMint, rewardPoolType }: CreateRewardEntryArgs, extParams: IInteractExt): Promise<{
3632
3640
  ixs: TransactionInstruction[];
@@ -3697,4 +3705,4 @@ declare function calculateAmountWithTransferFees(connection: Connection, transfe
3697
3705
 
3698
3706
  declare const calculateStakeWeight: (minDuration: BN, maxDuration: BN, maxWeight: BN, duration: BN) => BN;
3699
3707
 
3700
- export { type BaseStakePoolArgs, type ClaimRewardPoolArgs, type CloseRewardEntryArgs, type CloseStakeEntryArgs, type CreateFundDelegateArgs, type CreateFundDelegatePrepareResult, type CreateFundDelegateResult, type CreateRewardEntryArgs, type CreateRewardPoolArgs, type CreateStakePoolArgs, type DefaultFeeValueConfig, type FeeValue, type FundPoolArgs, type IInteractExt, type RewardEntry, RewardEntryAccumulator, type RewardPool, SolanaStakingClient, type StakeAndCreateEntriesArgs, type StakeArgs, type StakeEntry, type StakePool, type UnstakeAndClaimArgs, type UnstakeAndCloseArgs, type UnstakeArgs, type UpdateRewardPoolArgs, calcRewards, calculateAmountWithTransferFees, calculateDecimalsShift, calculateFeeAmount, calculateRewardAmountFromRate, calculateRewardAmountFromValue, calculateRewardRateFromAmount, calculateStakeWeight, constants, deriveConfigPDA, deriveFeeValuePDA, deriveFundDelegatePDA, deriveRewardEntryPDA, deriveRewardPoolPDA, deriveRewardVaultPDA, deriveStakeEntryPDA, deriveStakeMintPDA, deriveStakePoolPDA, deriveStakeVaultPDA };
3708
+ export { type BaseStakePoolArgs, type ClaimRewardPoolArgs, type ClawbackRewardPoolArgs, type CloseRewardEntryArgs, type CloseStakeEntryArgs, type CreateFundDelegateArgs, type CreateFundDelegatePrepareResult, type CreateFundDelegateResult, type CreateRewardEntryArgs, type CreateRewardPoolArgs, type CreateStakePoolArgs, type DefaultFeeValueConfig, type FeeValue, type FundPoolArgs, type IInteractExt, type RewardEntry, RewardEntryAccumulator, type RewardPool, SolanaStakingClient, type StakeAndCreateEntriesArgs, type StakeArgs, type StakeEntry, type StakePool, type UnstakeAndClaimArgs, type UnstakeAndCloseArgs, type UnstakeArgs, type UpdateRewardPoolArgs, calcRewards, calculateAmountWithTransferFees, calculateDecimalsShift, calculateFeeAmount, calculateRewardAmountFromRate, calculateRewardAmountFromValue, calculateRewardRateFromAmount, calculateStakeWeight, constants, deriveConfigPDA, deriveFeeValuePDA, deriveFundDelegatePDA, deriveRewardEntryPDA, deriveRewardPoolPDA, deriveRewardVaultPDA, deriveStakeEntryPDA, deriveStakeMintPDA, deriveStakePoolPDA, deriveStakeVaultPDA };
@@ -3465,6 +3465,10 @@ interface FundPoolArgs extends BaseStakePoolArgs, TokenProgram, RewardPoolProgra
3465
3465
  rewardMint: Address;
3466
3466
  feeValue: Address | null;
3467
3467
  }
3468
+ interface ClawbackRewardPoolArgs extends BaseStakePoolArgs, TokenProgram {
3469
+ nonce: number;
3470
+ rewardMint: Address;
3471
+ }
3468
3472
  interface CreateRewardEntryArgs extends BaseStakePoolArgs, TokenProgram, RewardPoolProgram {
3469
3473
  depositNonce: number;
3470
3474
  rewardPoolNonce: number;
@@ -3627,6 +3631,10 @@ declare class SolanaStakingClient {
3627
3631
  prepareFundPoolInstructions({ amount, tokenProgramId, rewardMint, stakePool, feeValue, nonce, rewardPoolType, }: FundPoolArgs, extParams: IInteractExt): Promise<{
3628
3632
  ixs: TransactionInstruction[];
3629
3633
  }>;
3634
+ clawback(data: ClawbackRewardPoolArgs, extParams: IInteractExt): Promise<ITransactionResult>;
3635
+ prepareClawbackInstructions({ nonce, rewardMint, stakePool, tokenProgramId }: ClawbackRewardPoolArgs, extParams: IInteractExt): Promise<{
3636
+ ixs: TransactionInstruction[];
3637
+ }>;
3630
3638
  createRewardEntry(data: CreateRewardEntryArgs, extParams: IInteractExt): Promise<ITransactionResult>;
3631
3639
  prepareCreateRewardEntryInstructions({ stakePool, rewardPoolNonce, depositNonce, rewardMint, rewardPoolType }: CreateRewardEntryArgs, extParams: IInteractExt): Promise<{
3632
3640
  ixs: TransactionInstruction[];
@@ -3697,4 +3705,4 @@ declare function calculateAmountWithTransferFees(connection: Connection, transfe
3697
3705
 
3698
3706
  declare const calculateStakeWeight: (minDuration: BN, maxDuration: BN, maxWeight: BN, duration: BN) => BN;
3699
3707
 
3700
- export { type BaseStakePoolArgs, type ClaimRewardPoolArgs, type CloseRewardEntryArgs, type CloseStakeEntryArgs, type CreateFundDelegateArgs, type CreateFundDelegatePrepareResult, type CreateFundDelegateResult, type CreateRewardEntryArgs, type CreateRewardPoolArgs, type CreateStakePoolArgs, type DefaultFeeValueConfig, type FeeValue, type FundPoolArgs, type IInteractExt, type RewardEntry, RewardEntryAccumulator, type RewardPool, SolanaStakingClient, type StakeAndCreateEntriesArgs, type StakeArgs, type StakeEntry, type StakePool, type UnstakeAndClaimArgs, type UnstakeAndCloseArgs, type UnstakeArgs, type UpdateRewardPoolArgs, calcRewards, calculateAmountWithTransferFees, calculateDecimalsShift, calculateFeeAmount, calculateRewardAmountFromRate, calculateRewardAmountFromValue, calculateRewardRateFromAmount, calculateStakeWeight, constants, deriveConfigPDA, deriveFeeValuePDA, deriveFundDelegatePDA, deriveRewardEntryPDA, deriveRewardPoolPDA, deriveRewardVaultPDA, deriveStakeEntryPDA, deriveStakeMintPDA, deriveStakePoolPDA, deriveStakeVaultPDA };
3708
+ export { type BaseStakePoolArgs, type ClaimRewardPoolArgs, type ClawbackRewardPoolArgs, type CloseRewardEntryArgs, type CloseStakeEntryArgs, type CreateFundDelegateArgs, type CreateFundDelegatePrepareResult, type CreateFundDelegateResult, type CreateRewardEntryArgs, type CreateRewardPoolArgs, type CreateStakePoolArgs, type DefaultFeeValueConfig, type FeeValue, type FundPoolArgs, type IInteractExt, type RewardEntry, RewardEntryAccumulator, type RewardPool, SolanaStakingClient, type StakeAndCreateEntriesArgs, type StakeArgs, type StakeEntry, type StakePool, type UnstakeAndClaimArgs, type UnstakeAndCloseArgs, type UnstakeArgs, type UpdateRewardPoolArgs, calcRewards, calculateAmountWithTransferFees, calculateDecimalsShift, calculateFeeAmount, calculateRewardAmountFromRate, calculateRewardAmountFromValue, calculateRewardRateFromAmount, calculateStakeWeight, constants, deriveConfigPDA, deriveFeeValuePDA, deriveFundDelegatePDA, deriveRewardEntryPDA, deriveRewardPoolPDA, deriveRewardVaultPDA, deriveStakeEntryPDA, deriveStakeMintPDA, deriveStakePoolPDA, deriveStakeVaultPDA };
package/dist/esm/index.js CHANGED
@@ -8128,6 +8128,29 @@ var SolanaStakingClient = class {
8128
8128
  }).instruction();
8129
8129
  return { ixs: treasuryATA ? treasuryATA.concat([instruction]) : [instruction] };
8130
8130
  }
8131
+ async clawback(data, extParams) {
8132
+ const { ixs } = await this.prepareClawbackInstructions(data, extParams);
8133
+ const { signature } = await this.execute(ixs, extParams);
8134
+ return {
8135
+ ixs,
8136
+ txId: signature
8137
+ };
8138
+ }
8139
+ async prepareClawbackInstructions({ nonce, rewardMint, stakePool, tokenProgramId = TOKEN_PROGRAM_ID }, extParams) {
8140
+ const { rewardPoolProgram } = this.programs;
8141
+ const authority = extParams.invoker.publicKey;
8142
+ invariant(authority, "Undefined invoker publicKey");
8143
+ const rewardMintPk = pk(rewardMint);
8144
+ const tokenProgramPk = pk(tokenProgramId);
8145
+ const rewardPoolPda = deriveRewardPoolPDA(rewardPoolProgram.programId, pk(stakePool), rewardMintPk, nonce);
8146
+ const instruction = await rewardPoolProgram.methods.clawback().accountsPartial({
8147
+ rewardPool: rewardPoolPda,
8148
+ authority,
8149
+ tokenProgram: tokenProgramId,
8150
+ to: getAssociatedTokenAddressSync(rewardMintPk, authority, true, tokenProgramPk)
8151
+ }).instruction();
8152
+ return { ixs: [instruction] };
8153
+ }
8131
8154
  async createRewardEntry(data, extParams) {
8132
8155
  const { ixs } = await this.prepareCreateRewardEntryInstructions(data, extParams);
8133
8156
  const { signature } = await this.execute(ixs, extParams);