@skalenetwork/privacy-sdk 0.1.0-develop.0

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