@gitmyabi/lwc 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.
package/README.md CHANGED
@@ -1,3 +1,108 @@
1
- # Temporary Holding Version
1
+ # @gitmyabi/lwc
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Auto-generated TypeScript type bindings for **LWC**
4
+
5
+ - **Build ID**: `etherscan-lwc-a6a1cc52-1792843028098`
6
+ - **Build Number**: 1
7
+ - **Commit**: `5371e4d`
8
+ - **Branch**: `etherscan`
9
+ - **Target**: `ethers-v6`
10
+ - **Contracts**: 1
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @gitmyabi/lwc@1.0.0
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/lwc';
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/lwc';
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/lwc';
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,594 @@
1
+ import type { Address, PublicClient, WalletClient } from 'viem';
2
+ /**
3
+ * LWCToken_json ABI
4
+ *
5
+ * This ABI is typed using viem's type system for full type safety.
6
+ */
7
+ export declare const LWCToken_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: "spender";
22
+ readonly type: "address";
23
+ }, {
24
+ readonly name: "tokens";
25
+ readonly type: "uint256";
26
+ }];
27
+ readonly name: "approve";
28
+ readonly outputs: readonly [{
29
+ readonly name: "success";
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: "from";
50
+ readonly type: "address";
51
+ }, {
52
+ readonly name: "to";
53
+ readonly type: "address";
54
+ }, {
55
+ readonly name: "tokens";
56
+ readonly type: "uint256";
57
+ }];
58
+ readonly name: "transferFrom";
59
+ readonly outputs: readonly [{
60
+ readonly name: "success";
61
+ readonly type: "bool";
62
+ }];
63
+ readonly payable: false;
64
+ readonly stateMutability: "nonpayable";
65
+ readonly type: "function";
66
+ }, {
67
+ readonly constant: true;
68
+ readonly inputs: readonly [];
69
+ readonly name: "decimals";
70
+ readonly outputs: readonly [{
71
+ readonly name: "";
72
+ readonly type: "uint8";
73
+ }];
74
+ readonly payable: false;
75
+ readonly stateMutability: "view";
76
+ readonly type: "function";
77
+ }, {
78
+ readonly constant: true;
79
+ readonly inputs: readonly [];
80
+ readonly name: "_totalSupply";
81
+ readonly outputs: readonly [{
82
+ readonly name: "";
83
+ readonly type: "uint256";
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: "tokenOwner";
92
+ readonly type: "address";
93
+ }];
94
+ readonly name: "balanceOf";
95
+ readonly outputs: readonly [{
96
+ readonly name: "balance";
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: "tokenPrice";
106
+ readonly outputs: readonly [{
107
+ readonly name: "";
108
+ readonly type: "uint256";
109
+ }];
110
+ readonly payable: false;
111
+ readonly stateMutability: "view";
112
+ readonly type: "function";
113
+ }, {
114
+ readonly constant: true;
115
+ readonly inputs: readonly [];
116
+ readonly name: "symbol";
117
+ readonly outputs: readonly [{
118
+ readonly name: "";
119
+ readonly type: "string";
120
+ }];
121
+ readonly payable: false;
122
+ readonly stateMutability: "view";
123
+ readonly type: "function";
124
+ }, {
125
+ readonly constant: true;
126
+ readonly inputs: readonly [{
127
+ readonly name: "a";
128
+ readonly type: "uint256";
129
+ }, {
130
+ readonly name: "b";
131
+ readonly type: "uint256";
132
+ }];
133
+ readonly name: "safeSub";
134
+ readonly outputs: readonly [{
135
+ readonly name: "c";
136
+ readonly type: "uint256";
137
+ }];
138
+ readonly payable: false;
139
+ readonly stateMutability: "pure";
140
+ readonly type: "function";
141
+ }, {
142
+ readonly constant: false;
143
+ readonly inputs: readonly [{
144
+ readonly name: "to";
145
+ readonly type: "address";
146
+ }, {
147
+ readonly name: "tokens";
148
+ readonly type: "uint256";
149
+ }];
150
+ readonly name: "transfer";
151
+ readonly outputs: readonly [{
152
+ readonly name: "success";
153
+ readonly type: "bool";
154
+ }];
155
+ readonly payable: false;
156
+ readonly stateMutability: "nonpayable";
157
+ readonly type: "function";
158
+ }, {
159
+ readonly constant: true;
160
+ readonly inputs: readonly [{
161
+ readonly name: "a";
162
+ readonly type: "uint256";
163
+ }, {
164
+ readonly name: "b";
165
+ readonly type: "uint256";
166
+ }];
167
+ readonly name: "safeDiv";
168
+ readonly outputs: readonly [{
169
+ readonly name: "c";
170
+ readonly type: "uint256";
171
+ }];
172
+ readonly payable: false;
173
+ readonly stateMutability: "pure";
174
+ readonly type: "function";
175
+ }, {
176
+ readonly constant: false;
177
+ readonly inputs: readonly [{
178
+ readonly name: "spender";
179
+ readonly type: "address";
180
+ }, {
181
+ readonly name: "tokens";
182
+ readonly type: "uint256";
183
+ }, {
184
+ readonly name: "data";
185
+ readonly type: "bytes";
186
+ }];
187
+ readonly name: "approveAndCall";
188
+ readonly outputs: readonly [{
189
+ readonly name: "success";
190
+ readonly type: "bool";
191
+ }];
192
+ readonly payable: false;
193
+ readonly stateMutability: "nonpayable";
194
+ readonly type: "function";
195
+ }, {
196
+ readonly constant: true;
197
+ readonly inputs: readonly [{
198
+ readonly name: "a";
199
+ readonly type: "uint256";
200
+ }, {
201
+ readonly name: "b";
202
+ readonly type: "uint256";
203
+ }];
204
+ readonly name: "safeMul";
205
+ readonly outputs: readonly [{
206
+ readonly name: "c";
207
+ readonly type: "uint256";
208
+ }];
209
+ readonly payable: false;
210
+ readonly stateMutability: "pure";
211
+ readonly type: "function";
212
+ }, {
213
+ readonly constant: true;
214
+ readonly inputs: readonly [{
215
+ readonly name: "tokenOwner";
216
+ readonly type: "address";
217
+ }, {
218
+ readonly name: "spender";
219
+ readonly type: "address";
220
+ }];
221
+ readonly name: "allowance";
222
+ readonly outputs: readonly [{
223
+ readonly name: "remaining";
224
+ readonly type: "uint256";
225
+ }];
226
+ readonly payable: false;
227
+ readonly stateMutability: "view";
228
+ readonly type: "function";
229
+ }, {
230
+ readonly constant: true;
231
+ readonly inputs: readonly [{
232
+ readonly name: "a";
233
+ readonly type: "uint256";
234
+ }, {
235
+ readonly name: "b";
236
+ readonly type: "uint256";
237
+ }];
238
+ readonly name: "safeAdd";
239
+ readonly outputs: readonly [{
240
+ readonly name: "c";
241
+ readonly type: "uint256";
242
+ }];
243
+ readonly payable: false;
244
+ readonly stateMutability: "pure";
245
+ readonly type: "function";
246
+ }, {
247
+ readonly inputs: readonly [];
248
+ readonly payable: false;
249
+ readonly stateMutability: "nonpayable";
250
+ readonly type: "constructor";
251
+ }, {
252
+ readonly payable: true;
253
+ readonly stateMutability: "payable";
254
+ readonly type: "fallback";
255
+ }, {
256
+ readonly anonymous: false;
257
+ readonly inputs: readonly [{
258
+ readonly indexed: true;
259
+ readonly name: "from";
260
+ readonly type: "address";
261
+ }, {
262
+ readonly indexed: true;
263
+ readonly name: "to";
264
+ readonly type: "address";
265
+ }, {
266
+ readonly indexed: false;
267
+ readonly name: "tokens";
268
+ readonly type: "uint256";
269
+ }];
270
+ readonly name: "Transfer";
271
+ readonly type: "event";
272
+ }, {
273
+ readonly anonymous: false;
274
+ readonly inputs: readonly [{
275
+ readonly indexed: true;
276
+ readonly name: "tokenOwner";
277
+ readonly type: "address";
278
+ }, {
279
+ readonly indexed: true;
280
+ readonly name: "spender";
281
+ readonly type: "address";
282
+ }, {
283
+ readonly indexed: false;
284
+ readonly name: "tokens";
285
+ readonly type: "uint256";
286
+ }];
287
+ readonly name: "Approval";
288
+ readonly type: "event";
289
+ }];
290
+ /**
291
+ * Type-safe ABI for LWCToken_json
292
+ */
293
+ export type LWCToken_jsonAbi = typeof LWCToken_jsonAbi;
294
+ /**
295
+ * Contract instance type for LWCToken_json
296
+ */
297
+ export type LWCToken_jsonContract = any;
298
+ /**
299
+ * LWCToken_json Contract Class
300
+ *
301
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
302
+ *
303
+ * @example
304
+ * ```typescript
305
+ * import { createPublicClient, createWalletClient, http } from 'viem';
306
+ * import { mainnet } from 'viem/chains';
307
+ * import { LWCToken_json } from 'LWCToken_json';
308
+ *
309
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
310
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
311
+ *
312
+ * const contract = new LWCToken_json('0x...', { publicClient, walletClient });
313
+ *
314
+ * // Read functions
315
+ * const result = await contract.balanceOf('0x...');
316
+ *
317
+ * // Write functions
318
+ * const hash = await contract.transfer('0x...', 1000n);
319
+ *
320
+ * // Simulate transactions (dry-run)
321
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
322
+ * console.log('Gas estimate:', simulation.request.gas);
323
+ *
324
+ * // Watch events
325
+ * const unwatch = contract.watch.Transfer((event) => {
326
+ * console.log('Transfer event:', event);
327
+ * });
328
+ * ```
329
+ */
330
+ export declare class LWCToken_json {
331
+ private contract;
332
+ private contractAddress;
333
+ private publicClient;
334
+ constructor(address: Address, clients: {
335
+ publicClient: PublicClient;
336
+ walletClient?: WalletClient;
337
+ });
338
+ /**
339
+ * Get the contract address
340
+ */
341
+ get address(): Address;
342
+ /**
343
+ * Get the underlying viem contract instance
344
+ */
345
+ getContract(): LWCToken_jsonContract;
346
+ /**
347
+ * name
348
+ * view
349
+ */
350
+ name(): Promise<string>;
351
+ /**
352
+ * totalSupply
353
+ * view
354
+ */
355
+ totalSupply(): Promise<bigint>;
356
+ /**
357
+ * decimals
358
+ * view
359
+ */
360
+ decimals(): Promise<bigint>;
361
+ /**
362
+ * _totalSupply
363
+ * view
364
+ */
365
+ _totalSupply(): Promise<bigint>;
366
+ /**
367
+ * balanceOf
368
+ * view
369
+ */
370
+ balanceOf(tokenOwner: `0x${string}`): Promise<bigint>;
371
+ /**
372
+ * tokenPrice
373
+ * view
374
+ */
375
+ tokenPrice(): Promise<bigint>;
376
+ /**
377
+ * symbol
378
+ * view
379
+ */
380
+ symbol(): Promise<string>;
381
+ /**
382
+ * safeSub
383
+ * pure
384
+ */
385
+ safeSub(a: bigint, b: bigint): Promise<bigint>;
386
+ /**
387
+ * safeDiv
388
+ * pure
389
+ */
390
+ safeDiv(a: bigint, b: bigint): Promise<bigint>;
391
+ /**
392
+ * safeMul
393
+ * pure
394
+ */
395
+ safeMul(a: bigint, b: bigint): Promise<bigint>;
396
+ /**
397
+ * allowance
398
+ * view
399
+ */
400
+ allowance(tokenOwner: `0x${string}`, spender: `0x${string}`): Promise<bigint>;
401
+ /**
402
+ * safeAdd
403
+ * pure
404
+ */
405
+ safeAdd(a: bigint, b: bigint): Promise<bigint>;
406
+ /**
407
+ * approve
408
+ * nonpayable
409
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
410
+ */
411
+ approve(spender: `0x${string}`, tokens: bigint, options?: {
412
+ accessList?: import('viem').AccessList;
413
+ authorizationList?: import('viem').AuthorizationList;
414
+ chain?: import('viem').Chain | null;
415
+ dataSuffix?: `0x${string}`;
416
+ gas?: bigint;
417
+ gasPrice?: bigint;
418
+ maxFeePerGas?: bigint;
419
+ maxPriorityFeePerGas?: bigint;
420
+ nonce?: number;
421
+ value?: bigint;
422
+ }): Promise<`0x${string}`>;
423
+ /**
424
+ * transferFrom
425
+ * nonpayable
426
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
427
+ */
428
+ transferFrom(from: `0x${string}`, to: `0x${string}`, tokens: bigint, options?: {
429
+ accessList?: import('viem').AccessList;
430
+ authorizationList?: import('viem').AuthorizationList;
431
+ chain?: import('viem').Chain | null;
432
+ dataSuffix?: `0x${string}`;
433
+ gas?: bigint;
434
+ gasPrice?: bigint;
435
+ maxFeePerGas?: bigint;
436
+ maxPriorityFeePerGas?: bigint;
437
+ nonce?: number;
438
+ value?: bigint;
439
+ }): Promise<`0x${string}`>;
440
+ /**
441
+ * transfer
442
+ * nonpayable
443
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
444
+ */
445
+ transfer(to: `0x${string}`, tokens: bigint, options?: {
446
+ accessList?: import('viem').AccessList;
447
+ authorizationList?: import('viem').AuthorizationList;
448
+ chain?: import('viem').Chain | null;
449
+ dataSuffix?: `0x${string}`;
450
+ gas?: bigint;
451
+ gasPrice?: bigint;
452
+ maxFeePerGas?: bigint;
453
+ maxPriorityFeePerGas?: bigint;
454
+ nonce?: number;
455
+ value?: bigint;
456
+ }): Promise<`0x${string}`>;
457
+ /**
458
+ * approveAndCall
459
+ * nonpayable
460
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
461
+ */
462
+ approveAndCall(spender: `0x${string}`, tokens: bigint, data: `0x${string}`, options?: {
463
+ accessList?: import('viem').AccessList;
464
+ authorizationList?: import('viem').AuthorizationList;
465
+ chain?: import('viem').Chain | null;
466
+ dataSuffix?: `0x${string}`;
467
+ gas?: bigint;
468
+ gasPrice?: bigint;
469
+ maxFeePerGas?: bigint;
470
+ maxPriorityFeePerGas?: bigint;
471
+ nonce?: number;
472
+ value?: bigint;
473
+ }): Promise<`0x${string}`>;
474
+ /**
475
+ * Simulate contract write operations (dry-run without sending transaction)
476
+ *
477
+ * @example
478
+ * const result = await contract.simulate.transfer('0x...', 1000n);
479
+ * console.log('Gas estimate:', result.request.gas);
480
+ * console.log('Would succeed:', result.result);
481
+ */
482
+ get simulate(): {
483
+ /**
484
+ * Simulate approve
485
+ * Returns gas estimate and result without sending transaction
486
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
487
+ */
488
+ approve(spender: `0x${string}`, tokens: bigint, options?: {
489
+ accessList?: import("viem").AccessList;
490
+ authorizationList?: import("viem").AuthorizationList;
491
+ chain?: import("viem").Chain | null;
492
+ dataSuffix?: `0x${string}`;
493
+ gas?: bigint;
494
+ gasPrice?: bigint;
495
+ maxFeePerGas?: bigint;
496
+ maxPriorityFeePerGas?: bigint;
497
+ nonce?: number;
498
+ value?: bigint;
499
+ }): Promise<boolean>;
500
+ /**
501
+ * Simulate transferFrom
502
+ * Returns gas estimate and result without sending transaction
503
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
504
+ */
505
+ transferFrom(from: `0x${string}`, to: `0x${string}`, tokens: bigint, options?: {
506
+ accessList?: import("viem").AccessList;
507
+ authorizationList?: import("viem").AuthorizationList;
508
+ chain?: import("viem").Chain | null;
509
+ dataSuffix?: `0x${string}`;
510
+ gas?: bigint;
511
+ gasPrice?: bigint;
512
+ maxFeePerGas?: bigint;
513
+ maxPriorityFeePerGas?: bigint;
514
+ nonce?: number;
515
+ value?: bigint;
516
+ }): Promise<boolean>;
517
+ /**
518
+ * Simulate transfer
519
+ * Returns gas estimate and result without sending transaction
520
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
521
+ */
522
+ transfer(to: `0x${string}`, tokens: bigint, options?: {
523
+ accessList?: import("viem").AccessList;
524
+ authorizationList?: import("viem").AuthorizationList;
525
+ chain?: import("viem").Chain | null;
526
+ dataSuffix?: `0x${string}`;
527
+ gas?: bigint;
528
+ gasPrice?: bigint;
529
+ maxFeePerGas?: bigint;
530
+ maxPriorityFeePerGas?: bigint;
531
+ nonce?: number;
532
+ value?: bigint;
533
+ }): Promise<boolean>;
534
+ /**
535
+ * Simulate approveAndCall
536
+ * Returns gas estimate and result without sending transaction
537
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
538
+ */
539
+ approveAndCall(spender: `0x${string}`, tokens: bigint, data: `0x${string}`, options?: {
540
+ accessList?: import("viem").AccessList;
541
+ authorizationList?: import("viem").AuthorizationList;
542
+ chain?: import("viem").Chain | null;
543
+ dataSuffix?: `0x${string}`;
544
+ gas?: bigint;
545
+ gasPrice?: bigint;
546
+ maxFeePerGas?: bigint;
547
+ maxPriorityFeePerGas?: bigint;
548
+ nonce?: number;
549
+ value?: bigint;
550
+ }): Promise<boolean>;
551
+ };
552
+ /**
553
+ * Watch contract events
554
+ *
555
+ * @example
556
+ * // Watch all Transfer events
557
+ * const unwatch = contract.watch.Transfer((event) => {
558
+ * console.log('Transfer:', event);
559
+ * });
560
+ *
561
+ * // Stop watching
562
+ * unwatch();
563
+ */
564
+ get watch(): {
565
+ /**
566
+ * Watch Transfer events
567
+ * @param callback Function to call when event is emitted
568
+ * @param filter Optional filter for indexed parameters
569
+ * @returns Unwatch function to stop listening
570
+ */
571
+ Transfer: (callback: (event: {
572
+ from: `0x${string}`;
573
+ to: `0x${string}`;
574
+ tokens: bigint;
575
+ }) => void, filter?: {
576
+ from: `0x${string}`;
577
+ to: `0x${string}`;
578
+ }) => () => void;
579
+ /**
580
+ * Watch Approval events
581
+ * @param callback Function to call when event is emitted
582
+ * @param filter Optional filter for indexed parameters
583
+ * @returns Unwatch function to stop listening
584
+ */
585
+ Approval: (callback: (event: {
586
+ tokenOwner: `0x${string}`;
587
+ spender: `0x${string}`;
588
+ tokens: bigint;
589
+ }) => void, filter?: {
590
+ tokenOwner: `0x${string}`;
591
+ spender: `0x${string}`;
592
+ }) => () => void;
593
+ };
594
+ }