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