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