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