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