@gitmyabi/weth 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.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # @gitmyabi/weth
2
+
3
+ Auto-generated TypeScript type bindings for **WETH**
4
+
5
+ - **Build ID**: `etherscan-weth-c02aaa39-1780514455228`
6
+ - **Build Number**: 3
7
+ - **Commit**: `901d1b4`
8
+ - **Branch**: `etherscan`
9
+ - **Target**: `ethers-v6`
10
+ - **Contracts**: 1
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @gitmyabi/weth@1.0.1
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ### Class-based API (TypeChain-like)
21
+
22
+ ```typescript
23
+ import { createPublicClient, createWalletClient, http } from 'viem';
24
+ import { mainnet } from 'viem/chains';
25
+ import { YourContract } from '@gitmyabi/weth';
26
+
27
+ const publicClient = createPublicClient({ chain: mainnet, transport: http() });
28
+ const walletClient = createWalletClient({ chain: mainnet, transport: http() });
29
+
30
+ // Create contract instance
31
+ const contract = new YourContract('0x...', { publicClient, walletClient });
32
+
33
+ // Read functions - call directly like TypeChain!
34
+ const result = await contract.yourMethod(param1, param2);
35
+
36
+ // Write functions - also call directly!
37
+ const hash = await contract.transfer('0x...', 1000n);
38
+ ```
39
+
40
+ ### With viem directly
41
+
42
+ ```typescript
43
+ import { createPublicClient, http } from 'viem';
44
+ import { mainnet } from 'viem/chains';
45
+ import { YourContractAbi } from '@gitmyabi/weth';
46
+
47
+ const client = createPublicClient({
48
+ chain: mainnet,
49
+ transport: http(),
50
+ });
51
+
52
+ // Fully typed contract read
53
+ const result = await client.readContract({
54
+ address: '0x...',
55
+ abi: YourContractAbi,
56
+ functionName: 'yourMethod',
57
+ args: [param1, param2],
58
+ });
59
+
60
+ // Fully typed contract write
61
+ const hash = await client.writeContract({
62
+ address: '0x...',
63
+ abi: YourContractAbi,
64
+ functionName: 'yourMethod',
65
+ args: [param1, param2],
66
+ });
67
+ ```
68
+
69
+ ### With wagmi
70
+
71
+ ```typescript
72
+ import { useReadContract, useWriteContract } from 'wagmi';
73
+ import { YourContractAbi } from '@gitmyabi/weth';
74
+
75
+ function MyComponent() {
76
+ const { data } = useReadContract({
77
+ address: '0x...',
78
+ abi: YourContractAbi,
79
+ functionName: 'yourMethod',
80
+ args: [param1, param2],
81
+ });
82
+
83
+ const { writeContract } = useWriteContract();
84
+
85
+ const handleWrite = () => {
86
+ writeContract({
87
+ address: '0x...',
88
+ abi: YourContractAbi,
89
+ functionName: 'yourMethod',
90
+ args: [param1, param2],
91
+ });
92
+ };
93
+
94
+ return <button onClick={handleWrite}>Call Contract</button>;
95
+ }
96
+ ```
97
+
98
+ ## Type Safety
99
+
100
+ This package provides full TypeScript type safety for all contract methods, events, and parameters using viem's type system. All ABIs are exported as `const` assertions for maximum type inference.
101
+
102
+ ## Generated Contracts
103
+
104
+ This package includes type bindings for 1 contract(s) generated from ABI artifacts.
105
+
106
+ ## License
107
+
108
+ MIT
@@ -0,0 +1,552 @@
1
+ import type { Address, PublicClient, WalletClient } from 'viem';
2
+ /**
3
+ * WETH9_json ABI
4
+ *
5
+ * This ABI is typed using viem's type system for full type safety.
6
+ */
7
+ export declare const WETH9_jsonAbi: readonly [{
8
+ readonly constant: true;
9
+ readonly inputs: readonly [];
10
+ readonly name: "name";
11
+ readonly outputs: readonly [{
12
+ readonly name: "";
13
+ readonly type: "string";
14
+ }];
15
+ readonly payable: false;
16
+ readonly stateMutability: "view";
17
+ readonly type: "function";
18
+ }, {
19
+ readonly constant: false;
20
+ readonly inputs: readonly [{
21
+ readonly name: "guy";
22
+ readonly type: "address";
23
+ }, {
24
+ readonly name: "wad";
25
+ readonly type: "uint256";
26
+ }];
27
+ readonly name: "approve";
28
+ readonly outputs: readonly [{
29
+ readonly name: "";
30
+ readonly type: "bool";
31
+ }];
32
+ readonly payable: false;
33
+ readonly stateMutability: "nonpayable";
34
+ readonly type: "function";
35
+ }, {
36
+ readonly constant: true;
37
+ readonly inputs: readonly [];
38
+ readonly name: "totalSupply";
39
+ readonly outputs: readonly [{
40
+ readonly name: "";
41
+ readonly type: "uint256";
42
+ }];
43
+ readonly payable: false;
44
+ readonly stateMutability: "view";
45
+ readonly type: "function";
46
+ }, {
47
+ readonly constant: false;
48
+ readonly inputs: readonly [{
49
+ readonly name: "src";
50
+ readonly type: "address";
51
+ }, {
52
+ readonly name: "dst";
53
+ readonly type: "address";
54
+ }, {
55
+ readonly name: "wad";
56
+ readonly type: "uint256";
57
+ }];
58
+ readonly name: "transferFrom";
59
+ readonly outputs: readonly [{
60
+ readonly name: "";
61
+ readonly type: "bool";
62
+ }];
63
+ readonly payable: false;
64
+ readonly stateMutability: "nonpayable";
65
+ readonly type: "function";
66
+ }, {
67
+ readonly constant: false;
68
+ readonly inputs: readonly [{
69
+ readonly name: "wad";
70
+ readonly type: "uint256";
71
+ }];
72
+ readonly name: "withdraw";
73
+ readonly outputs: readonly [];
74
+ readonly payable: false;
75
+ readonly stateMutability: "nonpayable";
76
+ readonly type: "function";
77
+ }, {
78
+ readonly constant: true;
79
+ readonly inputs: readonly [];
80
+ readonly name: "decimals";
81
+ readonly outputs: readonly [{
82
+ readonly name: "";
83
+ readonly type: "uint8";
84
+ }];
85
+ readonly payable: false;
86
+ readonly stateMutability: "view";
87
+ readonly type: "function";
88
+ }, {
89
+ readonly constant: true;
90
+ readonly inputs: readonly [{
91
+ readonly name: "";
92
+ readonly type: "address";
93
+ }];
94
+ readonly name: "balanceOf";
95
+ readonly outputs: readonly [{
96
+ readonly name: "";
97
+ readonly type: "uint256";
98
+ }];
99
+ readonly payable: false;
100
+ readonly stateMutability: "view";
101
+ readonly type: "function";
102
+ }, {
103
+ readonly constant: true;
104
+ readonly inputs: readonly [];
105
+ readonly name: "symbol";
106
+ readonly outputs: readonly [{
107
+ readonly name: "";
108
+ readonly type: "string";
109
+ }];
110
+ readonly payable: false;
111
+ readonly stateMutability: "view";
112
+ readonly type: "function";
113
+ }, {
114
+ readonly constant: false;
115
+ readonly inputs: readonly [{
116
+ readonly name: "dst";
117
+ readonly type: "address";
118
+ }, {
119
+ readonly name: "wad";
120
+ readonly type: "uint256";
121
+ }];
122
+ readonly name: "transfer";
123
+ readonly outputs: readonly [{
124
+ readonly name: "";
125
+ readonly type: "bool";
126
+ }];
127
+ readonly payable: false;
128
+ readonly stateMutability: "nonpayable";
129
+ readonly type: "function";
130
+ }, {
131
+ readonly constant: false;
132
+ readonly inputs: readonly [];
133
+ readonly name: "deposit";
134
+ readonly outputs: readonly [];
135
+ readonly payable: true;
136
+ readonly stateMutability: "payable";
137
+ readonly type: "function";
138
+ }, {
139
+ readonly constant: true;
140
+ readonly inputs: readonly [{
141
+ readonly name: "";
142
+ readonly type: "address";
143
+ }, {
144
+ readonly name: "";
145
+ readonly type: "address";
146
+ }];
147
+ readonly name: "allowance";
148
+ readonly outputs: readonly [{
149
+ readonly name: "";
150
+ readonly type: "uint256";
151
+ }];
152
+ readonly payable: false;
153
+ readonly stateMutability: "view";
154
+ readonly type: "function";
155
+ }, {
156
+ readonly payable: true;
157
+ readonly stateMutability: "payable";
158
+ readonly type: "fallback";
159
+ }, {
160
+ readonly anonymous: false;
161
+ readonly inputs: readonly [{
162
+ readonly indexed: true;
163
+ readonly name: "src";
164
+ readonly type: "address";
165
+ }, {
166
+ readonly indexed: true;
167
+ readonly name: "guy";
168
+ readonly type: "address";
169
+ }, {
170
+ readonly indexed: false;
171
+ readonly name: "wad";
172
+ readonly type: "uint256";
173
+ }];
174
+ readonly name: "Approval";
175
+ readonly type: "event";
176
+ }, {
177
+ readonly anonymous: false;
178
+ readonly inputs: readonly [{
179
+ readonly indexed: true;
180
+ readonly name: "src";
181
+ readonly type: "address";
182
+ }, {
183
+ readonly indexed: true;
184
+ readonly name: "dst";
185
+ readonly type: "address";
186
+ }, {
187
+ readonly indexed: false;
188
+ readonly name: "wad";
189
+ readonly type: "uint256";
190
+ }];
191
+ readonly name: "Transfer";
192
+ readonly type: "event";
193
+ }, {
194
+ readonly anonymous: false;
195
+ readonly inputs: readonly [{
196
+ readonly indexed: true;
197
+ readonly name: "dst";
198
+ readonly type: "address";
199
+ }, {
200
+ readonly indexed: false;
201
+ readonly name: "wad";
202
+ readonly type: "uint256";
203
+ }];
204
+ readonly name: "Deposit";
205
+ readonly type: "event";
206
+ }, {
207
+ readonly anonymous: false;
208
+ readonly inputs: readonly [{
209
+ readonly indexed: true;
210
+ readonly name: "src";
211
+ readonly type: "address";
212
+ }, {
213
+ readonly indexed: false;
214
+ readonly name: "wad";
215
+ readonly type: "uint256";
216
+ }];
217
+ readonly name: "Withdrawal";
218
+ readonly type: "event";
219
+ }];
220
+ /**
221
+ * Type-safe ABI for WETH9_json
222
+ */
223
+ export type WETH9_jsonAbi = typeof WETH9_jsonAbi;
224
+ /**
225
+ * Contract instance type for WETH9_json
226
+ */
227
+ export type WETH9_jsonContract = any;
228
+ /**
229
+ * WETH9_json Contract Class
230
+ *
231
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * import { createPublicClient, createWalletClient, http } from 'viem';
236
+ * import { mainnet } from 'viem/chains';
237
+ * import { WETH9_json } from 'WETH9_json';
238
+ *
239
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
240
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
241
+ *
242
+ * const contract = new WETH9_json('0x...', { publicClient, walletClient });
243
+ *
244
+ * // Read functions
245
+ * const result = await contract.balanceOf('0x...');
246
+ *
247
+ * // Write functions
248
+ * const hash = await contract.transfer('0x...', 1000n);
249
+ *
250
+ * // Simulate transactions (dry-run)
251
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
252
+ * console.log('Gas estimate:', simulation.request.gas);
253
+ *
254
+ * // Watch events
255
+ * const unwatch = contract.watch.Transfer((event) => {
256
+ * console.log('Transfer event:', event);
257
+ * });
258
+ * ```
259
+ */
260
+ export declare class WETH9_json {
261
+ private contract;
262
+ private contractAddress;
263
+ private publicClient;
264
+ constructor(address: Address, clients: {
265
+ publicClient: PublicClient;
266
+ walletClient?: WalletClient;
267
+ });
268
+ /**
269
+ * Get the contract address
270
+ */
271
+ get address(): Address;
272
+ /**
273
+ * Get the underlying viem contract instance
274
+ */
275
+ getContract(): WETH9_jsonContract;
276
+ /**
277
+ * name
278
+ * view
279
+ */
280
+ name(): Promise<string>;
281
+ /**
282
+ * totalSupply
283
+ * view
284
+ */
285
+ totalSupply(): Promise<bigint>;
286
+ /**
287
+ * decimals
288
+ * view
289
+ */
290
+ decimals(): Promise<bigint>;
291
+ /**
292
+ * balanceOf
293
+ * view
294
+ */
295
+ balanceOf(arg0: `0x${string}`): Promise<bigint>;
296
+ /**
297
+ * symbol
298
+ * view
299
+ */
300
+ symbol(): Promise<string>;
301
+ /**
302
+ * allowance
303
+ * view
304
+ */
305
+ allowance(arg0: `0x${string}`, arg1: `0x${string}`): Promise<bigint>;
306
+ /**
307
+ * approve
308
+ * nonpayable
309
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
310
+ */
311
+ approve(guy: `0x${string}`, wad: bigint, options?: {
312
+ accessList?: import('viem').AccessList;
313
+ authorizationList?: import('viem').AuthorizationList;
314
+ chain?: import('viem').Chain | null;
315
+ dataSuffix?: `0x${string}`;
316
+ gas?: bigint;
317
+ gasPrice?: bigint;
318
+ maxFeePerGas?: bigint;
319
+ maxPriorityFeePerGas?: bigint;
320
+ nonce?: number;
321
+ value?: bigint;
322
+ }): Promise<`0x${string}`>;
323
+ /**
324
+ * transferFrom
325
+ * nonpayable
326
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
327
+ */
328
+ transferFrom(src: `0x${string}`, dst: `0x${string}`, wad: bigint, options?: {
329
+ accessList?: import('viem').AccessList;
330
+ authorizationList?: import('viem').AuthorizationList;
331
+ chain?: import('viem').Chain | null;
332
+ dataSuffix?: `0x${string}`;
333
+ gas?: bigint;
334
+ gasPrice?: bigint;
335
+ maxFeePerGas?: bigint;
336
+ maxPriorityFeePerGas?: bigint;
337
+ nonce?: number;
338
+ value?: bigint;
339
+ }): Promise<`0x${string}`>;
340
+ /**
341
+ * withdraw
342
+ * nonpayable
343
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
344
+ */
345
+ withdraw(wad: bigint, options?: {
346
+ accessList?: import('viem').AccessList;
347
+ authorizationList?: import('viem').AuthorizationList;
348
+ chain?: import('viem').Chain | null;
349
+ dataSuffix?: `0x${string}`;
350
+ gas?: bigint;
351
+ gasPrice?: bigint;
352
+ maxFeePerGas?: bigint;
353
+ maxPriorityFeePerGas?: bigint;
354
+ nonce?: number;
355
+ value?: bigint;
356
+ }): Promise<`0x${string}`>;
357
+ /**
358
+ * transfer
359
+ * nonpayable
360
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
361
+ */
362
+ transfer(dst: `0x${string}`, wad: bigint, options?: {
363
+ accessList?: import('viem').AccessList;
364
+ authorizationList?: import('viem').AuthorizationList;
365
+ chain?: import('viem').Chain | null;
366
+ dataSuffix?: `0x${string}`;
367
+ gas?: bigint;
368
+ gasPrice?: bigint;
369
+ maxFeePerGas?: bigint;
370
+ maxPriorityFeePerGas?: bigint;
371
+ nonce?: number;
372
+ value?: bigint;
373
+ }): Promise<`0x${string}`>;
374
+ /**
375
+ * deposit
376
+ * payable
377
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
378
+ */
379
+ deposit(options?: {
380
+ accessList?: import('viem').AccessList;
381
+ authorizationList?: import('viem').AuthorizationList;
382
+ chain?: import('viem').Chain | null;
383
+ dataSuffix?: `0x${string}`;
384
+ gas?: bigint;
385
+ gasPrice?: bigint;
386
+ maxFeePerGas?: bigint;
387
+ maxPriorityFeePerGas?: bigint;
388
+ nonce?: number;
389
+ value?: bigint;
390
+ }): Promise<`0x${string}`>;
391
+ /**
392
+ * Simulate contract write operations (dry-run without sending transaction)
393
+ *
394
+ * @example
395
+ * const result = await contract.simulate.transfer('0x...', 1000n);
396
+ * console.log('Gas estimate:', result.request.gas);
397
+ * console.log('Would succeed:', result.result);
398
+ */
399
+ get simulate(): {
400
+ /**
401
+ * Simulate approve
402
+ * Returns gas estimate and result without sending transaction
403
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
404
+ */
405
+ approve(guy: `0x${string}`, wad: bigint, options?: {
406
+ accessList?: import("viem").AccessList;
407
+ authorizationList?: import("viem").AuthorizationList;
408
+ chain?: import("viem").Chain | null;
409
+ dataSuffix?: `0x${string}`;
410
+ gas?: bigint;
411
+ gasPrice?: bigint;
412
+ maxFeePerGas?: bigint;
413
+ maxPriorityFeePerGas?: bigint;
414
+ nonce?: number;
415
+ value?: bigint;
416
+ }): Promise<boolean>;
417
+ /**
418
+ * Simulate transferFrom
419
+ * Returns gas estimate and result without sending transaction
420
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
421
+ */
422
+ transferFrom(src: `0x${string}`, dst: `0x${string}`, wad: bigint, options?: {
423
+ accessList?: import("viem").AccessList;
424
+ authorizationList?: import("viem").AuthorizationList;
425
+ chain?: import("viem").Chain | null;
426
+ dataSuffix?: `0x${string}`;
427
+ gas?: bigint;
428
+ gasPrice?: bigint;
429
+ maxFeePerGas?: bigint;
430
+ maxPriorityFeePerGas?: bigint;
431
+ nonce?: number;
432
+ value?: bigint;
433
+ }): Promise<boolean>;
434
+ /**
435
+ * Simulate withdraw
436
+ * Returns gas estimate and result without sending transaction
437
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
438
+ */
439
+ withdraw(wad: bigint, options?: {
440
+ accessList?: import("viem").AccessList;
441
+ authorizationList?: import("viem").AuthorizationList;
442
+ chain?: import("viem").Chain | null;
443
+ dataSuffix?: `0x${string}`;
444
+ gas?: bigint;
445
+ gasPrice?: bigint;
446
+ maxFeePerGas?: bigint;
447
+ maxPriorityFeePerGas?: bigint;
448
+ nonce?: number;
449
+ value?: bigint;
450
+ }): Promise<void>;
451
+ /**
452
+ * Simulate transfer
453
+ * Returns gas estimate and result without sending transaction
454
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
455
+ */
456
+ transfer(dst: `0x${string}`, wad: bigint, options?: {
457
+ accessList?: import("viem").AccessList;
458
+ authorizationList?: import("viem").AuthorizationList;
459
+ chain?: import("viem").Chain | null;
460
+ dataSuffix?: `0x${string}`;
461
+ gas?: bigint;
462
+ gasPrice?: bigint;
463
+ maxFeePerGas?: bigint;
464
+ maxPriorityFeePerGas?: bigint;
465
+ nonce?: number;
466
+ value?: bigint;
467
+ }): Promise<boolean>;
468
+ /**
469
+ * Simulate deposit
470
+ * Returns gas estimate and result without sending transaction
471
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
472
+ */
473
+ deposit(options?: {
474
+ accessList?: import("viem").AccessList;
475
+ authorizationList?: import("viem").AuthorizationList;
476
+ chain?: import("viem").Chain | null;
477
+ dataSuffix?: `0x${string}`;
478
+ gas?: bigint;
479
+ gasPrice?: bigint;
480
+ maxFeePerGas?: bigint;
481
+ maxPriorityFeePerGas?: bigint;
482
+ nonce?: number;
483
+ value?: bigint;
484
+ }): Promise<void>;
485
+ };
486
+ /**
487
+ * Watch contract events
488
+ *
489
+ * @example
490
+ * // Watch all Transfer events
491
+ * const unwatch = contract.watch.Transfer((event) => {
492
+ * console.log('Transfer:', event);
493
+ * });
494
+ *
495
+ * // Stop watching
496
+ * unwatch();
497
+ */
498
+ get watch(): {
499
+ /**
500
+ * Watch Approval events
501
+ * @param callback Function to call when event is emitted
502
+ * @param filter Optional filter for indexed parameters
503
+ * @returns Unwatch function to stop listening
504
+ */
505
+ Approval: (callback: (event: {
506
+ src: `0x${string}`;
507
+ guy: `0x${string}`;
508
+ wad: bigint;
509
+ }) => void, filter?: {
510
+ src: `0x${string}`;
511
+ guy: `0x${string}`;
512
+ }) => () => void;
513
+ /**
514
+ * Watch Transfer events
515
+ * @param callback Function to call when event is emitted
516
+ * @param filter Optional filter for indexed parameters
517
+ * @returns Unwatch function to stop listening
518
+ */
519
+ Transfer: (callback: (event: {
520
+ src: `0x${string}`;
521
+ dst: `0x${string}`;
522
+ wad: bigint;
523
+ }) => void, filter?: {
524
+ src: `0x${string}`;
525
+ dst: `0x${string}`;
526
+ }) => () => void;
527
+ /**
528
+ * Watch Deposit events
529
+ * @param callback Function to call when event is emitted
530
+ * @param filter Optional filter for indexed parameters
531
+ * @returns Unwatch function to stop listening
532
+ */
533
+ Deposit: (callback: (event: {
534
+ dst: `0x${string}`;
535
+ wad: bigint;
536
+ }) => void, filter?: {
537
+ dst: `0x${string}`;
538
+ }) => () => void;
539
+ /**
540
+ * Watch Withdrawal events
541
+ * @param callback Function to call when event is emitted
542
+ * @param filter Optional filter for indexed parameters
543
+ * @returns Unwatch function to stop listening
544
+ */
545
+ Withdrawal: (callback: (event: {
546
+ src: `0x${string}`;
547
+ wad: bigint;
548
+ }) => void, filter?: {
549
+ src: `0x${string}`;
550
+ }) => () => void;
551
+ };
552
+ }