@streamflow/staking 12.3.0 → 12.4.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.
- package/dist/cjs/index.cjs +8 -6
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +8 -5
- package/dist/esm/index.d.ts +8 -5
- package/dist/esm/index.js +8 -6
- package/dist/esm/index.js.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.d.cts
CHANGED
|
@@ -3437,6 +3437,9 @@ type DefaultFeeValueConfig = IdlAccounts<FeeManager>["config"];
|
|
|
3437
3437
|
interface IInteractExt extends ITransactionExt {
|
|
3438
3438
|
invoker: SignerWalletAdapter | Keypair;
|
|
3439
3439
|
}
|
|
3440
|
+
interface IInteractWithAurhorityExt extends IInteractExt {
|
|
3441
|
+
authority?: PublicKey;
|
|
3442
|
+
}
|
|
3440
3443
|
interface BaseStakePoolArgs {
|
|
3441
3444
|
stakePool: Address;
|
|
3442
3445
|
stakePoolMint: Address;
|
|
@@ -3594,10 +3597,10 @@ declare class SolanaStakingClient {
|
|
|
3594
3597
|
* @param extParams - parameter required for transaction execution
|
|
3595
3598
|
*/
|
|
3596
3599
|
stakeAndCreateEntries(data: StakeAndCreateEntriesArgs, extParams: IInteractExt): Promise<ITransactionResult>;
|
|
3597
|
-
prepareStakeAndCreateEntriesInstructions(data: StakeAndCreateEntriesArgs, extParams:
|
|
3600
|
+
prepareStakeAndCreateEntriesInstructions(data: StakeAndCreateEntriesArgs, extParams: IInteractWithAurhorityExt): Promise<{
|
|
3598
3601
|
ixs: TransactionInstruction[];
|
|
3599
3602
|
}>;
|
|
3600
|
-
prepareStakeInstructions({ nonce, amount, duration, stakePool, stakePoolMint, tokenProgramId }: StakeArgs, extParams:
|
|
3603
|
+
prepareStakeInstructions({ nonce, amount, duration, stakePool, stakePoolMint, tokenProgramId }: StakeArgs, extParams: IInteractWithAurhorityExt): Promise<{
|
|
3601
3604
|
ixs: TransactionInstruction[];
|
|
3602
3605
|
}>;
|
|
3603
3606
|
unstake(data: UnstakeArgs, extParams: IInteractExt): Promise<ITransactionResult>;
|
|
@@ -3654,8 +3657,8 @@ declare class SolanaStakingClient {
|
|
|
3654
3657
|
prepareClawbackInstructions({ nonce, rewardMint, stakePool, tokenProgramId }: ClawbackRewardPoolArgs, extParams: IInteractExt): Promise<{
|
|
3655
3658
|
ixs: TransactionInstruction[];
|
|
3656
3659
|
}>;
|
|
3657
|
-
createRewardEntry(data: CreateRewardEntryArgs, extParams:
|
|
3658
|
-
prepareCreateRewardEntryInstructions({ stakePool, rewardPoolNonce, depositNonce, rewardMint, rewardPoolType }: CreateRewardEntryArgs, extParams:
|
|
3660
|
+
createRewardEntry(data: CreateRewardEntryArgs, extParams: IInteractWithAurhorityExt): Promise<ITransactionResult>;
|
|
3661
|
+
prepareCreateRewardEntryInstructions({ stakePool, rewardPoolNonce, depositNonce, rewardMint, rewardPoolType }: CreateRewardEntryArgs, extParams: IInteractWithAurhorityExt): Promise<{
|
|
3659
3662
|
ixs: TransactionInstruction[];
|
|
3660
3663
|
}>;
|
|
3661
3664
|
closeRewardEntry(data: CloseRewardEntryArgs, extParams: IInteractExt): Promise<ITransactionResult>;
|
|
@@ -3724,4 +3727,4 @@ declare function calculateAmountWithTransferFees(connection: Connection, transfe
|
|
|
3724
3727
|
|
|
3725
3728
|
declare const calculateStakeWeight: (minDuration: BN, maxDuration: BN, maxWeight: BN, duration: BN) => BN;
|
|
3726
3729
|
|
|
3727
|
-
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 };
|
|
3730
|
+
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 IInteractWithAurhorityExt, 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.d.ts
CHANGED
|
@@ -3437,6 +3437,9 @@ type DefaultFeeValueConfig = IdlAccounts<FeeManager>["config"];
|
|
|
3437
3437
|
interface IInteractExt extends ITransactionExt {
|
|
3438
3438
|
invoker: SignerWalletAdapter | Keypair;
|
|
3439
3439
|
}
|
|
3440
|
+
interface IInteractWithAurhorityExt extends IInteractExt {
|
|
3441
|
+
authority?: PublicKey;
|
|
3442
|
+
}
|
|
3440
3443
|
interface BaseStakePoolArgs {
|
|
3441
3444
|
stakePool: Address;
|
|
3442
3445
|
stakePoolMint: Address;
|
|
@@ -3594,10 +3597,10 @@ declare class SolanaStakingClient {
|
|
|
3594
3597
|
* @param extParams - parameter required for transaction execution
|
|
3595
3598
|
*/
|
|
3596
3599
|
stakeAndCreateEntries(data: StakeAndCreateEntriesArgs, extParams: IInteractExt): Promise<ITransactionResult>;
|
|
3597
|
-
prepareStakeAndCreateEntriesInstructions(data: StakeAndCreateEntriesArgs, extParams:
|
|
3600
|
+
prepareStakeAndCreateEntriesInstructions(data: StakeAndCreateEntriesArgs, extParams: IInteractWithAurhorityExt): Promise<{
|
|
3598
3601
|
ixs: TransactionInstruction[];
|
|
3599
3602
|
}>;
|
|
3600
|
-
prepareStakeInstructions({ nonce, amount, duration, stakePool, stakePoolMint, tokenProgramId }: StakeArgs, extParams:
|
|
3603
|
+
prepareStakeInstructions({ nonce, amount, duration, stakePool, stakePoolMint, tokenProgramId }: StakeArgs, extParams: IInteractWithAurhorityExt): Promise<{
|
|
3601
3604
|
ixs: TransactionInstruction[];
|
|
3602
3605
|
}>;
|
|
3603
3606
|
unstake(data: UnstakeArgs, extParams: IInteractExt): Promise<ITransactionResult>;
|
|
@@ -3654,8 +3657,8 @@ declare class SolanaStakingClient {
|
|
|
3654
3657
|
prepareClawbackInstructions({ nonce, rewardMint, stakePool, tokenProgramId }: ClawbackRewardPoolArgs, extParams: IInteractExt): Promise<{
|
|
3655
3658
|
ixs: TransactionInstruction[];
|
|
3656
3659
|
}>;
|
|
3657
|
-
createRewardEntry(data: CreateRewardEntryArgs, extParams:
|
|
3658
|
-
prepareCreateRewardEntryInstructions({ stakePool, rewardPoolNonce, depositNonce, rewardMint, rewardPoolType }: CreateRewardEntryArgs, extParams:
|
|
3660
|
+
createRewardEntry(data: CreateRewardEntryArgs, extParams: IInteractWithAurhorityExt): Promise<ITransactionResult>;
|
|
3661
|
+
prepareCreateRewardEntryInstructions({ stakePool, rewardPoolNonce, depositNonce, rewardMint, rewardPoolType }: CreateRewardEntryArgs, extParams: IInteractWithAurhorityExt): Promise<{
|
|
3659
3662
|
ixs: TransactionInstruction[];
|
|
3660
3663
|
}>;
|
|
3661
3664
|
closeRewardEntry(data: CloseRewardEntryArgs, extParams: IInteractExt): Promise<ITransactionResult>;
|
|
@@ -3724,4 +3727,4 @@ declare function calculateAmountWithTransferFees(connection: Connection, transfe
|
|
|
3724
3727
|
|
|
3725
3728
|
declare const calculateStakeWeight: (minDuration: BN, maxDuration: BN, maxWeight: BN, duration: BN) => BN;
|
|
3726
3729
|
|
|
3727
|
-
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 };
|
|
3730
|
+
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 IInteractWithAurhorityExt, 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
|
@@ -7902,15 +7902,16 @@ var SolanaStakingClient = class {
|
|
|
7902
7902
|
}
|
|
7903
7903
|
async prepareStakeInstructions({ nonce, amount, duration, stakePool, stakePoolMint, tokenProgramId = TOKEN_PROGRAM_ID }, extParams) {
|
|
7904
7904
|
const { stakePoolProgram } = this.programs;
|
|
7905
|
-
const
|
|
7906
|
-
invariant(
|
|
7905
|
+
const invoker = extParams.invoker.publicKey;
|
|
7906
|
+
invariant(invoker, "Undefined invoker publicKey");
|
|
7907
|
+
const staker = extParams.authority ?? invoker;
|
|
7907
7908
|
const poolMintAccountKey = getAssociatedTokenAddressSync(pk(stakePoolMint), staker, true, pk(tokenProgramId));
|
|
7908
7909
|
const instruction = await stakePoolProgram.methods.stake(nonce, amount, duration).accounts({
|
|
7909
7910
|
stakePool,
|
|
7910
7911
|
tokenProgram: tokenProgramId,
|
|
7911
7912
|
from: poolMintAccountKey,
|
|
7912
7913
|
authority: staker,
|
|
7913
|
-
payer:
|
|
7914
|
+
payer: invoker
|
|
7914
7915
|
}).instruction();
|
|
7915
7916
|
return { ixs: [instruction] };
|
|
7916
7917
|
}
|
|
@@ -8181,10 +8182,11 @@ var SolanaStakingClient = class {
|
|
|
8181
8182
|
async prepareCreateRewardEntryInstructions({ stakePool, rewardPoolNonce, depositNonce, rewardMint, rewardPoolType = "fixed" }, extParams) {
|
|
8182
8183
|
const rewardPoolProgram = this.getRewardProgram(rewardPoolType);
|
|
8183
8184
|
const { stakePoolProgram } = this.programs;
|
|
8184
|
-
const
|
|
8185
|
-
invariant(
|
|
8185
|
+
const invoker = extParams.invoker.publicKey;
|
|
8186
|
+
invariant(invoker, "Undefined invoker publicKey");
|
|
8187
|
+
const staker = extParams.authority ?? invoker;
|
|
8186
8188
|
const instruction = await rewardPoolProgram.methods.createEntry().accounts({
|
|
8187
|
-
payer:
|
|
8189
|
+
payer: invoker,
|
|
8188
8190
|
authority: staker,
|
|
8189
8191
|
stakeEntry: deriveStakeEntryPDA(stakePoolProgram.programId, pk(stakePool), staker, depositNonce),
|
|
8190
8192
|
rewardPool: deriveRewardPoolPDA(rewardPoolProgram.programId, pk(stakePool), pk(rewardMint), rewardPoolNonce)
|