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