@jup-ag/lend 0.0.69 → 0.0.71

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,1544 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ import BN from 'bn.js';
3
+
4
+ const address = "jup9FB8aPL62L8SHwhZJnxnV263qQvc9tseGT6AFLn6";
5
+ const metadata = {
6
+ name: "merkle_distributor",
7
+ version: "0.1.0",
8
+ spec: "0.1.0",
9
+ description: "Created with Anchor"
10
+ };
11
+ const instructions = [
12
+ {
13
+ name: "approve_root",
14
+ discriminator: [
15
+ 167,
16
+ 152,
17
+ 175,
18
+ 193,
19
+ 218,
20
+ 188,
21
+ 184,
22
+ 23
23
+ ],
24
+ accounts: [
25
+ {
26
+ name: "approver",
27
+ signer: true
28
+ },
29
+ {
30
+ name: "merkle_admin"
31
+ },
32
+ {
33
+ name: "distributor",
34
+ writable: true
35
+ },
36
+ {
37
+ name: "approver_role"
38
+ }
39
+ ],
40
+ args: [
41
+ {
42
+ name: "merkle_root",
43
+ type: {
44
+ array: [
45
+ "u8",
46
+ 32
47
+ ]
48
+ }
49
+ },
50
+ {
51
+ name: "cycle",
52
+ type: "u32"
53
+ },
54
+ {
55
+ name: "start_slot",
56
+ type: "u32"
57
+ },
58
+ {
59
+ name: "end_slot",
60
+ type: "u32"
61
+ }
62
+ ]
63
+ },
64
+ {
65
+ name: "claim",
66
+ discriminator: [
67
+ 62,
68
+ 198,
69
+ 214,
70
+ 193,
71
+ 213,
72
+ 159,
73
+ 108,
74
+ 210
75
+ ],
76
+ accounts: [
77
+ {
78
+ name: "signer",
79
+ writable: true,
80
+ signer: true
81
+ },
82
+ {
83
+ name: "distributor",
84
+ writable: true
85
+ },
86
+ {
87
+ name: "merkle_admin"
88
+ },
89
+ {
90
+ name: "mint",
91
+ relations: [
92
+ "distributor"
93
+ ]
94
+ },
95
+ {
96
+ name: "claim_status",
97
+ writable: true,
98
+ pda: {
99
+ seeds: [
100
+ {
101
+ kind: "const",
102
+ value: [
103
+ 99,
104
+ 108,
105
+ 97,
106
+ 105,
107
+ 109
108
+ ]
109
+ },
110
+ {
111
+ kind: "account",
112
+ path: "signer"
113
+ },
114
+ {
115
+ kind: "arg",
116
+ path: "position_id"
117
+ }
118
+ ]
119
+ }
120
+ },
121
+ {
122
+ name: "vault_token_account",
123
+ writable: true,
124
+ pda: {
125
+ seeds: [
126
+ {
127
+ kind: "account",
128
+ path: "merkle_admin"
129
+ },
130
+ {
131
+ kind: "account",
132
+ path: "token_program"
133
+ },
134
+ {
135
+ kind: "account",
136
+ path: "mint"
137
+ }
138
+ ],
139
+ program: {
140
+ kind: "const",
141
+ value: [
142
+ 140,
143
+ 151,
144
+ 37,
145
+ 143,
146
+ 78,
147
+ 36,
148
+ 137,
149
+ 241,
150
+ 187,
151
+ 61,
152
+ 16,
153
+ 41,
154
+ 20,
155
+ 142,
156
+ 13,
157
+ 131,
158
+ 11,
159
+ 90,
160
+ 19,
161
+ 153,
162
+ 218,
163
+ 255,
164
+ 16,
165
+ 132,
166
+ 4,
167
+ 142,
168
+ 123,
169
+ 216,
170
+ 219,
171
+ 233,
172
+ 248,
173
+ 89
174
+ ]
175
+ }
176
+ }
177
+ },
178
+ {
179
+ name: "recipient_token_account",
180
+ writable: true,
181
+ pda: {
182
+ seeds: [
183
+ {
184
+ kind: "account",
185
+ path: "signer"
186
+ },
187
+ {
188
+ kind: "account",
189
+ path: "token_program"
190
+ },
191
+ {
192
+ kind: "account",
193
+ path: "mint"
194
+ }
195
+ ],
196
+ program: {
197
+ kind: "const",
198
+ value: [
199
+ 140,
200
+ 151,
201
+ 37,
202
+ 143,
203
+ 78,
204
+ 36,
205
+ 137,
206
+ 241,
207
+ 187,
208
+ 61,
209
+ 16,
210
+ 41,
211
+ 20,
212
+ 142,
213
+ 13,
214
+ 131,
215
+ 11,
216
+ 90,
217
+ 19,
218
+ 153,
219
+ 218,
220
+ 255,
221
+ 16,
222
+ 132,
223
+ 4,
224
+ 142,
225
+ 123,
226
+ 216,
227
+ 219,
228
+ 233,
229
+ 248,
230
+ 89
231
+ ]
232
+ }
233
+ }
234
+ },
235
+ {
236
+ name: "token_program"
237
+ },
238
+ {
239
+ name: "associated_token_program",
240
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
241
+ },
242
+ {
243
+ name: "system_program",
244
+ address: "11111111111111111111111111111111"
245
+ }
246
+ ],
247
+ args: [
248
+ {
249
+ name: "cumulative_amount",
250
+ type: "u64"
251
+ },
252
+ {
253
+ name: "position_type",
254
+ type: "u8"
255
+ },
256
+ {
257
+ name: "position_id",
258
+ type: "pubkey"
259
+ },
260
+ {
261
+ name: "cycle",
262
+ type: "u32"
263
+ },
264
+ {
265
+ name: "merkle_proof",
266
+ type: {
267
+ vec: {
268
+ array: [
269
+ "u8",
270
+ 32
271
+ ]
272
+ }
273
+ }
274
+ },
275
+ {
276
+ name: "metadata",
277
+ type: "bytes"
278
+ }
279
+ ]
280
+ },
281
+ {
282
+ name: "distribute_rewards",
283
+ discriminator: [
284
+ 97,
285
+ 6,
286
+ 227,
287
+ 255,
288
+ 124,
289
+ 165,
290
+ 3,
291
+ 148
292
+ ],
293
+ accounts: [
294
+ {
295
+ name: "distributor",
296
+ writable: true,
297
+ signer: true,
298
+ relations: [
299
+ "merkle_distributor"
300
+ ]
301
+ },
302
+ {
303
+ name: "merkle_admin"
304
+ },
305
+ {
306
+ name: "merkle_distributor",
307
+ writable: true
308
+ },
309
+ {
310
+ name: "mint",
311
+ relations: [
312
+ "merkle_distributor"
313
+ ]
314
+ },
315
+ {
316
+ name: "distributor_token_account",
317
+ writable: true,
318
+ pda: {
319
+ seeds: [
320
+ {
321
+ kind: "account",
322
+ path: "distributor"
323
+ },
324
+ {
325
+ kind: "account",
326
+ path: "token_program"
327
+ },
328
+ {
329
+ kind: "account",
330
+ path: "mint"
331
+ }
332
+ ],
333
+ program: {
334
+ kind: "const",
335
+ value: [
336
+ 140,
337
+ 151,
338
+ 37,
339
+ 143,
340
+ 78,
341
+ 36,
342
+ 137,
343
+ 241,
344
+ 187,
345
+ 61,
346
+ 16,
347
+ 41,
348
+ 20,
349
+ 142,
350
+ 13,
351
+ 131,
352
+ 11,
353
+ 90,
354
+ 19,
355
+ 153,
356
+ 218,
357
+ 255,
358
+ 16,
359
+ 132,
360
+ 4,
361
+ 142,
362
+ 123,
363
+ 216,
364
+ 219,
365
+ 233,
366
+ 248,
367
+ 89
368
+ ]
369
+ }
370
+ }
371
+ },
372
+ {
373
+ name: "vault_token_account",
374
+ writable: true,
375
+ pda: {
376
+ seeds: [
377
+ {
378
+ kind: "account",
379
+ path: "merkle_admin"
380
+ },
381
+ {
382
+ kind: "account",
383
+ path: "token_program"
384
+ },
385
+ {
386
+ kind: "account",
387
+ path: "mint"
388
+ }
389
+ ],
390
+ program: {
391
+ kind: "const",
392
+ value: [
393
+ 140,
394
+ 151,
395
+ 37,
396
+ 143,
397
+ 78,
398
+ 36,
399
+ 137,
400
+ 241,
401
+ 187,
402
+ 61,
403
+ 16,
404
+ 41,
405
+ 20,
406
+ 142,
407
+ 13,
408
+ 131,
409
+ 11,
410
+ 90,
411
+ 19,
412
+ 153,
413
+ 218,
414
+ 255,
415
+ 16,
416
+ 132,
417
+ 4,
418
+ 142,
419
+ 123,
420
+ 216,
421
+ 219,
422
+ 233,
423
+ 248,
424
+ 89
425
+ ]
426
+ }
427
+ }
428
+ },
429
+ {
430
+ name: "token_program"
431
+ },
432
+ {
433
+ name: "associated_token_program",
434
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
435
+ },
436
+ {
437
+ name: "system_program",
438
+ address: "11111111111111111111111111111111"
439
+ }
440
+ ],
441
+ args: [
442
+ {
443
+ name: "amount",
444
+ type: "u64"
445
+ }
446
+ ]
447
+ },
448
+ {
449
+ name: "init_distributor",
450
+ discriminator: [
451
+ 4,
452
+ 170,
453
+ 72,
454
+ 1,
455
+ 58,
456
+ 177,
457
+ 150,
458
+ 43
459
+ ],
460
+ accounts: [
461
+ {
462
+ name: "authority",
463
+ writable: true,
464
+ signer: true
465
+ },
466
+ {
467
+ name: "merkle_admin",
468
+ writable: true
469
+ },
470
+ {
471
+ name: "merkle_distributor",
472
+ writable: true,
473
+ pda: {
474
+ seeds: [
475
+ {
476
+ kind: "const",
477
+ value: [
478
+ 100,
479
+ 105,
480
+ 115,
481
+ 116,
482
+ 114,
483
+ 105,
484
+ 98,
485
+ 117,
486
+ 116,
487
+ 111,
488
+ 114
489
+ ]
490
+ },
491
+ {
492
+ kind: "account",
493
+ path: "mint"
494
+ },
495
+ {
496
+ kind: "account",
497
+ path: "merkle_admin.next_distributor_id",
498
+ account: "MerkleAdmin"
499
+ }
500
+ ]
501
+ }
502
+ },
503
+ {
504
+ name: "mint"
505
+ },
506
+ {
507
+ name: "system_program",
508
+ address: "11111111111111111111111111111111"
509
+ }
510
+ ],
511
+ args: [
512
+ {
513
+ name: "params",
514
+ type: {
515
+ defined: {
516
+ name: "InitializeParams"
517
+ }
518
+ }
519
+ }
520
+ ]
521
+ },
522
+ {
523
+ name: "init_merkle_admin",
524
+ discriminator: [
525
+ 130,
526
+ 19,
527
+ 59,
528
+ 140,
529
+ 26,
530
+ 4,
531
+ 117,
532
+ 19
533
+ ],
534
+ accounts: [
535
+ {
536
+ name: "signer",
537
+ writable: true,
538
+ signer: true
539
+ },
540
+ {
541
+ name: "merkle_admin",
542
+ writable: true,
543
+ pda: {
544
+ seeds: [
545
+ {
546
+ kind: "const",
547
+ value: [
548
+ 109,
549
+ 101,
550
+ 114,
551
+ 107,
552
+ 108,
553
+ 101,
554
+ 95,
555
+ 97,
556
+ 100,
557
+ 109,
558
+ 105,
559
+ 110
560
+ ]
561
+ }
562
+ ]
563
+ }
564
+ },
565
+ {
566
+ name: "system_program",
567
+ address: "11111111111111111111111111111111"
568
+ }
569
+ ],
570
+ args: [
571
+ {
572
+ name: "authority",
573
+ type: "pubkey"
574
+ }
575
+ ]
576
+ },
577
+ {
578
+ name: "init_role",
579
+ discriminator: [
580
+ 24,
581
+ 82,
582
+ 229,
583
+ 76,
584
+ 200,
585
+ 87,
586
+ 242,
587
+ 26
588
+ ],
589
+ accounts: [
590
+ {
591
+ name: "authority",
592
+ writable: true,
593
+ signer: true
594
+ },
595
+ {
596
+ name: "merkle_admin"
597
+ },
598
+ {
599
+ name: "role_account",
600
+ writable: true,
601
+ pda: {
602
+ seeds: [
603
+ {
604
+ kind: "const",
605
+ value: [
606
+ 114,
607
+ 111,
608
+ 108,
609
+ 101
610
+ ]
611
+ },
612
+ {
613
+ kind: "arg",
614
+ path: "address"
615
+ },
616
+ {
617
+ kind: "arg",
618
+ path: "role"
619
+ }
620
+ ]
621
+ }
622
+ },
623
+ {
624
+ name: "system_program",
625
+ address: "11111111111111111111111111111111"
626
+ }
627
+ ],
628
+ args: [
629
+ {
630
+ name: "address",
631
+ type: "pubkey"
632
+ },
633
+ {
634
+ name: "role",
635
+ type: "u8"
636
+ }
637
+ ]
638
+ },
639
+ {
640
+ name: "propose_root",
641
+ discriminator: [
642
+ 132,
643
+ 0,
644
+ 76,
645
+ 107,
646
+ 236,
647
+ 86,
648
+ 118,
649
+ 165
650
+ ],
651
+ accounts: [
652
+ {
653
+ name: "proposer",
654
+ signer: true
655
+ },
656
+ {
657
+ name: "merkle_admin"
658
+ },
659
+ {
660
+ name: "distributor",
661
+ writable: true
662
+ },
663
+ {
664
+ name: "proposer_role"
665
+ }
666
+ ],
667
+ args: [
668
+ {
669
+ name: "merkle_root",
670
+ type: {
671
+ array: [
672
+ "u8",
673
+ 32
674
+ ]
675
+ }
676
+ },
677
+ {
678
+ name: "cycle",
679
+ type: "u32"
680
+ },
681
+ {
682
+ name: "start_slot",
683
+ type: "u32"
684
+ },
685
+ {
686
+ name: "end_slot",
687
+ type: "u32"
688
+ }
689
+ ]
690
+ },
691
+ {
692
+ name: "update_auths",
693
+ discriminator: [
694
+ 93,
695
+ 96,
696
+ 178,
697
+ 156,
698
+ 57,
699
+ 117,
700
+ 253,
701
+ 209
702
+ ],
703
+ accounts: [
704
+ {
705
+ name: "authority",
706
+ signer: true
707
+ },
708
+ {
709
+ name: "merkle_admin",
710
+ writable: true
711
+ }
712
+ ],
713
+ args: [
714
+ {
715
+ name: "auth_status",
716
+ type: {
717
+ vec: {
718
+ defined: {
719
+ name: "AddressBool"
720
+ }
721
+ }
722
+ }
723
+ }
724
+ ]
725
+ },
726
+ {
727
+ name: "update_role",
728
+ discriminator: [
729
+ 36,
730
+ 223,
731
+ 162,
732
+ 98,
733
+ 168,
734
+ 209,
735
+ 75,
736
+ 151
737
+ ],
738
+ accounts: [
739
+ {
740
+ name: "authority",
741
+ signer: true
742
+ },
743
+ {
744
+ name: "merkle_admin"
745
+ },
746
+ {
747
+ name: "role_account",
748
+ writable: true
749
+ }
750
+ ],
751
+ args: [
752
+ {
753
+ name: "turn_off",
754
+ type: "bool"
755
+ }
756
+ ]
757
+ }
758
+ ];
759
+ const accounts = [
760
+ {
761
+ name: "ClaimStatus",
762
+ discriminator: [
763
+ 22,
764
+ 183,
765
+ 249,
766
+ 157,
767
+ 247,
768
+ 95,
769
+ 150,
770
+ 96
771
+ ]
772
+ },
773
+ {
774
+ name: "MerkleAdmin",
775
+ discriminator: [
776
+ 0,
777
+ 192,
778
+ 185,
779
+ 207,
780
+ 98,
781
+ 65,
782
+ 4,
783
+ 187
784
+ ]
785
+ },
786
+ {
787
+ name: "MerkleDistributor",
788
+ discriminator: [
789
+ 77,
790
+ 119,
791
+ 139,
792
+ 70,
793
+ 84,
794
+ 247,
795
+ 12,
796
+ 26
797
+ ]
798
+ },
799
+ {
800
+ name: "RoleAccount",
801
+ discriminator: [
802
+ 142,
803
+ 236,
804
+ 135,
805
+ 197,
806
+ 214,
807
+ 3,
808
+ 244,
809
+ 226
810
+ ]
811
+ }
812
+ ];
813
+ const events = [
814
+ {
815
+ name: "LogClaimed",
816
+ discriminator: [
817
+ 215,
818
+ 10,
819
+ 98,
820
+ 242,
821
+ 67,
822
+ 30,
823
+ 230,
824
+ 185
825
+ ]
826
+ },
827
+ {
828
+ name: "LogDistribution",
829
+ discriminator: [
830
+ 122,
831
+ 162,
832
+ 17,
833
+ 219,
834
+ 57,
835
+ 67,
836
+ 93,
837
+ 50
838
+ ]
839
+ },
840
+ {
841
+ name: "LogDistributionConfigUpdated",
842
+ discriminator: [
843
+ 64,
844
+ 108,
845
+ 152,
846
+ 215,
847
+ 83,
848
+ 217,
849
+ 187,
850
+ 190
851
+ ]
852
+ },
853
+ {
854
+ name: "LogInitRole",
855
+ discriminator: [
856
+ 14,
857
+ 236,
858
+ 197,
859
+ 243,
860
+ 241,
861
+ 106,
862
+ 70,
863
+ 162
864
+ ]
865
+ },
866
+ {
867
+ name: "LogRewardsDistributorToggled",
868
+ discriminator: [
869
+ 160,
870
+ 88,
871
+ 97,
872
+ 43,
873
+ 45,
874
+ 180,
875
+ 117,
876
+ 136
877
+ ]
878
+ },
879
+ {
880
+ name: "LogRootProposed",
881
+ discriminator: [
882
+ 241,
883
+ 45,
884
+ 0,
885
+ 250,
886
+ 225,
887
+ 243,
888
+ 158,
889
+ 34
890
+ ]
891
+ },
892
+ {
893
+ name: "LogRootUpdated",
894
+ discriminator: [
895
+ 79,
896
+ 2,
897
+ 209,
898
+ 136,
899
+ 63,
900
+ 82,
901
+ 145,
902
+ 211
903
+ ]
904
+ },
905
+ {
906
+ name: "LogStartBlockOfNextCycleUpdated",
907
+ discriminator: [
908
+ 46,
909
+ 130,
910
+ 115,
911
+ 115,
912
+ 242,
913
+ 191,
914
+ 9,
915
+ 226
916
+ ]
917
+ },
918
+ {
919
+ name: "LogUpdateAuths",
920
+ discriminator: [
921
+ 88,
922
+ 80,
923
+ 109,
924
+ 48,
925
+ 111,
926
+ 203,
927
+ 76,
928
+ 251
929
+ ]
930
+ },
931
+ {
932
+ name: "LogUpdateRole",
933
+ discriminator: [
934
+ 138,
935
+ 23,
936
+ 252,
937
+ 139,
938
+ 73,
939
+ 226,
940
+ 226,
941
+ 166
942
+ ]
943
+ }
944
+ ];
945
+ const errors = [
946
+ {
947
+ code: 6000,
948
+ name: "InvalidParams",
949
+ msg: "INVALID_PARAMS"
950
+ },
951
+ {
952
+ code: 6001,
953
+ name: "Unauthorized",
954
+ msg: "UNAUTHORIZED"
955
+ },
956
+ {
957
+ code: 6002,
958
+ name: "RewardsPaused",
959
+ msg: "REWARDS_PAUSED"
960
+ },
961
+ {
962
+ code: 6003,
963
+ name: "InvalidCycle",
964
+ msg: "INVALID_CYCLE"
965
+ },
966
+ {
967
+ code: 6004,
968
+ name: "InvalidProof",
969
+ msg: "INVALID_PROOF"
970
+ },
971
+ {
972
+ code: 6005,
973
+ name: "NothingToClaim",
974
+ msg: "NOTHING_TO_CLAIM"
975
+ },
976
+ {
977
+ code: 6006,
978
+ name: "MaxAuthCountReached",
979
+ msg: "MAX_AUTH_COUNT_REACHED"
980
+ },
981
+ {
982
+ code: 6007,
983
+ name: "InvalidDistributor",
984
+ msg: "INVALID_DISTRIBUTOR"
985
+ }
986
+ ];
987
+ const types = [
988
+ {
989
+ name: "AddressBool",
990
+ type: {
991
+ kind: "struct",
992
+ fields: [
993
+ {
994
+ name: "addr",
995
+ type: "pubkey"
996
+ },
997
+ {
998
+ name: "value",
999
+ type: "bool"
1000
+ }
1001
+ ]
1002
+ }
1003
+ },
1004
+ {
1005
+ name: "ClaimStatus",
1006
+ type: {
1007
+ kind: "struct",
1008
+ fields: [
1009
+ {
1010
+ name: "recipient",
1011
+ type: "pubkey"
1012
+ },
1013
+ {
1014
+ name: "position_id",
1015
+ type: "pubkey"
1016
+ },
1017
+ {
1018
+ name: "claimed_amount",
1019
+ type: "u64"
1020
+ }
1021
+ ]
1022
+ }
1023
+ },
1024
+ {
1025
+ name: "InitializeParams",
1026
+ type: {
1027
+ kind: "struct",
1028
+ fields: [
1029
+ {
1030
+ name: "distribution_in_hours",
1031
+ type: "u64"
1032
+ },
1033
+ {
1034
+ name: "cycle_in_hours",
1035
+ type: "u64"
1036
+ },
1037
+ {
1038
+ name: "start_block",
1039
+ type: "u32"
1040
+ },
1041
+ {
1042
+ name: "pull_from_distributor",
1043
+ type: "bool"
1044
+ },
1045
+ {
1046
+ name: "vesting_time",
1047
+ type: "u32"
1048
+ },
1049
+ {
1050
+ name: "vesting_start_time",
1051
+ type: "u32"
1052
+ }
1053
+ ]
1054
+ }
1055
+ },
1056
+ {
1057
+ name: "LogClaimed",
1058
+ type: {
1059
+ kind: "struct",
1060
+ fields: [
1061
+ {
1062
+ name: "user",
1063
+ type: "pubkey"
1064
+ },
1065
+ {
1066
+ name: "amount",
1067
+ type: "u64"
1068
+ },
1069
+ {
1070
+ name: "cycle",
1071
+ type: "u32"
1072
+ },
1073
+ {
1074
+ name: "position_type",
1075
+ type: "u8"
1076
+ },
1077
+ {
1078
+ name: "position_id",
1079
+ type: "pubkey"
1080
+ },
1081
+ {
1082
+ name: "timestamp",
1083
+ type: "u32"
1084
+ },
1085
+ {
1086
+ name: "block_number",
1087
+ type: "u64"
1088
+ }
1089
+ ]
1090
+ }
1091
+ },
1092
+ {
1093
+ name: "LogDistribution",
1094
+ type: {
1095
+ kind: "struct",
1096
+ fields: [
1097
+ {
1098
+ name: "epoch",
1099
+ type: "u32"
1100
+ },
1101
+ {
1102
+ name: "distributor",
1103
+ type: "pubkey"
1104
+ },
1105
+ {
1106
+ name: "amount",
1107
+ type: "u64"
1108
+ },
1109
+ {
1110
+ name: "start_cycle",
1111
+ type: "u32"
1112
+ },
1113
+ {
1114
+ name: "end_cycle",
1115
+ type: "u32"
1116
+ },
1117
+ {
1118
+ name: "registration_block",
1119
+ type: "u32"
1120
+ },
1121
+ {
1122
+ name: "registration_timestamp",
1123
+ type: "u32"
1124
+ }
1125
+ ]
1126
+ }
1127
+ },
1128
+ {
1129
+ name: "LogDistributionConfigUpdated",
1130
+ type: {
1131
+ kind: "struct",
1132
+ fields: [
1133
+ {
1134
+ name: "pull_from_distributor",
1135
+ type: "bool"
1136
+ },
1137
+ {
1138
+ name: "blocks_per_distribution",
1139
+ type: "u32"
1140
+ },
1141
+ {
1142
+ name: "cycles_per_distribution",
1143
+ type: "u32"
1144
+ }
1145
+ ]
1146
+ }
1147
+ },
1148
+ {
1149
+ name: "LogInitRole",
1150
+ type: {
1151
+ kind: "struct",
1152
+ fields: [
1153
+ {
1154
+ name: "address",
1155
+ type: "pubkey"
1156
+ },
1157
+ {
1158
+ name: "role",
1159
+ type: {
1160
+ defined: {
1161
+ name: "RoleType"
1162
+ }
1163
+ }
1164
+ }
1165
+ ]
1166
+ }
1167
+ },
1168
+ {
1169
+ name: "LogRewardsDistributorToggled",
1170
+ type: {
1171
+ kind: "struct",
1172
+ fields: [
1173
+ {
1174
+ name: "distributor",
1175
+ type: "pubkey"
1176
+ },
1177
+ {
1178
+ name: "is_distributor",
1179
+ type: "bool"
1180
+ }
1181
+ ]
1182
+ }
1183
+ },
1184
+ {
1185
+ name: "LogRootProposed",
1186
+ type: {
1187
+ kind: "struct",
1188
+ fields: [
1189
+ {
1190
+ name: "cycle",
1191
+ type: "u32"
1192
+ },
1193
+ {
1194
+ name: "merkle_root",
1195
+ type: {
1196
+ array: [
1197
+ "u8",
1198
+ 32
1199
+ ]
1200
+ }
1201
+ },
1202
+ {
1203
+ name: "timestamp",
1204
+ type: "u32"
1205
+ },
1206
+ {
1207
+ name: "publish_block",
1208
+ type: "u32"
1209
+ }
1210
+ ]
1211
+ }
1212
+ },
1213
+ {
1214
+ name: "LogRootUpdated",
1215
+ type: {
1216
+ kind: "struct",
1217
+ fields: [
1218
+ {
1219
+ name: "cycle",
1220
+ type: "u32"
1221
+ },
1222
+ {
1223
+ name: "merkle_root",
1224
+ type: {
1225
+ array: [
1226
+ "u8",
1227
+ 32
1228
+ ]
1229
+ }
1230
+ },
1231
+ {
1232
+ name: "timestamp",
1233
+ type: "u32"
1234
+ },
1235
+ {
1236
+ name: "publish_block",
1237
+ type: "u32"
1238
+ }
1239
+ ]
1240
+ }
1241
+ },
1242
+ {
1243
+ name: "LogStartBlockOfNextCycleUpdated",
1244
+ type: {
1245
+ kind: "struct",
1246
+ fields: [
1247
+ {
1248
+ name: "start_block",
1249
+ type: "u32"
1250
+ }
1251
+ ]
1252
+ }
1253
+ },
1254
+ {
1255
+ name: "LogUpdateAuths",
1256
+ type: {
1257
+ kind: "struct",
1258
+ fields: [
1259
+ {
1260
+ name: "auth_status",
1261
+ type: {
1262
+ vec: {
1263
+ defined: {
1264
+ name: "AddressBool"
1265
+ }
1266
+ }
1267
+ }
1268
+ }
1269
+ ]
1270
+ }
1271
+ },
1272
+ {
1273
+ name: "LogUpdateRole",
1274
+ type: {
1275
+ kind: "struct",
1276
+ fields: [
1277
+ {
1278
+ name: "address",
1279
+ type: "pubkey"
1280
+ },
1281
+ {
1282
+ name: "role",
1283
+ type: {
1284
+ defined: {
1285
+ name: "RoleType"
1286
+ }
1287
+ }
1288
+ }
1289
+ ]
1290
+ }
1291
+ },
1292
+ {
1293
+ name: "MerkleAdmin",
1294
+ type: {
1295
+ kind: "struct",
1296
+ fields: [
1297
+ {
1298
+ name: "authority",
1299
+ type: "pubkey"
1300
+ },
1301
+ {
1302
+ name: "auths",
1303
+ type: {
1304
+ vec: "pubkey"
1305
+ }
1306
+ },
1307
+ {
1308
+ name: "next_distributor_id",
1309
+ type: "u32"
1310
+ },
1311
+ {
1312
+ name: "bump",
1313
+ type: "u8"
1314
+ }
1315
+ ]
1316
+ }
1317
+ },
1318
+ {
1319
+ name: "MerkleCycle",
1320
+ repr: {
1321
+ kind: "c"
1322
+ },
1323
+ type: {
1324
+ kind: "struct",
1325
+ fields: [
1326
+ {
1327
+ name: "merkle_root",
1328
+ type: {
1329
+ array: [
1330
+ "u8",
1331
+ 32
1332
+ ]
1333
+ }
1334
+ },
1335
+ {
1336
+ name: "cycle",
1337
+ type: "u32"
1338
+ },
1339
+ {
1340
+ name: "timestamp",
1341
+ type: "u32"
1342
+ },
1343
+ {
1344
+ name: "publish_block",
1345
+ type: "u32"
1346
+ },
1347
+ {
1348
+ name: "start_slot",
1349
+ type: "u32"
1350
+ },
1351
+ {
1352
+ name: "end_slot",
1353
+ type: "u32"
1354
+ }
1355
+ ]
1356
+ }
1357
+ },
1358
+ {
1359
+ name: "MerkleDistributor",
1360
+ serialization: "bytemuck",
1361
+ repr: {
1362
+ kind: "c",
1363
+ packed: true
1364
+ },
1365
+ type: {
1366
+ kind: "struct",
1367
+ fields: [
1368
+ {
1369
+ name: "mint",
1370
+ type: "pubkey"
1371
+ },
1372
+ {
1373
+ name: "paused",
1374
+ type: "u8"
1375
+ },
1376
+ {
1377
+ name: "distributor",
1378
+ type: "pubkey"
1379
+ },
1380
+ {
1381
+ name: "current_merkle_cycle",
1382
+ type: {
1383
+ defined: {
1384
+ name: "MerkleCycle"
1385
+ }
1386
+ }
1387
+ },
1388
+ {
1389
+ name: "pending_merkle_cycle",
1390
+ type: {
1391
+ defined: {
1392
+ name: "MerkleCycle"
1393
+ }
1394
+ }
1395
+ },
1396
+ {
1397
+ name: "previous_merkle_root",
1398
+ type: {
1399
+ array: [
1400
+ "u8",
1401
+ 32
1402
+ ]
1403
+ }
1404
+ },
1405
+ {
1406
+ name: "cycles_per_distribution",
1407
+ type: "u32"
1408
+ },
1409
+ {
1410
+ name: "blocks_per_distribution",
1411
+ type: "u32"
1412
+ },
1413
+ {
1414
+ name: "start_block_of_next_cycle",
1415
+ type: "u32"
1416
+ },
1417
+ {
1418
+ name: "end_block_of_last_cycle",
1419
+ type: "u32"
1420
+ },
1421
+ {
1422
+ name: "pull_from_distributor",
1423
+ type: "u8"
1424
+ },
1425
+ {
1426
+ name: "vesting_time",
1427
+ type: "u32"
1428
+ },
1429
+ {
1430
+ name: "vesting_start_time",
1431
+ type: "u32"
1432
+ },
1433
+ {
1434
+ name: "total_rewards_cycles",
1435
+ type: "u32"
1436
+ },
1437
+ {
1438
+ name: "total_distributions",
1439
+ type: "u32"
1440
+ }
1441
+ ]
1442
+ }
1443
+ },
1444
+ {
1445
+ name: "RoleAccount",
1446
+ type: {
1447
+ kind: "struct",
1448
+ fields: [
1449
+ {
1450
+ name: "address",
1451
+ type: "pubkey"
1452
+ },
1453
+ {
1454
+ name: "role",
1455
+ type: "u8"
1456
+ },
1457
+ {
1458
+ name: "active",
1459
+ type: "bool"
1460
+ }
1461
+ ]
1462
+ }
1463
+ },
1464
+ {
1465
+ name: "RoleType",
1466
+ type: {
1467
+ kind: "enum",
1468
+ variants: [
1469
+ {
1470
+ name: "None"
1471
+ },
1472
+ {
1473
+ name: "Proposer"
1474
+ },
1475
+ {
1476
+ name: "Approver"
1477
+ }
1478
+ ]
1479
+ }
1480
+ }
1481
+ ];
1482
+ const merkleDistributor$1 = {
1483
+ address: address,
1484
+ metadata: metadata,
1485
+ instructions: instructions,
1486
+ accounts: accounts,
1487
+ events: events,
1488
+ errors: errors,
1489
+ types: types
1490
+ };
1491
+
1492
+ const MERKLE_DISTRIBUTOR_PROGRAM_ID = new PublicKey(address);
1493
+ const getMerkleAdmin = () => {
1494
+ const [pda] = PublicKey.findProgramAddressSync(
1495
+ [Buffer.from("merkle_admin")],
1496
+ MERKLE_DISTRIBUTOR_PROGRAM_ID
1497
+ );
1498
+ return pda;
1499
+ };
1500
+ const ROLE_TO_INDEX = {
1501
+ none: 0,
1502
+ proposer: 1,
1503
+ approver: 2
1504
+ };
1505
+ const getRole = (role, address) => {
1506
+ const [pda] = PublicKey.findProgramAddressSync(
1507
+ [
1508
+ Buffer.from("role"),
1509
+ address.toBuffer(),
1510
+ new BN(ROLE_TO_INDEX[role]).toArrayLike(Buffer, "le", 1)
1511
+ ],
1512
+ MERKLE_DISTRIBUTOR_PROGRAM_ID
1513
+ );
1514
+ return pda;
1515
+ };
1516
+ const getRewardsDistributor = (rewardToken, nextDistributorId) => {
1517
+ const [pda] = PublicKey.findProgramAddressSync(
1518
+ [
1519
+ Buffer.from("distributor"),
1520
+ rewardToken.toBuffer(),
1521
+ new BN(nextDistributorId).toArrayLike(Buffer, "le", 4)
1522
+ ],
1523
+ MERKLE_DISTRIBUTOR_PROGRAM_ID
1524
+ );
1525
+ return pda;
1526
+ };
1527
+ const getClaimStatus = (user, positionId) => {
1528
+ const [pda] = PublicKey.findProgramAddressSync(
1529
+ [Buffer.from("claim"), user.toBuffer(), positionId.toBuffer()],
1530
+ MERKLE_DISTRIBUTOR_PROGRAM_ID
1531
+ );
1532
+ return pda;
1533
+ };
1534
+
1535
+ const merkleDistributor = {
1536
+ __proto__: null,
1537
+ ROLE_TO_INDEX: ROLE_TO_INDEX,
1538
+ getClaimStatus: getClaimStatus,
1539
+ getMerkleAdmin: getMerkleAdmin,
1540
+ getRewardsDistributor: getRewardsDistributor,
1541
+ getRole: getRole
1542
+ };
1543
+
1544
+ export { getMerkleAdmin as a, getRewardsDistributor as b, merkleDistributor$1 as c, getClaimStatus as g, merkleDistributor as m };