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