@jpool/bond-sdk 0.0.1-next.0

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.
@@ -0,0 +1,713 @@
1
+ /**
2
+ * Program IDL in camelCase format in order to be used in JS/TS.
3
+ *
4
+ * Note that this is only a type helper and is not the actual IDL. The original
5
+ * IDL can be found at `target/idl/jbond.json`.
6
+ */
7
+ export type Jbond = {
8
+ "address": "4a3YovKEfm4jWhczCzJciHXL1xVkXWfGQjRCaMft7M4G",
9
+ "metadata": {
10
+ "name": "jbond",
11
+ "version": "0.1.0",
12
+ "spec": "0.1.0",
13
+ "description": "Validator compensation program for boosting APR"
14
+ },
15
+ "instructions": [
16
+ {
17
+ "name": "bondInit",
18
+ "docs": [
19
+ "Register validator and fund initial collateral"
20
+ ],
21
+ "discriminator": [
22
+ 220,
23
+ 108,
24
+ 156,
25
+ 81,
26
+ 16,
27
+ 185,
28
+ 144,
29
+ 157
30
+ ],
31
+ "accounts": [
32
+ {
33
+ "name": "globalState",
34
+ "writable": true,
35
+ "pda": {
36
+ "seeds": [
37
+ {
38
+ "kind": "const",
39
+ "value": [
40
+ 103,
41
+ 108,
42
+ 111,
43
+ 98,
44
+ 97,
45
+ 108,
46
+ 95,
47
+ 115,
48
+ 116,
49
+ 97,
50
+ 116,
51
+ 101
52
+ ]
53
+ }
54
+ ]
55
+ }
56
+ },
57
+ {
58
+ "name": "validatorBondAccount",
59
+ "writable": true,
60
+ "pda": {
61
+ "seeds": [
62
+ {
63
+ "kind": "const",
64
+ "value": [
65
+ 118,
66
+ 97,
67
+ 108,
68
+ 105,
69
+ 100,
70
+ 97,
71
+ 116,
72
+ 111,
73
+ 114,
74
+ 95,
75
+ 98,
76
+ 111,
77
+ 110,
78
+ 100
79
+ ]
80
+ },
81
+ {
82
+ "kind": "account",
83
+ "path": "voteAccount"
84
+ }
85
+ ]
86
+ }
87
+ },
88
+ {
89
+ "name": "identity"
90
+ },
91
+ {
92
+ "name": "voteAccount"
93
+ },
94
+ {
95
+ "name": "creator",
96
+ "docs": [
97
+ "The account creating the bond (pays for account creation and initial collateral)"
98
+ ],
99
+ "writable": true,
100
+ "signer": true
101
+ },
102
+ {
103
+ "name": "systemProgram",
104
+ "address": "11111111111111111111111111111111"
105
+ }
106
+ ],
107
+ "args": [
108
+ {
109
+ "name": "initialCollateral",
110
+ "type": "u64"
111
+ },
112
+ {
113
+ "name": "withdrawalAuthority",
114
+ "type": {
115
+ "option": "pubkey"
116
+ }
117
+ }
118
+ ]
119
+ },
120
+ {
121
+ "name": "bondTopUp",
122
+ "docs": [
123
+ "Top up collateral for existing validator"
124
+ ],
125
+ "discriminator": [
126
+ 132,
127
+ 225,
128
+ 254,
129
+ 187,
130
+ 152,
131
+ 162,
132
+ 176,
133
+ 66
134
+ ],
135
+ "accounts": [
136
+ {
137
+ "name": "validatorBondAccount",
138
+ "writable": true,
139
+ "pda": {
140
+ "seeds": [
141
+ {
142
+ "kind": "const",
143
+ "value": [
144
+ 118,
145
+ 97,
146
+ 108,
147
+ 105,
148
+ 100,
149
+ 97,
150
+ 116,
151
+ 111,
152
+ 114,
153
+ 95,
154
+ 98,
155
+ 111,
156
+ 110,
157
+ 100
158
+ ]
159
+ },
160
+ {
161
+ "kind": "account",
162
+ "path": "validator_bond_account.vote_account",
163
+ "account": "validatorBondAccount"
164
+ }
165
+ ]
166
+ }
167
+ },
168
+ {
169
+ "name": "depositor",
170
+ "writable": true,
171
+ "signer": true
172
+ },
173
+ {
174
+ "name": "systemProgram",
175
+ "address": "11111111111111111111111111111111"
176
+ }
177
+ ],
178
+ "args": [
179
+ {
180
+ "name": "amount",
181
+ "type": "u64"
182
+ }
183
+ ]
184
+ },
185
+ {
186
+ "name": "bondWithdraw",
187
+ "discriminator": [
188
+ 99,
189
+ 64,
190
+ 127,
191
+ 178,
192
+ 53,
193
+ 117,
194
+ 70,
195
+ 204
196
+ ],
197
+ "accounts": [
198
+ {
199
+ "name": "validatorBondAccount",
200
+ "writable": true,
201
+ "pda": {
202
+ "seeds": [
203
+ {
204
+ "kind": "const",
205
+ "value": [
206
+ 118,
207
+ 97,
208
+ 108,
209
+ 105,
210
+ 100,
211
+ 97,
212
+ 116,
213
+ 111,
214
+ 114,
215
+ 95,
216
+ 98,
217
+ 111,
218
+ 110,
219
+ 100
220
+ ]
221
+ },
222
+ {
223
+ "kind": "account",
224
+ "path": "validator_bond_account.vote_account",
225
+ "account": "validatorBondAccount"
226
+ }
227
+ ]
228
+ }
229
+ },
230
+ {
231
+ "name": "withdrawalAuthority",
232
+ "writable": true,
233
+ "signer": true
234
+ },
235
+ {
236
+ "name": "destination",
237
+ "writable": true
238
+ },
239
+ {
240
+ "name": "systemProgram",
241
+ "address": "11111111111111111111111111111111"
242
+ }
243
+ ],
244
+ "args": [
245
+ {
246
+ "name": "amount",
247
+ "type": "u64"
248
+ }
249
+ ]
250
+ },
251
+ {
252
+ "name": "initialize",
253
+ "docs": [
254
+ "Initialize the global state and reserve vault"
255
+ ],
256
+ "discriminator": [
257
+ 175,
258
+ 175,
259
+ 109,
260
+ 31,
261
+ 13,
262
+ 152,
263
+ 155,
264
+ 237
265
+ ],
266
+ "accounts": [
267
+ {
268
+ "name": "globalState",
269
+ "writable": true,
270
+ "pda": {
271
+ "seeds": [
272
+ {
273
+ "kind": "const",
274
+ "value": [
275
+ 103,
276
+ 108,
277
+ 111,
278
+ 98,
279
+ 97,
280
+ 108,
281
+ 95,
282
+ 115,
283
+ 116,
284
+ 97,
285
+ 116,
286
+ 101
287
+ ]
288
+ }
289
+ ]
290
+ }
291
+ },
292
+ {
293
+ "name": "authority",
294
+ "writable": true,
295
+ "signer": true
296
+ },
297
+ {
298
+ "name": "reserve"
299
+ },
300
+ {
301
+ "name": "systemProgram",
302
+ "address": "11111111111111111111111111111111"
303
+ }
304
+ ],
305
+ "args": []
306
+ },
307
+ {
308
+ "name": "withdrawCompensation",
309
+ "docs": [
310
+ "Withdraw compensation from validator to reserve (oracle only)"
311
+ ],
312
+ "discriminator": [
313
+ 10,
314
+ 228,
315
+ 22,
316
+ 213,
317
+ 205,
318
+ 117,
319
+ 181,
320
+ 75
321
+ ],
322
+ "accounts": [
323
+ {
324
+ "name": "globalState",
325
+ "writable": true,
326
+ "pda": {
327
+ "seeds": [
328
+ {
329
+ "kind": "const",
330
+ "value": [
331
+ 103,
332
+ 108,
333
+ 111,
334
+ 98,
335
+ 97,
336
+ 108,
337
+ 95,
338
+ 115,
339
+ 116,
340
+ 97,
341
+ 116,
342
+ 101
343
+ ]
344
+ }
345
+ ]
346
+ }
347
+ },
348
+ {
349
+ "name": "validatorBondAccount",
350
+ "writable": true,
351
+ "pda": {
352
+ "seeds": [
353
+ {
354
+ "kind": "const",
355
+ "value": [
356
+ 118,
357
+ 97,
358
+ 108,
359
+ 105,
360
+ 100,
361
+ 97,
362
+ 116,
363
+ 111,
364
+ 114,
365
+ 95,
366
+ 98,
367
+ 111,
368
+ 110,
369
+ 100
370
+ ]
371
+ },
372
+ {
373
+ "kind": "account",
374
+ "path": "validator_bond_account.vote_account",
375
+ "account": "validatorBondAccount"
376
+ }
377
+ ]
378
+ }
379
+ },
380
+ {
381
+ "name": "reserve",
382
+ "writable": true
383
+ },
384
+ {
385
+ "name": "authority",
386
+ "docs": [
387
+ "Authority that can trigger claims"
388
+ ],
389
+ "signer": true
390
+ },
391
+ {
392
+ "name": "systemProgram",
393
+ "address": "11111111111111111111111111111111"
394
+ }
395
+ ],
396
+ "args": [
397
+ {
398
+ "name": "amount",
399
+ "type": "u64"
400
+ }
401
+ ]
402
+ }
403
+ ],
404
+ "accounts": [
405
+ {
406
+ "name": "globalState",
407
+ "discriminator": [
408
+ 163,
409
+ 46,
410
+ 74,
411
+ 168,
412
+ 216,
413
+ 123,
414
+ 133,
415
+ 98
416
+ ]
417
+ },
418
+ {
419
+ "name": "validatorBondAccount",
420
+ "discriminator": [
421
+ 25,
422
+ 67,
423
+ 241,
424
+ 227,
425
+ 226,
426
+ 104,
427
+ 108,
428
+ 73
429
+ ]
430
+ }
431
+ ],
432
+ "events": [
433
+ {
434
+ "name": "collateralToppedUp",
435
+ "discriminator": [
436
+ 189,
437
+ 137,
438
+ 204,
439
+ 58,
440
+ 135,
441
+ 182,
442
+ 19,
443
+ 176
444
+ ]
445
+ },
446
+ {
447
+ "name": "collateralWithdrawn",
448
+ "discriminator": [
449
+ 51,
450
+ 224,
451
+ 133,
452
+ 106,
453
+ 74,
454
+ 173,
455
+ 72,
456
+ 82
457
+ ]
458
+ },
459
+ {
460
+ "name": "compensationClaimed",
461
+ "discriminator": [
462
+ 36,
463
+ 159,
464
+ 41,
465
+ 178,
466
+ 104,
467
+ 135,
468
+ 220,
469
+ 32
470
+ ]
471
+ },
472
+ {
473
+ "name": "validatorRegistered",
474
+ "discriminator": [
475
+ 20,
476
+ 20,
477
+ 190,
478
+ 191,
479
+ 53,
480
+ 174,
481
+ 95,
482
+ 72
483
+ ]
484
+ }
485
+ ],
486
+ "errors": [
487
+ {
488
+ "code": 6000,
489
+ "name": "invalidVoteAccount",
490
+ "msg": "Invalid vote account"
491
+ },
492
+ {
493
+ "code": 6001,
494
+ "name": "identityMismatch",
495
+ "msg": "Identity does not match vote account"
496
+ },
497
+ {
498
+ "code": 6002,
499
+ "name": "insufficientCollateral",
500
+ "msg": "Insufficient collateral amount"
501
+ },
502
+ {
503
+ "code": 6003,
504
+ "name": "targetAprTooLow",
505
+ "msg": "Target APR is below minimum threshold"
506
+ },
507
+ {
508
+ "code": 6004,
509
+ "name": "mathOverflow",
510
+ "msg": "Math overflow"
511
+ },
512
+ {
513
+ "code": 6005,
514
+ "name": "invalidAmount",
515
+ "msg": "Invalid amount"
516
+ },
517
+ {
518
+ "code": 6006,
519
+ "name": "validatorNotActive",
520
+ "msg": "Validator boost account is not active"
521
+ },
522
+ {
523
+ "code": 6007,
524
+ "name": "validatorAlreadyRegistered",
525
+ "msg": "Validator already registered"
526
+ },
527
+ {
528
+ "code": 6008,
529
+ "name": "unauthorized",
530
+ "msg": "unauthorized"
531
+ }
532
+ ],
533
+ "types": [
534
+ {
535
+ "name": "collateralToppedUp",
536
+ "type": {
537
+ "kind": "struct",
538
+ "fields": [
539
+ {
540
+ "name": "validator",
541
+ "type": "pubkey"
542
+ },
543
+ {
544
+ "name": "amount",
545
+ "type": "u64"
546
+ },
547
+ {
548
+ "name": "newTotal",
549
+ "type": "u64"
550
+ },
551
+ {
552
+ "name": "timestamp",
553
+ "type": "i64"
554
+ }
555
+ ]
556
+ }
557
+ },
558
+ {
559
+ "name": "collateralWithdrawn",
560
+ "type": {
561
+ "kind": "struct",
562
+ "fields": [
563
+ {
564
+ "name": "validator",
565
+ "type": "pubkey"
566
+ },
567
+ {
568
+ "name": "amount",
569
+ "type": "u64"
570
+ },
571
+ {
572
+ "name": "remainingCollateral",
573
+ "type": "u64"
574
+ },
575
+ {
576
+ "name": "timestamp",
577
+ "type": "i64"
578
+ }
579
+ ]
580
+ }
581
+ },
582
+ {
583
+ "name": "compensationClaimed",
584
+ "type": {
585
+ "kind": "struct",
586
+ "fields": [
587
+ {
588
+ "name": "validator",
589
+ "type": "pubkey"
590
+ },
591
+ {
592
+ "name": "amount",
593
+ "type": "u64"
594
+ },
595
+ {
596
+ "name": "remainingCollateral",
597
+ "type": "u64"
598
+ },
599
+ {
600
+ "name": "totalWithdrawn",
601
+ "type": "u64"
602
+ },
603
+ {
604
+ "name": "epoch",
605
+ "type": "u64"
606
+ },
607
+ {
608
+ "name": "timestamp",
609
+ "type": "i64"
610
+ }
611
+ ]
612
+ }
613
+ },
614
+ {
615
+ "name": "globalState",
616
+ "type": {
617
+ "kind": "struct",
618
+ "fields": [
619
+ {
620
+ "name": "authority",
621
+ "type": "pubkey"
622
+ },
623
+ {
624
+ "name": "reserve",
625
+ "type": "pubkey"
626
+ },
627
+ {
628
+ "name": "totalValidators",
629
+ "type": "u32"
630
+ },
631
+ {
632
+ "name": "totalWithdrawn",
633
+ "type": "u64"
634
+ },
635
+ {
636
+ "name": "bump",
637
+ "type": "u8"
638
+ }
639
+ ]
640
+ }
641
+ },
642
+ {
643
+ "name": "validatorBondAccount",
644
+ "type": {
645
+ "kind": "struct",
646
+ "fields": [
647
+ {
648
+ "name": "identity",
649
+ "type": "pubkey"
650
+ },
651
+ {
652
+ "name": "voteAccount",
653
+ "type": "pubkey"
654
+ },
655
+ {
656
+ "name": "creator",
657
+ "type": "pubkey"
658
+ },
659
+ {
660
+ "name": "withdrawalAuthority",
661
+ "type": {
662
+ "option": "pubkey"
663
+ }
664
+ },
665
+ {
666
+ "name": "totalWithdrawn",
667
+ "type": "u64"
668
+ },
669
+ {
670
+ "name": "lastWithdrawalEpoch",
671
+ "type": "u64"
672
+ },
673
+ {
674
+ "name": "isActive",
675
+ "type": "bool"
676
+ },
677
+ {
678
+ "name": "createdAt",
679
+ "type": "i64"
680
+ },
681
+ {
682
+ "name": "bump",
683
+ "type": "u8"
684
+ }
685
+ ]
686
+ }
687
+ },
688
+ {
689
+ "name": "validatorRegistered",
690
+ "type": {
691
+ "kind": "struct",
692
+ "fields": [
693
+ {
694
+ "name": "validator",
695
+ "type": "pubkey"
696
+ },
697
+ {
698
+ "name": "voteAccount",
699
+ "type": "pubkey"
700
+ },
701
+ {
702
+ "name": "collateralAmount",
703
+ "type": "u64"
704
+ },
705
+ {
706
+ "name": "timestamp",
707
+ "type": "i64"
708
+ }
709
+ ]
710
+ }
711
+ }
712
+ ]
713
+ };