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