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