@gitmyabi/joyso 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,1323 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Joyso_json = exports.Joyso_jsonAbi = void 0;
4
+ const viem_1 = require("viem");
5
+ /**
6
+ * Joyso_json ABI
7
+ *
8
+ * This ABI is typed using viem's type system for full type safety.
9
+ */
10
+ exports.Joyso_jsonAbi = [
11
+ {
12
+ "constant": false,
13
+ "inputs": [
14
+ {
15
+ "name": "inputs",
16
+ "type": "uint256[]"
17
+ }
18
+ ],
19
+ "name": "matchTokenOrderByAdmin_k44j",
20
+ "outputs": [],
21
+ "payable": false,
22
+ "stateMutability": "nonpayable",
23
+ "type": "function"
24
+ },
25
+ {
26
+ "constant": false,
27
+ "inputs": [
28
+ {
29
+ "name": "inputs",
30
+ "type": "uint256[]"
31
+ }
32
+ ],
33
+ "name": "matchByAdmin_TwH36",
34
+ "outputs": [],
35
+ "payable": false,
36
+ "stateMutability": "nonpayable",
37
+ "type": "function"
38
+ },
39
+ {
40
+ "constant": false,
41
+ "inputs": [
42
+ {
43
+ "name": "inputs",
44
+ "type": "uint256[]"
45
+ }
46
+ ],
47
+ "name": "withdrawByAdmin_Unau",
48
+ "outputs": [],
49
+ "payable": false,
50
+ "stateMutability": "nonpayable",
51
+ "type": "function"
52
+ },
53
+ {
54
+ "constant": false,
55
+ "inputs": [
56
+ {
57
+ "name": "inputs",
58
+ "type": "uint256[]"
59
+ }
60
+ ],
61
+ "name": "migrateByAdmin_DQV",
62
+ "outputs": [],
63
+ "payable": false,
64
+ "stateMutability": "nonpayable",
65
+ "type": "function"
66
+ },
67
+ {
68
+ "constant": false,
69
+ "inputs": [
70
+ {
71
+ "name": "tokenAddress",
72
+ "type": "address"
73
+ },
74
+ {
75
+ "name": "index",
76
+ "type": "uint256"
77
+ }
78
+ ],
79
+ "name": "registerToken",
80
+ "outputs": [],
81
+ "payable": false,
82
+ "stateMutability": "nonpayable",
83
+ "type": "function"
84
+ },
85
+ {
86
+ "constant": true,
87
+ "inputs": [],
88
+ "name": "userCount",
89
+ "outputs": [
90
+ {
91
+ "name": "",
92
+ "type": "uint256"
93
+ }
94
+ ],
95
+ "payable": false,
96
+ "stateMutability": "view",
97
+ "type": "function"
98
+ },
99
+ {
100
+ "constant": false,
101
+ "inputs": [
102
+ {
103
+ "name": "token",
104
+ "type": "address"
105
+ },
106
+ {
107
+ "name": "account",
108
+ "type": "address"
109
+ },
110
+ {
111
+ "name": "amount",
112
+ "type": "uint256"
113
+ }
114
+ ],
115
+ "name": "transferForAdmin",
116
+ "outputs": [],
117
+ "payable": false,
118
+ "stateMutability": "nonpayable",
119
+ "type": "function"
120
+ },
121
+ {
122
+ "constant": false,
123
+ "inputs": [
124
+ {
125
+ "name": "admin",
126
+ "type": "address"
127
+ },
128
+ {
129
+ "name": "isAdd",
130
+ "type": "bool"
131
+ }
132
+ ],
133
+ "name": "addToAdmin",
134
+ "outputs": [],
135
+ "payable": false,
136
+ "stateMutability": "nonpayable",
137
+ "type": "function"
138
+ },
139
+ {
140
+ "constant": true,
141
+ "inputs": [],
142
+ "name": "joysoWallet",
143
+ "outputs": [
144
+ {
145
+ "name": "",
146
+ "type": "address"
147
+ }
148
+ ],
149
+ "payable": false,
150
+ "stateMutability": "view",
151
+ "type": "function"
152
+ },
153
+ {
154
+ "constant": true,
155
+ "inputs": [
156
+ {
157
+ "name": "",
158
+ "type": "address"
159
+ }
160
+ ],
161
+ "name": "isAdmin",
162
+ "outputs": [
163
+ {
164
+ "name": "",
165
+ "type": "bool"
166
+ }
167
+ ],
168
+ "payable": false,
169
+ "stateMutability": "view",
170
+ "type": "function"
171
+ },
172
+ {
173
+ "constant": true,
174
+ "inputs": [
175
+ {
176
+ "name": "",
177
+ "type": "address"
178
+ }
179
+ ],
180
+ "name": "userNonce",
181
+ "outputs": [
182
+ {
183
+ "name": "",
184
+ "type": "uint256"
185
+ }
186
+ ],
187
+ "payable": false,
188
+ "stateMutability": "view",
189
+ "type": "function"
190
+ },
191
+ {
192
+ "constant": false,
193
+ "inputs": [
194
+ {
195
+ "name": "token",
196
+ "type": "address"
197
+ },
198
+ {
199
+ "name": "amount",
200
+ "type": "uint256"
201
+ }
202
+ ],
203
+ "name": "depositToken",
204
+ "outputs": [],
205
+ "payable": false,
206
+ "stateMutability": "nonpayable",
207
+ "type": "function"
208
+ },
209
+ {
210
+ "constant": true,
211
+ "inputs": [],
212
+ "name": "lockPeriod",
213
+ "outputs": [
214
+ {
215
+ "name": "",
216
+ "type": "uint256"
217
+ }
218
+ ],
219
+ "payable": false,
220
+ "stateMutability": "view",
221
+ "type": "function"
222
+ },
223
+ {
224
+ "constant": true,
225
+ "inputs": [
226
+ {
227
+ "name": "",
228
+ "type": "bytes32"
229
+ }
230
+ ],
231
+ "name": "usedHash",
232
+ "outputs": [
233
+ {
234
+ "name": "",
235
+ "type": "bool"
236
+ }
237
+ ],
238
+ "payable": false,
239
+ "stateMutability": "view",
240
+ "type": "function"
241
+ },
242
+ {
243
+ "constant": true,
244
+ "inputs": [
245
+ {
246
+ "name": "",
247
+ "type": "address"
248
+ }
249
+ ],
250
+ "name": "userLock",
251
+ "outputs": [
252
+ {
253
+ "name": "",
254
+ "type": "uint256"
255
+ }
256
+ ],
257
+ "payable": false,
258
+ "stateMutability": "view",
259
+ "type": "function"
260
+ },
261
+ {
262
+ "constant": false,
263
+ "inputs": [
264
+ {
265
+ "name": "token",
266
+ "type": "address"
267
+ }
268
+ ],
269
+ "name": "collectFee",
270
+ "outputs": [],
271
+ "payable": false,
272
+ "stateMutability": "nonpayable",
273
+ "type": "function"
274
+ },
275
+ {
276
+ "constant": false,
277
+ "inputs": [],
278
+ "name": "unlockMe",
279
+ "outputs": [],
280
+ "payable": false,
281
+ "stateMutability": "nonpayable",
282
+ "type": "function"
283
+ },
284
+ {
285
+ "constant": true,
286
+ "inputs": [],
287
+ "name": "owner",
288
+ "outputs": [
289
+ {
290
+ "name": "",
291
+ "type": "address"
292
+ }
293
+ ],
294
+ "payable": false,
295
+ "stateMutability": "view",
296
+ "type": "function"
297
+ },
298
+ {
299
+ "constant": true,
300
+ "inputs": [
301
+ {
302
+ "name": "",
303
+ "type": "uint256"
304
+ }
305
+ ],
306
+ "name": "userId2Address",
307
+ "outputs": [
308
+ {
309
+ "name": "",
310
+ "type": "address"
311
+ }
312
+ ],
313
+ "payable": false,
314
+ "stateMutability": "view",
315
+ "type": "function"
316
+ },
317
+ {
318
+ "constant": false,
319
+ "inputs": [
320
+ {
321
+ "name": "enabled",
322
+ "type": "bool"
323
+ }
324
+ ],
325
+ "name": "setTradeEventEnabled",
326
+ "outputs": [],
327
+ "payable": false,
328
+ "stateMutability": "nonpayable",
329
+ "type": "function"
330
+ },
331
+ {
332
+ "constant": false,
333
+ "inputs": [],
334
+ "name": "depositEther",
335
+ "outputs": [],
336
+ "payable": true,
337
+ "stateMutability": "payable",
338
+ "type": "function"
339
+ },
340
+ {
341
+ "constant": true,
342
+ "inputs": [],
343
+ "name": "joyToken",
344
+ "outputs": [
345
+ {
346
+ "name": "",
347
+ "type": "address"
348
+ }
349
+ ],
350
+ "payable": false,
351
+ "stateMutability": "view",
352
+ "type": "function"
353
+ },
354
+ {
355
+ "constant": false,
356
+ "inputs": [
357
+ {
358
+ "name": "periodInDays",
359
+ "type": "uint256"
360
+ }
361
+ ],
362
+ "name": "changeLockPeriod",
363
+ "outputs": [],
364
+ "payable": false,
365
+ "stateMutability": "nonpayable",
366
+ "type": "function"
367
+ },
368
+ {
369
+ "constant": true,
370
+ "inputs": [
371
+ {
372
+ "name": "",
373
+ "type": "address"
374
+ }
375
+ ],
376
+ "name": "tokenAddress2Id",
377
+ "outputs": [
378
+ {
379
+ "name": "",
380
+ "type": "uint256"
381
+ }
382
+ ],
383
+ "payable": false,
384
+ "stateMutability": "view",
385
+ "type": "function"
386
+ },
387
+ {
388
+ "constant": true,
389
+ "inputs": [
390
+ {
391
+ "name": "token",
392
+ "type": "address"
393
+ },
394
+ {
395
+ "name": "account",
396
+ "type": "address"
397
+ }
398
+ ],
399
+ "name": "getBalance",
400
+ "outputs": [
401
+ {
402
+ "name": "",
403
+ "type": "uint256"
404
+ }
405
+ ],
406
+ "payable": false,
407
+ "stateMutability": "view",
408
+ "type": "function"
409
+ },
410
+ {
411
+ "constant": true,
412
+ "inputs": [],
413
+ "name": "tradeEventEnabled",
414
+ "outputs": [
415
+ {
416
+ "name": "",
417
+ "type": "bool"
418
+ }
419
+ ],
420
+ "payable": false,
421
+ "stateMutability": "view",
422
+ "type": "function"
423
+ },
424
+ {
425
+ "constant": false,
426
+ "inputs": [
427
+ {
428
+ "name": "inputs",
429
+ "type": "uint256[]"
430
+ }
431
+ ],
432
+ "name": "cancelByAdmin",
433
+ "outputs": [],
434
+ "payable": false,
435
+ "stateMutability": "nonpayable",
436
+ "type": "function"
437
+ },
438
+ {
439
+ "constant": false,
440
+ "inputs": [
441
+ {
442
+ "name": "newOwner",
443
+ "type": "address"
444
+ }
445
+ ],
446
+ "name": "transferOwnership",
447
+ "outputs": [],
448
+ "payable": false,
449
+ "stateMutability": "nonpayable",
450
+ "type": "function"
451
+ },
452
+ {
453
+ "constant": false,
454
+ "inputs": [
455
+ {
456
+ "name": "token",
457
+ "type": "address"
458
+ },
459
+ {
460
+ "name": "amount",
461
+ "type": "uint256"
462
+ }
463
+ ],
464
+ "name": "withdraw",
465
+ "outputs": [],
466
+ "payable": false,
467
+ "stateMutability": "nonpayable",
468
+ "type": "function"
469
+ },
470
+ {
471
+ "constant": true,
472
+ "inputs": [
473
+ {
474
+ "name": "",
475
+ "type": "bytes32"
476
+ }
477
+ ],
478
+ "name": "orderFills",
479
+ "outputs": [
480
+ {
481
+ "name": "",
482
+ "type": "uint256"
483
+ }
484
+ ],
485
+ "payable": false,
486
+ "stateMutability": "view",
487
+ "type": "function"
488
+ },
489
+ {
490
+ "constant": false,
491
+ "inputs": [],
492
+ "name": "lockMe",
493
+ "outputs": [],
494
+ "payable": false,
495
+ "stateMutability": "nonpayable",
496
+ "type": "function"
497
+ },
498
+ {
499
+ "constant": true,
500
+ "inputs": [
501
+ {
502
+ "name": "",
503
+ "type": "uint256"
504
+ }
505
+ ],
506
+ "name": "tokenId2Address",
507
+ "outputs": [
508
+ {
509
+ "name": "",
510
+ "type": "address"
511
+ }
512
+ ],
513
+ "payable": false,
514
+ "stateMutability": "view",
515
+ "type": "function"
516
+ },
517
+ {
518
+ "constant": true,
519
+ "inputs": [
520
+ {
521
+ "name": "",
522
+ "type": "address"
523
+ }
524
+ ],
525
+ "name": "userAddress2Id",
526
+ "outputs": [
527
+ {
528
+ "name": "",
529
+ "type": "uint256"
530
+ }
531
+ ],
532
+ "payable": false,
533
+ "stateMutability": "view",
534
+ "type": "function"
535
+ },
536
+ {
537
+ "inputs": [
538
+ {
539
+ "name": "_joysoWallet",
540
+ "type": "address"
541
+ },
542
+ {
543
+ "name": "_joyToken",
544
+ "type": "address"
545
+ }
546
+ ],
547
+ "payable": false,
548
+ "stateMutability": "nonpayable",
549
+ "type": "constructor"
550
+ },
551
+ {
552
+ "anonymous": false,
553
+ "inputs": [
554
+ {
555
+ "indexed": false,
556
+ "name": "token",
557
+ "type": "address"
558
+ },
559
+ {
560
+ "indexed": false,
561
+ "name": "user",
562
+ "type": "address"
563
+ },
564
+ {
565
+ "indexed": false,
566
+ "name": "amount",
567
+ "type": "uint256"
568
+ },
569
+ {
570
+ "indexed": false,
571
+ "name": "balance",
572
+ "type": "uint256"
573
+ }
574
+ ],
575
+ "name": "Deposit",
576
+ "type": "event"
577
+ },
578
+ {
579
+ "anonymous": false,
580
+ "inputs": [
581
+ {
582
+ "indexed": false,
583
+ "name": "token",
584
+ "type": "address"
585
+ },
586
+ {
587
+ "indexed": false,
588
+ "name": "user",
589
+ "type": "address"
590
+ },
591
+ {
592
+ "indexed": false,
593
+ "name": "amount",
594
+ "type": "uint256"
595
+ },
596
+ {
597
+ "indexed": false,
598
+ "name": "balance",
599
+ "type": "uint256"
600
+ }
601
+ ],
602
+ "name": "Withdraw",
603
+ "type": "event"
604
+ },
605
+ {
606
+ "anonymous": false,
607
+ "inputs": [
608
+ {
609
+ "indexed": false,
610
+ "name": "user",
611
+ "type": "address"
612
+ },
613
+ {
614
+ "indexed": false,
615
+ "name": "id",
616
+ "type": "uint256"
617
+ }
618
+ ],
619
+ "name": "NewUser",
620
+ "type": "event"
621
+ },
622
+ {
623
+ "anonymous": false,
624
+ "inputs": [
625
+ {
626
+ "indexed": false,
627
+ "name": "user",
628
+ "type": "address"
629
+ },
630
+ {
631
+ "indexed": false,
632
+ "name": "timeLock",
633
+ "type": "uint256"
634
+ }
635
+ ],
636
+ "name": "Lock",
637
+ "type": "event"
638
+ },
639
+ {
640
+ "anonymous": false,
641
+ "inputs": [
642
+ {
643
+ "indexed": false,
644
+ "name": "user",
645
+ "type": "address"
646
+ },
647
+ {
648
+ "indexed": false,
649
+ "name": "baseAmount",
650
+ "type": "uint256"
651
+ },
652
+ {
653
+ "indexed": false,
654
+ "name": "tokenAmount",
655
+ "type": "uint256"
656
+ },
657
+ {
658
+ "indexed": false,
659
+ "name": "isBuy",
660
+ "type": "bool"
661
+ },
662
+ {
663
+ "indexed": false,
664
+ "name": "fee",
665
+ "type": "uint256"
666
+ }
667
+ ],
668
+ "name": "TradeSuccess",
669
+ "type": "event"
670
+ },
671
+ {
672
+ "anonymous": false,
673
+ "inputs": [
674
+ {
675
+ "indexed": true,
676
+ "name": "previousOwner",
677
+ "type": "address"
678
+ },
679
+ {
680
+ "indexed": true,
681
+ "name": "newOwner",
682
+ "type": "address"
683
+ }
684
+ ],
685
+ "name": "OwnershipTransferred",
686
+ "type": "event"
687
+ }
688
+ ];
689
+ /**
690
+ * Joyso_json Contract Class
691
+ *
692
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
693
+ *
694
+ * @example
695
+ * ```typescript
696
+ * import { createPublicClient, createWalletClient, http } from 'viem';
697
+ * import { mainnet } from 'viem/chains';
698
+ * import { Joyso_json } from 'Joyso_json';
699
+ *
700
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
701
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
702
+ *
703
+ * const contract = new Joyso_json('0x...', { publicClient, walletClient });
704
+ *
705
+ * // Read functions
706
+ * const result = await contract.balanceOf('0x...');
707
+ *
708
+ * // Write functions
709
+ * const hash = await contract.transfer('0x...', 1000n);
710
+ *
711
+ * // Simulate transactions (dry-run)
712
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
713
+ * console.log('Gas estimate:', simulation.request.gas);
714
+ *
715
+ * // Watch events
716
+ * const unwatch = contract.watch.Transfer((event) => {
717
+ * console.log('Transfer event:', event);
718
+ * });
719
+ * ```
720
+ */
721
+ class Joyso_json {
722
+ constructor(address, clients) {
723
+ this.contractAddress = address;
724
+ this.publicClient = clients.publicClient;
725
+ this.contract = (0, viem_1.getContract)({
726
+ address,
727
+ abi: exports.Joyso_jsonAbi,
728
+ client: {
729
+ public: clients.publicClient,
730
+ wallet: clients.walletClient,
731
+ },
732
+ });
733
+ }
734
+ /**
735
+ * Get the contract address
736
+ */
737
+ get address() {
738
+ return this.contractAddress;
739
+ }
740
+ /**
741
+ * Get the underlying viem contract instance
742
+ */
743
+ getContract() {
744
+ return this.contract;
745
+ }
746
+ /**
747
+ * userCount
748
+ * view
749
+ */
750
+ async userCount() {
751
+ return this.contract.read.userCount();
752
+ }
753
+ /**
754
+ * joysoWallet
755
+ * view
756
+ */
757
+ async joysoWallet() {
758
+ return this.contract.read.joysoWallet();
759
+ }
760
+ /**
761
+ * isAdmin
762
+ * view
763
+ */
764
+ async isAdmin(arg0) {
765
+ return this.contract.read.isAdmin([arg0]);
766
+ }
767
+ /**
768
+ * userNonce
769
+ * view
770
+ */
771
+ async userNonce(arg0) {
772
+ return this.contract.read.userNonce([arg0]);
773
+ }
774
+ /**
775
+ * lockPeriod
776
+ * view
777
+ */
778
+ async lockPeriod() {
779
+ return this.contract.read.lockPeriod();
780
+ }
781
+ /**
782
+ * usedHash
783
+ * view
784
+ */
785
+ async usedHash(arg0) {
786
+ return this.contract.read.usedHash([arg0]);
787
+ }
788
+ /**
789
+ * userLock
790
+ * view
791
+ */
792
+ async userLock(arg0) {
793
+ return this.contract.read.userLock([arg0]);
794
+ }
795
+ /**
796
+ * owner
797
+ * view
798
+ */
799
+ async owner() {
800
+ return this.contract.read.owner();
801
+ }
802
+ /**
803
+ * userId2Address
804
+ * view
805
+ */
806
+ async userId2Address(arg0) {
807
+ return this.contract.read.userId2Address([arg0]);
808
+ }
809
+ /**
810
+ * joyToken
811
+ * view
812
+ */
813
+ async joyToken() {
814
+ return this.contract.read.joyToken();
815
+ }
816
+ /**
817
+ * tokenAddress2Id
818
+ * view
819
+ */
820
+ async tokenAddress2Id(arg0) {
821
+ return this.contract.read.tokenAddress2Id([arg0]);
822
+ }
823
+ /**
824
+ * getBalance
825
+ * view
826
+ */
827
+ async getBalance(token, account) {
828
+ return this.contract.read.getBalance([token, account]);
829
+ }
830
+ /**
831
+ * tradeEventEnabled
832
+ * view
833
+ */
834
+ async tradeEventEnabled() {
835
+ return this.contract.read.tradeEventEnabled();
836
+ }
837
+ /**
838
+ * orderFills
839
+ * view
840
+ */
841
+ async orderFills(arg0) {
842
+ return this.contract.read.orderFills([arg0]);
843
+ }
844
+ /**
845
+ * tokenId2Address
846
+ * view
847
+ */
848
+ async tokenId2Address(arg0) {
849
+ return this.contract.read.tokenId2Address([arg0]);
850
+ }
851
+ /**
852
+ * userAddress2Id
853
+ * view
854
+ */
855
+ async userAddress2Id(arg0) {
856
+ return this.contract.read.userAddress2Id([arg0]);
857
+ }
858
+ /**
859
+ * matchTokenOrderByAdmin_k44j
860
+ * nonpayable
861
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
862
+ */
863
+ async matchTokenOrderByAdmin_k44j(inputs, options) {
864
+ if (!this.contract.write) {
865
+ throw new Error('Wallet client is required for write operations');
866
+ }
867
+ return this.contract.write.matchTokenOrderByAdmin_k44j([inputs], options);
868
+ }
869
+ /**
870
+ * matchByAdmin_TwH36
871
+ * nonpayable
872
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
873
+ */
874
+ async matchByAdmin_TwH36(inputs, options) {
875
+ if (!this.contract.write) {
876
+ throw new Error('Wallet client is required for write operations');
877
+ }
878
+ return this.contract.write.matchByAdmin_TwH36([inputs], options);
879
+ }
880
+ /**
881
+ * withdrawByAdmin_Unau
882
+ * nonpayable
883
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
884
+ */
885
+ async withdrawByAdmin_Unau(inputs, options) {
886
+ if (!this.contract.write) {
887
+ throw new Error('Wallet client is required for write operations');
888
+ }
889
+ return this.contract.write.withdrawByAdmin_Unau([inputs], options);
890
+ }
891
+ /**
892
+ * migrateByAdmin_DQV
893
+ * nonpayable
894
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
895
+ */
896
+ async migrateByAdmin_DQV(inputs, options) {
897
+ if (!this.contract.write) {
898
+ throw new Error('Wallet client is required for write operations');
899
+ }
900
+ return this.contract.write.migrateByAdmin_DQV([inputs], options);
901
+ }
902
+ /**
903
+ * registerToken
904
+ * nonpayable
905
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
906
+ */
907
+ async registerToken(tokenAddress, index, options) {
908
+ if (!this.contract.write) {
909
+ throw new Error('Wallet client is required for write operations');
910
+ }
911
+ return this.contract.write.registerToken([tokenAddress, index], options);
912
+ }
913
+ /**
914
+ * transferForAdmin
915
+ * nonpayable
916
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
917
+ */
918
+ async transferForAdmin(token, account, amount, options) {
919
+ if (!this.contract.write) {
920
+ throw new Error('Wallet client is required for write operations');
921
+ }
922
+ return this.contract.write.transferForAdmin([token, account, amount], options);
923
+ }
924
+ /**
925
+ * addToAdmin
926
+ * nonpayable
927
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
928
+ */
929
+ async addToAdmin(admin, isAdd, options) {
930
+ if (!this.contract.write) {
931
+ throw new Error('Wallet client is required for write operations');
932
+ }
933
+ return this.contract.write.addToAdmin([admin, isAdd], options);
934
+ }
935
+ /**
936
+ * depositToken
937
+ * nonpayable
938
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
939
+ */
940
+ async depositToken(token, amount, options) {
941
+ if (!this.contract.write) {
942
+ throw new Error('Wallet client is required for write operations');
943
+ }
944
+ return this.contract.write.depositToken([token, amount], options);
945
+ }
946
+ /**
947
+ * collectFee
948
+ * nonpayable
949
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
950
+ */
951
+ async collectFee(token, options) {
952
+ if (!this.contract.write) {
953
+ throw new Error('Wallet client is required for write operations');
954
+ }
955
+ return this.contract.write.collectFee([token], options);
956
+ }
957
+ /**
958
+ * unlockMe
959
+ * nonpayable
960
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
961
+ */
962
+ async unlockMe(options) {
963
+ if (!this.contract.write) {
964
+ throw new Error('Wallet client is required for write operations');
965
+ }
966
+ return this.contract.write.unlockMe(options);
967
+ }
968
+ /**
969
+ * setTradeEventEnabled
970
+ * nonpayable
971
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
972
+ */
973
+ async setTradeEventEnabled(enabled, options) {
974
+ if (!this.contract.write) {
975
+ throw new Error('Wallet client is required for write operations');
976
+ }
977
+ return this.contract.write.setTradeEventEnabled([enabled], options);
978
+ }
979
+ /**
980
+ * depositEther
981
+ * payable
982
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
983
+ */
984
+ async depositEther(options) {
985
+ if (!this.contract.write) {
986
+ throw new Error('Wallet client is required for write operations');
987
+ }
988
+ return this.contract.write.depositEther(options);
989
+ }
990
+ /**
991
+ * changeLockPeriod
992
+ * nonpayable
993
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
994
+ */
995
+ async changeLockPeriod(periodInDays, options) {
996
+ if (!this.contract.write) {
997
+ throw new Error('Wallet client is required for write operations');
998
+ }
999
+ return this.contract.write.changeLockPeriod([periodInDays], options);
1000
+ }
1001
+ /**
1002
+ * cancelByAdmin
1003
+ * nonpayable
1004
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1005
+ */
1006
+ async cancelByAdmin(inputs, options) {
1007
+ if (!this.contract.write) {
1008
+ throw new Error('Wallet client is required for write operations');
1009
+ }
1010
+ return this.contract.write.cancelByAdmin([inputs], options);
1011
+ }
1012
+ /**
1013
+ * transferOwnership
1014
+ * nonpayable
1015
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1016
+ */
1017
+ async transferOwnership(newOwner, options) {
1018
+ if (!this.contract.write) {
1019
+ throw new Error('Wallet client is required for write operations');
1020
+ }
1021
+ return this.contract.write.transferOwnership([newOwner], options);
1022
+ }
1023
+ /**
1024
+ * withdraw
1025
+ * nonpayable
1026
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1027
+ */
1028
+ async withdraw(token, amount, options) {
1029
+ if (!this.contract.write) {
1030
+ throw new Error('Wallet client is required for write operations');
1031
+ }
1032
+ return this.contract.write.withdraw([token, amount], options);
1033
+ }
1034
+ /**
1035
+ * lockMe
1036
+ * nonpayable
1037
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1038
+ */
1039
+ async lockMe(options) {
1040
+ if (!this.contract.write) {
1041
+ throw new Error('Wallet client is required for write operations');
1042
+ }
1043
+ return this.contract.write.lockMe(options);
1044
+ }
1045
+ /**
1046
+ * Simulate contract write operations (dry-run without sending transaction)
1047
+ *
1048
+ * @example
1049
+ * const result = await contract.simulate.transfer('0x...', 1000n);
1050
+ * console.log('Gas estimate:', result.request.gas);
1051
+ * console.log('Would succeed:', result.result);
1052
+ */
1053
+ get simulate() {
1054
+ const contract = this.contract;
1055
+ if (!contract.simulate) {
1056
+ throw new Error('Public client is required for simulation');
1057
+ }
1058
+ return {
1059
+ /**
1060
+ * Simulate matchTokenOrderByAdmin_k44j
1061
+ * Returns gas estimate and result without sending transaction
1062
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1063
+ */
1064
+ async matchTokenOrderByAdmin_k44j(inputs, options) {
1065
+ return contract.simulate.matchTokenOrderByAdmin_k44j([inputs], options);
1066
+ },
1067
+ /**
1068
+ * Simulate matchByAdmin_TwH36
1069
+ * Returns gas estimate and result without sending transaction
1070
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1071
+ */
1072
+ async matchByAdmin_TwH36(inputs, options) {
1073
+ return contract.simulate.matchByAdmin_TwH36([inputs], options);
1074
+ },
1075
+ /**
1076
+ * Simulate withdrawByAdmin_Unau
1077
+ * Returns gas estimate and result without sending transaction
1078
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1079
+ */
1080
+ async withdrawByAdmin_Unau(inputs, options) {
1081
+ return contract.simulate.withdrawByAdmin_Unau([inputs], options);
1082
+ },
1083
+ /**
1084
+ * Simulate migrateByAdmin_DQV
1085
+ * Returns gas estimate and result without sending transaction
1086
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1087
+ */
1088
+ async migrateByAdmin_DQV(inputs, options) {
1089
+ return contract.simulate.migrateByAdmin_DQV([inputs], options);
1090
+ },
1091
+ /**
1092
+ * Simulate registerToken
1093
+ * Returns gas estimate and result without sending transaction
1094
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1095
+ */
1096
+ async registerToken(tokenAddress, index, options) {
1097
+ return contract.simulate.registerToken([tokenAddress, index], options);
1098
+ },
1099
+ /**
1100
+ * Simulate transferForAdmin
1101
+ * Returns gas estimate and result without sending transaction
1102
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1103
+ */
1104
+ async transferForAdmin(token, account, amount, options) {
1105
+ return contract.simulate.transferForAdmin([token, account, amount], options);
1106
+ },
1107
+ /**
1108
+ * Simulate addToAdmin
1109
+ * Returns gas estimate and result without sending transaction
1110
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1111
+ */
1112
+ async addToAdmin(admin, isAdd, options) {
1113
+ return contract.simulate.addToAdmin([admin, isAdd], options);
1114
+ },
1115
+ /**
1116
+ * Simulate depositToken
1117
+ * Returns gas estimate and result without sending transaction
1118
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1119
+ */
1120
+ async depositToken(token, amount, options) {
1121
+ return contract.simulate.depositToken([token, amount], options);
1122
+ },
1123
+ /**
1124
+ * Simulate collectFee
1125
+ * Returns gas estimate and result without sending transaction
1126
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1127
+ */
1128
+ async collectFee(token, options) {
1129
+ return contract.simulate.collectFee([token], options);
1130
+ },
1131
+ /**
1132
+ * Simulate unlockMe
1133
+ * Returns gas estimate and result without sending transaction
1134
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1135
+ */
1136
+ async unlockMe(options) {
1137
+ return contract.simulate.unlockMe(options);
1138
+ },
1139
+ /**
1140
+ * Simulate setTradeEventEnabled
1141
+ * Returns gas estimate and result without sending transaction
1142
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1143
+ */
1144
+ async setTradeEventEnabled(enabled, options) {
1145
+ return contract.simulate.setTradeEventEnabled([enabled], options);
1146
+ },
1147
+ /**
1148
+ * Simulate depositEther
1149
+ * Returns gas estimate and result without sending transaction
1150
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1151
+ */
1152
+ async depositEther(options) {
1153
+ return contract.simulate.depositEther(options);
1154
+ },
1155
+ /**
1156
+ * Simulate changeLockPeriod
1157
+ * Returns gas estimate and result without sending transaction
1158
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1159
+ */
1160
+ async changeLockPeriod(periodInDays, options) {
1161
+ return contract.simulate.changeLockPeriod([periodInDays], options);
1162
+ },
1163
+ /**
1164
+ * Simulate cancelByAdmin
1165
+ * Returns gas estimate and result without sending transaction
1166
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1167
+ */
1168
+ async cancelByAdmin(inputs, options) {
1169
+ return contract.simulate.cancelByAdmin([inputs], options);
1170
+ },
1171
+ /**
1172
+ * Simulate transferOwnership
1173
+ * Returns gas estimate and result without sending transaction
1174
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1175
+ */
1176
+ async transferOwnership(newOwner, options) {
1177
+ return contract.simulate.transferOwnership([newOwner], options);
1178
+ },
1179
+ /**
1180
+ * Simulate withdraw
1181
+ * Returns gas estimate and result without sending transaction
1182
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1183
+ */
1184
+ async withdraw(token, amount, options) {
1185
+ return contract.simulate.withdraw([token, amount], options);
1186
+ },
1187
+ /**
1188
+ * Simulate lockMe
1189
+ * Returns gas estimate and result without sending transaction
1190
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
1191
+ */
1192
+ async lockMe(options) {
1193
+ return contract.simulate.lockMe(options);
1194
+ }
1195
+ };
1196
+ }
1197
+ /**
1198
+ * Watch contract events
1199
+ *
1200
+ * @example
1201
+ * // Watch all Transfer events
1202
+ * const unwatch = contract.watch.Transfer((event) => {
1203
+ * console.log('Transfer:', event);
1204
+ * });
1205
+ *
1206
+ * // Stop watching
1207
+ * unwatch();
1208
+ */
1209
+ get watch() {
1210
+ return {
1211
+ /**
1212
+ * Watch Deposit events
1213
+ * @param callback Function to call when event is emitted
1214
+ * @param filter Optional filter for indexed parameters
1215
+ * @returns Unwatch function to stop listening
1216
+ */
1217
+ Deposit: (callback) => {
1218
+ return this.publicClient.watchContractEvent({
1219
+ address: this.contractAddress,
1220
+ abi: exports.Joyso_jsonAbi,
1221
+ eventName: 'Deposit',
1222
+ onLogs: (logs) => {
1223
+ logs.forEach((log) => {
1224
+ callback(log.args);
1225
+ });
1226
+ },
1227
+ });
1228
+ },
1229
+ /**
1230
+ * Watch Withdraw events
1231
+ * @param callback Function to call when event is emitted
1232
+ * @param filter Optional filter for indexed parameters
1233
+ * @returns Unwatch function to stop listening
1234
+ */
1235
+ Withdraw: (callback) => {
1236
+ return this.publicClient.watchContractEvent({
1237
+ address: this.contractAddress,
1238
+ abi: exports.Joyso_jsonAbi,
1239
+ eventName: 'Withdraw',
1240
+ onLogs: (logs) => {
1241
+ logs.forEach((log) => {
1242
+ callback(log.args);
1243
+ });
1244
+ },
1245
+ });
1246
+ },
1247
+ /**
1248
+ * Watch NewUser events
1249
+ * @param callback Function to call when event is emitted
1250
+ * @param filter Optional filter for indexed parameters
1251
+ * @returns Unwatch function to stop listening
1252
+ */
1253
+ NewUser: (callback) => {
1254
+ return this.publicClient.watchContractEvent({
1255
+ address: this.contractAddress,
1256
+ abi: exports.Joyso_jsonAbi,
1257
+ eventName: 'NewUser',
1258
+ onLogs: (logs) => {
1259
+ logs.forEach((log) => {
1260
+ callback(log.args);
1261
+ });
1262
+ },
1263
+ });
1264
+ },
1265
+ /**
1266
+ * Watch Lock events
1267
+ * @param callback Function to call when event is emitted
1268
+ * @param filter Optional filter for indexed parameters
1269
+ * @returns Unwatch function to stop listening
1270
+ */
1271
+ Lock: (callback) => {
1272
+ return this.publicClient.watchContractEvent({
1273
+ address: this.contractAddress,
1274
+ abi: exports.Joyso_jsonAbi,
1275
+ eventName: 'Lock',
1276
+ onLogs: (logs) => {
1277
+ logs.forEach((log) => {
1278
+ callback(log.args);
1279
+ });
1280
+ },
1281
+ });
1282
+ },
1283
+ /**
1284
+ * Watch TradeSuccess events
1285
+ * @param callback Function to call when event is emitted
1286
+ * @param filter Optional filter for indexed parameters
1287
+ * @returns Unwatch function to stop listening
1288
+ */
1289
+ TradeSuccess: (callback) => {
1290
+ return this.publicClient.watchContractEvent({
1291
+ address: this.contractAddress,
1292
+ abi: exports.Joyso_jsonAbi,
1293
+ eventName: 'TradeSuccess',
1294
+ onLogs: (logs) => {
1295
+ logs.forEach((log) => {
1296
+ callback(log.args);
1297
+ });
1298
+ },
1299
+ });
1300
+ },
1301
+ /**
1302
+ * Watch OwnershipTransferred events
1303
+ * @param callback Function to call when event is emitted
1304
+ * @param filter Optional filter for indexed parameters
1305
+ * @returns Unwatch function to stop listening
1306
+ */
1307
+ OwnershipTransferred: (callback, filter) => {
1308
+ return this.publicClient.watchContractEvent({
1309
+ address: this.contractAddress,
1310
+ abi: exports.Joyso_jsonAbi,
1311
+ eventName: 'OwnershipTransferred',
1312
+ args: filter,
1313
+ onLogs: (logs) => {
1314
+ logs.forEach((log) => {
1315
+ callback(log.args);
1316
+ });
1317
+ },
1318
+ });
1319
+ }
1320
+ };
1321
+ }
1322
+ }
1323
+ exports.Joyso_json = Joyso_json;