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, });