@gitmyabi/usd 1.0.1 → 1.0.3

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