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