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

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