@streamflow/staking 7.0.2 → 7.0.3-alpha.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/solana/client.js +12 -11
- package/dist/cjs/solana/descriptor/idl/reward_pool.json +28 -2
- package/dist/esm/solana/client.d.ts +3 -3
- package/dist/esm/solana/client.js +12 -11
- package/dist/esm/solana/descriptor/idl/reward_pool.json +28 -2
- package/dist/esm/solana/descriptor/reward_pool.d.ts +28 -2
- package/dist/esm/solana/types.d.ts +3 -0
- package/package.json +5 -5
|
@@ -129,8 +129,8 @@ class SolanaStakingClient {
|
|
|
129
129
|
const staker = extParams.invoker.publicKey;
|
|
130
130
|
(0, common_1.invariant)(staker, "Undefined invoker publicKey");
|
|
131
131
|
const mint = (0, derive_accounts_js_1.deriveStakeMintPDA)(stakePoolProgram.programId, (0, solana_1.pk)(stakePool));
|
|
132
|
-
const stakeMintAccountKey = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, staker,
|
|
133
|
-
const poolMintAccountKey = (0, spl_token_1.getAssociatedTokenAddressSync)((0, solana_1.pk)(stakePoolMint), staker,
|
|
132
|
+
const stakeMintAccountKey = (0, spl_token_1.getAssociatedTokenAddressSync)(mint, staker, true, (0, solana_1.pk)(tokenProgramId));
|
|
133
|
+
const poolMintAccountKey = (0, spl_token_1.getAssociatedTokenAddressSync)((0, solana_1.pk)(stakePoolMint), staker, true, (0, solana_1.pk)(tokenProgramId));
|
|
134
134
|
const instruction = await stakePoolProgram.methods
|
|
135
135
|
.stake(nonce, amount, duration)
|
|
136
136
|
.accounts({
|
|
@@ -158,8 +158,8 @@ class SolanaStakingClient {
|
|
|
158
158
|
(0, common_1.invariant)(staker, "Undefined invoker publicKey");
|
|
159
159
|
const stakeMintKey = (0, derive_accounts_js_1.deriveStakeMintPDA)(stakePoolProgram.programId, (0, solana_1.pk)(stakePool));
|
|
160
160
|
const stakeEntryKey = (0, derive_accounts_js_1.deriveStakeEntryPDA)(stakePoolProgram.programId, (0, solana_1.pk)(stakePool), staker, nonce);
|
|
161
|
-
const poolMintAccountKey = (0, spl_token_1.getAssociatedTokenAddressSync)((0, solana_1.pk)(stakePoolMint), staker,
|
|
162
|
-
const stakeMintAccountKey = (0, spl_token_1.getAssociatedTokenAddressSync)(stakeMintKey, staker,
|
|
161
|
+
const poolMintAccountKey = (0, spl_token_1.getAssociatedTokenAddressSync)((0, solana_1.pk)(stakePoolMint), staker, true, (0, solana_1.pk)(tokenProgramId));
|
|
162
|
+
const stakeMintAccountKey = (0, spl_token_1.getAssociatedTokenAddressSync)(stakeMintKey, staker, true, (0, solana_1.pk)(tokenProgramId));
|
|
163
163
|
const instruction = await stakePoolProgram.methods
|
|
164
164
|
.unstake()
|
|
165
165
|
.accounts({
|
|
@@ -181,12 +181,12 @@ class SolanaStakingClient {
|
|
|
181
181
|
metadataId: publicKey,
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
async prepareCreateRewardPoolInstructions({ nonce, rewardAmount, rewardPeriod, rewardMint, permissionless = false, stakePool, tokenProgramId = spl_token_1.TOKEN_PROGRAM_ID, }, extParams) {
|
|
184
|
+
async prepareCreateRewardPoolInstructions({ nonce, rewardAmount, rewardPeriod, rewardMint, permissionless = false, stakePool, lastClaimPeriodOpt, tokenProgramId = spl_token_1.TOKEN_PROGRAM_ID, }, extParams) {
|
|
185
185
|
const { rewardPoolProgram } = this.programs;
|
|
186
186
|
const creator = extParams.invoker.publicKey;
|
|
187
187
|
(0, common_1.invariant)(creator, "Undefined invoker publicKey");
|
|
188
188
|
const instruction = await rewardPoolProgram.methods
|
|
189
|
-
.createPool(nonce, rewardAmount, rewardPeriod, permissionless)
|
|
189
|
+
.createPool(nonce, rewardAmount, rewardPeriod, permissionless, lastClaimPeriodOpt)
|
|
190
190
|
.accounts({
|
|
191
191
|
creator,
|
|
192
192
|
stakePool,
|
|
@@ -216,7 +216,7 @@ class SolanaStakingClient {
|
|
|
216
216
|
rewardPool: (0, derive_accounts_js_1.deriveRewardPoolPDA)(rewardPoolProgram.programId, (0, solana_1.pk)(stakePool), (0, solana_1.pk)(rewardMint), rewardPoolNonce),
|
|
217
217
|
claimant: staker,
|
|
218
218
|
tokenProgram: tokenProgramId,
|
|
219
|
-
to: (0, spl_token_1.getAssociatedTokenAddressSync)((0, solana_1.pk)(rewardMint), staker,
|
|
219
|
+
to: (0, spl_token_1.getAssociatedTokenAddressSync)((0, solana_1.pk)(rewardMint), staker, true, (0, solana_1.pk)(tokenProgramId)),
|
|
220
220
|
})
|
|
221
221
|
.instruction();
|
|
222
222
|
return { ixs: [instruction] };
|
|
@@ -245,7 +245,7 @@ class SolanaStakingClient {
|
|
|
245
245
|
.accountsPartial({
|
|
246
246
|
funder: staker,
|
|
247
247
|
rewardPool: rewardPoolPda,
|
|
248
|
-
from: (0, spl_token_1.getAssociatedTokenAddressSync)(rewardMintPk, staker,
|
|
248
|
+
from: (0, spl_token_1.getAssociatedTokenAddressSync)(rewardMintPk, staker, true, tokenProgramPk),
|
|
249
249
|
tokenProgram: tokenProgramId,
|
|
250
250
|
vault: (0, derive_accounts_js_1.deriveRewardVaultPDA)(rewardPoolProgram.programId, rewardPoolPda),
|
|
251
251
|
mint: rewardMint,
|
|
@@ -262,7 +262,7 @@ class SolanaStakingClient {
|
|
|
262
262
|
txId: signature,
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
|
-
async prepareCreateRewardEntryInstructions({
|
|
265
|
+
async prepareCreateRewardEntryInstructions({ stakePool, rewardPoolNonce, depositNonce, rewardMint }, extParams) {
|
|
266
266
|
const { stakePoolProgram, rewardPoolProgram } = this.programs;
|
|
267
267
|
const staker = extParams.invoker.publicKey;
|
|
268
268
|
(0, common_1.invariant)(staker, "Undefined invoker publicKey");
|
|
@@ -272,7 +272,7 @@ class SolanaStakingClient {
|
|
|
272
272
|
payer: staker,
|
|
273
273
|
authority: staker,
|
|
274
274
|
stakeEntry: (0, derive_accounts_js_1.deriveStakeEntryPDA)(stakePoolProgram.programId, (0, solana_1.pk)(stakePool), staker, depositNonce),
|
|
275
|
-
rewardPool: (0, derive_accounts_js_1.deriveRewardPoolPDA)(rewardPoolProgram.programId, (0, solana_1.pk)(stakePool), (0, solana_1.pk)(
|
|
275
|
+
rewardPool: (0, derive_accounts_js_1.deriveRewardPoolPDA)(rewardPoolProgram.programId, (0, solana_1.pk)(stakePool), (0, solana_1.pk)(rewardMint), rewardPoolNonce),
|
|
276
276
|
})
|
|
277
277
|
.instruction();
|
|
278
278
|
return { ixs: [instruction] };
|
|
@@ -285,13 +285,14 @@ class SolanaStakingClient {
|
|
|
285
285
|
txId: signature,
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
|
-
async prepareUpdateRewardPoolInstructions({ rewardPool, rewardAmount, rewardPeriod }, extParams) {
|
|
288
|
+
async prepareUpdateRewardPoolInstructions({ rewardPool, rewardAmount, rewardPeriod, stakePool }, extParams) {
|
|
289
289
|
const { rewardPoolProgram } = this.programs;
|
|
290
290
|
const invoker = extParams.invoker.publicKey;
|
|
291
291
|
(0, common_1.invariant)(invoker, "Undefined invoker publicKey");
|
|
292
292
|
const instruction = await rewardPoolProgram.methods
|
|
293
293
|
.updatePool(rewardAmount, rewardPeriod)
|
|
294
294
|
.accountsPartial({
|
|
295
|
+
stakePool,
|
|
295
296
|
authority: invoker,
|
|
296
297
|
rewardPool,
|
|
297
298
|
})
|
|
@@ -278,6 +278,12 @@
|
|
|
278
278
|
{
|
|
279
279
|
"name": "permissionless",
|
|
280
280
|
"type": "bool"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"name": "last_claim_period_opt",
|
|
284
|
+
"type": {
|
|
285
|
+
"option": "u64"
|
|
286
|
+
}
|
|
281
287
|
}
|
|
282
288
|
]
|
|
283
289
|
},
|
|
@@ -407,9 +413,14 @@
|
|
|
407
413
|
"signer": true,
|
|
408
414
|
"relations": ["reward_pool"]
|
|
409
415
|
},
|
|
416
|
+
{
|
|
417
|
+
"name": "stake_pool",
|
|
418
|
+
"docs": ["Stake Pool to Which Reward Pool belongs"],
|
|
419
|
+
"relations": ["reward_pool"]
|
|
420
|
+
},
|
|
410
421
|
{
|
|
411
422
|
"name": "reward_pool",
|
|
412
|
-
"docs": ["
|
|
423
|
+
"docs": ["Reward Pool"],
|
|
413
424
|
"writable": true
|
|
414
425
|
}
|
|
415
426
|
],
|
|
@@ -520,6 +531,16 @@
|
|
|
520
531
|
"code": 6012,
|
|
521
532
|
"name": "RewardPoolDrained",
|
|
522
533
|
"msg": "Reward Pool does not have enough Rewards for Claiming"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
"code": 6013,
|
|
537
|
+
"name": "UpdateTooSoon",
|
|
538
|
+
"msg": "Repeated update can not happen sooner than the stake pool max duration"
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
"code": 6014,
|
|
542
|
+
"name": "InvalidLastClaimPeriod",
|
|
543
|
+
"msg": "Invalid last claim period provided"
|
|
523
544
|
}
|
|
524
545
|
],
|
|
525
546
|
"types": [
|
|
@@ -731,11 +752,16 @@
|
|
|
731
752
|
"docs": ["Time when Reward Pool was created"],
|
|
732
753
|
"type": "u64"
|
|
733
754
|
},
|
|
755
|
+
{
|
|
756
|
+
"name": "last_claim_period",
|
|
757
|
+
"docs": ["For how much seconds after unstake user should be able to claim rewards"],
|
|
758
|
+
"type": "u64"
|
|
759
|
+
},
|
|
734
760
|
{
|
|
735
761
|
"name": "_buffer",
|
|
736
762
|
"docs": ["Buffer for additional fields"],
|
|
737
763
|
"type": {
|
|
738
|
-
"array": ["u8",
|
|
764
|
+
"array": ["u8", 48]
|
|
739
765
|
}
|
|
740
766
|
}
|
|
741
767
|
]
|
|
@@ -58,7 +58,7 @@ export declare class SolanaStakingClient {
|
|
|
58
58
|
ixs: TransactionInstruction[];
|
|
59
59
|
}>;
|
|
60
60
|
createRewardPool(data: CreateRewardPoolArgs, extParams: IInteractSolanaExt): Promise<CreationResult>;
|
|
61
|
-
prepareCreateRewardPoolInstructions({ nonce, rewardAmount, rewardPeriod, rewardMint, permissionless, stakePool, tokenProgramId, }: CreateRewardPoolArgs, extParams: IInteractSolanaExt): Promise<{
|
|
61
|
+
prepareCreateRewardPoolInstructions({ nonce, rewardAmount, rewardPeriod, rewardMint, permissionless, stakePool, lastClaimPeriodOpt, tokenProgramId, }: CreateRewardPoolArgs, extParams: IInteractSolanaExt): Promise<{
|
|
62
62
|
publicKey: PublicKey;
|
|
63
63
|
ixs: TransactionInstruction[];
|
|
64
64
|
}>;
|
|
@@ -71,14 +71,14 @@ export declare class SolanaStakingClient {
|
|
|
71
71
|
ixs: TransactionInstruction[];
|
|
72
72
|
}>;
|
|
73
73
|
createRewardEntry(data: CreateRewardEntryArgs, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
|
|
74
|
-
prepareCreateRewardEntryInstructions({
|
|
74
|
+
prepareCreateRewardEntryInstructions({ stakePool, rewardPoolNonce, depositNonce, rewardMint }: CreateRewardEntryArgs, extParams: IInteractSolanaExt): Promise<{
|
|
75
75
|
ixs: TransactionInstruction[];
|
|
76
76
|
}>;
|
|
77
77
|
updateRewardPool(data: UpdateRewardPoolArgs, extParams: IInteractSolanaExt): Promise<{
|
|
78
78
|
ixs: TransactionInstruction[];
|
|
79
79
|
txId: string;
|
|
80
80
|
}>;
|
|
81
|
-
prepareUpdateRewardPoolInstructions({ rewardPool, rewardAmount, rewardPeriod }: UpdateRewardPoolArgs, extParams: IInteractSolanaExt): Promise<{
|
|
81
|
+
prepareUpdateRewardPoolInstructions({ rewardPool, rewardAmount, rewardPeriod, stakePool }: UpdateRewardPoolArgs, extParams: IInteractSolanaExt): Promise<{
|
|
82
82
|
ixs: TransactionInstruction[];
|
|
83
83
|
}>;
|
|
84
84
|
decode<ProgramName extends keyof Programs = keyof Programs, DecodingProgram = Programs[ProgramName], DerivedIdl extends Idl = DecodingProgram extends Program<infer IDLType> ? IDLType : never, AccountName extends keyof IdlTypes<DerivedIdl> = keyof IdlTypes<DerivedIdl>, DecodedAccount = IdlTypes<DerivedIdl>[AccountName]>(programKey: ProgramName, accountName: AccountName, accInfo: Parameters<AccountsCoder["decode"]>[1]): DecodedAccount;
|
|
@@ -127,8 +127,8 @@ export class SolanaStakingClient {
|
|
|
127
127
|
const staker = extParams.invoker.publicKey;
|
|
128
128
|
invariant(staker, "Undefined invoker publicKey");
|
|
129
129
|
const mint = deriveStakeMintPDA(stakePoolProgram.programId, pk(stakePool));
|
|
130
|
-
const stakeMintAccountKey = getAssociatedTokenAddressSync(mint, staker,
|
|
131
|
-
const poolMintAccountKey = getAssociatedTokenAddressSync(pk(stakePoolMint), staker,
|
|
130
|
+
const stakeMintAccountKey = getAssociatedTokenAddressSync(mint, staker, true, pk(tokenProgramId));
|
|
131
|
+
const poolMintAccountKey = getAssociatedTokenAddressSync(pk(stakePoolMint), staker, true, pk(tokenProgramId));
|
|
132
132
|
const instruction = await stakePoolProgram.methods
|
|
133
133
|
.stake(nonce, amount, duration)
|
|
134
134
|
.accounts({
|
|
@@ -156,8 +156,8 @@ export class SolanaStakingClient {
|
|
|
156
156
|
invariant(staker, "Undefined invoker publicKey");
|
|
157
157
|
const stakeMintKey = deriveStakeMintPDA(stakePoolProgram.programId, pk(stakePool));
|
|
158
158
|
const stakeEntryKey = deriveStakeEntryPDA(stakePoolProgram.programId, pk(stakePool), staker, nonce);
|
|
159
|
-
const poolMintAccountKey = getAssociatedTokenAddressSync(pk(stakePoolMint), staker,
|
|
160
|
-
const stakeMintAccountKey = getAssociatedTokenAddressSync(stakeMintKey, staker,
|
|
159
|
+
const poolMintAccountKey = getAssociatedTokenAddressSync(pk(stakePoolMint), staker, true, pk(tokenProgramId));
|
|
160
|
+
const stakeMintAccountKey = getAssociatedTokenAddressSync(stakeMintKey, staker, true, pk(tokenProgramId));
|
|
161
161
|
const instruction = await stakePoolProgram.methods
|
|
162
162
|
.unstake()
|
|
163
163
|
.accounts({
|
|
@@ -179,12 +179,12 @@ export class SolanaStakingClient {
|
|
|
179
179
|
metadataId: publicKey,
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
async prepareCreateRewardPoolInstructions({ nonce, rewardAmount, rewardPeriod, rewardMint, permissionless = false, stakePool, tokenProgramId = TOKEN_PROGRAM_ID, }, extParams) {
|
|
182
|
+
async prepareCreateRewardPoolInstructions({ nonce, rewardAmount, rewardPeriod, rewardMint, permissionless = false, stakePool, lastClaimPeriodOpt, tokenProgramId = TOKEN_PROGRAM_ID, }, extParams) {
|
|
183
183
|
const { rewardPoolProgram } = this.programs;
|
|
184
184
|
const creator = extParams.invoker.publicKey;
|
|
185
185
|
invariant(creator, "Undefined invoker publicKey");
|
|
186
186
|
const instruction = await rewardPoolProgram.methods
|
|
187
|
-
.createPool(nonce, rewardAmount, rewardPeriod, permissionless)
|
|
187
|
+
.createPool(nonce, rewardAmount, rewardPeriod, permissionless, lastClaimPeriodOpt)
|
|
188
188
|
.accounts({
|
|
189
189
|
creator,
|
|
190
190
|
stakePool,
|
|
@@ -214,7 +214,7 @@ export class SolanaStakingClient {
|
|
|
214
214
|
rewardPool: deriveRewardPoolPDA(rewardPoolProgram.programId, pk(stakePool), pk(rewardMint), rewardPoolNonce),
|
|
215
215
|
claimant: staker,
|
|
216
216
|
tokenProgram: tokenProgramId,
|
|
217
|
-
to: getAssociatedTokenAddressSync(pk(rewardMint), staker,
|
|
217
|
+
to: getAssociatedTokenAddressSync(pk(rewardMint), staker, true, pk(tokenProgramId)),
|
|
218
218
|
})
|
|
219
219
|
.instruction();
|
|
220
220
|
return { ixs: [instruction] };
|
|
@@ -243,7 +243,7 @@ export class SolanaStakingClient {
|
|
|
243
243
|
.accountsPartial({
|
|
244
244
|
funder: staker,
|
|
245
245
|
rewardPool: rewardPoolPda,
|
|
246
|
-
from: getAssociatedTokenAddressSync(rewardMintPk, staker,
|
|
246
|
+
from: getAssociatedTokenAddressSync(rewardMintPk, staker, true, tokenProgramPk),
|
|
247
247
|
tokenProgram: tokenProgramId,
|
|
248
248
|
vault: deriveRewardVaultPDA(rewardPoolProgram.programId, rewardPoolPda),
|
|
249
249
|
mint: rewardMint,
|
|
@@ -260,7 +260,7 @@ export class SolanaStakingClient {
|
|
|
260
260
|
txId: signature,
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
|
-
async prepareCreateRewardEntryInstructions({
|
|
263
|
+
async prepareCreateRewardEntryInstructions({ stakePool, rewardPoolNonce, depositNonce, rewardMint }, extParams) {
|
|
264
264
|
const { stakePoolProgram, rewardPoolProgram } = this.programs;
|
|
265
265
|
const staker = extParams.invoker.publicKey;
|
|
266
266
|
invariant(staker, "Undefined invoker publicKey");
|
|
@@ -270,7 +270,7 @@ export class SolanaStakingClient {
|
|
|
270
270
|
payer: staker,
|
|
271
271
|
authority: staker,
|
|
272
272
|
stakeEntry: deriveStakeEntryPDA(stakePoolProgram.programId, pk(stakePool), staker, depositNonce),
|
|
273
|
-
rewardPool: deriveRewardPoolPDA(rewardPoolProgram.programId, pk(stakePool), pk(
|
|
273
|
+
rewardPool: deriveRewardPoolPDA(rewardPoolProgram.programId, pk(stakePool), pk(rewardMint), rewardPoolNonce),
|
|
274
274
|
})
|
|
275
275
|
.instruction();
|
|
276
276
|
return { ixs: [instruction] };
|
|
@@ -283,13 +283,14 @@ export class SolanaStakingClient {
|
|
|
283
283
|
txId: signature,
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
|
-
async prepareUpdateRewardPoolInstructions({ rewardPool, rewardAmount, rewardPeriod }, extParams) {
|
|
286
|
+
async prepareUpdateRewardPoolInstructions({ rewardPool, rewardAmount, rewardPeriod, stakePool }, extParams) {
|
|
287
287
|
const { rewardPoolProgram } = this.programs;
|
|
288
288
|
const invoker = extParams.invoker.publicKey;
|
|
289
289
|
invariant(invoker, "Undefined invoker publicKey");
|
|
290
290
|
const instruction = await rewardPoolProgram.methods
|
|
291
291
|
.updatePool(rewardAmount, rewardPeriod)
|
|
292
292
|
.accountsPartial({
|
|
293
|
+
stakePool,
|
|
293
294
|
authority: invoker,
|
|
294
295
|
rewardPool,
|
|
295
296
|
})
|
|
@@ -278,6 +278,12 @@
|
|
|
278
278
|
{
|
|
279
279
|
"name": "permissionless",
|
|
280
280
|
"type": "bool"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"name": "last_claim_period_opt",
|
|
284
|
+
"type": {
|
|
285
|
+
"option": "u64"
|
|
286
|
+
}
|
|
281
287
|
}
|
|
282
288
|
]
|
|
283
289
|
},
|
|
@@ -407,9 +413,14 @@
|
|
|
407
413
|
"signer": true,
|
|
408
414
|
"relations": ["reward_pool"]
|
|
409
415
|
},
|
|
416
|
+
{
|
|
417
|
+
"name": "stake_pool",
|
|
418
|
+
"docs": ["Stake Pool to Which Reward Pool belongs"],
|
|
419
|
+
"relations": ["reward_pool"]
|
|
420
|
+
},
|
|
410
421
|
{
|
|
411
422
|
"name": "reward_pool",
|
|
412
|
-
"docs": ["
|
|
423
|
+
"docs": ["Reward Pool"],
|
|
413
424
|
"writable": true
|
|
414
425
|
}
|
|
415
426
|
],
|
|
@@ -520,6 +531,16 @@
|
|
|
520
531
|
"code": 6012,
|
|
521
532
|
"name": "RewardPoolDrained",
|
|
522
533
|
"msg": "Reward Pool does not have enough Rewards for Claiming"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
"code": 6013,
|
|
537
|
+
"name": "UpdateTooSoon",
|
|
538
|
+
"msg": "Repeated update can not happen sooner than the stake pool max duration"
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
"code": 6014,
|
|
542
|
+
"name": "InvalidLastClaimPeriod",
|
|
543
|
+
"msg": "Invalid last claim period provided"
|
|
523
544
|
}
|
|
524
545
|
],
|
|
525
546
|
"types": [
|
|
@@ -731,11 +752,16 @@
|
|
|
731
752
|
"docs": ["Time when Reward Pool was created"],
|
|
732
753
|
"type": "u64"
|
|
733
754
|
},
|
|
755
|
+
{
|
|
756
|
+
"name": "last_claim_period",
|
|
757
|
+
"docs": ["For how much seconds after unstake user should be able to claim rewards"],
|
|
758
|
+
"type": "u64"
|
|
759
|
+
},
|
|
734
760
|
{
|
|
735
761
|
"name": "_buffer",
|
|
736
762
|
"docs": ["Buffer for additional fields"],
|
|
737
763
|
"type": {
|
|
738
|
-
"array": ["u8",
|
|
764
|
+
"array": ["u8", 48]
|
|
739
765
|
}
|
|
740
766
|
}
|
|
741
767
|
]
|
|
@@ -284,6 +284,12 @@ export type RewardPool = {
|
|
|
284
284
|
{
|
|
285
285
|
name: "permissionless";
|
|
286
286
|
type: "bool";
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: "lastClaimPeriodOpt";
|
|
290
|
+
type: {
|
|
291
|
+
option: "u64";
|
|
292
|
+
};
|
|
287
293
|
}
|
|
288
294
|
];
|
|
289
295
|
},
|
|
@@ -443,9 +449,14 @@ export type RewardPool = {
|
|
|
443
449
|
signer: true;
|
|
444
450
|
relations: ["rewardPool"];
|
|
445
451
|
},
|
|
452
|
+
{
|
|
453
|
+
name: "stakePool";
|
|
454
|
+
docs: ["Stake Pool to Which Reward Pool belongs"];
|
|
455
|
+
relations: ["rewardPool"];
|
|
456
|
+
},
|
|
446
457
|
{
|
|
447
458
|
name: "rewardPool";
|
|
448
|
-
docs: ["
|
|
459
|
+
docs: ["Reward Pool"];
|
|
449
460
|
writable: true;
|
|
450
461
|
}
|
|
451
462
|
];
|
|
@@ -556,6 +567,16 @@ export type RewardPool = {
|
|
|
556
567
|
code: 6012;
|
|
557
568
|
name: "rewardPoolDrained";
|
|
558
569
|
msg: "Reward Pool does not have enough Rewards for Claiming";
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
code: 6013;
|
|
573
|
+
name: "updateTooSoon";
|
|
574
|
+
msg: "Repeated update can not happen sooner than the stake pool max duration";
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
code: 6014;
|
|
578
|
+
name: "invalidLastClaimPeriod";
|
|
579
|
+
msg: "Invalid last claim period provided";
|
|
559
580
|
}
|
|
560
581
|
];
|
|
561
582
|
types: [
|
|
@@ -767,11 +788,16 @@ export type RewardPool = {
|
|
|
767
788
|
docs: ["Time when Reward Pool was created"];
|
|
768
789
|
type: "u64";
|
|
769
790
|
},
|
|
791
|
+
{
|
|
792
|
+
name: "lastClaimPeriod";
|
|
793
|
+
docs: ["For how much seconds after unstake user should be able to claim rewards"];
|
|
794
|
+
type: "u64";
|
|
795
|
+
},
|
|
770
796
|
{
|
|
771
797
|
name: "buffer";
|
|
772
798
|
docs: ["Buffer for additional fields"];
|
|
773
799
|
type: {
|
|
774
|
-
array: ["u8",
|
|
800
|
+
array: ["u8", 48];
|
|
775
801
|
};
|
|
776
802
|
}
|
|
777
803
|
];
|
|
@@ -41,6 +41,7 @@ export interface FundPoolArgs extends BaseStakePoolArgs, TokenProgram {
|
|
|
41
41
|
export interface CreateRewardEntryArgs extends BaseStakePoolArgs, TokenProgram {
|
|
42
42
|
depositNonce: number;
|
|
43
43
|
rewardPoolNonce: number;
|
|
44
|
+
rewardMint: Address;
|
|
44
45
|
}
|
|
45
46
|
export interface CreateRewardPoolArgs extends BaseStakePoolArgs, TokenProgram {
|
|
46
47
|
stakePoolNonce: number;
|
|
@@ -49,8 +50,10 @@ export interface CreateRewardPoolArgs extends BaseStakePoolArgs, TokenProgram {
|
|
|
49
50
|
rewardAmount: BN;
|
|
50
51
|
rewardPeriod: BN;
|
|
51
52
|
permissionless: boolean;
|
|
53
|
+
lastClaimPeriodOpt: BN | null;
|
|
52
54
|
}
|
|
53
55
|
export interface UpdateRewardPoolArgs {
|
|
56
|
+
stakePool: Address;
|
|
54
57
|
rewardAmount: BN | null;
|
|
55
58
|
rewardPeriod: BN | null;
|
|
56
59
|
rewardPool: Address;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/staking",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.3-alpha.0",
|
|
4
4
|
"description": "JavaScript SDK to interact with Streamflow Staking protocol.",
|
|
5
5
|
"homepage": "https://github.com/streamflow-finance/js-sdk/",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"pack": "pnpm build && pnpm pack",
|
|
26
26
|
"lint": "eslint --fix .",
|
|
27
27
|
"test": "vitest",
|
|
28
|
-
"prepublishOnly": "
|
|
28
|
+
"prepublishOnly": "pnpm run lint && pnpm run test run && pnpm run build"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "13884be9cf8313252173aadc45842a4598b1e335",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@streamflow/eslint-config": "7.0.
|
|
32
|
+
"@streamflow/eslint-config": "7.0.3-alpha.0",
|
|
33
33
|
"@types/bn.js": "5.1.1",
|
|
34
34
|
"typescript": "^5.6.3"
|
|
35
35
|
},
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@solana/spl-token": "0.4.9",
|
|
41
41
|
"@solana/wallet-adapter-base": "0.9.19",
|
|
42
42
|
"@solana/web3.js": "1.95.4",
|
|
43
|
-
"@streamflow/common": "7.0.
|
|
43
|
+
"@streamflow/common": "7.0.3-alpha.0",
|
|
44
44
|
"bn.js": "5.2.1",
|
|
45
45
|
"borsh": "^2.0.0",
|
|
46
46
|
"bs58": "5.0.0",
|