@jpool/bond-sdk 0.11.6 → 0.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,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, BN, Provider, Program } from '@coral-xyz/anchor';
3
+ import { IdlTypes, IdlAccounts, 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, Signer } from '@solana/web3.js';
5
+ import { PublicKey, PublicKeyInitData, Cluster, Transaction, VersionedTransaction, Keypair, Connection, TransactionInstruction } 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.6";
18
- "spec": "0.1.0";
19
- "description": "Jpool Bond Program";
14
+ address: 'BondQ7KqZreTcW2UbeTNDcLCJQ3aXAtLn2Fm6ftaJDU';
15
+ metadata: {
16
+ name: 'jbond';
17
+ version: '0.2.1';
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,71 +72,68 @@ 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;
93
- "relations": [
94
- "bondState"
95
- ];
91
+ name: 'authority';
92
+ signer: true;
96
93
  },
97
94
  {
98
- "name": "bondTokenAccount";
99
- "writable": true;
100
- "optional": true;
95
+ name: 'bondTokenAccount';
96
+ writable: true;
97
+ optional: true;
101
98
  },
102
99
  {
103
- "name": "reserveTokenAccount";
104
- "writable": true;
105
- "optional": true;
100
+ name: 'reserveTokenAccount';
101
+ writable: true;
102
+ optional: true;
106
103
  },
107
104
  {
108
- "name": "stakeAccount";
109
- "writable": true;
110
- "optional": true;
105
+ name: 'stakeAccount';
106
+ writable: true;
107
+ optional: true;
111
108
  },
112
109
  {
113
- "name": "systemProgram";
114
- "address": "11111111111111111111111111111111";
110
+ name: 'systemProgram';
111
+ address: '11111111111111111111111111111111';
115
112
  },
116
113
  {
117
- "name": "tokenProgram";
118
- "optional": true;
119
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
114
+ name: 'tokenProgram';
115
+ optional: true;
116
+ address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
120
117
  },
121
118
  {
122
- "name": "stakeProgram";
123
- "optional": true;
119
+ name: 'stakeProgram';
120
+ optional: true;
124
121
  }
125
122
  ];
126
- "args": [
123
+ args: [
127
124
  {
128
- "name": "amount";
129
- "type": "u64";
125
+ name: 'amount';
126
+ type: 'u64';
130
127
  }
131
128
  ];
132
129
  },
133
130
  {
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."
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.'
138
135
  ];
139
- "discriminator": [
136
+ discriminator: [
140
137
  61,
141
138
  42,
142
139
  106,
@@ -146,41 +143,41 @@ type Jbond = {
146
143
  65,
147
144
  20
148
145
  ];
149
- "accounts": [
146
+ accounts: [
150
147
  {
151
- "name": "bondState";
152
- "writable": true;
148
+ name: 'bondState';
149
+ writable: true;
153
150
  },
154
151
  {
155
- "name": "authority";
156
- "signer": true;
157
- "relations": [
158
- "bondState"
152
+ name: 'authority';
153
+ signer: true;
154
+ relations: [
155
+ 'bondState'
159
156
  ];
160
157
  }
161
158
  ];
162
- "args": [
159
+ args: [
163
160
  {
164
- "name": "data";
165
- "type": {
166
- "defined": {
167
- "name": "bondConfigureData";
161
+ name: 'data';
162
+ type: {
163
+ defined: {
164
+ name: 'bondConfigureData';
168
165
  };
169
166
  };
170
167
  }
171
168
  ];
172
169
  },
173
170
  {
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."
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.'
182
179
  ];
183
- "discriminator": [
180
+ discriminator: [
184
181
  230,
185
182
  3,
186
183
  121,
@@ -190,15 +187,15 @@ type Jbond = {
190
187
  175,
191
188
  210
192
189
  ];
193
- "accounts": [
190
+ accounts: [
194
191
  {
195
- "name": "bondState";
196
- "writable": true;
197
- "pda": {
198
- "seeds": [
192
+ name: 'bondState';
193
+ writable: true;
194
+ pda: {
195
+ seeds: [
199
196
  {
200
- "kind": "const";
201
- "value": [
197
+ kind: 'const';
198
+ value: [
202
199
  98,
203
200
  111,
204
201
  110,
@@ -212,150 +209,72 @@ type Jbond = {
212
209
  ];
213
210
  },
214
211
  {
215
- "kind": "arg";
216
- "path": "data.bond_type";
212
+ kind: 'arg';
213
+ path: 'data.bond_type';
217
214
  },
218
215
  {
219
- "kind": "arg";
220
- "path": "data.name";
216
+ kind: 'arg';
217
+ path: 'data.name';
221
218
  }
222
219
  ];
223
220
  };
224
221
  },
225
222
  {
226
- "name": "authority";
227
- "writable": true;
228
- "signer": true;
223
+ name: 'authority';
224
+ writable: true;
225
+ signer: true;
229
226
  },
230
227
  {
231
- "name": "reserve";
228
+ name: 'reserve';
232
229
  },
233
230
  {
234
- "name": "associatedTokenProgram";
235
- "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
231
+ name: 'associatedTokenProgram';
232
+ address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
236
233
  },
237
234
  {
238
- "name": "systemProgram";
239
- "address": "11111111111111111111111111111111";
235
+ name: 'systemProgram';
236
+ address: '11111111111111111111111111111111';
240
237
  },
241
238
  {
242
- "name": "tokenProgram";
243
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
239
+ name: 'tokenProgram';
240
+ address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
244
241
  },
245
242
  {
246
- "name": "reserveTokenAccount";
247
- "writable": true;
248
- "optional": true;
243
+ name: 'reserveTokenAccount';
244
+ writable: true;
245
+ optional: true;
249
246
  },
250
247
  {
251
- "name": "mint";
252
- "optional": true;
248
+ name: 'mint';
249
+ optional: true;
253
250
  }
254
251
  ];
255
- "args": [
252
+ args: [
256
253
  {
257
- "name": "data";
258
- "type": {
259
- "defined": {
260
- "name": "bondInitializeData";
254
+ name: 'data';
255
+ type: {
256
+ defined: {
257
+ name: 'bondInitializeData';
261
258
  };
262
259
  };
263
260
  }
264
261
  ];
265
262
  },
266
263
  {
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."
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.'
275
276
  ];
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."
357
- ];
358
- "discriminator": [
277
+ discriminator: [
359
278
  117,
360
279
  127,
361
280
  78,
@@ -365,46 +284,19 @@ type Jbond = {
365
284
  163,
366
285
  83
367
286
  ];
368
- "accounts": [
287
+ accounts: [
369
288
  {
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
- };
289
+ name: 'bondState';
290
+ writable: true;
399
291
  },
400
292
  {
401
- "name": "validatorBond";
402
- "writable": true;
403
- "pda": {
404
- "seeds": [
293
+ name: 'validatorBond';
294
+ writable: true;
295
+ pda: {
296
+ seeds: [
405
297
  {
406
- "kind": "const";
407
- "value": [
298
+ kind: 'const';
299
+ value: [
408
300
  118,
409
301
  97,
410
302
  108,
@@ -422,184 +314,78 @@ type Jbond = {
422
314
  ];
423
315
  },
424
316
  {
425
- "kind": "account";
426
- "path": "bondState";
317
+ kind: 'account';
318
+ path: 'bondState';
427
319
  },
428
320
  {
429
- "kind": "account";
430
- "path": "voteAccount";
321
+ kind: 'account';
322
+ path: 'voteAccount';
431
323
  }
432
324
  ];
433
325
  };
434
326
  },
435
327
  {
436
- "name": "identity";
328
+ name: 'identity';
437
329
  },
438
330
  {
439
- "name": "voteAccount";
331
+ name: 'voteAccount';
440
332
  },
441
333
  {
442
- "name": "creator";
443
- "writable": true;
444
- "signer": true;
334
+ name: 'creator';
335
+ writable: true;
336
+ signer: true;
445
337
  },
446
338
  {
447
- "name": "systemProgram";
448
- "address": "11111111111111111111111111111111";
339
+ name: 'systemProgram';
340
+ address: '11111111111111111111111111111111';
449
341
  },
450
342
  {
451
- "name": "tokenProgram";
452
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
343
+ name: 'tokenProgram';
344
+ address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
453
345
  },
454
346
  {
455
- "name": "associatedTokenProgram";
456
- "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
347
+ name: 'associatedTokenProgram';
348
+ address: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
457
349
  },
458
350
  {
459
- "name": "bondTokenAccount";
460
- "writable": true;
461
- "optional": true;
351
+ name: 'bondTokenAccount';
352
+ writable: true;
353
+ optional: true;
462
354
  },
463
355
  {
464
- "name": "mint";
465
- "optional": true;
356
+ name: 'mint';
357
+ optional: true;
466
358
  }
467
359
  ];
468
- "args": [
360
+ args: [
469
361
  {
470
- "name": "bondType";
471
- "type": {
472
- "defined": {
473
- "name": "bondType";
362
+ name: 'bondType';
363
+ type: {
364
+ defined: {
365
+ name: 'bondType';
474
366
  };
475
367
  };
476
368
  },
477
369
  {
478
- "name": "bondName";
479
- "type": "string";
480
- }
481
- ];
482
- },
483
- {
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
503
- ];
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";
370
+ name: 'bondName';
371
+ type: 'string';
555
372
  }
556
373
  ];
557
374
  },
558
375
  {
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
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.'
572
387
  ];
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": [
388
+ discriminator: [
603
389
  212,
604
390
  162,
605
391
  53,
@@ -609,18 +395,18 @@ type Jbond = {
609
395
  61,
610
396
  166
611
397
  ];
612
- "accounts": [
398
+ accounts: [
613
399
  {
614
- "name": "bondState";
400
+ name: 'bondState';
615
401
  },
616
402
  {
617
- "name": "validatorBond";
618
- "writable": true;
619
- "pda": {
620
- "seeds": [
403
+ name: 'validatorBond';
404
+ writable: true;
405
+ pda: {
406
+ seeds: [
621
407
  {
622
- "kind": "const";
623
- "value": [
408
+ kind: 'const';
409
+ value: [
624
410
  118,
625
411
  97,
626
412
  108,
@@ -638,42 +424,42 @@ type Jbond = {
638
424
  ];
639
425
  },
640
426
  {
641
- "kind": "account";
642
- "path": "bondState";
427
+ kind: 'account';
428
+ path: 'bondState';
643
429
  },
644
430
  {
645
- "kind": "account";
646
- "path": "validator_bond.vote_account";
647
- "account": "validatorBond";
431
+ kind: 'account';
432
+ path: 'validator_bond.vote_account';
433
+ account: 'validatorBond';
648
434
  }
649
435
  ];
650
436
  };
651
437
  },
652
438
  {
653
- "name": "identity";
654
- "signer": true;
439
+ name: 'identity';
440
+ signer: true;
655
441
  },
656
442
  {
657
- "name": "newWithdrawAuthority";
658
- "optional": true;
443
+ name: 'newWithdrawAuthority';
444
+ optional: true;
659
445
  }
660
446
  ];
661
- "args": [];
447
+ args: [];
662
448
  },
663
449
  {
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."
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.'
675
461
  ];
676
- "discriminator": [
462
+ discriminator: [
677
463
  132,
678
464
  225,
679
465
  254,
@@ -683,19 +469,19 @@ type Jbond = {
683
469
  176,
684
470
  66
685
471
  ];
686
- "accounts": [
472
+ accounts: [
687
473
  {
688
- "name": "bondState";
689
- "writable": true;
474
+ name: 'bondState';
475
+ writable: true;
690
476
  },
691
477
  {
692
- "name": "validatorBond";
693
- "writable": true;
694
- "pda": {
695
- "seeds": [
478
+ name: 'validatorBond';
479
+ writable: true;
480
+ pda: {
481
+ seeds: [
696
482
  {
697
- "kind": "const";
698
- "value": [
483
+ kind: 'const';
484
+ value: [
699
485
  118,
700
486
  97,
701
487
  108,
@@ -713,73 +499,73 @@ type Jbond = {
713
499
  ];
714
500
  },
715
501
  {
716
- "kind": "account";
717
- "path": "bondState";
502
+ kind: 'account';
503
+ path: 'bondState';
718
504
  },
719
505
  {
720
- "kind": "account";
721
- "path": "validator_bond.vote_account";
722
- "account": "validatorBond";
506
+ kind: 'account';
507
+ path: 'validator_bond.vote_account';
508
+ account: 'validatorBond';
723
509
  }
724
510
  ];
725
511
  };
726
512
  },
727
513
  {
728
- "name": "payer";
729
- "writable": true;
730
- "signer": true;
514
+ name: 'payer';
515
+ writable: true;
516
+ signer: true;
731
517
  },
732
518
  {
733
- "name": "payerTokenAccount";
734
- "writable": true;
735
- "optional": true;
519
+ name: 'payerTokenAccount';
520
+ writable: true;
521
+ optional: true;
736
522
  },
737
523
  {
738
- "name": "bondTokenAccount";
739
- "writable": true;
740
- "optional": true;
524
+ name: 'bondTokenAccount';
525
+ writable: true;
526
+ optional: true;
741
527
  },
742
528
  {
743
- "name": "stakeAccount";
744
- "writable": true;
745
- "optional": true;
529
+ name: 'stakeAccount';
530
+ writable: true;
531
+ optional: true;
746
532
  },
747
533
  {
748
- "name": "systemProgram";
749
- "address": "11111111111111111111111111111111";
534
+ name: 'systemProgram';
535
+ address: '11111111111111111111111111111111';
750
536
  },
751
537
  {
752
- "name": "tokenProgram";
753
- "optional": true;
754
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
538
+ name: 'tokenProgram';
539
+ optional: true;
540
+ address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
755
541
  },
756
542
  {
757
- "name": "stakeProgram";
758
- "optional": true;
543
+ name: 'stakeProgram';
544
+ optional: true;
759
545
  }
760
546
  ];
761
- "args": [
547
+ args: [
762
548
  {
763
- "name": "amount";
764
- "type": "u64";
549
+ name: 'amount';
550
+ type: 'u64';
765
551
  }
766
552
  ];
767
553
  },
768
554
  {
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."
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.'
781
567
  ];
782
- "discriminator": [
568
+ discriminator: [
783
569
  99,
784
570
  64,
785
571
  127,
@@ -789,19 +575,19 @@ type Jbond = {
789
575
  70,
790
576
  204
791
577
  ];
792
- "accounts": [
578
+ accounts: [
793
579
  {
794
- "name": "bondState";
795
- "writable": true;
580
+ name: 'bondState';
581
+ writable: true;
796
582
  },
797
583
  {
798
- "name": "validatorBond";
799
- "writable": true;
800
- "pda": {
801
- "seeds": [
584
+ name: 'validatorBond';
585
+ writable: true;
586
+ pda: {
587
+ seeds: [
802
588
  {
803
- "kind": "const";
804
- "value": [
589
+ kind: 'const';
590
+ value: [
805
591
  118,
806
592
  97,
807
593
  108,
@@ -819,162 +605,65 @@ type Jbond = {
819
605
  ];
820
606
  },
821
607
  {
822
- "kind": "account";
823
- "path": "bondState";
608
+ kind: 'account';
609
+ path: 'bondState';
824
610
  },
825
611
  {
826
- "kind": "account";
827
- "path": "validator_bond.vote_account";
828
- "account": "validatorBond";
612
+ kind: 'account';
613
+ path: 'validator_bond.vote_account';
614
+ account: 'validatorBond';
829
615
  }
830
616
  ];
831
617
  };
832
618
  },
833
619
  {
834
- "name": "withdrawalAuthority";
835
- "writable": true;
836
- "signer": true;
620
+ name: 'withdrawalAuthority';
621
+ writable: true;
622
+ signer: true;
837
623
  },
838
624
  {
839
- "name": "destination";
840
- "writable": true;
625
+ name: 'destination';
626
+ writable: true;
841
627
  },
842
628
  {
843
- "name": "destinationTokenAccount";
844
- "writable": true;
845
- "optional": true;
629
+ name: 'destinationTokenAccount';
630
+ writable: true;
631
+ optional: true;
846
632
  },
847
633
  {
848
- "name": "bondTokenAccount";
849
- "writable": true;
850
- "optional": true;
634
+ name: 'bondTokenAccount';
635
+ writable: true;
636
+ optional: true;
851
637
  },
852
638
  {
853
- "name": "stakeAccount";
854
- "writable": true;
855
- "optional": true;
639
+ name: 'stakeAccount';
640
+ writable: true;
641
+ optional: true;
856
642
  },
857
643
  {
858
- "name": "systemProgram";
859
- "address": "11111111111111111111111111111111";
644
+ name: 'systemProgram';
645
+ address: '11111111111111111111111111111111';
860
646
  },
861
647
  {
862
- "name": "tokenProgram";
863
- "optional": true;
864
- "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
648
+ name: 'tokenProgram';
649
+ optional: true;
650
+ address: 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
865
651
  },
866
652
  {
867
- "name": "stakeProgram";
868
- "optional": true;
653
+ name: 'stakeProgram';
654
+ optional: true;
869
655
  }
870
656
  ];
871
- "args": [
657
+ args: [
872
658
  {
873
- "name": "amount";
874
- "type": "u64";
659
+ name: 'amount';
660
+ type: 'u64';
875
661
  }
876
662
  ];
877
663
  },
878
664
  {
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": [
665
+ name: 'globalConfigure';
666
+ discriminator: [
978
667
  67,
979
668
  142,
980
669
  164,
@@ -984,15 +673,15 @@ type Jbond = {
984
673
  144,
985
674
  187
986
675
  ];
987
- "accounts": [
676
+ accounts: [
988
677
  {
989
- "name": "globalState";
990
- "writable": true;
991
- "pda": {
992
- "seeds": [
678
+ name: 'globalState';
679
+ writable: true;
680
+ pda: {
681
+ seeds: [
993
682
  {
994
- "kind": "const";
995
- "value": [
683
+ kind: 'const';
684
+ value: [
996
685
  103,
997
686
  108,
998
687
  111,
@@ -1011,27 +700,27 @@ type Jbond = {
1011
700
  };
1012
701
  },
1013
702
  {
1014
- "name": "authority";
1015
- "signer": true;
1016
- "relations": [
1017
- "globalState"
703
+ name: 'authority';
704
+ signer: true;
705
+ relations: [
706
+ 'globalState'
1018
707
  ];
1019
708
  }
1020
709
  ];
1021
- "args": [
710
+ args: [
1022
711
  {
1023
- "name": "data";
1024
- "type": {
1025
- "defined": {
1026
- "name": "globalConfigureData";
712
+ name: 'data';
713
+ type: {
714
+ defined: {
715
+ name: 'globalConfigureData';
1027
716
  };
1028
717
  };
1029
718
  }
1030
719
  ];
1031
720
  },
1032
721
  {
1033
- "name": "globalInitialize";
1034
- "discriminator": [
722
+ name: 'globalInitialize';
723
+ discriminator: [
1035
724
  30,
1036
725
  79,
1037
726
  193,
@@ -1041,15 +730,15 @@ type Jbond = {
1041
730
  223,
1042
731
  196
1043
732
  ];
1044
- "accounts": [
733
+ accounts: [
1045
734
  {
1046
- "name": "globalState";
1047
- "writable": true;
1048
- "pda": {
1049
- "seeds": [
735
+ name: 'globalState';
736
+ writable: true;
737
+ pda: {
738
+ seeds: [
1050
739
  {
1051
- "kind": "const";
1052
- "value": [
740
+ kind: 'const';
741
+ value: [
1053
742
  103,
1054
743
  108,
1055
744
  111,
@@ -1068,23 +757,97 @@ type Jbond = {
1068
757
  };
1069
758
  },
1070
759
  {
1071
- "name": "authority";
1072
- "writable": true;
1073
- "signer": true;
760
+ name: 'authority';
761
+ writable: true;
762
+ signer: true;
1074
763
  },
1075
764
  {
1076
- "name": "systemProgram";
1077
- "address": "11111111111111111111111111111111";
765
+ name: 'systemProgram';
766
+ address: '11111111111111111111111111111111';
1078
767
  }
1079
768
  ];
1080
- "args": [];
769
+ args: [];
1081
770
  },
1082
771
  {
1083
- "name": "sessionFinish";
1084
- "docs": [
1085
- "Finishes a bond, preventing further deposits and withdrawals."
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
1086
785
  ];
1087
- "discriminator": [
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;
837
+ },
838
+ {
839
+ name: 'systemProgram';
840
+ address: '11111111111111111111111111111111';
841
+ }
842
+ ];
843
+ args: [];
844
+ },
845
+ {
846
+ name: 'sessionFinish';
847
+ docs: [
848
+ 'Finishes a bond, preventing further deposits and withdrawals.'
849
+ ];
850
+ discriminator: [
1088
851
  230,
1089
852
  209,
1090
853
  54,
@@ -1094,28 +857,28 @@ type Jbond = {
1094
857
  137,
1095
858
  113
1096
859
  ];
1097
- "accounts": [
860
+ accounts: [
1098
861
  {
1099
- "name": "bondState";
1100
- "writable": true;
862
+ name: 'bondState';
863
+ writable: true;
1101
864
  },
1102
865
  {
1103
- "name": "authority";
1104
- "writable": true;
1105
- "signer": true;
1106
- "relations": [
1107
- "bondState"
866
+ name: 'authority';
867
+ writable: true;
868
+ signer: true;
869
+ relations: [
870
+ 'bondState'
1108
871
  ];
1109
872
  }
1110
873
  ];
1111
- "args": [];
874
+ args: [];
1112
875
  },
1113
876
  {
1114
- "name": "sessionStart";
1115
- "docs": [
1116
- "Starts a paused bond, allowing deposits and withdrawals to resume."
877
+ name: 'sessionStart';
878
+ docs: [
879
+ 'Starts a paused bond, allowing deposits and withdrawals to resume.'
1117
880
  ];
1118
- "discriminator": [
881
+ discriminator: [
1119
882
  132,
1120
883
  93,
1121
884
  83,
@@ -1125,32 +888,32 @@ type Jbond = {
1125
888
  58,
1126
889
  92
1127
890
  ];
1128
- "accounts": [
891
+ accounts: [
1129
892
  {
1130
- "name": "bondState";
1131
- "writable": true;
893
+ name: 'bondState';
894
+ writable: true;
1132
895
  },
1133
896
  {
1134
- "name": "authority";
1135
- "writable": true;
1136
- "signer": true;
1137
- "relations": [
1138
- "bondState"
897
+ name: 'authority';
898
+ writable: true;
899
+ signer: true;
900
+ relations: [
901
+ 'bondState'
1139
902
  ];
1140
903
  }
1141
904
  ];
1142
- "args": [
905
+ args: [
1143
906
  {
1144
- "name": "durationSecs";
1145
- "type": "u64";
907
+ name: 'durationSecs';
908
+ type: 'u64';
1146
909
  }
1147
910
  ];
1148
911
  }
1149
912
  ];
1150
- "accounts": [
913
+ accounts: [
1151
914
  {
1152
- "name": "bondState";
1153
- "discriminator": [
915
+ name: 'bondState';
916
+ discriminator: [
1154
917
  251,
1155
918
  95,
1156
919
  76,
@@ -1162,8 +925,8 @@ type Jbond = {
1162
925
  ];
1163
926
  },
1164
927
  {
1165
- "name": "globalState";
1166
- "discriminator": [
928
+ name: 'globalState';
929
+ discriminator: [
1167
930
  163,
1168
931
  46,
1169
932
  74,
@@ -1175,8 +938,8 @@ type Jbond = {
1175
938
  ];
1176
939
  },
1177
940
  {
1178
- "name": "validatorBond";
1179
- "discriminator": [
941
+ name: 'validatorBond';
942
+ discriminator: [
1180
943
  82,
1181
944
  127,
1182
945
  243,
@@ -1188,23 +951,10 @@ type Jbond = {
1188
951
  ];
1189
952
  }
1190
953
  ];
1191
- "events": [
954
+ events: [
1192
955
  {
1193
- "name": "bondConfigured";
1194
- "discriminator": [
1195
- 141,
1196
- 252,
1197
- 43,
1198
- 54,
1199
- 45,
1200
- 157,
1201
- 81,
1202
- 14
1203
- ];
1204
- },
1205
- {
1206
- "name": "bondFinished";
1207
- "discriminator": [
956
+ name: 'bondFinished';
957
+ discriminator: [
1208
958
  223,
1209
959
  254,
1210
960
  3,
@@ -1216,34 +966,8 @@ type Jbond = {
1216
966
  ];
1217
967
  },
1218
968
  {
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": [
969
+ name: 'bondStarted';
970
+ discriminator: [
1247
971
  235,
1248
972
  69,
1249
973
  80,
@@ -1255,21 +979,21 @@ type Jbond = {
1255
979
  ];
1256
980
  },
1257
981
  {
1258
- "name": "collateralDeposited";
1259
- "discriminator": [
1260
- 244,
1261
- 62,
1262
- 77,
1263
- 11,
982
+ name: 'collateralToppedUp';
983
+ discriminator: [
984
+ 189,
985
+ 137,
986
+ 204,
987
+ 58,
1264
988
  135,
1265
- 112,
1266
- 61,
1267
- 96
989
+ 182,
990
+ 19,
991
+ 176
1268
992
  ];
1269
993
  },
1270
994
  {
1271
- "name": "collateralWithdrawn";
1272
- "discriminator": [
995
+ name: 'collateralWithdrawn';
996
+ discriminator: [
1273
997
  51,
1274
998
  224,
1275
999
  133,
@@ -1281,21 +1005,8 @@ type Jbond = {
1281
1005
  ];
1282
1006
  },
1283
1007
  {
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": [
1008
+ name: 'compensationClaimed';
1009
+ discriminator: [
1299
1010
  36,
1300
1011
  159,
1301
1012
  41,
@@ -1307,47 +1018,8 @@ type Jbond = {
1307
1018
  ];
1308
1019
  },
1309
1020
  {
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": [
1021
+ name: 'validatorRegistered';
1022
+ discriminator: [
1351
1023
  20,
1352
1024
  20,
1353
1025
  190,
@@ -1357,203 +1029,210 @@ type Jbond = {
1357
1029
  95,
1358
1030
  72
1359
1031
  ];
1360
- },
1361
- {
1362
- "name": "withdrawAuthorityChanged";
1363
- "discriminator": [
1364
- 91,
1365
- 149,
1366
- 224,
1367
- 49,
1368
- 187,
1369
- 48,
1370
- 190,
1371
- 100
1372
- ];
1373
1032
  }
1374
1033
  ];
1375
- "errors": [
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
+ },
1045
+ {
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
+ },
1376
1075
  {
1377
- "code": 6000;
1378
- "name": "forbidden";
1379
- "msg": "forbidden";
1076
+ code: 6008;
1077
+ name: 'unauthorized';
1078
+ msg: 'unauthorized';
1380
1079
  },
1381
1080
  {
1382
- "code": 6001;
1383
- "name": "unauthorized";
1384
- "msg": "unauthorized";
1081
+ code: 6009;
1082
+ name: 'withdrawalLockedNearEpochEnd';
1083
+ msg: 'Withdrawals are locked near the end of the epoch.';
1385
1084
  },
1386
1085
  {
1387
- "code": 6002;
1388
- "name": "invalidVoteAccount";
1389
- "msg": "Invalid vote account";
1086
+ code: 6010;
1087
+ name: 'missingTokenAccounts';
1088
+ msg: 'Missing token accounts for token collateral type';
1390
1089
  },
1391
1090
  {
1392
- "code": 6003;
1393
- "name": "identityMismatch";
1394
- "msg": "Vote account identity mismatch";
1091
+ code: 6011;
1092
+ name: 'missingTokenProgram';
1093
+ msg: 'Token program is required for token collateral type';
1395
1094
  },
1396
1095
  {
1397
- "code": 6004;
1398
- "name": "invalidMint";
1399
- "msg": "Invalid mint address";
1096
+ code: 6012;
1097
+ name: 'invalidMint';
1098
+ msg: 'Invalid mint for token collateral type';
1400
1099
  },
1401
1100
  {
1402
- "code": 6005;
1403
- "name": "invalidAmount";
1404
- "msg": "Invalid amount";
1101
+ code: 6013;
1102
+ name: 'missingStakeAccount';
1103
+ msg: 'Stake account is required for stake account collateral type';
1405
1104
  },
1406
1105
  {
1407
- "code": 6006;
1408
- "name": "invalidArgument";
1409
- "msg": "Invalid argument";
1106
+ code: 6014;
1107
+ name: 'missingStakeProgram';
1108
+ msg: 'Stake program is required for stake account collateral type';
1410
1109
  },
1411
1110
  {
1412
- "code": 6007;
1413
- "name": "insufficientBalance";
1414
- "msg": "Insufficient balance";
1111
+ code: 6015;
1112
+ name: 'bondFinished';
1113
+ msg: 'Bond is finished (deposits/withdrawals disabled)';
1415
1114
  },
1416
1115
  {
1417
- "code": 6008;
1418
- "name": "mathOverflow";
1419
- "msg": "Math overflow";
1116
+ code: 6016;
1117
+ name: 'bondNotFinished';
1118
+ msg: 'Bond is not finished';
1420
1119
  },
1421
1120
  {
1422
- "code": 6009;
1423
- "name": "overflow";
1424
- "msg": "Arithmetic overflow";
1121
+ code: 6017;
1122
+ name: 'unsupportedCollateralType';
1123
+ msg: 'Unsupported collateral type';
1425
1124
  },
1426
1125
  {
1427
- "code": 6010;
1428
- "name": "bondNotRemovable";
1429
- "msg": "Bond cannot be removed";
1126
+ code: 6018;
1127
+ name: 'overflow';
1128
+ msg: 'Math operation overflowed';
1430
1129
  },
1431
1130
  {
1432
- "code": 6011;
1433
- "name": "missingTokenAccounts";
1434
- "msg": "Missing token accounts";
1131
+ code: 6019;
1132
+ name: 'incorrectBondType';
1133
+ msg: 'Incorrect bond type for this operation';
1435
1134
  },
1436
1135
  {
1437
- "code": 6012;
1438
- "name": "missingTokenProgram";
1439
- "msg": "Missing token program";
1136
+ code: 6020;
1137
+ name: 'bondNotFinishable';
1138
+ msg: 'This bond type can\'t be finished';
1440
1139
  },
1441
1140
  {
1442
- "code": 6013;
1443
- "name": "missingStakeAccount";
1444
- "msg": "Missing stake account";
1141
+ code: 6021;
1142
+ name: 'invalidArgument';
1143
+ msg: 'Invalid argument provided';
1445
1144
  },
1446
1145
  {
1447
- "code": 6014;
1448
- "name": "missingStakeProgram";
1449
- "msg": "Missing stake program";
1146
+ code: 6022;
1147
+ name: 'bondNotDisabled';
1148
+ msg: 'Bond is not disabled';
1450
1149
  },
1451
1150
  {
1452
- "code": 6015;
1453
- "name": "unsupportedCollateralType";
1454
- "msg": "Unsupported collateral type";
1151
+ code: 6023;
1152
+ name: 'bondNotEnabled';
1153
+ msg: 'Bond is not enabled';
1455
1154
  }
1456
1155
  ];
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";
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';
1469
1168
  };
1470
1169
  };
1471
1170
  };
1472
1171
  },
1473
1172
  {
1474
- "name": "newReserve";
1475
- "type": {
1476
- "option": "pubkey";
1173
+ name: 'newReserve';
1174
+ type: {
1175
+ option: 'pubkey';
1477
1176
  };
1478
1177
  },
1479
1178
  {
1480
- "name": "newAuthority";
1481
- "type": {
1482
- "option": "pubkey";
1179
+ name: 'newAuthority';
1180
+ type: {
1181
+ option: 'pubkey';
1483
1182
  };
1484
1183
  }
1485
1184
  ];
1486
1185
  };
1487
1186
  },
1488
1187
  {
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": [
1188
+ name: 'bondFinished';
1189
+ type: {
1190
+ kind: 'struct';
1191
+ fields: [
1513
1192
  {
1514
- "name": "bond";
1515
- "type": "pubkey";
1193
+ name: 'bond';
1194
+ type: 'pubkey';
1516
1195
  },
1517
1196
  {
1518
- "name": "authority";
1519
- "type": "pubkey";
1197
+ name: 'authority';
1198
+ type: 'pubkey';
1520
1199
  },
1521
1200
  {
1522
- "name": "timestamp";
1523
- "type": "i64";
1201
+ name: 'timestamp';
1202
+ type: 'i64';
1524
1203
  }
1525
1204
  ];
1526
1205
  };
1527
1206
  },
1528
1207
  {
1529
- "name": "bondInitializeData";
1530
- "docs": [
1531
- "Data required to initialize a performance bond"
1208
+ name: 'bondInitializeData';
1209
+ docs: [
1210
+ 'Data required to initialize a performance bond'
1532
1211
  ];
1533
- "type": {
1534
- "kind": "struct";
1535
- "fields": [
1212
+ type: {
1213
+ kind: 'struct';
1214
+ fields: [
1536
1215
  {
1537
- "name": "name";
1538
- "type": "string";
1216
+ name: 'name';
1217
+ type: 'string';
1539
1218
  },
1540
1219
  {
1541
- "name": "bondType";
1542
- "type": {
1543
- "defined": {
1544
- "name": "bondType";
1220
+ name: 'bondType';
1221
+ type: {
1222
+ defined: {
1223
+ name: 'bondType';
1545
1224
  };
1546
1225
  };
1547
1226
  },
1548
1227
  {
1549
- "name": "reserve";
1550
- "type": "pubkey";
1228
+ name: 'reserve';
1229
+ type: 'pubkey';
1551
1230
  },
1552
1231
  {
1553
- "name": "collateralType";
1554
- "type": {
1555
- "defined": {
1556
- "name": "collateralType";
1232
+ name: 'collateralType';
1233
+ type: {
1234
+ defined: {
1235
+ name: 'collateralType';
1557
1236
  };
1558
1237
  };
1559
1238
  }
@@ -1561,582 +1240,363 @@ type Jbond = {
1561
1240
  };
1562
1241
  },
1563
1242
  {
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": [
1243
+ name: 'bondStarted';
1244
+ type: {
1245
+ kind: 'struct';
1246
+ fields: [
1608
1247
  {
1609
- "name": "bond";
1610
- "type": "pubkey";
1248
+ name: 'bond';
1249
+ type: 'pubkey';
1611
1250
  },
1612
1251
  {
1613
- "name": "authority";
1614
- "type": "pubkey";
1252
+ name: 'authority';
1253
+ type: 'pubkey';
1615
1254
  },
1616
1255
  {
1617
- "name": "timestamp";
1618
- "type": "i64";
1256
+ name: 'timestamp';
1257
+ type: 'i64';
1619
1258
  }
1620
1259
  ];
1621
1260
  };
1622
1261
  },
1623
1262
  {
1624
- "name": "bondState";
1625
- "type": {
1626
- "kind": "struct";
1627
- "fields": [
1263
+ name: 'bondState';
1264
+ type: {
1265
+ kind: 'struct';
1266
+ fields: [
1628
1267
  {
1629
- "name": "name";
1630
- "type": "string";
1268
+ name: 'name';
1269
+ type: 'string';
1631
1270
  },
1632
1271
  {
1633
- "name": "bondType";
1634
- "docs": [
1635
- "The type of bond (e.g., Standard, Crowdfunding)"
1272
+ name: 'bondType';
1273
+ docs: [
1274
+ 'The type of bond (e.g., Standard, Crowdfunding)'
1636
1275
  ];
1637
- "type": {
1638
- "defined": {
1639
- "name": "bondType";
1276
+ type: {
1277
+ defined: {
1278
+ name: 'bondType';
1640
1279
  };
1641
1280
  };
1642
1281
  },
1643
1282
  {
1644
- "name": "collateralType";
1645
- "docs": [
1646
- "The type of collateral accepted for this bond"
1283
+ name: 'collateralType';
1284
+ docs: [
1285
+ 'The type of collateral accepted for this bond'
1647
1286
  ];
1648
- "type": {
1649
- "defined": {
1650
- "name": "collateralType";
1287
+ type: {
1288
+ defined: {
1289
+ name: 'collateralType';
1651
1290
  };
1652
1291
  };
1653
1292
  },
1654
1293
  {
1655
- "name": "reserve";
1656
- "docs": [
1657
- "Reserve account where collateral is held"
1294
+ name: 'reserve';
1295
+ docs: [
1296
+ 'Reserve account where collateral is held'
1658
1297
  ];
1659
- "type": "pubkey";
1298
+ type: 'pubkey';
1660
1299
  },
1661
1300
  {
1662
- "name": "authority";
1663
- "docs": [
1664
- "Authority allowed to manage the bond configuration"
1301
+ name: 'authority';
1302
+ docs: [
1303
+ 'Authority allowed to manage the bond configuration'
1665
1304
  ];
1666
- "type": "pubkey";
1305
+ type: 'pubkey';
1667
1306
  },
1668
1307
  {
1669
- "name": "sessionId";
1670
- "docs": [
1671
- "Unique identifier for the bonding session"
1308
+ name: 'sessionId';
1309
+ docs: [
1310
+ 'Unique identifier for the bonding session'
1672
1311
  ];
1673
- "type": "u32";
1312
+ type: 'u32';
1674
1313
  },
1675
1314
  {
1676
- "name": "totalMembers";
1677
- "docs": [
1678
- "Total number of users who have participated in the bond"
1315
+ name: 'totalMembers';
1316
+ docs: [
1317
+ 'Total number of users who have participated in the bond'
1679
1318
  ];
1680
- "type": "u16";
1319
+ type: 'u16';
1681
1320
  },
1682
1321
  {
1683
- "name": "totalCompensationAmount";
1684
- "docs": [
1685
- "Total compensation amount paid out"
1322
+ name: 'totalCompensationAmount';
1323
+ docs: [
1324
+ 'Total compensation amount paid out'
1686
1325
  ];
1687
- "type": "u64";
1326
+ type: 'u64';
1688
1327
  },
1689
1328
  {
1690
- "name": "sessionStartTs";
1691
- "docs": [
1692
- "Start timestamp of the current session (unix seconds). 0 — not set."
1329
+ name: 'sessionStartTs';
1330
+ docs: [
1331
+ 'Start timestamp of the current session (unix seconds). 0 — not set.'
1693
1332
  ];
1694
- "type": "i64";
1333
+ type: 'i64';
1695
1334
  },
1696
1335
  {
1697
- "name": "sessionFinishTs";
1698
- "docs": [
1699
- "Finish timestamp of the current session (unix seconds). 0 — not set."
1336
+ name: 'sessionFinishTs';
1337
+ docs: [
1338
+ 'Finish timestamp of the current session (unix seconds). 0 — not set.'
1700
1339
  ];
1701
- "type": "i64";
1340
+ type: 'i64';
1702
1341
  },
1703
1342
  {
1704
- "name": "status";
1705
- "docs": [
1706
- "Current status of the bond"
1343
+ name: 'status';
1344
+ docs: [
1345
+ 'Current status of the bond'
1707
1346
  ];
1708
- "type": {
1709
- "defined": {
1710
- "name": "bondStatus";
1347
+ type: {
1348
+ defined: {
1349
+ name: 'bondStatus';
1711
1350
  };
1712
1351
  };
1713
1352
  },
1714
1353
  {
1715
- "name": "bump";
1716
- "docs": [
1717
- "Bump for the PDA"
1354
+ name: 'bump';
1355
+ docs: [
1356
+ 'Bump for the PDA'
1718
1357
  ];
1719
- "type": "u8";
1358
+ type: 'u8';
1720
1359
  }
1721
1360
  ];
1722
1361
  };
1723
1362
  },
1724
1363
  {
1725
- "name": "bondStatus";
1726
- "type": {
1727
- "kind": "enum";
1728
- "variants": [
1364
+ name: 'bondStatus';
1365
+ type: {
1366
+ kind: 'enum';
1367
+ variants: [
1729
1368
  {
1730
- "name": "active";
1369
+ name: 'active';
1731
1370
  },
1732
1371
  {
1733
- "name": "disabled";
1372
+ name: 'disabled';
1734
1373
  }
1735
1374
  ];
1736
1375
  };
1737
1376
  },
1738
1377
  {
1739
- "name": "bondType";
1740
- "docs": [
1741
- "Types of bonds supported by the program"
1378
+ name: 'bondType';
1379
+ docs: [
1380
+ 'Types of bonds supported by the program'
1742
1381
  ];
1743
- "type": {
1744
- "kind": "enum";
1745
- "variants": [
1382
+ type: {
1383
+ kind: 'enum';
1384
+ variants: [
1746
1385
  {
1747
- "name": "standard";
1386
+ name: 'standard';
1748
1387
  },
1749
1388
  {
1750
- "name": "crowdfunding";
1389
+ name: 'crowdfunding';
1751
1390
  }
1752
1391
  ];
1753
1392
  };
1754
1393
  },
1755
1394
  {
1756
- "name": "collateralDeposited";
1757
- "type": {
1758
- "kind": "struct";
1759
- "fields": [
1395
+ name: 'collateralToppedUp';
1396
+ type: {
1397
+ kind: 'struct';
1398
+ fields: [
1760
1399
  {
1761
- "name": "validator";
1762
- "type": "pubkey";
1400
+ name: 'validator';
1401
+ type: 'pubkey';
1763
1402
  },
1764
1403
  {
1765
- "name": "amount";
1766
- "type": "u64";
1404
+ name: 'amount';
1405
+ type: 'u64';
1767
1406
  },
1768
1407
  {
1769
- "name": "postBalance";
1770
- "type": "u64";
1408
+ name: 'postBalance';
1409
+ type: 'u64';
1771
1410
  },
1772
1411
  {
1773
- "name": "timestamp";
1774
- "type": "i64";
1412
+ name: 'timestamp';
1413
+ type: 'i64';
1775
1414
  }
1776
1415
  ];
1777
1416
  };
1778
1417
  },
1779
1418
  {
1780
- "name": "collateralType";
1781
- "docs": [
1782
- "Types of collateral that can be used for bond deposit"
1419
+ name: 'collateralType';
1420
+ docs: [
1421
+ 'Types of collateral that can be used for bond deposit'
1783
1422
  ];
1784
- "type": {
1785
- "kind": "enum";
1786
- "variants": [
1423
+ type: {
1424
+ kind: 'enum';
1425
+ variants: [
1787
1426
  {
1788
- "name": "native";
1427
+ name: 'native';
1789
1428
  },
1790
1429
  {
1791
- "name": "stakeAccount";
1430
+ name: 'stakeAccount';
1792
1431
  },
1793
1432
  {
1794
- "name": "token";
1795
- "fields": [
1796
- "pubkey"
1433
+ name: 'token';
1434
+ fields: [
1435
+ 'pubkey'
1797
1436
  ];
1798
1437
  }
1799
1438
  ];
1800
1439
  };
1801
1440
  },
1802
1441
  {
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
- },
1442
+ name: 'collateralWithdrawn';
1443
+ type: {
1444
+ kind: 'struct';
1445
+ fields: [
1863
1446
  {
1864
- "name": "amount";
1865
- "type": "u64";
1447
+ name: 'validator';
1448
+ type: 'pubkey';
1866
1449
  },
1867
1450
  {
1868
- "name": "postBalance";
1869
- "type": "u64";
1451
+ name: 'amount';
1452
+ type: 'u64';
1870
1453
  },
1871
1454
  {
1872
- "name": "epoch";
1873
- "type": "u64";
1455
+ name: 'postBalance';
1456
+ type: 'u64';
1874
1457
  },
1875
1458
  {
1876
- "name": "timestamp";
1877
- "type": "i64";
1459
+ name: 'timestamp';
1460
+ type: 'i64';
1878
1461
  }
1879
1462
  ];
1880
1463
  };
1881
1464
  },
1882
1465
  {
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
- },
1466
+ name: 'compensationClaimed';
1467
+ type: {
1468
+ kind: 'struct';
1469
+ fields: [
1895
1470
  {
1896
- "name": "totalLocked";
1897
- "type": "u64";
1471
+ name: 'validator';
1472
+ type: 'pubkey';
1898
1473
  },
1899
1474
  {
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";
1475
+ name: 'amount';
1476
+ type: 'u64';
1914
1477
  },
1915
1478
  {
1916
- "name": "amount";
1917
- "type": "u64";
1479
+ name: 'postBalance';
1480
+ type: 'u64';
1918
1481
  },
1919
1482
  {
1920
- "name": "pendingUnlock";
1921
- "type": "u64";
1483
+ name: 'epoch';
1484
+ type: 'u64';
1922
1485
  },
1923
1486
  {
1924
- "name": "epoch";
1925
- "type": "u64";
1487
+ name: 'timestamp';
1488
+ type: 'i64';
1926
1489
  }
1927
1490
  ];
1928
1491
  };
1929
1492
  },
1930
1493
  {
1931
- "name": "globalConfigureData";
1932
- "type": {
1933
- "kind": "struct";
1934
- "fields": [
1494
+ name: 'globalConfigureData';
1495
+ type: {
1496
+ kind: 'struct';
1497
+ fields: [
1935
1498
  {
1936
- "name": "newAuthority";
1937
- "type": {
1938
- "option": "pubkey";
1499
+ name: 'newAuthority';
1500
+ type: {
1501
+ option: 'pubkey';
1939
1502
  };
1940
1503
  }
1941
1504
  ];
1942
1505
  };
1943
1506
  },
1944
1507
  {
1945
- "name": "globalState";
1946
- "type": {
1947
- "kind": "struct";
1948
- "fields": [
1508
+ name: 'globalState';
1509
+ type: {
1510
+ kind: 'struct';
1511
+ fields: [
1949
1512
  {
1950
- "name": "authority";
1951
- "docs": [
1952
- "The authority allowed to manage the program"
1513
+ name: 'authority';
1514
+ docs: [
1515
+ 'The authority allowed to manage the program'
1953
1516
  ];
1954
- "type": "pubkey";
1517
+ type: 'pubkey';
1955
1518
  },
1956
1519
  {
1957
- "name": "bump";
1958
- "docs": [
1959
- "Bump for the PDA"
1520
+ name: 'bump';
1521
+ docs: [
1522
+ 'Bump for the PDA'
1960
1523
  ];
1961
- "type": "u8";
1524
+ type: 'u8';
1962
1525
  }
1963
1526
  ];
1964
1527
  };
1965
1528
  },
1966
1529
  {
1967
- "name": "validatorBond";
1968
- "type": {
1969
- "kind": "struct";
1970
- "fields": [
1530
+ name: 'validatorBond';
1531
+ type: {
1532
+ kind: 'struct';
1533
+ fields: [
1971
1534
  {
1972
- "name": "state";
1973
- "docs": [
1974
- "The bond state address"
1975
- ];
1976
- "type": "pubkey";
1535
+ name: 'state';
1536
+ type: 'pubkey';
1977
1537
  },
1978
1538
  {
1979
- "name": "identity";
1980
- "docs": [
1981
- "Validator identity pubkey"
1982
- ];
1983
- "type": "pubkey";
1539
+ name: 'identity';
1540
+ type: 'pubkey';
1984
1541
  },
1985
1542
  {
1986
- "name": "voteAccount";
1987
- "docs": [
1988
- "Validator vote account pubkey"
1989
- ];
1990
- "type": "pubkey";
1543
+ name: 'voteAccount';
1544
+ type: 'pubkey';
1991
1545
  },
1992
1546
  {
1993
- "name": "creator";
1994
- "docs": [
1995
- "The bond creator pubkey"
1996
- ];
1997
- "type": "pubkey";
1547
+ name: 'creator';
1548
+ type: 'pubkey';
1998
1549
  },
1999
1550
  {
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";
1551
+ name: 'withdrawalAuthority';
1552
+ type: {
1553
+ option: 'pubkey';
2007
1554
  };
2008
1555
  },
2009
1556
  {
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";
1557
+ name: 'createdAt';
1558
+ type: 'i64';
2087
1559
  },
2088
1560
  {
2089
- "name": "timestamp";
2090
- "type": "i64";
1561
+ name: 'bump';
1562
+ type: 'u8';
2091
1563
  }
2092
1564
  ];
2093
1565
  };
2094
1566
  },
2095
1567
  {
2096
- "name": "withdrawAuthorityChanged";
2097
- "type": {
2098
- "kind": "struct";
2099
- "fields": [
1568
+ name: 'validatorRegistered';
1569
+ type: {
1570
+ kind: 'struct';
1571
+ fields: [
2100
1572
  {
2101
- "name": "validator";
2102
- "type": "pubkey";
1573
+ name: 'identity';
1574
+ type: 'pubkey';
2103
1575
  },
2104
1576
  {
2105
- "name": "oldAuthority";
2106
- "type": {
2107
- "option": "pubkey";
2108
- };
1577
+ name: 'voteAccount';
1578
+ type: 'pubkey';
2109
1579
  },
2110
1580
  {
2111
- "name": "newAuthority";
2112
- "type": {
2113
- "option": "pubkey";
2114
- };
1581
+ name: 'timestamp';
1582
+ type: 'i64';
2115
1583
  }
2116
1584
  ];
2117
1585
  };
2118
1586
  }
2119
1587
  ];
2120
- "constants": [
1588
+ constants: [
2121
1589
  {
2122
- "name": "epochLockedSlotTail";
2123
- "docs": [
2124
- "Epoch slot index at the end of an epoch after which withdrawals are locked"
1590
+ name: 'epochLockedSlotTail';
1591
+ docs: [
1592
+ 'Epoch slot index at the end of an epoch after which withdrawals are locked'
2125
1593
  ];
2126
- "type": "u64";
2127
- "value": "420000";
1594
+ type: 'u64';
1595
+ value: '420000';
2128
1596
  }
2129
1597
  ];
2130
1598
  };
2131
1599
 
2132
- /**
2133
- * Enum for different client environments.
2134
- */
2135
- declare enum JBondClientEnv {
2136
- DEV = "dev",
2137
- STAGE = "stage",
2138
- PROD = "prod"
2139
- }
2140
1600
  type GlobalState = IdlAccounts<Jbond>['globalState'];
2141
1601
  type BondState = IdlAccounts<Jbond>['bondState'];
2142
1602
  type ValidatorBond = IdlAccounts<Jbond>['validatorBond'];
@@ -2151,7 +1611,6 @@ declare enum BondType {
2151
1611
  Crowdfunding = "crowdfunding"
2152
1612
  }
2153
1613
  declare enum BondTransactionType {
2154
- Registered = "registered",
2155
1614
  Deposit = "deposit",
2156
1615
  Withdrawal = "withdrawal",
2157
1616
  Compensation = "compensation"
@@ -2184,7 +1643,6 @@ type TopUpCollateralProps = {
2184
1643
  identity: PublicKey;
2185
1644
  voteAccount: PublicKey;
2186
1645
  amount: number;
2187
- solUsage?: boolean;
2188
1646
  collateralType?: CollateralType;
2189
1647
  payer?: PublicKey;
2190
1648
  };
@@ -2197,17 +1655,6 @@ type WithdrawCollateralProps = {
2197
1655
  destination?: PublicKey;
2198
1656
  withdrawalAuthority?: PublicKey;
2199
1657
  };
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
- };
2211
1658
  type ClaimProps = {
2212
1659
  bondType: BondType;
2213
1660
  name: string;
@@ -2217,28 +1664,6 @@ type ClaimProps = {
2217
1664
  reserve?: PublicKey;
2218
1665
  authority?: PublicKey;
2219
1666
  };
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
- };
2242
1667
  type GetHistoryProps = {
2243
1668
  voteAccount: PublicKey;
2244
1669
  options?: {
@@ -2293,19 +1718,6 @@ type BondFinishProps = {
2293
1718
  bondType: BondType;
2294
1719
  name: string;
2295
1720
  };
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
- };
2309
1721
 
2310
1722
  type GetHistoryOpts = {
2311
1723
  cluster?: Cluster;
@@ -2318,7 +1730,7 @@ declare class HistoryManager {
2318
1730
  private discCache;
2319
1731
  constructor(client: JBondClient);
2320
1732
  get program(): _coral_xyz_anchor.Program<Jbond>;
2321
- get programId(): PublicKey;
1733
+ get programId(): any;
2322
1734
  get connection(): _solana_web3_js.Connection;
2323
1735
  debug(...args: any[]): void;
2324
1736
  getHistory(bondType: BondType, bondName: string, vote: PublicKeyInitData, opts?: GetHistoryOpts): Promise<TransactionHistoryItem[]>;
@@ -2342,21 +1754,24 @@ declare class NodeWallet implements Wallet {
2342
1754
  get publicKey(): PublicKey;
2343
1755
  }
2344
1756
 
2345
- declare function lamportsToSol(lamports: number | BN): number;
2346
-
1757
+ /**
1758
+ * Enum for different client environments.
1759
+ */
1760
+ declare enum JBondClientEnv {
1761
+ DEV = "dev",
1762
+ STAGE = "stage",
1763
+ PROD = "prod"
1764
+ }
2347
1765
  /**
2348
1766
  * Options for configuring the JBondClient.
2349
1767
  */
2350
1768
  type JBondClientOptions = {
2351
1769
  debug?: boolean;
2352
1770
  } & Record<string, any>;
2353
- type GetAllBondStatesOptions = {
2354
- includeStats?: boolean;
2355
- };
2356
1771
  declare class JBondClient {
2357
1772
  readonly provider: Provider;
2358
1773
  readonly options: JBondClientOptions;
2359
- private _program;
1774
+ readonly program: Program<Jbond>;
2360
1775
  constructor(provider: Provider, options?: JBondClientOptions);
2361
1776
  get history(): HistoryManager;
2362
1777
  /**
@@ -2371,14 +1786,10 @@ declare class JBondClient {
2371
1786
  * Creates an instance of `JBondClient` using the provided connection and keypair.
2372
1787
  */
2373
1788
  static fromKeypair(connection: Connection, keypair: Keypair, options?: JBondClientOptions): JBondClient;
2374
- /**
2375
- * Get or create the program instance
2376
- */
2377
- get program(): Program<Jbond>;
2378
1789
  /**
2379
1790
  * Get the current program ID.
2380
1791
  */
2381
- get programId(): PublicKey;
1792
+ get programId(): any;
2382
1793
  /**
2383
1794
  * Get the current connection.
2384
1795
  */
@@ -2425,11 +1836,7 @@ declare class JBondClient {
2425
1836
  */
2426
1837
  withdrawCollateral(props: WithdrawCollateralProps): Promise<string | undefined>;
2427
1838
  /**
2428
- * Migrate SOL collateral from one bond account to JSOL collateral in another bond account
2429
- */
2430
- migrateBond(props: MigrateBondProps): Promise<string | undefined>;
2431
- /**
2432
- * Claim compensation for a validator
1839
+ * Claim compensation
2433
1840
  */
2434
1841
  claimCompensation(props: ClaimProps): Promise<string | undefined>;
2435
1842
  /**
@@ -2452,8 +1859,6 @@ declare class JBondClient {
2452
1859
  * Finish crowdfunding bond session
2453
1860
  */
2454
1861
  bondFinish(props: BondFinishProps): Promise<string | undefined>;
2455
- bondRemove(props: BondRemoveProps): Promise<string | undefined>;
2456
- closeValidatorBond(props: CloseValidatorBondProps): Promise<string | undefined>;
2457
1862
  /**
2458
1863
  * Build global state initialize instruction
2459
1864
  */
@@ -2477,34 +1882,15 @@ declare class JBondClient {
2477
1882
  /**
2478
1883
  * Build top up collateral instructions
2479
1884
  */
2480
- getTopUpIxs(props: TopUpCollateralProps): Promise<{
2481
- instructions: TransactionInstruction[];
2482
- signers: Signer[];
2483
- }>;
1885
+ getTopUpIxs(props: TopUpCollateralProps): Promise<TransactionInstruction[]>;
2484
1886
  /**
2485
1887
  * Build withdraw collateral instruction
2486
1888
  */
2487
1889
  getWithdrawIx(props: WithdrawCollateralProps): Promise<TransactionInstruction>;
2488
- /**
2489
- * Build instructions for migrating SOL bond collateral into JSOL bond collateral in a single transaction
2490
- */
2491
- getMigrateBondIx(props: MigrateBondProps): Promise<{
2492
- instructions: TransactionInstruction[];
2493
- signers: Signer[];
2494
- }>;
2495
- /**
2496
- * Build stake-pool SOL deposit instructions without pre-checking payer balance.
2497
- * This allows composing withdraw->deposit in a single transaction where SOL is obtained by the prior instruction.
2498
- */
2499
- private getDepositSolIxsWithoutBalanceCheck;
2500
1890
  /**
2501
1891
  * Build claim instruction
2502
1892
  */
2503
1893
  getClaimIx(props: ClaimProps): Promise<TransactionInstruction>;
2504
- /**
2505
- * Build claim all compensations instructions
2506
- */
2507
- getClaimAllCompensationsIxs(props: ClaimAllProps): Promise<TransactionInstruction[]>;
2508
1894
  /**
2509
1895
  * Build set withdraw authority instruction
2510
1896
  */
@@ -2517,88 +1903,10 @@ declare class JBondClient {
2517
1903
  * Build start crowdfunding session instruction
2518
1904
  */
2519
1905
  getBondSessionStartIx(props: BondStartProps): Promise<TransactionInstruction>;
2520
- lockFunds(props: BondLockFunds): Promise<string | undefined>;
2521
- releaseFunds(props: BondReleaseFunds): Promise<string | undefined>;
2522
- /**
2523
- * Build bond remove instruction
2524
- */
2525
- getBondRemoveIx(props: BondRemoveProps): Promise<TransactionInstruction>;
2526
- /**
2527
- * Build close validator bond instruction
2528
- */
2529
- getCloseValidatorBondIx(props: CloseValidatorBondProps): Promise<TransactionInstruction>;
2530
- /**
2531
- * Build test set last update epoch instruction
2532
- * NOTE!: This instruction is for testing purposes only.
2533
- * It allows direct manipulation of the validator bond's last epoch update.
2534
- * This should not be used in production environments.
2535
- */
2536
- /**
2537
- * Build lock funds instruction
2538
- */
2539
- getLockFundsIx(props: BondLockFunds): Promise<TransactionInstruction>;
2540
- /**
2541
- * Build release funds instruction
2542
- */
2543
- getReleaseFundsIx(props: BondReleaseFunds): Promise<TransactionInstruction>;
2544
- /**
2545
- * Get available collateral for withdrawal (taking into account locked funds)
2546
- */
2547
- getAvailableCollateral(bondType: BondType, bondName: string, voteAccount: PublicKeyInitData): Promise<number>;
2548
1906
  /**
2549
1907
  * Get all bond states with total collected collateral
2550
1908
  */
2551
- getAllBondStates(bondType: BondType, sessionStatus?: SessionStatus, options?: GetAllBondStatesOptions): Promise<{
2552
- publicKey: PublicKey;
2553
- bondState: {
2554
- name: string;
2555
- bondType: ({
2556
- crowdfunding?: undefined;
2557
- } & {
2558
- standard: Record<string, never>;
2559
- }) | ({
2560
- standard?: undefined;
2561
- } & {
2562
- crowdfunding: Record<string, never>;
2563
- });
2564
- collateralType: ({
2565
- native?: undefined;
2566
- token?: undefined;
2567
- } & {
2568
- stakeAccount: Record<string, never>;
2569
- }) | ({
2570
- stakeAccount?: undefined;
2571
- token?: undefined;
2572
- } & {
2573
- native: Record<string, never>;
2574
- }) | ({
2575
- stakeAccount?: undefined;
2576
- native?: undefined;
2577
- } & {
2578
- token: {
2579
- 0: PublicKey;
2580
- };
2581
- });
2582
- reserve: PublicKey;
2583
- authority: PublicKey;
2584
- sessionId: number;
2585
- totalMembers: number;
2586
- totalCompensationAmount: bn_js;
2587
- sessionStartTs: bn_js;
2588
- sessionFinishTs: bn_js;
2589
- status: ({
2590
- disabled?: undefined;
2591
- } & {
2592
- active: Record<string, never>;
2593
- }) | ({
2594
- active?: undefined;
2595
- } & {
2596
- disabled: Record<string, never>;
2597
- });
2598
- bump: number;
2599
- };
2600
- stateStats: null;
2601
- }[] | {
1909
+ getAllBondStates(bondType: BondType, sessionStatus?: SessionStatus): Promise<{
2602
1910
  publicKey: PublicKey;
2603
1911
  bondState: {
2604
1912
  name: string;
@@ -2648,7 +1956,7 @@ declare class JBondClient {
2648
1956
  bump: number;
2649
1957
  };
2650
1958
  stateStats: {
2651
- totalCollected: number;
1959
+ totalCollected: unknown;
2652
1960
  status: SessionStatus;
2653
1961
  };
2654
1962
  }[]>;
@@ -2712,7 +2020,7 @@ declare class JBondClient {
2712
2020
  publicKey: PublicKey;
2713
2021
  }>;
2714
2022
  /**
2715
- * Fetch validator bond data or error if not found
2023
+ * Fetch validator bond data or null if not found
2716
2024
  */
2717
2025
  getValidatorBond(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<{
2718
2026
  state: PublicKey;
@@ -2722,55 +2030,27 @@ declare class JBondClient {
2722
2030
  withdrawalAuthority: PublicKey | null;
2723
2031
  createdAt: bn_js;
2724
2032
  bump: number;
2725
- locked: bn_js;
2726
- pendingUnlock: bn_js;
2727
- pendingUnlockEpoch: bn_js;
2728
2033
  publicKey: PublicKey;
2729
2034
  }>;
2730
2035
  /**
2731
- * Fetch validator bond data or null if not found
2732
- */
2733
- getValidatorBondNullable(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<{
2734
- state: PublicKey;
2735
- identity: PublicKey;
2736
- voteAccount: PublicKey;
2737
- creator: PublicKey;
2738
- withdrawalAuthority: PublicKey | null;
2739
- createdAt: bn_js;
2740
- bump: number;
2741
- locked: bn_js;
2742
- pendingUnlock: bn_js;
2743
- pendingUnlockEpoch: bn_js;
2744
- publicKey: PublicKey;
2745
- } | null>;
2746
- /**
2747
- * Get validator bond account balance (in SOL)
2036
+ * Get validator bond account balance, in the collateral's base units
2037
+ * (lamports for native bonds, token base units for token bonds).
2748
2038
  */
2749
2039
  getValidatorBondBalance(bondType: BondType, bondName: string, vote: PublicKeyInitData): Promise<number>;
2750
- getBondStateValidatorBondBalances(bondType: BondType, bondName: string, bondState?: BondState): Promise<{
2751
- voteAccount: PublicKey;
2752
- balance: number;
2753
- }[]>;
2754
2040
  /**
2755
2041
  * Get total collected collateral for a bond state
2756
2042
  */
2757
- getBondStateTotalCollected(bondType: BondType, bondName: string, bondState?: BondState): Promise<number>;
2043
+ getBondStateTotalCollected(bondType: BondType, bondName: string, votes: PublicKeyInitData[]): Promise<unknown>;
2758
2044
  /**
2759
2045
  * Get bond state stats
2760
2046
  * @param state
2047
+ * @private
2761
2048
  */
2762
- getBondStateStats(state: BondState): Promise<{
2763
- totalCollected: number;
2764
- status: SessionStatus;
2765
- }>;
2766
- /**
2767
- * Get validator bond rent exempt amount
2768
- */
2769
- private validatorBondRentExempt;
2049
+ private getBondStateStats;
2770
2050
  /**
2771
2051
  * Get all validator bonds for a given bond state
2772
2052
  */
2773
- private getValidatorBondsForState;
2053
+ private getBondValidatorStates;
2774
2054
  /**
2775
2055
  * Get session status for bond state
2776
2056
  */
@@ -2785,8 +2065,6 @@ declare const CROWDFUNDING_BOND_SEED = "crowdfunding";
2785
2065
  /**
2786
2066
  * Program IDs for different environments
2787
2067
  */
2788
- declare const ENV_PROGRAM_ID: Record<JBondClientEnv, string>;
2789
- declare const JSOL_MINT: PublicKey;
2790
- declare const JPOOL_POOL_ADDRESS: PublicKey;
2068
+ declare const ENV_PROGRAM_ID: Record<string, PublicKey>;
2791
2069
 
2792
- 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 };
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 };