From d82af6fa6a8659b4bc800a5bf40399f146a29d99 Mon Sep 17 00:00:00 2001 From: Sebastien Guillemot Date: Thu, 27 Mar 2025 20:03:28 +0900 Subject: [PATCH] Allow fetching from genesis --- src/cardano.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cardano.ts b/src/cardano.ts index c13dcc5..4c4c759 100644 --- a/src/cardano.ts +++ b/src/cardano.ts @@ -152,12 +152,12 @@ export class SyncClient { return anyChainToBlock(res.block[0])!; } - async fetchHistory(p: ChainPoint, maxItems = 1): Promise { + async fetchHistory(p: ChainPoint | undefined, maxItems = 1): Promise { const req = new sync.DumpHistoryRequest({ - startToken: new sync.BlockRef({ + startToken: p ? new sync.BlockRef({ index: BigInt(p.slot), hash: Buffer.from(p.hash, "hex"), - }), + }) : undefined, maxItems: maxItems, });