@jpool/bond-sdk 0.9.0 → 0.10.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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,29 @@
1
- import * as _solana_web3_js from '@solana/web3.js';
2
- import { PublicKey, Transaction, VersionedTransaction, Keypair, Connection, PublicKeyInitData } from '@solana/web3.js';
3
- import { BN, AnchorProvider, Program } from '@coral-xyz/anchor';
1
+ import { Fee } from '@solana/spl-stake-pool/src/layouts';
2
+ import { PublicKey, TransactionInstruction, Connection, PublicKeyInitData, Transaction, VersionedTransaction, Keypair } from '@solana/web3.js';
3
+ import * as bn_js from 'bn.js';
4
+ import bn_js__default from 'bn.js';
5
+ import { IdlTypes, IdlAccounts, Program, Provider } from '@coral-xyz/anchor';
6
+
7
+ type StakePoolManager = {
8
+ stakePoolAddress: PublicKey;
9
+ depositSol: (lamports: bn_js__default) => TransactionInstruction;
10
+ withdrawSol: (poolTokens: bn_js__default) => 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
+ StandardBond = "standard",
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,71 +32,50 @@ import { BN, AnchorProvider, 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';
13
- metadata: {
14
- name: 'jbond';
15
- version: '0.2.1';
16
- spec: '0.1.0';
17
- description: 'Jpool Bond Program';
35
+ "address": "BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU";
36
+ "metadata": {
37
+ "name": "jbond";
38
+ "version": "0.2.1";
39
+ "spec": "0.1.0";
40
+ "description": "Jpool Bond Program";
18
41
  };
19
- instructions: [
42
+ "instructions": [
20
43
  {
21
- name: 'claim';
22
- docs: [
23
- 'Claims compensation for a validator.',
24
- 'Transfers funds from the validator\'s bond account to reserve.',
25
- '',
26
- '# Arguments',
27
- '* `amount` - Amount of compensation to claim (must be positive).',
28
- '',
29
- '# Errors',
30
- 'Fails if the authority is invalid, if the validator is not active,',
31
- 'if the amount is zero, or if there are insufficient funds.'
44
+ "name": "bondClaim";
45
+ "docs": [
46
+ "Claims compensation for a validator.",
47
+ "Transfers funds from the validator's bond account to reserve.",
48
+ "",
49
+ "# Arguments",
50
+ "* `amount` - Amount of compensation to claim (must be positive).",
51
+ "",
52
+ "# Errors",
53
+ "Fails if the authority is invalid, if the validator is not active,",
54
+ "if the amount is zero, or if there are insufficient funds."
32
55
  ];
33
- discriminator: [
34
- 62,
35
- 198,
36
- 214,
37
- 193,
38
- 213,
39
- 159,
40
- 108,
41
- 210
56
+ "discriminator": [
57
+ 151,
58
+ 92,
59
+ 10,
60
+ 205,
61
+ 66,
62
+ 250,
63
+ 188,
64
+ 129
42
65
  ];
43
- accounts: [
66
+ "accounts": [
44
67
  {
45
- name: 'globalState';
46
- 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
+ "name": "bondState";
69
+ "writable": true;
68
70
  },
69
71
  {
70
- name: 'validatorBond';
71
- writable: true;
72
- pda: {
73
- seeds: [
72
+ "name": "validatorBond";
73
+ "writable": true;
74
+ "pda": {
75
+ "seeds": [
74
76
  {
75
- kind: 'const';
76
- value: [
77
+ "kind": "const";
78
+ "value": [
77
79
  118,
78
80
  97,
79
81
  108,
@@ -91,73 +93,134 @@ type Jbond = {
91
93
  ];
92
94
  },
93
95
  {
94
- kind: 'account';
95
- path: 'validator_bond.vote_account';
96
- account: 'validatorBond';
96
+ "kind": "account";
97
+ "path": "bondState";
98
+ },
99
+ {
100
+ "kind": "account";
101
+ "path": "validator_bond.vote_account";
102
+ "account": "validatorBond";
97
103
  }
98
104
  ];
99
105
  };
100
106
  },
101
107
  {
102
- name: 'reserve';
103
- writable: true;
108
+ "name": "reserve";
109
+ "writable": true;
104
110
  },
105
111
  {
106
- name: 'authority';
107
- docs: [
108
- 'Authority that can trigger claims'
109
- ];
110
- signer: true;
112
+ "name": "authority";
113
+ "signer": true;
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
+ },
130
+ {
131
+ "name": "systemProgram";
132
+ "address": "11111111111111111111111111111111";
133
+ },
134
+ {
135
+ "name": "tokenProgram";
136
+ "optional": true;
137
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
111
138
  },
112
139
  {
113
- name: 'systemProgram';
114
- address: '11111111111111111111111111111111';
140
+ "name": "stakeProgram";
141
+ "optional": true;
115
142
  }
116
143
  ];
117
- args: [
144
+ "args": [
118
145
  {
119
- name: 'amount';
120
- type: 'u64';
146
+ "name": "amount";
147
+ "type": "u64";
121
148
  }
122
149
  ];
123
150
  },
124
151
  {
125
- name: 'configure';
126
- 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.'
152
+ "name": "bondConfigure";
153
+ "docs": [
154
+ "Updates bond configuration, including authority and reserve fields.",
155
+ "Allows changing the bond's authority and updating the reserve account."
135
156
  ];
136
- discriminator: [
137
- 245,
138
- 7,
157
+ "discriminator": [
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
- accounts: [
167
+ "accounts": [
168
+ {
169
+ "name": "bondState";
170
+ "writable": true;
171
+ },
147
172
  {
148
- name: 'globalState';
149
- writable: true;
150
- pda: {
151
- seeds: [
173
+ "name": "authority";
174
+ "signer": true;
175
+ "relations": [
176
+ "bondState"
177
+ ];
178
+ }
179
+ ];
180
+ "args": [
181
+ {
182
+ "name": "data";
183
+ "type": {
184
+ "defined": {
185
+ "name": "bondConfigureData";
186
+ };
187
+ };
188
+ }
189
+ ];
190
+ },
191
+ {
192
+ "name": "bondInitialize";
193
+ "docs": [
194
+ "Initializes state for the bond.",
195
+ "Sets the authority and reserve account for managing validator bonds.",
196
+ "",
197
+ "# Errors",
198
+ "Fails if the global state account is already initialized or if the payer lacks",
199
+ "sufficient funds."
200
+ ];
201
+ "discriminator": [
202
+ 230,
203
+ 3,
204
+ 121,
205
+ 94,
206
+ 147,
207
+ 203,
208
+ 175,
209
+ 210
210
+ ];
211
+ "accounts": [
212
+ {
213
+ "name": "bondState";
214
+ "writable": true;
215
+ "pda": {
216
+ "seeds": [
152
217
  {
153
- kind: 'const';
154
- value: [
155
- 103,
156
- 108,
157
- 111,
218
+ "kind": "const";
219
+ "value": [
158
220
  98,
159
- 97,
160
- 108,
221
+ 111,
222
+ 110,
223
+ 100,
161
224
  95,
162
225
  115,
163
226
  116,
@@ -165,148 +228,281 @@ type Jbond = {
165
228
  116,
166
229
  101
167
230
  ];
231
+ },
232
+ {
233
+ "kind": "arg";
234
+ "path": "data.bond_type";
235
+ },
236
+ {
237
+ "kind": "arg";
238
+ "path": "data.name";
168
239
  }
169
240
  ];
170
241
  };
171
242
  },
172
243
  {
173
- name: 'authority';
174
- signer: true;
175
- relations: [
176
- 'globalState'
177
- ];
244
+ "name": "authority";
245
+ "writable": true;
246
+ "signer": true;
247
+ },
248
+ {
249
+ "name": "reserve";
250
+ },
251
+ {
252
+ "name": "associatedTokenProgram";
253
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
254
+ },
255
+ {
256
+ "name": "systemProgram";
257
+ "address": "11111111111111111111111111111111";
258
+ },
259
+ {
260
+ "name": "tokenProgram";
261
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
262
+ },
263
+ {
264
+ "name": "reserveTokenAccount";
265
+ "writable": true;
266
+ "optional": true;
267
+ },
268
+ {
269
+ "name": "mint";
270
+ "optional": true;
178
271
  }
179
272
  ];
180
- args: [
273
+ "args": [
181
274
  {
182
- name: 'data';
183
- type: {
184
- defined: {
185
- name: 'configureData';
275
+ "name": "data";
276
+ "type": {
277
+ "defined": {
278
+ "name": "bondInitializeData";
186
279
  };
187
280
  };
188
281
  }
189
282
  ];
190
283
  },
191
284
  {
192
- name: 'initialize';
193
- docs: [
194
- 'Initializes the global state for the bonding program.',
195
- 'Sets the authority and reserve account for managing validator bonds.',
196
- '',
197
- '# Errors',
198
- 'Fails if the global state account is already initialized or if the payer lacks',
199
- 'sufficient funds.'
285
+ "name": "bondRegister";
286
+ "docs": [
287
+ "Registers a new validator with the bond.",
288
+ "Sets up the validator's bond account and deposits initial collateral.",
289
+ "",
290
+ "# Arguments",
291
+ "* `initial_collateral` - Amount of collateral to lock (must be positive).",
292
+ "* `withdrawal_authority` - Optional key that can withdraw collateral later.",
293
+ "",
294
+ "# Errors",
295
+ "Fails if the validator is already registered, if the vote account is invalid,",
296
+ "or if the initial collateral transfer fails."
200
297
  ];
201
- discriminator: [
202
- 175,
298
+ "discriminator": [
299
+ 117,
300
+ 127,
301
+ 78,
302
+ 103,
303
+ 166,
203
304
  175,
204
- 109,
205
- 31,
206
- 13,
207
- 152,
208
- 155,
209
- 237
305
+ 163,
306
+ 83
210
307
  ];
211
- accounts: [
308
+ "accounts": [
309
+ {
310
+ "name": "bondState";
311
+ "writable": true;
312
+ },
212
313
  {
213
- name: 'globalState';
214
- writable: true;
215
- pda: {
216
- seeds: [
314
+ "name": "validatorBond";
315
+ "writable": true;
316
+ "pda": {
317
+ "seeds": [
217
318
  {
218
- kind: 'const';
219
- value: [
220
- 103,
221
- 108,
222
- 111,
223
- 98,
319
+ "kind": "const";
320
+ "value": [
321
+ 118,
224
322
  97,
225
323
  108,
226
- 95,
227
- 115,
228
- 116,
324
+ 105,
325
+ 100,
229
326
  97,
230
327
  116,
231
- 101
328
+ 111,
329
+ 114,
330
+ 95,
331
+ 98,
332
+ 111,
333
+ 110,
334
+ 100
232
335
  ];
336
+ },
337
+ {
338
+ "kind": "account";
339
+ "path": "bondState";
340
+ },
341
+ {
342
+ "kind": "account";
343
+ "path": "voteAccount";
233
344
  }
234
345
  ];
235
346
  };
236
347
  },
237
348
  {
238
- name: 'authority';
239
- writable: true;
240
- signer: true;
349
+ "name": "identity";
350
+ },
351
+ {
352
+ "name": "voteAccount";
353
+ },
354
+ {
355
+ "name": "creator";
356
+ "writable": true;
357
+ "signer": true;
358
+ },
359
+ {
360
+ "name": "systemProgram";
361
+ "address": "11111111111111111111111111111111";
362
+ },
363
+ {
364
+ "name": "tokenProgram";
365
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
366
+ },
367
+ {
368
+ "name": "associatedTokenProgram";
369
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
370
+ },
371
+ {
372
+ "name": "bondTokenAccount";
373
+ "writable": true;
374
+ "optional": true;
241
375
  },
242
376
  {
243
- name: 'reserve';
377
+ "name": "mint";
378
+ "optional": true;
379
+ }
380
+ ];
381
+ "args": [
382
+ {
383
+ "name": "bondType";
384
+ "type": {
385
+ "defined": {
386
+ "name": "bondType";
387
+ };
388
+ };
244
389
  },
245
390
  {
246
- name: 'systemProgram';
247
- address: '11111111111111111111111111111111';
391
+ "name": "bondName";
392
+ "type": "string";
248
393
  }
249
394
  ];
250
- args: [];
251
395
  },
252
396
  {
253
- name: 'register';
254
- docs: [
255
- 'Registers a new validator with the bonding program.',
256
- 'Sets up the validator\'s bond account and deposits initial collateral.',
257
- '',
258
- '# Arguments',
259
- '* `initial_collateral` - Amount of collateral to lock (must be positive).',
260
- '* `withdrawal_authority` - Optional key that can withdraw collateral later.',
261
- '',
262
- '# Errors',
263
- 'Fails if the validator is already registered, if the vote account is invalid,',
264
- 'or if the initial collateral transfer fails.'
397
+ "name": "bondSetWithdrawAuthority";
398
+ "docs": [
399
+ "Sets a new withdrawal authority for a validator's bond account.",
400
+ "Allows changing who can withdraw collateral in the future.",
401
+ "",
402
+ "# Arguments",
403
+ "* `new_withdraw_authority` - Optional new withdrawal authority key (None to restrict to",
404
+ "identity).",
405
+ "",
406
+ "# Errors",
407
+ "Fails if the signer is not authorized to change the withdrawal authority."
265
408
  ];
266
- discriminator: [
267
- 211,
268
- 124,
269
- 67,
270
- 15,
271
- 211,
272
- 194,
273
- 178,
274
- 240
409
+ "discriminator": [
410
+ 212,
411
+ 162,
412
+ 53,
413
+ 130,
414
+ 91,
415
+ 158,
416
+ 61,
417
+ 166
275
418
  ];
276
- accounts: [
419
+ "accounts": [
420
+ {
421
+ "name": "bondState";
422
+ },
277
423
  {
278
- name: 'globalState';
279
- writable: true;
280
- pda: {
281
- seeds: [
424
+ "name": "validatorBond";
425
+ "writable": true;
426
+ "pda": {
427
+ "seeds": [
282
428
  {
283
- kind: 'const';
284
- value: [
285
- 103,
286
- 108,
287
- 111,
288
- 98,
429
+ "kind": "const";
430
+ "value": [
431
+ 118,
289
432
  97,
290
433
  108,
291
- 95,
292
- 115,
293
- 116,
434
+ 105,
435
+ 100,
294
436
  97,
295
437
  116,
296
- 101
438
+ 111,
439
+ 114,
440
+ 95,
441
+ 98,
442
+ 111,
443
+ 110,
444
+ 100
297
445
  ];
446
+ },
447
+ {
448
+ "kind": "account";
449
+ "path": "bondState";
450
+ },
451
+ {
452
+ "kind": "account";
453
+ "path": "validator_bond.vote_account";
454
+ "account": "validatorBond";
298
455
  }
299
456
  ];
300
457
  };
301
458
  },
302
459
  {
303
- name: 'validatorBond';
304
- writable: true;
305
- pda: {
306
- seeds: [
460
+ "name": "identity";
461
+ "signer": true;
462
+ },
463
+ {
464
+ "name": "newWithdrawAuthority";
465
+ "optional": true;
466
+ }
467
+ ];
468
+ "args": [];
469
+ },
470
+ {
471
+ "name": "bondTopUp";
472
+ "docs": [
473
+ "Adds additional collateral to an existing validator's bond.",
474
+ "Increases the collateral balance, enhancing the validator's stake.",
475
+ "",
476
+ "# Arguments",
477
+ "* `amount` - Amount to add.",
478
+ "",
479
+ "# Errors",
480
+ "Fails if the validator is not active, if the amount is zero,",
481
+ "or if the transfer of funds fails."
482
+ ];
483
+ "discriminator": [
484
+ 132,
485
+ 225,
486
+ 254,
487
+ 187,
488
+ 152,
489
+ 162,
490
+ 176,
491
+ 66
492
+ ];
493
+ "accounts": [
494
+ {
495
+ "name": "bondState";
496
+ "writable": true;
497
+ },
498
+ {
499
+ "name": "validatorBond";
500
+ "writable": true;
501
+ "pda": {
502
+ "seeds": [
307
503
  {
308
- kind: 'const';
309
- value: [
504
+ "kind": "const";
505
+ "value": [
310
506
  118,
311
507
  97,
312
508
  108,
@@ -324,70 +520,95 @@ type Jbond = {
324
520
  ];
325
521
  },
326
522
  {
327
- kind: 'account';
328
- path: 'voteAccount';
523
+ "kind": "account";
524
+ "path": "bondState";
525
+ },
526
+ {
527
+ "kind": "account";
528
+ "path": "validator_bond.vote_account";
529
+ "account": "validatorBond";
329
530
  }
330
531
  ];
331
532
  };
332
533
  },
333
534
  {
334
- name: 'identity';
535
+ "name": "payer";
536
+ "writable": true;
537
+ "signer": true;
335
538
  },
336
539
  {
337
- name: 'voteAccount';
540
+ "name": "payerTokenAccount";
541
+ "writable": true;
542
+ "optional": true;
338
543
  },
339
544
  {
340
- name: 'creator';
341
- docs: [
342
- 'The account creating the bond (pays for account creation and initial collateral)'
343
- ];
344
- writable: true;
345
- signer: true;
545
+ "name": "bondTokenAccount";
546
+ "writable": true;
547
+ "optional": true;
548
+ },
549
+ {
550
+ "name": "stakeAccount";
551
+ "writable": true;
552
+ "optional": true;
346
553
  },
347
554
  {
348
- name: 'systemProgram';
349
- address: '11111111111111111111111111111111';
555
+ "name": "systemProgram";
556
+ "address": "11111111111111111111111111111111";
557
+ },
558
+ {
559
+ "name": "tokenProgram";
560
+ "optional": true;
561
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
562
+ },
563
+ {
564
+ "name": "stakeProgram";
565
+ "optional": true;
350
566
  }
351
567
  ];
352
- args: [
568
+ "args": [
353
569
  {
354
- name: 'initialCollateral';
355
- type: 'u64';
570
+ "name": "amount";
571
+ "type": "u64";
356
572
  }
357
573
  ];
358
574
  },
359
575
  {
360
- name: 'setWithdrawAuthority';
361
- docs: [
362
- 'Sets a new withdrawal authority for a validator\'s bond account.',
363
- 'Allows changing who can withdraw collateral in the future.',
364
- '',
365
- '# Arguments',
366
- '* `new_withdraw_authority` - Optional new withdrawal authority key (None to restrict to',
367
- 'identity).',
368
- '',
369
- '# Errors',
370
- 'Fails if the signer is not authorized to change the withdrawal authority.'
576
+ "name": "bondWithdraw";
577
+ "docs": [
578
+ "Withdraws collateral from a validator's bond.",
579
+ "Decreases the collateral balance, allowing the validator to reclaim funds.",
580
+ "",
581
+ "# Arguments",
582
+ "* `amount` - Amount to withdraw (must not exceed available balance).",
583
+ "",
584
+ "# Errors",
585
+ "Fails if the validator is not active, if the amount is zero,",
586
+ "if the withdrawal authority is invalid, or if the withdrawal would",
587
+ "leave insufficient collateral."
371
588
  ];
372
- discriminator: [
373
- 199,
374
- 146,
375
- 140,
376
- 67,
377
- 1,
378
- 90,
379
- 8,
380
- 222
589
+ "discriminator": [
590
+ 99,
591
+ 64,
592
+ 127,
593
+ 178,
594
+ 53,
595
+ 117,
596
+ 70,
597
+ 204
381
598
  ];
382
- accounts: [
599
+ "accounts": [
600
+ {
601
+ "name": "bondState";
602
+ "writable": true;
603
+ },
383
604
  {
384
- name: 'validatorBond';
385
- writable: true;
386
- pda: {
387
- seeds: [
605
+ "name": "validatorBond";
606
+ "writable": true;
607
+ "pda": {
608
+ "seeds": [
388
609
  {
389
- kind: 'const';
390
- value: [
610
+ "kind": "const";
611
+ "value": [
391
612
  118,
392
613
  97,
393
614
  108,
@@ -405,130 +626,207 @@ type Jbond = {
405
626
  ];
406
627
  },
407
628
  {
408
- kind: 'account';
409
- path: 'validator_bond.vote_account';
410
- account: 'validatorBond';
629
+ "kind": "account";
630
+ "path": "bondState";
631
+ },
632
+ {
633
+ "kind": "account";
634
+ "path": "validator_bond.vote_account";
635
+ "account": "validatorBond";
411
636
  }
412
637
  ];
413
638
  };
414
639
  },
415
640
  {
416
- name: 'identity';
417
- signer: true;
641
+ "name": "withdrawalAuthority";
642
+ "writable": true;
643
+ "signer": true;
644
+ },
645
+ {
646
+ "name": "destination";
647
+ "writable": true;
418
648
  },
419
649
  {
420
- name: 'newWithdrawAuthority';
421
- optional: true;
650
+ "name": "destinationTokenAccount";
651
+ "writable": true;
652
+ "optional": true;
653
+ },
654
+ {
655
+ "name": "bondTokenAccount";
656
+ "writable": true;
657
+ "optional": true;
658
+ },
659
+ {
660
+ "name": "stakeAccount";
661
+ "writable": true;
662
+ "optional": true;
663
+ },
664
+ {
665
+ "name": "systemProgram";
666
+ "address": "11111111111111111111111111111111";
667
+ },
668
+ {
669
+ "name": "tokenProgram";
670
+ "optional": true;
671
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
672
+ },
673
+ {
674
+ "name": "stakeProgram";
675
+ "optional": true;
676
+ }
677
+ ];
678
+ "args": [
679
+ {
680
+ "name": "amount";
681
+ "type": "u64";
422
682
  }
423
683
  ];
424
- args: [];
425
684
  },
426
685
  {
427
- name: 'topUp';
428
- docs: [
429
- 'Adds additional collateral to an existing validator\'s bond.',
430
- 'Increases the collateral balance, enhancing the validator\'s stake.',
431
- '',
432
- '# Arguments',
433
- '* `amount` - Amount to add.',
434
- '',
435
- '# Errors',
436
- 'Fails if the validator is not active, if the amount is zero,',
437
- 'or if the transfer of funds fails.'
438
- ];
439
- discriminator: [
440
- 236,
441
- 225,
442
- 96,
443
- 9,
444
- 60,
445
- 106,
446
- 77,
447
- 208
686
+ "name": "globalConfigure";
687
+ "discriminator": [
688
+ 67,
689
+ 142,
690
+ 164,
691
+ 250,
692
+ 90,
693
+ 233,
694
+ 144,
695
+ 187
448
696
  ];
449
- accounts: [
697
+ "accounts": [
450
698
  {
451
- name: 'validatorBond';
452
- writable: true;
453
- pda: {
454
- seeds: [
699
+ "name": "globalState";
700
+ "writable": true;
701
+ "pda": {
702
+ "seeds": [
455
703
  {
456
- kind: 'const';
457
- value: [
458
- 118,
704
+ "kind": "const";
705
+ "value": [
706
+ 103,
707
+ 108,
708
+ 111,
709
+ 98,
459
710
  97,
460
711
  108,
461
- 105,
462
- 100,
712
+ 95,
713
+ 115,
714
+ 116,
463
715
  97,
464
716
  116,
717
+ 101
718
+ ];
719
+ }
720
+ ];
721
+ };
722
+ },
723
+ {
724
+ "name": "authority";
725
+ "signer": true;
726
+ "relations": [
727
+ "globalState"
728
+ ];
729
+ }
730
+ ];
731
+ "args": [
732
+ {
733
+ "name": "data";
734
+ "type": {
735
+ "defined": {
736
+ "name": "globalConfigureData";
737
+ };
738
+ };
739
+ }
740
+ ];
741
+ },
742
+ {
743
+ "name": "globalInitialize";
744
+ "docs": [
745
+ "----------------------------- Global Instructions ----------------------------"
746
+ ];
747
+ "discriminator": [
748
+ 30,
749
+ 79,
750
+ 193,
751
+ 205,
752
+ 75,
753
+ 42,
754
+ 223,
755
+ 196
756
+ ];
757
+ "accounts": [
758
+ {
759
+ "name": "globalState";
760
+ "writable": true;
761
+ "pda": {
762
+ "seeds": [
763
+ {
764
+ "kind": "const";
765
+ "value": [
766
+ 103,
767
+ 108,
465
768
  111,
466
- 114,
467
- 95,
468
769
  98,
469
- 111,
470
- 110,
471
- 100
770
+ 97,
771
+ 108,
772
+ 95,
773
+ 115,
774
+ 116,
775
+ 97,
776
+ 116,
777
+ 101
472
778
  ];
473
- },
474
- {
475
- kind: 'account';
476
- path: 'validator_bond.vote_account';
477
- account: 'validatorBond';
478
779
  }
479
780
  ];
480
781
  };
481
782
  },
482
783
  {
483
- name: 'payer';
484
- writable: true;
485
- signer: true;
784
+ "name": "authority";
785
+ "writable": true;
786
+ "signer": true;
486
787
  },
487
788
  {
488
- name: 'systemProgram';
489
- address: '11111111111111111111111111111111';
490
- }
491
- ];
492
- args: [
493
- {
494
- name: 'amount';
495
- type: 'u64';
789
+ "name": "systemProgram";
790
+ "address": "11111111111111111111111111111111";
496
791
  }
497
792
  ];
793
+ "args": [];
498
794
  },
499
795
  {
500
- name: 'withdraw';
501
- docs: [
502
- 'Withdraws collateral from a validator\'s bond.',
503
- 'Decreases the collateral balance, allowing the validator to reclaim funds.',
504
- '',
505
- '# Arguments',
506
- '* `amount` - Amount to withdraw (must not exceed available balance).',
507
- '',
508
- '# Errors',
509
- 'Fails if the validator is not active, if the amount is zero,',
510
- 'if the withdrawal authority is invalid, or if the withdrawal would',
511
- 'leave insufficient collateral.'
796
+ "name": "migrateBond";
797
+ "docs": [
798
+ "Migrates validator bond data from legacy structure to new structure."
512
799
  ];
513
- discriminator: [
514
- 183,
800
+ "discriminator": [
801
+ 107,
802
+ 119,
803
+ 59,
804
+ 110,
805
+ 76,
515
806
  18,
516
- 70,
517
- 156,
518
- 148,
519
- 109,
520
- 161,
521
- 34
807
+ 37,
808
+ 163
522
809
  ];
523
- accounts: [
810
+ "accounts": [
524
811
  {
525
- name: 'validatorBond';
526
- writable: true;
527
- pda: {
528
- seeds: [
812
+ "name": "bondState";
813
+ "writable": true;
814
+ },
815
+ {
816
+ "name": "legacyValidatorBond";
817
+ "writable": true;
818
+ },
819
+ {
820
+ "name": "legacyVoteAccount";
821
+ },
822
+ {
823
+ "name": "validatorBond";
824
+ "writable": true;
825
+ "pda": {
826
+ "seeds": [
529
827
  {
530
- kind: 'const';
531
- value: [
828
+ "kind": "const";
829
+ "value": [
532
830
  118,
533
831
  97,
534
832
  108,
@@ -546,43 +844,113 @@ type Jbond = {
546
844
  ];
547
845
  },
548
846
  {
549
- kind: 'account';
550
- path: 'validator_bond.vote_account';
551
- account: 'validatorBond';
847
+ "kind": "account";
848
+ "path": "bondState";
849
+ },
850
+ {
851
+ "kind": "account";
852
+ "path": "legacyVoteAccount";
552
853
  }
553
854
  ];
554
855
  };
555
856
  },
556
857
  {
557
- name: 'withdrawalAuthority';
558
- writable: true;
559
- signer: true;
858
+ "name": "creator";
859
+ "writable": true;
860
+ "signer": true;
560
861
  },
561
862
  {
562
- name: 'destination';
563
- writable: true;
863
+ "name": "systemProgram";
864
+ "address": "11111111111111111111111111111111";
865
+ }
866
+ ];
867
+ "args": [];
868
+ },
869
+ {
870
+ "name": "sessionFinish";
871
+ "docs": [
872
+ "Finishes a bond, preventing further deposits and withdrawals."
873
+ ];
874
+ "discriminator": [
875
+ 230,
876
+ 209,
877
+ 54,
878
+ 205,
879
+ 127,
880
+ 141,
881
+ 137,
882
+ 113
883
+ ];
884
+ "accounts": [
885
+ {
886
+ "name": "bondState";
887
+ "writable": true;
564
888
  },
565
889
  {
566
- name: 'epochSchedule';
567
- address: 'SysvarEpochSchedu1e111111111111111111111111';
890
+ "name": "authority";
891
+ "writable": true;
892
+ "signer": true;
893
+ "relations": [
894
+ "bondState"
895
+ ];
896
+ }
897
+ ];
898
+ "args": [];
899
+ },
900
+ {
901
+ "name": "sessionStart";
902
+ "docs": [
903
+ "Starts a paused bond, allowing deposits and withdrawals to resume."
904
+ ];
905
+ "discriminator": [
906
+ 132,
907
+ 93,
908
+ 83,
909
+ 152,
910
+ 141,
911
+ 32,
912
+ 58,
913
+ 92
914
+ ];
915
+ "accounts": [
916
+ {
917
+ "name": "bondState";
918
+ "writable": true;
568
919
  },
569
920
  {
570
- name: 'systemProgram';
571
- address: '11111111111111111111111111111111';
921
+ "name": "authority";
922
+ "writable": true;
923
+ "signer": true;
924
+ "relations": [
925
+ "bondState"
926
+ ];
572
927
  }
573
928
  ];
574
- args: [
929
+ "args": [
575
930
  {
576
- name: 'amount';
577
- type: 'u64';
931
+ "name": "durationSecs";
932
+ "type": "u64";
578
933
  }
579
934
  ];
580
935
  }
581
936
  ];
582
- accounts: [
937
+ "accounts": [
938
+ {
939
+ "name": "bondState";
940
+ "discriminator": [
941
+ 251,
942
+ 95,
943
+ 76,
944
+ 47,
945
+ 191,
946
+ 108,
947
+ 163,
948
+ 92
949
+ ];
950
+ },
583
951
  {
584
- name: 'globalState';
585
- discriminator: [
952
+ "name": "globalState";
953
+ "discriminator": [
586
954
  163,
587
955
  46,
588
956
  74,
@@ -594,8 +962,8 @@ type Jbond = {
594
962
  ];
595
963
  },
596
964
  {
597
- name: 'validatorBond';
598
- discriminator: [
965
+ "name": "validatorBond";
966
+ "discriminator": [
599
967
  82,
600
968
  127,
601
969
  243,
@@ -607,10 +975,36 @@ type Jbond = {
607
975
  ];
608
976
  }
609
977
  ];
610
- events: [
978
+ "events": [
979
+ {
980
+ "name": "bondFinished";
981
+ "discriminator": [
982
+ 223,
983
+ 254,
984
+ 3,
985
+ 161,
986
+ 90,
987
+ 190,
988
+ 150,
989
+ 191
990
+ ];
991
+ },
992
+ {
993
+ "name": "bondStarted";
994
+ "discriminator": [
995
+ 235,
996
+ 69,
997
+ 80,
998
+ 63,
999
+ 209,
1000
+ 252,
1001
+ 232,
1002
+ 64
1003
+ ];
1004
+ },
611
1005
  {
612
- name: 'collateralToppedUp';
613
- discriminator: [
1006
+ "name": "collateralToppedUp";
1007
+ "discriminator": [
614
1008
  189,
615
1009
  137,
616
1010
  204,
@@ -622,8 +1016,8 @@ type Jbond = {
622
1016
  ];
623
1017
  },
624
1018
  {
625
- name: 'collateralWithdrawn';
626
- discriminator: [
1019
+ "name": "collateralWithdrawn";
1020
+ "discriminator": [
627
1021
  51,
628
1022
  224,
629
1023
  133,
@@ -635,8 +1029,8 @@ type Jbond = {
635
1029
  ];
636
1030
  },
637
1031
  {
638
- name: 'compensationClaimed';
639
- discriminator: [
1032
+ "name": "compensationClaimed";
1033
+ "discriminator": [
640
1034
  36,
641
1035
  159,
642
1036
  41,
@@ -648,8 +1042,8 @@ type Jbond = {
648
1042
  ];
649
1043
  },
650
1044
  {
651
- name: 'validatorRegistered';
652
- discriminator: [
1045
+ "name": "validatorRegistered";
1046
+ "discriminator": [
653
1047
  20,
654
1048
  20,
655
1049
  190,
@@ -661,347 +1055,631 @@ type Jbond = {
661
1055
  ];
662
1056
  }
663
1057
  ];
664
- errors: [
1058
+ "errors": [
1059
+ {
1060
+ "code": 6000;
1061
+ "name": "invalidVoteAccount";
1062
+ "msg": "Invalid vote account";
1063
+ },
1064
+ {
1065
+ "code": 6001;
1066
+ "name": "identityMismatch";
1067
+ "msg": "Identity does not match vote account";
1068
+ },
1069
+ {
1070
+ "code": 6002;
1071
+ "name": "insufficientCollateral";
1072
+ "msg": "Insufficient collateral amount";
1073
+ },
1074
+ {
1075
+ "code": 6003;
1076
+ "name": "targetAprTooLow";
1077
+ "msg": "Target APR is below minimum threshold";
1078
+ },
1079
+ {
1080
+ "code": 6004;
1081
+ "name": "mathOverflow";
1082
+ "msg": "Math overflow";
1083
+ },
665
1084
  {
666
- code: 6000;
667
- name: 'invalidVoteAccount';
668
- msg: 'Invalid vote account';
1085
+ "code": 6005;
1086
+ "name": "invalidAmount";
1087
+ "msg": "Invalid amount";
669
1088
  },
670
1089
  {
671
- code: 6001;
672
- name: 'identityMismatch';
673
- msg: 'Identity does not match vote account';
1090
+ "code": 6006;
1091
+ "name": "validatorNotActive";
1092
+ "msg": "Validator bond account is not active";
674
1093
  },
675
1094
  {
676
- code: 6002;
677
- name: 'insufficientCollateral';
678
- msg: 'Insufficient collateral amount';
1095
+ "code": 6007;
1096
+ "name": "validatorAlreadyRegistered";
1097
+ "msg": "Validator already registered";
679
1098
  },
680
1099
  {
681
- code: 6003;
682
- name: 'targetAprTooLow';
683
- msg: 'Target APR is below minimum threshold';
1100
+ "code": 6008;
1101
+ "name": "unauthorized";
1102
+ "msg": "unauthorized";
684
1103
  },
685
1104
  {
686
- code: 6004;
687
- name: 'mathOverflow';
688
- msg: 'Math overflow';
1105
+ "code": 6009;
1106
+ "name": "withdrawalLockedNearEpochEnd";
1107
+ "msg": "Withdrawals are locked near the end of the epoch.";
689
1108
  },
690
1109
  {
691
- code: 6005;
692
- name: 'invalidAmount';
693
- msg: 'Invalid amount';
1110
+ "code": 6010;
1111
+ "name": "missingTokenAccounts";
1112
+ "msg": "Missing token accounts for token collateral type";
694
1113
  },
695
1114
  {
696
- code: 6006;
697
- name: 'validatorNotActive';
698
- msg: 'Validator bond account is not active';
1115
+ "code": 6011;
1116
+ "name": "missingTokenProgram";
1117
+ "msg": "Token program is required for token collateral type";
699
1118
  },
700
1119
  {
701
- code: 6007;
702
- name: 'validatorAlreadyRegistered';
703
- msg: 'Validator already registered';
1120
+ "code": 6012;
1121
+ "name": "invalidMint";
1122
+ "msg": "Invalid mint for token collateral type";
704
1123
  },
705
1124
  {
706
- code: 6008;
707
- name: 'unauthorized';
708
- msg: 'unauthorized';
1125
+ "code": 6013;
1126
+ "name": "missingStakeAccount";
1127
+ "msg": "Stake account is required for stake account collateral type";
709
1128
  },
710
1129
  {
711
- code: 6009;
712
- name: 'withdrawalLockedNearEpochEnd';
713
- msg: 'Withdrawals are locked near the end of the epoch.';
1130
+ "code": 6014;
1131
+ "name": "missingStakeProgram";
1132
+ "msg": "Stake program is required for stake account collateral type";
1133
+ },
1134
+ {
1135
+ "code": 6015;
1136
+ "name": "bondFinished";
1137
+ "msg": "Bond is finished (deposits/withdrawals disabled)";
1138
+ },
1139
+ {
1140
+ "code": 6016;
1141
+ "name": "bondNotFinished";
1142
+ "msg": "Bond is not finished";
1143
+ },
1144
+ {
1145
+ "code": 6017;
1146
+ "name": "unsupportedCollateralType";
1147
+ "msg": "Unsupported collateral type";
1148
+ },
1149
+ {
1150
+ "code": 6018;
1151
+ "name": "overflow";
1152
+ "msg": "Math operation overflowed";
1153
+ },
1154
+ {
1155
+ "code": 6019;
1156
+ "name": "incorrectBondType";
1157
+ "msg": "Incorrect bond type for this operation";
1158
+ },
1159
+ {
1160
+ "code": 6020;
1161
+ "name": "bondNotFinishable";
1162
+ "msg": "This bond type can't be finished";
1163
+ },
1164
+ {
1165
+ "code": 6021;
1166
+ "name": "invalidArgument";
1167
+ "msg": "Invalid argument provided";
1168
+ },
1169
+ {
1170
+ "code": 6022;
1171
+ "name": "bondNotDisabled";
1172
+ "msg": "Bond is not disabled";
1173
+ },
1174
+ {
1175
+ "code": 6023;
1176
+ "name": "bondNotEnabled";
1177
+ "msg": "Bond is not enabled";
714
1178
  }
715
1179
  ];
716
- types: [
1180
+ "types": [
717
1181
  {
718
- name: 'collateralToppedUp';
719
- type: {
720
- kind: 'struct';
721
- fields: [
722
- {
723
- name: 'validator';
724
- type: 'pubkey';
725
- },
1182
+ "name": "bondConfigureData";
1183
+ "type": {
1184
+ "kind": "struct";
1185
+ "fields": [
726
1186
  {
727
- name: 'amount';
728
- type: 'u64';
1187
+ "name": "status";
1188
+ "type": {
1189
+ "option": {
1190
+ "defined": {
1191
+ "name": "bondStatus";
1192
+ };
1193
+ };
1194
+ };
729
1195
  },
730
1196
  {
731
- name: 'postBalance';
732
- type: 'u64';
1197
+ "name": "newReserve";
1198
+ "type": {
1199
+ "option": "pubkey";
1200
+ };
733
1201
  },
734
1202
  {
735
- name: 'timestamp';
736
- type: 'i64';
1203
+ "name": "newAuthority";
1204
+ "type": {
1205
+ "option": "pubkey";
1206
+ };
737
1207
  }
738
1208
  ];
739
1209
  };
740
1210
  },
741
1211
  {
742
- name: 'collateralWithdrawn';
743
- type: {
744
- kind: 'struct';
745
- fields: [
746
- {
747
- name: 'validator';
748
- type: 'pubkey';
749
- },
1212
+ "name": "bondFinished";
1213
+ "type": {
1214
+ "kind": "struct";
1215
+ "fields": [
750
1216
  {
751
- name: 'amount';
752
- type: 'u64';
1217
+ "name": "bond";
1218
+ "type": "pubkey";
753
1219
  },
754
1220
  {
755
- name: 'postBalance';
756
- type: 'u64';
1221
+ "name": "authority";
1222
+ "type": "pubkey";
757
1223
  },
758
1224
  {
759
- name: 'timestamp';
760
- type: 'i64';
1225
+ "name": "timestamp";
1226
+ "type": "i64";
761
1227
  }
762
1228
  ];
763
1229
  };
764
1230
  },
765
1231
  {
766
- name: 'compensationClaimed';
767
- type: {
768
- kind: 'struct';
769
- fields: [
770
- {
771
- name: 'validator';
772
- type: 'pubkey';
773
- },
1232
+ "name": "bondInitializeData";
1233
+ "docs": [
1234
+ "Data required to initialize a performance bond"
1235
+ ];
1236
+ "type": {
1237
+ "kind": "struct";
1238
+ "fields": [
774
1239
  {
775
- name: 'amount';
776
- type: 'u64';
1240
+ "name": "name";
1241
+ "type": "string";
777
1242
  },
778
1243
  {
779
- name: 'postBalance';
780
- type: 'u64';
1244
+ "name": "bondType";
1245
+ "type": {
1246
+ "defined": {
1247
+ "name": "bondType";
1248
+ };
1249
+ };
781
1250
  },
782
1251
  {
783
- name: 'epoch';
784
- type: 'u64';
1252
+ "name": "reserve";
1253
+ "type": "pubkey";
785
1254
  },
786
1255
  {
787
- name: 'timestamp';
788
- type: 'i64';
1256
+ "name": "collateralType";
1257
+ "type": {
1258
+ "defined": {
1259
+ "name": "collateralType";
1260
+ };
1261
+ };
789
1262
  }
790
1263
  ];
791
1264
  };
792
1265
  },
793
1266
  {
794
- name: 'configureData';
795
- type: {
796
- kind: 'struct';
797
- fields: [
1267
+ "name": "bondStarted";
1268
+ "type": {
1269
+ "kind": "struct";
1270
+ "fields": [
798
1271
  {
799
- name: 'newAuthority';
800
- type: {
801
- option: 'pubkey';
802
- };
1272
+ "name": "bond";
1273
+ "type": "pubkey";
803
1274
  },
804
1275
  {
805
- name: 'newReserve';
806
- type: {
807
- option: 'pubkey';
808
- };
1276
+ "name": "authority";
1277
+ "type": "pubkey";
1278
+ },
1279
+ {
1280
+ "name": "timestamp";
1281
+ "type": "i64";
809
1282
  }
810
1283
  ];
811
1284
  };
812
1285
  },
813
1286
  {
814
- name: 'globalState';
815
- type: {
816
- kind: 'struct';
817
- fields: [
1287
+ "name": "bondState";
1288
+ "type": {
1289
+ "kind": "struct";
1290
+ "fields": [
818
1291
  {
819
- name: 'authority';
820
- docs: [
821
- 'The authority allowed to manage the program'
822
- ];
823
- type: 'pubkey';
1292
+ "name": "name";
1293
+ "type": "string";
824
1294
  },
825
1295
  {
826
- name: 'reserve';
827
- docs: [
828
- 'The reserve vault holding SOL for bonding and compensation'
1296
+ "name": "bondType";
1297
+ "docs": [
1298
+ "The type of bond (e.g., Standard, Crowdfunding)"
829
1299
  ];
830
- type: 'pubkey';
1300
+ "type": {
1301
+ "defined": {
1302
+ "name": "bondType";
1303
+ };
1304
+ };
831
1305
  },
832
1306
  {
833
- name: 'totalValidators';
834
- docs: [
835
- 'Total number of registered validators'
1307
+ "name": "collateralType";
1308
+ "docs": [
1309
+ "The type of collateral accepted for this bond"
836
1310
  ];
837
- type: 'u16';
1311
+ "type": {
1312
+ "defined": {
1313
+ "name": "collateralType";
1314
+ };
1315
+ };
838
1316
  },
839
1317
  {
840
- name: 'totalCompensationAmount';
841
- docs: [
842
- 'Total compensation amount paid out'
1318
+ "name": "reserve";
1319
+ "docs": [
1320
+ "Reserve account where collateral is held"
843
1321
  ];
844
- type: 'u64';
1322
+ "type": "pubkey";
845
1323
  },
846
1324
  {
847
- name: 'bump';
848
- docs: [
849
- 'Bump for the PDA'
1325
+ "name": "authority";
1326
+ "docs": [
1327
+ "Authority allowed to manage the bond configuration"
850
1328
  ];
851
- type: 'u8';
852
- }
853
- ];
854
- };
855
- },
856
- {
857
- name: 'validatorBond';
858
- type: {
859
- kind: 'struct';
860
- fields: [
1329
+ "type": "pubkey";
1330
+ },
861
1331
  {
862
- name: 'identity';
863
- docs: [
864
- 'The validator identity pubkey'
1332
+ "name": "sessionId";
1333
+ "docs": [
1334
+ "Unique identifier for the bonding session"
865
1335
  ];
866
- type: 'pubkey';
1336
+ "type": "u32";
867
1337
  },
868
1338
  {
869
- name: 'voteAccount';
870
- docs: [
871
- 'The validator vote account pubkey'
1339
+ "name": "totalMembers";
1340
+ "docs": [
1341
+ "Total number of users who have participated in the bond"
872
1342
  ];
873
- type: 'pubkey';
1343
+ "type": "u16";
874
1344
  },
875
1345
  {
876
- name: 'creator';
877
- docs: [
878
- 'Creator of the validator bond account'
1346
+ "name": "totalCompensationAmount";
1347
+ "docs": [
1348
+ "Total compensation amount paid out"
879
1349
  ];
880
- type: 'pubkey';
1350
+ "type": "u64";
881
1351
  },
882
1352
  {
883
- name: 'withdrawalAuthority';
884
- docs: [
885
- 'Authority allowed to withdraw funds (if None, only identity can withdraw)'
1353
+ "name": "sessionStartTs";
1354
+ "docs": [
1355
+ "Start timestamp of the current session (unix seconds). 0 not set."
886
1356
  ];
887
- type: {
888
- option: 'pubkey';
889
- };
1357
+ "type": "i64";
890
1358
  },
891
1359
  {
892
- name: 'totalCompensationAmount';
893
- docs: [
894
- 'Total compensation claimed for the validator'
1360
+ "name": "sessionFinishTs";
1361
+ "docs": [
1362
+ "Finish timestamp of the current session (unix seconds). 0 — not set."
895
1363
  ];
896
- type: 'u64';
1364
+ "type": "i64";
897
1365
  },
898
1366
  {
899
- name: 'lastCompensationAmount';
900
- docs: [
901
- 'Last compensation amount claimed'
1367
+ "name": "status";
1368
+ "docs": [
1369
+ "Current status of the bond"
902
1370
  ];
903
- type: 'u64';
1371
+ "type": {
1372
+ "defined": {
1373
+ "name": "bondStatus";
1374
+ };
1375
+ };
904
1376
  },
905
1377
  {
906
- name: 'lastCompensationEpoch';
907
- docs: [
908
- 'Last epoch when compensation was claimed'
1378
+ "name": "bump";
1379
+ "docs": [
1380
+ "Bump for the PDA"
909
1381
  ];
910
- type: 'u64';
1382
+ "type": "u8";
1383
+ }
1384
+ ];
1385
+ };
1386
+ },
1387
+ {
1388
+ "name": "bondStatus";
1389
+ "type": {
1390
+ "kind": "enum";
1391
+ "variants": [
1392
+ {
1393
+ "name": "active";
1394
+ },
1395
+ {
1396
+ "name": "disabled";
1397
+ }
1398
+ ];
1399
+ };
1400
+ },
1401
+ {
1402
+ "name": "bondType";
1403
+ "docs": [
1404
+ "Types of bonds supported by the program"
1405
+ ];
1406
+ "type": {
1407
+ "kind": "enum";
1408
+ "variants": [
1409
+ {
1410
+ "name": "standard";
1411
+ },
1412
+ {
1413
+ "name": "crowdfunding";
1414
+ }
1415
+ ];
1416
+ };
1417
+ },
1418
+ {
1419
+ "name": "collateralToppedUp";
1420
+ "type": {
1421
+ "kind": "struct";
1422
+ "fields": [
1423
+ {
1424
+ "name": "validator";
1425
+ "type": "pubkey";
1426
+ },
1427
+ {
1428
+ "name": "amount";
1429
+ "type": "u64";
1430
+ },
1431
+ {
1432
+ "name": "postBalance";
1433
+ "type": "u64";
1434
+ },
1435
+ {
1436
+ "name": "timestamp";
1437
+ "type": "i64";
1438
+ }
1439
+ ];
1440
+ };
1441
+ },
1442
+ {
1443
+ "name": "collateralType";
1444
+ "docs": [
1445
+ "Types of collateral that can be used for bond deposit"
1446
+ ];
1447
+ "type": {
1448
+ "kind": "enum";
1449
+ "variants": [
1450
+ {
1451
+ "name": "native";
1452
+ },
1453
+ {
1454
+ "name": "stakeAccount";
911
1455
  },
912
1456
  {
913
- name: 'createdAt';
914
- docs: [
915
- 'Timestamp when the bond account was created'
1457
+ "name": "token";
1458
+ "fields": [
1459
+ "pubkey"
916
1460
  ];
917
- type: 'i64';
1461
+ }
1462
+ ];
1463
+ };
1464
+ },
1465
+ {
1466
+ "name": "collateralWithdrawn";
1467
+ "type": {
1468
+ "kind": "struct";
1469
+ "fields": [
1470
+ {
1471
+ "name": "validator";
1472
+ "type": "pubkey";
1473
+ },
1474
+ {
1475
+ "name": "amount";
1476
+ "type": "u64";
1477
+ },
1478
+ {
1479
+ "name": "postBalance";
1480
+ "type": "u64";
1481
+ },
1482
+ {
1483
+ "name": "timestamp";
1484
+ "type": "i64";
1485
+ }
1486
+ ];
1487
+ };
1488
+ },
1489
+ {
1490
+ "name": "compensationClaimed";
1491
+ "type": {
1492
+ "kind": "struct";
1493
+ "fields": [
1494
+ {
1495
+ "name": "validator";
1496
+ "type": "pubkey";
1497
+ },
1498
+ {
1499
+ "name": "amount";
1500
+ "type": "u64";
1501
+ },
1502
+ {
1503
+ "name": "postBalance";
1504
+ "type": "u64";
1505
+ },
1506
+ {
1507
+ "name": "epoch";
1508
+ "type": "u64";
918
1509
  },
919
1510
  {
920
- name: 'isActive';
921
- docs: [
922
- 'Whether the validator is currently active'
1511
+ "name": "timestamp";
1512
+ "type": "i64";
1513
+ }
1514
+ ];
1515
+ };
1516
+ },
1517
+ {
1518
+ "name": "globalConfigureData";
1519
+ "type": {
1520
+ "kind": "struct";
1521
+ "fields": [
1522
+ {
1523
+ "name": "newAuthority";
1524
+ "type": {
1525
+ "option": "pubkey";
1526
+ };
1527
+ }
1528
+ ];
1529
+ };
1530
+ },
1531
+ {
1532
+ "name": "globalState";
1533
+ "type": {
1534
+ "kind": "struct";
1535
+ "fields": [
1536
+ {
1537
+ "name": "authority";
1538
+ "docs": [
1539
+ "The authority allowed to manage the program"
923
1540
  ];
924
- type: 'bool';
1541
+ "type": "pubkey";
925
1542
  },
926
1543
  {
927
- name: 'bump';
928
- docs: [
929
- 'Bump for the PDA'
1544
+ "name": "bump";
1545
+ "docs": [
1546
+ "Bump for the PDA"
930
1547
  ];
931
- type: 'u8';
1548
+ "type": "u8";
932
1549
  }
933
1550
  ];
934
1551
  };
935
1552
  },
936
1553
  {
937
- name: 'validatorRegistered';
938
- type: {
939
- kind: 'struct';
940
- fields: [
1554
+ "name": "validatorBond";
1555
+ "type": {
1556
+ "kind": "struct";
1557
+ "fields": [
1558
+ {
1559
+ "name": "state";
1560
+ "type": "pubkey";
1561
+ },
1562
+ {
1563
+ "name": "identity";
1564
+ "type": "pubkey";
1565
+ },
1566
+ {
1567
+ "name": "voteAccount";
1568
+ "type": "pubkey";
1569
+ },
1570
+ {
1571
+ "name": "creator";
1572
+ "type": "pubkey";
1573
+ },
941
1574
  {
942
- name: 'identity';
943
- type: 'pubkey';
1575
+ "name": "withdrawalAuthority";
1576
+ "type": {
1577
+ "option": "pubkey";
1578
+ };
1579
+ },
1580
+ {
1581
+ "name": "createdAt";
1582
+ "type": "i64";
944
1583
  },
945
1584
  {
946
- name: 'voteAccount';
947
- type: 'pubkey';
1585
+ "name": "bump";
1586
+ "type": "u8";
1587
+ }
1588
+ ];
1589
+ };
1590
+ },
1591
+ {
1592
+ "name": "validatorRegistered";
1593
+ "type": {
1594
+ "kind": "struct";
1595
+ "fields": [
1596
+ {
1597
+ "name": "identity";
1598
+ "type": "pubkey";
948
1599
  },
949
1600
  {
950
- name: 'initialCollateral';
951
- type: 'u64';
1601
+ "name": "voteAccount";
1602
+ "type": "pubkey";
952
1603
  },
953
1604
  {
954
- name: 'timestamp';
955
- type: 'i64';
1605
+ "name": "timestamp";
1606
+ "type": "i64";
956
1607
  }
957
1608
  ];
958
1609
  };
959
1610
  }
960
1611
  ];
1612
+ "constants": [
1613
+ {
1614
+ "name": "epochLockedSlotTail";
1615
+ "docs": [
1616
+ "Epoch slot index at the end of an epoch after which withdrawals are locked"
1617
+ ];
1618
+ "type": "u64";
1619
+ "value": "420000";
1620
+ }
1621
+ ];
961
1622
  };
962
1623
 
963
- type GlobalState = {
964
- authority: PublicKey;
965
- reserve: PublicKey;
966
- totalValidators: number;
967
- totalCompensationAmount: BN;
968
- bump: number;
1624
+ type GlobalState = IdlAccounts<Jbond>['globalState'];
1625
+ type BondState = IdlAccounts<Jbond>['bondState'];
1626
+ type ValidatorBond = IdlAccounts<Jbond>['validatorBond'];
1627
+ type BondType = IdlTypes<Jbond>['bondType'];
1628
+ type CollateralType = IdlTypes<Jbond>['collateralType'];
1629
+ type BondStateStatus = IdlTypes<Jbond>['bondStatus'];
1630
+ type BondStateStats = {
1631
+ totalCollected: number;
1632
+ status: SessionStatus;
969
1633
  };
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;
1634
+ declare const bondTypeToSeed: {
1635
+ standard: Seeds;
1636
+ crowdfunding: Seeds;
981
1637
  };
982
- type InitializeProps = {
1638
+ declare const BondTypeVariant: {
1639
+ Standard: BondType;
1640
+ Crowdfunding: BondType;
1641
+ };
1642
+ declare const BondStateStatusVariant: {
1643
+ Active: BondStateStatus;
1644
+ Disabled: BondStateStatus;
1645
+ };
1646
+ type GlobalInitializeProps = {
1647
+ authority?: PublicKey;
1648
+ };
1649
+ type BondInitializeProps = {
1650
+ bondType: BondType;
1651
+ name: string;
983
1652
  authority?: PublicKey;
1653
+ collateralType: CollateralType;
984
1654
  reserve: PublicKey;
985
1655
  };
986
1656
  type RegisterValidatorProps = {
1657
+ bondType: BondType;
1658
+ name: string;
987
1659
  identity: PublicKey;
988
1660
  voteAccount: PublicKey;
989
- initialCollateral: number;
990
1661
  creator?: PublicKey;
991
1662
  };
992
1663
  type TopUpCollateralProps = {
993
- amount: number;
1664
+ bondType: BondType;
1665
+ name: string;
1666
+ identity: PublicKey;
994
1667
  voteAccount: PublicKey;
1668
+ collateral: BondCollateral;
995
1669
  payer?: PublicKey;
996
1670
  };
997
1671
  type WithdrawCollateralProps = {
998
- amount: number;
1672
+ bondType: BondType;
1673
+ name: string;
1674
+ withdraw: BondCollateral;
999
1675
  voteAccount: PublicKey;
1000
1676
  destination?: PublicKey;
1001
1677
  withdrawalAuthority?: PublicKey;
1002
1678
  };
1003
1679
  type ClaimProps = {
1004
- amount: number;
1680
+ bondType: BondType;
1681
+ name: string;
1682
+ claim: BondCollateral;
1005
1683
  voteAccount: PublicKey;
1006
1684
  reserve?: PublicKey;
1007
1685
  authority?: PublicKey;
@@ -1018,12 +1696,21 @@ type GetHistoryGroupedProps = {
1018
1696
  voteAccount: PublicKey;
1019
1697
  epochsCount?: number;
1020
1698
  };
1021
- type ConfigureProps = {
1699
+ type BondConfigureProps = {
1700
+ bondType: BondType;
1701
+ name: string;
1022
1702
  authority?: PublicKey;
1703
+ bondStateStatus?: BondStateStatus;
1023
1704
  newAuthority?: PublicKey;
1024
1705
  newReserve?: PublicKey;
1025
1706
  };
1707
+ type GlobalConfigureProps = {
1708
+ authority?: PublicKey;
1709
+ newAuthority?: PublicKey;
1710
+ };
1026
1711
  type SetWithdrawAuthorityProps = {
1712
+ bondType: BondType;
1713
+ name: string;
1027
1714
  voteAccount: PublicKey;
1028
1715
  newWithdrawAuthority?: PublicKey | null;
1029
1716
  identity?: PublicKey;
@@ -1041,14 +1728,40 @@ type TransactionHistoryItem = {
1041
1728
  epoch: number;
1042
1729
  type: BondTransactionType;
1043
1730
  amount: number;
1044
- beforeBalance?: number;
1045
- afterBalance?: number;
1046
1731
  };
1047
1732
  declare enum BondTransactionType {
1048
1733
  Deposit = "deposit",
1049
1734
  Withdrawal = "withdrawal",
1050
1735
  Compensation = "compensation"
1051
1736
  }
1737
+ type BondCollateral = {
1738
+ amount?: number;
1739
+ mint?: PublicKey;
1740
+ stakeAccount?: PublicKey;
1741
+ };
1742
+ declare enum SessionStatus {
1743
+ Live = 0,
1744
+ Finished = 1
1745
+ }
1746
+
1747
+ type GetHistoryOpts = {
1748
+ cluster?: 'mainnet-beta' | 'testnet' | 'devnet';
1749
+ limit?: number;
1750
+ before?: string;
1751
+ until?: string;
1752
+ };
1753
+ declare class HistoryManager {
1754
+ private program;
1755
+ private connection;
1756
+ private programId;
1757
+ private discCache;
1758
+ constructor(program: Program<Jbond>, connection: Connection, programId: PublicKey);
1759
+ getHistory(bondType: BondType, vote: PublicKeyInitData, pdaDeriver: (bondType: BondType, vote: PublicKeyInitData) => [PublicKey, number], options?: GetHistoryOpts): Promise<TransactionHistoryItem[]>;
1760
+ private fetchSignaturesForAddress;
1761
+ private fetchParsedTransactions;
1762
+ private getInstructionDiscriminator;
1763
+ private decodeInstructionData;
1764
+ }
1052
1765
 
1053
1766
  type Wallet = {
1054
1767
  publicKey: PublicKey;
@@ -1076,14 +1789,14 @@ declare enum BondClientEnv {
1076
1789
  * Options for configuring the JBondClient.
1077
1790
  */
1078
1791
  type ClientOptions = {
1079
- programId?: PublicKey;
1080
1792
  debug?: boolean;
1081
1793
  } & Record<string, any>;
1082
1794
  declare class JBondClient {
1083
- readonly provider: AnchorProvider;
1795
+ readonly provider: Provider;
1084
1796
  readonly options: ClientOptions;
1085
1797
  readonly program: Program<Jbond>;
1086
- constructor(provider: AnchorProvider, options?: ClientOptions);
1798
+ readonly history: HistoryManager;
1799
+ constructor(provider: Provider, options?: ClientOptions);
1087
1800
  /**
1088
1801
  * Creates an instance of `JBondClient` using a provided connection and wallet.
1089
1802
  */
@@ -1095,7 +1808,7 @@ declare class JBondClient {
1095
1808
  /**
1096
1809
  * Get the current program ID.
1097
1810
  */
1098
- get programId(): PublicKey;
1811
+ get programId(): any;
1099
1812
  /**
1100
1813
  * Get the current connection.
1101
1814
  */
@@ -1108,109 +1821,211 @@ declare class JBondClient {
1108
1821
  * Configure a specific option.
1109
1822
  */
1110
1823
  configureEnv<K extends keyof ClientOptions>(key: K, val: ClientOptions[K]): this;
1824
+ private getBondTypeSeed;
1111
1825
  /**
1112
1826
  * Program Derived Addresses (PDAs)
1113
1827
  */
1114
1828
  pda: {
1115
1829
  globalState: () => [PublicKey, number];
1116
- validatorBond: (vote: PublicKeyInitData) => [PublicKey, number];
1830
+ bondState: (bondType: BondType, bondName: string) => [PublicKey, number];
1831
+ validatorBond: (bondType: BondType, bondName: string, vote: PublicKeyInitData) => [PublicKey, number];
1117
1832
  };
1833
+ globalInitialize(props: GlobalInitializeProps): Promise<string | undefined>;
1118
1834
  /**
1119
1835
  * Initialize the program
1120
1836
  * Default authority is the provider's wallet
1121
1837
  */
1122
- initialize(props: InitializeProps): Promise<string>;
1838
+ bondInitialize(props: BondInitializeProps): Promise<string | undefined>;
1123
1839
  /**
1124
1840
  * Register a new validator
1125
1841
  * Default creator is the provider's wallet
1126
1842
  */
1127
- registerValidator(props: RegisterValidatorProps): Promise<string>;
1843
+ registerValidator(props: RegisterValidatorProps): Promise<string | undefined>;
1128
1844
  /**
1129
1845
  * Top up collateral
1130
1846
  * Default payer is the provider's wallet
1131
1847
  */
1132
- topUpCollateral(props: TopUpCollateralProps): Promise<string>;
1848
+ topUpCollateral(props: TopUpCollateralProps): Promise<string | undefined>;
1133
1849
  /**
1134
1850
  * Withdraw collateral
1135
1851
  * Default withdrawal authority is the provider's wallet
1136
1852
  * Default destination is the provider's wallet
1137
1853
  * @return Transaction signature
1138
1854
  */
1139
- withdrawCollateral(props: WithdrawCollateralProps): Promise<string>;
1855
+ withdrawCollateral(props: WithdrawCollateralProps): Promise<string | undefined>;
1140
1856
  /**
1141
1857
  * Claim compensation
1142
1858
  * Default authority is the provider's wallet
1143
1859
  * @return Transaction signature
1144
1860
  */
1145
- claimCompensation(props: ClaimProps): Promise<string>;
1861
+ claimCompensation(props: ClaimProps): Promise<string | undefined>;
1862
+ /**
1863
+ * Update global configuration for the program
1864
+ * Default authority is the provider's wallet
1865
+ * Only the current authority can call this
1866
+ * @return Transaction signature
1867
+ */
1868
+ globalConfigure(props: GlobalConfigureProps): Promise<string | undefined>;
1146
1869
  /**
1147
1870
  * Update global configuration for the program
1148
1871
  * Default authority is the provider's wallet
1149
1872
  * Only the current authority can call this
1150
1873
  * @return Transaction signature
1151
1874
  */
1152
- configure(props: ConfigureProps): Promise<string>;
1875
+ bondConfigure(props: BondConfigureProps): Promise<string | undefined>;
1153
1876
  /**
1154
1877
  * Set withdrawal authority for validator bond
1155
1878
  * Only the validator identity can call this
1156
1879
  * Default identity is the provider's wallet
1157
1880
  * @return Transaction signature
1158
1881
  */
1159
- setWithdrawAuthority(props: SetWithdrawAuthorityProps): Promise<string>;
1882
+ setWithdrawAuthority(props: SetWithdrawAuthorityProps): Promise<string | undefined>;
1883
+ bondStart(props: {
1884
+ bondType: BondType;
1885
+ name: string;
1886
+ duration_secs: number;
1887
+ }): Promise<string | undefined>;
1888
+ bondFinish(props: {
1889
+ bondType: BondType;
1890
+ name: string;
1891
+ }): Promise<string | undefined>;
1892
+ buildBondGlobalStateInitializeIx(props: GlobalInitializeProps): Promise<TransactionInstruction>;
1160
1893
  /**
1161
- * Build initialize instruction
1894
+ * Build configure instruction
1162
1895
  */
1163
- buildInitializeInstruction(props: InitializeProps): Promise<_solana_web3_js.TransactionInstruction>;
1896
+ buildGlobalConfigureInstruction(props: GlobalConfigureProps): Promise<TransactionInstruction>;
1164
1897
  /**
1165
- * Build register validator instruction
1898
+ * Build initialize instruction
1166
1899
  */
1167
- buildRegisterValidatorInstruction(props: RegisterValidatorProps): Promise<_solana_web3_js.TransactionInstruction>;
1900
+ buildBondInitializeIx(props: BondInitializeProps): Promise<TransactionInstruction>;
1901
+ buildConfigureIx(props: BondConfigureProps): Promise<TransactionInstruction>;
1902
+ buildRegisterIx(props: RegisterValidatorProps): Promise<TransactionInstruction>;
1903
+ buildTopUpIXs(props: TopUpCollateralProps): Promise<TransactionInstruction[]>;
1904
+ buildWithdrawIx(props: WithdrawCollateralProps): Promise<TransactionInstruction>;
1905
+ buildClaimIx(props: ClaimProps): Promise<TransactionInstruction>;
1906
+ buildSetWithdrawAuthorityIx(props: SetWithdrawAuthorityProps): Promise<TransactionInstruction>;
1907
+ buildBondFinishIx(props: {
1908
+ bondType: BondType;
1909
+ name: string;
1910
+ }): Promise<TransactionInstruction>;
1911
+ migrateBond(props: {
1912
+ bondType: BondType;
1913
+ name: string;
1914
+ voteAccount: PublicKeyInitData;
1915
+ }): Promise<string | undefined>;
1916
+ buildBondMigrateIx(props: {
1917
+ bondType: BondType;
1918
+ name: string;
1919
+ voteAccount: PublicKeyInitData;
1920
+ }): Promise<TransactionInstruction>;
1921
+ buildBondStartIx(props: {
1922
+ bondType: BondType;
1923
+ name: string;
1924
+ duration_secs: number;
1925
+ }): Promise<TransactionInstruction>;
1168
1926
  /**
1169
- * Build top up collateral instruction
1927
+ * Fetch global state or throw if not found
1170
1928
  */
1171
- buildTopUpCollateralInstruction(props: TopUpCollateralProps): Promise<_solana_web3_js.TransactionInstruction>;
1929
+ getGlobalState(): Promise<GlobalState>;
1172
1930
  /**
1173
- * Build withdraw collateral instruction
1931
+ * Fetch bond state with stats
1932
+ * @param bondType - Type of the bond
1933
+ * @param bondName - Name of the bond
1934
+ * @param withStats
1174
1935
  */
1175
- buildWithdrawCollateralInstruction(props: WithdrawCollateralProps): Promise<_solana_web3_js.TransactionInstruction>;
1936
+ getBondState(bondType: BondType, bondName: string, withStats?: boolean): Promise<{
1937
+ bondState: BondState;
1938
+ stateStats: BondStateStats | null;
1939
+ }>;
1176
1940
  /**
1177
- * Build claim compensation instruction
1941
+ * Get all bond states with total collected collateral
1178
1942
  */
1179
- buildClaimInstruction(props: ClaimProps): Promise<_solana_web3_js.TransactionInstruction>;
1943
+ getAllBondStates(bondType: BondType, sessionStatus?: SessionStatus): Promise<{
1944
+ publicKey: PublicKey;
1945
+ bondState: {
1946
+ name: string;
1947
+ bondType: ({
1948
+ crowdfunding?: undefined;
1949
+ } & {
1950
+ standard: Record<string, never>;
1951
+ }) | ({
1952
+ standard?: undefined;
1953
+ } & {
1954
+ crowdfunding: Record<string, never>;
1955
+ });
1956
+ collateralType: ({
1957
+ native?: undefined;
1958
+ token?: undefined;
1959
+ } & {
1960
+ stakeAccount: Record<string, never>;
1961
+ }) | ({
1962
+ stakeAccount?: undefined;
1963
+ token?: undefined;
1964
+ } & {
1965
+ native: Record<string, never>;
1966
+ }) | ({
1967
+ stakeAccount?: undefined;
1968
+ native?: undefined;
1969
+ } & {
1970
+ token: {
1971
+ 0: PublicKey;
1972
+ };
1973
+ });
1974
+ reserve: PublicKey;
1975
+ authority: PublicKey;
1976
+ sessionId: number;
1977
+ totalMembers: number;
1978
+ totalCompensationAmount: bn_js;
1979
+ sessionStartTs: bn_js;
1980
+ sessionFinishTs: bn_js;
1981
+ status: ({
1982
+ disabled?: undefined;
1983
+ } & {
1984
+ active: Record<string, never>;
1985
+ }) | ({
1986
+ active?: undefined;
1987
+ } & {
1988
+ disabled: Record<string, never>;
1989
+ });
1990
+ bump: number;
1991
+ };
1992
+ stateStats: {
1993
+ totalCollected: number;
1994
+ status: SessionStatus;
1995
+ };
1996
+ }[]>;
1180
1997
  /**
1181
- * Build configure instruction
1998
+ * Get session status for bond state
1182
1999
  */
1183
- buildConfigureInstruction(props: ConfigureProps): Promise<_solana_web3_js.TransactionInstruction>;
2000
+ private getBondStateSessionStatus;
1184
2001
  /**
1185
- * Build set withdraw authority instruction
2002
+ * Get all validator bonds for a given bond state
1186
2003
  */
1187
- buildSetWithdrawAuthorityInstruction(props: SetWithdrawAuthorityProps): Promise<_solana_web3_js.TransactionInstruction>;
2004
+ private getValidatorBondsByState;
1188
2005
  /**
1189
- * Fetch global state or throw if not found
2006
+ * Fetch validator bond data or null if not found
1190
2007
  */
1191
- getGlobalState(): Promise<GlobalState>;
2008
+ getValidatorBond(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<ValidatorBond | null>;
1192
2009
  /**
1193
- * Fetch validator bond data or null if not found
1194
- * @param vote
2010
+ * Get bond collateral type
1195
2011
  */
1196
- getValidatorBond(vote: PublicKeyInitData): Promise<ValidatorBond | null>;
2012
+ getBondCollateralType(bondType: BondType, bondName: string): Promise<CollateralType>;
1197
2013
  /**
1198
2014
  * Get validator bond account balance (in SOL)
2015
+ * @param bondType - Type of the bond
2016
+ * @param bondName - Name of the bond
1199
2017
  * @param vote - Vote account public key
1200
- * @return Balance in SOL
2018
+ * @return Balance in lamports
1201
2019
  */
1202
- getValidatorBondBalance(vote: PublicKeyInitData): Promise<number>;
2020
+ getValidatorBondBalance(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<number>;
1203
2021
  /**
1204
- * Get transaction history grouped by epochs
1205
- * @param vote - The vote account to get history for
1206
- * @param epochsCount - Number of recent epochs to return (default: 10)
1207
- * @returns Array of epoch history items sorted by epoch (descending)
2022
+ * Get total collected collateral for a bond state
1208
2023
  */
1209
- getHistoryGroupedByEpochs(vote: PublicKeyInitData, epochsCount?: number): Promise<EpochHistoryItem[]>;
2024
+ getBondStateTotalCollected(bondType: BondType, bondName: string, votes: PublicKeyInitData[]): Promise<number>;
1210
2025
  /**
1211
2026
  * Get transaction history for a specific validator bond account
1212
2027
  */
1213
- getHistory(vote: PublicKey, options?: {
2028
+ getHistory(bondType: BondType, bondName: string, vote: PublicKey, options?: {
1214
2029
  cluster?: 'mainnet-beta' | 'testnet' | 'devnet';
1215
2030
  limit?: number;
1216
2031
  before?: string;
@@ -1218,21 +2033,42 @@ declare class JBondClient {
1218
2033
  }): Promise<TransactionHistoryItem[]>;
1219
2034
  /**
1220
2035
  * Get full transaction history by paginating through results
2036
+ * @param bondType
2037
+ * @param bondName
1221
2038
  * @param voteAccount
1222
2039
  * @param pageSize
1223
2040
  */
1224
- getFullHistory(voteAccount: PublicKey, pageSize?: number): Promise<TransactionHistoryItem[]>;
2041
+ getFullHistory(bondType: BondType, bondName: string, voteAccount: PublicKey, pageSize?: number): Promise<TransactionHistoryItem[]>;
1225
2042
  /**
1226
2043
  * Get instruction discriminator from IDL
1227
2044
  * @param instructionName
1228
2045
  * @private
1229
2046
  */
1230
2047
  private getInstructionDiscriminator;
2048
+ /**
2049
+ * Get bond state stats
2050
+ * @param state
2051
+ * @private
2052
+ */
2053
+ private getBondStateStats;
2054
+ /**
2055
+ * Load stake pool account and cache it if not already cached
2056
+ * @private
2057
+ */
2058
+ private loadStakePoolAccount;
2059
+ /**
2060
+ * Manages the interaction with a stake pool, allowing deposits and withdrawals of SOL.
2061
+ */
2062
+ stakePoolManager(props?: {
2063
+ user?: PublicKey;
2064
+ }): Promise<StakePoolManager>;
2065
+ /**
2066
+ * Ensures that a valid user is provided. If a user is not explicitly passed
2067
+ * in the properties, it defaults to the provider's public key.
2068
+ * Throws an error if no user is available.
2069
+ */
2070
+ private ensureUser;
2071
+ private lamports;
1231
2072
  }
1232
2073
 
1233
- /**
1234
- * Program IDs for different environments
1235
- */
1236
- declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
1237
-
1238
- 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, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, type ValidatorBond, type WithdrawCollateralProps };
2074
+ export { BondClientEnv, type BondCollateral, type BondConfigureProps, type BondInitializeProps, type BondState, type BondStateStats, type BondStateStatus, BondStateStatusVariant, 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 };