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