@gitmyabi/dot 1.0.1 → 1.0.2

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.
@@ -1,785 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Token_json = exports.Token_jsonAbi = void 0;
4
- const viem_1 = require("viem");
5
- /**
6
- * Token_json ABI
7
- *
8
- * This ABI is typed using viem's type system for full type safety.
9
- */
10
- exports.Token_jsonAbi = [
11
- {
12
- "inputs": [
13
- {
14
- "internalType": "string",
15
- "name": "_name",
16
- "type": "string"
17
- },
18
- {
19
- "internalType": "string",
20
- "name": "_symbol",
21
- "type": "string"
22
- },
23
- {
24
- "internalType": "uint8",
25
- "name": "_decimals",
26
- "type": "uint8"
27
- }
28
- ],
29
- "stateMutability": "nonpayable",
30
- "type": "constructor"
31
- },
32
- {
33
- "inputs": [
34
- {
35
- "internalType": "address",
36
- "name": "spender",
37
- "type": "address"
38
- },
39
- {
40
- "internalType": "uint256",
41
- "name": "allowance",
42
- "type": "uint256"
43
- },
44
- {
45
- "internalType": "uint256",
46
- "name": "needed",
47
- "type": "uint256"
48
- }
49
- ],
50
- "name": "InsufficientAllowance",
51
- "type": "error"
52
- },
53
- {
54
- "inputs": [
55
- {
56
- "internalType": "address",
57
- "name": "sender",
58
- "type": "address"
59
- },
60
- {
61
- "internalType": "uint256",
62
- "name": "balance",
63
- "type": "uint256"
64
- },
65
- {
66
- "internalType": "uint256",
67
- "name": "needed",
68
- "type": "uint256"
69
- }
70
- ],
71
- "name": "InsufficientBalance",
72
- "type": "error"
73
- },
74
- {
75
- "inputs": [
76
- {
77
- "internalType": "address",
78
- "name": "",
79
- "type": "address"
80
- }
81
- ],
82
- "name": "InvalidApprover",
83
- "type": "error"
84
- },
85
- {
86
- "inputs": [
87
- {
88
- "internalType": "address",
89
- "name": "",
90
- "type": "address"
91
- }
92
- ],
93
- "name": "InvalidReceiver",
94
- "type": "error"
95
- },
96
- {
97
- "inputs": [
98
- {
99
- "internalType": "address",
100
- "name": "",
101
- "type": "address"
102
- }
103
- ],
104
- "name": "InvalidSender",
105
- "type": "error"
106
- },
107
- {
108
- "inputs": [],
109
- "name": "InvalidSignature",
110
- "type": "error"
111
- },
112
- {
113
- "inputs": [
114
- {
115
- "internalType": "address",
116
- "name": "",
117
- "type": "address"
118
- }
119
- ],
120
- "name": "InvalidSpender",
121
- "type": "error"
122
- },
123
- {
124
- "inputs": [],
125
- "name": "PermitExpired",
126
- "type": "error"
127
- },
128
- {
129
- "inputs": [],
130
- "name": "Unauthorized",
131
- "type": "error"
132
- },
133
- {
134
- "anonymous": false,
135
- "inputs": [
136
- {
137
- "indexed": true,
138
- "internalType": "address",
139
- "name": "owner",
140
- "type": "address"
141
- },
142
- {
143
- "indexed": true,
144
- "internalType": "address",
145
- "name": "spender",
146
- "type": "address"
147
- },
148
- {
149
- "indexed": false,
150
- "internalType": "uint256",
151
- "name": "value",
152
- "type": "uint256"
153
- }
154
- ],
155
- "name": "Approval",
156
- "type": "event"
157
- },
158
- {
159
- "anonymous": false,
160
- "inputs": [
161
- {
162
- "indexed": true,
163
- "internalType": "address",
164
- "name": "from",
165
- "type": "address"
166
- },
167
- {
168
- "indexed": true,
169
- "internalType": "address",
170
- "name": "to",
171
- "type": "address"
172
- },
173
- {
174
- "indexed": false,
175
- "internalType": "uint256",
176
- "name": "value",
177
- "type": "uint256"
178
- }
179
- ],
180
- "name": "Transfer",
181
- "type": "event"
182
- },
183
- {
184
- "inputs": [],
185
- "name": "DOMAIN_SEPARATOR",
186
- "outputs": [
187
- {
188
- "internalType": "bytes32",
189
- "name": "",
190
- "type": "bytes32"
191
- }
192
- ],
193
- "stateMutability": "view",
194
- "type": "function"
195
- },
196
- {
197
- "inputs": [
198
- {
199
- "internalType": "address",
200
- "name": "_owner",
201
- "type": "address"
202
- },
203
- {
204
- "internalType": "address",
205
- "name": "spender",
206
- "type": "address"
207
- }
208
- ],
209
- "name": "allowance",
210
- "outputs": [
211
- {
212
- "internalType": "uint256",
213
- "name": "",
214
- "type": "uint256"
215
- }
216
- ],
217
- "stateMutability": "view",
218
- "type": "function"
219
- },
220
- {
221
- "inputs": [
222
- {
223
- "internalType": "address",
224
- "name": "spender",
225
- "type": "address"
226
- },
227
- {
228
- "internalType": "uint256",
229
- "name": "amount",
230
- "type": "uint256"
231
- }
232
- ],
233
- "name": "approve",
234
- "outputs": [
235
- {
236
- "internalType": "bool",
237
- "name": "",
238
- "type": "bool"
239
- }
240
- ],
241
- "stateMutability": "nonpayable",
242
- "type": "function"
243
- },
244
- {
245
- "inputs": [
246
- {
247
- "internalType": "address",
248
- "name": "account",
249
- "type": "address"
250
- }
251
- ],
252
- "name": "balanceOf",
253
- "outputs": [
254
- {
255
- "internalType": "uint256",
256
- "name": "",
257
- "type": "uint256"
258
- }
259
- ],
260
- "stateMutability": "view",
261
- "type": "function"
262
- },
263
- {
264
- "inputs": [
265
- {
266
- "internalType": "address",
267
- "name": "account",
268
- "type": "address"
269
- },
270
- {
271
- "internalType": "uint256",
272
- "name": "amount",
273
- "type": "uint256"
274
- }
275
- ],
276
- "name": "burn",
277
- "outputs": [],
278
- "stateMutability": "nonpayable",
279
- "type": "function"
280
- },
281
- {
282
- "inputs": [],
283
- "name": "decimals",
284
- "outputs": [
285
- {
286
- "internalType": "uint8",
287
- "name": "",
288
- "type": "uint8"
289
- }
290
- ],
291
- "stateMutability": "view",
292
- "type": "function"
293
- },
294
- {
295
- "inputs": [],
296
- "name": "gateway",
297
- "outputs": [
298
- {
299
- "internalType": "address",
300
- "name": "",
301
- "type": "address"
302
- }
303
- ],
304
- "stateMutability": "view",
305
- "type": "function"
306
- },
307
- {
308
- "inputs": [
309
- {
310
- "internalType": "address",
311
- "name": "account",
312
- "type": "address"
313
- },
314
- {
315
- "internalType": "uint256",
316
- "name": "amount",
317
- "type": "uint256"
318
- }
319
- ],
320
- "name": "mint",
321
- "outputs": [],
322
- "stateMutability": "nonpayable",
323
- "type": "function"
324
- },
325
- {
326
- "inputs": [],
327
- "name": "name",
328
- "outputs": [
329
- {
330
- "internalType": "string",
331
- "name": "",
332
- "type": "string"
333
- }
334
- ],
335
- "stateMutability": "view",
336
- "type": "function"
337
- },
338
- {
339
- "inputs": [
340
- {
341
- "internalType": "address",
342
- "name": "account",
343
- "type": "address"
344
- }
345
- ],
346
- "name": "nonces",
347
- "outputs": [
348
- {
349
- "internalType": "uint256",
350
- "name": "",
351
- "type": "uint256"
352
- }
353
- ],
354
- "stateMutability": "view",
355
- "type": "function"
356
- },
357
- {
358
- "inputs": [
359
- {
360
- "internalType": "address",
361
- "name": "issuer",
362
- "type": "address"
363
- },
364
- {
365
- "internalType": "address",
366
- "name": "spender",
367
- "type": "address"
368
- },
369
- {
370
- "internalType": "uint256",
371
- "name": "value",
372
- "type": "uint256"
373
- },
374
- {
375
- "internalType": "uint256",
376
- "name": "deadline",
377
- "type": "uint256"
378
- },
379
- {
380
- "internalType": "uint8",
381
- "name": "v",
382
- "type": "uint8"
383
- },
384
- {
385
- "internalType": "bytes32",
386
- "name": "r",
387
- "type": "bytes32"
388
- },
389
- {
390
- "internalType": "bytes32",
391
- "name": "s",
392
- "type": "bytes32"
393
- }
394
- ],
395
- "name": "permit",
396
- "outputs": [],
397
- "stateMutability": "nonpayable",
398
- "type": "function"
399
- },
400
- {
401
- "inputs": [],
402
- "name": "symbol",
403
- "outputs": [
404
- {
405
- "internalType": "string",
406
- "name": "",
407
- "type": "string"
408
- }
409
- ],
410
- "stateMutability": "view",
411
- "type": "function"
412
- },
413
- {
414
- "inputs": [],
415
- "name": "totalSupply",
416
- "outputs": [
417
- {
418
- "internalType": "uint256",
419
- "name": "",
420
- "type": "uint256"
421
- }
422
- ],
423
- "stateMutability": "view",
424
- "type": "function"
425
- },
426
- {
427
- "inputs": [
428
- {
429
- "internalType": "address",
430
- "name": "recipient",
431
- "type": "address"
432
- },
433
- {
434
- "internalType": "uint256",
435
- "name": "amount",
436
- "type": "uint256"
437
- }
438
- ],
439
- "name": "transfer",
440
- "outputs": [
441
- {
442
- "internalType": "bool",
443
- "name": "",
444
- "type": "bool"
445
- }
446
- ],
447
- "stateMutability": "nonpayable",
448
- "type": "function"
449
- },
450
- {
451
- "inputs": [
452
- {
453
- "internalType": "address",
454
- "name": "sender",
455
- "type": "address"
456
- },
457
- {
458
- "internalType": "address",
459
- "name": "recipient",
460
- "type": "address"
461
- },
462
- {
463
- "internalType": "uint256",
464
- "name": "amount",
465
- "type": "uint256"
466
- }
467
- ],
468
- "name": "transferFrom",
469
- "outputs": [
470
- {
471
- "internalType": "bool",
472
- "name": "",
473
- "type": "bool"
474
- }
475
- ],
476
- "stateMutability": "nonpayable",
477
- "type": "function"
478
- }
479
- ];
480
- /**
481
- * Token_json Contract Class
482
- *
483
- * Provides a class-based API similar to TypeChain for interacting with the contract.
484
- *
485
- * @example
486
- * ```typescript
487
- * import { createPublicClient, createWalletClient, http } from 'viem';
488
- * import { mainnet } from 'viem/chains';
489
- * import { Token_json } from 'Token_json';
490
- *
491
- * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
492
- * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
493
- *
494
- * const contract = new Token_json('0x...', { publicClient, walletClient });
495
- *
496
- * // Read functions
497
- * const result = await contract.balanceOf('0x...');
498
- *
499
- * // Write functions
500
- * const hash = await contract.transfer('0x...', 1000n);
501
- *
502
- * // Simulate transactions (dry-run)
503
- * const simulation = await contract.simulate.transfer('0x...', 1000n);
504
- * console.log('Gas estimate:', simulation.request.gas);
505
- *
506
- * // Watch events
507
- * const unwatch = contract.watch.Transfer((event) => {
508
- * console.log('Transfer event:', event);
509
- * });
510
- * ```
511
- */
512
- class Token_json {
513
- constructor(address, clients) {
514
- this.contractAddress = address;
515
- this.publicClient = clients.publicClient;
516
- this.contract = (0, viem_1.getContract)({
517
- address,
518
- abi: exports.Token_jsonAbi,
519
- client: {
520
- public: clients.publicClient,
521
- wallet: clients.walletClient,
522
- },
523
- });
524
- }
525
- /**
526
- * Get the contract address
527
- */
528
- get address() {
529
- return this.contractAddress;
530
- }
531
- /**
532
- * Get the underlying viem contract instance
533
- */
534
- getContract() {
535
- return this.contract;
536
- }
537
- /**
538
- * DOMAIN_SEPARATOR
539
- * view
540
- */
541
- async DOMAIN_SEPARATOR() {
542
- return this.contract.read.DOMAIN_SEPARATOR();
543
- }
544
- /**
545
- * allowance
546
- * view
547
- */
548
- async allowance(_owner, spender) {
549
- return this.contract.read.allowance([_owner, spender]);
550
- }
551
- /**
552
- * balanceOf
553
- * view
554
- */
555
- async balanceOf(account) {
556
- return this.contract.read.balanceOf([account]);
557
- }
558
- /**
559
- * decimals
560
- * view
561
- */
562
- async decimals() {
563
- return this.contract.read.decimals();
564
- }
565
- /**
566
- * gateway
567
- * view
568
- */
569
- async gateway() {
570
- return this.contract.read.gateway();
571
- }
572
- /**
573
- * name
574
- * view
575
- */
576
- async name() {
577
- return this.contract.read.name();
578
- }
579
- /**
580
- * nonces
581
- * view
582
- */
583
- async nonces(account) {
584
- return this.contract.read.nonces([account]);
585
- }
586
- /**
587
- * symbol
588
- * view
589
- */
590
- async symbol() {
591
- return this.contract.read.symbol();
592
- }
593
- /**
594
- * totalSupply
595
- * view
596
- */
597
- async totalSupply() {
598
- return this.contract.read.totalSupply();
599
- }
600
- /**
601
- * approve
602
- * nonpayable
603
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
604
- */
605
- async approve(spender, amount, options) {
606
- if (!this.contract.write) {
607
- throw new Error('Wallet client is required for write operations');
608
- }
609
- return this.contract.write.approve([spender, amount], options);
610
- }
611
- /**
612
- * burn
613
- * nonpayable
614
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
615
- */
616
- async burn(account, amount, options) {
617
- if (!this.contract.write) {
618
- throw new Error('Wallet client is required for write operations');
619
- }
620
- return this.contract.write.burn([account, amount], options);
621
- }
622
- /**
623
- * mint
624
- * nonpayable
625
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
626
- */
627
- async mint(account, amount, options) {
628
- if (!this.contract.write) {
629
- throw new Error('Wallet client is required for write operations');
630
- }
631
- return this.contract.write.mint([account, amount], options);
632
- }
633
- /**
634
- * permit
635
- * nonpayable
636
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
637
- */
638
- async permit(issuer, spender, value, deadline, v, r, s, options) {
639
- if (!this.contract.write) {
640
- throw new Error('Wallet client is required for write operations');
641
- }
642
- return this.contract.write.permit([issuer, spender, value, deadline, v, r, s], options);
643
- }
644
- /**
645
- * transfer
646
- * nonpayable
647
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
648
- */
649
- async transfer(recipient, amount, options) {
650
- if (!this.contract.write) {
651
- throw new Error('Wallet client is required for write operations');
652
- }
653
- return this.contract.write.transfer([recipient, amount], options);
654
- }
655
- /**
656
- * transferFrom
657
- * nonpayable
658
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
659
- */
660
- async transferFrom(sender, recipient, amount, options) {
661
- if (!this.contract.write) {
662
- throw new Error('Wallet client is required for write operations');
663
- }
664
- return this.contract.write.transferFrom([sender, recipient, amount], options);
665
- }
666
- /**
667
- * Simulate contract write operations (dry-run without sending transaction)
668
- *
669
- * @example
670
- * const result = await contract.simulate.transfer('0x...', 1000n);
671
- * console.log('Gas estimate:', result.request.gas);
672
- * console.log('Would succeed:', result.result);
673
- */
674
- get simulate() {
675
- const contract = this.contract;
676
- if (!contract.simulate) {
677
- throw new Error('Public client is required for simulation');
678
- }
679
- return {
680
- /**
681
- * Simulate approve
682
- * Returns gas estimate and result without sending transaction
683
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
684
- */
685
- async approve(spender, amount, options) {
686
- return contract.simulate.approve([spender, amount], options);
687
- },
688
- /**
689
- * Simulate burn
690
- * Returns gas estimate and result without sending transaction
691
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
692
- */
693
- async burn(account, amount, options) {
694
- return contract.simulate.burn([account, amount], options);
695
- },
696
- /**
697
- * Simulate mint
698
- * Returns gas estimate and result without sending transaction
699
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
700
- */
701
- async mint(account, amount, options) {
702
- return contract.simulate.mint([account, amount], options);
703
- },
704
- /**
705
- * Simulate permit
706
- * Returns gas estimate and result without sending transaction
707
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
708
- */
709
- async permit(issuer, spender, value, deadline, v, r, s, options) {
710
- return contract.simulate.permit([issuer, spender, value, deadline, v, r, s], options);
711
- },
712
- /**
713
- * Simulate transfer
714
- * Returns gas estimate and result without sending transaction
715
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
716
- */
717
- async transfer(recipient, amount, options) {
718
- return contract.simulate.transfer([recipient, amount], options);
719
- },
720
- /**
721
- * Simulate transferFrom
722
- * Returns gas estimate and result without sending transaction
723
- * @param options Optional transaction parameters (value, gas, nonce, etc.)
724
- */
725
- async transferFrom(sender, recipient, amount, options) {
726
- return contract.simulate.transferFrom([sender, recipient, amount], options);
727
- }
728
- };
729
- }
730
- /**
731
- * Watch contract events
732
- *
733
- * @example
734
- * // Watch all Transfer events
735
- * const unwatch = contract.watch.Transfer((event) => {
736
- * console.log('Transfer:', event);
737
- * });
738
- *
739
- * // Stop watching
740
- * unwatch();
741
- */
742
- get watch() {
743
- return {
744
- /**
745
- * Watch Approval events
746
- * @param callback Function to call when event is emitted
747
- * @param filter Optional filter for indexed parameters
748
- * @returns Unwatch function to stop listening
749
- */
750
- Approval: (callback, filter) => {
751
- return this.publicClient.watchContractEvent({
752
- address: this.contractAddress,
753
- abi: exports.Token_jsonAbi,
754
- eventName: 'Approval',
755
- args: filter,
756
- onLogs: (logs) => {
757
- logs.forEach((log) => {
758
- callback(log.args);
759
- });
760
- },
761
- });
762
- },
763
- /**
764
- * Watch Transfer events
765
- * @param callback Function to call when event is emitted
766
- * @param filter Optional filter for indexed parameters
767
- * @returns Unwatch function to stop listening
768
- */
769
- Transfer: (callback, filter) => {
770
- return this.publicClient.watchContractEvent({
771
- address: this.contractAddress,
772
- abi: exports.Token_jsonAbi,
773
- eventName: 'Transfer',
774
- args: filter,
775
- onLogs: (logs) => {
776
- logs.forEach((log) => {
777
- callback(log.args);
778
- });
779
- },
780
- });
781
- }
782
- };
783
- }
784
- }
785
- exports.Token_json = Token_json;