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