@gitmyabi/var 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/var
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 **VAR**
4
+
5
+ - **Build ID**: `etherscan-var-c57e0586-1795777175089`
6
+ - **Build Number**: 1
7
+ - **Commit**: `3a61df1`
8
+ - **Branch**: `etherscan`
9
+ - **Target**: `ethers-v6`
10
+ - **Contracts**: 1
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @gitmyabi/var@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/var';
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/var';
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/var';
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
+ Apache License 2.0
@@ -0,0 +1,434 @@
1
+ import type { Address, PublicClient, WalletClient } from 'viem';
2
+ /**
3
+ * Token ABI
4
+ *
5
+ * This ABI is typed using viem's type system for full type safety.
6
+ */
7
+ export declare const TokenAbi: readonly [{
8
+ readonly inputs: readonly [{
9
+ readonly internalType: "string";
10
+ readonly name: "_name";
11
+ readonly type: "string";
12
+ }, {
13
+ readonly internalType: "string";
14
+ readonly name: "_symbol";
15
+ readonly type: "string";
16
+ }, {
17
+ readonly internalType: "uint256[]";
18
+ readonly name: "_numbers";
19
+ readonly type: "uint256[]";
20
+ }];
21
+ readonly stateMutability: "nonpayable";
22
+ readonly type: "constructor";
23
+ }, {
24
+ readonly anonymous: false;
25
+ readonly inputs: readonly [{
26
+ readonly indexed: true;
27
+ readonly internalType: "address";
28
+ readonly name: "owner";
29
+ readonly type: "address";
30
+ }, {
31
+ readonly indexed: true;
32
+ readonly internalType: "address";
33
+ readonly name: "spender";
34
+ readonly type: "address";
35
+ }, {
36
+ readonly indexed: false;
37
+ readonly internalType: "uint256";
38
+ readonly name: "value";
39
+ readonly type: "uint256";
40
+ }];
41
+ readonly name: "Approval";
42
+ readonly type: "event";
43
+ }, {
44
+ readonly anonymous: false;
45
+ readonly inputs: readonly [{
46
+ readonly indexed: true;
47
+ readonly internalType: "address";
48
+ readonly name: "from";
49
+ readonly type: "address";
50
+ }, {
51
+ readonly indexed: true;
52
+ readonly internalType: "address";
53
+ readonly name: "to";
54
+ readonly type: "address";
55
+ }, {
56
+ readonly indexed: false;
57
+ readonly internalType: "uint256";
58
+ readonly name: "value";
59
+ readonly type: "uint256";
60
+ }];
61
+ readonly name: "Transfer";
62
+ readonly type: "event";
63
+ }, {
64
+ readonly inputs: readonly [{
65
+ readonly internalType: "address";
66
+ readonly name: "_owner";
67
+ readonly type: "address";
68
+ }, {
69
+ readonly internalType: "address";
70
+ readonly name: "_spender";
71
+ readonly type: "address";
72
+ }];
73
+ readonly name: "allowance";
74
+ readonly outputs: readonly [{
75
+ readonly internalType: "uint256";
76
+ readonly name: "";
77
+ readonly type: "uint256";
78
+ }];
79
+ readonly stateMutability: "view";
80
+ readonly type: "function";
81
+ }, {
82
+ readonly inputs: readonly [{
83
+ readonly internalType: "address";
84
+ readonly name: "_spender";
85
+ readonly type: "address";
86
+ }, {
87
+ readonly internalType: "uint256";
88
+ readonly name: "_value";
89
+ readonly type: "uint256";
90
+ }];
91
+ readonly name: "approve";
92
+ readonly outputs: readonly [{
93
+ readonly internalType: "bool";
94
+ readonly name: "";
95
+ readonly type: "bool";
96
+ }];
97
+ readonly stateMutability: "nonpayable";
98
+ readonly type: "function";
99
+ }, {
100
+ readonly inputs: readonly [{
101
+ readonly internalType: "address";
102
+ readonly name: "_owner";
103
+ readonly type: "address";
104
+ }];
105
+ readonly name: "balanceOf";
106
+ readonly outputs: readonly [{
107
+ readonly internalType: "uint256";
108
+ readonly name: "";
109
+ readonly type: "uint256";
110
+ }];
111
+ readonly stateMutability: "view";
112
+ readonly type: "function";
113
+ }, {
114
+ readonly inputs: readonly [];
115
+ readonly name: "decimals";
116
+ readonly outputs: readonly [{
117
+ readonly internalType: "uint256";
118
+ readonly name: "";
119
+ readonly type: "uint256";
120
+ }];
121
+ readonly stateMutability: "view";
122
+ readonly type: "function";
123
+ }, {
124
+ readonly inputs: readonly [];
125
+ readonly name: "name";
126
+ readonly outputs: readonly [{
127
+ readonly internalType: "string";
128
+ readonly name: "";
129
+ readonly type: "string";
130
+ }];
131
+ readonly stateMutability: "view";
132
+ readonly type: "function";
133
+ }, {
134
+ readonly inputs: readonly [];
135
+ readonly name: "symbol";
136
+ readonly outputs: readonly [{
137
+ readonly internalType: "string";
138
+ readonly name: "";
139
+ readonly type: "string";
140
+ }];
141
+ readonly stateMutability: "view";
142
+ readonly type: "function";
143
+ }, {
144
+ readonly inputs: readonly [];
145
+ readonly name: "totalSupply";
146
+ readonly outputs: readonly [{
147
+ readonly internalType: "uint256";
148
+ readonly name: "";
149
+ readonly type: "uint256";
150
+ }];
151
+ readonly stateMutability: "view";
152
+ readonly type: "function";
153
+ }, {
154
+ readonly inputs: readonly [{
155
+ readonly internalType: "address";
156
+ readonly name: "_to";
157
+ readonly type: "address";
158
+ }, {
159
+ readonly internalType: "uint256";
160
+ readonly name: "_value";
161
+ readonly type: "uint256";
162
+ }];
163
+ readonly name: "transfer";
164
+ readonly outputs: readonly [{
165
+ readonly internalType: "bool";
166
+ readonly name: "";
167
+ readonly type: "bool";
168
+ }];
169
+ readonly stateMutability: "nonpayable";
170
+ readonly type: "function";
171
+ }, {
172
+ readonly inputs: readonly [{
173
+ readonly internalType: "address";
174
+ readonly name: "_from";
175
+ readonly type: "address";
176
+ }, {
177
+ readonly internalType: "address";
178
+ readonly name: "_to";
179
+ readonly type: "address";
180
+ }, {
181
+ readonly internalType: "uint256";
182
+ readonly name: "_value";
183
+ readonly type: "uint256";
184
+ }];
185
+ readonly name: "transferFrom";
186
+ readonly outputs: readonly [{
187
+ readonly internalType: "bool";
188
+ readonly name: "";
189
+ readonly type: "bool";
190
+ }];
191
+ readonly stateMutability: "nonpayable";
192
+ readonly type: "function";
193
+ }];
194
+ /**
195
+ * Type-safe ABI for Token
196
+ */
197
+ export type TokenAbi = typeof TokenAbi;
198
+ /**
199
+ * Contract instance type for Token
200
+ */
201
+ export type TokenContract = any;
202
+ /**
203
+ * Token Contract Class
204
+ *
205
+ * Provides a class-based API similar to TypeChain for interacting with the contract.
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * import { createPublicClient, createWalletClient, http } from 'viem';
210
+ * import { mainnet } from 'viem/chains';
211
+ * import { Token } from 'Token';
212
+ *
213
+ * const publicClient = createPublicClient({ chain: mainnet, transport: http() });
214
+ * const walletClient = createWalletClient({ chain: mainnet, transport: http() });
215
+ *
216
+ * const contract = new Token('0x...', { publicClient, walletClient });
217
+ *
218
+ * // Read functions
219
+ * const result = await contract.balanceOf('0x...');
220
+ *
221
+ * // Write functions
222
+ * const hash = await contract.transfer('0x...', 1000n);
223
+ *
224
+ * // Simulate transactions (dry-run)
225
+ * const simulation = await contract.simulate.transfer('0x...', 1000n);
226
+ * console.log('Gas estimate:', simulation.request.gas);
227
+ *
228
+ * // Watch events
229
+ * const unwatch = contract.watch.Transfer((event) => {
230
+ * console.log('Transfer event:', event);
231
+ * });
232
+ * ```
233
+ */
234
+ export declare class Token {
235
+ private contract;
236
+ private contractAddress;
237
+ private publicClient;
238
+ constructor(address: Address, clients: {
239
+ publicClient: PublicClient;
240
+ walletClient?: WalletClient;
241
+ });
242
+ /**
243
+ * Get the contract address
244
+ */
245
+ get address(): Address;
246
+ /**
247
+ * Get the underlying viem contract instance.
248
+ */
249
+ getContract(): TokenContract;
250
+ /**
251
+ * allowance
252
+ * view
253
+ */
254
+ allowance(_owner: `0x${string}`, _spender: `0x${string}`): Promise<bigint>;
255
+ /**
256
+ * balanceOf
257
+ * view
258
+ */
259
+ balanceOf(_owner: `0x${string}`): Promise<bigint>;
260
+ /**
261
+ * decimals
262
+ * view
263
+ */
264
+ decimals(): Promise<bigint>;
265
+ /**
266
+ * name
267
+ * view
268
+ */
269
+ name(): Promise<string>;
270
+ /**
271
+ * symbol
272
+ * view
273
+ */
274
+ symbol(): Promise<string>;
275
+ /**
276
+ * totalSupply
277
+ * view
278
+ */
279
+ totalSupply(): Promise<bigint>;
280
+ /**
281
+ * approve
282
+ * nonpayable
283
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
284
+ */
285
+ approve(_spender: `0x${string}`, _value: bigint, options?: {
286
+ accessList?: import('viem').AccessList;
287
+ authorizationList?: import('viem').AuthorizationList;
288
+ chain?: import('viem').Chain | null;
289
+ dataSuffix?: `0x${string}`;
290
+ gas?: bigint;
291
+ gasPrice?: bigint;
292
+ maxFeePerGas?: bigint;
293
+ maxPriorityFeePerGas?: bigint;
294
+ nonce?: number;
295
+ value?: bigint;
296
+ }): Promise<`0x${string}`>;
297
+ /**
298
+ * transfer
299
+ * nonpayable
300
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
301
+ */
302
+ transfer(_to: `0x${string}`, _value: bigint, options?: {
303
+ accessList?: import('viem').AccessList;
304
+ authorizationList?: import('viem').AuthorizationList;
305
+ chain?: import('viem').Chain | null;
306
+ dataSuffix?: `0x${string}`;
307
+ gas?: bigint;
308
+ gasPrice?: bigint;
309
+ maxFeePerGas?: bigint;
310
+ maxPriorityFeePerGas?: bigint;
311
+ nonce?: number;
312
+ value?: bigint;
313
+ }): Promise<`0x${string}`>;
314
+ /**
315
+ * transferFrom
316
+ * nonpayable
317
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
318
+ */
319
+ transferFrom(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, options?: {
320
+ accessList?: import('viem').AccessList;
321
+ authorizationList?: import('viem').AuthorizationList;
322
+ chain?: import('viem').Chain | null;
323
+ dataSuffix?: `0x${string}`;
324
+ gas?: bigint;
325
+ gasPrice?: bigint;
326
+ maxFeePerGas?: bigint;
327
+ maxPriorityFeePerGas?: bigint;
328
+ nonce?: number;
329
+ value?: bigint;
330
+ }): Promise<`0x${string}`>;
331
+ /**
332
+ * Simulate contract write operations (dry-run without sending transaction)
333
+ *
334
+ * @example
335
+ * const result = await contract.simulate.transfer('0x...', 1000n);
336
+ * console.log('Gas estimate:', result.request.gas);
337
+ * console.log('Would succeed:', result.result);
338
+ */
339
+ get simulate(): {
340
+ /**
341
+ * Simulate approve
342
+ * Returns gas estimate and result without sending transaction
343
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
344
+ */
345
+ approve(_spender: `0x${string}`, _value: 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<boolean>;
357
+ /**
358
+ * Simulate transfer
359
+ * Returns gas estimate and result without sending transaction
360
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
361
+ */
362
+ transfer(_to: `0x${string}`, _value: 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<boolean>;
374
+ /**
375
+ * Simulate transferFrom
376
+ * Returns gas estimate and result without sending transaction
377
+ * @param options Optional transaction parameters (value, gas, nonce, etc.)
378
+ */
379
+ transferFrom(_from: `0x${string}`, _to: `0x${string}`, _value: bigint, 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<boolean>;
391
+ };
392
+ /**
393
+ * Watch contract events
394
+ *
395
+ * @example
396
+ * // Watch all Transfer events
397
+ * const unwatch = contract.watch.Transfer((event) => {
398
+ * console.log('Transfer:', event);
399
+ * });
400
+ *
401
+ * // Stop watching
402
+ * unwatch();
403
+ */
404
+ get watch(): {
405
+ /**
406
+ * Watch Approval events
407
+ * @param callback Function to call when event is emitted
408
+ * @param filter Optional filter for indexed parameters
409
+ * @returns Unwatch function to stop listening
410
+ */
411
+ Approval: (callback: (event: {
412
+ owner: `0x${string}`;
413
+ spender: `0x${string}`;
414
+ value: bigint;
415
+ }) => void, filter?: {
416
+ owner?: `0x${string}` | `0x${string}`[] | null;
417
+ spender?: `0x${string}` | `0x${string}`[] | null;
418
+ }) => () => void;
419
+ /**
420
+ * Watch Transfer events
421
+ * @param callback Function to call when event is emitted
422
+ * @param filter Optional filter for indexed parameters
423
+ * @returns Unwatch function to stop listening
424
+ */
425
+ Transfer: (callback: (event: {
426
+ from: `0x${string}`;
427
+ to: `0x${string}`;
428
+ value: bigint;
429
+ }) => void, filter?: {
430
+ from?: `0x${string}` | `0x${string}`[] | null;
431
+ to?: `0x${string}` | `0x${string}`[] | null;
432
+ }) => () => void;
433
+ };
434
+ }