@zebec-network/zebec-stake-sdk 1.2.2 → 1.3.1

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.
@@ -61,7 +61,20 @@ export type ZebecStake = {
61
61
  seeds: [
62
62
  {
63
63
  kind: "const";
64
- value: [114, 101, 119, 97, 114, 100, 95, 118, 97, 117, 108, 116];
64
+ value: [
65
+ 114,
66
+ 101,
67
+ 119,
68
+ 97,
69
+ 114,
70
+ 100,
71
+ 95,
72
+ 118,
73
+ 97,
74
+ 117,
75
+ 108,
76
+ 116
77
+ ];
65
78
  },
66
79
  {
67
80
  kind: "account";
@@ -650,7 +663,20 @@ export type ZebecStake = {
650
663
  seeds: [
651
664
  {
652
665
  kind: "const";
653
- value: [114, 101, 119, 97, 114, 100, 95, 118, 97, 117, 108, 116];
666
+ value: [
667
+ 114,
668
+ 101,
669
+ 119,
670
+ 97,
671
+ 114,
672
+ 100,
673
+ 95,
674
+ 118,
675
+ 97,
676
+ 117,
677
+ 108,
678
+ 116
679
+ ];
654
680
  },
655
681
  {
656
682
  kind: "account";
@@ -23,7 +23,9 @@
23
23
  "seeds": [
24
24
  {
25
25
  "kind": "const",
26
- "value": [122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112]
26
+ "value": [
27
+ 122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112
28
+ ]
27
29
  },
28
30
  {
29
31
  "kind": "arg",
@@ -55,7 +57,9 @@
55
57
  "seeds": [
56
58
  {
57
59
  "kind": "const",
58
- "value": [114, 101, 119, 97, 114, 100, 95, 118, 97, 117, 108, 116]
60
+ "value": [
61
+ 114, 101, 119, 97, 114, 100, 95, 118, 97, 117, 108, 116
62
+ ]
59
63
  },
60
64
  {
61
65
  "kind": "account",
@@ -115,7 +119,9 @@
115
119
  "seeds": [
116
120
  {
117
121
  "kind": "const",
118
- "value": [122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112]
122
+ "value": [
123
+ 122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112
124
+ ]
119
125
  },
120
126
  {
121
127
  "kind": "account",
@@ -176,8 +182,9 @@
176
182
  {
177
183
  "kind": "const",
178
184
  "value": [
179
- 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
180
- 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
185
+ 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
186
+ 235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
187
+ 245, 133, 126, 255, 0, 169
181
188
  ]
182
189
  },
183
190
  {
@@ -188,8 +195,9 @@
188
195
  "program": {
189
196
  "kind": "const",
190
197
  "value": [
191
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
192
- 132, 4, 142, 123, 216, 219, 233, 248, 89
198
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
199
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
200
+ 219, 233, 248, 89
193
201
  ]
194
202
  }
195
203
  }
@@ -222,8 +230,9 @@
222
230
  {
223
231
  "kind": "const",
224
232
  "value": [
225
- 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
226
- 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
233
+ 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
234
+ 235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
235
+ 245, 133, 126, 255, 0, 169
227
236
  ]
228
237
  },
229
238
  {
@@ -234,8 +243,9 @@
234
243
  "program": {
235
244
  "kind": "const",
236
245
  "value": [
237
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
238
- 132, 4, 142, 123, 216, 219, 233, 248, 89
246
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
247
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
248
+ 219, 233, 248, 89
239
249
  ]
240
250
  }
241
251
  }
@@ -285,7 +295,9 @@
285
295
  "seeds": [
286
296
  {
287
297
  "kind": "const",
288
- "value": [122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112]
298
+ "value": [
299
+ 122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112
300
+ ]
289
301
  },
290
302
  {
291
303
  "kind": "account",
@@ -333,8 +345,9 @@
333
345
  {
334
346
  "kind": "const",
335
347
  "value": [
336
- 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
337
- 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
348
+ 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
349
+ 235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
350
+ 245, 133, 126, 255, 0, 169
338
351
  ]
339
352
  },
340
353
  {
@@ -345,8 +358,9 @@
345
358
  "program": {
346
359
  "kind": "const",
347
360
  "value": [
348
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
349
- 132, 4, 142, 123, 216, 219, 233, 248, 89
361
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
362
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
363
+ 219, 233, 248, 89
350
364
  ]
351
365
  }
352
366
  }
@@ -363,8 +377,9 @@
363
377
  {
364
378
  "kind": "const",
365
379
  "value": [
366
- 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
367
- 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
380
+ 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
381
+ 235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
382
+ 245, 133, 126, 255, 0, 169
368
383
  ]
369
384
  },
370
385
  {
@@ -375,8 +390,9 @@
375
390
  "program": {
376
391
  "kind": "const",
377
392
  "value": [
378
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
379
- 132, 4, 142, 123, 216, 219, 233, 248, 89
393
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
394
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
395
+ 219, 233, 248, 89
380
396
  ]
381
397
  }
382
398
  }
@@ -404,7 +420,9 @@
404
420
  "seeds": [
405
421
  {
406
422
  "kind": "const",
407
- "value": [114, 101, 119, 97, 114, 100, 95, 118, 97, 117, 108, 116]
423
+ "value": [
424
+ 114, 101, 119, 97, 114, 100, 95, 118, 97, 117, 108, 116
425
+ ]
408
426
  },
409
427
  {
410
428
  "kind": "account",
@@ -425,8 +443,9 @@
425
443
  {
426
444
  "kind": "const",
427
445
  "value": [
428
- 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
429
- 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
446
+ 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
447
+ 235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
448
+ 245, 133, 126, 255, 0, 169
430
449
  ]
431
450
  },
432
451
  {
@@ -437,8 +456,9 @@
437
456
  "program": {
438
457
  "kind": "const",
439
458
  "value": [
440
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
441
- 132, 4, 142, 123, 216, 219, 233, 248, 89
459
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
460
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
461
+ 219, 233, 248, 89
442
462
  ]
443
463
  }
444
464
  }
@@ -455,8 +475,9 @@
455
475
  {
456
476
  "kind": "const",
457
477
  "value": [
458
- 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
459
- 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
478
+ 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
479
+ 235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
480
+ 245, 133, 126, 255, 0, 169
460
481
  ]
461
482
  },
462
483
  {
@@ -467,8 +488,9 @@
467
488
  "program": {
468
489
  "kind": "const",
469
490
  "value": [
470
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
471
- 132, 4, 142, 123, 216, 219, 233, 248, 89
491
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
492
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
493
+ 219, 233, 248, 89
472
494
  ]
473
495
  }
474
496
  }
@@ -489,8 +511,9 @@
489
511
  {
490
512
  "kind": "const",
491
513
  "value": [
492
- 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
493
- 91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
514
+ 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206,
515
+ 235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140,
516
+ 245, 133, 126, 255, 0, 169
494
517
  ]
495
518
  },
496
519
  {
@@ -501,8 +524,9 @@
501
524
  "program": {
502
525
  "kind": "const",
503
526
  "value": [
504
- 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
505
- 132, 4, 142, 123, 216, 219, 233, 248, 89
527
+ 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142,
528
+ 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142, 123, 216,
529
+ 219, 233, 248, 89
506
530
  ]
507
531
  }
508
532
  }
@@ -543,7 +567,9 @@
543
567
  "seeds": [
544
568
  {
545
569
  "kind": "const",
546
- "value": [122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112]
570
+ "value": [
571
+ 122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112
572
+ ]
547
573
  },
548
574
  {
549
575
  "kind": "account",
@@ -581,7 +607,9 @@
581
607
  "seeds": [
582
608
  {
583
609
  "kind": "const",
584
- "value": [122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112]
610
+ "value": [
611
+ 122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112
612
+ ]
585
613
  },
586
614
  {
587
615
  "kind": "account",
@@ -7,3 +7,4 @@ export declare const ZEBEC_STAKE_PROGRAM: {
7
7
  /** Devnet Program Id */
8
8
  devnet: string;
9
9
  };
10
+ export declare const STAKE_LOOKUP_TABLE_ADDRESS: Record<"mainnet-beta" | "devnet", string>;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZEBEC_STAKE_PROGRAM = void 0;
3
+ exports.STAKE_LOOKUP_TABLE_ADDRESS = exports.ZEBEC_STAKE_PROGRAM = void 0;
4
4
  /**
5
5
  * Zebec Card Program Ids
6
6
  */
@@ -10,3 +10,7 @@ exports.ZEBEC_STAKE_PROGRAM = {
10
10
  /** Devnet Program Id */
11
11
  devnet: "zSTKzGLiN6T6EVzhBiL6sjULXMahDavAS2p4R62afGv",
12
12
  };
13
+ exports.STAKE_LOOKUP_TABLE_ADDRESS = {
14
+ "mainnet-beta": "EoKjJejKr4XsBdtUuYwzZcYd6tpGNijxCGgQocxtxQ8t",
15
+ devnet: "C4R2sL6yj7bzKfbdfwCfH68DZZ3QnzdmedE9wQqTfAAA",
16
+ };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export * from "./constants";
2
1
  export * from "./artifacts";
3
- export * from "./service";
4
- export * from "./providers";
2
+ export * from "./constants";
5
3
  export * from "./pda";
4
+ export * from "./providers";
6
5
  export * from "./rateLimitQueue";
6
+ export * from "./service";
7
+ export * from "./types";
package/dist/index.js CHANGED
@@ -14,9 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./constants"), exports);
18
17
  __exportStar(require("./artifacts"), exports);
19
- __exportStar(require("./service"), exports);
20
- __exportStar(require("./providers"), exports);
18
+ __exportStar(require("./constants"), exports);
21
19
  __exportStar(require("./pda"), exports);
20
+ __exportStar(require("./providers"), exports);
22
21
  __exportStar(require("./rateLimitQueue"), exports);
22
+ __exportStar(require("./service"), exports);
23
+ __exportStar(require("./types"), exports);
package/dist/pda.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Address } from "@coral-xyz/anchor";
1
+ import { type Address } from "@coral-xyz/anchor";
2
2
  import { PublicKey } from "@solana/web3.js";
3
3
  export declare function deriveStakeAddress(staker: Address, lockup: Address, nonce: bigint, programId?: Address): PublicKey;
4
4
  export declare function deriveLockupAddress(name: string, programId?: Address): PublicKey;
package/dist/pda.js CHANGED
@@ -30,10 +30,16 @@ function deriveUserNonceAddress(user, lockup, programId = constants_1.ZEBEC_STAK
30
30
  return userNonceAddress;
31
31
  }
32
32
  function deriveStakeVaultAddress(lockup, programId = constants_1.ZEBEC_STAKE_PROGRAM.mainnet) {
33
- const [stakeVault] = web3_js_1.PublicKey.findProgramAddressSync([anchor_1.utils.bytes.utf8.encode(SEEDS.stakeVault), (0, anchor_1.translateAddress)(lockup).toBuffer()], (0, anchor_1.translateAddress)(programId));
33
+ const [stakeVault] = web3_js_1.PublicKey.findProgramAddressSync([
34
+ anchor_1.utils.bytes.utf8.encode(SEEDS.stakeVault),
35
+ (0, anchor_1.translateAddress)(lockup).toBuffer(),
36
+ ], (0, anchor_1.translateAddress)(programId));
34
37
  return stakeVault;
35
38
  }
36
39
  function deriveRewardVaultAddress(lockup, programId = constants_1.ZEBEC_STAKE_PROGRAM.mainnet) {
37
- const [rewardVault] = web3_js_1.PublicKey.findProgramAddressSync([anchor_1.utils.bytes.utf8.encode(SEEDS.rewardVault), (0, anchor_1.translateAddress)(lockup).toBuffer()], (0, anchor_1.translateAddress)(programId));
40
+ const [rewardVault] = web3_js_1.PublicKey.findProgramAddressSync([
41
+ anchor_1.utils.bytes.utf8.encode(SEEDS.rewardVault),
42
+ (0, anchor_1.translateAddress)(lockup).toBuffer(),
43
+ ], (0, anchor_1.translateAddress)(programId));
38
44
  return rewardVault;
39
45
  }
@@ -1,5 +1,5 @@
1
- import { Address, AnchorProvider } from "@coral-xyz/anchor";
2
- import { ConfirmOptions, Connection, PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js";
1
+ import { type Address, AnchorProvider } from "@coral-xyz/anchor";
2
+ import type { ConfirmOptions, Connection, PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js";
3
3
  export declare class ReadonlyProvider {
4
4
  readonly connection: Connection;
5
5
  readonly walletAddress?: PublicKey;
package/dist/providers.js CHANGED
@@ -9,7 +9,9 @@ class ReadonlyProvider {
9
9
  walletAddress;
10
10
  constructor(connection, walletAddress) {
11
11
  this.connection = connection;
12
- this.walletAddress = walletAddress ? (0, anchor_1.translateAddress)(walletAddress) : undefined;
12
+ this.walletAddress = walletAddress
13
+ ? (0, anchor_1.translateAddress)(walletAddress)
14
+ : undefined;
13
15
  }
14
16
  }
15
17
  exports.ReadonlyProvider = ReadonlyProvider;
package/dist/service.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { Address, AnchorProvider, BN, Program, Provider } from "@coral-xyz/anchor";
2
- import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js";
1
+ import { type Address, AnchorProvider, BN, Program, type Provider } from "@coral-xyz/anchor";
2
+ import { Connection, type PublicKey, type TransactionInstruction } from "@solana/web3.js";
3
3
  import { TransactionPayload } from "@zebec-network/solana-common";
4
- import { ZebecStakeIdlV1 } from "./artifacts";
5
- import { ReadonlyProvider } from "./providers";
4
+ import { type ZebecStakeIdlV1 } from "./artifacts";
5
+ import { type ReadonlyProvider } from "./providers";
6
+ import type { InitLockupInstructionData, LockupInfo, Numeric, RewardScheme, StakeInfo, StakeInfoWithHash, StakeInstructionData, UpdateLockupInstructionData, UserNonceInfo } from "./types";
6
7
  type ProgramCreateFunction = (provider: ReadonlyProvider | AnchorProvider) => Program<ZebecStakeIdlV1>;
7
8
  /**
8
9
  * StakeServiceBuilder is a builder class for creating a StakeService instance.
@@ -92,69 +93,4 @@ export declare class StakeService {
92
93
  get programId(): PublicKey;
93
94
  get connection(): Connection;
94
95
  }
95
- export type InitLockupInstructionData = {
96
- rewardSchemes: ParsedRewardScheme[];
97
- fee: BN;
98
- feeVault: PublicKey;
99
- name: string;
100
- minimumStake: BN;
101
- };
102
- export type UpdateLockupInstructionData = {
103
- rewardSchemes: ParsedRewardScheme[];
104
- fee: BN;
105
- feeVault: PublicKey;
106
- minimumStake: BN;
107
- };
108
- export type ParsedRewardScheme = {
109
- duration: BN;
110
- reward: BN;
111
- };
112
- type Numeric = string | number;
113
- export type RewardScheme = {
114
- duration: number;
115
- rewardRate: Numeric;
116
- };
117
- export type StakeInstructionData = {
118
- amount: BN;
119
- lockPeriod: BN;
120
- nonce: BN;
121
- };
122
- export type LockupInfo = {
123
- address: string;
124
- feeInfo: {
125
- fee: string;
126
- feeVault: string;
127
- };
128
- rewardToken: {
129
- tokenAddress: string;
130
- };
131
- stakeToken: {
132
- tokenAdress: string;
133
- totalStaked: string;
134
- };
135
- stakeInfo: {
136
- name: string;
137
- creator: string;
138
- rewardSchemes: RewardScheme[];
139
- minimumStake: string;
140
- };
141
- };
142
- export type StakeInfo = {
143
- address: string;
144
- nonce: bigint;
145
- createdTime: number;
146
- stakedAmount: string;
147
- rewardAmount: string;
148
- stakeClaimed: boolean;
149
- lockPeriod: number;
150
- staker: string;
151
- lockup: string;
152
- };
153
- export type UserNonceInfo = {
154
- address: string;
155
- nonce: bigint;
156
- };
157
- export type StakeInfoWithHash = StakeInfo & {
158
- hash: string;
159
- };
160
96
  export {};