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