@gitmyabi/usddpsm7 1.0.1

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