@aztec/blob-client 0.0.1-commit.e558bd1c → 0.0.1-commit.e5a3663dd

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.
@@ -6,11 +6,20 @@ import type { Blob } from '@aztec/blob-lib';
6
6
  export interface GetBlobSidecarOptions {
7
7
  /**
8
8
  * True if the archiver is catching up (historical sync), false if near tip.
9
- * This affects source ordering:
10
- * - Historical: FileStore first (data should exist), then L1 consensus, then archive (eg. blobscan)
11
- * - Near tip: FileStore first with no retries (data should exist), L1 consensus second (freshest data), then FileStore with retries, then archive (eg. blobscan)
9
+ * Historical sync uses a shorter retry backoff since blobs should already exist.
12
10
  */
13
11
  isHistoricalSync?: boolean;
12
+ /**
13
+ * The parent beacon block root for the L1 block containing the blobs.
14
+ * If provided, skips the eth_getBlockByHash execution RPC call inside getSlotNumber.
15
+ */
16
+ parentBeaconBlockRoot?: string;
17
+ /**
18
+ * The timestamp of the L1 execution block containing the blobs.
19
+ * When provided alongside a cached beacon genesis config (fetched at startup), allows computing
20
+ * the beacon slot directly via timestamp math, skipping the beacon headers network call entirely.
21
+ */
22
+ l1BlockTimestamp?: bigint;
14
23
  }
15
24
 
16
25
  export interface BlobClientInterface {
@@ -28,7 +28,7 @@ export function runBlobClientTests(
28
28
  });
29
29
 
30
30
  it('should send and retrieve blobs by hash', async () => {
31
- const blob = makeRandomBlob(5);
31
+ const blob = await makeRandomBlob(5);
32
32
  const blobHash = blob.getEthVersionedBlobHash();
33
33
 
34
34
  await client.sendBlobsToFilestore([blob]);
@@ -39,7 +39,7 @@ export function runBlobClientTests(
39
39
  });
40
40
 
41
41
  it('should handle multiple blobs', async () => {
42
- const blobs = Array.from({ length: 3 }, () => makeRandomBlob(7));
42
+ const blobs = await Promise.all(Array.from({ length: 3 }, () => makeRandomBlob(7)));
43
43
  const blobHashes = blobs.map(blob => blob.getEthVersionedBlobHash());
44
44
 
45
45
  await client.sendBlobsToFilestore(blobs);
@@ -1,6 +1,7 @@
1
1
  import { type Logger, createLogger } from '@aztec/foundation/log';
2
2
  import {
3
3
  type FileStore,
4
+ type HttpFileStoreOptions,
4
5
  type ReadOnlyFileStore,
5
6
  createFileStore,
6
7
  createReadOnlyFileStore,
@@ -44,16 +45,19 @@ export async function createReadOnlyFileStoreBlobClient(
44
45
  storeUrl: string,
45
46
  metadata: BlobFileStoreMetadata,
46
47
  logger?: Logger,
48
+ httpOptions?: HttpFileStoreOptions,
47
49
  ): Promise<FileStoreBlobClient>;
48
50
  export async function createReadOnlyFileStoreBlobClient(
49
51
  storeUrl: string | undefined,
50
52
  metadata: BlobFileStoreMetadata,
51
53
  logger?: Logger,
54
+ httpOptions?: HttpFileStoreOptions,
52
55
  ): Promise<FileStoreBlobClient | undefined>;
53
56
  export async function createReadOnlyFileStoreBlobClient(
54
57
  storeUrl: string | undefined,
55
58
  metadata: BlobFileStoreMetadata,
56
59
  logger?: Logger,
60
+ httpOptions?: HttpFileStoreOptions,
57
61
  ): Promise<FileStoreBlobClient | undefined> {
58
62
  if (!storeUrl) {
59
63
  return undefined;
@@ -64,7 +68,7 @@ export async function createReadOnlyFileStoreBlobClient(
64
68
 
65
69
  log.debug(`Creating read-only filestore blob client`, { storeUrl, basePath });
66
70
 
67
- const store: ReadOnlyFileStore = await createReadOnlyFileStore(storeUrl, log);
71
+ const store: ReadOnlyFileStore = await createReadOnlyFileStore(storeUrl, log, httpOptions);
68
72
  return new FileStoreBlobClient(store, basePath, log);
69
73
  }
70
74
 
@@ -80,6 +84,7 @@ export async function createReadOnlyFileStoreBlobClients(
80
84
  storeUrls: string[] | undefined,
81
85
  metadata: BlobFileStoreMetadata,
82
86
  logger?: Logger,
87
+ httpOptions?: HttpFileStoreOptions,
83
88
  ): Promise<FileStoreBlobClient[]> {
84
89
  if (!storeUrls || storeUrls.length === 0) {
85
90
  return [];
@@ -90,7 +95,7 @@ export async function createReadOnlyFileStoreBlobClients(
90
95
 
91
96
  for (const storeUrl of storeUrls) {
92
97
  try {
93
- const client = await createReadOnlyFileStoreBlobClient(storeUrl, metadata, log);
98
+ const client = await createReadOnlyFileStoreBlobClient(storeUrl, metadata, log, httpOptions);
94
99
  if (client) {
95
100
  clients.push(client);
96
101
  }