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