@gitmyabi/oftwrapperdiamond 1.0.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,1307 @@
1
+ import type { Abi, Address, PublicClient, WalletClient, GetContractReturnType } from 'viem';
2
+ import { getContract } from 'viem';
3
+
4
+
5
+ /**
6
+ * IDiamondWritableInternal.FacetCut struct type
7
+ */
8
+ export type IDiamondWritableInternal_FacetCut = {
9
+ target: `0x${string}`;
10
+ action: bigint;
11
+ selectors: `0x${string}`[];
12
+ };
13
+
14
+ /**
15
+ * IDiamondReadable.Facet struct type
16
+ */
17
+ export type IDiamondReadable_Facet = {
18
+ target: `0x${string}`;
19
+ selectors: `0x${string}`[];
20
+ };
21
+ /**
22
+ * OFTWrapperDiamond_json ABI
23
+ *
24
+ * This ABI is typed using viem's type system for full type safety.
25
+ */
26
+ export const OFTWrapperDiamond_jsonAbi = [
27
+ {
28
+ "inputs": [
29
+ {
30
+ "internalType": "address",
31
+ "name": "_collector",
32
+ "type": "address"
33
+ },
34
+ {
35
+ "internalType": "address",
36
+ "name": "_owner",
37
+ "type": "address"
38
+ }
39
+ ],
40
+ "stateMutability": "nonpayable",
41
+ "type": "constructor"
42
+ },
43
+ {
44
+ "inputs": [],
45
+ "name": "DiamondWritable__InvalidInitializationParameters",
46
+ "type": "error"
47
+ },
48
+ {
49
+ "inputs": [],
50
+ "name": "DiamondWritable__RemoveTargetNotZeroAddress",
51
+ "type": "error"
52
+ },
53
+ {
54
+ "inputs": [],
55
+ "name": "DiamondWritable__ReplaceTargetIsIdentical",
56
+ "type": "error"
57
+ },
58
+ {
59
+ "inputs": [],
60
+ "name": "DiamondWritable__SelectorAlreadyAdded",
61
+ "type": "error"
62
+ },
63
+ {
64
+ "inputs": [],
65
+ "name": "DiamondWritable__SelectorIsImmutable",
66
+ "type": "error"
67
+ },
68
+ {
69
+ "inputs": [],
70
+ "name": "DiamondWritable__SelectorNotFound",
71
+ "type": "error"
72
+ },
73
+ {
74
+ "inputs": [],
75
+ "name": "DiamondWritable__SelectorNotSpecified",
76
+ "type": "error"
77
+ },
78
+ {
79
+ "inputs": [],
80
+ "name": "DiamondWritable__TargetHasNoCode",
81
+ "type": "error"
82
+ },
83
+ {
84
+ "inputs": [],
85
+ "name": "ERC165Base__InvalidInterfaceId",
86
+ "type": "error"
87
+ },
88
+ {
89
+ "inputs": [],
90
+ "name": "Ownable__NotOwner",
91
+ "type": "error"
92
+ },
93
+ {
94
+ "inputs": [],
95
+ "name": "Ownable__NotTransitiveOwner",
96
+ "type": "error"
97
+ },
98
+ {
99
+ "inputs": [],
100
+ "name": "Pausable__NotPaused",
101
+ "type": "error"
102
+ },
103
+ {
104
+ "inputs": [],
105
+ "name": "Pausable__Paused",
106
+ "type": "error"
107
+ },
108
+ {
109
+ "inputs": [],
110
+ "name": "Proxy__ImplementationIsNotContract",
111
+ "type": "error"
112
+ },
113
+ {
114
+ "inputs": [],
115
+ "name": "ReentrancyGuard__ReentrantCall",
116
+ "type": "error"
117
+ },
118
+ {
119
+ "inputs": [],
120
+ "name": "SafeOwnable__NotNomineeOwner",
121
+ "type": "error"
122
+ },
123
+ {
124
+ "inputs": [],
125
+ "name": "SafeTransferError",
126
+ "type": "error"
127
+ },
128
+ {
129
+ "inputs": [],
130
+ "name": "SafeTransferNativeError",
131
+ "type": "error"
132
+ },
133
+ {
134
+ "anonymous": false,
135
+ "inputs": [
136
+ {
137
+ "components": [
138
+ {
139
+ "internalType": "address",
140
+ "name": "target",
141
+ "type": "address"
142
+ },
143
+ {
144
+ "internalType": "enum IDiamondWritableInternal.FacetCutAction",
145
+ "name": "action",
146
+ "type": "uint8"
147
+ },
148
+ {
149
+ "internalType": "bytes4[]",
150
+ "name": "selectors",
151
+ "type": "bytes4[]"
152
+ }
153
+ ],
154
+ "indexed": false,
155
+ "internalType": "struct IDiamondWritableInternal.FacetCut[]",
156
+ "name": "facetCuts",
157
+ "type": "tuple[]"
158
+ },
159
+ {
160
+ "indexed": false,
161
+ "internalType": "address",
162
+ "name": "target",
163
+ "type": "address"
164
+ },
165
+ {
166
+ "indexed": false,
167
+ "internalType": "bytes",
168
+ "name": "data",
169
+ "type": "bytes"
170
+ }
171
+ ],
172
+ "name": "DiamondCut",
173
+ "type": "event"
174
+ },
175
+ {
176
+ "anonymous": false,
177
+ "inputs": [
178
+ {
179
+ "indexed": true,
180
+ "internalType": "address",
181
+ "name": "previousOwner",
182
+ "type": "address"
183
+ },
184
+ {
185
+ "indexed": true,
186
+ "internalType": "address",
187
+ "name": "newOwner",
188
+ "type": "address"
189
+ }
190
+ ],
191
+ "name": "OwnershipTransferred",
192
+ "type": "event"
193
+ },
194
+ {
195
+ "anonymous": false,
196
+ "inputs": [
197
+ {
198
+ "indexed": false,
199
+ "internalType": "address",
200
+ "name": "account",
201
+ "type": "address"
202
+ }
203
+ ],
204
+ "name": "Paused",
205
+ "type": "event"
206
+ },
207
+ {
208
+ "anonymous": false,
209
+ "inputs": [
210
+ {
211
+ "indexed": true,
212
+ "internalType": "address",
213
+ "name": "collector",
214
+ "type": "address"
215
+ }
216
+ ],
217
+ "name": "SetCollector",
218
+ "type": "event"
219
+ },
220
+ {
221
+ "anonymous": false,
222
+ "inputs": [
223
+ {
224
+ "indexed": false,
225
+ "internalType": "address",
226
+ "name": "account",
227
+ "type": "address"
228
+ }
229
+ ],
230
+ "name": "Unpaused",
231
+ "type": "event"
232
+ },
233
+ {
234
+ "stateMutability": "payable",
235
+ "type": "fallback"
236
+ },
237
+ {
238
+ "inputs": [],
239
+ "name": "SYSTEM_VERSION_ID",
240
+ "outputs": [
241
+ {
242
+ "internalType": "uint256",
243
+ "name": "",
244
+ "type": "uint256"
245
+ }
246
+ ],
247
+ "stateMutability": "pure",
248
+ "type": "function"
249
+ },
250
+ {
251
+ "inputs": [],
252
+ "name": "acceptOwnership",
253
+ "outputs": [],
254
+ "stateMutability": "nonpayable",
255
+ "type": "function"
256
+ },
257
+ {
258
+ "inputs": [
259
+ {
260
+ "internalType": "address",
261
+ "name": "_tokenAddress",
262
+ "type": "address"
263
+ }
264
+ ],
265
+ "name": "cleanup",
266
+ "outputs": [],
267
+ "stateMutability": "nonpayable",
268
+ "type": "function"
269
+ },
270
+ {
271
+ "inputs": [
272
+ {
273
+ "internalType": "address",
274
+ "name": "_tokenAddress",
275
+ "type": "address"
276
+ },
277
+ {
278
+ "internalType": "uint256",
279
+ "name": "_tokenAmount",
280
+ "type": "uint256"
281
+ }
282
+ ],
283
+ "name": "cleanupWithAmount",
284
+ "outputs": [],
285
+ "stateMutability": "nonpayable",
286
+ "type": "function"
287
+ },
288
+ {
289
+ "inputs": [],
290
+ "name": "collector",
291
+ "outputs": [
292
+ {
293
+ "internalType": "address",
294
+ "name": "",
295
+ "type": "address"
296
+ }
297
+ ],
298
+ "stateMutability": "view",
299
+ "type": "function"
300
+ },
301
+ {
302
+ "inputs": [
303
+ {
304
+ "components": [
305
+ {
306
+ "internalType": "address",
307
+ "name": "target",
308
+ "type": "address"
309
+ },
310
+ {
311
+ "internalType": "enum IDiamondWritableInternal.FacetCutAction",
312
+ "name": "action",
313
+ "type": "uint8"
314
+ },
315
+ {
316
+ "internalType": "bytes4[]",
317
+ "name": "selectors",
318
+ "type": "bytes4[]"
319
+ }
320
+ ],
321
+ "internalType": "struct IDiamondWritableInternal.FacetCut[]",
322
+ "name": "facetCuts",
323
+ "type": "tuple[]"
324
+ },
325
+ {
326
+ "internalType": "address",
327
+ "name": "target",
328
+ "type": "address"
329
+ },
330
+ {
331
+ "internalType": "bytes",
332
+ "name": "data",
333
+ "type": "bytes"
334
+ }
335
+ ],
336
+ "name": "diamondCut",
337
+ "outputs": [],
338
+ "stateMutability": "nonpayable",
339
+ "type": "function"
340
+ },
341
+ {
342
+ "inputs": [
343
+ {
344
+ "internalType": "bytes4",
345
+ "name": "selector",
346
+ "type": "bytes4"
347
+ }
348
+ ],
349
+ "name": "facetAddress",
350
+ "outputs": [
351
+ {
352
+ "internalType": "address",
353
+ "name": "facet",
354
+ "type": "address"
355
+ }
356
+ ],
357
+ "stateMutability": "view",
358
+ "type": "function"
359
+ },
360
+ {
361
+ "inputs": [],
362
+ "name": "facetAddresses",
363
+ "outputs": [
364
+ {
365
+ "internalType": "address[]",
366
+ "name": "addresses",
367
+ "type": "address[]"
368
+ }
369
+ ],
370
+ "stateMutability": "view",
371
+ "type": "function"
372
+ },
373
+ {
374
+ "inputs": [
375
+ {
376
+ "internalType": "address",
377
+ "name": "facet",
378
+ "type": "address"
379
+ }
380
+ ],
381
+ "name": "facetFunctionSelectors",
382
+ "outputs": [
383
+ {
384
+ "internalType": "bytes4[]",
385
+ "name": "selectors",
386
+ "type": "bytes4[]"
387
+ }
388
+ ],
389
+ "stateMutability": "view",
390
+ "type": "function"
391
+ },
392
+ {
393
+ "inputs": [],
394
+ "name": "facets",
395
+ "outputs": [
396
+ {
397
+ "components": [
398
+ {
399
+ "internalType": "address",
400
+ "name": "target",
401
+ "type": "address"
402
+ },
403
+ {
404
+ "internalType": "bytes4[]",
405
+ "name": "selectors",
406
+ "type": "bytes4[]"
407
+ }
408
+ ],
409
+ "internalType": "struct IDiamondReadable.Facet[]",
410
+ "name": "diamondFacets",
411
+ "type": "tuple[]"
412
+ }
413
+ ],
414
+ "stateMutability": "view",
415
+ "type": "function"
416
+ },
417
+ {
418
+ "inputs": [
419
+ {
420
+ "internalType": "address",
421
+ "name": "_newOwner",
422
+ "type": "address"
423
+ }
424
+ ],
425
+ "name": "forceTransferOwnership",
426
+ "outputs": [],
427
+ "stateMutability": "nonpayable",
428
+ "type": "function"
429
+ },
430
+ {
431
+ "inputs": [],
432
+ "name": "getFallbackAddress",
433
+ "outputs": [
434
+ {
435
+ "internalType": "address",
436
+ "name": "fallbackAddress",
437
+ "type": "address"
438
+ }
439
+ ],
440
+ "stateMutability": "view",
441
+ "type": "function"
442
+ },
443
+ {
444
+ "inputs": [],
445
+ "name": "nomineeOwner",
446
+ "outputs": [
447
+ {
448
+ "internalType": "address",
449
+ "name": "",
450
+ "type": "address"
451
+ }
452
+ ],
453
+ "stateMutability": "view",
454
+ "type": "function"
455
+ },
456
+ {
457
+ "inputs": [],
458
+ "name": "owner",
459
+ "outputs": [
460
+ {
461
+ "internalType": "address",
462
+ "name": "",
463
+ "type": "address"
464
+ }
465
+ ],
466
+ "stateMutability": "view",
467
+ "type": "function"
468
+ },
469
+ {
470
+ "inputs": [],
471
+ "name": "pause",
472
+ "outputs": [],
473
+ "stateMutability": "nonpayable",
474
+ "type": "function"
475
+ },
476
+ {
477
+ "inputs": [],
478
+ "name": "paused",
479
+ "outputs": [
480
+ {
481
+ "internalType": "bool",
482
+ "name": "status",
483
+ "type": "bool"
484
+ }
485
+ ],
486
+ "stateMutability": "view",
487
+ "type": "function"
488
+ },
489
+ {
490
+ "inputs": [
491
+ {
492
+ "internalType": "address",
493
+ "name": "_collector",
494
+ "type": "address"
495
+ }
496
+ ],
497
+ "name": "setCollector",
498
+ "outputs": [],
499
+ "stateMutability": "nonpayable",
500
+ "type": "function"
501
+ },
502
+ {
503
+ "inputs": [
504
+ {
505
+ "internalType": "address",
506
+ "name": "fallbackAddress",
507
+ "type": "address"
508
+ }
509
+ ],
510
+ "name": "setFallbackAddress",
511
+ "outputs": [],
512
+ "stateMutability": "nonpayable",
513
+ "type": "function"
514
+ },
515
+ {
516
+ "inputs": [
517
+ {
518
+ "internalType": "bytes4",
519
+ "name": "interfaceId",
520
+ "type": "bytes4"
521
+ }
522
+ ],
523
+ "name": "supportsInterface",
524
+ "outputs": [
525
+ {
526
+ "internalType": "bool",
527
+ "name": "",
528
+ "type": "bool"
529
+ }
530
+ ],
531
+ "stateMutability": "view",
532
+ "type": "function"
533
+ },
534
+ {
535
+ "inputs": [
536
+ {
537
+ "internalType": "address",
538
+ "name": "_tokenAddress",
539
+ "type": "address"
540
+ }
541
+ ],
542
+ "name": "tokenBalance",
543
+ "outputs": [
544
+ {
545
+ "internalType": "uint256",
546
+ "name": "",
547
+ "type": "uint256"
548
+ }
549
+ ],
550
+ "stateMutability": "view",
551
+ "type": "function"
552
+ },
553
+ {
554
+ "inputs": [
555
+ {
556
+ "internalType": "address",
557
+ "name": "account",
558
+ "type": "address"
559
+ }
560
+ ],
561
+ "name": "transferOwnership",
562
+ "outputs": [],
563
+ "stateMutability": "nonpayable",
564
+ "type": "function"
565
+ },
566
+ {
567
+ "inputs": [],
568
+ "name": "unpause",
569
+ "outputs": [],
570
+ "stateMutability": "nonpayable",
571
+ "type": "function"
572
+ },
573
+ {
574
+ "stateMutability": "payable",
575
+ "type": "receive"
576
+ }
577
+ ] as const satisfies Abi;
578
+
579
+ /**
580
+ * Type-safe ABI for OFTWrapperDiamond_json
581
+ */
582
+ export type OFTWrapperDiamond_jsonAbi = typeof OFTWrapperDiamond_jsonAbi;
583
+
584
+ /**
585
+ * Contract instance type for OFTWrapperDiamond_json
586
+ */
587
+ // Use any for contract type to avoid complex viem type issues
588
+ // The runtime behavior is type-safe through viem's ABI typing
589
+ export type OFTWrapperDiamond_jsonContract = any;
590
+
591
+ /**
592
+ * OFTWrapperDiamond_json Contract Class
593
+ *
594
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
595
+ *
596
+ * @example
597
+ * ```typescript
598
+ * import { createPublicClient, createWalletClient, http } from 'viem';
599
+ * import { mainnet } from 'viem/chains';
600
+ * import { OFTWrapperDiamond_json } from 'OFTWrapperDiamond_json';
601
+ *
602
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
603
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
604
+ *
605
+ * const contract = new OFTWrapperDiamond_json('0x...', { publicClient, walletClient });
606
+ *
607
+ * // Read functions
608
+ * const result = await contract.balanceOf('0x...');
609
+ *
610
+ * // Write functions
611
+ * const hash = await contract.transfer('0x...', 1000n);
612
+ *
613
+ * // Simulate transactions (dry-run)
614
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
615
+ * console.log('Gas estimate:', simulation.request.gas);
616
+ *
617
+ * // Watch events
618
+ * const unwatch = contract.watch.Transfer((event) => {
619
+ * console.log('Transfer event:', event);
620
+ * });
621
+ * ```
622
+ */
623
+ export class OFTWrapperDiamond_json {
624
+ private contract: OFTWrapperDiamond_jsonContract;
625
+ private contractAddress: Address;
626
+ private publicClient: PublicClient;
627
+
628
+ constructor(
629
+ address: Address,
630
+ clients: {
631
+ publicClient: PublicClient;
632
+ walletClient?: WalletClient;
633
+ }
634
+ ) {
635
+ this.contractAddress = address;
636
+ this.publicClient = clients.publicClient;
637
+ this.contract = getContract({
638
+ address,
639
+ abi: OFTWrapperDiamond_jsonAbi,
640
+ client: {
641
+ public: clients.publicClient,
642
+ wallet: clients.walletClient,
643
+ },
644
+ });
645
+ }
646
+
647
+ /**
648
+ * Get the contract address
649
+ */
650
+ get address(): Address {
651
+ return this.contractAddress;
652
+ }
653
+
654
+ /**
655
+ * Get the underlying viem contract instance
656
+ */
657
+ getContract(): OFTWrapperDiamond_jsonContract {
658
+ return this.contract;
659
+ }
660
+
661
+ /**
662
+ * SYSTEM_VERSION_ID
663
+ * pure
664
+ */
665
+ async SYSTEM_VERSION_ID(): Promise<bigint> {
666
+ return this.contract.read.SYSTEM_VERSION_ID() as Promise<bigint>;
667
+ }
668
+
669
+ /**
670
+ * collector
671
+ * view
672
+ */
673
+ async collector(): Promise<`0x${string}`> {
674
+ return this.contract.read.collector() as Promise<`0x${string}`>;
675
+ }
676
+
677
+ /**
678
+ * facetAddress
679
+ * view
680
+ */
681
+ async facetAddress(selector: `0x${string}`): Promise<`0x${string}`> {
682
+ return this.contract.read.facetAddress([selector] as const) as Promise<`0x${string}`>;
683
+ }
684
+
685
+ /**
686
+ * facetAddresses
687
+ * view
688
+ */
689
+ async facetAddresses(): Promise<`0x${string}`[]> {
690
+ return this.contract.read.facetAddresses() as Promise<`0x${string}`[]>;
691
+ }
692
+
693
+ /**
694
+ * facetFunctionSelectors
695
+ * view
696
+ */
697
+ async facetFunctionSelectors(facet: `0x${string}`): Promise<`0x${string}`[]> {
698
+ return this.contract.read.facetFunctionSelectors([facet] as const) as Promise<`0x${string}`[]>;
699
+ }
700
+
701
+ /**
702
+ * facets
703
+ * view
704
+ */
705
+ async facets(): Promise<IDiamondReadable_Facet[]> {
706
+ return this.contract.read.facets() as Promise<IDiamondReadable_Facet[]>;
707
+ }
708
+
709
+ /**
710
+ * getFallbackAddress
711
+ * view
712
+ */
713
+ async getFallbackAddress(): Promise<`0x${string}`> {
714
+ return this.contract.read.getFallbackAddress() as Promise<`0x${string}`>;
715
+ }
716
+
717
+ /**
718
+ * nomineeOwner
719
+ * view
720
+ */
721
+ async nomineeOwner(): Promise<`0x${string}`> {
722
+ return this.contract.read.nomineeOwner() as Promise<`0x${string}`>;
723
+ }
724
+
725
+ /**
726
+ * owner
727
+ * view
728
+ */
729
+ async owner(): Promise<`0x${string}`> {
730
+ return this.contract.read.owner() as Promise<`0x${string}`>;
731
+ }
732
+
733
+ /**
734
+ * paused
735
+ * view
736
+ */
737
+ async paused(): Promise<boolean> {
738
+ return this.contract.read.paused() as Promise<boolean>;
739
+ }
740
+
741
+ /**
742
+ * supportsInterface
743
+ * view
744
+ */
745
+ async supportsInterface(interfaceId: `0x${string}`): Promise<boolean> {
746
+ return this.contract.read.supportsInterface([interfaceId] as const) as Promise<boolean>;
747
+ }
748
+
749
+ /**
750
+ * tokenBalance
751
+ * view
752
+ */
753
+ async tokenBalance(_tokenAddress: `0x${string}`): Promise<bigint> {
754
+ return this.contract.read.tokenBalance([_tokenAddress] as const) as Promise<bigint>;
755
+ }
756
+
757
+ /**
758
+ * acceptOwnership
759
+ * nonpayable
760
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
761
+ */
762
+ async acceptOwnership(options?: {
763
+ accessList?: import('viem').AccessList;
764
+ authorizationList?: import('viem').AuthorizationList;
765
+ chain?: import('viem').Chain | null;
766
+ dataSuffix?: `0x${string}`;
767
+ gas?: bigint;
768
+ gasPrice?: bigint;
769
+ maxFeePerGas?: bigint;
770
+ maxPriorityFeePerGas?: bigint;
771
+ nonce?: number;
772
+ value?: bigint;
773
+ }): Promise<`0x${string}`> {
774
+ if (!this.contract.write) {
775
+ throw new Error('Wallet client is required for write operations');
776
+ }
777
+ return this.contract.write.acceptOwnership(options) as Promise<`0x${string}`>;
778
+ }
779
+
780
+ /**
781
+ * cleanup
782
+ * nonpayable
783
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
784
+ */
785
+ async cleanup(_tokenAddress: `0x${string}`, options?: {
786
+ accessList?: import('viem').AccessList;
787
+ authorizationList?: import('viem').AuthorizationList;
788
+ chain?: import('viem').Chain | null;
789
+ dataSuffix?: `0x${string}`;
790
+ gas?: bigint;
791
+ gasPrice?: bigint;
792
+ maxFeePerGas?: bigint;
793
+ maxPriorityFeePerGas?: bigint;
794
+ nonce?: number;
795
+ value?: bigint;
796
+ }): Promise<`0x${string}`> {
797
+ if (!this.contract.write) {
798
+ throw new Error('Wallet client is required for write operations');
799
+ }
800
+ return this.contract.write.cleanup([_tokenAddress] as const, options) as Promise<`0x${string}`>;
801
+ }
802
+
803
+ /**
804
+ * cleanupWithAmount
805
+ * nonpayable
806
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
807
+ */
808
+ async cleanupWithAmount(_tokenAddress: `0x${string}`, _tokenAmount: bigint, options?: {
809
+ accessList?: import('viem').AccessList;
810
+ authorizationList?: import('viem').AuthorizationList;
811
+ chain?: import('viem').Chain | null;
812
+ dataSuffix?: `0x${string}`;
813
+ gas?: bigint;
814
+ gasPrice?: bigint;
815
+ maxFeePerGas?: bigint;
816
+ maxPriorityFeePerGas?: bigint;
817
+ nonce?: number;
818
+ value?: bigint;
819
+ }): Promise<`0x${string}`> {
820
+ if (!this.contract.write) {
821
+ throw new Error('Wallet client is required for write operations');
822
+ }
823
+ return this.contract.write.cleanupWithAmount([_tokenAddress, _tokenAmount] as const, options) as Promise<`0x${string}`>;
824
+ }
825
+
826
+ /**
827
+ * diamondCut
828
+ * nonpayable
829
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
830
+ */
831
+ async diamondCut(facetCuts: IDiamondWritableInternal_FacetCut[], target: `0x${string}`, data: `0x${string}`, options?: {
832
+ accessList?: import('viem').AccessList;
833
+ authorizationList?: import('viem').AuthorizationList;
834
+ chain?: import('viem').Chain | null;
835
+ dataSuffix?: `0x${string}`;
836
+ gas?: bigint;
837
+ gasPrice?: bigint;
838
+ maxFeePerGas?: bigint;
839
+ maxPriorityFeePerGas?: bigint;
840
+ nonce?: number;
841
+ value?: bigint;
842
+ }): Promise<`0x${string}`> {
843
+ if (!this.contract.write) {
844
+ throw new Error('Wallet client is required for write operations');
845
+ }
846
+ return this.contract.write.diamondCut([facetCuts, target, data] as const, options) as Promise<`0x${string}`>;
847
+ }
848
+
849
+ /**
850
+ * forceTransferOwnership
851
+ * nonpayable
852
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
853
+ */
854
+ async forceTransferOwnership(_newOwner: `0x${string}`, options?: {
855
+ accessList?: import('viem').AccessList;
856
+ authorizationList?: import('viem').AuthorizationList;
857
+ chain?: import('viem').Chain | null;
858
+ dataSuffix?: `0x${string}`;
859
+ gas?: bigint;
860
+ gasPrice?: bigint;
861
+ maxFeePerGas?: bigint;
862
+ maxPriorityFeePerGas?: bigint;
863
+ nonce?: number;
864
+ value?: bigint;
865
+ }): Promise<`0x${string}`> {
866
+ if (!this.contract.write) {
867
+ throw new Error('Wallet client is required for write operations');
868
+ }
869
+ return this.contract.write.forceTransferOwnership([_newOwner] as const, options) as Promise<`0x${string}`>;
870
+ }
871
+
872
+ /**
873
+ * pause
874
+ * nonpayable
875
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
876
+ */
877
+ async pause(options?: {
878
+ accessList?: import('viem').AccessList;
879
+ authorizationList?: import('viem').AuthorizationList;
880
+ chain?: import('viem').Chain | null;
881
+ dataSuffix?: `0x${string}`;
882
+ gas?: bigint;
883
+ gasPrice?: bigint;
884
+ maxFeePerGas?: bigint;
885
+ maxPriorityFeePerGas?: bigint;
886
+ nonce?: number;
887
+ value?: bigint;
888
+ }): Promise<`0x${string}`> {
889
+ if (!this.contract.write) {
890
+ throw new Error('Wallet client is required for write operations');
891
+ }
892
+ return this.contract.write.pause(options) as Promise<`0x${string}`>;
893
+ }
894
+
895
+ /**
896
+ * setCollector
897
+ * nonpayable
898
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
899
+ */
900
+ async setCollector(_collector: `0x${string}`, options?: {
901
+ accessList?: import('viem').AccessList;
902
+ authorizationList?: import('viem').AuthorizationList;
903
+ chain?: import('viem').Chain | null;
904
+ dataSuffix?: `0x${string}`;
905
+ gas?: bigint;
906
+ gasPrice?: bigint;
907
+ maxFeePerGas?: bigint;
908
+ maxPriorityFeePerGas?: bigint;
909
+ nonce?: number;
910
+ value?: bigint;
911
+ }): Promise<`0x${string}`> {
912
+ if (!this.contract.write) {
913
+ throw new Error('Wallet client is required for write operations');
914
+ }
915
+ return this.contract.write.setCollector([_collector] as const, options) as Promise<`0x${string}`>;
916
+ }
917
+
918
+ /**
919
+ * setFallbackAddress
920
+ * nonpayable
921
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
922
+ */
923
+ async setFallbackAddress(fallbackAddress: `0x${string}`, options?: {
924
+ accessList?: import('viem').AccessList;
925
+ authorizationList?: import('viem').AuthorizationList;
926
+ chain?: import('viem').Chain | null;
927
+ dataSuffix?: `0x${string}`;
928
+ gas?: bigint;
929
+ gasPrice?: bigint;
930
+ maxFeePerGas?: bigint;
931
+ maxPriorityFeePerGas?: bigint;
932
+ nonce?: number;
933
+ value?: bigint;
934
+ }): Promise<`0x${string}`> {
935
+ if (!this.contract.write) {
936
+ throw new Error('Wallet client is required for write operations');
937
+ }
938
+ return this.contract.write.setFallbackAddress([fallbackAddress] as const, options) as Promise<`0x${string}`>;
939
+ }
940
+
941
+ /**
942
+ * transferOwnership
943
+ * nonpayable
944
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
945
+ */
946
+ async transferOwnership(account: `0x${string}`, options?: {
947
+ accessList?: import('viem').AccessList;
948
+ authorizationList?: import('viem').AuthorizationList;
949
+ chain?: import('viem').Chain | null;
950
+ dataSuffix?: `0x${string}`;
951
+ gas?: bigint;
952
+ gasPrice?: bigint;
953
+ maxFeePerGas?: bigint;
954
+ maxPriorityFeePerGas?: bigint;
955
+ nonce?: number;
956
+ value?: bigint;
957
+ }): Promise<`0x${string}`> {
958
+ if (!this.contract.write) {
959
+ throw new Error('Wallet client is required for write operations');
960
+ }
961
+ return this.contract.write.transferOwnership([account] as const, options) as Promise<`0x${string}`>;
962
+ }
963
+
964
+ /**
965
+ * unpause
966
+ * nonpayable
967
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
968
+ */
969
+ async unpause(options?: {
970
+ accessList?: import('viem').AccessList;
971
+ authorizationList?: import('viem').AuthorizationList;
972
+ chain?: import('viem').Chain | null;
973
+ dataSuffix?: `0x${string}`;
974
+ gas?: bigint;
975
+ gasPrice?: bigint;
976
+ maxFeePerGas?: bigint;
977
+ maxPriorityFeePerGas?: bigint;
978
+ nonce?: number;
979
+ value?: bigint;
980
+ }): Promise<`0x${string}`> {
981
+ if (!this.contract.write) {
982
+ throw new Error('Wallet client is required for write operations');
983
+ }
984
+ return this.contract.write.unpause(options) as Promise<`0x${string}`>;
985
+ }
986
+
987
+
988
+
989
+ /**
990
+ * Simulate contract write operations (dry-run without sending transaction)
991
+ *
992
+ * @example
993
+ * const result = await contract.simulate.transfer('0x...', 1000n);
994
+ * console.log('Gas estimate:', result.request.gas);
995
+ * console.log('Would succeed:', result.result);
996
+ */
997
+ get simulate() {
998
+ const contract = this.contract;
999
+ if (!contract.simulate) {
1000
+ throw new Error('Public client is required for simulation');
1001
+ }
1002
+ return {
1003
+ /**
1004
+ * Simulate acceptOwnership
1005
+ * Returns gas estimate and result without sending transaction
1006
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1007
+ */
1008
+ async acceptOwnership(options?: {
1009
+ accessList?: import('viem').AccessList;
1010
+ authorizationList?: import('viem').AuthorizationList;
1011
+ chain?: import('viem').Chain | null;
1012
+ dataSuffix?: `0x${string}`;
1013
+ gas?: bigint;
1014
+ gasPrice?: bigint;
1015
+ maxFeePerGas?: bigint;
1016
+ maxPriorityFeePerGas?: bigint;
1017
+ nonce?: number;
1018
+ value?: bigint;
1019
+ }): Promise<void> {
1020
+ return contract.simulate.acceptOwnership(options) as Promise<void>;
1021
+ },
1022
+ /**
1023
+ * Simulate cleanup
1024
+ * Returns gas estimate and result without sending transaction
1025
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1026
+ */
1027
+ async cleanup(_tokenAddress: `0x${string}`, options?: {
1028
+ accessList?: import('viem').AccessList;
1029
+ authorizationList?: import('viem').AuthorizationList;
1030
+ chain?: import('viem').Chain | null;
1031
+ dataSuffix?: `0x${string}`;
1032
+ gas?: bigint;
1033
+ gasPrice?: bigint;
1034
+ maxFeePerGas?: bigint;
1035
+ maxPriorityFeePerGas?: bigint;
1036
+ nonce?: number;
1037
+ value?: bigint;
1038
+ }): Promise<void> {
1039
+ return contract.simulate.cleanup([_tokenAddress] as const, options) as Promise<void>;
1040
+ },
1041
+ /**
1042
+ * Simulate cleanupWithAmount
1043
+ * Returns gas estimate and result without sending transaction
1044
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1045
+ */
1046
+ async cleanupWithAmount(_tokenAddress: `0x${string}`, _tokenAmount: bigint, options?: {
1047
+ accessList?: import('viem').AccessList;
1048
+ authorizationList?: import('viem').AuthorizationList;
1049
+ chain?: import('viem').Chain | null;
1050
+ dataSuffix?: `0x${string}`;
1051
+ gas?: bigint;
1052
+ gasPrice?: bigint;
1053
+ maxFeePerGas?: bigint;
1054
+ maxPriorityFeePerGas?: bigint;
1055
+ nonce?: number;
1056
+ value?: bigint;
1057
+ }): Promise<void> {
1058
+ return contract.simulate.cleanupWithAmount([_tokenAddress, _tokenAmount] as const, options) as Promise<void>;
1059
+ },
1060
+ /**
1061
+ * Simulate diamondCut
1062
+ * Returns gas estimate and result without sending transaction
1063
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1064
+ */
1065
+ async diamondCut(facetCuts: IDiamondWritableInternal_FacetCut[], target: `0x${string}`, data: `0x${string}`, options?: {
1066
+ accessList?: import('viem').AccessList;
1067
+ authorizationList?: import('viem').AuthorizationList;
1068
+ chain?: import('viem').Chain | null;
1069
+ dataSuffix?: `0x${string}`;
1070
+ gas?: bigint;
1071
+ gasPrice?: bigint;
1072
+ maxFeePerGas?: bigint;
1073
+ maxPriorityFeePerGas?: bigint;
1074
+ nonce?: number;
1075
+ value?: bigint;
1076
+ }): Promise<void> {
1077
+ return contract.simulate.diamondCut([facetCuts, target, data] as const, options) as Promise<void>;
1078
+ },
1079
+ /**
1080
+ * Simulate forceTransferOwnership
1081
+ * Returns gas estimate and result without sending transaction
1082
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1083
+ */
1084
+ async forceTransferOwnership(_newOwner: `0x${string}`, options?: {
1085
+ accessList?: import('viem').AccessList;
1086
+ authorizationList?: import('viem').AuthorizationList;
1087
+ chain?: import('viem').Chain | null;
1088
+ dataSuffix?: `0x${string}`;
1089
+ gas?: bigint;
1090
+ gasPrice?: bigint;
1091
+ maxFeePerGas?: bigint;
1092
+ maxPriorityFeePerGas?: bigint;
1093
+ nonce?: number;
1094
+ value?: bigint;
1095
+ }): Promise<void> {
1096
+ return contract.simulate.forceTransferOwnership([_newOwner] as const, options) as Promise<void>;
1097
+ },
1098
+ /**
1099
+ * Simulate pause
1100
+ * Returns gas estimate and result without sending transaction
1101
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1102
+ */
1103
+ async pause(options?: {
1104
+ accessList?: import('viem').AccessList;
1105
+ authorizationList?: import('viem').AuthorizationList;
1106
+ chain?: import('viem').Chain | null;
1107
+ dataSuffix?: `0x${string}`;
1108
+ gas?: bigint;
1109
+ gasPrice?: bigint;
1110
+ maxFeePerGas?: bigint;
1111
+ maxPriorityFeePerGas?: bigint;
1112
+ nonce?: number;
1113
+ value?: bigint;
1114
+ }): Promise<void> {
1115
+ return contract.simulate.pause(options) as Promise<void>;
1116
+ },
1117
+ /**
1118
+ * Simulate setCollector
1119
+ * Returns gas estimate and result without sending transaction
1120
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1121
+ */
1122
+ async setCollector(_collector: `0x${string}`, options?: {
1123
+ accessList?: import('viem').AccessList;
1124
+ authorizationList?: import('viem').AuthorizationList;
1125
+ chain?: import('viem').Chain | null;
1126
+ dataSuffix?: `0x${string}`;
1127
+ gas?: bigint;
1128
+ gasPrice?: bigint;
1129
+ maxFeePerGas?: bigint;
1130
+ maxPriorityFeePerGas?: bigint;
1131
+ nonce?: number;
1132
+ value?: bigint;
1133
+ }): Promise<void> {
1134
+ return contract.simulate.setCollector([_collector] as const, options) as Promise<void>;
1135
+ },
1136
+ /**
1137
+ * Simulate setFallbackAddress
1138
+ * Returns gas estimate and result without sending transaction
1139
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1140
+ */
1141
+ async setFallbackAddress(fallbackAddress: `0x${string}`, options?: {
1142
+ accessList?: import('viem').AccessList;
1143
+ authorizationList?: import('viem').AuthorizationList;
1144
+ chain?: import('viem').Chain | null;
1145
+ dataSuffix?: `0x${string}`;
1146
+ gas?: bigint;
1147
+ gasPrice?: bigint;
1148
+ maxFeePerGas?: bigint;
1149
+ maxPriorityFeePerGas?: bigint;
1150
+ nonce?: number;
1151
+ value?: bigint;
1152
+ }): Promise<void> {
1153
+ return contract.simulate.setFallbackAddress([fallbackAddress] as const, options) as Promise<void>;
1154
+ },
1155
+ /**
1156
+ * Simulate transferOwnership
1157
+ * Returns gas estimate and result without sending transaction
1158
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1159
+ */
1160
+ async transferOwnership(account: `0x${string}`, options?: {
1161
+ accessList?: import('viem').AccessList;
1162
+ authorizationList?: import('viem').AuthorizationList;
1163
+ chain?: import('viem').Chain | null;
1164
+ dataSuffix?: `0x${string}`;
1165
+ gas?: bigint;
1166
+ gasPrice?: bigint;
1167
+ maxFeePerGas?: bigint;
1168
+ maxPriorityFeePerGas?: bigint;
1169
+ nonce?: number;
1170
+ value?: bigint;
1171
+ }): Promise<void> {
1172
+ return contract.simulate.transferOwnership([account] as const, options) as Promise<void>;
1173
+ },
1174
+ /**
1175
+ * Simulate unpause
1176
+ * Returns gas estimate and result without sending transaction
1177
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1178
+ */
1179
+ async unpause(options?: {
1180
+ accessList?: import('viem').AccessList;
1181
+ authorizationList?: import('viem').AuthorizationList;
1182
+ chain?: import('viem').Chain | null;
1183
+ dataSuffix?: `0x${string}`;
1184
+ gas?: bigint;
1185
+ gasPrice?: bigint;
1186
+ maxFeePerGas?: bigint;
1187
+ maxPriorityFeePerGas?: bigint;
1188
+ nonce?: number;
1189
+ value?: bigint;
1190
+ }): Promise<void> {
1191
+ return contract.simulate.unpause(options) as Promise<void>;
1192
+ }
1193
+ };
1194
+ }
1195
+
1196
+ /**
1197
+ * Watch contract events
1198
+ *
1199
+ * @example
1200
+ * // Watch all Transfer events
1201
+ * const unwatch = contract.watch.Transfer((event) => {
1202
+ * console.log('Transfer:', event);
1203
+ * });
1204
+ *
1205
+ * // Stop watching
1206
+ * unwatch();
1207
+ */
1208
+ get watch() {
1209
+ return {
1210
+ /**
1211
+ * Watch DiamondCut events
1212
+ * @param callback Function to call when event is emitted
1213
+ * @param filter Optional filter for indexed parameters
1214
+ * @returns Unwatch function to stop listening
1215
+ */
1216
+ DiamondCut: (callback: (event: { facetCuts: IDiamondWritableInternal_FacetCut[]; target: `0x${string}`; data: `0x${string}` }) => void) => {
1217
+ return this.publicClient.watchContractEvent({
1218
+ address: this.contractAddress,
1219
+ abi: OFTWrapperDiamond_jsonAbi,
1220
+ eventName: 'DiamondCut',
1221
+
1222
+ onLogs: (logs: any[]) => {
1223
+ logs.forEach((log: any) => {
1224
+ callback(log.args as any);
1225
+ });
1226
+ },
1227
+ }) as () => void;
1228
+ },
1229
+ /**
1230
+ * Watch OwnershipTransferred events
1231
+ * @param callback Function to call when event is emitted
1232
+ * @param filter Optional filter for indexed parameters
1233
+ * @returns Unwatch function to stop listening
1234
+ */
1235
+ OwnershipTransferred: (callback: (event: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => void, filter?: { previousOwner: `0x${string}`; newOwner: `0x${string}` }) => {
1236
+ return this.publicClient.watchContractEvent({
1237
+ address: this.contractAddress,
1238
+ abi: OFTWrapperDiamond_jsonAbi,
1239
+ eventName: 'OwnershipTransferred',
1240
+ args: filter,
1241
+ onLogs: (logs: any[]) => {
1242
+ logs.forEach((log: any) => {
1243
+ callback(log.args as any);
1244
+ });
1245
+ },
1246
+ }) as () => void;
1247
+ },
1248
+ /**
1249
+ * Watch Paused events
1250
+ * @param callback Function to call when event is emitted
1251
+ * @param filter Optional filter for indexed parameters
1252
+ * @returns Unwatch function to stop listening
1253
+ */
1254
+ Paused: (callback: (event: { account: `0x${string}` }) => void) => {
1255
+ return this.publicClient.watchContractEvent({
1256
+ address: this.contractAddress,
1257
+ abi: OFTWrapperDiamond_jsonAbi,
1258
+ eventName: 'Paused',
1259
+
1260
+ onLogs: (logs: any[]) => {
1261
+ logs.forEach((log: any) => {
1262
+ callback(log.args as any);
1263
+ });
1264
+ },
1265
+ }) as () => void;
1266
+ },
1267
+ /**
1268
+ * Watch SetCollector events
1269
+ * @param callback Function to call when event is emitted
1270
+ * @param filter Optional filter for indexed parameters
1271
+ * @returns Unwatch function to stop listening
1272
+ */
1273
+ SetCollector: (callback: (event: { collector: `0x${string}` }) => void, filter?: { collector: `0x${string}` }) => {
1274
+ return this.publicClient.watchContractEvent({
1275
+ address: this.contractAddress,
1276
+ abi: OFTWrapperDiamond_jsonAbi,
1277
+ eventName: 'SetCollector',
1278
+ args: filter,
1279
+ onLogs: (logs: any[]) => {
1280
+ logs.forEach((log: any) => {
1281
+ callback(log.args as any);
1282
+ });
1283
+ },
1284
+ }) as () => void;
1285
+ },
1286
+ /**
1287
+ * Watch Unpaused events
1288
+ * @param callback Function to call when event is emitted
1289
+ * @param filter Optional filter for indexed parameters
1290
+ * @returns Unwatch function to stop listening
1291
+ */
1292
+ Unpaused: (callback: (event: { account: `0x${string}` }) => void) => {
1293
+ return this.publicClient.watchContractEvent({
1294
+ address: this.contractAddress,
1295
+ abi: OFTWrapperDiamond_jsonAbi,
1296
+ eventName: 'Unpaused',
1297
+
1298
+ onLogs: (logs: any[]) => {
1299
+ logs.forEach((log: any) => {
1300
+ callback(log.args as any);
1301
+ });
1302
+ },
1303
+ }) as () => void;
1304
+ }
1305
+ };
1306
+ }
1307
+ }