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