@aromedia/contracts-sdk 0.2.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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +121 -0
  3. package/dist/chains.cjs +67 -0
  4. package/dist/chains.cjs.map +1 -0
  5. package/dist/chains.d.cts +826 -0
  6. package/dist/chains.d.ts +826 -0
  7. package/dist/chains.js +23 -0
  8. package/dist/chains.js.map +1 -0
  9. package/dist/chunk-7I5N3BGV.js +271 -0
  10. package/dist/chunk-7I5N3BGV.js.map +1 -0
  11. package/dist/chunk-BYPGUFYV.js +50 -0
  12. package/dist/chunk-BYPGUFYV.js.map +1 -0
  13. package/dist/chunk-FWZ7XKFC.js +91 -0
  14. package/dist/chunk-FWZ7XKFC.js.map +1 -0
  15. package/dist/chunk-J6YVU3VA.js +35 -0
  16. package/dist/chunk-J6YVU3VA.js.map +1 -0
  17. package/dist/chunk-TZQHQLNY.js +7213 -0
  18. package/dist/chunk-TZQHQLNY.js.map +1 -0
  19. package/dist/generated/abis.cjs +7244 -0
  20. package/dist/generated/abis.cjs.map +1 -0
  21. package/dist/generated/abis.d.cts +11005 -0
  22. package/dist/generated/abis.d.ts +11005 -0
  23. package/dist/generated/abis.js +21 -0
  24. package/dist/generated/abis.js.map +1 -0
  25. package/dist/generated/addresses.cjs +119 -0
  26. package/dist/generated/addresses.cjs.map +1 -0
  27. package/dist/generated/addresses.d.cts +18 -0
  28. package/dist/generated/addresses.d.ts +18 -0
  29. package/dist/generated/addresses.js +15 -0
  30. package/dist/generated/addresses.js.map +1 -0
  31. package/dist/hooks/index.cjs +2005 -0
  32. package/dist/hooks/index.cjs.map +1 -0
  33. package/dist/hooks/index.d.cts +63 -0
  34. package/dist/hooks/index.d.ts +63 -0
  35. package/dist/hooks/index.js +218 -0
  36. package/dist/hooks/index.js.map +1 -0
  37. package/dist/index.cjs +7884 -0
  38. package/dist/index.cjs.map +1 -0
  39. package/dist/index.d.cts +42 -0
  40. package/dist/index.d.ts +42 -0
  41. package/dist/index.js +258 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/onboarding-BHpAJaNW.d.cts +302 -0
  44. package/dist/onboarding-DxL_LpM3.d.ts +302 -0
  45. package/dist/workflows/index.cjs +1988 -0
  46. package/dist/workflows/index.cjs.map +1 -0
  47. package/dist/workflows/index.d.cts +72 -0
  48. package/dist/workflows/index.d.ts +72 -0
  49. package/dist/workflows/index.js +25 -0
  50. package/dist/workflows/index.js.map +1 -0
  51. package/package.json +120 -0
@@ -0,0 +1,1988 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/workflows/index.ts
21
+ var workflows_exports = {};
22
+ __export(workflows_exports, {
23
+ checkMembershipStatus: () => checkMembershipStatus,
24
+ clearNomination: () => clearNomination,
25
+ computeKycHash: () => computeKycHash,
26
+ describeOnboardingState: () => describeOnboardingState,
27
+ getNominationSnapshot: () => getNominationSnapshot,
28
+ hashKycResult: () => hashKycResult,
29
+ mintSBTForApproved: () => mintSBTForApproved,
30
+ nominateCandidate: () => nominateCandidate,
31
+ vouchForCandidate: () => vouchForCandidate
32
+ });
33
+ module.exports = __toCommonJS(workflows_exports);
34
+
35
+ // src/generated/abis.ts
36
+ var AroSBT_ABI = [
37
+ {
38
+ "inputs": [
39
+ {
40
+ "internalType": "address",
41
+ "name": "initialAuthority",
42
+ "type": "address"
43
+ }
44
+ ],
45
+ "stateMutability": "nonpayable",
46
+ "type": "constructor"
47
+ },
48
+ {
49
+ "inputs": [
50
+ {
51
+ "internalType": "address",
52
+ "name": "authority",
53
+ "type": "address"
54
+ }
55
+ ],
56
+ "name": "AccessManagedInvalidAuthority",
57
+ "type": "error"
58
+ },
59
+ {
60
+ "inputs": [
61
+ {
62
+ "internalType": "address",
63
+ "name": "caller",
64
+ "type": "address"
65
+ },
66
+ {
67
+ "internalType": "uint32",
68
+ "name": "delay",
69
+ "type": "uint32"
70
+ }
71
+ ],
72
+ "name": "AccessManagedRequiredDelay",
73
+ "type": "error"
74
+ },
75
+ {
76
+ "inputs": [
77
+ {
78
+ "internalType": "address",
79
+ "name": "caller",
80
+ "type": "address"
81
+ }
82
+ ],
83
+ "name": "AccessManagedUnauthorized",
84
+ "type": "error"
85
+ },
86
+ {
87
+ "inputs": [
88
+ {
89
+ "internalType": "address",
90
+ "name": "account",
91
+ "type": "address"
92
+ }
93
+ ],
94
+ "name": "AlreadyHasSBT",
95
+ "type": "error"
96
+ },
97
+ {
98
+ "inputs": [],
99
+ "name": "ERC721EnumerableForbiddenBatchMint",
100
+ "type": "error"
101
+ },
102
+ {
103
+ "inputs": [
104
+ {
105
+ "internalType": "address",
106
+ "name": "sender",
107
+ "type": "address"
108
+ },
109
+ {
110
+ "internalType": "uint256",
111
+ "name": "tokenId",
112
+ "type": "uint256"
113
+ },
114
+ {
115
+ "internalType": "address",
116
+ "name": "owner",
117
+ "type": "address"
118
+ }
119
+ ],
120
+ "name": "ERC721IncorrectOwner",
121
+ "type": "error"
122
+ },
123
+ {
124
+ "inputs": [
125
+ {
126
+ "internalType": "address",
127
+ "name": "operator",
128
+ "type": "address"
129
+ },
130
+ {
131
+ "internalType": "uint256",
132
+ "name": "tokenId",
133
+ "type": "uint256"
134
+ }
135
+ ],
136
+ "name": "ERC721InsufficientApproval",
137
+ "type": "error"
138
+ },
139
+ {
140
+ "inputs": [
141
+ {
142
+ "internalType": "address",
143
+ "name": "approver",
144
+ "type": "address"
145
+ }
146
+ ],
147
+ "name": "ERC721InvalidApprover",
148
+ "type": "error"
149
+ },
150
+ {
151
+ "inputs": [
152
+ {
153
+ "internalType": "address",
154
+ "name": "operator",
155
+ "type": "address"
156
+ }
157
+ ],
158
+ "name": "ERC721InvalidOperator",
159
+ "type": "error"
160
+ },
161
+ {
162
+ "inputs": [
163
+ {
164
+ "internalType": "address",
165
+ "name": "owner",
166
+ "type": "address"
167
+ }
168
+ ],
169
+ "name": "ERC721InvalidOwner",
170
+ "type": "error"
171
+ },
172
+ {
173
+ "inputs": [
174
+ {
175
+ "internalType": "address",
176
+ "name": "receiver",
177
+ "type": "address"
178
+ }
179
+ ],
180
+ "name": "ERC721InvalidReceiver",
181
+ "type": "error"
182
+ },
183
+ {
184
+ "inputs": [
185
+ {
186
+ "internalType": "address",
187
+ "name": "sender",
188
+ "type": "address"
189
+ }
190
+ ],
191
+ "name": "ERC721InvalidSender",
192
+ "type": "error"
193
+ },
194
+ {
195
+ "inputs": [
196
+ {
197
+ "internalType": "uint256",
198
+ "name": "tokenId",
199
+ "type": "uint256"
200
+ }
201
+ ],
202
+ "name": "ERC721NonexistentToken",
203
+ "type": "error"
204
+ },
205
+ {
206
+ "inputs": [
207
+ {
208
+ "internalType": "address",
209
+ "name": "owner",
210
+ "type": "address"
211
+ },
212
+ {
213
+ "internalType": "uint256",
214
+ "name": "index",
215
+ "type": "uint256"
216
+ }
217
+ ],
218
+ "name": "ERC721OutOfBoundsIndex",
219
+ "type": "error"
220
+ },
221
+ {
222
+ "inputs": [],
223
+ "name": "EnforcedPause",
224
+ "type": "error"
225
+ },
226
+ {
227
+ "inputs": [],
228
+ "name": "ExpectedPause",
229
+ "type": "error"
230
+ },
231
+ {
232
+ "inputs": [
233
+ {
234
+ "internalType": "address",
235
+ "name": "account",
236
+ "type": "address"
237
+ }
238
+ ],
239
+ "name": "NoSBT",
240
+ "type": "error"
241
+ },
242
+ {
243
+ "inputs": [],
244
+ "name": "SoulboundTransferBlocked",
245
+ "type": "error"
246
+ },
247
+ {
248
+ "anonymous": false,
249
+ "inputs": [
250
+ {
251
+ "indexed": true,
252
+ "internalType": "address",
253
+ "name": "owner",
254
+ "type": "address"
255
+ },
256
+ {
257
+ "indexed": true,
258
+ "internalType": "address",
259
+ "name": "approved",
260
+ "type": "address"
261
+ },
262
+ {
263
+ "indexed": true,
264
+ "internalType": "uint256",
265
+ "name": "tokenId",
266
+ "type": "uint256"
267
+ }
268
+ ],
269
+ "name": "Approval",
270
+ "type": "event"
271
+ },
272
+ {
273
+ "anonymous": false,
274
+ "inputs": [
275
+ {
276
+ "indexed": true,
277
+ "internalType": "address",
278
+ "name": "owner",
279
+ "type": "address"
280
+ },
281
+ {
282
+ "indexed": true,
283
+ "internalType": "address",
284
+ "name": "operator",
285
+ "type": "address"
286
+ },
287
+ {
288
+ "indexed": false,
289
+ "internalType": "bool",
290
+ "name": "approved",
291
+ "type": "bool"
292
+ }
293
+ ],
294
+ "name": "ApprovalForAll",
295
+ "type": "event"
296
+ },
297
+ {
298
+ "anonymous": false,
299
+ "inputs": [
300
+ {
301
+ "indexed": false,
302
+ "internalType": "address",
303
+ "name": "authority",
304
+ "type": "address"
305
+ }
306
+ ],
307
+ "name": "AuthorityUpdated",
308
+ "type": "event"
309
+ },
310
+ {
311
+ "anonymous": false,
312
+ "inputs": [
313
+ {
314
+ "indexed": false,
315
+ "internalType": "uint256",
316
+ "name": "_fromTokenId",
317
+ "type": "uint256"
318
+ },
319
+ {
320
+ "indexed": false,
321
+ "internalType": "uint256",
322
+ "name": "_toTokenId",
323
+ "type": "uint256"
324
+ }
325
+ ],
326
+ "name": "BatchMetadataUpdate",
327
+ "type": "event"
328
+ },
329
+ {
330
+ "anonymous": false,
331
+ "inputs": [
332
+ {
333
+ "indexed": false,
334
+ "internalType": "uint256",
335
+ "name": "tokenId",
336
+ "type": "uint256"
337
+ }
338
+ ],
339
+ "name": "Locked",
340
+ "type": "event"
341
+ },
342
+ {
343
+ "anonymous": false,
344
+ "inputs": [
345
+ {
346
+ "indexed": true,
347
+ "internalType": "address",
348
+ "name": "member",
349
+ "type": "address"
350
+ },
351
+ {
352
+ "indexed": true,
353
+ "internalType": "uint256",
354
+ "name": "tokenId",
355
+ "type": "uint256"
356
+ },
357
+ {
358
+ "indexed": false,
359
+ "internalType": "uint256",
360
+ "name": "memberId",
361
+ "type": "uint256"
362
+ },
363
+ {
364
+ "indexed": false,
365
+ "internalType": "enum AroSBT.Tier",
366
+ "name": "tier",
367
+ "type": "uint8"
368
+ },
369
+ {
370
+ "indexed": false,
371
+ "internalType": "bytes32",
372
+ "name": "kycHash",
373
+ "type": "bytes32"
374
+ }
375
+ ],
376
+ "name": "MemberAdmitted",
377
+ "type": "event"
378
+ },
379
+ {
380
+ "anonymous": false,
381
+ "inputs": [
382
+ {
383
+ "indexed": true,
384
+ "internalType": "address",
385
+ "name": "member",
386
+ "type": "address"
387
+ },
388
+ {
389
+ "indexed": true,
390
+ "internalType": "uint256",
391
+ "name": "tokenId",
392
+ "type": "uint256"
393
+ },
394
+ {
395
+ "indexed": false,
396
+ "internalType": "uint256",
397
+ "name": "memberId",
398
+ "type": "uint256"
399
+ }
400
+ ],
401
+ "name": "MemberRevoked",
402
+ "type": "event"
403
+ },
404
+ {
405
+ "anonymous": false,
406
+ "inputs": [
407
+ {
408
+ "indexed": false,
409
+ "internalType": "uint256",
410
+ "name": "_tokenId",
411
+ "type": "uint256"
412
+ }
413
+ ],
414
+ "name": "MetadataUpdate",
415
+ "type": "event"
416
+ },
417
+ {
418
+ "anonymous": false,
419
+ "inputs": [
420
+ {
421
+ "indexed": false,
422
+ "internalType": "address",
423
+ "name": "account",
424
+ "type": "address"
425
+ }
426
+ ],
427
+ "name": "Paused",
428
+ "type": "event"
429
+ },
430
+ {
431
+ "anonymous": false,
432
+ "inputs": [
433
+ {
434
+ "indexed": true,
435
+ "internalType": "address",
436
+ "name": "member",
437
+ "type": "address"
438
+ },
439
+ {
440
+ "indexed": true,
441
+ "internalType": "uint256",
442
+ "name": "tokenId",
443
+ "type": "uint256"
444
+ },
445
+ {
446
+ "indexed": false,
447
+ "internalType": "enum AroSBT.Tier",
448
+ "name": "oldTier",
449
+ "type": "uint8"
450
+ },
451
+ {
452
+ "indexed": false,
453
+ "internalType": "enum AroSBT.Tier",
454
+ "name": "newTier",
455
+ "type": "uint8"
456
+ }
457
+ ],
458
+ "name": "TierUpdated",
459
+ "type": "event"
460
+ },
461
+ {
462
+ "anonymous": false,
463
+ "inputs": [
464
+ {
465
+ "indexed": true,
466
+ "internalType": "address",
467
+ "name": "from",
468
+ "type": "address"
469
+ },
470
+ {
471
+ "indexed": true,
472
+ "internalType": "address",
473
+ "name": "to",
474
+ "type": "address"
475
+ },
476
+ {
477
+ "indexed": true,
478
+ "internalType": "uint256",
479
+ "name": "tokenId",
480
+ "type": "uint256"
481
+ }
482
+ ],
483
+ "name": "Transfer",
484
+ "type": "event"
485
+ },
486
+ {
487
+ "anonymous": false,
488
+ "inputs": [
489
+ {
490
+ "indexed": false,
491
+ "internalType": "uint256",
492
+ "name": "tokenId",
493
+ "type": "uint256"
494
+ }
495
+ ],
496
+ "name": "Unlocked",
497
+ "type": "event"
498
+ },
499
+ {
500
+ "anonymous": false,
501
+ "inputs": [
502
+ {
503
+ "indexed": false,
504
+ "internalType": "address",
505
+ "name": "account",
506
+ "type": "address"
507
+ }
508
+ ],
509
+ "name": "Unpaused",
510
+ "type": "event"
511
+ },
512
+ {
513
+ "inputs": [
514
+ {
515
+ "internalType": "address",
516
+ "name": "to",
517
+ "type": "address"
518
+ },
519
+ {
520
+ "internalType": "uint256",
521
+ "name": "tokenId",
522
+ "type": "uint256"
523
+ }
524
+ ],
525
+ "name": "approve",
526
+ "outputs": [],
527
+ "stateMutability": "nonpayable",
528
+ "type": "function"
529
+ },
530
+ {
531
+ "inputs": [],
532
+ "name": "authority",
533
+ "outputs": [
534
+ {
535
+ "internalType": "address",
536
+ "name": "",
537
+ "type": "address"
538
+ }
539
+ ],
540
+ "stateMutability": "view",
541
+ "type": "function"
542
+ },
543
+ {
544
+ "inputs": [
545
+ {
546
+ "internalType": "address",
547
+ "name": "owner",
548
+ "type": "address"
549
+ }
550
+ ],
551
+ "name": "balanceOf",
552
+ "outputs": [
553
+ {
554
+ "internalType": "uint256",
555
+ "name": "",
556
+ "type": "uint256"
557
+ }
558
+ ],
559
+ "stateMutability": "view",
560
+ "type": "function"
561
+ },
562
+ {
563
+ "inputs": [
564
+ {
565
+ "internalType": "uint256",
566
+ "name": "tokenId",
567
+ "type": "uint256"
568
+ }
569
+ ],
570
+ "name": "getApproved",
571
+ "outputs": [
572
+ {
573
+ "internalType": "address",
574
+ "name": "",
575
+ "type": "address"
576
+ }
577
+ ],
578
+ "stateMutability": "view",
579
+ "type": "function"
580
+ },
581
+ {
582
+ "inputs": [
583
+ {
584
+ "internalType": "address",
585
+ "name": "account",
586
+ "type": "address"
587
+ }
588
+ ],
589
+ "name": "getMemberData",
590
+ "outputs": [
591
+ {
592
+ "components": [
593
+ {
594
+ "internalType": "uint256",
595
+ "name": "memberId",
596
+ "type": "uint256"
597
+ },
598
+ {
599
+ "internalType": "uint256",
600
+ "name": "issuanceDate",
601
+ "type": "uint256"
602
+ },
603
+ {
604
+ "internalType": "enum AroSBT.Tier",
605
+ "name": "tier",
606
+ "type": "uint8"
607
+ },
608
+ {
609
+ "internalType": "bytes32",
610
+ "name": "kycHash",
611
+ "type": "bytes32"
612
+ }
613
+ ],
614
+ "internalType": "struct AroSBT.MemberData",
615
+ "name": "data",
616
+ "type": "tuple"
617
+ }
618
+ ],
619
+ "stateMutability": "view",
620
+ "type": "function"
621
+ },
622
+ {
623
+ "inputs": [
624
+ {
625
+ "internalType": "uint256",
626
+ "name": "tokenId",
627
+ "type": "uint256"
628
+ }
629
+ ],
630
+ "name": "getMemberDataByToken",
631
+ "outputs": [
632
+ {
633
+ "components": [
634
+ {
635
+ "internalType": "uint256",
636
+ "name": "memberId",
637
+ "type": "uint256"
638
+ },
639
+ {
640
+ "internalType": "uint256",
641
+ "name": "issuanceDate",
642
+ "type": "uint256"
643
+ },
644
+ {
645
+ "internalType": "enum AroSBT.Tier",
646
+ "name": "tier",
647
+ "type": "uint8"
648
+ },
649
+ {
650
+ "internalType": "bytes32",
651
+ "name": "kycHash",
652
+ "type": "bytes32"
653
+ }
654
+ ],
655
+ "internalType": "struct AroSBT.MemberData",
656
+ "name": "data",
657
+ "type": "tuple"
658
+ }
659
+ ],
660
+ "stateMutability": "view",
661
+ "type": "function"
662
+ },
663
+ {
664
+ "inputs": [
665
+ {
666
+ "internalType": "address",
667
+ "name": "account",
668
+ "type": "address"
669
+ }
670
+ ],
671
+ "name": "hasSBT",
672
+ "outputs": [
673
+ {
674
+ "internalType": "bool",
675
+ "name": "",
676
+ "type": "bool"
677
+ }
678
+ ],
679
+ "stateMutability": "view",
680
+ "type": "function"
681
+ },
682
+ {
683
+ "inputs": [
684
+ {
685
+ "internalType": "address",
686
+ "name": "owner",
687
+ "type": "address"
688
+ },
689
+ {
690
+ "internalType": "address",
691
+ "name": "operator",
692
+ "type": "address"
693
+ }
694
+ ],
695
+ "name": "isApprovedForAll",
696
+ "outputs": [
697
+ {
698
+ "internalType": "bool",
699
+ "name": "",
700
+ "type": "bool"
701
+ }
702
+ ],
703
+ "stateMutability": "view",
704
+ "type": "function"
705
+ },
706
+ {
707
+ "inputs": [],
708
+ "name": "isConsumingScheduledOp",
709
+ "outputs": [
710
+ {
711
+ "internalType": "bytes4",
712
+ "name": "",
713
+ "type": "bytes4"
714
+ }
715
+ ],
716
+ "stateMutability": "view",
717
+ "type": "function"
718
+ },
719
+ {
720
+ "inputs": [
721
+ {
722
+ "internalType": "uint256",
723
+ "name": "tokenId",
724
+ "type": "uint256"
725
+ }
726
+ ],
727
+ "name": "locked",
728
+ "outputs": [
729
+ {
730
+ "internalType": "bool",
731
+ "name": "",
732
+ "type": "bool"
733
+ }
734
+ ],
735
+ "stateMutability": "view",
736
+ "type": "function"
737
+ },
738
+ {
739
+ "inputs": [
740
+ {
741
+ "internalType": "address",
742
+ "name": "to",
743
+ "type": "address"
744
+ },
745
+ {
746
+ "internalType": "bytes32",
747
+ "name": "kycHash",
748
+ "type": "bytes32"
749
+ },
750
+ {
751
+ "internalType": "string",
752
+ "name": "metadataURI",
753
+ "type": "string"
754
+ }
755
+ ],
756
+ "name": "mint",
757
+ "outputs": [
758
+ {
759
+ "internalType": "uint256",
760
+ "name": "",
761
+ "type": "uint256"
762
+ }
763
+ ],
764
+ "stateMutability": "nonpayable",
765
+ "type": "function"
766
+ },
767
+ {
768
+ "inputs": [
769
+ {
770
+ "internalType": "address",
771
+ "name": "to",
772
+ "type": "address"
773
+ },
774
+ {
775
+ "internalType": "bytes32",
776
+ "name": "kycHash",
777
+ "type": "bytes32"
778
+ },
779
+ {
780
+ "internalType": "string",
781
+ "name": "metadataURI",
782
+ "type": "string"
783
+ },
784
+ {
785
+ "internalType": "enum AroSBT.Tier",
786
+ "name": "tier",
787
+ "type": "uint8"
788
+ }
789
+ ],
790
+ "name": "mint",
791
+ "outputs": [
792
+ {
793
+ "internalType": "uint256",
794
+ "name": "",
795
+ "type": "uint256"
796
+ }
797
+ ],
798
+ "stateMutability": "nonpayable",
799
+ "type": "function"
800
+ },
801
+ {
802
+ "inputs": [],
803
+ "name": "name",
804
+ "outputs": [
805
+ {
806
+ "internalType": "string",
807
+ "name": "",
808
+ "type": "string"
809
+ }
810
+ ],
811
+ "stateMutability": "view",
812
+ "type": "function"
813
+ },
814
+ {
815
+ "inputs": [
816
+ {
817
+ "internalType": "uint256",
818
+ "name": "tokenId",
819
+ "type": "uint256"
820
+ }
821
+ ],
822
+ "name": "ownerOf",
823
+ "outputs": [
824
+ {
825
+ "internalType": "address",
826
+ "name": "",
827
+ "type": "address"
828
+ }
829
+ ],
830
+ "stateMutability": "view",
831
+ "type": "function"
832
+ },
833
+ {
834
+ "inputs": [],
835
+ "name": "pause",
836
+ "outputs": [],
837
+ "stateMutability": "nonpayable",
838
+ "type": "function"
839
+ },
840
+ {
841
+ "inputs": [],
842
+ "name": "paused",
843
+ "outputs": [
844
+ {
845
+ "internalType": "bool",
846
+ "name": "",
847
+ "type": "bool"
848
+ }
849
+ ],
850
+ "stateMutability": "view",
851
+ "type": "function"
852
+ },
853
+ {
854
+ "inputs": [
855
+ {
856
+ "internalType": "uint256",
857
+ "name": "tokenId",
858
+ "type": "uint256"
859
+ }
860
+ ],
861
+ "name": "revoke",
862
+ "outputs": [],
863
+ "stateMutability": "nonpayable",
864
+ "type": "function"
865
+ },
866
+ {
867
+ "inputs": [
868
+ {
869
+ "internalType": "address",
870
+ "name": "from",
871
+ "type": "address"
872
+ },
873
+ {
874
+ "internalType": "address",
875
+ "name": "to",
876
+ "type": "address"
877
+ },
878
+ {
879
+ "internalType": "uint256",
880
+ "name": "tokenId",
881
+ "type": "uint256"
882
+ }
883
+ ],
884
+ "name": "safeTransferFrom",
885
+ "outputs": [],
886
+ "stateMutability": "nonpayable",
887
+ "type": "function"
888
+ },
889
+ {
890
+ "inputs": [
891
+ {
892
+ "internalType": "address",
893
+ "name": "from",
894
+ "type": "address"
895
+ },
896
+ {
897
+ "internalType": "address",
898
+ "name": "to",
899
+ "type": "address"
900
+ },
901
+ {
902
+ "internalType": "uint256",
903
+ "name": "tokenId",
904
+ "type": "uint256"
905
+ },
906
+ {
907
+ "internalType": "bytes",
908
+ "name": "data",
909
+ "type": "bytes"
910
+ }
911
+ ],
912
+ "name": "safeTransferFrom",
913
+ "outputs": [],
914
+ "stateMutability": "nonpayable",
915
+ "type": "function"
916
+ },
917
+ {
918
+ "inputs": [
919
+ {
920
+ "internalType": "address",
921
+ "name": "operator",
922
+ "type": "address"
923
+ },
924
+ {
925
+ "internalType": "bool",
926
+ "name": "approved",
927
+ "type": "bool"
928
+ }
929
+ ],
930
+ "name": "setApprovalForAll",
931
+ "outputs": [],
932
+ "stateMutability": "nonpayable",
933
+ "type": "function"
934
+ },
935
+ {
936
+ "inputs": [
937
+ {
938
+ "internalType": "address",
939
+ "name": "newAuthority",
940
+ "type": "address"
941
+ }
942
+ ],
943
+ "name": "setAuthority",
944
+ "outputs": [],
945
+ "stateMutability": "nonpayable",
946
+ "type": "function"
947
+ },
948
+ {
949
+ "inputs": [
950
+ {
951
+ "internalType": "uint256",
952
+ "name": "tokenId",
953
+ "type": "uint256"
954
+ },
955
+ {
956
+ "internalType": "enum AroSBT.Tier",
957
+ "name": "newTier",
958
+ "type": "uint8"
959
+ }
960
+ ],
961
+ "name": "setTier",
962
+ "outputs": [],
963
+ "stateMutability": "nonpayable",
964
+ "type": "function"
965
+ },
966
+ {
967
+ "inputs": [
968
+ {
969
+ "internalType": "bytes4",
970
+ "name": "interfaceId",
971
+ "type": "bytes4"
972
+ }
973
+ ],
974
+ "name": "supportsInterface",
975
+ "outputs": [
976
+ {
977
+ "internalType": "bool",
978
+ "name": "",
979
+ "type": "bool"
980
+ }
981
+ ],
982
+ "stateMutability": "view",
983
+ "type": "function"
984
+ },
985
+ {
986
+ "inputs": [],
987
+ "name": "symbol",
988
+ "outputs": [
989
+ {
990
+ "internalType": "string",
991
+ "name": "",
992
+ "type": "string"
993
+ }
994
+ ],
995
+ "stateMutability": "view",
996
+ "type": "function"
997
+ },
998
+ {
999
+ "inputs": [
1000
+ {
1001
+ "internalType": "uint256",
1002
+ "name": "index",
1003
+ "type": "uint256"
1004
+ }
1005
+ ],
1006
+ "name": "tokenByIndex",
1007
+ "outputs": [
1008
+ {
1009
+ "internalType": "uint256",
1010
+ "name": "",
1011
+ "type": "uint256"
1012
+ }
1013
+ ],
1014
+ "stateMutability": "view",
1015
+ "type": "function"
1016
+ },
1017
+ {
1018
+ "inputs": [
1019
+ {
1020
+ "internalType": "address",
1021
+ "name": "account",
1022
+ "type": "address"
1023
+ }
1024
+ ],
1025
+ "name": "tokenOfMember",
1026
+ "outputs": [
1027
+ {
1028
+ "internalType": "uint256",
1029
+ "name": "",
1030
+ "type": "uint256"
1031
+ }
1032
+ ],
1033
+ "stateMutability": "view",
1034
+ "type": "function"
1035
+ },
1036
+ {
1037
+ "inputs": [
1038
+ {
1039
+ "internalType": "address",
1040
+ "name": "owner",
1041
+ "type": "address"
1042
+ },
1043
+ {
1044
+ "internalType": "uint256",
1045
+ "name": "index",
1046
+ "type": "uint256"
1047
+ }
1048
+ ],
1049
+ "name": "tokenOfOwnerByIndex",
1050
+ "outputs": [
1051
+ {
1052
+ "internalType": "uint256",
1053
+ "name": "",
1054
+ "type": "uint256"
1055
+ }
1056
+ ],
1057
+ "stateMutability": "view",
1058
+ "type": "function"
1059
+ },
1060
+ {
1061
+ "inputs": [
1062
+ {
1063
+ "internalType": "uint256",
1064
+ "name": "tokenId",
1065
+ "type": "uint256"
1066
+ }
1067
+ ],
1068
+ "name": "tokenURI",
1069
+ "outputs": [
1070
+ {
1071
+ "internalType": "string",
1072
+ "name": "",
1073
+ "type": "string"
1074
+ }
1075
+ ],
1076
+ "stateMutability": "view",
1077
+ "type": "function"
1078
+ },
1079
+ {
1080
+ "inputs": [],
1081
+ "name": "totalMembersAdmitted",
1082
+ "outputs": [
1083
+ {
1084
+ "internalType": "uint256",
1085
+ "name": "",
1086
+ "type": "uint256"
1087
+ }
1088
+ ],
1089
+ "stateMutability": "view",
1090
+ "type": "function"
1091
+ },
1092
+ {
1093
+ "inputs": [],
1094
+ "name": "totalSupply",
1095
+ "outputs": [
1096
+ {
1097
+ "internalType": "uint256",
1098
+ "name": "",
1099
+ "type": "uint256"
1100
+ }
1101
+ ],
1102
+ "stateMutability": "view",
1103
+ "type": "function"
1104
+ },
1105
+ {
1106
+ "inputs": [
1107
+ {
1108
+ "internalType": "address",
1109
+ "name": "from",
1110
+ "type": "address"
1111
+ },
1112
+ {
1113
+ "internalType": "address",
1114
+ "name": "to",
1115
+ "type": "address"
1116
+ },
1117
+ {
1118
+ "internalType": "uint256",
1119
+ "name": "tokenId",
1120
+ "type": "uint256"
1121
+ }
1122
+ ],
1123
+ "name": "transferFrom",
1124
+ "outputs": [],
1125
+ "stateMutability": "nonpayable",
1126
+ "type": "function"
1127
+ },
1128
+ {
1129
+ "inputs": [],
1130
+ "name": "unpause",
1131
+ "outputs": [],
1132
+ "stateMutability": "nonpayable",
1133
+ "type": "function"
1134
+ },
1135
+ {
1136
+ "inputs": [
1137
+ {
1138
+ "internalType": "uint256",
1139
+ "name": "tokenId",
1140
+ "type": "uint256"
1141
+ },
1142
+ {
1143
+ "internalType": "bytes32",
1144
+ "name": "newKycHash",
1145
+ "type": "bytes32"
1146
+ }
1147
+ ],
1148
+ "name": "updateKycHash",
1149
+ "outputs": [],
1150
+ "stateMutability": "nonpayable",
1151
+ "type": "function"
1152
+ }
1153
+ ];
1154
+ var AroNomination_ABI = [
1155
+ {
1156
+ "inputs": [
1157
+ {
1158
+ "internalType": "address",
1159
+ "name": "initialAuthority",
1160
+ "type": "address"
1161
+ },
1162
+ {
1163
+ "internalType": "address",
1164
+ "name": "_sbtContract",
1165
+ "type": "address"
1166
+ },
1167
+ {
1168
+ "internalType": "uint256",
1169
+ "name": "_threshold",
1170
+ "type": "uint256"
1171
+ }
1172
+ ],
1173
+ "stateMutability": "nonpayable",
1174
+ "type": "constructor"
1175
+ },
1176
+ {
1177
+ "inputs": [
1178
+ {
1179
+ "internalType": "address",
1180
+ "name": "authority",
1181
+ "type": "address"
1182
+ }
1183
+ ],
1184
+ "name": "AccessManagedInvalidAuthority",
1185
+ "type": "error"
1186
+ },
1187
+ {
1188
+ "inputs": [
1189
+ {
1190
+ "internalType": "address",
1191
+ "name": "caller",
1192
+ "type": "address"
1193
+ },
1194
+ {
1195
+ "internalType": "uint32",
1196
+ "name": "delay",
1197
+ "type": "uint32"
1198
+ }
1199
+ ],
1200
+ "name": "AccessManagedRequiredDelay",
1201
+ "type": "error"
1202
+ },
1203
+ {
1204
+ "inputs": [
1205
+ {
1206
+ "internalType": "address",
1207
+ "name": "caller",
1208
+ "type": "address"
1209
+ }
1210
+ ],
1211
+ "name": "AccessManagedUnauthorized",
1212
+ "type": "error"
1213
+ },
1214
+ {
1215
+ "inputs": [
1216
+ {
1217
+ "internalType": "address",
1218
+ "name": "candidate",
1219
+ "type": "address"
1220
+ }
1221
+ ],
1222
+ "name": "AlreadyNominated",
1223
+ "type": "error"
1224
+ },
1225
+ {
1226
+ "inputs": [
1227
+ {
1228
+ "internalType": "address",
1229
+ "name": "voucher",
1230
+ "type": "address"
1231
+ },
1232
+ {
1233
+ "internalType": "address",
1234
+ "name": "candidate",
1235
+ "type": "address"
1236
+ }
1237
+ ],
1238
+ "name": "AlreadyVouched",
1239
+ "type": "error"
1240
+ },
1241
+ {
1242
+ "inputs": [],
1243
+ "name": "CallerHasNoSBT",
1244
+ "type": "error"
1245
+ },
1246
+ {
1247
+ "inputs": [
1248
+ {
1249
+ "internalType": "address",
1250
+ "name": "candidate",
1251
+ "type": "address"
1252
+ }
1253
+ ],
1254
+ "name": "CandidateAlreadyMember",
1255
+ "type": "error"
1256
+ },
1257
+ {
1258
+ "inputs": [
1259
+ {
1260
+ "internalType": "address",
1261
+ "name": "candidate",
1262
+ "type": "address"
1263
+ }
1264
+ ],
1265
+ "name": "NominationNotPending",
1266
+ "type": "error"
1267
+ },
1268
+ {
1269
+ "inputs": [],
1270
+ "name": "NominatorCannotVouch",
1271
+ "type": "error"
1272
+ },
1273
+ {
1274
+ "inputs": [
1275
+ {
1276
+ "internalType": "address",
1277
+ "name": "candidate",
1278
+ "type": "address"
1279
+ }
1280
+ ],
1281
+ "name": "NotNominated",
1282
+ "type": "error"
1283
+ },
1284
+ {
1285
+ "inputs": [],
1286
+ "name": "ThresholdCannotBeZero",
1287
+ "type": "error"
1288
+ },
1289
+ {
1290
+ "anonymous": false,
1291
+ "inputs": [
1292
+ {
1293
+ "indexed": false,
1294
+ "internalType": "address",
1295
+ "name": "authority",
1296
+ "type": "address"
1297
+ }
1298
+ ],
1299
+ "name": "AuthorityUpdated",
1300
+ "type": "event"
1301
+ },
1302
+ {
1303
+ "anonymous": false,
1304
+ "inputs": [
1305
+ {
1306
+ "indexed": true,
1307
+ "internalType": "address",
1308
+ "name": "candidate",
1309
+ "type": "address"
1310
+ },
1311
+ {
1312
+ "indexed": false,
1313
+ "internalType": "uint256",
1314
+ "name": "totalVouches",
1315
+ "type": "uint256"
1316
+ },
1317
+ {
1318
+ "indexed": false,
1319
+ "internalType": "uint256",
1320
+ "name": "timestamp",
1321
+ "type": "uint256"
1322
+ }
1323
+ ],
1324
+ "name": "CandidateApproved",
1325
+ "type": "event"
1326
+ },
1327
+ {
1328
+ "anonymous": false,
1329
+ "inputs": [
1330
+ {
1331
+ "indexed": true,
1332
+ "internalType": "address",
1333
+ "name": "candidate",
1334
+ "type": "address"
1335
+ },
1336
+ {
1337
+ "indexed": true,
1338
+ "internalType": "address",
1339
+ "name": "nominator",
1340
+ "type": "address"
1341
+ },
1342
+ {
1343
+ "indexed": false,
1344
+ "internalType": "uint256",
1345
+ "name": "timestamp",
1346
+ "type": "uint256"
1347
+ }
1348
+ ],
1349
+ "name": "CandidateNominated",
1350
+ "type": "event"
1351
+ },
1352
+ {
1353
+ "anonymous": false,
1354
+ "inputs": [
1355
+ {
1356
+ "indexed": true,
1357
+ "internalType": "address",
1358
+ "name": "candidate",
1359
+ "type": "address"
1360
+ },
1361
+ {
1362
+ "indexed": true,
1363
+ "internalType": "address",
1364
+ "name": "voucher",
1365
+ "type": "address"
1366
+ },
1367
+ {
1368
+ "indexed": false,
1369
+ "internalType": "uint256",
1370
+ "name": "currentVouches",
1371
+ "type": "uint256"
1372
+ },
1373
+ {
1374
+ "indexed": false,
1375
+ "internalType": "uint256",
1376
+ "name": "threshold",
1377
+ "type": "uint256"
1378
+ }
1379
+ ],
1380
+ "name": "CandidateVouched",
1381
+ "type": "event"
1382
+ },
1383
+ {
1384
+ "anonymous": false,
1385
+ "inputs": [
1386
+ {
1387
+ "indexed": true,
1388
+ "internalType": "address",
1389
+ "name": "candidate",
1390
+ "type": "address"
1391
+ },
1392
+ {
1393
+ "indexed": true,
1394
+ "internalType": "address",
1395
+ "name": "clearedBy",
1396
+ "type": "address"
1397
+ }
1398
+ ],
1399
+ "name": "NominationCleared",
1400
+ "type": "event"
1401
+ },
1402
+ {
1403
+ "anonymous": false,
1404
+ "inputs": [
1405
+ {
1406
+ "indexed": false,
1407
+ "internalType": "address",
1408
+ "name": "oldContract",
1409
+ "type": "address"
1410
+ },
1411
+ {
1412
+ "indexed": false,
1413
+ "internalType": "address",
1414
+ "name": "newContract",
1415
+ "type": "address"
1416
+ }
1417
+ ],
1418
+ "name": "SBTContractUpdated",
1419
+ "type": "event"
1420
+ },
1421
+ {
1422
+ "anonymous": false,
1423
+ "inputs": [
1424
+ {
1425
+ "indexed": false,
1426
+ "internalType": "uint256",
1427
+ "name": "oldThreshold",
1428
+ "type": "uint256"
1429
+ },
1430
+ {
1431
+ "indexed": false,
1432
+ "internalType": "uint256",
1433
+ "name": "newThreshold",
1434
+ "type": "uint256"
1435
+ }
1436
+ ],
1437
+ "name": "ThresholdUpdated",
1438
+ "type": "event"
1439
+ },
1440
+ {
1441
+ "inputs": [],
1442
+ "name": "authority",
1443
+ "outputs": [
1444
+ {
1445
+ "internalType": "address",
1446
+ "name": "",
1447
+ "type": "address"
1448
+ }
1449
+ ],
1450
+ "stateMutability": "view",
1451
+ "type": "function"
1452
+ },
1453
+ {
1454
+ "inputs": [
1455
+ {
1456
+ "internalType": "address",
1457
+ "name": "candidate",
1458
+ "type": "address"
1459
+ }
1460
+ ],
1461
+ "name": "clearNomination",
1462
+ "outputs": [],
1463
+ "stateMutability": "nonpayable",
1464
+ "type": "function"
1465
+ },
1466
+ {
1467
+ "inputs": [
1468
+ {
1469
+ "internalType": "address",
1470
+ "name": "candidate",
1471
+ "type": "address"
1472
+ }
1473
+ ],
1474
+ "name": "getNomination",
1475
+ "outputs": [
1476
+ {
1477
+ "internalType": "address",
1478
+ "name": "nominator",
1479
+ "type": "address"
1480
+ },
1481
+ {
1482
+ "internalType": "address[]",
1483
+ "name": "vouchers",
1484
+ "type": "address[]"
1485
+ },
1486
+ {
1487
+ "internalType": "uint256",
1488
+ "name": "nominatedAt",
1489
+ "type": "uint256"
1490
+ },
1491
+ {
1492
+ "internalType": "enum AroNomination.NominationStatus",
1493
+ "name": "status",
1494
+ "type": "uint8"
1495
+ }
1496
+ ],
1497
+ "stateMutability": "view",
1498
+ "type": "function"
1499
+ },
1500
+ {
1501
+ "inputs": [
1502
+ {
1503
+ "internalType": "address",
1504
+ "name": "candidate",
1505
+ "type": "address"
1506
+ }
1507
+ ],
1508
+ "name": "getNominationCount",
1509
+ "outputs": [
1510
+ {
1511
+ "internalType": "uint256",
1512
+ "name": "",
1513
+ "type": "uint256"
1514
+ }
1515
+ ],
1516
+ "stateMutability": "view",
1517
+ "type": "function"
1518
+ },
1519
+ {
1520
+ "inputs": [
1521
+ {
1522
+ "internalType": "address",
1523
+ "name": "candidate",
1524
+ "type": "address"
1525
+ }
1526
+ ],
1527
+ "name": "getNominationStatus",
1528
+ "outputs": [
1529
+ {
1530
+ "internalType": "enum AroNomination.NominationStatus",
1531
+ "name": "",
1532
+ "type": "uint8"
1533
+ }
1534
+ ],
1535
+ "stateMutability": "view",
1536
+ "type": "function"
1537
+ },
1538
+ {
1539
+ "inputs": [
1540
+ {
1541
+ "internalType": "address",
1542
+ "name": "candidate",
1543
+ "type": "address"
1544
+ }
1545
+ ],
1546
+ "name": "getNominator",
1547
+ "outputs": [
1548
+ {
1549
+ "internalType": "address",
1550
+ "name": "",
1551
+ "type": "address"
1552
+ }
1553
+ ],
1554
+ "stateMutability": "view",
1555
+ "type": "function"
1556
+ },
1557
+ {
1558
+ "inputs": [
1559
+ {
1560
+ "internalType": "address",
1561
+ "name": "candidate",
1562
+ "type": "address"
1563
+ }
1564
+ ],
1565
+ "name": "getVouchers",
1566
+ "outputs": [
1567
+ {
1568
+ "internalType": "address[]",
1569
+ "name": "",
1570
+ "type": "address[]"
1571
+ }
1572
+ ],
1573
+ "stateMutability": "view",
1574
+ "type": "function"
1575
+ },
1576
+ {
1577
+ "inputs": [
1578
+ {
1579
+ "internalType": "address",
1580
+ "name": "voucher",
1581
+ "type": "address"
1582
+ },
1583
+ {
1584
+ "internalType": "address",
1585
+ "name": "candidate",
1586
+ "type": "address"
1587
+ }
1588
+ ],
1589
+ "name": "hasVouched",
1590
+ "outputs": [
1591
+ {
1592
+ "internalType": "bool",
1593
+ "name": "",
1594
+ "type": "bool"
1595
+ }
1596
+ ],
1597
+ "stateMutability": "view",
1598
+ "type": "function"
1599
+ },
1600
+ {
1601
+ "inputs": [],
1602
+ "name": "isConsumingScheduledOp",
1603
+ "outputs": [
1604
+ {
1605
+ "internalType": "bytes4",
1606
+ "name": "",
1607
+ "type": "bytes4"
1608
+ }
1609
+ ],
1610
+ "stateMutability": "view",
1611
+ "type": "function"
1612
+ },
1613
+ {
1614
+ "inputs": [
1615
+ {
1616
+ "internalType": "address",
1617
+ "name": "candidate",
1618
+ "type": "address"
1619
+ }
1620
+ ],
1621
+ "name": "isNominated",
1622
+ "outputs": [
1623
+ {
1624
+ "internalType": "bool",
1625
+ "name": "",
1626
+ "type": "bool"
1627
+ }
1628
+ ],
1629
+ "stateMutability": "view",
1630
+ "type": "function"
1631
+ },
1632
+ {
1633
+ "inputs": [
1634
+ {
1635
+ "internalType": "address",
1636
+ "name": "candidate",
1637
+ "type": "address"
1638
+ }
1639
+ ],
1640
+ "name": "nominate",
1641
+ "outputs": [],
1642
+ "stateMutability": "nonpayable",
1643
+ "type": "function"
1644
+ },
1645
+ {
1646
+ "inputs": [],
1647
+ "name": "sbtContract",
1648
+ "outputs": [
1649
+ {
1650
+ "internalType": "contract AroSBT",
1651
+ "name": "",
1652
+ "type": "address"
1653
+ }
1654
+ ],
1655
+ "stateMutability": "view",
1656
+ "type": "function"
1657
+ },
1658
+ {
1659
+ "inputs": [
1660
+ {
1661
+ "internalType": "address",
1662
+ "name": "newAuthority",
1663
+ "type": "address"
1664
+ }
1665
+ ],
1666
+ "name": "setAuthority",
1667
+ "outputs": [],
1668
+ "stateMutability": "nonpayable",
1669
+ "type": "function"
1670
+ },
1671
+ {
1672
+ "inputs": [
1673
+ {
1674
+ "internalType": "address",
1675
+ "name": "newSBTContract",
1676
+ "type": "address"
1677
+ }
1678
+ ],
1679
+ "name": "setSBTContract",
1680
+ "outputs": [],
1681
+ "stateMutability": "nonpayable",
1682
+ "type": "function"
1683
+ },
1684
+ {
1685
+ "inputs": [
1686
+ {
1687
+ "internalType": "uint256",
1688
+ "name": "newThreshold",
1689
+ "type": "uint256"
1690
+ }
1691
+ ],
1692
+ "name": "setThreshold",
1693
+ "outputs": [],
1694
+ "stateMutability": "nonpayable",
1695
+ "type": "function"
1696
+ },
1697
+ {
1698
+ "inputs": [],
1699
+ "name": "threshold",
1700
+ "outputs": [
1701
+ {
1702
+ "internalType": "uint256",
1703
+ "name": "",
1704
+ "type": "uint256"
1705
+ }
1706
+ ],
1707
+ "stateMutability": "view",
1708
+ "type": "function"
1709
+ },
1710
+ {
1711
+ "inputs": [
1712
+ {
1713
+ "internalType": "address",
1714
+ "name": "candidate",
1715
+ "type": "address"
1716
+ }
1717
+ ],
1718
+ "name": "vouch",
1719
+ "outputs": [],
1720
+ "stateMutability": "nonpayable",
1721
+ "type": "function"
1722
+ }
1723
+ ];
1724
+
1725
+ // src/utils/errors.ts
1726
+ var import_viem = require("viem");
1727
+ var AroContractError = class extends Error {
1728
+ errorName;
1729
+ args;
1730
+ cause;
1731
+ constructor(opts) {
1732
+ super(opts.message);
1733
+ this.name = "AroContractError";
1734
+ this.errorName = opts.errorName;
1735
+ this.args = opts.args;
1736
+ this.cause = opts.cause;
1737
+ }
1738
+ };
1739
+ var FRIENDLY = {
1740
+ // AroSBT
1741
+ AlreadyHasSBT: ([who]) => `Address ${String(who)} already holds an SBT.`,
1742
+ SoulboundTransferBlocked: () => "SBTs are soulbound \u2014 transfers are not permitted.",
1743
+ NoSBT: ([who]) => `Address ${String(who)} does not hold an SBT.`,
1744
+ // AroNomination
1745
+ CallerHasNoSBT: () => "Only existing SBT holders can nominate or vouch.",
1746
+ AlreadyNominated: ([who]) => `Address ${String(who)} is already nominated.`,
1747
+ CandidateAlreadyMember: ([who]) => `Address ${String(who)} is already a member.`,
1748
+ NotNominated: ([who]) => `Address ${String(who)} has not been nominated.`,
1749
+ AlreadyVouched: ([voucher, candidate]) => `Address ${String(voucher)} already vouched for ${String(candidate)}.`,
1750
+ NominatorCannotVouch: () => "The original nominator cannot also vouch.",
1751
+ ThresholdCannotBeZero: () => "Vouch threshold must be at least 1.",
1752
+ NominationNotPending: ([who]) => `Nomination for ${String(who)} is not in PENDING status.`
1753
+ };
1754
+ function decodeAroError(err) {
1755
+ if (!(err instanceof import_viem.BaseError)) return null;
1756
+ const reverted = err.walk(
1757
+ (e) => e instanceof Error && e.name === "ContractFunctionRevertedError"
1758
+ );
1759
+ if (!reverted || !reverted.data) return null;
1760
+ const errorName = reverted.data.errorName ?? "UnknownError";
1761
+ const args = reverted.data.args ?? [];
1762
+ const friendly = FRIENDLY[errorName];
1763
+ const message = friendly ? friendly(args) : `Revert: ${errorName}`;
1764
+ return new AroContractError({ errorName, args, message, cause: err });
1765
+ }
1766
+
1767
+ // src/workflows/onboarding.ts
1768
+ async function checkMembershipStatus(sdk, account) {
1769
+ const sbtAddress = sdk.addressOf("AroSBT");
1770
+ const hasSBT = await sdk.publicClient.readContract({
1771
+ address: sbtAddress,
1772
+ abi: AroSBT_ABI,
1773
+ functionName: "hasSBT",
1774
+ args: [account]
1775
+ });
1776
+ if (!hasSBT) return { hasSBT: false };
1777
+ const tokenId = await sdk.publicClient.readContract({
1778
+ address: sbtAddress,
1779
+ abi: AroSBT_ABI,
1780
+ functionName: "tokenOfMember",
1781
+ args: [account]
1782
+ });
1783
+ const data = await sdk.publicClient.readContract({
1784
+ address: sbtAddress,
1785
+ abi: AroSBT_ABI,
1786
+ functionName: "getMemberData",
1787
+ args: [account]
1788
+ });
1789
+ return {
1790
+ hasSBT: true,
1791
+ tokenId,
1792
+ tier: data.tier,
1793
+ memberId: data.memberId,
1794
+ issuanceDate: data.issuanceDate,
1795
+ kycHash: data.kycHash
1796
+ };
1797
+ }
1798
+ async function getNominationSnapshot(sdk, candidate) {
1799
+ const nominationAddress = sdk.addressOf("AroNomination");
1800
+ const [nomination, threshold] = await Promise.all([
1801
+ sdk.publicClient.readContract({
1802
+ address: nominationAddress,
1803
+ abi: AroNomination_ABI,
1804
+ functionName: "getNomination",
1805
+ args: [candidate]
1806
+ }),
1807
+ sdk.publicClient.readContract({
1808
+ address: nominationAddress,
1809
+ abi: AroNomination_ABI,
1810
+ functionName: "threshold"
1811
+ })
1812
+ ]);
1813
+ const [nominator, vouchers, nominatedAt, status] = nomination;
1814
+ const voucherCount = vouchers.length;
1815
+ const thresholdN = Number(threshold);
1816
+ return {
1817
+ status,
1818
+ nominator,
1819
+ vouchers,
1820
+ nominatedAt,
1821
+ voucherCount,
1822
+ threshold: thresholdN,
1823
+ remaining: Math.max(0, thresholdN - voucherCount),
1824
+ ready: status === 2 /* APPROVED */
1825
+ };
1826
+ }
1827
+ function pickAccount(wallet, passed) {
1828
+ if (passed) return passed;
1829
+ if (wallet.account) return wallet.account;
1830
+ throw new Error(
1831
+ "No account available \u2014 pass one explicitly or use a walletClient bound to an account."
1832
+ );
1833
+ }
1834
+ async function nominateCandidate(sdk, candidate, opts = {}) {
1835
+ if (!sdk.walletClient) {
1836
+ throw new Error("nominateCandidate requires a walletClient on the SDK");
1837
+ }
1838
+ const wallet = sdk.walletClient;
1839
+ try {
1840
+ return await wallet.writeContract({
1841
+ account: pickAccount(wallet, opts.account),
1842
+ chain: wallet.chain,
1843
+ address: sdk.addressOf("AroNomination"),
1844
+ abi: AroNomination_ABI,
1845
+ functionName: "nominate",
1846
+ args: [candidate]
1847
+ });
1848
+ } catch (err) {
1849
+ throw decodeAroError(err) ?? err;
1850
+ }
1851
+ }
1852
+ async function vouchForCandidate(sdk, candidate, opts = {}) {
1853
+ if (!sdk.walletClient) {
1854
+ throw new Error("vouchForCandidate requires a walletClient on the SDK");
1855
+ }
1856
+ const wallet = sdk.walletClient;
1857
+ try {
1858
+ return await wallet.writeContract({
1859
+ account: pickAccount(wallet, opts.account),
1860
+ chain: wallet.chain,
1861
+ address: sdk.addressOf("AroNomination"),
1862
+ abi: AroNomination_ABI,
1863
+ functionName: "vouch",
1864
+ args: [candidate]
1865
+ });
1866
+ } catch (err) {
1867
+ throw decodeAroError(err) ?? err;
1868
+ }
1869
+ }
1870
+ async function clearNomination(sdk, candidate, opts = {}) {
1871
+ if (!sdk.walletClient) {
1872
+ throw new Error("clearNomination requires a walletClient on the SDK");
1873
+ }
1874
+ const wallet = sdk.walletClient;
1875
+ try {
1876
+ return await wallet.writeContract({
1877
+ account: pickAccount(wallet, opts.account),
1878
+ chain: wallet.chain,
1879
+ address: sdk.addressOf("AroNomination"),
1880
+ abi: AroNomination_ABI,
1881
+ functionName: "clearNomination",
1882
+ args: [candidate]
1883
+ });
1884
+ } catch (err) {
1885
+ throw decodeAroError(err) ?? err;
1886
+ }
1887
+ }
1888
+ async function mintSBTForApproved(sdk, opts) {
1889
+ if (!sdk.walletClient) {
1890
+ throw new Error("mintSBTForApproved requires a walletClient on the SDK");
1891
+ }
1892
+ const wallet = sdk.walletClient;
1893
+ const tier = opts.tier ?? 0 /* STANDARD */;
1894
+ try {
1895
+ return await wallet.writeContract({
1896
+ account: pickAccount(wallet, opts.account),
1897
+ chain: wallet.chain,
1898
+ address: sdk.addressOf("AroSBT"),
1899
+ abi: AroSBT_ABI,
1900
+ // Disambiguate the overload by writing the explicit 4-arg form.
1901
+ functionName: "mint",
1902
+ args: [opts.to, opts.kycHash, opts.metadataURI, tier]
1903
+ });
1904
+ } catch (err) {
1905
+ throw decodeAroError(err) ?? err;
1906
+ }
1907
+ }
1908
+ async function describeOnboardingState(sdk, wallet) {
1909
+ if (!wallet) {
1910
+ return {
1911
+ step: "needs-wallet",
1912
+ membership: { hasSBT: false }
1913
+ };
1914
+ }
1915
+ const membership = await checkMembershipStatus(sdk, wallet);
1916
+ if (membership.hasSBT) return { step: "member", membership };
1917
+ const nomination = await getNominationSnapshot(sdk, wallet);
1918
+ if (nomination.status === 0 /* NONE */) {
1919
+ return { step: "needs-nomination", membership, nomination };
1920
+ }
1921
+ if (nomination.status === 1 /* PENDING */) {
1922
+ return { step: "needs-vouches", membership, nomination };
1923
+ }
1924
+ if (nomination.status === 2 /* APPROVED */) {
1925
+ return { step: "needs-kyc", membership, nomination };
1926
+ }
1927
+ return { step: "needs-nomination", membership, nomination };
1928
+ }
1929
+
1930
+ // src/utils/kycHash.ts
1931
+ var import_viem2 = require("viem");
1932
+ var import_viem3 = require("viem");
1933
+ function stableStringify(value) {
1934
+ if (value === void 0) return "null";
1935
+ if (value === null) return "null";
1936
+ if (typeof value === "string") return JSON.stringify(value);
1937
+ if (typeof value === "number") {
1938
+ if (!Number.isFinite(value)) {
1939
+ throw new Error("KYC payload must not contain Infinity or NaN");
1940
+ }
1941
+ return JSON.stringify(value);
1942
+ }
1943
+ if (typeof value === "boolean") return JSON.stringify(value);
1944
+ if (Array.isArray(value)) {
1945
+ return `[${value.map(stableStringify).join(",")}]`;
1946
+ }
1947
+ if (typeof value === "object") {
1948
+ const obj = value;
1949
+ const keys = Object.keys(obj).sort();
1950
+ const parts = keys.map((k) => `${JSON.stringify(k)}:${stableStringify(obj[k])}`);
1951
+ return `{${parts.join(",")}}`;
1952
+ }
1953
+ throw new Error(`Unsupported type in KYC payload: ${typeof value}`);
1954
+ }
1955
+ function computeKycHash(payload) {
1956
+ const serialized = stableStringify(payload);
1957
+ return (0, import_viem2.keccak256)((0, import_viem2.stringToBytes)(serialized));
1958
+ }
1959
+
1960
+ // src/workflows/kyc.ts
1961
+ function hashKycResult(result) {
1962
+ if (result.status !== "verified") {
1963
+ throw new Error(
1964
+ `Refusing to hash an un-verified KYC result (status=${result.status}).`
1965
+ );
1966
+ }
1967
+ return computeKycHash({
1968
+ provider: result.provider,
1969
+ sessionId: result.sessionId,
1970
+ status: result.status,
1971
+ verifiedAt: result.verifiedAt,
1972
+ walletAddress: result.walletAddress,
1973
+ attributes: result.attributes
1974
+ });
1975
+ }
1976
+ // Annotate the CommonJS export names for ESM import in node:
1977
+ 0 && (module.exports = {
1978
+ checkMembershipStatus,
1979
+ clearNomination,
1980
+ computeKycHash,
1981
+ describeOnboardingState,
1982
+ getNominationSnapshot,
1983
+ hashKycResult,
1984
+ mintSBTForApproved,
1985
+ nominateCandidate,
1986
+ vouchForCandidate
1987
+ });
1988
+ //# sourceMappingURL=index.cjs.map