@jpool/bond-sdk 0.9.0-next.3 → 0.9.0-next.5

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/index.d.mts CHANGED
@@ -1,6 +1,29 @@
1
+ import { Fee } from '@solana/spl-stake-pool/src/layouts';
1
2
  import * as _solana_web3_js from '@solana/web3.js';
2
- import { PublicKey, Transaction, VersionedTransaction, Keypair, Connection, PublicKeyInitData } from '@solana/web3.js';
3
- import { BN, Provider, Program } from '@coral-xyz/anchor';
3
+ import { PublicKey, TransactionInstruction, Connection, PublicKeyInitData, Transaction, VersionedTransaction, Keypair } from '@solana/web3.js';
4
+ import BN from 'bn.js';
5
+ import { IdlTypes, IdlAccounts, Program, Provider } from '@coral-xyz/anchor';
6
+
7
+ type StakePoolManager = {
8
+ stakePoolAddress: PublicKey;
9
+ depositSol: (lamports: BN) => TransactionInstruction;
10
+ withdrawSol: (poolTokens: BN) => TransactionInstruction;
11
+ readonly exchangeRate: number;
12
+ readonly withdrawSolFee: Fee;
13
+ };
14
+
15
+ declare const JPOOL_STAKE_POOL: PublicKey;
16
+ declare enum Seeds {
17
+ GlobalState = "global_state",
18
+ BondState = "bond_state",
19
+ ValidatorBond = "validator_bond",
20
+ PerformanceBond = "performance",
21
+ CrowdFundingBond = "crowdfunding"
22
+ }
23
+ /**
24
+ * Program IDs for different environments
25
+ */
26
+ declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
4
27
 
5
28
  /**
6
29
  * Program IDL in camelCase format in order to be used in JS/TS.
@@ -9,7 +32,7 @@ import { BN, Provider, Program } from '@coral-xyz/anchor';
9
32
  * IDL can be found at `target/idl/jbond.json`.
10
33
  */
11
34
  type Jbond = {
12
- "address": "BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU";
35
+ "address": "DBuUGWbLz8CkAMQiagMfrQzj8SSg1rHQJWrTSc97HWfR";
13
36
  "metadata": {
14
37
  "name": "jbond";
15
38
  "version": "0.2.1";
@@ -18,7 +41,7 @@ type Jbond = {
18
41
  };
19
42
  "instructions": [
20
43
  {
21
- "name": "claim";
44
+ "name": "bondClaim";
22
45
  "docs": [
23
46
  "Claims compensation for a validator.",
24
47
  "Transfers funds from the validator's bond account to reserve.",
@@ -31,40 +54,19 @@ type Jbond = {
31
54
  "if the amount is zero, or if there are insufficient funds."
32
55
  ];
33
56
  "discriminator": [
34
- 62,
35
- 198,
36
- 214,
37
- 193,
38
- 213,
39
- 159,
40
- 108,
41
- 210
57
+ 151,
58
+ 92,
59
+ 10,
60
+ 205,
61
+ 66,
62
+ 250,
63
+ 188,
64
+ 129
42
65
  ];
43
66
  "accounts": [
44
67
  {
45
- "name": "globalState";
68
+ "name": "bondState";
46
69
  "writable": true;
47
- "pda": {
48
- "seeds": [
49
- {
50
- "kind": "const";
51
- "value": [
52
- 103,
53
- 108,
54
- 111,
55
- 98,
56
- 97,
57
- 108,
58
- 95,
59
- 115,
60
- 116,
61
- 97,
62
- 116,
63
- 101
64
- ];
65
- }
66
- ];
67
- };
68
70
  },
69
71
  {
70
72
  "name": "validatorBond";
@@ -90,6 +92,10 @@ type Jbond = {
90
92
  100
91
93
  ];
92
94
  },
95
+ {
96
+ "kind": "account";
97
+ "path": "bondState";
98
+ },
93
99
  {
94
100
  "kind": "account";
95
101
  "path": "validator_bond.vote_account";
@@ -104,14 +110,35 @@ type Jbond = {
104
110
  },
105
111
  {
106
112
  "name": "authority";
107
- "docs": [
108
- "Authority that can trigger claims"
109
- ];
110
113
  "signer": true;
111
114
  },
115
+ {
116
+ "name": "bondTokenAccount";
117
+ "writable": true;
118
+ "optional": true;
119
+ },
120
+ {
121
+ "name": "reserveTokenAccount";
122
+ "writable": true;
123
+ "optional": true;
124
+ },
125
+ {
126
+ "name": "stakeAccount";
127
+ "writable": true;
128
+ "optional": true;
129
+ },
112
130
  {
113
131
  "name": "systemProgram";
114
132
  "address": "11111111111111111111111111111111";
133
+ },
134
+ {
135
+ "name": "tokenProgram";
136
+ "optional": true;
137
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
138
+ },
139
+ {
140
+ "name": "stakeProgram";
141
+ "optional": true;
115
142
  }
116
143
  ];
117
144
  "args": [
@@ -122,58 +149,31 @@ type Jbond = {
122
149
  ];
123
150
  },
124
151
  {
125
- "name": "configure";
152
+ "name": "bondConfigure";
126
153
  "docs": [
127
- "Updates the global program configuration, including authority and reserve fields.",
128
- "Allows changing the program's authority and updating the reserve account.",
129
- "",
130
- "# Arguments",
131
- "* `data` - Configuration data containing optional new authority and reserve keys.",
132
- "",
133
- "# Errors",
134
- "Fails if the signer is not authorized to update the global configuration."
154
+ "Updates bond configuration, including authority and reserve fields.",
155
+ "Allows changing the bond's authority and updating the reserve account."
135
156
  ];
136
157
  "discriminator": [
137
- 245,
138
- 7,
158
+ 61,
159
+ 42,
160
+ 106,
161
+ 235,
139
162
  108,
140
- 117,
141
- 95,
142
- 196,
143
- 54,
144
- 217
163
+ 57,
164
+ 65,
165
+ 20
145
166
  ];
146
167
  "accounts": [
147
168
  {
148
- "name": "globalState";
169
+ "name": "bondState";
149
170
  "writable": true;
150
- "pda": {
151
- "seeds": [
152
- {
153
- "kind": "const";
154
- "value": [
155
- 103,
156
- 108,
157
- 111,
158
- 98,
159
- 97,
160
- 108,
161
- 95,
162
- 115,
163
- 116,
164
- 97,
165
- 116,
166
- 101
167
- ];
168
- }
169
- ];
170
- };
171
171
  },
172
172
  {
173
173
  "name": "authority";
174
174
  "signer": true;
175
175
  "relations": [
176
- "globalState"
176
+ "bondState"
177
177
  ];
178
178
  }
179
179
  ];
@@ -182,16 +182,16 @@ type Jbond = {
182
182
  "name": "data";
183
183
  "type": {
184
184
  "defined": {
185
- "name": "configureData";
185
+ "name": "bondConfigureData";
186
186
  };
187
187
  };
188
188
  }
189
189
  ];
190
190
  },
191
191
  {
192
- "name": "initialize";
192
+ "name": "bondInitialize";
193
193
  "docs": [
194
- "Initializes the global state for the bonding program.",
194
+ "Initializes state for the bond.",
195
195
  "Sets the authority and reserve account for managing validator bonds.",
196
196
  "",
197
197
  "# Errors",
@@ -199,30 +199,32 @@ type Jbond = {
199
199
  "sufficient funds."
200
200
  ];
201
201
  "discriminator": [
202
+ 230,
203
+ 3,
204
+ 121,
205
+ 94,
206
+ 147,
207
+ 203,
202
208
  175,
203
- 175,
204
- 109,
205
- 31,
206
- 13,
207
- 152,
208
- 155,
209
- 237
209
+ 210
210
210
  ];
211
211
  "accounts": [
212
212
  {
213
213
  "name": "globalState";
214
214
  "writable": true;
215
+ },
216
+ {
217
+ "name": "bondState";
218
+ "writable": true;
215
219
  "pda": {
216
220
  "seeds": [
217
221
  {
218
222
  "kind": "const";
219
223
  "value": [
220
- 103,
221
- 108,
222
- 111,
223
224
  98,
224
- 97,
225
- 108,
225
+ 111,
226
+ 110,
227
+ 100,
226
228
  95,
227
229
  115,
228
230
  116,
@@ -230,6 +232,14 @@ type Jbond = {
230
232
  116,
231
233
  101
232
234
  ];
235
+ },
236
+ {
237
+ "kind": "arg";
238
+ "path": "data.bond_type";
239
+ },
240
+ {
241
+ "kind": "arg";
242
+ "path": "data.name";
233
243
  }
234
244
  ];
235
245
  };
@@ -242,17 +252,43 @@ type Jbond = {
242
252
  {
243
253
  "name": "reserve";
244
254
  },
255
+ {
256
+ "name": "associatedTokenProgram";
257
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
258
+ },
245
259
  {
246
260
  "name": "systemProgram";
247
261
  "address": "11111111111111111111111111111111";
262
+ },
263
+ {
264
+ "name": "tokenProgram";
265
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
266
+ },
267
+ {
268
+ "name": "reserveTokenAccount";
269
+ "writable": true;
270
+ "optional": true;
271
+ },
272
+ {
273
+ "name": "mint";
274
+ "optional": true;
275
+ }
276
+ ];
277
+ "args": [
278
+ {
279
+ "name": "data";
280
+ "type": {
281
+ "defined": {
282
+ "name": "bondInitializeData";
283
+ };
284
+ };
248
285
  }
249
286
  ];
250
- "args": [];
251
287
  },
252
288
  {
253
- "name": "register";
289
+ "name": "bondRegister";
254
290
  "docs": [
255
- "Registers a new validator with the bonding program.",
291
+ "Registers a new validator with the bond.",
256
292
  "Sets up the validator's bond account and deposits initial collateral.",
257
293
  "",
258
294
  "# Arguments",
@@ -264,40 +300,19 @@ type Jbond = {
264
300
  "or if the initial collateral transfer fails."
265
301
  ];
266
302
  "discriminator": [
267
- 211,
268
- 124,
269
- 67,
270
- 15,
271
- 211,
272
- 194,
273
- 178,
274
- 240
303
+ 117,
304
+ 127,
305
+ 78,
306
+ 103,
307
+ 166,
308
+ 175,
309
+ 163,
310
+ 83
275
311
  ];
276
312
  "accounts": [
277
313
  {
278
- "name": "globalState";
314
+ "name": "bondState";
279
315
  "writable": true;
280
- "pda": {
281
- "seeds": [
282
- {
283
- "kind": "const";
284
- "value": [
285
- 103,
286
- 108,
287
- 111,
288
- 98,
289
- 97,
290
- 108,
291
- 95,
292
- 115,
293
- 116,
294
- 97,
295
- 116,
296
- 101
297
- ];
298
- }
299
- ];
300
- };
301
316
  },
302
317
  {
303
318
  "name": "validatorBond";
@@ -323,6 +338,10 @@ type Jbond = {
323
338
  100
324
339
  ];
325
340
  },
341
+ {
342
+ "kind": "account";
343
+ "path": "bondState";
344
+ },
326
345
  {
327
346
  "kind": "account";
328
347
  "path": "voteAccount";
@@ -338,26 +357,48 @@ type Jbond = {
338
357
  },
339
358
  {
340
359
  "name": "creator";
341
- "docs": [
342
- "The account creating the bond (pays for account creation and initial collateral)"
343
- ];
344
360
  "writable": true;
345
361
  "signer": true;
346
362
  },
347
363
  {
348
364
  "name": "systemProgram";
349
365
  "address": "11111111111111111111111111111111";
366
+ },
367
+ {
368
+ "name": "tokenProgram";
369
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
370
+ },
371
+ {
372
+ "name": "associatedTokenProgram";
373
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
374
+ },
375
+ {
376
+ "name": "bondTokenAccount";
377
+ "writable": true;
378
+ "optional": true;
379
+ },
380
+ {
381
+ "name": "mint";
382
+ "optional": true;
350
383
  }
351
384
  ];
352
385
  "args": [
353
386
  {
354
- "name": "initialCollateral";
355
- "type": "u64";
387
+ "name": "bondType";
388
+ "type": {
389
+ "defined": {
390
+ "name": "bondType";
391
+ };
392
+ };
393
+ },
394
+ {
395
+ "name": "bondName";
396
+ "type": "string";
356
397
  }
357
398
  ];
358
399
  },
359
400
  {
360
- "name": "setWithdrawAuthority";
401
+ "name": "bondSetWithdrawAuthority";
361
402
  "docs": [
362
403
  "Sets a new withdrawal authority for a validator's bond account.",
363
404
  "Allows changing who can withdraw collateral in the future.",
@@ -370,16 +411,19 @@ type Jbond = {
370
411
  "Fails if the signer is not authorized to change the withdrawal authority."
371
412
  ];
372
413
  "discriminator": [
373
- 199,
374
- 146,
375
- 140,
376
- 67,
377
- 1,
378
- 90,
379
- 8,
380
- 222
414
+ 212,
415
+ 162,
416
+ 53,
417
+ 130,
418
+ 91,
419
+ 158,
420
+ 61,
421
+ 166
381
422
  ];
382
423
  "accounts": [
424
+ {
425
+ "name": "bondState";
426
+ },
383
427
  {
384
428
  "name": "validatorBond";
385
429
  "writable": true;
@@ -404,6 +448,10 @@ type Jbond = {
404
448
  100
405
449
  ];
406
450
  },
451
+ {
452
+ "kind": "account";
453
+ "path": "bondState";
454
+ },
407
455
  {
408
456
  "kind": "account";
409
457
  "path": "validator_bond.vote_account";
@@ -424,7 +472,7 @@ type Jbond = {
424
472
  "args": [];
425
473
  },
426
474
  {
427
- "name": "topUp";
475
+ "name": "bondTopUp";
428
476
  "docs": [
429
477
  "Adds additional collateral to an existing validator's bond.",
430
478
  "Increases the collateral balance, enhancing the validator's stake.",
@@ -437,16 +485,20 @@ type Jbond = {
437
485
  "or if the transfer of funds fails."
438
486
  ];
439
487
  "discriminator": [
440
- 236,
488
+ 132,
441
489
  225,
442
- 96,
443
- 9,
444
- 60,
445
- 106,
446
- 77,
447
- 208
490
+ 254,
491
+ 187,
492
+ 152,
493
+ 162,
494
+ 176,
495
+ 66
448
496
  ];
449
497
  "accounts": [
498
+ {
499
+ "name": "bondState";
500
+ "writable": true;
501
+ },
450
502
  {
451
503
  "name": "validatorBond";
452
504
  "writable": true;
@@ -471,6 +523,10 @@ type Jbond = {
471
523
  100
472
524
  ];
473
525
  },
526
+ {
527
+ "kind": "account";
528
+ "path": "bondState";
529
+ },
474
530
  {
475
531
  "kind": "account";
476
532
  "path": "validator_bond.vote_account";
@@ -484,9 +540,33 @@ type Jbond = {
484
540
  "writable": true;
485
541
  "signer": true;
486
542
  },
543
+ {
544
+ "name": "payerTokenAccount";
545
+ "writable": true;
546
+ "optional": true;
547
+ },
548
+ {
549
+ "name": "bondTokenAccount";
550
+ "writable": true;
551
+ "optional": true;
552
+ },
553
+ {
554
+ "name": "stakeAccount";
555
+ "writable": true;
556
+ "optional": true;
557
+ },
487
558
  {
488
559
  "name": "systemProgram";
489
560
  "address": "11111111111111111111111111111111";
561
+ },
562
+ {
563
+ "name": "tokenProgram";
564
+ "optional": true;
565
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
566
+ },
567
+ {
568
+ "name": "stakeProgram";
569
+ "optional": true;
490
570
  }
491
571
  ];
492
572
  "args": [
@@ -497,7 +577,7 @@ type Jbond = {
497
577
  ];
498
578
  },
499
579
  {
500
- "name": "withdraw";
580
+ "name": "bondWithdraw";
501
581
  "docs": [
502
582
  "Withdraws collateral from a validator's bond.",
503
583
  "Decreases the collateral balance, allowing the validator to reclaim funds.",
@@ -511,16 +591,20 @@ type Jbond = {
511
591
  "leave insufficient collateral."
512
592
  ];
513
593
  "discriminator": [
514
- 183,
515
- 18,
594
+ 99,
595
+ 64,
596
+ 127,
597
+ 178,
598
+ 53,
599
+ 117,
516
600
  70,
517
- 156,
518
- 148,
519
- 109,
520
- 161,
521
- 34
601
+ 204
522
602
  ];
523
603
  "accounts": [
604
+ {
605
+ "name": "bondState";
606
+ "writable": true;
607
+ },
524
608
  {
525
609
  "name": "validatorBond";
526
610
  "writable": true;
@@ -545,6 +629,10 @@ type Jbond = {
545
629
  100
546
630
  ];
547
631
  },
632
+ {
633
+ "kind": "account";
634
+ "path": "bondState";
635
+ },
548
636
  {
549
637
  "kind": "account";
550
638
  "path": "validator_bond.vote_account";
@@ -563,12 +651,32 @@ type Jbond = {
563
651
  "writable": true;
564
652
  },
565
653
  {
566
- "name": "epochSchedule";
567
- "address": "SysvarEpochSchedu1e111111111111111111111111";
654
+ "name": "destinationTokenAccount";
655
+ "writable": true;
656
+ "optional": true;
657
+ },
658
+ {
659
+ "name": "bondTokenAccount";
660
+ "writable": true;
661
+ "optional": true;
662
+ },
663
+ {
664
+ "name": "stakeAccount";
665
+ "writable": true;
666
+ "optional": true;
568
667
  },
569
668
  {
570
669
  "name": "systemProgram";
571
670
  "address": "11111111111111111111111111111111";
671
+ },
672
+ {
673
+ "name": "tokenProgram";
674
+ "optional": true;
675
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
676
+ },
677
+ {
678
+ "name": "stakeProgram";
679
+ "optional": true;
572
680
  }
573
681
  ];
574
682
  "args": [
@@ -577,26 +685,185 @@ type Jbond = {
577
685
  "type": "u64";
578
686
  }
579
687
  ];
580
- }
581
- ];
582
- "accounts": [
583
- {
584
- "name": "globalState";
585
- "discriminator": [
586
- 163,
587
- 46,
588
- 74,
589
- 168,
590
- 216,
591
- 123,
592
- 133,
593
- 98
594
- ];
595
688
  },
596
689
  {
597
- "name": "validatorBond";
690
+ "name": "globalConfigure";
598
691
  "discriminator": [
599
- 82,
692
+ 67,
693
+ 142,
694
+ 164,
695
+ 250,
696
+ 90,
697
+ 233,
698
+ 144,
699
+ 187
700
+ ];
701
+ "accounts": [
702
+ {
703
+ "name": "globalState";
704
+ "writable": true;
705
+ "pda": {
706
+ "seeds": [
707
+ {
708
+ "kind": "const";
709
+ "value": [
710
+ 103,
711
+ 108,
712
+ 111,
713
+ 98,
714
+ 97,
715
+ 108,
716
+ 95,
717
+ 115,
718
+ 116,
719
+ 97,
720
+ 116,
721
+ 101
722
+ ];
723
+ }
724
+ ];
725
+ };
726
+ },
727
+ {
728
+ "name": "authority";
729
+ "signer": true;
730
+ "relations": [
731
+ "globalState"
732
+ ];
733
+ }
734
+ ];
735
+ "args": [
736
+ {
737
+ "name": "data";
738
+ "type": {
739
+ "defined": {
740
+ "name": "globalConfigureData";
741
+ };
742
+ };
743
+ }
744
+ ];
745
+ },
746
+ {
747
+ "name": "globalInitialize";
748
+ "docs": [
749
+ "----------------------------- Global Instructions ----------------------------"
750
+ ];
751
+ "discriminator": [
752
+ 30,
753
+ 79,
754
+ 193,
755
+ 205,
756
+ 75,
757
+ 42,
758
+ 223,
759
+ 196
760
+ ];
761
+ "accounts": [
762
+ {
763
+ "name": "globalState";
764
+ "writable": true;
765
+ "pda": {
766
+ "seeds": [
767
+ {
768
+ "kind": "const";
769
+ "value": [
770
+ 103,
771
+ 108,
772
+ 111,
773
+ 98,
774
+ 97,
775
+ 108,
776
+ 95,
777
+ 115,
778
+ 116,
779
+ 97,
780
+ 116,
781
+ 101
782
+ ];
783
+ }
784
+ ];
785
+ };
786
+ },
787
+ {
788
+ "name": "authority";
789
+ "writable": true;
790
+ "signer": true;
791
+ },
792
+ {
793
+ "name": "systemProgram";
794
+ "address": "11111111111111111111111111111111";
795
+ }
796
+ ];
797
+ "args": [];
798
+ },
799
+ {
800
+ "name": "sessionStart";
801
+ "docs": [
802
+ "Starts a paused bond, allowing deposits and withdrawals to resume."
803
+ ];
804
+ "discriminator": [
805
+ 132,
806
+ 93,
807
+ 83,
808
+ 152,
809
+ 141,
810
+ 32,
811
+ 58,
812
+ 92
813
+ ];
814
+ "accounts": [
815
+ {
816
+ "name": "bondState";
817
+ "writable": true;
818
+ },
819
+ {
820
+ "name": "authority";
821
+ "writable": true;
822
+ "signer": true;
823
+ "relations": [
824
+ "bondState"
825
+ ];
826
+ }
827
+ ];
828
+ "args": [
829
+ {
830
+ "name": "durationSecs";
831
+ "type": "u64";
832
+ }
833
+ ];
834
+ }
835
+ ];
836
+ "accounts": [
837
+ {
838
+ "name": "bondState";
839
+ "discriminator": [
840
+ 251,
841
+ 95,
842
+ 76,
843
+ 47,
844
+ 191,
845
+ 108,
846
+ 163,
847
+ 92
848
+ ];
849
+ },
850
+ {
851
+ "name": "globalState";
852
+ "discriminator": [
853
+ 163,
854
+ 46,
855
+ 74,
856
+ 168,
857
+ 216,
858
+ 123,
859
+ 133,
860
+ 98
861
+ ];
862
+ },
863
+ {
864
+ "name": "validatorBond";
865
+ "discriminator": [
866
+ 82,
600
867
  127,
601
868
  243,
602
869
  208,
@@ -608,6 +875,32 @@ type Jbond = {
608
875
  }
609
876
  ];
610
877
  "events": [
878
+ {
879
+ "name": "bondFinished";
880
+ "discriminator": [
881
+ 223,
882
+ 254,
883
+ 3,
884
+ 161,
885
+ 90,
886
+ 190,
887
+ 150,
888
+ 191
889
+ ];
890
+ },
891
+ {
892
+ "name": "bondStarted";
893
+ "discriminator": [
894
+ 235,
895
+ 69,
896
+ 80,
897
+ 63,
898
+ 209,
899
+ 252,
900
+ 232,
901
+ 64
902
+ ];
903
+ },
611
904
  {
612
905
  "name": "collateralToppedUp";
613
906
  "discriminator": [
@@ -711,9 +1004,299 @@ type Jbond = {
711
1004
  "code": 6009;
712
1005
  "name": "withdrawalLockedNearEpochEnd";
713
1006
  "msg": "Withdrawals are locked near the end of the epoch.";
1007
+ },
1008
+ {
1009
+ "code": 6010;
1010
+ "name": "missingTokenAccounts";
1011
+ "msg": "Missing token accounts for token collateral type";
1012
+ },
1013
+ {
1014
+ "code": 6011;
1015
+ "name": "missingTokenProgram";
1016
+ "msg": "Token program is required for token collateral type";
1017
+ },
1018
+ {
1019
+ "code": 6012;
1020
+ "name": "invalidMint";
1021
+ "msg": "Invalid mint for token collateral type";
1022
+ },
1023
+ {
1024
+ "code": 6013;
1025
+ "name": "missingStakeAccount";
1026
+ "msg": "Stake account is required for stake account collateral type";
1027
+ },
1028
+ {
1029
+ "code": 6014;
1030
+ "name": "missingStakeProgram";
1031
+ "msg": "Stake program is required for stake account collateral type";
1032
+ },
1033
+ {
1034
+ "code": 6015;
1035
+ "name": "bondFinished";
1036
+ "msg": "Bond is finished (deposits/withdrawals disabled)";
1037
+ },
1038
+ {
1039
+ "code": 6016;
1040
+ "name": "bondNotFinished";
1041
+ "msg": "Bond is not finished";
1042
+ },
1043
+ {
1044
+ "code": 6017;
1045
+ "name": "unsupportedCollateralType";
1046
+ "msg": "Unsupported collateral type";
1047
+ },
1048
+ {
1049
+ "code": 6018;
1050
+ "name": "overflow";
1051
+ "msg": "Math operation overflowed";
1052
+ },
1053
+ {
1054
+ "code": 6019;
1055
+ "name": "incorrectBondType";
1056
+ "msg": "Incorrect bond type for this operation";
1057
+ },
1058
+ {
1059
+ "code": 6020;
1060
+ "name": "bondNotFinishable";
1061
+ "msg": "This bond type can't be finished";
1062
+ },
1063
+ {
1064
+ "code": 6021;
1065
+ "name": "invalidArgument";
1066
+ "msg": "Invalid argument provided";
714
1067
  }
715
1068
  ];
716
1069
  "types": [
1070
+ {
1071
+ "name": "bondConfigureData";
1072
+ "type": {
1073
+ "kind": "struct";
1074
+ "fields": [
1075
+ {
1076
+ "name": "newReserve";
1077
+ "type": {
1078
+ "option": "pubkey";
1079
+ };
1080
+ },
1081
+ {
1082
+ "name": "newAuthority";
1083
+ "type": {
1084
+ "option": "pubkey";
1085
+ };
1086
+ }
1087
+ ];
1088
+ };
1089
+ },
1090
+ {
1091
+ "name": "bondFinished";
1092
+ "type": {
1093
+ "kind": "struct";
1094
+ "fields": [
1095
+ {
1096
+ "name": "bond";
1097
+ "type": "pubkey";
1098
+ },
1099
+ {
1100
+ "name": "authority";
1101
+ "type": "pubkey";
1102
+ },
1103
+ {
1104
+ "name": "timestamp";
1105
+ "type": "i64";
1106
+ }
1107
+ ];
1108
+ };
1109
+ },
1110
+ {
1111
+ "name": "bondInitializeData";
1112
+ "docs": [
1113
+ "Data required to initialize a performance bond"
1114
+ ];
1115
+ "type": {
1116
+ "kind": "struct";
1117
+ "fields": [
1118
+ {
1119
+ "name": "name";
1120
+ "type": "string";
1121
+ },
1122
+ {
1123
+ "name": "bondType";
1124
+ "type": {
1125
+ "defined": {
1126
+ "name": "bondType";
1127
+ };
1128
+ };
1129
+ },
1130
+ {
1131
+ "name": "reserve";
1132
+ "type": "pubkey";
1133
+ },
1134
+ {
1135
+ "name": "collateralType";
1136
+ "type": {
1137
+ "defined": {
1138
+ "name": "collateralType";
1139
+ };
1140
+ };
1141
+ }
1142
+ ];
1143
+ };
1144
+ },
1145
+ {
1146
+ "name": "bondStarted";
1147
+ "type": {
1148
+ "kind": "struct";
1149
+ "fields": [
1150
+ {
1151
+ "name": "bond";
1152
+ "type": "pubkey";
1153
+ },
1154
+ {
1155
+ "name": "authority";
1156
+ "type": "pubkey";
1157
+ },
1158
+ {
1159
+ "name": "timestamp";
1160
+ "type": "i64";
1161
+ }
1162
+ ];
1163
+ };
1164
+ },
1165
+ {
1166
+ "name": "bondState";
1167
+ "type": {
1168
+ "kind": "struct";
1169
+ "fields": [
1170
+ {
1171
+ "name": "name";
1172
+ "type": "string";
1173
+ },
1174
+ {
1175
+ "name": "bondType";
1176
+ "docs": [
1177
+ "The type of bond (e.g., Performance, Crowdfunding)"
1178
+ ];
1179
+ "type": {
1180
+ "defined": {
1181
+ "name": "bondType";
1182
+ };
1183
+ };
1184
+ },
1185
+ {
1186
+ "name": "collateralType";
1187
+ "docs": [
1188
+ "The type of collateral accepted for this bond"
1189
+ ];
1190
+ "type": {
1191
+ "defined": {
1192
+ "name": "collateralType";
1193
+ };
1194
+ };
1195
+ },
1196
+ {
1197
+ "name": "reserve";
1198
+ "docs": [
1199
+ "Reserve account where collateral is held"
1200
+ ];
1201
+ "type": "pubkey";
1202
+ },
1203
+ {
1204
+ "name": "authority";
1205
+ "docs": [
1206
+ "Authority allowed to manage the bond configuration"
1207
+ ];
1208
+ "type": "pubkey";
1209
+ },
1210
+ {
1211
+ "name": "sessionId";
1212
+ "docs": [
1213
+ "Unique identifier for the bonding session"
1214
+ ];
1215
+ "type": "u32";
1216
+ },
1217
+ {
1218
+ "name": "totalMembers";
1219
+ "docs": [
1220
+ "Total number of users who have participated in the bond"
1221
+ ];
1222
+ "type": "u16";
1223
+ },
1224
+ {
1225
+ "name": "totalCompensationAmount";
1226
+ "docs": [
1227
+ "Total compensation amount paid out"
1228
+ ];
1229
+ "type": "u64";
1230
+ },
1231
+ {
1232
+ "name": "status";
1233
+ "docs": [
1234
+ "Current status of the bond"
1235
+ ];
1236
+ "type": {
1237
+ "defined": {
1238
+ "name": "bondStatus";
1239
+ };
1240
+ };
1241
+ },
1242
+ {
1243
+ "name": "sessionStartTs";
1244
+ "docs": [
1245
+ "Start timestamp of the current session (unix seconds). 0 — not set."
1246
+ ];
1247
+ "type": "i64";
1248
+ },
1249
+ {
1250
+ "name": "sessionFinishTs";
1251
+ "docs": [
1252
+ "Finish timestamp of the current session (unix seconds). 0 — not set."
1253
+ ];
1254
+ "type": "i64";
1255
+ },
1256
+ {
1257
+ "name": "bump";
1258
+ "docs": [
1259
+ "Bump for the PDA"
1260
+ ];
1261
+ "type": "u8";
1262
+ }
1263
+ ];
1264
+ };
1265
+ },
1266
+ {
1267
+ "name": "bondStatus";
1268
+ "type": {
1269
+ "kind": "enum";
1270
+ "variants": [
1271
+ {
1272
+ "name": "active";
1273
+ },
1274
+ {
1275
+ "name": "inactive";
1276
+ },
1277
+ {
1278
+ "name": "pending";
1279
+ }
1280
+ ];
1281
+ };
1282
+ },
1283
+ {
1284
+ "name": "bondType";
1285
+ "docs": [
1286
+ "Types of bonds supported by the program"
1287
+ ];
1288
+ "type": {
1289
+ "kind": "enum";
1290
+ "variants": [
1291
+ {
1292
+ "name": "performance";
1293
+ },
1294
+ {
1295
+ "name": "crowdfunding";
1296
+ }
1297
+ ];
1298
+ };
1299
+ },
717
1300
  {
718
1301
  "name": "collateralToppedUp";
719
1302
  "type": {
@@ -738,6 +1321,29 @@ type Jbond = {
738
1321
  ];
739
1322
  };
740
1323
  },
1324
+ {
1325
+ "name": "collateralType";
1326
+ "docs": [
1327
+ "Types of collateral that can be used for bond deposit"
1328
+ ];
1329
+ "type": {
1330
+ "kind": "enum";
1331
+ "variants": [
1332
+ {
1333
+ "name": "native";
1334
+ },
1335
+ {
1336
+ "name": "stakeAccount";
1337
+ },
1338
+ {
1339
+ "name": "token";
1340
+ "fields": [
1341
+ "pubkey"
1342
+ ];
1343
+ }
1344
+ ];
1345
+ };
1346
+ },
741
1347
  {
742
1348
  "name": "collateralWithdrawn";
743
1349
  "type": {
@@ -791,7 +1397,7 @@ type Jbond = {
791
1397
  };
792
1398
  },
793
1399
  {
794
- "name": "configureData";
1400
+ "name": "globalConfigureData";
795
1401
  "type": {
796
1402
  "kind": "struct";
797
1403
  "fields": [
@@ -800,12 +1406,6 @@ type Jbond = {
800
1406
  "type": {
801
1407
  "option": "pubkey";
802
1408
  };
803
- },
804
- {
805
- "name": "newReserve";
806
- "type": {
807
- "option": "pubkey";
808
- };
809
1409
  }
810
1410
  ];
811
1411
  };
@@ -816,33 +1416,21 @@ type Jbond = {
816
1416
  "kind": "struct";
817
1417
  "fields": [
818
1418
  {
819
- "name": "authority";
1419
+ "name": "bonds";
820
1420
  "docs": [
821
- "The authority allowed to manage the program"
1421
+ "List of all registered bonds"
822
1422
  ];
823
- "type": "pubkey";
1423
+ "type": {
1424
+ "vec": "pubkey";
1425
+ };
824
1426
  },
825
1427
  {
826
- "name": "reserve";
1428
+ "name": "authority";
827
1429
  "docs": [
828
- "The reserve vault holding SOL for bonding and compensation"
1430
+ "The authority allowed to manage the program"
829
1431
  ];
830
1432
  "type": "pubkey";
831
1433
  },
832
- {
833
- "name": "totalValidators";
834
- "docs": [
835
- "Total number of registered validators"
836
- ];
837
- "type": "u16";
838
- },
839
- {
840
- "name": "totalCompensationAmount";
841
- "docs": [
842
- "Total compensation amount paid out"
843
- ];
844
- "type": "u64";
845
- },
846
1434
  {
847
1435
  "name": "bump";
848
1436
  "docs": [
@@ -858,76 +1446,50 @@ type Jbond = {
858
1446
  "type": {
859
1447
  "kind": "struct";
860
1448
  "fields": [
1449
+ {
1450
+ "name": "bond";
1451
+ "type": "pubkey";
1452
+ },
861
1453
  {
862
1454
  "name": "identity";
863
- "docs": [
864
- "The validator identity pubkey"
865
- ];
866
1455
  "type": "pubkey";
867
1456
  },
868
1457
  {
869
1458
  "name": "voteAccount";
870
- "docs": [
871
- "The validator vote account pubkey"
872
- ];
873
1459
  "type": "pubkey";
874
1460
  },
875
1461
  {
876
1462
  "name": "creator";
877
- "docs": [
878
- "Creator of the validator bond account"
879
- ];
880
1463
  "type": "pubkey";
881
1464
  },
882
1465
  {
883
1466
  "name": "withdrawalAuthority";
884
- "docs": [
885
- "Authority allowed to withdraw funds (if None, only identity can withdraw)"
886
- ];
887
1467
  "type": {
888
1468
  "option": "pubkey";
889
1469
  };
890
1470
  },
891
1471
  {
892
1472
  "name": "totalCompensationAmount";
893
- "docs": [
894
- "Total compensation claimed for the validator"
895
- ];
896
1473
  "type": "u64";
897
1474
  },
898
1475
  {
899
1476
  "name": "lastCompensationAmount";
900
- "docs": [
901
- "Last compensation amount claimed"
902
- ];
903
1477
  "type": "u64";
904
1478
  },
905
1479
  {
906
1480
  "name": "lastCompensationEpoch";
907
- "docs": [
908
- "Last epoch when compensation was claimed"
909
- ];
910
1481
  "type": "u64";
911
1482
  },
912
1483
  {
913
1484
  "name": "createdAt";
914
- "docs": [
915
- "Timestamp when the bond account was created"
916
- ];
917
1485
  "type": "i64";
918
1486
  },
919
1487
  {
920
1488
  "name": "isActive";
921
- "docs": [
922
- "Whether the validator is currently active"
923
- ];
924
1489
  "type": "bool";
925
1490
  },
926
1491
  {
927
1492
  "name": "bump";
928
- "docs": [
929
- "Bump for the PDA"
930
- ];
931
1493
  "type": "u8";
932
1494
  }
933
1495
  ];
@@ -946,10 +1508,6 @@ type Jbond = {
946
1508
  "name": "voteAccount";
947
1509
  "type": "pubkey";
948
1510
  },
949
- {
950
- "name": "initialCollateral";
951
- "type": "u64";
952
- },
953
1511
  {
954
1512
  "name": "timestamp";
955
1513
  "type": "i64";
@@ -958,50 +1516,67 @@ type Jbond = {
958
1516
  };
959
1517
  }
960
1518
  ];
1519
+ "constants": [
1520
+ {
1521
+ "name": "epochLockedSlotTail";
1522
+ "docs": [
1523
+ "Epoch slot index at the end of an epoch after which withdrawals are locked"
1524
+ ];
1525
+ "type": "u64";
1526
+ "value": "420000";
1527
+ }
1528
+ ];
961
1529
  };
962
1530
 
963
- type GlobalState = {
964
- authority: PublicKey;
965
- reserve: PublicKey;
966
- totalValidators: number;
967
- totalCompensationAmount: BN;
968
- bump: number;
1531
+ type GlobalState = IdlAccounts<Jbond>['globalState'];
1532
+ type BondState = IdlAccounts<Jbond>['bondState'];
1533
+ type ValidatorBond = IdlAccounts<Jbond>['validatorBond'];
1534
+ type BondType = IdlTypes<Jbond>['bondType'];
1535
+ type CollateralType = IdlTypes<Jbond>['collateralType'];
1536
+ declare const bondTypeToSeed: {
1537
+ performance: Seeds;
1538
+ crowdfunding: Seeds;
969
1539
  };
970
- type ValidatorBond = {
971
- identity: PublicKey;
972
- voteAccount: PublicKey;
973
- creator: PublicKey;
974
- withdrawalAuthority: PublicKey | null;
975
- totalCompensationAmount: BN;
976
- lastCompensationAmount: BN;
977
- lastCompensationEpoch: BN;
978
- isActive: boolean;
979
- createdAt: BN;
980
- bump: number;
1540
+ declare const BondTypeVariant: {
1541
+ Performance: BondType;
1542
+ Crowdfunding: BondType;
981
1543
  };
982
- type InitializeProps = {
1544
+ type GlobalInitializeProps = {
983
1545
  authority?: PublicKey;
1546
+ };
1547
+ type BondInitializeProps = {
1548
+ bondType: BondType;
1549
+ name: string;
1550
+ authority?: PublicKey;
1551
+ collateralType: CollateralType;
984
1552
  reserve: PublicKey;
985
1553
  };
986
1554
  type RegisterValidatorProps = {
1555
+ bondType: BondType;
1556
+ name: string;
987
1557
  identity: PublicKey;
988
1558
  voteAccount: PublicKey;
989
- initialCollateral: number;
990
1559
  creator?: PublicKey;
991
1560
  };
992
1561
  type TopUpCollateralProps = {
993
- amount: number;
1562
+ bondType: BondType;
1563
+ name: string;
994
1564
  voteAccount: PublicKey;
1565
+ collateral: BondCollateral;
995
1566
  payer?: PublicKey;
996
1567
  };
997
1568
  type WithdrawCollateralProps = {
998
- amount: number;
1569
+ bondType: BondType;
1570
+ name: string;
1571
+ withdraw: BondCollateral;
999
1572
  voteAccount: PublicKey;
1000
1573
  destination?: PublicKey;
1001
1574
  withdrawalAuthority?: PublicKey;
1002
1575
  };
1003
1576
  type ClaimProps = {
1004
- amount: number;
1577
+ bondType: BondType;
1578
+ name: string;
1579
+ claim: BondCollateral;
1005
1580
  voteAccount: PublicKey;
1006
1581
  reserve?: PublicKey;
1007
1582
  authority?: PublicKey;
@@ -1018,12 +1593,20 @@ type GetHistoryGroupedProps = {
1018
1593
  voteAccount: PublicKey;
1019
1594
  epochsCount?: number;
1020
1595
  };
1021
- type ConfigureProps = {
1596
+ type BondConfigureProps = {
1597
+ bondType: BondType;
1598
+ name: string;
1022
1599
  authority?: PublicKey;
1023
1600
  newAuthority?: PublicKey;
1024
1601
  newReserve?: PublicKey;
1025
1602
  };
1603
+ type GlobalConfigureProps = {
1604
+ authority?: PublicKey;
1605
+ newAuthority?: PublicKey;
1606
+ };
1026
1607
  type SetWithdrawAuthorityProps = {
1608
+ bondType: BondType;
1609
+ name: string;
1027
1610
  voteAccount: PublicKey;
1028
1611
  newWithdrawAuthority?: PublicKey | null;
1029
1612
  identity?: PublicKey;
@@ -1049,6 +1632,34 @@ declare enum BondTransactionType {
1049
1632
  Withdrawal = "withdrawal",
1050
1633
  Compensation = "compensation"
1051
1634
  }
1635
+ type BondCollateral = {
1636
+ amount?: number;
1637
+ mint?: PublicKey;
1638
+ stakeAccount?: PublicKey;
1639
+ };
1640
+ declare enum SessionStatus {
1641
+ Live = 0,
1642
+ Finished = 1
1643
+ }
1644
+
1645
+ type GetHistoryOpts = {
1646
+ cluster?: 'mainnet-beta' | 'testnet' | 'devnet';
1647
+ limit?: number;
1648
+ before?: string;
1649
+ until?: string;
1650
+ };
1651
+ declare class HistoryManager {
1652
+ private program;
1653
+ private connection;
1654
+ private programId;
1655
+ private discCache;
1656
+ constructor(program: Program<Jbond>, connection: Connection, programId: PublicKey);
1657
+ getHistory(bondType: BondType, vote: PublicKeyInitData, pdaDeriver: (bondType: BondType, vote: PublicKeyInitData) => [PublicKey, number], options?: GetHistoryOpts): Promise<TransactionHistoryItem[]>;
1658
+ private fetchSignaturesForAddress;
1659
+ private fetchParsedTransactions;
1660
+ private getInstructionDiscriminator;
1661
+ private decodeInstructionData;
1662
+ }
1052
1663
 
1053
1664
  type Wallet = {
1054
1665
  publicKey: PublicKey;
@@ -1082,6 +1693,7 @@ declare class JBondClient {
1082
1693
  readonly provider: Provider;
1083
1694
  readonly options: ClientOptions;
1084
1695
  readonly program: Program<Jbond>;
1696
+ readonly history: HistoryManager;
1085
1697
  constructor(provider: Provider, options?: ClientOptions);
1086
1698
  /**
1087
1699
  * Creates an instance of `JBondClient` using a provided connection and wallet.
@@ -1107,18 +1719,22 @@ declare class JBondClient {
1107
1719
  * Configure a specific option.
1108
1720
  */
1109
1721
  configureEnv<K extends keyof ClientOptions>(key: K, val: ClientOptions[K]): this;
1722
+ private getAdapter;
1723
+ private getBondTypeSeed;
1110
1724
  /**
1111
1725
  * Program Derived Addresses (PDAs)
1112
1726
  */
1113
1727
  pda: {
1114
1728
  globalState: () => [PublicKey, number];
1115
- validatorBond: (vote: PublicKeyInitData) => [PublicKey, number];
1729
+ bondState: (bondType: BondType, bondName: string) => [PublicKey, number];
1730
+ validatorBond: (bondType: BondType, bondName: string, vote: PublicKeyInitData) => [PublicKey, number];
1116
1731
  };
1732
+ globalInitialize(props: GlobalInitializeProps): Promise<string | undefined>;
1117
1733
  /**
1118
1734
  * Initialize the program
1119
1735
  * Default authority is the provider's wallet
1120
1736
  */
1121
- initialize(props: InitializeProps): Promise<string | undefined>;
1737
+ bondInitialize(props: BondInitializeProps): Promise<string | undefined>;
1122
1738
  /**
1123
1739
  * Register a new validator
1124
1740
  * Default creator is the provider's wallet
@@ -1148,7 +1764,14 @@ declare class JBondClient {
1148
1764
  * Only the current authority can call this
1149
1765
  * @return Transaction signature
1150
1766
  */
1151
- configure(props: ConfigureProps): Promise<string | undefined>;
1767
+ globalConfigure(props: GlobalConfigureProps): Promise<string | undefined>;
1768
+ /**
1769
+ * Update global configuration for the program
1770
+ * Default authority is the provider's wallet
1771
+ * Only the current authority can call this
1772
+ * @return Transaction signature
1773
+ */
1774
+ bondConfigure(props: BondConfigureProps): Promise<string | undefined>;
1152
1775
  /**
1153
1776
  * Set withdrawal authority for validator bond
1154
1777
  * Only the validator identity can call this
@@ -1156,10 +1779,24 @@ declare class JBondClient {
1156
1779
  * @return Transaction signature
1157
1780
  */
1158
1781
  setWithdrawAuthority(props: SetWithdrawAuthorityProps): Promise<string | undefined>;
1782
+ bondStart(props: {
1783
+ bondType: BondType;
1784
+ name: string;
1785
+ duration_secs: number;
1786
+ }): Promise<string | undefined>;
1787
+ bondFinish(props: {
1788
+ bondType: BondType;
1789
+ name: string;
1790
+ }): Promise<string | undefined>;
1791
+ buildBondGlobalStateInitializeInstruction(props: GlobalInitializeProps): Promise<_solana_web3_js.TransactionInstruction>;
1792
+ /**
1793
+ * Build configure instruction
1794
+ */
1795
+ buildGlobalConfigureInstruction(props: GlobalConfigureProps): Promise<_solana_web3_js.TransactionInstruction>;
1159
1796
  /**
1160
1797
  * Build initialize instruction
1161
1798
  */
1162
- buildInitializeInstruction(props: InitializeProps): Promise<_solana_web3_js.TransactionInstruction>;
1799
+ buildBondInitializeInstruction(props: BondInitializeProps): Promise<_solana_web3_js.TransactionInstruction>;
1163
1800
  /**
1164
1801
  * Build register validator instruction
1165
1802
  */
@@ -1175,62 +1812,67 @@ declare class JBondClient {
1175
1812
  /**
1176
1813
  * Build claim compensation instruction
1177
1814
  */
1178
- buildClaimInstruction(props: ClaimProps): Promise<_solana_web3_js.TransactionInstruction>;
1815
+ buildBondClaimInstruction(props: ClaimProps): Promise<_solana_web3_js.TransactionInstruction>;
1179
1816
  /**
1180
1817
  * Build configure instruction
1181
1818
  */
1182
- buildConfigureInstruction(props: ConfigureProps): Promise<_solana_web3_js.TransactionInstruction>;
1819
+ buildConfigureInstruction(props: BondConfigureProps): Promise<_solana_web3_js.TransactionInstruction>;
1183
1820
  /**
1184
1821
  * Build set withdraw authority instruction
1185
1822
  */
1186
1823
  buildSetWithdrawAuthorityInstruction(props: SetWithdrawAuthorityProps): Promise<_solana_web3_js.TransactionInstruction>;
1824
+ buildBondStartInstruction(props: {
1825
+ bondType: BondType;
1826
+ name: string;
1827
+ duration_secs: number;
1828
+ }): Promise<_solana_web3_js.TransactionInstruction>;
1829
+ buildBondFinishInstruction(props: {
1830
+ bondType: BondType;
1831
+ name: string;
1832
+ }): Promise<_solana_web3_js.TransactionInstruction>;
1187
1833
  /**
1188
1834
  * Fetch global state or throw if not found
1189
1835
  */
1190
1836
  getGlobalState(): Promise<GlobalState>;
1837
+ getBondState(bondType: BondType, bondName: string): Promise<BondState>;
1838
+ getAllBondStates(_bondType: BondType): Promise<BondState[]>;
1839
+ getBondStateSessionStatus(bondType: BondType, bondName: string): Promise<SessionStatus>;
1191
1840
  /**
1192
1841
  * Fetch validator bond data or null if not found
1842
+ * @param bondType
1843
+ * @param bondName
1193
1844
  * @param vote
1194
1845
  */
1195
- getValidatorBond(vote: PublicKeyInitData): Promise<ValidatorBond | null>;
1846
+ getValidatorBond(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<ValidatorBond | null>;
1847
+ /**
1848
+ * Get bond collateral type
1849
+ */
1850
+ getBondCollateralType(bondType: BondType, bondName: string): Promise<CollateralType>;
1196
1851
  /**
1197
1852
  * Get validator bond account balance (in SOL)
1853
+ * @param bondType - Type of the bond
1854
+ * @param bondName - Name of the bond
1198
1855
  * @param vote - Vote account public key
1199
- * @return Balance in SOL
1856
+ * @return Balance in lamports
1200
1857
  */
1201
- getValidatorBondBalance(vote: PublicKeyInitData): Promise<number>;
1858
+ getValidatorBondBalance(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<number>;
1202
1859
  /**
1203
- * Get transaction history for a specific validator bond account
1860
+ * Load stake pool account and cache it if not already cached
1861
+ * @private
1204
1862
  */
1205
- getHistory(vote: PublicKey, options?: {
1206
- cluster?: 'mainnet-beta' | 'testnet' | 'devnet';
1207
- limit?: number;
1208
- before?: string;
1209
- until?: string;
1210
- }): Promise<TransactionHistoryItem[]>;
1863
+ private loadStakePoolAccount;
1211
1864
  /**
1212
- * Get instruction discriminator from IDL
1213
- * @param instructionName
1214
- * @private
1865
+ * Manages the interaction with a stake pool, allowing deposits and withdrawals of SOL.
1215
1866
  */
1216
- private getInstructionDiscriminator;
1217
- private fetchSignaturesForValidator;
1218
- private fetchParsedTransactions;
1867
+ stakePoolManager(props?: {
1868
+ user?: PublicKey;
1869
+ }): Promise<StakePoolManager>;
1219
1870
  /**
1220
- * Decode instruction data to determine transaction type and amount
1221
- * @param data
1222
- * @private
1871
+ * Ensures that a valid user is provided. If a user is not explicitly passed
1872
+ * in the properties, it defaults to the provider's public key.
1873
+ * Throws an error if no user is available.
1223
1874
  */
1224
- private decodeInstructionData;
1225
- }
1226
-
1227
- declare enum Seeds {
1228
- GlobalState = "global_state",
1229
- ValidatorBond = "validator_bond"
1875
+ private ensureUser;
1230
1876
  }
1231
- /**
1232
- * Program IDs for different environments
1233
- */
1234
- declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
1235
1877
 
1236
- export { BondClientEnv, BondTransactionType, type ClaimProps, type ClientOptions, type ConfigureProps, ENV_PROGRAM_ID, type EpochHistoryItem, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalState, type InitializeProps, JBondClient, type Jbond, NodeWallet, type RegisterValidatorProps, Seeds, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, type ValidatorBond, type WithdrawCollateralProps };
1878
+ export { BondClientEnv, type BondCollateral, type BondConfigureProps, type BondInitializeProps, type BondState, BondTransactionType, type BondType, BondTypeVariant, type ClaimProps, type ClientOptions, type CollateralType, ENV_PROGRAM_ID, type EpochHistoryItem, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalConfigureProps, type GlobalInitializeProps, type GlobalState, JBondClient, JPOOL_STAKE_POOL, type Jbond, NodeWallet, type RegisterValidatorProps, Seeds, SessionStatus, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, type ValidatorBond, type WithdrawCollateralProps, bondTypeToSeed };