@jpool/bond-sdk 0.11.8 → 0.11.9

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,8 +1,8 @@
1
1
  import * as bn_js from 'bn.js';
2
2
  import * as _coral_xyz_anchor from '@coral-xyz/anchor';
3
- import { IdlTypes, IdlAccounts, Provider, Program } from '@coral-xyz/anchor';
3
+ import { IdlTypes, IdlAccounts, BN, Provider, Program } from '@coral-xyz/anchor';
4
4
  import * as _solana_web3_js from '@solana/web3.js';
5
- import { PublicKey, PublicKeyInitData, Cluster, Transaction, VersionedTransaction, Keypair, Connection, TransactionInstruction } from '@solana/web3.js';
5
+ import { PublicKey, PublicKeyInitData, Cluster, Transaction, VersionedTransaction, Keypair, Connection, TransactionInstruction, Signer } from '@solana/web3.js';
6
6
 
7
7
  /**
8
8
  * Program IDL in camelCase format in order to be used in JS/TS.
@@ -11,28 +11,28 @@ import { PublicKey, PublicKeyInitData, Cluster, Transaction, VersionedTransactio
11
11
  * IDL can be found at `target/idl/jbond.json`.
12
12
  */
13
13
  type Jbond = {
14
- address: 'BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU';
15
- metadata: {
16
- name: 'jbond';
17
- version: '0.2.1';
18
- spec: '0.1.0';
19
- description: 'Jpool Bond Program';
14
+ "address": "BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU";
15
+ "metadata": {
16
+ "name": "jbond";
17
+ "version": "0.2.6";
18
+ "spec": "0.1.0";
19
+ "description": "Jpool Bond Program";
20
20
  };
21
- instructions: [
22
- {
23
- name: 'bondClaim';
24
- docs: [
25
- 'Claims compensation for a validator.',
26
- 'Transfers funds from the validator\'s bond account to reserve.',
27
- '',
28
- '# Arguments',
29
- '* `amount` - Amount of compensation to claim (must be positive).',
30
- '',
31
- '# Errors',
32
- 'Fails if the authority is invalid, if the validator is not active,',
33
- 'if the amount is zero, or if there are insufficient funds.'
34
- ];
35
- discriminator: [
21
+ "instructions": [
22
+ {
23
+ "name": "bondClaim";
24
+ "docs": [
25
+ "Claims compensation for a validator.",
26
+ "Transfers funds from the validator's bond account to reserve.",
27
+ "",
28
+ "# Arguments",
29
+ "* `amount` - Amount of compensation to claim (must be positive).",
30
+ "",
31
+ "# Errors",
32
+ "Fails if the authority is invalid, if the validator is not active,",
33
+ "if the amount is zero, or if there are insufficient funds."
34
+ ];
35
+ "discriminator": [
36
36
  151,
37
37
  92,
38
38
  10,
@@ -42,19 +42,19 @@ type Jbond = {
42
42
  188,
43
43
  129
44
44
  ];
45
- accounts: [
45
+ "accounts": [
46
46
  {
47
- name: 'bondState';
48
- writable: true;
47
+ "name": "bondState";
48
+ "writable": true;
49
49
  },
50
50
  {
51
- name: 'validatorBond';
52
- writable: true;
53
- pda: {
54
- seeds: [
51
+ "name": "validatorBond";
52
+ "writable": true;
53
+ "pda": {
54
+ "seeds": [
55
55
  {
56
- kind: 'const';
57
- value: [
56
+ "kind": "const";
57
+ "value": [
58
58
  118,
59
59
  97,
60
60
  108,
@@ -72,68 +72,71 @@ type Jbond = {
72
72
  ];
73
73
  },
74
74
  {
75
- kind: 'account';
76
- path: 'bondState';
75
+ "kind": "account";
76
+ "path": "bondState";
77
77
  },
78
78
  {
79
- kind: 'account';
80
- path: 'validator_bond.vote_account';
81
- account: 'validatorBond';
79
+ "kind": "account";
80
+ "path": "validator_bond.vote_account";
81
+ "account": "validatorBond";
82
82
  }
83
83
  ];
84
84
  };
85
85
  },
86
86
  {
87
- name: 'reserve';
88
- writable: true;
87
+ "name": "reserve";
88
+ "writable": true;
89
89
  },
90
90
  {
91
- name: 'authority';
92
- signer: true;
91
+ "name": "authority";
92
+ "signer": true;
93
+ "relations": [
94
+ "bondState"
95
+ ];
93
96
  },
94
97
  {
95
- name: 'bondTokenAccount';
96
- writable: true;
97
- optional: true;
98
+ "name": "bondTokenAccount";
99
+ "writable": true;
100
+ "optional": true;
98
101
  },
99
102
  {
100
- name: 'reserveTokenAccount';
101
- writable: true;
102
- optional: true;
103
+ "name": "reserveTokenAccount";
104
+ "writable": true;
105
+ "optional": true;
103
106
  },
104
107
  {
105
- name: 'stakeAccount';
106
- writable: true;
107
- optional: true;
108
+ "name": "stakeAccount";
109
+ "writable": true;
110
+ "optional": true;
108
111
  },
109
112
  {
110
- name: 'systemProgram';
111
- address: '11111111111111111111111111111111';
113
+ "name": "systemProgram";
114
+ "address": "11111111111111111111111111111111";
112
115
  },
113
116
  {
114
- name: 'tokenProgram';
115
- optional: true;
116
- address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
117
+ "name": "tokenProgram";
118
+ "optional": true;
119
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
117
120
  },
118
121
  {
119
- name: 'stakeProgram';
120
- optional: true;
122
+ "name": "stakeProgram";
123
+ "optional": true;
121
124
  }
122
125
  ];
123
- args: [
126
+ "args": [
124
127
  {
125
- name: 'amount';
126
- type: 'u64';
128
+ "name": "amount";
129
+ "type": "u64";
127
130
  }
128
131
  ];
129
132
  },
130
133
  {
131
- name: 'bondConfigure';
132
- docs: [
133
- 'Updates bond configuration, including authority and reserve fields.',
134
- 'Allows changing the bond\'s authority and updating the reserve account.'
134
+ "name": "bondConfigure";
135
+ "docs": [
136
+ "Updates bond configuration, including authority and reserve fields.",
137
+ "Allows changing the bond's authority and updating the reserve account."
135
138
  ];
136
- discriminator: [
139
+ "discriminator": [
137
140
  61,
138
141
  42,
139
142
  106,
@@ -143,41 +146,41 @@ type Jbond = {
143
146
  65,
144
147
  20
145
148
  ];
146
- accounts: [
149
+ "accounts": [
147
150
  {
148
- name: 'bondState';
149
- writable: true;
151
+ "name": "bondState";
152
+ "writable": true;
150
153
  },
151
154
  {
152
- name: 'authority';
153
- signer: true;
154
- relations: [
155
- 'bondState'
155
+ "name": "authority";
156
+ "signer": true;
157
+ "relations": [
158
+ "bondState"
156
159
  ];
157
160
  }
158
161
  ];
159
- args: [
162
+ "args": [
160
163
  {
161
- name: 'data';
162
- type: {
163
- defined: {
164
- name: 'bondConfigureData';
164
+ "name": "data";
165
+ "type": {
166
+ "defined": {
167
+ "name": "bondConfigureData";
165
168
  };
166
169
  };
167
170
  }
168
171
  ];
169
172
  },
170
173
  {
171
- name: 'bondInitialize';
172
- docs: [
173
- 'Initializes state for the bond.',
174
- 'Sets the authority and reserve account for managing validator bonds.',
175
- '',
176
- '# Errors',
177
- 'Fails if the global state account is already initialized or if the payer lacks',
178
- 'sufficient funds.'
174
+ "name": "bondInitialize";
175
+ "docs": [
176
+ "Initializes state for the bond.",
177
+ "Sets the authority and reserve account for managing validator bonds.",
178
+ "",
179
+ "# Errors",
180
+ "Fails if the global state account is already initialized or if the payer lacks",
181
+ "sufficient funds."
179
182
  ];
180
- discriminator: [
183
+ "discriminator": [
181
184
  230,
182
185
  3,
183
186
  121,
@@ -187,15 +190,15 @@ type Jbond = {
187
190
  175,
188
191
  210
189
192
  ];
190
- accounts: [
193
+ "accounts": [
191
194
  {
192
- name: 'bondState';
193
- writable: true;
194
- pda: {
195
- seeds: [
195
+ "name": "bondState";
196
+ "writable": true;
197
+ "pda": {
198
+ "seeds": [
196
199
  {
197
- kind: 'const';
198
- value: [
200
+ "kind": "const";
201
+ "value": [
199
202
  98,
200
203
  111,
201
204
  110,
@@ -209,72 +212,150 @@ type Jbond = {
209
212
  ];
210
213
  },
211
214
  {
212
- kind: 'arg';
213
- path: 'data.bond_type';
215
+ "kind": "arg";
216
+ "path": "data.bond_type";
214
217
  },
215
218
  {
216
- kind: 'arg';
217
- path: 'data.name';
219
+ "kind": "arg";
220
+ "path": "data.name";
218
221
  }
219
222
  ];
220
223
  };
221
224
  },
222
225
  {
223
- name: 'authority';
224
- writable: true;
225
- signer: true;
226
+ "name": "authority";
227
+ "writable": true;
228
+ "signer": true;
226
229
  },
227
230
  {
228
- name: 'reserve';
231
+ "name": "reserve";
229
232
  },
230
233
  {
231
- name: 'associatedTokenProgram';
232
- address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
234
+ "name": "associatedTokenProgram";
235
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
233
236
  },
234
237
  {
235
- name: 'systemProgram';
236
- address: '11111111111111111111111111111111';
238
+ "name": "systemProgram";
239
+ "address": "11111111111111111111111111111111";
237
240
  },
238
241
  {
239
- name: 'tokenProgram';
240
- address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
242
+ "name": "tokenProgram";
243
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
241
244
  },
242
245
  {
243
- name: 'reserveTokenAccount';
244
- writable: true;
245
- optional: true;
246
+ "name": "reserveTokenAccount";
247
+ "writable": true;
248
+ "optional": true;
246
249
  },
247
250
  {
248
- name: 'mint';
249
- optional: true;
251
+ "name": "mint";
252
+ "optional": true;
250
253
  }
251
254
  ];
252
- args: [
255
+ "args": [
253
256
  {
254
- name: 'data';
255
- type: {
256
- defined: {
257
- name: 'bondInitializeData';
257
+ "name": "data";
258
+ "type": {
259
+ "defined": {
260
+ "name": "bondInitializeData";
258
261
  };
259
262
  };
260
263
  }
261
264
  ];
262
265
  },
263
266
  {
264
- name: 'bondRegister';
265
- docs: [
266
- 'Registers a new validator with the bond.',
267
- 'Sets up the validator\'s bond account and deposits initial collateral.',
268
- '',
269
- '# Arguments',
270
- '* `initial_collateral` - Amount of collateral to lock (must be positive).',
271
- '* `withdrawal_authority` - Optional key that can withdraw collateral later.',
272
- '',
273
- '# Errors',
274
- 'Fails if the validator is already registered, if the vote account is invalid,',
275
- 'or if the initial collateral transfer fails.'
267
+ "name": "bondLockFunds";
268
+ "docs": [
269
+ "Locks funds immediately, making them unavailable for withdrawal.",
270
+ "The locked amount takes effect immediately in the current epoch.",
271
+ "",
272
+ "# Errors",
273
+ "Fails if the bond type is not lockable, if the amount is zero,",
274
+ "or if there are insufficient available funds."
275
+ ];
276
+ "discriminator": [
277
+ 117,
278
+ 166,
279
+ 195,
280
+ 99,
281
+ 103,
282
+ 45,
283
+ 195,
284
+ 2
285
+ ];
286
+ "accounts": [
287
+ {
288
+ "name": "bondState";
289
+ "writable": true;
290
+ },
291
+ {
292
+ "name": "validatorBond";
293
+ "writable": true;
294
+ "pda": {
295
+ "seeds": [
296
+ {
297
+ "kind": "const";
298
+ "value": [
299
+ 118,
300
+ 97,
301
+ 108,
302
+ 105,
303
+ 100,
304
+ 97,
305
+ 116,
306
+ 111,
307
+ 114,
308
+ 95,
309
+ 98,
310
+ 111,
311
+ 110,
312
+ 100
313
+ ];
314
+ },
315
+ {
316
+ "kind": "account";
317
+ "path": "bondState";
318
+ },
319
+ {
320
+ "kind": "account";
321
+ "path": "validator_bond.vote_account";
322
+ "account": "validatorBond";
323
+ }
324
+ ];
325
+ };
326
+ },
327
+ {
328
+ "name": "bondTokenAccount";
329
+ "optional": true;
330
+ },
331
+ {
332
+ "name": "payer";
333
+ "writable": true;
334
+ "signer": true;
335
+ }
336
+ ];
337
+ "args": [
338
+ {
339
+ "name": "amount";
340
+ "type": "u64";
341
+ }
342
+ ];
343
+ },
344
+ {
345
+ "name": "bondRegister";
346
+ "docs": [
347
+ "Registers a new validator with the bond.",
348
+ "Sets up the validator's bond account and deposits initial collateral.",
349
+ "",
350
+ "# Arguments",
351
+ "* `initial_collateral` - Amount of collateral to lock (must be positive).",
352
+ "* `withdrawal_authority` - Optional key that can withdraw collateral later.",
353
+ "",
354
+ "# Errors",
355
+ "Fails if the validator is already registered, if the vote account is invalid,",
356
+ "or if the initial collateral transfer fails."
276
357
  ];
277
- discriminator: [
358
+ "discriminator": [
278
359
  117,
279
360
  127,
280
361
  78,
@@ -284,19 +365,46 @@ type Jbond = {
284
365
  163,
285
366
  83
286
367
  ];
287
- accounts: [
368
+ "accounts": [
288
369
  {
289
- name: 'bondState';
290
- writable: true;
370
+ "name": "bondState";
371
+ "writable": true;
372
+ "pda": {
373
+ "seeds": [
374
+ {
375
+ "kind": "const";
376
+ "value": [
377
+ 98,
378
+ 111,
379
+ 110,
380
+ 100,
381
+ 95,
382
+ 115,
383
+ 116,
384
+ 97,
385
+ 116,
386
+ 101
387
+ ];
388
+ },
389
+ {
390
+ "kind": "arg";
391
+ "path": "bondType";
392
+ },
393
+ {
394
+ "kind": "arg";
395
+ "path": "bondName";
396
+ }
397
+ ];
398
+ };
291
399
  },
292
400
  {
293
- name: 'validatorBond';
294
- writable: true;
295
- pda: {
296
- seeds: [
401
+ "name": "validatorBond";
402
+ "writable": true;
403
+ "pda": {
404
+ "seeds": [
297
405
  {
298
- kind: 'const';
299
- value: [
406
+ "kind": "const";
407
+ "value": [
300
408
  118,
301
409
  97,
302
410
  108,
@@ -314,78 +422,184 @@ type Jbond = {
314
422
  ];
315
423
  },
316
424
  {
317
- kind: 'account';
318
- path: 'bondState';
425
+ "kind": "account";
426
+ "path": "bondState";
319
427
  },
320
428
  {
321
- kind: 'account';
322
- path: 'voteAccount';
429
+ "kind": "account";
430
+ "path": "voteAccount";
323
431
  }
324
432
  ];
325
433
  };
326
434
  },
327
435
  {
328
- name: 'identity';
436
+ "name": "identity";
329
437
  },
330
438
  {
331
- name: 'voteAccount';
439
+ "name": "voteAccount";
332
440
  },
333
441
  {
334
- name: 'creator';
335
- writable: true;
336
- signer: true;
442
+ "name": "creator";
443
+ "writable": true;
444
+ "signer": true;
337
445
  },
338
446
  {
339
- name: 'systemProgram';
340
- address: '11111111111111111111111111111111';
447
+ "name": "systemProgram";
448
+ "address": "11111111111111111111111111111111";
341
449
  },
342
450
  {
343
- name: 'tokenProgram';
344
- address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
451
+ "name": "tokenProgram";
452
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
345
453
  },
346
454
  {
347
- name: 'associatedTokenProgram';
348
- address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
455
+ "name": "associatedTokenProgram";
456
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
349
457
  },
350
458
  {
351
- name: 'bondTokenAccount';
352
- writable: true;
353
- optional: true;
459
+ "name": "bondTokenAccount";
460
+ "writable": true;
461
+ "optional": true;
354
462
  },
355
463
  {
356
- name: 'mint';
357
- optional: true;
464
+ "name": "mint";
465
+ "optional": true;
358
466
  }
359
467
  ];
360
- args: [
468
+ "args": [
361
469
  {
362
- name: 'bondType';
363
- type: {
364
- defined: {
365
- name: 'bondType';
470
+ "name": "bondType";
471
+ "type": {
472
+ "defined": {
473
+ "name": "bondType";
366
474
  };
367
475
  };
368
476
  },
369
477
  {
370
- name: 'bondName';
371
- type: 'string';
478
+ "name": "bondName";
479
+ "type": "string";
372
480
  }
373
481
  ];
374
482
  },
375
483
  {
376
- name: 'bondSetWithdrawAuthority';
377
- docs: [
378
- 'Sets a new withdrawal authority for a validator\'s bond account.',
379
- 'Allows changing who can withdraw collateral in the future.',
380
- '',
381
- '# Arguments',
382
- '* `new_withdraw_authority` - Optional new withdrawal authority key (None to restrict to',
383
- 'identity).',
384
- '',
385
- '# Errors',
386
- 'Fails if the signer is not authorized to change the withdrawal authority.'
484
+ "name": "bondReleaseFunds";
485
+ "docs": [
486
+ "Queues funds for unlock in the next epoch.",
487
+ "The unlock is delayed by one epoch for security - funds remain locked",
488
+ "in the current epoch but will be available after epoch transition.",
489
+ "",
490
+ "# Errors",
491
+ "Fails if the bond type is not lockable, if the amount is zero,",
492
+ "or if the amount exceeds currently locked funds."
493
+ ];
494
+ "discriminator": [
495
+ 184,
496
+ 224,
497
+ 14,
498
+ 24,
499
+ 76,
500
+ 14,
501
+ 226,
502
+ 190
387
503
  ];
388
- discriminator: [
504
+ "accounts": [
505
+ {
506
+ "name": "bondState";
507
+ "writable": true;
508
+ },
509
+ {
510
+ "name": "validatorBond";
511
+ "writable": true;
512
+ "pda": {
513
+ "seeds": [
514
+ {
515
+ "kind": "const";
516
+ "value": [
517
+ 118,
518
+ 97,
519
+ 108,
520
+ 105,
521
+ 100,
522
+ 97,
523
+ 116,
524
+ 111,
525
+ 114,
526
+ 95,
527
+ 98,
528
+ 111,
529
+ 110,
530
+ 100
531
+ ];
532
+ },
533
+ {
534
+ "kind": "account";
535
+ "path": "bondState";
536
+ },
537
+ {
538
+ "kind": "account";
539
+ "path": "validator_bond.vote_account";
540
+ "account": "validatorBond";
541
+ }
542
+ ];
543
+ };
544
+ },
545
+ {
546
+ "name": "payer";
547
+ "writable": true;
548
+ "signer": true;
549
+ }
550
+ ];
551
+ "args": [
552
+ {
553
+ "name": "amount";
554
+ "type": "u64";
555
+ }
556
+ ];
557
+ },
558
+ {
559
+ "name": "bondRemove";
560
+ "docs": [
561
+ "Removes bond state"
562
+ ];
563
+ "discriminator": [
564
+ 121,
565
+ 112,
566
+ 246,
567
+ 177,
568
+ 181,
569
+ 8,
570
+ 18,
571
+ 220
572
+ ];
573
+ "accounts": [
574
+ {
575
+ "name": "bondState";
576
+ "writable": true;
577
+ },
578
+ {
579
+ "name": "authority";
580
+ "writable": true;
581
+ "signer": true;
582
+ "relations": [
583
+ "bondState"
584
+ ];
585
+ }
586
+ ];
587
+ "args": [];
588
+ },
589
+ {
590
+ "name": "bondSetWithdrawAuthority";
591
+ "docs": [
592
+ "Sets a new withdrawal authority for a validator's bond account.",
593
+ "Allows changing who can withdraw collateral in the future.",
594
+ "",
595
+ "# Arguments",
596
+ "* `new_withdraw_authority` - Optional new withdrawal authority key (None to restrict to",
597
+ "identity).",
598
+ "",
599
+ "# Errors",
600
+ "Fails if the signer is not authorized to change the withdrawal authority."
601
+ ];
602
+ "discriminator": [
389
603
  212,
390
604
  162,
391
605
  53,
@@ -395,18 +609,18 @@ type Jbond = {
395
609
  61,
396
610
  166
397
611
  ];
398
- accounts: [
612
+ "accounts": [
399
613
  {
400
- name: 'bondState';
614
+ "name": "bondState";
401
615
  },
402
616
  {
403
- name: 'validatorBond';
404
- writable: true;
405
- pda: {
406
- seeds: [
617
+ "name": "validatorBond";
618
+ "writable": true;
619
+ "pda": {
620
+ "seeds": [
407
621
  {
408
- kind: 'const';
409
- value: [
622
+ "kind": "const";
623
+ "value": [
410
624
  118,
411
625
  97,
412
626
  108,
@@ -424,42 +638,42 @@ type Jbond = {
424
638
  ];
425
639
  },
426
640
  {
427
- kind: 'account';
428
- path: 'bondState';
641
+ "kind": "account";
642
+ "path": "bondState";
429
643
  },
430
644
  {
431
- kind: 'account';
432
- path: 'validator_bond.vote_account';
433
- account: 'validatorBond';
645
+ "kind": "account";
646
+ "path": "validator_bond.vote_account";
647
+ "account": "validatorBond";
434
648
  }
435
649
  ];
436
650
  };
437
651
  },
438
652
  {
439
- name: 'identity';
440
- signer: true;
653
+ "name": "identity";
654
+ "signer": true;
441
655
  },
442
656
  {
443
- name: 'newWithdrawAuthority';
444
- optional: true;
657
+ "name": "newWithdrawAuthority";
658
+ "optional": true;
445
659
  }
446
660
  ];
447
- args: [];
661
+ "args": [];
448
662
  },
449
663
  {
450
- name: 'bondTopUp';
451
- docs: [
452
- 'Adds additional collateral to an existing validator\'s bond.',
453
- 'Increases the collateral balance, enhancing the validator\'s stake.',
454
- '',
455
- '# Arguments',
456
- '* `amount` - Amount to add.',
457
- '',
458
- '# Errors',
459
- 'Fails if the validator is not active, if the amount is zero,',
460
- 'or if the transfer of funds fails.'
664
+ "name": "bondTopUp";
665
+ "docs": [
666
+ "Adds additional collateral to an existing validator's bond.",
667
+ "Increases the collateral balance, enhancing the validator's stake.",
668
+ "",
669
+ "# Arguments",
670
+ "* `amount` - Amount to add.",
671
+ "",
672
+ "# Errors",
673
+ "Fails if the validator is not active, if the amount is zero,",
674
+ "or if the transfer of funds fails."
461
675
  ];
462
- discriminator: [
676
+ "discriminator": [
463
677
  132,
464
678
  225,
465
679
  254,
@@ -469,19 +683,19 @@ type Jbond = {
469
683
  176,
470
684
  66
471
685
  ];
472
- accounts: [
686
+ "accounts": [
473
687
  {
474
- name: 'bondState';
475
- writable: true;
688
+ "name": "bondState";
689
+ "writable": true;
476
690
  },
477
691
  {
478
- name: 'validatorBond';
479
- writable: true;
480
- pda: {
481
- seeds: [
692
+ "name": "validatorBond";
693
+ "writable": true;
694
+ "pda": {
695
+ "seeds": [
482
696
  {
483
- kind: 'const';
484
- value: [
697
+ "kind": "const";
698
+ "value": [
485
699
  118,
486
700
  97,
487
701
  108,
@@ -499,73 +713,73 @@ type Jbond = {
499
713
  ];
500
714
  },
501
715
  {
502
- kind: 'account';
503
- path: 'bondState';
716
+ "kind": "account";
717
+ "path": "bondState";
504
718
  },
505
719
  {
506
- kind: 'account';
507
- path: 'validator_bond.vote_account';
508
- account: 'validatorBond';
720
+ "kind": "account";
721
+ "path": "validator_bond.vote_account";
722
+ "account": "validatorBond";
509
723
  }
510
724
  ];
511
725
  };
512
726
  },
513
727
  {
514
- name: 'payer';
515
- writable: true;
516
- signer: true;
728
+ "name": "payer";
729
+ "writable": true;
730
+ "signer": true;
517
731
  },
518
732
  {
519
- name: 'payerTokenAccount';
520
- writable: true;
521
- optional: true;
733
+ "name": "payerTokenAccount";
734
+ "writable": true;
735
+ "optional": true;
522
736
  },
523
737
  {
524
- name: 'bondTokenAccount';
525
- writable: true;
526
- optional: true;
738
+ "name": "bondTokenAccount";
739
+ "writable": true;
740
+ "optional": true;
527
741
  },
528
742
  {
529
- name: 'stakeAccount';
530
- writable: true;
531
- optional: true;
743
+ "name": "stakeAccount";
744
+ "writable": true;
745
+ "optional": true;
532
746
  },
533
747
  {
534
- name: 'systemProgram';
535
- address: '11111111111111111111111111111111';
748
+ "name": "systemProgram";
749
+ "address": "11111111111111111111111111111111";
536
750
  },
537
751
  {
538
- name: 'tokenProgram';
539
- optional: true;
540
- address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
752
+ "name": "tokenProgram";
753
+ "optional": true;
754
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
541
755
  },
542
756
  {
543
- name: 'stakeProgram';
544
- optional: true;
757
+ "name": "stakeProgram";
758
+ "optional": true;
545
759
  }
546
760
  ];
547
- args: [
761
+ "args": [
548
762
  {
549
- name: 'amount';
550
- type: 'u64';
763
+ "name": "amount";
764
+ "type": "u64";
551
765
  }
552
766
  ];
553
767
  },
554
768
  {
555
- name: 'bondWithdraw';
556
- docs: [
557
- 'Withdraws collateral from a validator\'s bond.',
558
- 'Decreases the collateral balance, allowing the validator to reclaim funds.',
559
- '',
560
- '# Arguments',
561
- '* `amount` - Amount to withdraw (must not exceed available balance).',
562
- '',
563
- '# Errors',
564
- 'Fails if the validator is not active, if the amount is zero,',
565
- 'if the withdrawal authority is invalid, or if the withdrawal would',
566
- 'leave insufficient collateral.'
769
+ "name": "bondWithdraw";
770
+ "docs": [
771
+ "Withdraws collateral from a validator's bond.",
772
+ "Decreases the collateral balance, allowing the validator to reclaim funds.",
773
+ "",
774
+ "# Arguments",
775
+ "* `amount` - Amount to withdraw (must not exceed available balance).",
776
+ "",
777
+ "# Errors",
778
+ "Fails if the validator is not active, if the amount is zero,",
779
+ "if the withdrawal authority is invalid, or if the withdrawal would",
780
+ "leave insufficient collateral."
567
781
  ];
568
- discriminator: [
782
+ "discriminator": [
569
783
  99,
570
784
  64,
571
785
  127,
@@ -575,19 +789,19 @@ type Jbond = {
575
789
  70,
576
790
  204
577
791
  ];
578
- accounts: [
792
+ "accounts": [
579
793
  {
580
- name: 'bondState';
581
- writable: true;
794
+ "name": "bondState";
795
+ "writable": true;
582
796
  },
583
797
  {
584
- name: 'validatorBond';
585
- writable: true;
586
- pda: {
587
- seeds: [
798
+ "name": "validatorBond";
799
+ "writable": true;
800
+ "pda": {
801
+ "seeds": [
588
802
  {
589
- kind: 'const';
590
- value: [
803
+ "kind": "const";
804
+ "value": [
591
805
  118,
592
806
  97,
593
807
  108,
@@ -605,65 +819,162 @@ type Jbond = {
605
819
  ];
606
820
  },
607
821
  {
608
- kind: 'account';
609
- path: 'bondState';
822
+ "kind": "account";
823
+ "path": "bondState";
610
824
  },
611
825
  {
612
- kind: 'account';
613
- path: 'validator_bond.vote_account';
614
- account: 'validatorBond';
826
+ "kind": "account";
827
+ "path": "validator_bond.vote_account";
828
+ "account": "validatorBond";
615
829
  }
616
830
  ];
617
831
  };
618
832
  },
619
833
  {
620
- name: 'withdrawalAuthority';
621
- writable: true;
622
- signer: true;
834
+ "name": "withdrawalAuthority";
835
+ "writable": true;
836
+ "signer": true;
623
837
  },
624
838
  {
625
- name: 'destination';
626
- writable: true;
839
+ "name": "destination";
840
+ "writable": true;
627
841
  },
628
842
  {
629
- name: 'destinationTokenAccount';
630
- writable: true;
631
- optional: true;
843
+ "name": "destinationTokenAccount";
844
+ "writable": true;
845
+ "optional": true;
632
846
  },
633
847
  {
634
- name: 'bondTokenAccount';
635
- writable: true;
636
- optional: true;
848
+ "name": "bondTokenAccount";
849
+ "writable": true;
850
+ "optional": true;
637
851
  },
638
852
  {
639
- name: 'stakeAccount';
640
- writable: true;
641
- optional: true;
853
+ "name": "stakeAccount";
854
+ "writable": true;
855
+ "optional": true;
642
856
  },
643
857
  {
644
- name: 'systemProgram';
645
- address: '11111111111111111111111111111111';
858
+ "name": "systemProgram";
859
+ "address": "11111111111111111111111111111111";
646
860
  },
647
861
  {
648
- name: 'tokenProgram';
649
- optional: true;
650
- address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
862
+ "name": "tokenProgram";
863
+ "optional": true;
864
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
651
865
  },
652
866
  {
653
- name: 'stakeProgram';
654
- optional: true;
867
+ "name": "stakeProgram";
868
+ "optional": true;
655
869
  }
656
870
  ];
657
- args: [
871
+ "args": [
658
872
  {
659
- name: 'amount';
660
- type: 'u64';
873
+ "name": "amount";
874
+ "type": "u64";
661
875
  }
662
876
  ];
663
877
  },
664
878
  {
665
- name: 'globalConfigure';
666
- discriminator: [
879
+ "name": "closeValidatorBond";
880
+ "docs": [
881
+ "Closes a validator bond account and transfers remaining balance to the rent receiver.",
882
+ "",
883
+ "# Security",
884
+ "- Only the validator identity or withdrawal authority can close the bond",
885
+ "- All funds must be unlocked (locked == 0 and pending_unlock == 0)",
886
+ "- For token collateral, closes the associated token account as well",
887
+ "- Decrements the bond state's total_members counter",
888
+ "",
889
+ "# Errors",
890
+ "Fails if the signer is not authorized, if funds are still locked,",
891
+ "or if the rent receiver is not the identity or withdrawal authority."
892
+ ];
893
+ "discriminator": [
894
+ 51,
895
+ 235,
896
+ 111,
897
+ 163,
898
+ 176,
899
+ 239,
900
+ 95,
901
+ 122
902
+ ];
903
+ "accounts": [
904
+ {
905
+ "name": "bondState";
906
+ "writable": true;
907
+ },
908
+ {
909
+ "name": "validatorBond";
910
+ "writable": true;
911
+ "pda": {
912
+ "seeds": [
913
+ {
914
+ "kind": "const";
915
+ "value": [
916
+ 118,
917
+ 97,
918
+ 108,
919
+ 105,
920
+ 100,
921
+ 97,
922
+ 116,
923
+ 111,
924
+ 114,
925
+ 95,
926
+ 98,
927
+ 111,
928
+ 110,
929
+ 100
930
+ ];
931
+ },
932
+ {
933
+ "kind": "account";
934
+ "path": "bondState";
935
+ },
936
+ {
937
+ "kind": "account";
938
+ "path": "validator_bond.vote_account";
939
+ "account": "validatorBond";
940
+ }
941
+ ];
942
+ };
943
+ },
944
+ {
945
+ "name": "authority";
946
+ "writable": true;
947
+ "signer": true;
948
+ },
949
+ {
950
+ "name": "rentReceiver";
951
+ "writable": true;
952
+ },
953
+ {
954
+ "name": "bondTokenAccount";
955
+ "writable": true;
956
+ "optional": true;
957
+ },
958
+ {
959
+ "name": "destinationTokenAccount";
960
+ "writable": true;
961
+ "optional": true;
962
+ },
963
+ {
964
+ "name": "systemProgram";
965
+ "address": "11111111111111111111111111111111";
966
+ },
967
+ {
968
+ "name": "tokenProgram";
969
+ "optional": true;
970
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
971
+ }
972
+ ];
973
+ "args": [];
974
+ },
975
+ {
976
+ "name": "globalConfigure";
977
+ "discriminator": [
667
978
  67,
668
979
  142,
669
980
  164,
@@ -673,15 +984,15 @@ type Jbond = {
673
984
  144,
674
985
  187
675
986
  ];
676
- accounts: [
987
+ "accounts": [
677
988
  {
678
- name: 'globalState';
679
- writable: true;
680
- pda: {
681
- seeds: [
989
+ "name": "globalState";
990
+ "writable": true;
991
+ "pda": {
992
+ "seeds": [
682
993
  {
683
- kind: 'const';
684
- value: [
994
+ "kind": "const";
995
+ "value": [
685
996
  103,
686
997
  108,
687
998
  111,
@@ -700,27 +1011,27 @@ type Jbond = {
700
1011
  };
701
1012
  },
702
1013
  {
703
- name: 'authority';
704
- signer: true;
705
- relations: [
706
- 'globalState'
1014
+ "name": "authority";
1015
+ "signer": true;
1016
+ "relations": [
1017
+ "globalState"
707
1018
  ];
708
1019
  }
709
1020
  ];
710
- args: [
1021
+ "args": [
711
1022
  {
712
- name: 'data';
713
- type: {
714
- defined: {
715
- name: 'globalConfigureData';
1023
+ "name": "data";
1024
+ "type": {
1025
+ "defined": {
1026
+ "name": "globalConfigureData";
716
1027
  };
717
1028
  };
718
1029
  }
719
1030
  ];
720
1031
  },
721
1032
  {
722
- name: 'globalInitialize';
723
- discriminator: [
1033
+ "name": "globalInitialize";
1034
+ "discriminator": [
724
1035
  30,
725
1036
  79,
726
1037
  193,
@@ -730,15 +1041,15 @@ type Jbond = {
730
1041
  223,
731
1042
  196
732
1043
  ];
733
- accounts: [
1044
+ "accounts": [
734
1045
  {
735
- name: 'globalState';
736
- writable: true;
737
- pda: {
738
- seeds: [
1046
+ "name": "globalState";
1047
+ "writable": true;
1048
+ "pda": {
1049
+ "seeds": [
739
1050
  {
740
- kind: 'const';
741
- value: [
1051
+ "kind": "const";
1052
+ "value": [
742
1053
  103,
743
1054
  108,
744
1055
  111,
@@ -757,97 +1068,23 @@ type Jbond = {
757
1068
  };
758
1069
  },
759
1070
  {
760
- name: 'authority';
761
- writable: true;
762
- signer: true;
763
- },
764
- {
765
- name: 'systemProgram';
766
- address: '11111111111111111111111111111111';
767
- }
768
- ];
769
- args: [];
770
- },
771
- {
772
- name: 'migrateBond';
773
- docs: [
774
- 'Migrates validator bond data from legacy structure to new structure.'
775
- ];
776
- discriminator: [
777
- 107,
778
- 119,
779
- 59,
780
- 110,
781
- 76,
782
- 18,
783
- 37,
784
- 163
785
- ];
786
- accounts: [
787
- {
788
- name: 'bondState';
789
- writable: true;
790
- },
791
- {
792
- name: 'legacyValidatorBond';
793
- writable: true;
794
- },
795
- {
796
- name: 'legacyVoteAccount';
797
- },
798
- {
799
- name: 'validatorBond';
800
- writable: true;
801
- pda: {
802
- seeds: [
803
- {
804
- kind: 'const';
805
- value: [
806
- 118,
807
- 97,
808
- 108,
809
- 105,
810
- 100,
811
- 97,
812
- 116,
813
- 111,
814
- 114,
815
- 95,
816
- 98,
817
- 111,
818
- 110,
819
- 100
820
- ];
821
- },
822
- {
823
- kind: 'account';
824
- path: 'bondState';
825
- },
826
- {
827
- kind: 'account';
828
- path: 'legacyVoteAccount';
829
- }
830
- ];
831
- };
832
- },
833
- {
834
- name: 'creator';
835
- writable: true;
836
- signer: true;
1071
+ "name": "authority";
1072
+ "writable": true;
1073
+ "signer": true;
837
1074
  },
838
1075
  {
839
- name: 'systemProgram';
840
- address: '11111111111111111111111111111111';
1076
+ "name": "systemProgram";
1077
+ "address": "11111111111111111111111111111111";
841
1078
  }
842
1079
  ];
843
- args: [];
1080
+ "args": [];
844
1081
  },
845
1082
  {
846
- name: 'sessionFinish';
847
- docs: [
848
- 'Finishes a bond, preventing further deposits and withdrawals.'
1083
+ "name": "sessionFinish";
1084
+ "docs": [
1085
+ "Finishes a bond, preventing further deposits and withdrawals."
849
1086
  ];
850
- discriminator: [
1087
+ "discriminator": [
851
1088
  230,
852
1089
  209,
853
1090
  54,
@@ -857,28 +1094,28 @@ type Jbond = {
857
1094
  137,
858
1095
  113
859
1096
  ];
860
- accounts: [
1097
+ "accounts": [
861
1098
  {
862
- name: 'bondState';
863
- writable: true;
1099
+ "name": "bondState";
1100
+ "writable": true;
864
1101
  },
865
1102
  {
866
- name: 'authority';
867
- writable: true;
868
- signer: true;
869
- relations: [
870
- 'bondState'
1103
+ "name": "authority";
1104
+ "writable": true;
1105
+ "signer": true;
1106
+ "relations": [
1107
+ "bondState"
871
1108
  ];
872
1109
  }
873
1110
  ];
874
- args: [];
1111
+ "args": [];
875
1112
  },
876
1113
  {
877
- name: 'sessionStart';
878
- docs: [
879
- 'Starts a paused bond, allowing deposits and withdrawals to resume.'
1114
+ "name": "sessionStart";
1115
+ "docs": [
1116
+ "Starts a paused bond, allowing deposits and withdrawals to resume."
880
1117
  ];
881
- discriminator: [
1118
+ "discriminator": [
882
1119
  132,
883
1120
  93,
884
1121
  83,
@@ -888,32 +1125,32 @@ type Jbond = {
888
1125
  58,
889
1126
  92
890
1127
  ];
891
- accounts: [
1128
+ "accounts": [
892
1129
  {
893
- name: 'bondState';
894
- writable: true;
1130
+ "name": "bondState";
1131
+ "writable": true;
895
1132
  },
896
1133
  {
897
- name: 'authority';
898
- writable: true;
899
- signer: true;
900
- relations: [
901
- 'bondState'
1134
+ "name": "authority";
1135
+ "writable": true;
1136
+ "signer": true;
1137
+ "relations": [
1138
+ "bondState"
902
1139
  ];
903
1140
  }
904
1141
  ];
905
- args: [
1142
+ "args": [
906
1143
  {
907
- name: 'durationSecs';
908
- type: 'u64';
1144
+ "name": "durationSecs";
1145
+ "type": "u64";
909
1146
  }
910
1147
  ];
911
1148
  }
912
1149
  ];
913
- accounts: [
1150
+ "accounts": [
914
1151
  {
915
- name: 'bondState';
916
- discriminator: [
1152
+ "name": "bondState";
1153
+ "discriminator": [
917
1154
  251,
918
1155
  95,
919
1156
  76,
@@ -925,8 +1162,8 @@ type Jbond = {
925
1162
  ];
926
1163
  },
927
1164
  {
928
- name: 'globalState';
929
- discriminator: [
1165
+ "name": "globalState";
1166
+ "discriminator": [
930
1167
  163,
931
1168
  46,
932
1169
  74,
@@ -938,8 +1175,8 @@ type Jbond = {
938
1175
  ];
939
1176
  },
940
1177
  {
941
- name: 'validatorBond';
942
- discriminator: [
1178
+ "name": "validatorBond";
1179
+ "discriminator": [
943
1180
  82,
944
1181
  127,
945
1182
  243,
@@ -951,10 +1188,23 @@ type Jbond = {
951
1188
  ];
952
1189
  }
953
1190
  ];
954
- events: [
1191
+ "events": [
1192
+ {
1193
+ "name": "bondConfigured";
1194
+ "discriminator": [
1195
+ 141,
1196
+ 252,
1197
+ 43,
1198
+ 54,
1199
+ 45,
1200
+ 157,
1201
+ 81,
1202
+ 14
1203
+ ];
1204
+ },
955
1205
  {
956
- name: 'bondFinished';
957
- discriminator: [
1206
+ "name": "bondFinished";
1207
+ "discriminator": [
958
1208
  223,
959
1209
  254,
960
1210
  3,
@@ -966,8 +1216,34 @@ type Jbond = {
966
1216
  ];
967
1217
  },
968
1218
  {
969
- name: 'bondStarted';
970
- discriminator: [
1219
+ "name": "bondInitialized";
1220
+ "discriminator": [
1221
+ 73,
1222
+ 68,
1223
+ 161,
1224
+ 2,
1225
+ 214,
1226
+ 12,
1227
+ 169,
1228
+ 53
1229
+ ];
1230
+ },
1231
+ {
1232
+ "name": "bondRemoved";
1233
+ "discriminator": [
1234
+ 177,
1235
+ 200,
1236
+ 116,
1237
+ 123,
1238
+ 1,
1239
+ 244,
1240
+ 161,
1241
+ 240
1242
+ ];
1243
+ },
1244
+ {
1245
+ "name": "bondStarted";
1246
+ "discriminator": [
971
1247
  235,
972
1248
  69,
973
1249
  80,
@@ -979,21 +1255,21 @@ type Jbond = {
979
1255
  ];
980
1256
  },
981
1257
  {
982
- name: 'collateralToppedUp';
983
- discriminator: [
984
- 189,
985
- 137,
986
- 204,
987
- 58,
1258
+ "name": "collateralDeposited";
1259
+ "discriminator": [
1260
+ 244,
1261
+ 62,
1262
+ 77,
1263
+ 11,
988
1264
  135,
989
- 182,
990
- 19,
991
- 176
1265
+ 112,
1266
+ 61,
1267
+ 96
992
1268
  ];
993
1269
  },
994
1270
  {
995
- name: 'collateralWithdrawn';
996
- discriminator: [
1271
+ "name": "collateralWithdrawn";
1272
+ "discriminator": [
997
1273
  51,
998
1274
  224,
999
1275
  133,
@@ -1005,8 +1281,21 @@ type Jbond = {
1005
1281
  ];
1006
1282
  },
1007
1283
  {
1008
- name: 'compensationClaimed';
1009
- discriminator: [
1284
+ "name": "compensationBurned";
1285
+ "discriminator": [
1286
+ 177,
1287
+ 198,
1288
+ 90,
1289
+ 188,
1290
+ 47,
1291
+ 95,
1292
+ 20,
1293
+ 174
1294
+ ];
1295
+ },
1296
+ {
1297
+ "name": "compensationClaimed";
1298
+ "discriminator": [
1010
1299
  36,
1011
1300
  159,
1012
1301
  41,
@@ -1018,8 +1307,47 @@ type Jbond = {
1018
1307
  ];
1019
1308
  },
1020
1309
  {
1021
- name: 'validatorRegistered';
1022
- discriminator: [
1310
+ "name": "fundsLocked";
1311
+ "discriminator": [
1312
+ 227,
1313
+ 93,
1314
+ 162,
1315
+ 69,
1316
+ 181,
1317
+ 4,
1318
+ 71,
1319
+ 157
1320
+ ];
1321
+ },
1322
+ {
1323
+ "name": "fundsUnlocked";
1324
+ "discriminator": [
1325
+ 11,
1326
+ 240,
1327
+ 184,
1328
+ 107,
1329
+ 86,
1330
+ 187,
1331
+ 196,
1332
+ 128
1333
+ ];
1334
+ },
1335
+ {
1336
+ "name": "validatorBondClosed";
1337
+ "discriminator": [
1338
+ 71,
1339
+ 54,
1340
+ 59,
1341
+ 241,
1342
+ 91,
1343
+ 35,
1344
+ 123,
1345
+ 123
1346
+ ];
1347
+ },
1348
+ {
1349
+ "name": "validatorRegistered";
1350
+ "discriminator": [
1023
1351
  20,
1024
1352
  20,
1025
1353
  190,
@@ -1029,210 +1357,203 @@ type Jbond = {
1029
1357
  95,
1030
1358
  72
1031
1359
  ];
1032
- }
1033
- ];
1034
- errors: [
1035
- {
1036
- code: 6000;
1037
- name: 'invalidVoteAccount';
1038
- msg: 'Invalid vote account';
1039
- },
1040
- {
1041
- code: 6001;
1042
- name: 'identityMismatch';
1043
- msg: 'Identity does not match vote account';
1044
1360
  },
1045
1361
  {
1046
- code: 6002;
1047
- name: 'insufficientCollateral';
1048
- msg: 'Insufficient collateral amount';
1049
- },
1050
- {
1051
- code: 6003;
1052
- name: 'targetAprTooLow';
1053
- msg: 'Target APR is below minimum threshold';
1054
- },
1055
- {
1056
- code: 6004;
1057
- name: 'mathOverflow';
1058
- msg: 'Math overflow';
1059
- },
1060
- {
1061
- code: 6005;
1062
- name: 'invalidAmount';
1063
- msg: 'Invalid amount';
1064
- },
1065
- {
1066
- code: 6006;
1067
- name: 'validatorNotActive';
1068
- msg: 'Validator bond account is not active';
1069
- },
1070
- {
1071
- code: 6007;
1072
- name: 'validatorAlreadyRegistered';
1073
- msg: 'Validator already registered';
1074
- },
1362
+ "name": "withdrawAuthorityChanged";
1363
+ "discriminator": [
1364
+ 91,
1365
+ 149,
1366
+ 224,
1367
+ 49,
1368
+ 187,
1369
+ 48,
1370
+ 190,
1371
+ 100
1372
+ ];
1373
+ }
1374
+ ];
1375
+ "errors": [
1075
1376
  {
1076
- code: 6008;
1077
- name: 'unauthorized';
1078
- msg: 'unauthorized';
1377
+ "code": 6000;
1378
+ "name": "forbidden";
1379
+ "msg": "forbidden";
1079
1380
  },
1080
1381
  {
1081
- code: 6009;
1082
- name: 'withdrawalLockedNearEpochEnd';
1083
- msg: 'Withdrawals are locked near the end of the epoch.';
1382
+ "code": 6001;
1383
+ "name": "unauthorized";
1384
+ "msg": "unauthorized";
1084
1385
  },
1085
1386
  {
1086
- code: 6010;
1087
- name: 'missingTokenAccounts';
1088
- msg: 'Missing token accounts for token collateral type';
1387
+ "code": 6002;
1388
+ "name": "invalidVoteAccount";
1389
+ "msg": "Invalid vote account";
1089
1390
  },
1090
1391
  {
1091
- code: 6011;
1092
- name: 'missingTokenProgram';
1093
- msg: 'Token program is required for token collateral type';
1392
+ "code": 6003;
1393
+ "name": "identityMismatch";
1394
+ "msg": "Vote account identity mismatch";
1094
1395
  },
1095
1396
  {
1096
- code: 6012;
1097
- name: 'invalidMint';
1098
- msg: 'Invalid mint for token collateral type';
1397
+ "code": 6004;
1398
+ "name": "invalidMint";
1399
+ "msg": "Invalid mint address";
1099
1400
  },
1100
1401
  {
1101
- code: 6013;
1102
- name: 'missingStakeAccount';
1103
- msg: 'Stake account is required for stake account collateral type';
1402
+ "code": 6005;
1403
+ "name": "invalidAmount";
1404
+ "msg": "Invalid amount";
1104
1405
  },
1105
1406
  {
1106
- code: 6014;
1107
- name: 'missingStakeProgram';
1108
- msg: 'Stake program is required for stake account collateral type';
1407
+ "code": 6006;
1408
+ "name": "invalidArgument";
1409
+ "msg": "Invalid argument";
1109
1410
  },
1110
1411
  {
1111
- code: 6015;
1112
- name: 'bondFinished';
1113
- msg: 'Bond is finished (deposits/withdrawals disabled)';
1412
+ "code": 6007;
1413
+ "name": "insufficientBalance";
1414
+ "msg": "Insufficient balance";
1114
1415
  },
1115
1416
  {
1116
- code: 6016;
1117
- name: 'bondNotFinished';
1118
- msg: 'Bond is not finished';
1417
+ "code": 6008;
1418
+ "name": "mathOverflow";
1419
+ "msg": "Math overflow";
1119
1420
  },
1120
1421
  {
1121
- code: 6017;
1122
- name: 'unsupportedCollateralType';
1123
- msg: 'Unsupported collateral type';
1422
+ "code": 6009;
1423
+ "name": "overflow";
1424
+ "msg": "Arithmetic overflow";
1124
1425
  },
1125
1426
  {
1126
- code: 6018;
1127
- name: 'overflow';
1128
- msg: 'Math operation overflowed';
1427
+ "code": 6010;
1428
+ "name": "bondNotRemovable";
1429
+ "msg": "Bond cannot be removed";
1129
1430
  },
1130
1431
  {
1131
- code: 6019;
1132
- name: 'incorrectBondType';
1133
- msg: 'Incorrect bond type for this operation';
1432
+ "code": 6011;
1433
+ "name": "missingTokenAccounts";
1434
+ "msg": "Missing token accounts";
1134
1435
  },
1135
1436
  {
1136
- code: 6020;
1137
- name: 'bondNotFinishable';
1138
- msg: 'This bond type can\'t be finished';
1437
+ "code": 6012;
1438
+ "name": "missingTokenProgram";
1439
+ "msg": "Missing token program";
1139
1440
  },
1140
1441
  {
1141
- code: 6021;
1142
- name: 'invalidArgument';
1143
- msg: 'Invalid argument provided';
1442
+ "code": 6013;
1443
+ "name": "missingStakeAccount";
1444
+ "msg": "Missing stake account";
1144
1445
  },
1145
1446
  {
1146
- code: 6022;
1147
- name: 'bondNotDisabled';
1148
- msg: 'Bond is not disabled';
1447
+ "code": 6014;
1448
+ "name": "missingStakeProgram";
1449
+ "msg": "Missing stake program";
1149
1450
  },
1150
1451
  {
1151
- code: 6023;
1152
- name: 'bondNotEnabled';
1153
- msg: 'Bond is not enabled';
1452
+ "code": 6015;
1453
+ "name": "unsupportedCollateralType";
1454
+ "msg": "Unsupported collateral type";
1154
1455
  }
1155
1456
  ];
1156
- types: [
1157
- {
1158
- name: 'bondConfigureData';
1159
- type: {
1160
- kind: 'struct';
1161
- fields: [
1162
- {
1163
- name: 'status';
1164
- type: {
1165
- option: {
1166
- defined: {
1167
- name: 'bondStatus';
1457
+ "types": [
1458
+ {
1459
+ "name": "bondConfigureData";
1460
+ "type": {
1461
+ "kind": "struct";
1462
+ "fields": [
1463
+ {
1464
+ "name": "status";
1465
+ "type": {
1466
+ "option": {
1467
+ "defined": {
1468
+ "name": "bondStatus";
1168
1469
  };
1169
1470
  };
1170
1471
  };
1171
1472
  },
1172
1473
  {
1173
- name: 'newReserve';
1174
- type: {
1175
- option: 'pubkey';
1474
+ "name": "newReserve";
1475
+ "type": {
1476
+ "option": "pubkey";
1176
1477
  };
1177
1478
  },
1178
1479
  {
1179
- name: 'newAuthority';
1180
- type: {
1181
- option: 'pubkey';
1480
+ "name": "newAuthority";
1481
+ "type": {
1482
+ "option": "pubkey";
1182
1483
  };
1183
1484
  }
1184
1485
  ];
1185
1486
  };
1186
1487
  },
1187
1488
  {
1188
- name: 'bondFinished';
1189
- type: {
1190
- kind: 'struct';
1191
- fields: [
1489
+ "name": "bondConfigured";
1490
+ "type": {
1491
+ "kind": "struct";
1492
+ "fields": [
1493
+ {
1494
+ "name": "bond";
1495
+ "type": "pubkey";
1496
+ },
1497
+ {
1498
+ "name": "authority";
1499
+ "type": "pubkey";
1500
+ },
1501
+ {
1502
+ "name": "timestamp";
1503
+ "type": "i64";
1504
+ }
1505
+ ];
1506
+ };
1507
+ },
1508
+ {
1509
+ "name": "bondFinished";
1510
+ "type": {
1511
+ "kind": "struct";
1512
+ "fields": [
1192
1513
  {
1193
- name: 'bond';
1194
- type: 'pubkey';
1514
+ "name": "bond";
1515
+ "type": "pubkey";
1195
1516
  },
1196
1517
  {
1197
- name: 'authority';
1198
- type: 'pubkey';
1518
+ "name": "authority";
1519
+ "type": "pubkey";
1199
1520
  },
1200
1521
  {
1201
- name: 'timestamp';
1202
- type: 'i64';
1522
+ "name": "timestamp";
1523
+ "type": "i64";
1203
1524
  }
1204
1525
  ];
1205
1526
  };
1206
1527
  },
1207
1528
  {
1208
- name: 'bondInitializeData';
1209
- docs: [
1210
- 'Data required to initialize a performance bond'
1529
+ "name": "bondInitializeData";
1530
+ "docs": [
1531
+ "Data required to initialize a performance bond"
1211
1532
  ];
1212
- type: {
1213
- kind: 'struct';
1214
- fields: [
1533
+ "type": {
1534
+ "kind": "struct";
1535
+ "fields": [
1215
1536
  {
1216
- name: 'name';
1217
- type: 'string';
1537
+ "name": "name";
1538
+ "type": "string";
1218
1539
  },
1219
1540
  {
1220
- name: 'bondType';
1221
- type: {
1222
- defined: {
1223
- name: 'bondType';
1541
+ "name": "bondType";
1542
+ "type": {
1543
+ "defined": {
1544
+ "name": "bondType";
1224
1545
  };
1225
1546
  };
1226
1547
  },
1227
1548
  {
1228
- name: 'reserve';
1229
- type: 'pubkey';
1549
+ "name": "reserve";
1550
+ "type": "pubkey";
1230
1551
  },
1231
1552
  {
1232
- name: 'collateralType';
1233
- type: {
1234
- defined: {
1235
- name: 'collateralType';
1553
+ "name": "collateralType";
1554
+ "type": {
1555
+ "defined": {
1556
+ "name": "collateralType";
1236
1557
  };
1237
1558
  };
1238
1559
  }
@@ -1240,363 +1561,582 @@ type Jbond = {
1240
1561
  };
1241
1562
  },
1242
1563
  {
1243
- name: 'bondStarted';
1244
- type: {
1245
- kind: 'struct';
1246
- fields: [
1564
+ "name": "bondInitialized";
1565
+ "type": {
1566
+ "kind": "struct";
1567
+ "fields": [
1568
+ {
1569
+ "name": "bond";
1570
+ "type": "pubkey";
1571
+ },
1572
+ {
1573
+ "name": "authority";
1574
+ "type": "pubkey";
1575
+ },
1576
+ {
1577
+ "name": "timestamp";
1578
+ "type": "i64";
1579
+ }
1580
+ ];
1581
+ };
1582
+ },
1583
+ {
1584
+ "name": "bondRemoved";
1585
+ "type": {
1586
+ "kind": "struct";
1587
+ "fields": [
1588
+ {
1589
+ "name": "bond";
1590
+ "type": "pubkey";
1591
+ },
1592
+ {
1593
+ "name": "authority";
1594
+ "type": "pubkey";
1595
+ },
1596
+ {
1597
+ "name": "timestamp";
1598
+ "type": "i64";
1599
+ }
1600
+ ];
1601
+ };
1602
+ },
1603
+ {
1604
+ "name": "bondStarted";
1605
+ "type": {
1606
+ "kind": "struct";
1607
+ "fields": [
1247
1608
  {
1248
- name: 'bond';
1249
- type: 'pubkey';
1609
+ "name": "bond";
1610
+ "type": "pubkey";
1250
1611
  },
1251
1612
  {
1252
- name: 'authority';
1253
- type: 'pubkey';
1613
+ "name": "authority";
1614
+ "type": "pubkey";
1254
1615
  },
1255
1616
  {
1256
- name: 'timestamp';
1257
- type: 'i64';
1617
+ "name": "timestamp";
1618
+ "type": "i64";
1258
1619
  }
1259
1620
  ];
1260
1621
  };
1261
1622
  },
1262
1623
  {
1263
- name: 'bondState';
1264
- type: {
1265
- kind: 'struct';
1266
- fields: [
1624
+ "name": "bondState";
1625
+ "type": {
1626
+ "kind": "struct";
1627
+ "fields": [
1267
1628
  {
1268
- name: 'name';
1269
- type: 'string';
1629
+ "name": "name";
1630
+ "type": "string";
1270
1631
  },
1271
1632
  {
1272
- name: 'bondType';
1273
- docs: [
1274
- 'The type of bond (e.g., Standard, Crowdfunding)'
1633
+ "name": "bondType";
1634
+ "docs": [
1635
+ "The type of bond (e.g., Standard, Crowdfunding)"
1275
1636
  ];
1276
- type: {
1277
- defined: {
1278
- name: 'bondType';
1637
+ "type": {
1638
+ "defined": {
1639
+ "name": "bondType";
1279
1640
  };
1280
1641
  };
1281
1642
  },
1282
1643
  {
1283
- name: 'collateralType';
1284
- docs: [
1285
- 'The type of collateral accepted for this bond'
1644
+ "name": "collateralType";
1645
+ "docs": [
1646
+ "The type of collateral accepted for this bond"
1286
1647
  ];
1287
- type: {
1288
- defined: {
1289
- name: 'collateralType';
1648
+ "type": {
1649
+ "defined": {
1650
+ "name": "collateralType";
1290
1651
  };
1291
1652
  };
1292
1653
  },
1293
1654
  {
1294
- name: 'reserve';
1295
- docs: [
1296
- 'Reserve account where collateral is held'
1655
+ "name": "reserve";
1656
+ "docs": [
1657
+ "Reserve account where collateral is held"
1297
1658
  ];
1298
- type: 'pubkey';
1659
+ "type": "pubkey";
1299
1660
  },
1300
1661
  {
1301
- name: 'authority';
1302
- docs: [
1303
- 'Authority allowed to manage the bond configuration'
1662
+ "name": "authority";
1663
+ "docs": [
1664
+ "Authority allowed to manage the bond configuration"
1304
1665
  ];
1305
- type: 'pubkey';
1666
+ "type": "pubkey";
1306
1667
  },
1307
1668
  {
1308
- name: 'sessionId';
1309
- docs: [
1310
- 'Unique identifier for the bonding session'
1669
+ "name": "sessionId";
1670
+ "docs": [
1671
+ "Unique identifier for the bonding session"
1311
1672
  ];
1312
- type: 'u32';
1673
+ "type": "u32";
1313
1674
  },
1314
1675
  {
1315
- name: 'totalMembers';
1316
- docs: [
1317
- 'Total number of users who have participated in the bond'
1676
+ "name": "totalMembers";
1677
+ "docs": [
1678
+ "Total number of users who have participated in the bond"
1318
1679
  ];
1319
- type: 'u16';
1680
+ "type": "u16";
1320
1681
  },
1321
1682
  {
1322
- name: 'totalCompensationAmount';
1323
- docs: [
1324
- 'Total compensation amount paid out'
1683
+ "name": "totalCompensationAmount";
1684
+ "docs": [
1685
+ "Total compensation amount paid out"
1325
1686
  ];
1326
- type: 'u64';
1687
+ "type": "u64";
1327
1688
  },
1328
1689
  {
1329
- name: 'sessionStartTs';
1330
- docs: [
1331
- 'Start timestamp of the current session (unix seconds). 0 — not set.'
1690
+ "name": "sessionStartTs";
1691
+ "docs": [
1692
+ "Start timestamp of the current session (unix seconds). 0 — not set."
1332
1693
  ];
1333
- type: 'i64';
1694
+ "type": "i64";
1334
1695
  },
1335
1696
  {
1336
- name: 'sessionFinishTs';
1337
- docs: [
1338
- 'Finish timestamp of the current session (unix seconds). 0 — not set.'
1697
+ "name": "sessionFinishTs";
1698
+ "docs": [
1699
+ "Finish timestamp of the current session (unix seconds). 0 — not set."
1339
1700
  ];
1340
- type: 'i64';
1701
+ "type": "i64";
1341
1702
  },
1342
1703
  {
1343
- name: 'status';
1344
- docs: [
1345
- 'Current status of the bond'
1704
+ "name": "status";
1705
+ "docs": [
1706
+ "Current status of the bond"
1346
1707
  ];
1347
- type: {
1348
- defined: {
1349
- name: 'bondStatus';
1708
+ "type": {
1709
+ "defined": {
1710
+ "name": "bondStatus";
1350
1711
  };
1351
1712
  };
1352
1713
  },
1353
1714
  {
1354
- name: 'bump';
1355
- docs: [
1356
- 'Bump for the PDA'
1715
+ "name": "bump";
1716
+ "docs": [
1717
+ "Bump for the PDA"
1357
1718
  ];
1358
- type: 'u8';
1719
+ "type": "u8";
1359
1720
  }
1360
1721
  ];
1361
1722
  };
1362
1723
  },
1363
1724
  {
1364
- name: 'bondStatus';
1365
- type: {
1366
- kind: 'enum';
1367
- variants: [
1725
+ "name": "bondStatus";
1726
+ "type": {
1727
+ "kind": "enum";
1728
+ "variants": [
1368
1729
  {
1369
- name: 'active';
1730
+ "name": "active";
1370
1731
  },
1371
1732
  {
1372
- name: 'disabled';
1733
+ "name": "disabled";
1373
1734
  }
1374
1735
  ];
1375
1736
  };
1376
1737
  },
1377
1738
  {
1378
- name: 'bondType';
1379
- docs: [
1380
- 'Types of bonds supported by the program'
1739
+ "name": "bondType";
1740
+ "docs": [
1741
+ "Types of bonds supported by the program"
1381
1742
  ];
1382
- type: {
1383
- kind: 'enum';
1384
- variants: [
1743
+ "type": {
1744
+ "kind": "enum";
1745
+ "variants": [
1385
1746
  {
1386
- name: 'standard';
1747
+ "name": "standard";
1387
1748
  },
1388
1749
  {
1389
- name: 'crowdfunding';
1750
+ "name": "crowdfunding";
1390
1751
  }
1391
1752
  ];
1392
1753
  };
1393
1754
  },
1394
1755
  {
1395
- name: 'collateralToppedUp';
1396
- type: {
1397
- kind: 'struct';
1398
- fields: [
1756
+ "name": "collateralDeposited";
1757
+ "type": {
1758
+ "kind": "struct";
1759
+ "fields": [
1399
1760
  {
1400
- name: 'validator';
1401
- type: 'pubkey';
1761
+ "name": "validator";
1762
+ "type": "pubkey";
1402
1763
  },
1403
1764
  {
1404
- name: 'amount';
1405
- type: 'u64';
1765
+ "name": "amount";
1766
+ "type": "u64";
1406
1767
  },
1407
1768
  {
1408
- name: 'postBalance';
1409
- type: 'u64';
1769
+ "name": "postBalance";
1770
+ "type": "u64";
1410
1771
  },
1411
1772
  {
1412
- name: 'timestamp';
1413
- type: 'i64';
1773
+ "name": "timestamp";
1774
+ "type": "i64";
1414
1775
  }
1415
1776
  ];
1416
1777
  };
1417
1778
  },
1418
1779
  {
1419
- name: 'collateralType';
1420
- docs: [
1421
- 'Types of collateral that can be used for bond deposit'
1780
+ "name": "collateralType";
1781
+ "docs": [
1782
+ "Types of collateral that can be used for bond deposit"
1422
1783
  ];
1423
- type: {
1424
- kind: 'enum';
1425
- variants: [
1784
+ "type": {
1785
+ "kind": "enum";
1786
+ "variants": [
1426
1787
  {
1427
- name: 'native';
1788
+ "name": "native";
1428
1789
  },
1429
1790
  {
1430
- name: 'stakeAccount';
1791
+ "name": "stakeAccount";
1431
1792
  },
1432
1793
  {
1433
- name: 'token';
1434
- fields: [
1435
- 'pubkey'
1794
+ "name": "token";
1795
+ "fields": [
1796
+ "pubkey"
1436
1797
  ];
1437
1798
  }
1438
1799
  ];
1439
1800
  };
1440
1801
  },
1441
1802
  {
1442
- name: 'collateralWithdrawn';
1443
- type: {
1444
- kind: 'struct';
1445
- fields: [
1803
+ "name": "collateralWithdrawn";
1804
+ "type": {
1805
+ "kind": "struct";
1806
+ "fields": [
1807
+ {
1808
+ "name": "validator";
1809
+ "type": "pubkey";
1810
+ },
1811
+ {
1812
+ "name": "amount";
1813
+ "type": "u64";
1814
+ },
1815
+ {
1816
+ "name": "postBalance";
1817
+ "type": "u64";
1818
+ },
1819
+ {
1820
+ "name": "timestamp";
1821
+ "type": "i64";
1822
+ }
1823
+ ];
1824
+ };
1825
+ },
1826
+ {
1827
+ "name": "compensationBurned";
1828
+ "type": {
1829
+ "kind": "struct";
1830
+ "fields": [
1831
+ {
1832
+ "name": "validator";
1833
+ "type": "pubkey";
1834
+ },
1835
+ {
1836
+ "name": "amount";
1837
+ "type": "u64";
1838
+ },
1839
+ {
1840
+ "name": "postBalance";
1841
+ "type": "u64";
1842
+ },
1843
+ {
1844
+ "name": "epoch";
1845
+ "type": "u64";
1846
+ },
1847
+ {
1848
+ "name": "timestamp";
1849
+ "type": "i64";
1850
+ }
1851
+ ];
1852
+ };
1853
+ },
1854
+ {
1855
+ "name": "compensationClaimed";
1856
+ "type": {
1857
+ "kind": "struct";
1858
+ "fields": [
1859
+ {
1860
+ "name": "validator";
1861
+ "type": "pubkey";
1862
+ },
1446
1863
  {
1447
- name: 'validator';
1448
- type: 'pubkey';
1864
+ "name": "amount";
1865
+ "type": "u64";
1449
1866
  },
1450
1867
  {
1451
- name: 'amount';
1452
- type: 'u64';
1868
+ "name": "postBalance";
1869
+ "type": "u64";
1453
1870
  },
1454
1871
  {
1455
- name: 'postBalance';
1456
- type: 'u64';
1872
+ "name": "epoch";
1873
+ "type": "u64";
1457
1874
  },
1458
1875
  {
1459
- name: 'timestamp';
1460
- type: 'i64';
1876
+ "name": "timestamp";
1877
+ "type": "i64";
1461
1878
  }
1462
1879
  ];
1463
1880
  };
1464
1881
  },
1465
1882
  {
1466
- name: 'compensationClaimed';
1467
- type: {
1468
- kind: 'struct';
1469
- fields: [
1883
+ "name": "fundsLocked";
1884
+ "type": {
1885
+ "kind": "struct";
1886
+ "fields": [
1887
+ {
1888
+ "name": "validator";
1889
+ "type": "pubkey";
1890
+ },
1891
+ {
1892
+ "name": "amount";
1893
+ "type": "u64";
1894
+ },
1470
1895
  {
1471
- name: 'validator';
1472
- type: 'pubkey';
1896
+ "name": "totalLocked";
1897
+ "type": "u64";
1473
1898
  },
1474
1899
  {
1475
- name: 'amount';
1476
- type: 'u64';
1900
+ "name": "epoch";
1901
+ "type": "u64";
1902
+ }
1903
+ ];
1904
+ };
1905
+ },
1906
+ {
1907
+ "name": "fundsUnlocked";
1908
+ "type": {
1909
+ "kind": "struct";
1910
+ "fields": [
1911
+ {
1912
+ "name": "validator";
1913
+ "type": "pubkey";
1477
1914
  },
1478
1915
  {
1479
- name: 'postBalance';
1480
- type: 'u64';
1916
+ "name": "amount";
1917
+ "type": "u64";
1481
1918
  },
1482
1919
  {
1483
- name: 'epoch';
1484
- type: 'u64';
1920
+ "name": "pendingUnlock";
1921
+ "type": "u64";
1485
1922
  },
1486
1923
  {
1487
- name: 'timestamp';
1488
- type: 'i64';
1924
+ "name": "epoch";
1925
+ "type": "u64";
1489
1926
  }
1490
1927
  ];
1491
1928
  };
1492
1929
  },
1493
1930
  {
1494
- name: 'globalConfigureData';
1495
- type: {
1496
- kind: 'struct';
1497
- fields: [
1931
+ "name": "globalConfigureData";
1932
+ "type": {
1933
+ "kind": "struct";
1934
+ "fields": [
1498
1935
  {
1499
- name: 'newAuthority';
1500
- type: {
1501
- option: 'pubkey';
1936
+ "name": "newAuthority";
1937
+ "type": {
1938
+ "option": "pubkey";
1502
1939
  };
1503
1940
  }
1504
1941
  ];
1505
1942
  };
1506
1943
  },
1507
1944
  {
1508
- name: 'globalState';
1509
- type: {
1510
- kind: 'struct';
1511
- fields: [
1945
+ "name": "globalState";
1946
+ "type": {
1947
+ "kind": "struct";
1948
+ "fields": [
1512
1949
  {
1513
- name: 'authority';
1514
- docs: [
1515
- 'The authority allowed to manage the program'
1950
+ "name": "authority";
1951
+ "docs": [
1952
+ "The authority allowed to manage the program"
1516
1953
  ];
1517
- type: 'pubkey';
1954
+ "type": "pubkey";
1518
1955
  },
1519
1956
  {
1520
- name: 'bump';
1521
- docs: [
1522
- 'Bump for the PDA'
1957
+ "name": "bump";
1958
+ "docs": [
1959
+ "Bump for the PDA"
1523
1960
  ];
1524
- type: 'u8';
1961
+ "type": "u8";
1525
1962
  }
1526
1963
  ];
1527
1964
  };
1528
1965
  },
1529
1966
  {
1530
- name: 'validatorBond';
1531
- type: {
1532
- kind: 'struct';
1533
- fields: [
1967
+ "name": "validatorBond";
1968
+ "type": {
1969
+ "kind": "struct";
1970
+ "fields": [
1534
1971
  {
1535
- name: 'state';
1536
- type: 'pubkey';
1972
+ "name": "state";
1973
+ "docs": [
1974
+ "The bond state address"
1975
+ ];
1976
+ "type": "pubkey";
1537
1977
  },
1538
1978
  {
1539
- name: 'identity';
1540
- type: 'pubkey';
1979
+ "name": "identity";
1980
+ "docs": [
1981
+ "Validator identity pubkey"
1982
+ ];
1983
+ "type": "pubkey";
1541
1984
  },
1542
1985
  {
1543
- name: 'voteAccount';
1544
- type: 'pubkey';
1986
+ "name": "voteAccount";
1987
+ "docs": [
1988
+ "Validator vote account pubkey"
1989
+ ];
1990
+ "type": "pubkey";
1545
1991
  },
1546
1992
  {
1547
- name: 'creator';
1548
- type: 'pubkey';
1993
+ "name": "creator";
1994
+ "docs": [
1995
+ "The bond creator pubkey"
1996
+ ];
1997
+ "type": "pubkey";
1549
1998
  },
1550
1999
  {
1551
- name: 'withdrawalAuthority';
1552
- type: {
1553
- option: 'pubkey';
2000
+ "name": "withdrawalAuthority";
2001
+ "docs": [
2002
+ "Optional withdrawal authority pubkey (if set, can withdraw on behalf of the validator,",
2003
+ "otherwise only identity can withdraw)"
2004
+ ];
2005
+ "type": {
2006
+ "option": "pubkey";
1554
2007
  };
1555
2008
  },
1556
2009
  {
1557
- name: 'createdAt';
1558
- type: 'i64';
2010
+ "name": "createdAt";
2011
+ "docs": [
2012
+ "Bond creation timestamp"
2013
+ ];
2014
+ "type": "i64";
2015
+ },
2016
+ {
2017
+ "name": "bump";
2018
+ "docs": [
2019
+ "Bump for the PDA"
2020
+ ];
2021
+ "type": "u8";
2022
+ },
2023
+ {
2024
+ "name": "locked";
2025
+ "docs": [
2026
+ "Amount of collateral currently locked (unavailable for withdrawal)"
2027
+ ];
2028
+ "type": "u64";
2029
+ },
2030
+ {
2031
+ "name": "pendingUnlock";
2032
+ "docs": [
2033
+ "Pending unlock amount (will reduce `locked` next epoch)"
2034
+ ];
2035
+ "type": "u64";
2036
+ },
2037
+ {
2038
+ "name": "pendingUnlockEpoch";
2039
+ "docs": [
2040
+ "Epoch when pending_unlock was queued"
2041
+ ];
2042
+ "type": "u64";
2043
+ }
2044
+ ];
2045
+ };
2046
+ },
2047
+ {
2048
+ "name": "validatorBondClosed";
2049
+ "type": {
2050
+ "kind": "struct";
2051
+ "fields": [
2052
+ {
2053
+ "name": "validator";
2054
+ "type": "pubkey";
2055
+ },
2056
+ {
2057
+ "name": "voteAccount";
2058
+ "type": "pubkey";
2059
+ },
2060
+ {
2061
+ "name": "rentReceiver";
2062
+ "type": "pubkey";
2063
+ },
2064
+ {
2065
+ "name": "finalBalance";
2066
+ "type": "u64";
2067
+ },
2068
+ {
2069
+ "name": "timestamp";
2070
+ "type": "i64";
2071
+ }
2072
+ ];
2073
+ };
2074
+ },
2075
+ {
2076
+ "name": "validatorRegistered";
2077
+ "type": {
2078
+ "kind": "struct";
2079
+ "fields": [
2080
+ {
2081
+ "name": "validator";
2082
+ "type": "pubkey";
2083
+ },
2084
+ {
2085
+ "name": "voteAccount";
2086
+ "type": "pubkey";
1559
2087
  },
1560
2088
  {
1561
- name: 'bump';
1562
- type: 'u8';
2089
+ "name": "timestamp";
2090
+ "type": "i64";
1563
2091
  }
1564
2092
  ];
1565
2093
  };
1566
2094
  },
1567
2095
  {
1568
- name: 'validatorRegistered';
1569
- type: {
1570
- kind: 'struct';
1571
- fields: [
2096
+ "name": "withdrawAuthorityChanged";
2097
+ "type": {
2098
+ "kind": "struct";
2099
+ "fields": [
1572
2100
  {
1573
- name: 'identity';
1574
- type: 'pubkey';
2101
+ "name": "validator";
2102
+ "type": "pubkey";
1575
2103
  },
1576
2104
  {
1577
- name: 'voteAccount';
1578
- type: 'pubkey';
2105
+ "name": "oldAuthority";
2106
+ "type": {
2107
+ "option": "pubkey";
2108
+ };
1579
2109
  },
1580
2110
  {
1581
- name: 'timestamp';
1582
- type: 'i64';
2111
+ "name": "newAuthority";
2112
+ "type": {
2113
+ "option": "pubkey";
2114
+ };
1583
2115
  }
1584
2116
  ];
1585
2117
  };
1586
2118
  }
1587
2119
  ];
1588
- constants: [
2120
+ "constants": [
1589
2121
  {
1590
- name: 'epochLockedSlotTail';
1591
- docs: [
1592
- 'Epoch slot index at the end of an epoch after which withdrawals are locked'
2122
+ "name": "epochLockedSlotTail";
2123
+ "docs": [
2124
+ "Epoch slot index at the end of an epoch after which withdrawals are locked"
1593
2125
  ];
1594
- type: 'u64';
1595
- value: '420000';
2126
+ "type": "u64";
2127
+ "value": "420000";
1596
2128
  }
1597
2129
  ];
1598
2130
  };
1599
2131
 
2132
+ /**
2133
+ * Enum for different client environments.
2134
+ */
2135
+ declare enum JBondClientEnv {
2136
+ DEV = "dev",
2137
+ STAGE = "stage",
2138
+ PROD = "prod"
2139
+ }
1600
2140
  type GlobalState = IdlAccounts<Jbond>['globalState'];
1601
2141
  type BondState = IdlAccounts<Jbond>['bondState'];
1602
2142
  type ValidatorBond = IdlAccounts<Jbond>['validatorBond'];
@@ -1611,6 +2151,7 @@ declare enum BondType {
1611
2151
  Crowdfunding = "crowdfunding"
1612
2152
  }
1613
2153
  declare enum BondTransactionType {
2154
+ Registered = "registered",
1614
2155
  Deposit = "deposit",
1615
2156
  Withdrawal = "withdrawal",
1616
2157
  Compensation = "compensation"
@@ -1643,6 +2184,7 @@ type TopUpCollateralProps = {
1643
2184
  identity: PublicKey;
1644
2185
  voteAccount: PublicKey;
1645
2186
  amount: number;
2187
+ solUsage?: boolean;
1646
2188
  collateralType?: CollateralType;
1647
2189
  payer?: PublicKey;
1648
2190
  };
@@ -1655,6 +2197,17 @@ type WithdrawCollateralProps = {
1655
2197
  destination?: PublicKey;
1656
2198
  withdrawalAuthority?: PublicKey;
1657
2199
  };
2200
+ type MigrateBondProps = {
2201
+ bondType: BondType;
2202
+ voteAccount: PublicKey;
2203
+ identity: PublicKey;
2204
+ withdrawName?: string;
2205
+ topUpName?: string;
2206
+ payer?: PublicKey;
2207
+ destination?: PublicKey;
2208
+ withdrawalAuthority?: PublicKey;
2209
+ stakePoolAddress?: PublicKey;
2210
+ };
1658
2211
  type ClaimProps = {
1659
2212
  bondType: BondType;
1660
2213
  name: string;
@@ -1664,6 +2217,28 @@ type ClaimProps = {
1664
2217
  reserve?: PublicKey;
1665
2218
  authority?: PublicKey;
1666
2219
  };
2220
+ type BondLockFunds = {
2221
+ bondType: BondType;
2222
+ name: string;
2223
+ amount: number;
2224
+ withdrawAuthority: PublicKey;
2225
+ voteAccount: PublicKey;
2226
+ collateralType?: CollateralType;
2227
+ };
2228
+ type BondReleaseFunds = {
2229
+ bondType: BondType;
2230
+ name: string;
2231
+ amount: number;
2232
+ withdrawAuthority: PublicKey;
2233
+ voteAccount: PublicKey;
2234
+ };
2235
+ type ClaimAllProps = {
2236
+ bondType: BondType;
2237
+ name: string;
2238
+ collateralType?: CollateralType;
2239
+ reserve?: PublicKey;
2240
+ authority?: PublicKey;
2241
+ };
1667
2242
  type GetHistoryProps = {
1668
2243
  voteAccount: PublicKey;
1669
2244
  options?: {
@@ -1718,22 +2293,41 @@ type BondFinishProps = {
1718
2293
  bondType: BondType;
1719
2294
  name: string;
1720
2295
  };
2296
+ type BondRemoveProps = {
2297
+ bondType: BondType;
2298
+ name: string;
2299
+ authority?: PublicKey;
2300
+ };
2301
+ type CloseValidatorBondProps = {
2302
+ bondType: BondType;
2303
+ name: string;
2304
+ voteAccount: PublicKey;
2305
+ rentReceiver?: PublicKey;
2306
+ collateralType?: CollateralType;
2307
+ authority?: PublicKey;
2308
+ };
1721
2309
 
1722
2310
  type GetHistoryOpts = {
1723
2311
  cluster?: Cluster;
1724
2312
  limit?: number;
1725
2313
  before?: string;
1726
2314
  until?: string;
2315
+ /**
2316
+ * Number of transactions fetched per JSON-RPC batch request.
2317
+ * @default 50
2318
+ */
2319
+ batchSize?: number;
1727
2320
  };
1728
2321
  declare class HistoryManager {
1729
2322
  readonly client: JBondClient;
1730
2323
  private discCache;
1731
2324
  constructor(client: JBondClient);
1732
2325
  get program(): _coral_xyz_anchor.Program<Jbond>;
1733
- get programId(): any;
2326
+ get programId(): PublicKey;
1734
2327
  get connection(): _solana_web3_js.Connection;
1735
2328
  debug(...args: any[]): void;
1736
2329
  getHistory(bondType: BondType, bondName: string, vote: PublicKeyInitData, opts?: GetHistoryOpts): Promise<TransactionHistoryItem[]>;
2330
+ private instructionReferencesBondAccount;
1737
2331
  private fetchSignaturesForAddress;
1738
2332
  private fetchParsedTransactions;
1739
2333
  private getInstructionDiscriminator;
@@ -1754,24 +2348,21 @@ declare class NodeWallet implements Wallet {
1754
2348
  get publicKey(): PublicKey;
1755
2349
  }
1756
2350
 
1757
- /**
1758
- * Enum for different client environments.
1759
- */
1760
- declare enum JBondClientEnv {
1761
- DEV = "dev",
1762
- STAGE = "stage",
1763
- PROD = "prod"
1764
- }
2351
+ declare function lamportsToSol(lamports: number | BN): number;
2352
+
1765
2353
  /**
1766
2354
  * Options for configuring the JBondClient.
1767
2355
  */
1768
2356
  type JBondClientOptions = {
1769
2357
  debug?: boolean;
1770
2358
  } & Record<string, any>;
2359
+ type GetAllBondStatesOptions = {
2360
+ includeStats?: boolean;
2361
+ };
1771
2362
  declare class JBondClient {
1772
2363
  readonly provider: Provider;
1773
2364
  readonly options: JBondClientOptions;
1774
- readonly program: Program<Jbond>;
2365
+ private _program;
1775
2366
  constructor(provider: Provider, options?: JBondClientOptions);
1776
2367
  get history(): HistoryManager;
1777
2368
  /**
@@ -1786,10 +2377,14 @@ declare class JBondClient {
1786
2377
  * Creates an instance of `JBondClient` using the provided connection and keypair.
1787
2378
  */
1788
2379
  static fromKeypair(connection: Connection, keypair: Keypair, options?: JBondClientOptions): JBondClient;
2380
+ /**
2381
+ * Get or create the program instance
2382
+ */
2383
+ get program(): Program<Jbond>;
1789
2384
  /**
1790
2385
  * Get the current program ID.
1791
2386
  */
1792
- get programId(): any;
2387
+ get programId(): PublicKey;
1793
2388
  /**
1794
2389
  * Get the current connection.
1795
2390
  */
@@ -1836,7 +2431,11 @@ declare class JBondClient {
1836
2431
  */
1837
2432
  withdrawCollateral(props: WithdrawCollateralProps): Promise<string | undefined>;
1838
2433
  /**
1839
- * Claim compensation
2434
+ * Migrate SOL collateral from one bond account to JSOL collateral in another bond account
2435
+ */
2436
+ migrateBond(props: MigrateBondProps): Promise<string | undefined>;
2437
+ /**
2438
+ * Claim compensation for a validator
1840
2439
  */
1841
2440
  claimCompensation(props: ClaimProps): Promise<string | undefined>;
1842
2441
  /**
@@ -1859,6 +2458,8 @@ declare class JBondClient {
1859
2458
  * Finish crowdfunding bond session
1860
2459
  */
1861
2460
  bondFinish(props: BondFinishProps): Promise<string | undefined>;
2461
+ bondRemove(props: BondRemoveProps): Promise<string | undefined>;
2462
+ closeValidatorBond(props: CloseValidatorBondProps): Promise<string | undefined>;
1862
2463
  /**
1863
2464
  * Build global state initialize instruction
1864
2465
  */
@@ -1882,15 +2483,34 @@ declare class JBondClient {
1882
2483
  /**
1883
2484
  * Build top up collateral instructions
1884
2485
  */
1885
- getTopUpIxs(props: TopUpCollateralProps): Promise<TransactionInstruction[]>;
2486
+ getTopUpIxs(props: TopUpCollateralProps): Promise<{
2487
+ instructions: TransactionInstruction[];
2488
+ signers: Signer[];
2489
+ }>;
1886
2490
  /**
1887
2491
  * Build withdraw collateral instruction
1888
2492
  */
1889
2493
  getWithdrawIx(props: WithdrawCollateralProps): Promise<TransactionInstruction>;
2494
+ /**
2495
+ * Build instructions for migrating SOL bond collateral into JSOL bond collateral in a single transaction
2496
+ */
2497
+ getMigrateBondIx(props: MigrateBondProps): Promise<{
2498
+ instructions: TransactionInstruction[];
2499
+ signers: Signer[];
2500
+ }>;
2501
+ /**
2502
+ * Build stake-pool SOL deposit instructions without pre-checking payer balance.
2503
+ * This allows composing withdraw->deposit in a single transaction where SOL is obtained by the prior instruction.
2504
+ */
2505
+ private getDepositSolIxsWithoutBalanceCheck;
1890
2506
  /**
1891
2507
  * Build claim instruction
1892
2508
  */
1893
2509
  getClaimIx(props: ClaimProps): Promise<TransactionInstruction>;
2510
+ /**
2511
+ * Build claim all compensations instructions
2512
+ */
2513
+ getClaimAllCompensationsIxs(props: ClaimAllProps): Promise<TransactionInstruction[]>;
1894
2514
  /**
1895
2515
  * Build set withdraw authority instruction
1896
2516
  */
@@ -1903,10 +2523,88 @@ declare class JBondClient {
1903
2523
  * Build start crowdfunding session instruction
1904
2524
  */
1905
2525
  getBondSessionStartIx(props: BondStartProps): Promise<TransactionInstruction>;
2526
+ lockFunds(props: BondLockFunds): Promise<string | undefined>;
2527
+ releaseFunds(props: BondReleaseFunds): Promise<string | undefined>;
2528
+ /**
2529
+ * Build bond remove instruction
2530
+ */
2531
+ getBondRemoveIx(props: BondRemoveProps): Promise<TransactionInstruction>;
2532
+ /**
2533
+ * Build close validator bond instruction
2534
+ */
2535
+ getCloseValidatorBondIx(props: CloseValidatorBondProps): Promise<TransactionInstruction>;
2536
+ /**
2537
+ * Build test set last update epoch instruction
2538
+ * NOTE!: This instruction is for testing purposes only.
2539
+ * It allows direct manipulation of the validator bond's last epoch update.
2540
+ * This should not be used in production environments.
2541
+ */
2542
+ /**
2543
+ * Build lock funds instruction
2544
+ */
2545
+ getLockFundsIx(props: BondLockFunds): Promise<TransactionInstruction>;
2546
+ /**
2547
+ * Build release funds instruction
2548
+ */
2549
+ getReleaseFundsIx(props: BondReleaseFunds): Promise<TransactionInstruction>;
2550
+ /**
2551
+ * Get available collateral for withdrawal (taking into account locked funds)
2552
+ */
2553
+ getAvailableCollateral(bondType: BondType, bondName: string, voteAccount: PublicKeyInitData): Promise<number>;
1906
2554
  /**
1907
2555
  * Get all bond states with total collected collateral
1908
2556
  */
1909
- getAllBondStates(bondType: BondType, sessionStatus?: SessionStatus): Promise<{
2557
+ getAllBondStates(bondType: BondType, sessionStatus?: SessionStatus, options?: GetAllBondStatesOptions): Promise<{
2558
+ publicKey: PublicKey;
2559
+ bondState: {
2560
+ name: string;
2561
+ bondType: ({
2562
+ crowdfunding?: undefined;
2563
+ } & {
2564
+ standard: Record<string, never>;
2565
+ }) | ({
2566
+ standard?: undefined;
2567
+ } & {
2568
+ crowdfunding: Record<string, never>;
2569
+ });
2570
+ collateralType: ({
2571
+ native?: undefined;
2572
+ token?: undefined;
2573
+ } & {
2574
+ stakeAccount: Record<string, never>;
2575
+ }) | ({
2576
+ stakeAccount?: undefined;
2577
+ token?: undefined;
2578
+ } & {
2579
+ native: Record<string, never>;
2580
+ }) | ({
2581
+ stakeAccount?: undefined;
2582
+ native?: undefined;
2583
+ } & {
2584
+ token: {
2585
+ 0: PublicKey;
2586
+ };
2587
+ });
2588
+ reserve: PublicKey;
2589
+ authority: PublicKey;
2590
+ sessionId: number;
2591
+ totalMembers: number;
2592
+ totalCompensationAmount: bn_js;
2593
+ sessionStartTs: bn_js;
2594
+ sessionFinishTs: bn_js;
2595
+ status: ({
2596
+ disabled?: undefined;
2597
+ } & {
2598
+ active: Record<string, never>;
2599
+ }) | ({
2600
+ active?: undefined;
2601
+ } & {
2602
+ disabled: Record<string, never>;
2603
+ });
2604
+ bump: number;
2605
+ };
2606
+ stateStats: null;
2607
+ }[] | {
1910
2608
  publicKey: PublicKey;
1911
2609
  bondState: {
1912
2610
  name: string;
@@ -1956,7 +2654,7 @@ declare class JBondClient {
1956
2654
  bump: number;
1957
2655
  };
1958
2656
  stateStats: {
1959
- totalCollected: unknown;
2657
+ totalCollected: number;
1960
2658
  status: SessionStatus;
1961
2659
  };
1962
2660
  }[]>;
@@ -2020,7 +2718,7 @@ declare class JBondClient {
2020
2718
  publicKey: PublicKey;
2021
2719
  }>;
2022
2720
  /**
2023
- * Fetch validator bond data or null if not found
2721
+ * Fetch validator bond data or error if not found
2024
2722
  */
2025
2723
  getValidatorBond(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<{
2026
2724
  state: PublicKey;
@@ -2030,27 +2728,55 @@ declare class JBondClient {
2030
2728
  withdrawalAuthority: PublicKey | null;
2031
2729
  createdAt: bn_js;
2032
2730
  bump: number;
2731
+ locked: bn_js;
2732
+ pendingUnlock: bn_js;
2733
+ pendingUnlockEpoch: bn_js;
2033
2734
  publicKey: PublicKey;
2034
2735
  }>;
2035
2736
  /**
2036
- * Get validator bond account balance, in the collateral's base units
2037
- * (lamports for native bonds, token base units for token bonds).
2737
+ * Fetch validator bond data or null if not found
2738
+ */
2739
+ getValidatorBondNullable(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<{
2740
+ state: PublicKey;
2741
+ identity: PublicKey;
2742
+ voteAccount: PublicKey;
2743
+ creator: PublicKey;
2744
+ withdrawalAuthority: PublicKey | null;
2745
+ createdAt: bn_js;
2746
+ bump: number;
2747
+ locked: bn_js;
2748
+ pendingUnlock: bn_js;
2749
+ pendingUnlockEpoch: bn_js;
2750
+ publicKey: PublicKey;
2751
+ } | null>;
2752
+ /**
2753
+ * Get validator bond account balance (in SOL)
2038
2754
  */
2039
2755
  getValidatorBondBalance(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<number>;
2756
+ getBondStateValidatorBondBalances(bondType: BondType, bondName: string, bondState?: BondState): Promise<{
2757
+ voteAccount: PublicKey;
2758
+ balance: number;
2759
+ }[]>;
2040
2760
  /**
2041
2761
  * Get total collected collateral for a bond state
2042
2762
  */
2043
- getBondStateTotalCollected(bondType: BondType, bondName: string, votes: PublicKeyInitData[]): Promise<unknown>;
2763
+ getBondStateTotalCollected(bondType: BondType, bondName: string, bondState?: BondState): Promise<number>;
2044
2764
  /**
2045
2765
  * Get bond state stats
2046
2766
  * @param state
2047
- * @private
2048
2767
  */
2049
- private getBondStateStats;
2768
+ getBondStateStats(state: BondState): Promise<{
2769
+ totalCollected: number;
2770
+ status: SessionStatus;
2771
+ }>;
2772
+ /**
2773
+ * Get validator bond rent exempt amount
2774
+ */
2775
+ private validatorBondRentExempt;
2050
2776
  /**
2051
2777
  * Get all validator bonds for a given bond state
2052
2778
  */
2053
- private getBondValidatorStates;
2779
+ private getValidatorBondsForState;
2054
2780
  /**
2055
2781
  * Get session status for bond state
2056
2782
  */
@@ -2065,6 +2791,8 @@ declare const CROWDFUNDING_BOND_SEED = "crowdfunding";
2065
2791
  /**
2066
2792
  * Program IDs for different environments
2067
2793
  */
2068
- declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
2794
+ declare const ENV_PROGRAM_ID: Record<JBondClientEnv, string>;
2795
+ declare const JSOL_MINT: PublicKey;
2796
+ declare const JPOOL_POOL_ADDRESS: PublicKey;
2069
2797
 
2070
- export { BOND_STATE_SEED, type BondConfigureProps, type BondFinishProps, type BondInitializeProps, type BondStartProps, type BondState, type BondStateStats, type BondStateStatus, BondTransactionType, BondType, CROWDFUNDING_BOND_SEED, type ClaimProps, type CollateralType, ENV_PROGRAM_ID, type EpochHistoryItem, GLOBAL_STATE_SEED, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalConfigureProps, type GlobalInitializeProps, type GlobalState, JBondClient, JBondClientEnv, type JBondClientOptions, type Jbond, NodeWallet, type RegisterValidatorProps, STANDARD_BOND_SEED, SessionStatus, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, VALIDATOR_BOND_SEED, type ValidatorBond, type WithdrawCollateralProps };
2798
+ export { BOND_STATE_SEED, type BondConfigureProps, type BondFinishProps, type BondInitializeProps, type BondLockFunds, type BondReleaseFunds, type BondRemoveProps, type BondStartProps, type BondState, type BondStateStats, type BondStateStatus, BondTransactionType, BondType, CROWDFUNDING_BOND_SEED, type ClaimAllProps, type ClaimProps, type CloseValidatorBondProps, type CollateralType, ENV_PROGRAM_ID, type EpochHistoryItem, GLOBAL_STATE_SEED, type GetAllBondStatesOptions, type GetHistoryGroupedProps, type GetHistoryProps, type GlobalConfigureProps, type GlobalInitializeProps, type GlobalState, JBondClient, JBondClientEnv, type JBondClientOptions, JPOOL_POOL_ADDRESS, JSOL_MINT, type Jbond, type MigrateBondProps, NodeWallet, type RegisterValidatorProps, STANDARD_BOND_SEED, SessionStatus, type SetWithdrawAuthorityProps, type TopUpCollateralProps, type TransactionHistoryItem, VALIDATOR_BOND_SEED, type ValidatorBond, type WithdrawCollateralProps, lamportsToSol };