@zebec-network/zebec-stake-sdk 1.0.4 → 1.0.6
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/README.md +18 -0
- package/dist/artifacts/zebec_stake_v1.json +44 -641
- package/dist/rateLimitQueue.d.ts +12 -0
- package/dist/rateLimitQueue.js +57 -0
- package/dist/service.d.ts +4 -3
- package/dist/service.js +12 -7
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +31 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,16 +9,7 @@
|
|
|
9
9
|
"instructions": [
|
|
10
10
|
{
|
|
11
11
|
"name": "init_lockup",
|
|
12
|
-
"discriminator": [
|
|
13
|
-
6,
|
|
14
|
-
96,
|
|
15
|
-
207,
|
|
16
|
-
185,
|
|
17
|
-
103,
|
|
18
|
-
62,
|
|
19
|
-
239,
|
|
20
|
-
168
|
|
21
|
-
],
|
|
12
|
+
"discriminator": [6, 96, 207, 185, 103, 62, 239, 168],
|
|
22
13
|
"accounts": [
|
|
23
14
|
{
|
|
24
15
|
"name": "creator",
|
|
@@ -32,20 +23,7 @@
|
|
|
32
23
|
"seeds": [
|
|
33
24
|
{
|
|
34
25
|
"kind": "const",
|
|
35
|
-
"value": [
|
|
36
|
-
122,
|
|
37
|
-
101,
|
|
38
|
-
98,
|
|
39
|
-
101,
|
|
40
|
-
99,
|
|
41
|
-
95,
|
|
42
|
-
108,
|
|
43
|
-
111,
|
|
44
|
-
99,
|
|
45
|
-
107,
|
|
46
|
-
117,
|
|
47
|
-
112
|
|
48
|
-
]
|
|
26
|
+
"value": [122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112]
|
|
49
27
|
},
|
|
50
28
|
{
|
|
51
29
|
"kind": "arg",
|
|
@@ -61,19 +39,7 @@
|
|
|
61
39
|
"seeds": [
|
|
62
40
|
{
|
|
63
41
|
"kind": "const",
|
|
64
|
-
"value": [
|
|
65
|
-
115,
|
|
66
|
-
116,
|
|
67
|
-
97,
|
|
68
|
-
107,
|
|
69
|
-
101,
|
|
70
|
-
95,
|
|
71
|
-
118,
|
|
72
|
-
97,
|
|
73
|
-
117,
|
|
74
|
-
108,
|
|
75
|
-
116
|
|
76
|
-
]
|
|
42
|
+
"value": [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116]
|
|
77
43
|
},
|
|
78
44
|
{
|
|
79
45
|
"kind": "account",
|
|
@@ -89,20 +55,7 @@
|
|
|
89
55
|
"seeds": [
|
|
90
56
|
{
|
|
91
57
|
"kind": "const",
|
|
92
|
-
"value": [
|
|
93
|
-
114,
|
|
94
|
-
101,
|
|
95
|
-
119,
|
|
96
|
-
97,
|
|
97
|
-
114,
|
|
98
|
-
100,
|
|
99
|
-
95,
|
|
100
|
-
118,
|
|
101
|
-
97,
|
|
102
|
-
117,
|
|
103
|
-
108,
|
|
104
|
-
116
|
|
105
|
-
]
|
|
58
|
+
"value": [114, 101, 119, 97, 114, 100, 95, 118, 97, 117, 108, 116]
|
|
106
59
|
},
|
|
107
60
|
{
|
|
108
61
|
"kind": "account",
|
|
@@ -143,16 +96,7 @@
|
|
|
143
96
|
},
|
|
144
97
|
{
|
|
145
98
|
"name": "stake_zbcn",
|
|
146
|
-
"discriminator": [
|
|
147
|
-
93,
|
|
148
|
-
162,
|
|
149
|
-
156,
|
|
150
|
-
54,
|
|
151
|
-
43,
|
|
152
|
-
11,
|
|
153
|
-
15,
|
|
154
|
-
122
|
|
155
|
-
],
|
|
99
|
+
"discriminator": [93, 162, 156, 54, 43, 11, 15, 122],
|
|
156
100
|
"accounts": [
|
|
157
101
|
{
|
|
158
102
|
"name": "staker",
|
|
@@ -166,20 +110,7 @@
|
|
|
166
110
|
"seeds": [
|
|
167
111
|
{
|
|
168
112
|
"kind": "const",
|
|
169
|
-
"value": [
|
|
170
|
-
122,
|
|
171
|
-
101,
|
|
172
|
-
98,
|
|
173
|
-
101,
|
|
174
|
-
99,
|
|
175
|
-
95,
|
|
176
|
-
108,
|
|
177
|
-
111,
|
|
178
|
-
99,
|
|
179
|
-
107,
|
|
180
|
-
117,
|
|
181
|
-
112
|
|
182
|
-
]
|
|
113
|
+
"value": [122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112]
|
|
183
114
|
},
|
|
184
115
|
{
|
|
185
116
|
"kind": "account",
|
|
@@ -240,38 +171,8 @@
|
|
|
240
171
|
{
|
|
241
172
|
"kind": "const",
|
|
242
173
|
"value": [
|
|
243
|
-
6,
|
|
244
|
-
|
|
245
|
-
246,
|
|
246
|
-
225,
|
|
247
|
-
215,
|
|
248
|
-
101,
|
|
249
|
-
161,
|
|
250
|
-
147,
|
|
251
|
-
217,
|
|
252
|
-
203,
|
|
253
|
-
225,
|
|
254
|
-
70,
|
|
255
|
-
206,
|
|
256
|
-
235,
|
|
257
|
-
121,
|
|
258
|
-
172,
|
|
259
|
-
28,
|
|
260
|
-
180,
|
|
261
|
-
133,
|
|
262
|
-
237,
|
|
263
|
-
95,
|
|
264
|
-
91,
|
|
265
|
-
55,
|
|
266
|
-
145,
|
|
267
|
-
58,
|
|
268
|
-
140,
|
|
269
|
-
245,
|
|
270
|
-
133,
|
|
271
|
-
126,
|
|
272
|
-
255,
|
|
273
|
-
0,
|
|
274
|
-
169
|
|
174
|
+
6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
|
|
175
|
+
91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
|
|
275
176
|
]
|
|
276
177
|
},
|
|
277
178
|
{
|
|
@@ -282,38 +183,8 @@
|
|
|
282
183
|
"program": {
|
|
283
184
|
"kind": "const",
|
|
284
185
|
"value": [
|
|
285
|
-
140,
|
|
286
|
-
|
|
287
|
-
37,
|
|
288
|
-
143,
|
|
289
|
-
78,
|
|
290
|
-
36,
|
|
291
|
-
137,
|
|
292
|
-
241,
|
|
293
|
-
187,
|
|
294
|
-
61,
|
|
295
|
-
16,
|
|
296
|
-
41,
|
|
297
|
-
20,
|
|
298
|
-
142,
|
|
299
|
-
13,
|
|
300
|
-
131,
|
|
301
|
-
11,
|
|
302
|
-
90,
|
|
303
|
-
19,
|
|
304
|
-
153,
|
|
305
|
-
218,
|
|
306
|
-
255,
|
|
307
|
-
16,
|
|
308
|
-
132,
|
|
309
|
-
4,
|
|
310
|
-
142,
|
|
311
|
-
123,
|
|
312
|
-
216,
|
|
313
|
-
219,
|
|
314
|
-
233,
|
|
315
|
-
248,
|
|
316
|
-
89
|
|
186
|
+
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
|
|
187
|
+
132, 4, 142, 123, 216, 219, 233, 248, 89
|
|
317
188
|
]
|
|
318
189
|
}
|
|
319
190
|
}
|
|
@@ -325,19 +196,7 @@
|
|
|
325
196
|
"seeds": [
|
|
326
197
|
{
|
|
327
198
|
"kind": "const",
|
|
328
|
-
"value": [
|
|
329
|
-
115,
|
|
330
|
-
116,
|
|
331
|
-
97,
|
|
332
|
-
107,
|
|
333
|
-
101,
|
|
334
|
-
95,
|
|
335
|
-
118,
|
|
336
|
-
97,
|
|
337
|
-
117,
|
|
338
|
-
108,
|
|
339
|
-
116
|
|
340
|
-
]
|
|
199
|
+
"value": [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116]
|
|
341
200
|
},
|
|
342
201
|
{
|
|
343
202
|
"kind": "account",
|
|
@@ -358,38 +217,8 @@
|
|
|
358
217
|
{
|
|
359
218
|
"kind": "const",
|
|
360
219
|
"value": [
|
|
361
|
-
6,
|
|
362
|
-
|
|
363
|
-
246,
|
|
364
|
-
225,
|
|
365
|
-
215,
|
|
366
|
-
101,
|
|
367
|
-
161,
|
|
368
|
-
147,
|
|
369
|
-
217,
|
|
370
|
-
203,
|
|
371
|
-
225,
|
|
372
|
-
70,
|
|
373
|
-
206,
|
|
374
|
-
235,
|
|
375
|
-
121,
|
|
376
|
-
172,
|
|
377
|
-
28,
|
|
378
|
-
180,
|
|
379
|
-
133,
|
|
380
|
-
237,
|
|
381
|
-
95,
|
|
382
|
-
91,
|
|
383
|
-
55,
|
|
384
|
-
145,
|
|
385
|
-
58,
|
|
386
|
-
140,
|
|
387
|
-
245,
|
|
388
|
-
133,
|
|
389
|
-
126,
|
|
390
|
-
255,
|
|
391
|
-
0,
|
|
392
|
-
169
|
|
220
|
+
6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
|
|
221
|
+
91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
|
|
393
222
|
]
|
|
394
223
|
},
|
|
395
224
|
{
|
|
@@ -400,38 +229,8 @@
|
|
|
400
229
|
"program": {
|
|
401
230
|
"kind": "const",
|
|
402
231
|
"value": [
|
|
403
|
-
140,
|
|
404
|
-
|
|
405
|
-
37,
|
|
406
|
-
143,
|
|
407
|
-
78,
|
|
408
|
-
36,
|
|
409
|
-
137,
|
|
410
|
-
241,
|
|
411
|
-
187,
|
|
412
|
-
61,
|
|
413
|
-
16,
|
|
414
|
-
41,
|
|
415
|
-
20,
|
|
416
|
-
142,
|
|
417
|
-
13,
|
|
418
|
-
131,
|
|
419
|
-
11,
|
|
420
|
-
90,
|
|
421
|
-
19,
|
|
422
|
-
153,
|
|
423
|
-
218,
|
|
424
|
-
255,
|
|
425
|
-
16,
|
|
426
|
-
132,
|
|
427
|
-
4,
|
|
428
|
-
142,
|
|
429
|
-
123,
|
|
430
|
-
216,
|
|
431
|
-
219,
|
|
432
|
-
233,
|
|
433
|
-
248,
|
|
434
|
-
89
|
|
232
|
+
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
|
|
233
|
+
132, 4, 142, 123, 216, 219, 233, 248, 89
|
|
435
234
|
]
|
|
436
235
|
}
|
|
437
236
|
}
|
|
@@ -462,16 +261,7 @@
|
|
|
462
261
|
},
|
|
463
262
|
{
|
|
464
263
|
"name": "unstake_zbcn",
|
|
465
|
-
"discriminator": [
|
|
466
|
-
90,
|
|
467
|
-
202,
|
|
468
|
-
101,
|
|
469
|
-
187,
|
|
470
|
-
218,
|
|
471
|
-
99,
|
|
472
|
-
244,
|
|
473
|
-
1
|
|
474
|
-
],
|
|
264
|
+
"discriminator": [90, 202, 101, 187, 218, 99, 244, 1],
|
|
475
265
|
"accounts": [
|
|
476
266
|
{
|
|
477
267
|
"name": "staker",
|
|
@@ -485,20 +275,7 @@
|
|
|
485
275
|
"seeds": [
|
|
486
276
|
{
|
|
487
277
|
"kind": "const",
|
|
488
|
-
"value": [
|
|
489
|
-
122,
|
|
490
|
-
101,
|
|
491
|
-
98,
|
|
492
|
-
101,
|
|
493
|
-
99,
|
|
494
|
-
95,
|
|
495
|
-
108,
|
|
496
|
-
111,
|
|
497
|
-
99,
|
|
498
|
-
107,
|
|
499
|
-
117,
|
|
500
|
-
112
|
|
501
|
-
]
|
|
278
|
+
"value": [122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112]
|
|
502
279
|
},
|
|
503
280
|
{
|
|
504
281
|
"kind": "account",
|
|
@@ -546,38 +323,8 @@
|
|
|
546
323
|
{
|
|
547
324
|
"kind": "const",
|
|
548
325
|
"value": [
|
|
549
|
-
6,
|
|
550
|
-
|
|
551
|
-
246,
|
|
552
|
-
225,
|
|
553
|
-
215,
|
|
554
|
-
101,
|
|
555
|
-
161,
|
|
556
|
-
147,
|
|
557
|
-
217,
|
|
558
|
-
203,
|
|
559
|
-
225,
|
|
560
|
-
70,
|
|
561
|
-
206,
|
|
562
|
-
235,
|
|
563
|
-
121,
|
|
564
|
-
172,
|
|
565
|
-
28,
|
|
566
|
-
180,
|
|
567
|
-
133,
|
|
568
|
-
237,
|
|
569
|
-
95,
|
|
570
|
-
91,
|
|
571
|
-
55,
|
|
572
|
-
145,
|
|
573
|
-
58,
|
|
574
|
-
140,
|
|
575
|
-
245,
|
|
576
|
-
133,
|
|
577
|
-
126,
|
|
578
|
-
255,
|
|
579
|
-
0,
|
|
580
|
-
169
|
|
326
|
+
6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
|
|
327
|
+
91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
|
|
581
328
|
]
|
|
582
329
|
},
|
|
583
330
|
{
|
|
@@ -588,38 +335,8 @@
|
|
|
588
335
|
"program": {
|
|
589
336
|
"kind": "const",
|
|
590
337
|
"value": [
|
|
591
|
-
140,
|
|
592
|
-
|
|
593
|
-
37,
|
|
594
|
-
143,
|
|
595
|
-
78,
|
|
596
|
-
36,
|
|
597
|
-
137,
|
|
598
|
-
241,
|
|
599
|
-
187,
|
|
600
|
-
61,
|
|
601
|
-
16,
|
|
602
|
-
41,
|
|
603
|
-
20,
|
|
604
|
-
142,
|
|
605
|
-
13,
|
|
606
|
-
131,
|
|
607
|
-
11,
|
|
608
|
-
90,
|
|
609
|
-
19,
|
|
610
|
-
153,
|
|
611
|
-
218,
|
|
612
|
-
255,
|
|
613
|
-
16,
|
|
614
|
-
132,
|
|
615
|
-
4,
|
|
616
|
-
142,
|
|
617
|
-
123,
|
|
618
|
-
216,
|
|
619
|
-
219,
|
|
620
|
-
233,
|
|
621
|
-
248,
|
|
622
|
-
89
|
|
338
|
+
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
|
|
339
|
+
132, 4, 142, 123, 216, 219, 233, 248, 89
|
|
623
340
|
]
|
|
624
341
|
}
|
|
625
342
|
}
|
|
@@ -636,38 +353,8 @@
|
|
|
636
353
|
{
|
|
637
354
|
"kind": "const",
|
|
638
355
|
"value": [
|
|
639
|
-
6,
|
|
640
|
-
|
|
641
|
-
246,
|
|
642
|
-
225,
|
|
643
|
-
215,
|
|
644
|
-
101,
|
|
645
|
-
161,
|
|
646
|
-
147,
|
|
647
|
-
217,
|
|
648
|
-
203,
|
|
649
|
-
225,
|
|
650
|
-
70,
|
|
651
|
-
206,
|
|
652
|
-
235,
|
|
653
|
-
121,
|
|
654
|
-
172,
|
|
655
|
-
28,
|
|
656
|
-
180,
|
|
657
|
-
133,
|
|
658
|
-
237,
|
|
659
|
-
95,
|
|
660
|
-
91,
|
|
661
|
-
55,
|
|
662
|
-
145,
|
|
663
|
-
58,
|
|
664
|
-
140,
|
|
665
|
-
245,
|
|
666
|
-
133,
|
|
667
|
-
126,
|
|
668
|
-
255,
|
|
669
|
-
0,
|
|
670
|
-
169
|
|
356
|
+
6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
|
|
357
|
+
91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
|
|
671
358
|
]
|
|
672
359
|
},
|
|
673
360
|
{
|
|
@@ -678,38 +365,8 @@
|
|
|
678
365
|
"program": {
|
|
679
366
|
"kind": "const",
|
|
680
367
|
"value": [
|
|
681
|
-
140,
|
|
682
|
-
|
|
683
|
-
37,
|
|
684
|
-
143,
|
|
685
|
-
78,
|
|
686
|
-
36,
|
|
687
|
-
137,
|
|
688
|
-
241,
|
|
689
|
-
187,
|
|
690
|
-
61,
|
|
691
|
-
16,
|
|
692
|
-
41,
|
|
693
|
-
20,
|
|
694
|
-
142,
|
|
695
|
-
13,
|
|
696
|
-
131,
|
|
697
|
-
11,
|
|
698
|
-
90,
|
|
699
|
-
19,
|
|
700
|
-
153,
|
|
701
|
-
218,
|
|
702
|
-
255,
|
|
703
|
-
16,
|
|
704
|
-
132,
|
|
705
|
-
4,
|
|
706
|
-
142,
|
|
707
|
-
123,
|
|
708
|
-
216,
|
|
709
|
-
219,
|
|
710
|
-
233,
|
|
711
|
-
248,
|
|
712
|
-
89
|
|
368
|
+
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
|
|
369
|
+
132, 4, 142, 123, 216, 219, 233, 248, 89
|
|
713
370
|
]
|
|
714
371
|
}
|
|
715
372
|
}
|
|
@@ -721,19 +378,7 @@
|
|
|
721
378
|
"seeds": [
|
|
722
379
|
{
|
|
723
380
|
"kind": "const",
|
|
724
|
-
"value": [
|
|
725
|
-
115,
|
|
726
|
-
116,
|
|
727
|
-
97,
|
|
728
|
-
107,
|
|
729
|
-
101,
|
|
730
|
-
95,
|
|
731
|
-
118,
|
|
732
|
-
97,
|
|
733
|
-
117,
|
|
734
|
-
108,
|
|
735
|
-
116
|
|
736
|
-
]
|
|
381
|
+
"value": [115, 116, 97, 107, 101, 95, 118, 97, 117, 108, 116]
|
|
737
382
|
},
|
|
738
383
|
{
|
|
739
384
|
"kind": "account",
|
|
@@ -749,20 +394,7 @@
|
|
|
749
394
|
"seeds": [
|
|
750
395
|
{
|
|
751
396
|
"kind": "const",
|
|
752
|
-
"value": [
|
|
753
|
-
114,
|
|
754
|
-
101,
|
|
755
|
-
119,
|
|
756
|
-
97,
|
|
757
|
-
114,
|
|
758
|
-
100,
|
|
759
|
-
95,
|
|
760
|
-
118,
|
|
761
|
-
97,
|
|
762
|
-
117,
|
|
763
|
-
108,
|
|
764
|
-
116
|
|
765
|
-
]
|
|
397
|
+
"value": [114, 101, 119, 97, 114, 100, 95, 118, 97, 117, 108, 116]
|
|
766
398
|
},
|
|
767
399
|
{
|
|
768
400
|
"kind": "account",
|
|
@@ -783,38 +415,8 @@
|
|
|
783
415
|
{
|
|
784
416
|
"kind": "const",
|
|
785
417
|
"value": [
|
|
786
|
-
6,
|
|
787
|
-
|
|
788
|
-
246,
|
|
789
|
-
225,
|
|
790
|
-
215,
|
|
791
|
-
101,
|
|
792
|
-
161,
|
|
793
|
-
147,
|
|
794
|
-
217,
|
|
795
|
-
203,
|
|
796
|
-
225,
|
|
797
|
-
70,
|
|
798
|
-
206,
|
|
799
|
-
235,
|
|
800
|
-
121,
|
|
801
|
-
172,
|
|
802
|
-
28,
|
|
803
|
-
180,
|
|
804
|
-
133,
|
|
805
|
-
237,
|
|
806
|
-
95,
|
|
807
|
-
91,
|
|
808
|
-
55,
|
|
809
|
-
145,
|
|
810
|
-
58,
|
|
811
|
-
140,
|
|
812
|
-
245,
|
|
813
|
-
133,
|
|
814
|
-
126,
|
|
815
|
-
255,
|
|
816
|
-
0,
|
|
817
|
-
169
|
|
418
|
+
6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
|
|
419
|
+
91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
|
|
818
420
|
]
|
|
819
421
|
},
|
|
820
422
|
{
|
|
@@ -825,38 +427,8 @@
|
|
|
825
427
|
"program": {
|
|
826
428
|
"kind": "const",
|
|
827
429
|
"value": [
|
|
828
|
-
140,
|
|
829
|
-
|
|
830
|
-
37,
|
|
831
|
-
143,
|
|
832
|
-
78,
|
|
833
|
-
36,
|
|
834
|
-
137,
|
|
835
|
-
241,
|
|
836
|
-
187,
|
|
837
|
-
61,
|
|
838
|
-
16,
|
|
839
|
-
41,
|
|
840
|
-
20,
|
|
841
|
-
142,
|
|
842
|
-
13,
|
|
843
|
-
131,
|
|
844
|
-
11,
|
|
845
|
-
90,
|
|
846
|
-
19,
|
|
847
|
-
153,
|
|
848
|
-
218,
|
|
849
|
-
255,
|
|
850
|
-
16,
|
|
851
|
-
132,
|
|
852
|
-
4,
|
|
853
|
-
142,
|
|
854
|
-
123,
|
|
855
|
-
216,
|
|
856
|
-
219,
|
|
857
|
-
233,
|
|
858
|
-
248,
|
|
859
|
-
89
|
|
430
|
+
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
|
|
431
|
+
132, 4, 142, 123, 216, 219, 233, 248, 89
|
|
860
432
|
]
|
|
861
433
|
}
|
|
862
434
|
}
|
|
@@ -873,38 +445,8 @@
|
|
|
873
445
|
{
|
|
874
446
|
"kind": "const",
|
|
875
447
|
"value": [
|
|
876
|
-
6,
|
|
877
|
-
|
|
878
|
-
246,
|
|
879
|
-
225,
|
|
880
|
-
215,
|
|
881
|
-
101,
|
|
882
|
-
161,
|
|
883
|
-
147,
|
|
884
|
-
217,
|
|
885
|
-
203,
|
|
886
|
-
225,
|
|
887
|
-
70,
|
|
888
|
-
206,
|
|
889
|
-
235,
|
|
890
|
-
121,
|
|
891
|
-
172,
|
|
892
|
-
28,
|
|
893
|
-
180,
|
|
894
|
-
133,
|
|
895
|
-
237,
|
|
896
|
-
95,
|
|
897
|
-
91,
|
|
898
|
-
55,
|
|
899
|
-
145,
|
|
900
|
-
58,
|
|
901
|
-
140,
|
|
902
|
-
245,
|
|
903
|
-
133,
|
|
904
|
-
126,
|
|
905
|
-
255,
|
|
906
|
-
0,
|
|
907
|
-
169
|
|
448
|
+
6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
|
|
449
|
+
91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
|
|
908
450
|
]
|
|
909
451
|
},
|
|
910
452
|
{
|
|
@@ -915,38 +457,8 @@
|
|
|
915
457
|
"program": {
|
|
916
458
|
"kind": "const",
|
|
917
459
|
"value": [
|
|
918
|
-
140,
|
|
919
|
-
|
|
920
|
-
37,
|
|
921
|
-
143,
|
|
922
|
-
78,
|
|
923
|
-
36,
|
|
924
|
-
137,
|
|
925
|
-
241,
|
|
926
|
-
187,
|
|
927
|
-
61,
|
|
928
|
-
16,
|
|
929
|
-
41,
|
|
930
|
-
20,
|
|
931
|
-
142,
|
|
932
|
-
13,
|
|
933
|
-
131,
|
|
934
|
-
11,
|
|
935
|
-
90,
|
|
936
|
-
19,
|
|
937
|
-
153,
|
|
938
|
-
218,
|
|
939
|
-
255,
|
|
940
|
-
16,
|
|
941
|
-
132,
|
|
942
|
-
4,
|
|
943
|
-
142,
|
|
944
|
-
123,
|
|
945
|
-
216,
|
|
946
|
-
219,
|
|
947
|
-
233,
|
|
948
|
-
248,
|
|
949
|
-
89
|
|
460
|
+
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
|
|
461
|
+
132, 4, 142, 123, 216, 219, 233, 248, 89
|
|
950
462
|
]
|
|
951
463
|
}
|
|
952
464
|
}
|
|
@@ -967,38 +479,8 @@
|
|
|
967
479
|
{
|
|
968
480
|
"kind": "const",
|
|
969
481
|
"value": [
|
|
970
|
-
6,
|
|
971
|
-
|
|
972
|
-
246,
|
|
973
|
-
225,
|
|
974
|
-
215,
|
|
975
|
-
101,
|
|
976
|
-
161,
|
|
977
|
-
147,
|
|
978
|
-
217,
|
|
979
|
-
203,
|
|
980
|
-
225,
|
|
981
|
-
70,
|
|
982
|
-
206,
|
|
983
|
-
235,
|
|
984
|
-
121,
|
|
985
|
-
172,
|
|
986
|
-
28,
|
|
987
|
-
180,
|
|
988
|
-
133,
|
|
989
|
-
237,
|
|
990
|
-
95,
|
|
991
|
-
91,
|
|
992
|
-
55,
|
|
993
|
-
145,
|
|
994
|
-
58,
|
|
995
|
-
140,
|
|
996
|
-
245,
|
|
997
|
-
133,
|
|
998
|
-
126,
|
|
999
|
-
255,
|
|
1000
|
-
0,
|
|
1001
|
-
169
|
|
482
|
+
6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95,
|
|
483
|
+
91, 55, 145, 58, 140, 245, 133, 126, 255, 0, 169
|
|
1002
484
|
]
|
|
1003
485
|
},
|
|
1004
486
|
{
|
|
@@ -1009,38 +491,8 @@
|
|
|
1009
491
|
"program": {
|
|
1010
492
|
"kind": "const",
|
|
1011
493
|
"value": [
|
|
1012
|
-
140,
|
|
1013
|
-
|
|
1014
|
-
37,
|
|
1015
|
-
143,
|
|
1016
|
-
78,
|
|
1017
|
-
36,
|
|
1018
|
-
137,
|
|
1019
|
-
241,
|
|
1020
|
-
187,
|
|
1021
|
-
61,
|
|
1022
|
-
16,
|
|
1023
|
-
41,
|
|
1024
|
-
20,
|
|
1025
|
-
142,
|
|
1026
|
-
13,
|
|
1027
|
-
131,
|
|
1028
|
-
11,
|
|
1029
|
-
90,
|
|
1030
|
-
19,
|
|
1031
|
-
153,
|
|
1032
|
-
218,
|
|
1033
|
-
255,
|
|
1034
|
-
16,
|
|
1035
|
-
132,
|
|
1036
|
-
4,
|
|
1037
|
-
142,
|
|
1038
|
-
123,
|
|
1039
|
-
216,
|
|
1040
|
-
219,
|
|
1041
|
-
233,
|
|
1042
|
-
248,
|
|
1043
|
-
89
|
|
494
|
+
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16,
|
|
495
|
+
132, 4, 142, 123, 216, 219, 233, 248, 89
|
|
1044
496
|
]
|
|
1045
497
|
}
|
|
1046
498
|
}
|
|
@@ -1067,16 +519,7 @@
|
|
|
1067
519
|
},
|
|
1068
520
|
{
|
|
1069
521
|
"name": "whitelist_staker",
|
|
1070
|
-
"discriminator": [
|
|
1071
|
-
13,
|
|
1072
|
-
211,
|
|
1073
|
-
22,
|
|
1074
|
-
179,
|
|
1075
|
-
35,
|
|
1076
|
-
177,
|
|
1077
|
-
63,
|
|
1078
|
-
155
|
|
1079
|
-
],
|
|
522
|
+
"discriminator": [13, 211, 22, 179, 35, 177, 63, 155],
|
|
1080
523
|
"accounts": [
|
|
1081
524
|
{
|
|
1082
525
|
"name": "admin",
|
|
@@ -1090,20 +533,7 @@
|
|
|
1090
533
|
"seeds": [
|
|
1091
534
|
{
|
|
1092
535
|
"kind": "const",
|
|
1093
|
-
"value": [
|
|
1094
|
-
122,
|
|
1095
|
-
101,
|
|
1096
|
-
98,
|
|
1097
|
-
101,
|
|
1098
|
-
99,
|
|
1099
|
-
95,
|
|
1100
|
-
108,
|
|
1101
|
-
111,
|
|
1102
|
-
99,
|
|
1103
|
-
107,
|
|
1104
|
-
117,
|
|
1105
|
-
112
|
|
1106
|
-
]
|
|
536
|
+
"value": [122, 101, 98, 101, 99, 95, 108, 111, 99, 107, 117, 112]
|
|
1107
537
|
},
|
|
1108
538
|
{
|
|
1109
539
|
"kind": "account",
|
|
@@ -1175,42 +605,15 @@
|
|
|
1175
605
|
"accounts": [
|
|
1176
606
|
{
|
|
1177
607
|
"name": "Lockup",
|
|
1178
|
-
"discriminator": [
|
|
1179
|
-
1,
|
|
1180
|
-
45,
|
|
1181
|
-
32,
|
|
1182
|
-
32,
|
|
1183
|
-
57,
|
|
1184
|
-
81,
|
|
1185
|
-
88,
|
|
1186
|
-
67
|
|
1187
|
-
]
|
|
608
|
+
"discriminator": [1, 45, 32, 32, 57, 81, 88, 67]
|
|
1188
609
|
},
|
|
1189
610
|
{
|
|
1190
611
|
"name": "UserNonce",
|
|
1191
|
-
"discriminator": [
|
|
1192
|
-
235,
|
|
1193
|
-
133,
|
|
1194
|
-
1,
|
|
1195
|
-
243,
|
|
1196
|
-
18,
|
|
1197
|
-
135,
|
|
1198
|
-
88,
|
|
1199
|
-
224
|
|
1200
|
-
]
|
|
612
|
+
"discriminator": [235, 133, 1, 243, 18, 135, 88, 224]
|
|
1201
613
|
},
|
|
1202
614
|
{
|
|
1203
615
|
"name": "UserStakeData",
|
|
1204
|
-
"discriminator": [
|
|
1205
|
-
105,
|
|
1206
|
-
207,
|
|
1207
|
-
3,
|
|
1208
|
-
141,
|
|
1209
|
-
114,
|
|
1210
|
-
114,
|
|
1211
|
-
232,
|
|
1212
|
-
147
|
|
1213
|
-
]
|
|
616
|
+
"discriminator": [105, 207, 3, 141, 114, 114, 232, 147]
|
|
1214
617
|
}
|
|
1215
618
|
],
|
|
1216
619
|
"errors": [
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class RateLimitedQueue {
|
|
2
|
+
private queue;
|
|
3
|
+
private running;
|
|
4
|
+
private maxConcurrent;
|
|
5
|
+
private minDelay;
|
|
6
|
+
private lastRequestTime;
|
|
7
|
+
constructor(maxConcurrent?: number, minDelayMs?: number);
|
|
8
|
+
add<T>(task: () => Promise<T>): Promise<T>;
|
|
9
|
+
private processQueue;
|
|
10
|
+
getQueueLength(): number;
|
|
11
|
+
getRunningCount(): number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RateLimitedQueue = void 0;
|
|
4
|
+
class RateLimitedQueue {
|
|
5
|
+
queue = [];
|
|
6
|
+
running = 0;
|
|
7
|
+
maxConcurrent;
|
|
8
|
+
minDelay;
|
|
9
|
+
lastRequestTime = 0;
|
|
10
|
+
constructor(maxConcurrent = 3, minDelayMs = 200) {
|
|
11
|
+
this.maxConcurrent = maxConcurrent;
|
|
12
|
+
this.minDelay = minDelayMs;
|
|
13
|
+
}
|
|
14
|
+
async add(task) {
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
this.queue.push(async () => {
|
|
17
|
+
try {
|
|
18
|
+
// Ensure minimum delay between requests
|
|
19
|
+
const now = Date.now();
|
|
20
|
+
const timeSinceLastRequest = now - this.lastRequestTime;
|
|
21
|
+
if (timeSinceLastRequest < this.minDelay) {
|
|
22
|
+
await new Promise((resolve) => setTimeout(resolve, this.minDelay - timeSinceLastRequest));
|
|
23
|
+
}
|
|
24
|
+
this.lastRequestTime = Date.now();
|
|
25
|
+
const result = await task();
|
|
26
|
+
resolve(result);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
reject(error);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
this.processQueue();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async processQueue() {
|
|
36
|
+
if (this.running >= this.maxConcurrent || this.queue.length === 0) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.running++;
|
|
40
|
+
const task = this.queue.shift();
|
|
41
|
+
try {
|
|
42
|
+
await task();
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
this.running--;
|
|
46
|
+
this.processQueue(); // Process next item
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Test helper methods
|
|
50
|
+
getQueueLength() {
|
|
51
|
+
return this.queue.length;
|
|
52
|
+
}
|
|
53
|
+
getRunningCount() {
|
|
54
|
+
return this.running;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.RateLimitedQueue = RateLimitedQueue;
|
package/dist/service.d.ts
CHANGED
|
@@ -71,9 +71,10 @@ export declare class StakeService {
|
|
|
71
71
|
getLockupInfo(lockupAddress: Address): Promise<LockupInfo | null>;
|
|
72
72
|
getStakeInfo(stakeAddress: Address, lockupAddress: Address): Promise<StakeInfo | null>;
|
|
73
73
|
getUserNonceInfo(userNonceAddress: Address): Promise<UserNonceInfo | null>;
|
|
74
|
-
getAllStakesInfo(userAdress: Address, lockupAddress: Address
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
getAllStakesInfo(userAdress: Address, lockupAddress: Address, options?: {
|
|
75
|
+
minDelayMs?: number;
|
|
76
|
+
maxConcurrent?: number;
|
|
77
|
+
}): Promise<StakeInfoWithHash[]>;
|
|
77
78
|
getTotalStakeCount(lockupAddress: Address): Promise<number>;
|
|
78
79
|
}
|
|
79
80
|
export type InitLockupInstructionData = {
|
package/dist/service.js
CHANGED
|
@@ -14,6 +14,8 @@ const artifacts_1 = require("./artifacts");
|
|
|
14
14
|
const constants_1 = require("./constants");
|
|
15
15
|
const pda_1 = require("./pda");
|
|
16
16
|
const providers_1 = require("./providers");
|
|
17
|
+
const rateLimitQueue_1 = require("./rateLimitQueue");
|
|
18
|
+
const utils_1 = require("./utils");
|
|
17
19
|
/**
|
|
18
20
|
* StakeServiceBuilder is a builder class for creating a StakeService instance.
|
|
19
21
|
* It allows you to set the network, provider, and program to use.
|
|
@@ -319,7 +321,7 @@ class StakeService {
|
|
|
319
321
|
nonce: BigInt(userNonceAccount.nonce.toString()),
|
|
320
322
|
};
|
|
321
323
|
}
|
|
322
|
-
async getAllStakesInfo(userAdress, lockupAddress) {
|
|
324
|
+
async getAllStakesInfo(userAdress, lockupAddress, options = {}) {
|
|
323
325
|
const lockupAccount = await this.program.account.lockup.fetchNullable(lockupAddress, this.provider.connection.commitment);
|
|
324
326
|
if (!lockupAccount) {
|
|
325
327
|
throw new Error("Lockup account does not exists for address: " + lockupAddress);
|
|
@@ -357,19 +359,22 @@ class StakeService {
|
|
|
357
359
|
};
|
|
358
360
|
return info;
|
|
359
361
|
});
|
|
360
|
-
|
|
361
|
-
|
|
362
|
+
let stakesWithHash = new Array(stakeAccountsInfo.length);
|
|
363
|
+
const { maxConcurrent = 3, minDelayMs = 400 } = options;
|
|
364
|
+
const queue = new rateLimitQueue_1.RateLimitedQueue(maxConcurrent, minDelayMs); // Max 3 concurrent, 300ms between requests
|
|
365
|
+
const promises = stakeAccountsInfo.map((stakeInfo, index) => queue.add(async () => {
|
|
366
|
+
const signatures = await (0, utils_1.callWithEnhancedBackoff)(async () => this.provider.connection.getSignaturesForAddress((0, anchor_1.translateAddress)(stakeInfo.address), {}, "finalized"));
|
|
362
367
|
const stakeSignatures = signatures.filter((s) => {
|
|
363
368
|
return !s.err && (s.blockTime ?? 0) === stakeInfo.createdTime;
|
|
364
369
|
});
|
|
365
370
|
const signatureInfo = stakeSignatures[stakeSignatures.length - 1];
|
|
366
|
-
|
|
371
|
+
stakesWithHash[index] = {
|
|
367
372
|
hash: signatureInfo ? signatureInfo.signature : "",
|
|
368
373
|
...stakeInfo,
|
|
369
374
|
};
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
return
|
|
375
|
+
}));
|
|
376
|
+
await Promise.all(promises);
|
|
377
|
+
return stakesWithHash;
|
|
373
378
|
}
|
|
374
379
|
async getTotalStakeCount(lockupAddress) {
|
|
375
380
|
const dataSize = this.program.account.userStakeData.size;
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function callWithEnhancedBackoff<T>(fn: () => Promise<T>, maxRetries?: number, backoffFactor?: number, baseDelay?: number, maxDelay?: number): Promise<T>;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.callWithEnhancedBackoff = callWithEnhancedBackoff;
|
|
4
|
+
const core_utils_1 = require("@zebec-network/core-utils");
|
|
5
|
+
// Set your backoff parameters
|
|
6
|
+
const MAX_RETRIES = 5;
|
|
7
|
+
const MIN_DELAY = 200; // in milliseconds
|
|
8
|
+
const BACKOFF_FACTOR = 2;
|
|
9
|
+
const MAX_DELAY = 30000;
|
|
10
|
+
// Helper function that wraps an async operation with exponential backoff.
|
|
11
|
+
async function callWithEnhancedBackoff(fn, maxRetries = MAX_RETRIES, backoffFactor = BACKOFF_FACTOR, baseDelay = MIN_DELAY, maxDelay = MAX_DELAY) {
|
|
12
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
13
|
+
try {
|
|
14
|
+
return await fn();
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (attempt === maxRetries)
|
|
18
|
+
throw error;
|
|
19
|
+
let delay = Math.min(baseDelay * Math.pow(backoffFactor, attempt), maxDelay);
|
|
20
|
+
// Handle 429 specifically with longer delays
|
|
21
|
+
if (error?.status === 429 || error?.code === 429 || error?.message?.includes("429")) {
|
|
22
|
+
delay = Math.min(delay * backoffFactor, maxDelay); // Double delay for rate limits
|
|
23
|
+
console.warn(`Rate limit hit, waiting ${delay}ms before retry ${attempt + 1}/${maxRetries}`);
|
|
24
|
+
}
|
|
25
|
+
// Add jitter to prevent thundering herd
|
|
26
|
+
const jitter = Math.random() * 0.3 * delay;
|
|
27
|
+
await (0, core_utils_1.sleep)(delay + jitter);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
throw new Error("Max retries exceeded");
|
|
31
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zebec-network/zebec-stake-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "An SDK for zebec network stake solana program",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"clean": "rimraf ./dist",
|
|
22
22
|
"format": "prettier --write .",
|
|
23
23
|
"start": "ts-node src/index.ts",
|
|
24
|
-
"test": "ts-mocha -p ./tsconfig.json -t
|
|
24
|
+
"test": "ts-mocha -p ./tsconfig.json -t 1000000000"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@coral-xyz/anchor": "^0.31.1",
|