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