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