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