@aztec/ethereum 4.0.0-nightly.20260113 → 4.0.0-nightly.20260114

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.
@@ -0,0 +1,13 @@
1
+ import type { Buffer32 } from '@aztec/foundation/buffer';
2
+
3
+ /** Base L1 event log with common fields. */
4
+ export type L1EventLog<T> = {
5
+ /** L1 block number where the event was emitted. */
6
+ l1BlockNumber: bigint;
7
+ /** L1 block hash. */
8
+ l1BlockHash: Buffer32;
9
+ /** L1 transaction hash that emitted the event. */
10
+ l1TransactionHash: `0x${string}`;
11
+ /** Event-specific arguments. */
12
+ args: T;
13
+ };
@@ -30,6 +30,7 @@ import type { ViemClient } from '../types.js';
30
30
  import { formatViemError } from '../utils.js';
31
31
  import { EmpireSlashingProposerContract } from './empire_slashing_proposer.js';
32
32
  import { GSEContract } from './gse.js';
33
+ import type { L1EventLog } from './log.js';
33
34
  import { SlasherContract } from './slasher_contract.js';
34
35
  import { TallySlashingProposerContract } from './tally_slashing_proposer.js';
35
36
  import { checkBlockTag } from './utils.js';
@@ -69,6 +70,7 @@ export type ViemHeader = {
69
70
  blockHeadersHash: `0x${string}`;
70
71
  blobsHash: `0x${string}`;
71
72
  inHash: `0x${string}`;
73
+ outHash: `0x${string}`;
72
74
  slotNumber: bigint;
73
75
  timestamp: bigint;
74
76
  coinbase: `0x${string}`;
@@ -185,6 +187,20 @@ export type RollupStatusResponse = {
185
187
  archiveOfMyCheckpoint: Fr;
186
188
  };
187
189
 
190
+ /** Arguments for the CheckpointProposed event. */
191
+ export type CheckpointProposedArgs = {
192
+ checkpointNumber: CheckpointNumber;
193
+ archive: Fr;
194
+ versionedBlobHashes: Buffer[];
195
+ /** Hash of attestations. Undefined for older events (backwards compatibility). */
196
+ attestationsHash?: Buffer32;
197
+ /** Digest of the payload. Undefined for older events (backwards compatibility). */
198
+ payloadDigest?: Buffer32;
199
+ };
200
+
201
+ /** Log type for CheckpointProposed events. */
202
+ export type CheckpointProposedLog = L1EventLog<CheckpointProposedArgs>;
203
+
188
204
  export class RollupContract {
189
205
  private readonly rollup: GetContractReturnType<typeof RollupAbi, ViemClient>;
190
206
 
@@ -965,4 +981,23 @@ export class RollupContract {
965
981
  },
966
982
  );
967
983
  }
984
+
985
+ /** Fetches CheckpointProposed events within the given block range. */
986
+ async getCheckpointProposedEvents(fromBlock: bigint, toBlock: bigint): Promise<CheckpointProposedLog[]> {
987
+ const logs = await this.rollup.getEvents.CheckpointProposed({}, { fromBlock, toBlock });
988
+ return logs
989
+ .filter(log => log.blockNumber! >= fromBlock && log.blockNumber! <= toBlock)
990
+ .map(log => ({
991
+ l1BlockNumber: log.blockNumber!,
992
+ l1BlockHash: Buffer32.fromString(log.blockHash!),
993
+ l1TransactionHash: log.transactionHash!,
994
+ args: {
995
+ checkpointNumber: CheckpointNumber.fromBigInt(log.args.checkpointNumber!),
996
+ archive: Fr.fromString(log.args.archive!),
997
+ versionedBlobHashes: log.args.versionedBlobHashes!.map(h => Buffer.from(h.slice(2), 'hex')),
998
+ attestationsHash: log.args.attestationsHash ? Buffer32.fromString(log.args.attestationsHash) : undefined,
999
+ payloadDigest: log.args.payloadDigest ? Buffer32.fromString(log.args.payloadDigest) : undefined,
1000
+ },
1001
+ }));
1002
+ }
968
1003
  }