@skalenetwork/privacy-sdk 0.1.0-develop.1 → 0.1.0-develop.2

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,2934 @@
1
+ import {
2
+ decryptBalance,
3
+ parsePublicKeyCoordinates
4
+ } from "./chunk-K5WS3F4Q.js";
5
+
6
+ // src/actions/transfers.ts
7
+ import { encodeAbiParameters, encodeFunctionData } from "viem";
8
+
9
+ // src/abi/confidentialWrapper.ts
10
+ var confidentialWrapperAbi = [
11
+ {
12
+ inputs: [
13
+ {
14
+ internalType: "bool",
15
+ name: "proxyMode",
16
+ type: "bool"
17
+ },
18
+ {
19
+ internalType: "contract IERC20Metadata",
20
+ name: "underlyingToken",
21
+ type: "address"
22
+ },
23
+ {
24
+ internalType: "string",
25
+ name: "version_",
26
+ type: "string"
27
+ },
28
+ {
29
+ internalType: "address",
30
+ name: "initialAuthority",
31
+ type: "address"
32
+ }
33
+ ],
34
+ stateMutability: "nonpayable",
35
+ type: "constructor"
36
+ },
37
+ {
38
+ inputs: [
39
+ {
40
+ internalType: "address",
41
+ name: "authority",
42
+ type: "address"
43
+ }
44
+ ],
45
+ name: "AccessManagedInvalidAuthority",
46
+ type: "error"
47
+ },
48
+ {
49
+ inputs: [
50
+ {
51
+ internalType: "address",
52
+ name: "caller",
53
+ type: "address"
54
+ },
55
+ {
56
+ internalType: "uint32",
57
+ name: "delay",
58
+ type: "uint32"
59
+ }
60
+ ],
61
+ name: "AccessManagedRequiredDelay",
62
+ type: "error"
63
+ },
64
+ {
65
+ inputs: [
66
+ {
67
+ internalType: "address",
68
+ name: "caller",
69
+ type: "address"
70
+ }
71
+ ],
72
+ name: "AccessManagedUnauthorized",
73
+ type: "error"
74
+ },
75
+ {
76
+ inputs: [],
77
+ name: "AccessViolation",
78
+ type: "error"
79
+ },
80
+ {
81
+ inputs: [],
82
+ name: "ActionNotRecognized",
83
+ type: "error"
84
+ },
85
+ {
86
+ inputs: [
87
+ {
88
+ internalType: "uint256",
89
+ name: "validBefore",
90
+ type: "uint256"
91
+ }
92
+ ],
93
+ name: "AuthorizationIsExpired",
94
+ type: "error"
95
+ },
96
+ {
97
+ inputs: [
98
+ {
99
+ internalType: "uint256",
100
+ name: "validAfter",
101
+ type: "uint256"
102
+ }
103
+ ],
104
+ name: "AuthorizationIsNotYetValid",
105
+ type: "error"
106
+ },
107
+ {
108
+ inputs: [
109
+ {
110
+ internalType: "address",
111
+ name: "authorizer",
112
+ type: "address"
113
+ },
114
+ {
115
+ internalType: "bytes32",
116
+ name: "nonce",
117
+ type: "bytes32"
118
+ }
119
+ ],
120
+ name: "AuthorizationUsedError",
121
+ type: "error"
122
+ },
123
+ {
124
+ inputs: [
125
+ {
126
+ internalType: "uint256",
127
+ name: "errorCode",
128
+ type: "uint256"
129
+ }
130
+ ],
131
+ name: "CTXAbiToRlpConversionFailed",
132
+ type: "error"
133
+ },
134
+ {
135
+ inputs: [
136
+ {
137
+ internalType: "uint256",
138
+ name: "errorCode",
139
+ type: "uint256"
140
+ }
141
+ ],
142
+ name: "CTXAbiToRlpUnknownError",
143
+ type: "error"
144
+ },
145
+ {
146
+ inputs: [
147
+ {
148
+ internalType: "uint256",
149
+ name: "errorCode",
150
+ type: "uint256"
151
+ }
152
+ ],
153
+ name: "CTXCountNotVerifyTransaction",
154
+ type: "error"
155
+ },
156
+ {
157
+ inputs: [
158
+ {
159
+ internalType: "uint256",
160
+ name: "errorCode",
161
+ type: "uint256"
162
+ }
163
+ ],
164
+ name: "CTXDataOffsetOutOfBounds",
165
+ type: "error"
166
+ },
167
+ {
168
+ inputs: [
169
+ {
170
+ internalType: "uint256",
171
+ name: "errorCode",
172
+ type: "uint256"
173
+ }
174
+ ],
175
+ name: "CTXDataTooShort",
176
+ type: "error"
177
+ },
178
+ {
179
+ inputs: [
180
+ {
181
+ internalType: "uint256",
182
+ name: "errorCode",
183
+ type: "uint256"
184
+ }
185
+ ],
186
+ name: "CTXInputTooShort",
187
+ type: "error"
188
+ },
189
+ {
190
+ inputs: [
191
+ {
192
+ internalType: "uint256",
193
+ name: "errorCode",
194
+ type: "uint256"
195
+ }
196
+ ],
197
+ name: "CTXInvalidDestination",
198
+ type: "error"
199
+ },
200
+ {
201
+ inputs: [
202
+ {
203
+ internalType: "uint256",
204
+ name: "errorCode",
205
+ type: "uint256"
206
+ }
207
+ ],
208
+ name: "CTXInvalidGasLimit",
209
+ type: "error"
210
+ },
211
+ {
212
+ inputs: [
213
+ {
214
+ internalType: "uint256",
215
+ name: "errorCode",
216
+ type: "uint256"
217
+ }
218
+ ],
219
+ name: "CTXInvalidSignature",
220
+ type: "error"
221
+ },
222
+ {
223
+ inputs: [
224
+ {
225
+ internalType: "uint256",
226
+ name: "errorCode",
227
+ type: "uint256"
228
+ }
229
+ ],
230
+ name: "CTXInvalidTransaction",
231
+ type: "error"
232
+ },
233
+ {
234
+ inputs: [
235
+ {
236
+ internalType: "uint256",
237
+ name: "errorCode",
238
+ type: "uint256"
239
+ }
240
+ ],
241
+ name: "CTXUnknownError",
242
+ type: "error"
243
+ },
244
+ {
245
+ inputs: [
246
+ {
247
+ internalType: "address",
248
+ name: "caller",
249
+ type: "address"
250
+ },
251
+ {
252
+ internalType: "address",
253
+ name: "payee",
254
+ type: "address"
255
+ }
256
+ ],
257
+ name: "CallerMustBeThePayee",
258
+ type: "error"
259
+ },
260
+ {
261
+ inputs: [
262
+ {
263
+ internalType: "uint256",
264
+ name: "errorCode",
265
+ type: "uint256"
266
+ }
267
+ ],
268
+ name: "DataLengthMismatch",
269
+ type: "error"
270
+ },
271
+ {
272
+ inputs: [],
273
+ name: "DecryptionBadFormat",
274
+ type: "error"
275
+ },
276
+ {
277
+ inputs: [],
278
+ name: "ECDSAInvalidSignature",
279
+ type: "error"
280
+ },
281
+ {
282
+ inputs: [
283
+ {
284
+ internalType: "uint256",
285
+ name: "length",
286
+ type: "uint256"
287
+ }
288
+ ],
289
+ name: "ECDSAInvalidSignatureLength",
290
+ type: "error"
291
+ },
292
+ {
293
+ inputs: [
294
+ {
295
+ internalType: "bytes32",
296
+ name: "s",
297
+ type: "bytes32"
298
+ }
299
+ ],
300
+ name: "ECDSAInvalidSignatureS",
301
+ type: "error"
302
+ },
303
+ {
304
+ inputs: [
305
+ {
306
+ internalType: "uint256",
307
+ name: "errorCode",
308
+ type: "uint256"
309
+ }
310
+ ],
311
+ name: "ECIESEncryptionFailed",
312
+ type: "error"
313
+ },
314
+ {
315
+ inputs: [
316
+ {
317
+ internalType: "uint256",
318
+ name: "errorCode",
319
+ type: "uint256"
320
+ }
321
+ ],
322
+ name: "ECIESInvalidPublicKey",
323
+ type: "error"
324
+ },
325
+ {
326
+ inputs: [
327
+ {
328
+ internalType: "address",
329
+ name: "spender",
330
+ type: "address"
331
+ },
332
+ {
333
+ internalType: "uint256",
334
+ name: "allowance",
335
+ type: "uint256"
336
+ },
337
+ {
338
+ internalType: "uint256",
339
+ name: "needed",
340
+ type: "uint256"
341
+ }
342
+ ],
343
+ name: "ERC20InsufficientAllowance",
344
+ type: "error"
345
+ },
346
+ {
347
+ inputs: [
348
+ {
349
+ internalType: "address",
350
+ name: "sender",
351
+ type: "address"
352
+ },
353
+ {
354
+ internalType: "uint256",
355
+ name: "balance",
356
+ type: "uint256"
357
+ },
358
+ {
359
+ internalType: "uint256",
360
+ name: "needed",
361
+ type: "uint256"
362
+ }
363
+ ],
364
+ name: "ERC20InsufficientBalance",
365
+ type: "error"
366
+ },
367
+ {
368
+ inputs: [
369
+ {
370
+ internalType: "address",
371
+ name: "approver",
372
+ type: "address"
373
+ }
374
+ ],
375
+ name: "ERC20InvalidApprover",
376
+ type: "error"
377
+ },
378
+ {
379
+ inputs: [
380
+ {
381
+ internalType: "address",
382
+ name: "receiver",
383
+ type: "address"
384
+ }
385
+ ],
386
+ name: "ERC20InvalidReceiver",
387
+ type: "error"
388
+ },
389
+ {
390
+ inputs: [
391
+ {
392
+ internalType: "address",
393
+ name: "sender",
394
+ type: "address"
395
+ }
396
+ ],
397
+ name: "ERC20InvalidSender",
398
+ type: "error"
399
+ },
400
+ {
401
+ inputs: [
402
+ {
403
+ internalType: "address",
404
+ name: "spender",
405
+ type: "address"
406
+ }
407
+ ],
408
+ name: "ERC20InvalidSpender",
409
+ type: "error"
410
+ },
411
+ {
412
+ inputs: [
413
+ {
414
+ internalType: "address",
415
+ name: "token",
416
+ type: "address"
417
+ }
418
+ ],
419
+ name: "ERC20InvalidUnderlying",
420
+ type: "error"
421
+ },
422
+ {
423
+ inputs: [
424
+ {
425
+ internalType: "uint256",
426
+ name: "deadline",
427
+ type: "uint256"
428
+ }
429
+ ],
430
+ name: "ERC2612ExpiredSignature",
431
+ type: "error"
432
+ },
433
+ {
434
+ inputs: [
435
+ {
436
+ internalType: "address",
437
+ name: "signer",
438
+ type: "address"
439
+ },
440
+ {
441
+ internalType: "address",
442
+ name: "owner",
443
+ type: "address"
444
+ }
445
+ ],
446
+ name: "ERC2612InvalidSigner",
447
+ type: "error"
448
+ },
449
+ {
450
+ inputs: [
451
+ {
452
+ internalType: "address",
453
+ name: "precompiledContract",
454
+ type: "address"
455
+ }
456
+ ],
457
+ name: "EmptyReturnData",
458
+ type: "error"
459
+ },
460
+ {
461
+ inputs: [],
462
+ name: "FailedCall",
463
+ type: "error"
464
+ },
465
+ {
466
+ inputs: [
467
+ {
468
+ internalType: "address",
469
+ name: "precompiledContract",
470
+ type: "address"
471
+ },
472
+ {
473
+ internalType: "uint256",
474
+ name: "expected",
475
+ type: "uint256"
476
+ },
477
+ {
478
+ internalType: "uint256",
479
+ name: "actual",
480
+ type: "uint256"
481
+ }
482
+ ],
483
+ name: "IncorrectReturnDataLength",
484
+ type: "error"
485
+ },
486
+ {
487
+ inputs: [
488
+ {
489
+ internalType: "uint256",
490
+ name: "errorCode",
491
+ type: "uint256"
492
+ }
493
+ ],
494
+ name: "InputNot32ByteAligned",
495
+ type: "error"
496
+ },
497
+ {
498
+ inputs: [
499
+ {
500
+ internalType: "uint256",
501
+ name: "errorCode",
502
+ type: "uint256"
503
+ }
504
+ ],
505
+ name: "InputTooLarge",
506
+ type: "error"
507
+ },
508
+ {
509
+ inputs: [
510
+ {
511
+ internalType: "uint256",
512
+ name: "errorCode",
513
+ type: "uint256"
514
+ }
515
+ ],
516
+ name: "InputTooShort",
517
+ type: "error"
518
+ },
519
+ {
520
+ inputs: [
521
+ {
522
+ internalType: "uint256",
523
+ name: "balance",
524
+ type: "uint256"
525
+ },
526
+ {
527
+ internalType: "uint256",
528
+ name: "needed",
529
+ type: "uint256"
530
+ }
531
+ ],
532
+ name: "InsufficientBalance",
533
+ type: "error"
534
+ },
535
+ {
536
+ inputs: [],
537
+ name: "InsufficientBalance",
538
+ type: "error"
539
+ },
540
+ {
541
+ inputs: [
542
+ {
543
+ internalType: "uint256",
544
+ name: "required",
545
+ type: "uint256"
546
+ },
547
+ {
548
+ internalType: "uint256",
549
+ name: "available",
550
+ type: "uint256"
551
+ }
552
+ ],
553
+ name: "InsufficientGasToken",
554
+ type: "error"
555
+ },
556
+ {
557
+ inputs: [
558
+ {
559
+ internalType: "address",
560
+ name: "account",
561
+ type: "address"
562
+ },
563
+ {
564
+ internalType: "uint256",
565
+ name: "currentNonce",
566
+ type: "uint256"
567
+ }
568
+ ],
569
+ name: "InvalidAccountNonce",
570
+ type: "error"
571
+ },
572
+ {
573
+ inputs: [
574
+ {
575
+ internalType: "uint256",
576
+ name: "errorCode",
577
+ type: "uint256"
578
+ }
579
+ ],
580
+ name: "InvalidDataOffset",
581
+ type: "error"
582
+ },
583
+ {
584
+ inputs: [],
585
+ name: "InvalidInitialization",
586
+ type: "error"
587
+ },
588
+ {
589
+ inputs: [],
590
+ name: "InvalidPublicKey",
591
+ type: "error"
592
+ },
593
+ {
594
+ inputs: [
595
+ {
596
+ internalType: "address",
597
+ name: "precompiledContract",
598
+ type: "address"
599
+ },
600
+ {
601
+ internalType: "uint256",
602
+ name: "expectedMin",
603
+ type: "uint256"
604
+ },
605
+ {
606
+ internalType: "uint256",
607
+ name: "actual",
608
+ type: "uint256"
609
+ }
610
+ ],
611
+ name: "InvalidReturnDataSize",
612
+ type: "error"
613
+ },
614
+ {
615
+ inputs: [],
616
+ name: "InvalidSaltForTransactionValue",
617
+ type: "error"
618
+ },
619
+ {
620
+ inputs: [],
621
+ name: "InvalidSignature",
622
+ type: "error"
623
+ },
624
+ {
625
+ inputs: [
626
+ {
627
+ internalType: "uint256",
628
+ name: "fromTimestamp",
629
+ type: "uint256"
630
+ },
631
+ {
632
+ internalType: "uint256",
633
+ name: "toTimestamp",
634
+ type: "uint256"
635
+ }
636
+ ],
637
+ name: "InvalidTimeRange",
638
+ type: "error"
639
+ },
640
+ {
641
+ inputs: [
642
+ {
643
+ internalType: "uint256",
644
+ name: "transferId",
645
+ type: "uint256"
646
+ }
647
+ ],
648
+ name: "InvalidTransferId",
649
+ type: "error"
650
+ },
651
+ {
652
+ inputs: [
653
+ {
654
+ internalType: "address",
655
+ name: "holder",
656
+ type: "address"
657
+ }
658
+ ],
659
+ name: "NoViewerRegisteredForHolder",
660
+ type: "error"
661
+ },
662
+ {
663
+ inputs: [],
664
+ name: "NotInitializing",
665
+ type: "error"
666
+ },
667
+ {
668
+ inputs: [
669
+ {
670
+ internalType: "address",
671
+ name: "to",
672
+ type: "address"
673
+ },
674
+ {
675
+ internalType: "uint256",
676
+ name: "value",
677
+ type: "uint256"
678
+ }
679
+ ],
680
+ name: "OutdatedMint",
681
+ type: "error"
682
+ },
683
+ {
684
+ inputs: [
685
+ {
686
+ internalType: "address",
687
+ name: "viewer",
688
+ type: "address"
689
+ }
690
+ ],
691
+ name: "PublicKeyIsNotRegistered",
692
+ type: "error"
693
+ },
694
+ {
695
+ inputs: [
696
+ {
697
+ internalType: "address",
698
+ name: "token",
699
+ type: "address"
700
+ }
701
+ ],
702
+ name: "SafeERC20FailedOperation",
703
+ type: "error"
704
+ },
705
+ {
706
+ inputs: [
707
+ {
708
+ internalType: "uint256",
709
+ name: "errorCode",
710
+ type: "uint256"
711
+ }
712
+ ],
713
+ name: "TrailingPaddingNotZeros",
714
+ type: "error"
715
+ },
716
+ {
717
+ inputs: [
718
+ {
719
+ internalType: "uint256",
720
+ name: "errorCode",
721
+ type: "uint256"
722
+ }
723
+ ],
724
+ name: "UnknownEncryptionError",
725
+ type: "error"
726
+ },
727
+ {
728
+ inputs: [
729
+ {
730
+ internalType: "bytes",
731
+ name: "errorData",
732
+ type: "bytes"
733
+ }
734
+ ],
735
+ name: "UnknownError",
736
+ type: "error"
737
+ },
738
+ {
739
+ inputs: [
740
+ {
741
+ internalType: "address",
742
+ name: "viewer",
743
+ type: "address"
744
+ },
745
+ {
746
+ internalType: "uint256",
747
+ name: "transferId",
748
+ type: "uint256"
749
+ }
750
+ ],
751
+ name: "UserIsNotAuthorizedToDecryptTransfer",
752
+ type: "error"
753
+ },
754
+ {
755
+ inputs: [],
756
+ name: "ValueIsEncrypted",
757
+ type: "error"
758
+ },
759
+ {
760
+ inputs: [],
761
+ name: "ValueWasNotEncryptedCorrectly",
762
+ type: "error"
763
+ },
764
+ {
765
+ inputs: [],
766
+ name: "WrongInitializer",
767
+ type: "error"
768
+ },
769
+ {
770
+ inputs: [],
771
+ name: "WrongPlaintextFormat",
772
+ type: "error"
773
+ },
774
+ {
775
+ inputs: [],
776
+ name: "ZeroAddress",
777
+ type: "error"
778
+ },
779
+ {
780
+ inputs: [],
781
+ name: "ZeroValue",
782
+ type: "error"
783
+ },
784
+ {
785
+ anonymous: false,
786
+ inputs: [
787
+ {
788
+ indexed: true,
789
+ internalType: "address",
790
+ name: "owner",
791
+ type: "address"
792
+ },
793
+ {
794
+ indexed: true,
795
+ internalType: "address",
796
+ name: "spender",
797
+ type: "address"
798
+ },
799
+ {
800
+ indexed: false,
801
+ internalType: "uint256",
802
+ name: "value",
803
+ type: "uint256"
804
+ }
805
+ ],
806
+ name: "Approval",
807
+ type: "event"
808
+ },
809
+ {
810
+ anonymous: false,
811
+ inputs: [
812
+ {
813
+ indexed: false,
814
+ internalType: "address",
815
+ name: "authority",
816
+ type: "address"
817
+ }
818
+ ],
819
+ name: "AuthorityUpdated",
820
+ type: "event"
821
+ },
822
+ {
823
+ anonymous: false,
824
+ inputs: [
825
+ {
826
+ indexed: true,
827
+ internalType: "address",
828
+ name: "authorizer",
829
+ type: "address"
830
+ },
831
+ {
832
+ indexed: true,
833
+ internalType: "bytes32",
834
+ name: "nonce",
835
+ type: "bytes32"
836
+ }
837
+ ],
838
+ name: "AuthorizationCanceled",
839
+ type: "event"
840
+ },
841
+ {
842
+ anonymous: false,
843
+ inputs: [
844
+ {
845
+ indexed: true,
846
+ internalType: "address",
847
+ name: "authorizer",
848
+ type: "address"
849
+ },
850
+ {
851
+ indexed: true,
852
+ internalType: "bytes32",
853
+ name: "nonce",
854
+ type: "bytes32"
855
+ }
856
+ ],
857
+ name: "AuthorizationUsed",
858
+ type: "event"
859
+ },
860
+ {
861
+ anonymous: false,
862
+ inputs: [
863
+ {
864
+ indexed: true,
865
+ internalType: "address",
866
+ name: "callbackSender",
867
+ type: "address"
868
+ }
869
+ ],
870
+ name: "CTXResubmitted",
871
+ type: "event"
872
+ },
873
+ {
874
+ anonymous: false,
875
+ inputs: [
876
+ {
877
+ indexed: true,
878
+ internalType: "address",
879
+ name: "callbackSender",
880
+ type: "address"
881
+ }
882
+ ],
883
+ name: "CTXSubmitted",
884
+ type: "event"
885
+ },
886
+ {
887
+ anonymous: false,
888
+ inputs: [
889
+ {
890
+ indexed: true,
891
+ internalType: "uint256",
892
+ name: "newFee",
893
+ type: "uint256"
894
+ }
895
+ ],
896
+ name: "CallbackFeeChanged",
897
+ type: "event"
898
+ },
899
+ {
900
+ anonymous: false,
901
+ inputs: [],
902
+ name: "EIP712DomainChanged",
903
+ type: "event"
904
+ },
905
+ {
906
+ anonymous: false,
907
+ inputs: [
908
+ {
909
+ indexed: true,
910
+ internalType: "address",
911
+ name: "newAddress",
912
+ type: "address"
913
+ }
914
+ ],
915
+ name: "EncryptECIESAddressChanged",
916
+ type: "event"
917
+ },
918
+ {
919
+ anonymous: false,
920
+ inputs: [
921
+ {
922
+ indexed: true,
923
+ internalType: "address",
924
+ name: "newAddress",
925
+ type: "address"
926
+ }
927
+ ],
928
+ name: "EncryptTEAddressChanged",
929
+ type: "event"
930
+ },
931
+ {
932
+ anonymous: false,
933
+ inputs: [
934
+ {
935
+ indexed: true,
936
+ internalType: "uint256",
937
+ name: "transferId",
938
+ type: "uint256"
939
+ },
940
+ {
941
+ indexed: true,
942
+ internalType: "address",
943
+ name: "from",
944
+ type: "address"
945
+ },
946
+ {
947
+ indexed: true,
948
+ internalType: "address",
949
+ name: "to",
950
+ type: "address"
951
+ },
952
+ {
953
+ indexed: false,
954
+ internalType: "bytes",
955
+ name: "encryptedData",
956
+ type: "bytes"
957
+ }
958
+ ],
959
+ name: "EncryptedTransfer",
960
+ type: "event"
961
+ },
962
+ {
963
+ anonymous: false,
964
+ inputs: [
965
+ {
966
+ indexed: true,
967
+ internalType: "address",
968
+ name: "sender",
969
+ type: "address"
970
+ },
971
+ {
972
+ indexed: true,
973
+ internalType: "address",
974
+ name: "receiver",
975
+ type: "address"
976
+ },
977
+ {
978
+ indexed: true,
979
+ internalType: "uint256",
980
+ name: "value",
981
+ type: "uint256"
982
+ }
983
+ ],
984
+ name: "GasTokenBalanceToppedUp",
985
+ type: "event"
986
+ },
987
+ {
988
+ anonymous: false,
989
+ inputs: [
990
+ {
991
+ indexed: true,
992
+ internalType: "address",
993
+ name: "receiver",
994
+ type: "address"
995
+ },
996
+ {
997
+ indexed: true,
998
+ internalType: "uint256",
999
+ name: "value",
1000
+ type: "uint256"
1001
+ }
1002
+ ],
1003
+ name: "GasTokenWithdrawn",
1004
+ type: "event"
1005
+ },
1006
+ {
1007
+ anonymous: false,
1008
+ inputs: [
1009
+ {
1010
+ indexed: true,
1011
+ internalType: "address",
1012
+ name: "holder",
1013
+ type: "address"
1014
+ },
1015
+ {
1016
+ indexed: true,
1017
+ internalType: "address",
1018
+ name: "viewer",
1019
+ type: "address"
1020
+ }
1021
+ ],
1022
+ name: "HistoricViewPermissionsRevoked",
1023
+ type: "event"
1024
+ },
1025
+ {
1026
+ anonymous: false,
1027
+ inputs: [
1028
+ {
1029
+ indexed: true,
1030
+ internalType: "address",
1031
+ name: "holder",
1032
+ type: "address"
1033
+ },
1034
+ {
1035
+ indexed: true,
1036
+ internalType: "address",
1037
+ name: "viewer",
1038
+ type: "address"
1039
+ },
1040
+ {
1041
+ indexed: false,
1042
+ internalType: "uint256",
1043
+ name: "fromTimestamp",
1044
+ type: "uint256"
1045
+ },
1046
+ {
1047
+ indexed: false,
1048
+ internalType: "uint256",
1049
+ name: "toTimestamp",
1050
+ type: "uint256"
1051
+ }
1052
+ ],
1053
+ name: "HistoricViewTimeRangeAuthorized",
1054
+ type: "event"
1055
+ },
1056
+ {
1057
+ anonymous: false,
1058
+ inputs: [
1059
+ {
1060
+ indexed: true,
1061
+ internalType: "address",
1062
+ name: "holder",
1063
+ type: "address"
1064
+ },
1065
+ {
1066
+ indexed: true,
1067
+ internalType: "address",
1068
+ name: "viewer",
1069
+ type: "address"
1070
+ }
1071
+ ],
1072
+ name: "HistoricViewTimeRangeRevoked",
1073
+ type: "event"
1074
+ },
1075
+ {
1076
+ anonymous: false,
1077
+ inputs: [
1078
+ {
1079
+ indexed: true,
1080
+ internalType: "address",
1081
+ name: "holder",
1082
+ type: "address"
1083
+ },
1084
+ {
1085
+ indexed: true,
1086
+ internalType: "address",
1087
+ name: "viewer",
1088
+ type: "address"
1089
+ },
1090
+ {
1091
+ indexed: true,
1092
+ internalType: "uint256",
1093
+ name: "transferId",
1094
+ type: "uint256"
1095
+ }
1096
+ ],
1097
+ name: "HistoricViewTransferIdAuthorized",
1098
+ type: "event"
1099
+ },
1100
+ {
1101
+ anonymous: false,
1102
+ inputs: [
1103
+ {
1104
+ indexed: true,
1105
+ internalType: "address",
1106
+ name: "holder",
1107
+ type: "address"
1108
+ },
1109
+ {
1110
+ indexed: true,
1111
+ internalType: "address",
1112
+ name: "viewer",
1113
+ type: "address"
1114
+ },
1115
+ {
1116
+ indexed: true,
1117
+ internalType: "uint256",
1118
+ name: "transferId",
1119
+ type: "uint256"
1120
+ }
1121
+ ],
1122
+ name: "HistoricViewTransferIdRevoked",
1123
+ type: "event"
1124
+ },
1125
+ {
1126
+ anonymous: false,
1127
+ inputs: [
1128
+ {
1129
+ indexed: false,
1130
+ internalType: "uint64",
1131
+ name: "version",
1132
+ type: "uint64"
1133
+ }
1134
+ ],
1135
+ name: "Initialized",
1136
+ type: "event"
1137
+ },
1138
+ {
1139
+ anonymous: false,
1140
+ inputs: [
1141
+ {
1142
+ indexed: true,
1143
+ internalType: "address",
1144
+ name: "viewer",
1145
+ type: "address"
1146
+ }
1147
+ ],
1148
+ name: "PublicKeyRegistered",
1149
+ type: "event"
1150
+ },
1151
+ {
1152
+ anonymous: false,
1153
+ inputs: [
1154
+ {
1155
+ indexed: true,
1156
+ internalType: "address",
1157
+ name: "viewer",
1158
+ type: "address"
1159
+ },
1160
+ {
1161
+ indexed: true,
1162
+ internalType: "address",
1163
+ name: "from",
1164
+ type: "address"
1165
+ },
1166
+ {
1167
+ indexed: true,
1168
+ internalType: "address",
1169
+ name: "to",
1170
+ type: "address"
1171
+ },
1172
+ {
1173
+ indexed: false,
1174
+ internalType: "bytes",
1175
+ name: "encryptedTransfer",
1176
+ type: "bytes"
1177
+ }
1178
+ ],
1179
+ name: "ReEncryptedTransfer",
1180
+ type: "event"
1181
+ },
1182
+ {
1183
+ anonymous: false,
1184
+ inputs: [
1185
+ {
1186
+ indexed: true,
1187
+ internalType: "address",
1188
+ name: "newAddress",
1189
+ type: "address"
1190
+ }
1191
+ ],
1192
+ name: "SubmitCTXAddressChanged",
1193
+ type: "event"
1194
+ },
1195
+ {
1196
+ anonymous: false,
1197
+ inputs: [
1198
+ {
1199
+ indexed: true,
1200
+ internalType: "address",
1201
+ name: "from",
1202
+ type: "address"
1203
+ },
1204
+ {
1205
+ indexed: true,
1206
+ internalType: "address",
1207
+ name: "to",
1208
+ type: "address"
1209
+ },
1210
+ {
1211
+ indexed: false,
1212
+ internalType: "uint256",
1213
+ name: "value",
1214
+ type: "uint256"
1215
+ }
1216
+ ],
1217
+ name: "Transfer",
1218
+ type: "event"
1219
+ },
1220
+ {
1221
+ anonymous: false,
1222
+ inputs: [
1223
+ {
1224
+ indexed: true,
1225
+ internalType: "address",
1226
+ name: "from",
1227
+ type: "address"
1228
+ },
1229
+ {
1230
+ indexed: true,
1231
+ internalType: "address",
1232
+ name: "to",
1233
+ type: "address"
1234
+ }
1235
+ ],
1236
+ name: "Transfer",
1237
+ type: "event"
1238
+ },
1239
+ {
1240
+ anonymous: false,
1241
+ inputs: [
1242
+ {
1243
+ indexed: true,
1244
+ internalType: "address",
1245
+ name: "from",
1246
+ type: "address"
1247
+ },
1248
+ {
1249
+ indexed: true,
1250
+ internalType: "address",
1251
+ name: "to",
1252
+ type: "address"
1253
+ },
1254
+ {
1255
+ indexed: true,
1256
+ internalType: "uint256",
1257
+ name: "transferId",
1258
+ type: "uint256"
1259
+ },
1260
+ {
1261
+ indexed: false,
1262
+ internalType: "bytes",
1263
+ name: "encryptedValue",
1264
+ type: "bytes"
1265
+ }
1266
+ ],
1267
+ name: "TransferValueEncryptedForRecipient",
1268
+ type: "event"
1269
+ },
1270
+ {
1271
+ anonymous: false,
1272
+ inputs: [
1273
+ {
1274
+ indexed: true,
1275
+ internalType: "address",
1276
+ name: "from",
1277
+ type: "address"
1278
+ },
1279
+ {
1280
+ indexed: true,
1281
+ internalType: "address",
1282
+ name: "to",
1283
+ type: "address"
1284
+ },
1285
+ {
1286
+ indexed: true,
1287
+ internalType: "uint256",
1288
+ name: "transferId",
1289
+ type: "uint256"
1290
+ },
1291
+ {
1292
+ indexed: false,
1293
+ internalType: "bytes",
1294
+ name: "encryptedValue",
1295
+ type: "bytes"
1296
+ }
1297
+ ],
1298
+ name: "TransferValueEncryptedForSender",
1299
+ type: "event"
1300
+ },
1301
+ {
1302
+ anonymous: false,
1303
+ inputs: [
1304
+ {
1305
+ indexed: true,
1306
+ internalType: "address",
1307
+ name: "holder",
1308
+ type: "address"
1309
+ },
1310
+ {
1311
+ indexed: true,
1312
+ internalType: "address",
1313
+ name: "newViewer",
1314
+ type: "address"
1315
+ }
1316
+ ],
1317
+ name: "ViewerChanged",
1318
+ type: "event"
1319
+ },
1320
+ {
1321
+ inputs: [],
1322
+ name: "CANCEL_AUTHORIZATION_TYPEHASH",
1323
+ outputs: [
1324
+ {
1325
+ internalType: "bytes32",
1326
+ name: "",
1327
+ type: "bytes32"
1328
+ }
1329
+ ],
1330
+ stateMutability: "view",
1331
+ type: "function"
1332
+ },
1333
+ {
1334
+ inputs: [],
1335
+ name: "DOMAIN_SEPARATOR",
1336
+ outputs: [
1337
+ {
1338
+ internalType: "bytes32",
1339
+ name: "",
1340
+ type: "bytes32"
1341
+ }
1342
+ ],
1343
+ stateMutability: "view",
1344
+ type: "function"
1345
+ },
1346
+ {
1347
+ inputs: [],
1348
+ name: "ENCRYPTED_RECEIVE_WITH_AUTHORIZATION_TYPEHASH",
1349
+ outputs: [
1350
+ {
1351
+ internalType: "bytes32",
1352
+ name: "",
1353
+ type: "bytes32"
1354
+ }
1355
+ ],
1356
+ stateMutability: "view",
1357
+ type: "function"
1358
+ },
1359
+ {
1360
+ inputs: [],
1361
+ name: "ENCRYPTED_TRANSFER_WITH_AUTHORIZATION_TYPEHASH",
1362
+ outputs: [
1363
+ {
1364
+ internalType: "bytes32",
1365
+ name: "",
1366
+ type: "bytes32"
1367
+ }
1368
+ ],
1369
+ stateMutability: "view",
1370
+ type: "function"
1371
+ },
1372
+ {
1373
+ inputs: [],
1374
+ name: "RECEIVE_WITH_AUTHORIZATION_TYPEHASH",
1375
+ outputs: [
1376
+ {
1377
+ internalType: "bytes32",
1378
+ name: "",
1379
+ type: "bytes32"
1380
+ }
1381
+ ],
1382
+ stateMutability: "view",
1383
+ type: "function"
1384
+ },
1385
+ {
1386
+ inputs: [],
1387
+ name: "TRANSFER_WITH_AUTHORIZATION_TYPEHASH",
1388
+ outputs: [
1389
+ {
1390
+ internalType: "bytes32",
1391
+ name: "",
1392
+ type: "bytes32"
1393
+ }
1394
+ ],
1395
+ stateMutability: "view",
1396
+ type: "function"
1397
+ },
1398
+ {
1399
+ inputs: [
1400
+ {
1401
+ internalType: "address",
1402
+ name: "owner",
1403
+ type: "address"
1404
+ },
1405
+ {
1406
+ internalType: "address",
1407
+ name: "spender",
1408
+ type: "address"
1409
+ }
1410
+ ],
1411
+ name: "allowance",
1412
+ outputs: [
1413
+ {
1414
+ internalType: "uint256",
1415
+ name: "",
1416
+ type: "uint256"
1417
+ }
1418
+ ],
1419
+ stateMutability: "view",
1420
+ type: "function"
1421
+ },
1422
+ {
1423
+ inputs: [
1424
+ {
1425
+ internalType: "address",
1426
+ name: "spender",
1427
+ type: "address"
1428
+ },
1429
+ {
1430
+ internalType: "uint256",
1431
+ name: "value",
1432
+ type: "uint256"
1433
+ }
1434
+ ],
1435
+ name: "approve",
1436
+ outputs: [
1437
+ {
1438
+ internalType: "bool",
1439
+ name: "",
1440
+ type: "bool"
1441
+ }
1442
+ ],
1443
+ stateMutability: "nonpayable",
1444
+ type: "function"
1445
+ },
1446
+ {
1447
+ inputs: [],
1448
+ name: "authority",
1449
+ outputs: [
1450
+ {
1451
+ internalType: "address",
1452
+ name: "",
1453
+ type: "address"
1454
+ }
1455
+ ],
1456
+ stateMutability: "view",
1457
+ type: "function"
1458
+ },
1459
+ {
1460
+ inputs: [
1461
+ {
1462
+ internalType: "address",
1463
+ name: "authorizer",
1464
+ type: "address"
1465
+ },
1466
+ {
1467
+ internalType: "bytes32",
1468
+ name: "nonce",
1469
+ type: "bytes32"
1470
+ }
1471
+ ],
1472
+ name: "authorizationState",
1473
+ outputs: [
1474
+ {
1475
+ internalType: "bool",
1476
+ name: "used",
1477
+ type: "bool"
1478
+ }
1479
+ ],
1480
+ stateMutability: "view",
1481
+ type: "function"
1482
+ },
1483
+ {
1484
+ inputs: [
1485
+ {
1486
+ internalType: "address",
1487
+ name: "viewer",
1488
+ type: "address"
1489
+ },
1490
+ {
1491
+ internalType: "uint256",
1492
+ name: "fromTimestamp",
1493
+ type: "uint256"
1494
+ },
1495
+ {
1496
+ internalType: "uint256",
1497
+ name: "toTimestamp",
1498
+ type: "uint256"
1499
+ }
1500
+ ],
1501
+ name: "authorizeHistoricViewTimeRange",
1502
+ outputs: [
1503
+ {
1504
+ internalType: "bool",
1505
+ name: "success",
1506
+ type: "bool"
1507
+ }
1508
+ ],
1509
+ stateMutability: "nonpayable",
1510
+ type: "function"
1511
+ },
1512
+ {
1513
+ inputs: [
1514
+ {
1515
+ internalType: "address",
1516
+ name: "viewer",
1517
+ type: "address"
1518
+ },
1519
+ {
1520
+ internalType: "uint256",
1521
+ name: "transferId",
1522
+ type: "uint256"
1523
+ }
1524
+ ],
1525
+ name: "authorizeHistoricViewTransferId",
1526
+ outputs: [
1527
+ {
1528
+ internalType: "bool",
1529
+ name: "success",
1530
+ type: "bool"
1531
+ }
1532
+ ],
1533
+ stateMutability: "nonpayable",
1534
+ type: "function"
1535
+ },
1536
+ {
1537
+ inputs: [
1538
+ {
1539
+ internalType: "address",
1540
+ name: "account",
1541
+ type: "address"
1542
+ }
1543
+ ],
1544
+ name: "balanceOf",
1545
+ outputs: [
1546
+ {
1547
+ internalType: "uint256",
1548
+ name: "balance",
1549
+ type: "uint256"
1550
+ }
1551
+ ],
1552
+ stateMutability: "pure",
1553
+ type: "function"
1554
+ },
1555
+ {
1556
+ inputs: [],
1557
+ name: "callbackFee",
1558
+ outputs: [
1559
+ {
1560
+ internalType: "uint256",
1561
+ name: "",
1562
+ type: "uint256"
1563
+ }
1564
+ ],
1565
+ stateMutability: "view",
1566
+ type: "function"
1567
+ },
1568
+ {
1569
+ inputs: [
1570
+ {
1571
+ internalType: "address",
1572
+ name: "viewer",
1573
+ type: "address"
1574
+ },
1575
+ {
1576
+ internalType: "uint256",
1577
+ name: "transferId",
1578
+ type: "uint256"
1579
+ },
1580
+ {
1581
+ internalType: "address",
1582
+ name: "from",
1583
+ type: "address"
1584
+ },
1585
+ {
1586
+ internalType: "address",
1587
+ name: "to",
1588
+ type: "address"
1589
+ },
1590
+ {
1591
+ internalType: "uint256",
1592
+ name: "timestamp",
1593
+ type: "uint256"
1594
+ }
1595
+ ],
1596
+ name: "canDecryptHistoricTransfer",
1597
+ outputs: [
1598
+ {
1599
+ internalType: "bool",
1600
+ name: "canDecrypt",
1601
+ type: "bool"
1602
+ }
1603
+ ],
1604
+ stateMutability: "view",
1605
+ type: "function"
1606
+ },
1607
+ {
1608
+ inputs: [
1609
+ {
1610
+ internalType: "address",
1611
+ name: "authorizer",
1612
+ type: "address"
1613
+ },
1614
+ {
1615
+ internalType: "bytes32",
1616
+ name: "nonce",
1617
+ type: "bytes32"
1618
+ },
1619
+ {
1620
+ internalType: "uint8",
1621
+ name: "v",
1622
+ type: "uint8"
1623
+ },
1624
+ {
1625
+ internalType: "bytes32",
1626
+ name: "r",
1627
+ type: "bytes32"
1628
+ },
1629
+ {
1630
+ internalType: "bytes32",
1631
+ name: "s",
1632
+ type: "bytes32"
1633
+ }
1634
+ ],
1635
+ name: "cancelAuthorization",
1636
+ outputs: [],
1637
+ stateMutability: "nonpayable",
1638
+ type: "function"
1639
+ },
1640
+ {
1641
+ inputs: [],
1642
+ name: "decimals",
1643
+ outputs: [
1644
+ {
1645
+ internalType: "uint8",
1646
+ name: "decimalsValue",
1647
+ type: "uint8"
1648
+ }
1649
+ ],
1650
+ stateMutability: "view",
1651
+ type: "function"
1652
+ },
1653
+ {
1654
+ inputs: [
1655
+ {
1656
+ internalType: "address",
1657
+ name: "account",
1658
+ type: "address"
1659
+ },
1660
+ {
1661
+ internalType: "uint256",
1662
+ name: "value",
1663
+ type: "uint256"
1664
+ }
1665
+ ],
1666
+ name: "depositFor",
1667
+ outputs: [
1668
+ {
1669
+ internalType: "bool",
1670
+ name: "success",
1671
+ type: "bool"
1672
+ }
1673
+ ],
1674
+ stateMutability: "nonpayable",
1675
+ type: "function"
1676
+ },
1677
+ {
1678
+ inputs: [
1679
+ {
1680
+ internalType: "address",
1681
+ name: "account",
1682
+ type: "address"
1683
+ },
1684
+ {
1685
+ internalType: "uint256",
1686
+ name: "value",
1687
+ type: "uint256"
1688
+ }
1689
+ ],
1690
+ name: "depositForWithGasToken",
1691
+ outputs: [
1692
+ {
1693
+ internalType: "bool",
1694
+ name: "success",
1695
+ type: "bool"
1696
+ }
1697
+ ],
1698
+ stateMutability: "payable",
1699
+ type: "function"
1700
+ },
1701
+ {
1702
+ inputs: [],
1703
+ name: "eip712Domain",
1704
+ outputs: [
1705
+ {
1706
+ internalType: "bytes1",
1707
+ name: "fields",
1708
+ type: "bytes1"
1709
+ },
1710
+ {
1711
+ internalType: "string",
1712
+ name: "name",
1713
+ type: "string"
1714
+ },
1715
+ {
1716
+ internalType: "string",
1717
+ name: "version",
1718
+ type: "string"
1719
+ },
1720
+ {
1721
+ internalType: "uint256",
1722
+ name: "chainId",
1723
+ type: "uint256"
1724
+ },
1725
+ {
1726
+ internalType: "address",
1727
+ name: "verifyingContract",
1728
+ type: "address"
1729
+ },
1730
+ {
1731
+ internalType: "bytes32",
1732
+ name: "salt",
1733
+ type: "bytes32"
1734
+ },
1735
+ {
1736
+ internalType: "uint256[]",
1737
+ name: "extensions",
1738
+ type: "uint256[]"
1739
+ }
1740
+ ],
1741
+ stateMutability: "view",
1742
+ type: "function"
1743
+ },
1744
+ {
1745
+ inputs: [],
1746
+ name: "encryptECIESAddress",
1747
+ outputs: [
1748
+ {
1749
+ internalType: "address",
1750
+ name: "",
1751
+ type: "address"
1752
+ }
1753
+ ],
1754
+ stateMutability: "view",
1755
+ type: "function"
1756
+ },
1757
+ {
1758
+ inputs: [],
1759
+ name: "encryptTEAddress",
1760
+ outputs: [
1761
+ {
1762
+ internalType: "address",
1763
+ name: "",
1764
+ type: "address"
1765
+ }
1766
+ ],
1767
+ stateMutability: "view",
1768
+ type: "function"
1769
+ },
1770
+ {
1771
+ inputs: [
1772
+ {
1773
+ internalType: "address",
1774
+ name: "holder",
1775
+ type: "address"
1776
+ },
1777
+ {
1778
+ internalType: "uint256",
1779
+ name: "value",
1780
+ type: "uint256"
1781
+ }
1782
+ ],
1783
+ name: "encryptValue",
1784
+ outputs: [
1785
+ {
1786
+ internalType: "bytes",
1787
+ name: "encryptedValue",
1788
+ type: "bytes"
1789
+ }
1790
+ ],
1791
+ stateMutability: "view",
1792
+ type: "function"
1793
+ },
1794
+ {
1795
+ inputs: [
1796
+ {
1797
+ internalType: "address",
1798
+ name: "holder",
1799
+ type: "address"
1800
+ }
1801
+ ],
1802
+ name: "encryptedBalanceOf",
1803
+ outputs: [
1804
+ {
1805
+ internalType: "bytes",
1806
+ name: "encryptedBalance",
1807
+ type: "bytes"
1808
+ }
1809
+ ],
1810
+ stateMutability: "view",
1811
+ type: "function"
1812
+ },
1813
+ {
1814
+ inputs: [
1815
+ {
1816
+ internalType: "address",
1817
+ name: "from",
1818
+ type: "address"
1819
+ },
1820
+ {
1821
+ internalType: "address",
1822
+ name: "to",
1823
+ type: "address"
1824
+ },
1825
+ {
1826
+ internalType: "bytes",
1827
+ name: "value",
1828
+ type: "bytes"
1829
+ },
1830
+ {
1831
+ internalType: "uint256",
1832
+ name: "validAfter",
1833
+ type: "uint256"
1834
+ },
1835
+ {
1836
+ internalType: "uint256",
1837
+ name: "validBefore",
1838
+ type: "uint256"
1839
+ },
1840
+ {
1841
+ internalType: "bytes32",
1842
+ name: "nonce",
1843
+ type: "bytes32"
1844
+ },
1845
+ {
1846
+ internalType: "uint8",
1847
+ name: "v",
1848
+ type: "uint8"
1849
+ },
1850
+ {
1851
+ internalType: "bytes32",
1852
+ name: "r",
1853
+ type: "bytes32"
1854
+ },
1855
+ {
1856
+ internalType: "bytes32",
1857
+ name: "s",
1858
+ type: "bytes32"
1859
+ }
1860
+ ],
1861
+ name: "encryptedReceiveWithAuthorization",
1862
+ outputs: [],
1863
+ stateMutability: "payable",
1864
+ type: "function"
1865
+ },
1866
+ {
1867
+ inputs: [
1868
+ {
1869
+ internalType: "address",
1870
+ name: "to",
1871
+ type: "address"
1872
+ },
1873
+ {
1874
+ internalType: "bytes",
1875
+ name: "value",
1876
+ type: "bytes"
1877
+ }
1878
+ ],
1879
+ name: "encryptedTransfer",
1880
+ outputs: [],
1881
+ stateMutability: "payable",
1882
+ type: "function"
1883
+ },
1884
+ {
1885
+ inputs: [
1886
+ {
1887
+ internalType: "address",
1888
+ name: "from",
1889
+ type: "address"
1890
+ },
1891
+ {
1892
+ internalType: "address",
1893
+ name: "to",
1894
+ type: "address"
1895
+ },
1896
+ {
1897
+ internalType: "bytes",
1898
+ name: "value",
1899
+ type: "bytes"
1900
+ }
1901
+ ],
1902
+ name: "encryptedTransferFrom",
1903
+ outputs: [],
1904
+ stateMutability: "payable",
1905
+ type: "function"
1906
+ },
1907
+ {
1908
+ inputs: [
1909
+ {
1910
+ internalType: "address",
1911
+ name: "from",
1912
+ type: "address"
1913
+ },
1914
+ {
1915
+ internalType: "address",
1916
+ name: "to",
1917
+ type: "address"
1918
+ },
1919
+ {
1920
+ internalType: "bytes",
1921
+ name: "value",
1922
+ type: "bytes"
1923
+ },
1924
+ {
1925
+ internalType: "uint256",
1926
+ name: "validAfter",
1927
+ type: "uint256"
1928
+ },
1929
+ {
1930
+ internalType: "uint256",
1931
+ name: "validBefore",
1932
+ type: "uint256"
1933
+ },
1934
+ {
1935
+ internalType: "bytes32",
1936
+ name: "nonce",
1937
+ type: "bytes32"
1938
+ },
1939
+ {
1940
+ internalType: "uint8",
1941
+ name: "v",
1942
+ type: "uint8"
1943
+ },
1944
+ {
1945
+ internalType: "bytes32",
1946
+ name: "r",
1947
+ type: "bytes32"
1948
+ },
1949
+ {
1950
+ internalType: "bytes32",
1951
+ name: "s",
1952
+ type: "bytes32"
1953
+ }
1954
+ ],
1955
+ name: "encryptedTransferWithAuthorization",
1956
+ outputs: [],
1957
+ stateMutability: "payable",
1958
+ type: "function"
1959
+ },
1960
+ {
1961
+ inputs: [
1962
+ {
1963
+ internalType: "address",
1964
+ name: "receiver",
1965
+ type: "address"
1966
+ }
1967
+ ],
1968
+ name: "fundWithGasToken",
1969
+ outputs: [],
1970
+ stateMutability: "payable",
1971
+ type: "function"
1972
+ },
1973
+ {
1974
+ inputs: [
1975
+ {
1976
+ internalType: "address",
1977
+ name: "holder",
1978
+ type: "address"
1979
+ }
1980
+ ],
1981
+ name: "gasTokenBalanceOf",
1982
+ outputs: [
1983
+ {
1984
+ internalType: "uint256",
1985
+ name: "balance",
1986
+ type: "uint256"
1987
+ }
1988
+ ],
1989
+ stateMutability: "view",
1990
+ type: "function"
1991
+ },
1992
+ {
1993
+ inputs: [
1994
+ {
1995
+ internalType: "string",
1996
+ name: "",
1997
+ type: "string"
1998
+ },
1999
+ {
2000
+ internalType: "string",
2001
+ name: "",
2002
+ type: "string"
2003
+ },
2004
+ {
2005
+ internalType: "string",
2006
+ name: "",
2007
+ type: "string"
2008
+ },
2009
+ {
2010
+ internalType: "address",
2011
+ name: "",
2012
+ type: "address"
2013
+ }
2014
+ ],
2015
+ name: "initialize",
2016
+ outputs: [],
2017
+ stateMutability: "pure",
2018
+ type: "function"
2019
+ },
2020
+ {
2021
+ inputs: [
2022
+ {
2023
+ internalType: "contract IERC20Metadata",
2024
+ name: "underlyingToken",
2025
+ type: "address"
2026
+ },
2027
+ {
2028
+ internalType: "string",
2029
+ name: "version_",
2030
+ type: "string"
2031
+ },
2032
+ {
2033
+ internalType: "address",
2034
+ name: "initialAuthority",
2035
+ type: "address"
2036
+ }
2037
+ ],
2038
+ name: "initialize",
2039
+ outputs: [],
2040
+ stateMutability: "nonpayable",
2041
+ type: "function"
2042
+ },
2043
+ {
2044
+ inputs: [],
2045
+ name: "isConsumingScheduledOp",
2046
+ outputs: [
2047
+ {
2048
+ internalType: "bytes4",
2049
+ name: "",
2050
+ type: "bytes4"
2051
+ }
2052
+ ],
2053
+ stateMutability: "view",
2054
+ type: "function"
2055
+ },
2056
+ {
2057
+ inputs: [],
2058
+ name: "name",
2059
+ outputs: [
2060
+ {
2061
+ internalType: "string",
2062
+ name: "",
2063
+ type: "string"
2064
+ }
2065
+ ],
2066
+ stateMutability: "view",
2067
+ type: "function"
2068
+ },
2069
+ {
2070
+ inputs: [
2071
+ {
2072
+ internalType: "address",
2073
+ name: "owner",
2074
+ type: "address"
2075
+ }
2076
+ ],
2077
+ name: "nonces",
2078
+ outputs: [
2079
+ {
2080
+ internalType: "uint256",
2081
+ name: "",
2082
+ type: "uint256"
2083
+ }
2084
+ ],
2085
+ stateMutability: "view",
2086
+ type: "function"
2087
+ },
2088
+ {
2089
+ inputs: [
2090
+ {
2091
+ internalType: "bytes[]",
2092
+ name: "decryptedArguments",
2093
+ type: "bytes[]"
2094
+ },
2095
+ {
2096
+ internalType: "bytes[]",
2097
+ name: "plaintextArguments",
2098
+ type: "bytes[]"
2099
+ }
2100
+ ],
2101
+ name: "onDecrypt",
2102
+ outputs: [],
2103
+ stateMutability: "nonpayable",
2104
+ type: "function"
2105
+ },
2106
+ {
2107
+ inputs: [
2108
+ {
2109
+ internalType: "address",
2110
+ name: "owner",
2111
+ type: "address"
2112
+ },
2113
+ {
2114
+ internalType: "address",
2115
+ name: "spender",
2116
+ type: "address"
2117
+ },
2118
+ {
2119
+ internalType: "uint256",
2120
+ name: "value",
2121
+ type: "uint256"
2122
+ },
2123
+ {
2124
+ internalType: "uint256",
2125
+ name: "deadline",
2126
+ type: "uint256"
2127
+ },
2128
+ {
2129
+ internalType: "uint8",
2130
+ name: "v",
2131
+ type: "uint8"
2132
+ },
2133
+ {
2134
+ internalType: "bytes32",
2135
+ name: "r",
2136
+ type: "bytes32"
2137
+ },
2138
+ {
2139
+ internalType: "bytes32",
2140
+ name: "s",
2141
+ type: "bytes32"
2142
+ }
2143
+ ],
2144
+ name: "permit",
2145
+ outputs: [],
2146
+ stateMutability: "nonpayable",
2147
+ type: "function"
2148
+ },
2149
+ {
2150
+ inputs: [
2151
+ {
2152
+ internalType: "address",
2153
+ name: "accountAddress",
2154
+ type: "address"
2155
+ }
2156
+ ],
2157
+ name: "publicKeys",
2158
+ outputs: [
2159
+ {
2160
+ internalType: "bytes32",
2161
+ name: "x",
2162
+ type: "bytes32"
2163
+ },
2164
+ {
2165
+ internalType: "bytes32",
2166
+ name: "y",
2167
+ type: "bytes32"
2168
+ }
2169
+ ],
2170
+ stateMutability: "view",
2171
+ type: "function"
2172
+ },
2173
+ {
2174
+ inputs: [
2175
+ {
2176
+ internalType: "address",
2177
+ name: "from",
2178
+ type: "address"
2179
+ },
2180
+ {
2181
+ internalType: "address",
2182
+ name: "to",
2183
+ type: "address"
2184
+ },
2185
+ {
2186
+ internalType: "uint256",
2187
+ name: "value",
2188
+ type: "uint256"
2189
+ },
2190
+ {
2191
+ internalType: "uint256",
2192
+ name: "validAfter",
2193
+ type: "uint256"
2194
+ },
2195
+ {
2196
+ internalType: "uint256",
2197
+ name: "validBefore",
2198
+ type: "uint256"
2199
+ },
2200
+ {
2201
+ internalType: "bytes32",
2202
+ name: "nonce",
2203
+ type: "bytes32"
2204
+ },
2205
+ {
2206
+ internalType: "uint8",
2207
+ name: "v",
2208
+ type: "uint8"
2209
+ },
2210
+ {
2211
+ internalType: "bytes32",
2212
+ name: "r",
2213
+ type: "bytes32"
2214
+ },
2215
+ {
2216
+ internalType: "bytes32",
2217
+ name: "s",
2218
+ type: "bytes32"
2219
+ }
2220
+ ],
2221
+ name: "receiveWithAuthorization",
2222
+ outputs: [],
2223
+ stateMutability: "nonpayable",
2224
+ type: "function"
2225
+ },
2226
+ {
2227
+ inputs: [
2228
+ {
2229
+ components: [
2230
+ {
2231
+ internalType: "bytes32",
2232
+ name: "x",
2233
+ type: "bytes32"
2234
+ },
2235
+ {
2236
+ internalType: "bytes32",
2237
+ name: "y",
2238
+ type: "bytes32"
2239
+ }
2240
+ ],
2241
+ internalType: "struct PublicKey",
2242
+ name: "publicKey",
2243
+ type: "tuple"
2244
+ }
2245
+ ],
2246
+ name: "registerPublicKey",
2247
+ outputs: [],
2248
+ stateMutability: "nonpayable",
2249
+ type: "function"
2250
+ },
2251
+ {
2252
+ inputs: [
2253
+ {
2254
+ internalType: "address",
2255
+ name: "account",
2256
+ type: "address"
2257
+ },
2258
+ {
2259
+ internalType: "uint256",
2260
+ name: "value",
2261
+ type: "uint256"
2262
+ }
2263
+ ],
2264
+ name: "releaseTo",
2265
+ outputs: [],
2266
+ stateMutability: "nonpayable",
2267
+ type: "function"
2268
+ },
2269
+ {
2270
+ inputs: [
2271
+ {
2272
+ internalType: "address",
2273
+ name: "viewer",
2274
+ type: "address"
2275
+ }
2276
+ ],
2277
+ name: "removeHistoricViewAuth",
2278
+ outputs: [
2279
+ {
2280
+ internalType: "bool",
2281
+ name: "success",
2282
+ type: "bool"
2283
+ }
2284
+ ],
2285
+ stateMutability: "nonpayable",
2286
+ type: "function"
2287
+ },
2288
+ {
2289
+ inputs: [
2290
+ {
2291
+ internalType: "address",
2292
+ name: "viewer",
2293
+ type: "address"
2294
+ }
2295
+ ],
2296
+ name: "removeHistoricViewTimeRange",
2297
+ outputs: [
2298
+ {
2299
+ internalType: "bool",
2300
+ name: "success",
2301
+ type: "bool"
2302
+ }
2303
+ ],
2304
+ stateMutability: "nonpayable",
2305
+ type: "function"
2306
+ },
2307
+ {
2308
+ inputs: [
2309
+ {
2310
+ internalType: "address",
2311
+ name: "viewer",
2312
+ type: "address"
2313
+ },
2314
+ {
2315
+ internalType: "uint256",
2316
+ name: "transferId",
2317
+ type: "uint256"
2318
+ }
2319
+ ],
2320
+ name: "removeHistoricViewTransferId",
2321
+ outputs: [
2322
+ {
2323
+ internalType: "bool",
2324
+ name: "success",
2325
+ type: "bool"
2326
+ }
2327
+ ],
2328
+ stateMutability: "nonpayable",
2329
+ type: "function"
2330
+ },
2331
+ {
2332
+ inputs: [
2333
+ {
2334
+ internalType: "bytes",
2335
+ name: "encryptedTransferData",
2336
+ type: "bytes"
2337
+ }
2338
+ ],
2339
+ name: "requestDecryptHistoricTransfer",
2340
+ outputs: [],
2341
+ stateMutability: "payable",
2342
+ type: "function"
2343
+ },
2344
+ {
2345
+ inputs: [
2346
+ {
2347
+ internalType: "bytes",
2348
+ name: "encryptedTransferData",
2349
+ type: "bytes"
2350
+ },
2351
+ {
2352
+ internalType: "address",
2353
+ name: "historicViewer",
2354
+ type: "address"
2355
+ }
2356
+ ],
2357
+ name: "requestDecryptHistoricTransferFor",
2358
+ outputs: [],
2359
+ stateMutability: "payable",
2360
+ type: "function"
2361
+ },
2362
+ {
2363
+ inputs: [
2364
+ {
2365
+ internalType: "address",
2366
+ name: "holder",
2367
+ type: "address"
2368
+ }
2369
+ ],
2370
+ name: "requestedMints",
2371
+ outputs: [
2372
+ {
2373
+ internalType: "uint256",
2374
+ name: "value",
2375
+ type: "uint256"
2376
+ }
2377
+ ],
2378
+ stateMutability: "view",
2379
+ type: "function"
2380
+ },
2381
+ {
2382
+ inputs: [
2383
+ {
2384
+ internalType: "uint256",
2385
+ name: "value",
2386
+ type: "uint256"
2387
+ },
2388
+ {
2389
+ internalType: "address",
2390
+ name: "receiver",
2391
+ type: "address"
2392
+ }
2393
+ ],
2394
+ name: "retrieveGasToken",
2395
+ outputs: [],
2396
+ stateMutability: "nonpayable",
2397
+ type: "function"
2398
+ },
2399
+ {
2400
+ inputs: [
2401
+ {
2402
+ internalType: "address",
2403
+ name: "newAuthority",
2404
+ type: "address"
2405
+ }
2406
+ ],
2407
+ name: "setAuthority",
2408
+ outputs: [],
2409
+ stateMutability: "nonpayable",
2410
+ type: "function"
2411
+ },
2412
+ {
2413
+ inputs: [
2414
+ {
2415
+ internalType: "uint256",
2416
+ name: "newFee",
2417
+ type: "uint256"
2418
+ }
2419
+ ],
2420
+ name: "setCallbackFee",
2421
+ outputs: [],
2422
+ stateMutability: "nonpayable",
2423
+ type: "function"
2424
+ },
2425
+ {
2426
+ inputs: [
2427
+ {
2428
+ internalType: "address",
2429
+ name: "newAddress",
2430
+ type: "address"
2431
+ }
2432
+ ],
2433
+ name: "setEncryptECIESAddress",
2434
+ outputs: [],
2435
+ stateMutability: "nonpayable",
2436
+ type: "function"
2437
+ },
2438
+ {
2439
+ inputs: [
2440
+ {
2441
+ internalType: "address",
2442
+ name: "newAddress",
2443
+ type: "address"
2444
+ }
2445
+ ],
2446
+ name: "setEncryptTEAddress",
2447
+ outputs: [],
2448
+ stateMutability: "nonpayable",
2449
+ type: "function"
2450
+ },
2451
+ {
2452
+ inputs: [
2453
+ {
2454
+ internalType: "address",
2455
+ name: "newAddress",
2456
+ type: "address"
2457
+ }
2458
+ ],
2459
+ name: "setSubmitCTXAddress",
2460
+ outputs: [],
2461
+ stateMutability: "nonpayable",
2462
+ type: "function"
2463
+ },
2464
+ {
2465
+ inputs: [
2466
+ {
2467
+ internalType: "address",
2468
+ name: "viewer",
2469
+ type: "address"
2470
+ }
2471
+ ],
2472
+ name: "setViewerAddress",
2473
+ outputs: [],
2474
+ stateMutability: "payable",
2475
+ type: "function"
2476
+ },
2477
+ {
2478
+ inputs: [
2479
+ {
2480
+ components: [
2481
+ {
2482
+ internalType: "bytes32",
2483
+ name: "x",
2484
+ type: "bytes32"
2485
+ },
2486
+ {
2487
+ internalType: "bytes32",
2488
+ name: "y",
2489
+ type: "bytes32"
2490
+ }
2491
+ ],
2492
+ internalType: "struct PublicKey",
2493
+ name: "publicKey",
2494
+ type: "tuple"
2495
+ }
2496
+ ],
2497
+ name: "setViewerPublicKey",
2498
+ outputs: [],
2499
+ stateMutability: "payable",
2500
+ type: "function"
2501
+ },
2502
+ {
2503
+ inputs: [],
2504
+ name: "submitCTXAddress",
2505
+ outputs: [
2506
+ {
2507
+ internalType: "address",
2508
+ name: "",
2509
+ type: "address"
2510
+ }
2511
+ ],
2512
+ stateMutability: "view",
2513
+ type: "function"
2514
+ },
2515
+ {
2516
+ inputs: [],
2517
+ name: "symbol",
2518
+ outputs: [
2519
+ {
2520
+ internalType: "string",
2521
+ name: "",
2522
+ type: "string"
2523
+ }
2524
+ ],
2525
+ stateMutability: "view",
2526
+ type: "function"
2527
+ },
2528
+ {
2529
+ inputs: [],
2530
+ name: "totalSupply",
2531
+ outputs: [
2532
+ {
2533
+ internalType: "uint256",
2534
+ name: "supply",
2535
+ type: "uint256"
2536
+ }
2537
+ ],
2538
+ stateMutability: "view",
2539
+ type: "function"
2540
+ },
2541
+ {
2542
+ inputs: [
2543
+ {
2544
+ internalType: "address",
2545
+ name: "to",
2546
+ type: "address"
2547
+ },
2548
+ {
2549
+ internalType: "uint256",
2550
+ name: "value",
2551
+ type: "uint256"
2552
+ }
2553
+ ],
2554
+ name: "transfer",
2555
+ outputs: [
2556
+ {
2557
+ internalType: "bool",
2558
+ name: "",
2559
+ type: "bool"
2560
+ }
2561
+ ],
2562
+ stateMutability: "nonpayable",
2563
+ type: "function"
2564
+ },
2565
+ {
2566
+ inputs: [
2567
+ {
2568
+ internalType: "address",
2569
+ name: "from",
2570
+ type: "address"
2571
+ },
2572
+ {
2573
+ internalType: "address",
2574
+ name: "to",
2575
+ type: "address"
2576
+ },
2577
+ {
2578
+ internalType: "uint256",
2579
+ name: "value",
2580
+ type: "uint256"
2581
+ }
2582
+ ],
2583
+ name: "transferFrom",
2584
+ outputs: [
2585
+ {
2586
+ internalType: "bool",
2587
+ name: "result",
2588
+ type: "bool"
2589
+ }
2590
+ ],
2591
+ stateMutability: "nonpayable",
2592
+ type: "function"
2593
+ },
2594
+ {
2595
+ inputs: [
2596
+ {
2597
+ internalType: "address",
2598
+ name: "from",
2599
+ type: "address"
2600
+ },
2601
+ {
2602
+ internalType: "address",
2603
+ name: "to",
2604
+ type: "address"
2605
+ },
2606
+ {
2607
+ internalType: "uint256",
2608
+ name: "value",
2609
+ type: "uint256"
2610
+ },
2611
+ {
2612
+ internalType: "uint256",
2613
+ name: "validAfter",
2614
+ type: "uint256"
2615
+ },
2616
+ {
2617
+ internalType: "uint256",
2618
+ name: "validBefore",
2619
+ type: "uint256"
2620
+ },
2621
+ {
2622
+ internalType: "bytes32",
2623
+ name: "nonce",
2624
+ type: "bytes32"
2625
+ },
2626
+ {
2627
+ internalType: "uint8",
2628
+ name: "v",
2629
+ type: "uint8"
2630
+ },
2631
+ {
2632
+ internalType: "bytes32",
2633
+ name: "r",
2634
+ type: "bytes32"
2635
+ },
2636
+ {
2637
+ internalType: "bytes32",
2638
+ name: "s",
2639
+ type: "bytes32"
2640
+ }
2641
+ ],
2642
+ name: "transferWithAuthorization",
2643
+ outputs: [],
2644
+ stateMutability: "nonpayable",
2645
+ type: "function"
2646
+ },
2647
+ {
2648
+ inputs: [],
2649
+ name: "underlying",
2650
+ outputs: [
2651
+ {
2652
+ internalType: "contract IERC20",
2653
+ name: "",
2654
+ type: "address"
2655
+ }
2656
+ ],
2657
+ stateMutability: "view",
2658
+ type: "function"
2659
+ },
2660
+ {
2661
+ inputs: [],
2662
+ name: "version",
2663
+ outputs: [
2664
+ {
2665
+ internalType: "string",
2666
+ name: "",
2667
+ type: "string"
2668
+ }
2669
+ ],
2670
+ stateMutability: "view",
2671
+ type: "function"
2672
+ },
2673
+ {
2674
+ inputs: [
2675
+ {
2676
+ internalType: "address",
2677
+ name: "holder",
2678
+ type: "address"
2679
+ }
2680
+ ],
2681
+ name: "viewerAddresses",
2682
+ outputs: [
2683
+ {
2684
+ internalType: "address",
2685
+ name: "viewerAddress",
2686
+ type: "address"
2687
+ }
2688
+ ],
2689
+ stateMutability: "view",
2690
+ type: "function"
2691
+ },
2692
+ {
2693
+ inputs: [
2694
+ {
2695
+ internalType: "address",
2696
+ name: "account",
2697
+ type: "address"
2698
+ },
2699
+ {
2700
+ internalType: "uint256",
2701
+ name: "value",
2702
+ type: "uint256"
2703
+ }
2704
+ ],
2705
+ name: "withdrawTo",
2706
+ outputs: [
2707
+ {
2708
+ internalType: "bool",
2709
+ name: "success",
2710
+ type: "bool"
2711
+ }
2712
+ ],
2713
+ stateMutability: "nonpayable",
2714
+ type: "function"
2715
+ },
2716
+ {
2717
+ inputs: [
2718
+ {
2719
+ internalType: "address",
2720
+ name: "account",
2721
+ type: "address"
2722
+ },
2723
+ {
2724
+ internalType: "uint256",
2725
+ name: "value",
2726
+ type: "uint256"
2727
+ }
2728
+ ],
2729
+ name: "withdrawToWithGasToken",
2730
+ outputs: [
2731
+ {
2732
+ internalType: "bool",
2733
+ name: "success",
2734
+ type: "bool"
2735
+ }
2736
+ ],
2737
+ stateMutability: "payable",
2738
+ type: "function"
2739
+ },
2740
+ {
2741
+ stateMutability: "payable",
2742
+ type: "receive"
2743
+ }
2744
+ ];
2745
+
2746
+ // src/actions/funding.ts
2747
+ var CTX_RESERVE_THRESHOLD = 1n;
2748
+ async function getCtxBalance(config) {
2749
+ return await config.publicClient.readContract({
2750
+ address: config.address,
2751
+ abi: confidentialWrapperAbi,
2752
+ functionName: "gasTokenBalanceOf",
2753
+ args: [config.signer.address]
2754
+ });
2755
+ }
2756
+ async function getCtxRawCost(config) {
2757
+ return await config.publicClient.readContract({
2758
+ address: config.address,
2759
+ abi: confidentialWrapperAbi,
2760
+ functionName: "callbackFee"
2761
+ });
2762
+ }
2763
+ async function getCtxOperationCost(config) {
2764
+ const [fee, balance] = await Promise.all([getCtxRawCost(config), getCtxBalance(config)]);
2765
+ const topUp = CTX_RESERVE_THRESHOLD * fee - balance;
2766
+ return fee + (topUp > 0n ? topUp : 0n);
2767
+ }
2768
+
2769
+ // src/actions/transfers.ts
2770
+ async function approve(config, spender, amount) {
2771
+ const data = encodeFunctionData({
2772
+ abi: confidentialWrapperAbi,
2773
+ functionName: "approve",
2774
+ args: [spender, amount]
2775
+ });
2776
+ return config.signer.sendTransaction({ to: config.address, data });
2777
+ }
2778
+ async function transfer(config, to, amount) {
2779
+ const value = await getCtxOperationCost(config);
2780
+ const valueHex = encodeAbiParameters(
2781
+ [{ type: "address" }, { type: "uint256" }],
2782
+ [config.signer.address, amount]
2783
+ );
2784
+ const encryptedValue = await config.bite.encryptMessageForCTX(valueHex, config.address);
2785
+ const data = encodeFunctionData({
2786
+ abi: confidentialWrapperAbi,
2787
+ functionName: "encryptedTransfer",
2788
+ args: [to, encryptedValue]
2789
+ });
2790
+ return config.signer.sendTransaction({ to: config.address, data, value });
2791
+ }
2792
+ async function wrap(config, receiver, amount) {
2793
+ const value = await getCtxOperationCost(config);
2794
+ const data = encodeFunctionData({
2795
+ abi: confidentialWrapperAbi,
2796
+ functionName: "depositForWithGasToken",
2797
+ args: [receiver, amount]
2798
+ });
2799
+ return config.signer.sendTransaction({ to: config.address, data, value });
2800
+ }
2801
+ async function unwrap(config, receiver, amount) {
2802
+ const value = await getCtxOperationCost(config);
2803
+ const data = encodeFunctionData({
2804
+ abi: confidentialWrapperAbi,
2805
+ functionName: "withdrawToWithGasToken",
2806
+ args: [receiver, amount]
2807
+ });
2808
+ return config.signer.sendTransaction({ to: config.address, data, value });
2809
+ }
2810
+
2811
+ // src/actions/decrypt.ts
2812
+ import { bytesToHex, parseEventLogs } from "viem";
2813
+ async function decryptTokenBalance(config, viewerKey) {
2814
+ const raw = await config.publicClient.readContract({
2815
+ address: config.address,
2816
+ abi: confidentialWrapperAbi,
2817
+ functionName: "encryptedBalanceOf",
2818
+ args: [config.signer.address]
2819
+ });
2820
+ const encryptedHex = typeof raw === "string" ? raw : bytesToHex(raw);
2821
+ return decryptBalance(encryptedHex, viewerKey);
2822
+ }
2823
+ async function getTransferId(config, ctxHash) {
2824
+ const receipt = await config.publicClient.waitForTransactionReceipt({ hash: ctxHash });
2825
+ const events = parseEventLogs({
2826
+ abi: confidentialWrapperAbi,
2827
+ logs: receipt.logs,
2828
+ eventName: "EncryptedTransfer"
2829
+ });
2830
+ const event = events[0];
2831
+ if (!event) {
2832
+ throw new Error("CTX receipt does not contain an EncryptedTransfer event.");
2833
+ }
2834
+ const transferId = event.args.transferId;
2835
+ if (transferId === void 0) {
2836
+ throw new Error("CTX receipt does not contain an EncryptedTransfer event.");
2837
+ }
2838
+ return transferId;
2839
+ }
2840
+
2841
+ // src/actions/access.ts
2842
+ import { encodeFunctionData as encodeFunctionData2, parseEventLogs as parseEventLogs2 } from "viem";
2843
+ async function registerViewerKey(config, publicKey) {
2844
+ const { x, y } = parsePublicKeyCoordinates(publicKey);
2845
+ const data = encodeFunctionData2({
2846
+ abi: confidentialWrapperAbi,
2847
+ functionName: "setViewerPublicKey",
2848
+ args: [{ x, y }]
2849
+ });
2850
+ return config.signer.sendTransaction({ to: config.address, data });
2851
+ }
2852
+ async function authorizeHistoricViewForRange(config, address, fromTimestamp, toTimestamp) {
2853
+ const data = encodeFunctionData2({
2854
+ abi: confidentialWrapperAbi,
2855
+ functionName: "authorizeHistoricViewTimeRange",
2856
+ args: [address, fromTimestamp, toTimestamp]
2857
+ });
2858
+ return config.signer.sendTransaction({ to: config.address, data });
2859
+ }
2860
+ async function authorizeHistoricViewForTransfer(config, address, transferId) {
2861
+ const data = encodeFunctionData2({
2862
+ abi: confidentialWrapperAbi,
2863
+ functionName: "authorizeHistoricViewTransferId",
2864
+ args: [address, transferId]
2865
+ });
2866
+ return config.signer.sendTransaction({ to: config.address, data });
2867
+ }
2868
+ async function revokeHistoricView(config, address) {
2869
+ const data = encodeFunctionData2({
2870
+ abi: confidentialWrapperAbi,
2871
+ functionName: "removeHistoricViewAuth",
2872
+ args: [address]
2873
+ });
2874
+ return config.signer.sendTransaction({ to: config.address, data });
2875
+ }
2876
+ async function requestTransferDecryption(config, ctxHash) {
2877
+ const value = await getCtxOperationCost(config);
2878
+ const receipt = await config.publicClient.waitForTransactionReceipt({ hash: ctxHash });
2879
+ const events = parseEventLogs2({
2880
+ abi: confidentialWrapperAbi,
2881
+ logs: receipt.logs,
2882
+ eventName: "EncryptedTransfer"
2883
+ });
2884
+ const event = events[0];
2885
+ if (!event) {
2886
+ throw new Error("CTX receipt does not contain an EncryptedTransfer event.");
2887
+ }
2888
+ const args = event.args;
2889
+ const { encryptedData, transferId, from, to } = args;
2890
+ if (!encryptedData || transferId === void 0 || !from || !to) {
2891
+ throw new Error("CTX receipt does not contain an EncryptedTransfer event.");
2892
+ }
2893
+ const viewerAddress = await config.publicClient.readContract({
2894
+ address: config.address,
2895
+ abi: confidentialWrapperAbi,
2896
+ functionName: "viewerAddresses",
2897
+ args: [config.signer.address]
2898
+ });
2899
+ const block = await config.publicClient.getBlock({ blockNumber: receipt.blockNumber });
2900
+ const canDecrypt = await config.publicClient.readContract({
2901
+ address: config.address,
2902
+ abi: confidentialWrapperAbi,
2903
+ functionName: "canDecryptHistoricTransfer",
2904
+ args: [viewerAddress, transferId, from, to, block.timestamp]
2905
+ });
2906
+ if (!canDecrypt) {
2907
+ throw new Error("Viewer is not authorized to decrypt this historic transfer.");
2908
+ }
2909
+ const data = encodeFunctionData2({
2910
+ abi: confidentialWrapperAbi,
2911
+ functionName: "requestDecryptHistoricTransferFor",
2912
+ args: [encryptedData, viewerAddress]
2913
+ });
2914
+ return config.signer.sendTransaction({ to: config.address, data, value });
2915
+ }
2916
+
2917
+ export {
2918
+ confidentialWrapperAbi,
2919
+ getCtxBalance,
2920
+ getCtxRawCost,
2921
+ getCtxOperationCost,
2922
+ approve,
2923
+ transfer,
2924
+ wrap,
2925
+ unwrap,
2926
+ decryptTokenBalance,
2927
+ getTransferId,
2928
+ registerViewerKey,
2929
+ authorizeHistoricViewForRange,
2930
+ authorizeHistoricViewForTransfer,
2931
+ revokeHistoricView,
2932
+ requestTransferDecryption
2933
+ };
2934
+ //# sourceMappingURL=chunk-PMT6KSGL.js.map