From 44cc9a1bd8a819f4e039bb86320893915b1a9ac2 Mon Sep 17 00:00:00 2001 From: Hermi Date: Tue, 15 Jul 2025 00:48:35 +0800 Subject: [PATCH 1/2] chore: update dependency to latest version --- package.json | 5 ++++- src/cardano.ts | 26 +++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 4ea136b..87ed115 100644 --- a/package.json +++ b/package.json @@ -34,10 +34,13 @@ "vitest": "^3.2.4" }, "dependencies": { + "@blaze-cardano/core": "^0.6.4", + "@blaze-cardano/sdk": "^0.2.34", "@connectrpc/connect": "1.4", "@connectrpc/connect-node": "1.4", "@connectrpc/connect-web": "1.4", - "@utxorpc/spec": "0.16.0", + "@utxorpc/blaze-provider": "^0.3.6", + "@utxorpc/spec": "0.17.0", "buffer": "^6.0.3" }, "exports": { diff --git a/src/cardano.ts b/src/cardano.ts index fa02ed8..8b727c7 100644 --- a/src/cardano.ts +++ b/src/cardano.ts @@ -62,14 +62,14 @@ function anyChainToBlock(msg: sync.AnyChainBlock) { function pointToBlockRef(p: ChainPoint) { return new sync.BlockRef({ - index: BigInt(p.slot), + slot: BigInt(p.slot), hash: new Uint8Array(Buffer.from(p.hash, "hex")), }); } function blockRefToPoint(r: sync.BlockRef) { return { - slot: r.index.toString(), + slot: r.slot.toString(), hash: Buffer.from(r.hash).toString("hex"), }; } @@ -155,7 +155,7 @@ export class SyncClient { async fetchHistory(p: ChainPoint | undefined, maxItems = 1): Promise { const req = new sync.DumpHistoryRequest({ startToken: p ? new sync.BlockRef({ - index: BigInt(p.slot), + slot: BigInt(p.slot), hash: Buffer.from(p.hash, "hex"), }) : undefined, maxItems: maxItems, @@ -293,6 +293,26 @@ export class QueryClient { asset: (policyId && name) ? { policyId: policyId, assetName: name } : policyId ? { policyId } : { assetName: name }, }); } + + async readGenesis(): Promise { + const res = await this.inner.readGenesis({}); + + if (!res.config || res.config.case !== "cardano") { + throw new Error("Genesis config is not Cardano data"); + } + + return res.config.value; + } + + async readErasummary(): Promise { + const res = await this.inner.readEraSummary({}); + + if (!res.summary || res.summary.case !== "cardano") { + throw new Error("Era summary is not Cardano data"); + } + + return res.summary.value.summaries; + } } export class SubmitClient { From 1f475ad0cb796496f79e9ce7d259d4b15694ee79 Mon Sep 17 00:00:00 2001 From: Hermi Date: Tue, 15 Jul 2025 00:58:02 +0800 Subject: [PATCH 2/2] chore: remove unused dependencies from package.json --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index 87ed115..52c6423 100644 --- a/package.json +++ b/package.json @@ -34,12 +34,9 @@ "vitest": "^3.2.4" }, "dependencies": { - "@blaze-cardano/core": "^0.6.4", - "@blaze-cardano/sdk": "^0.2.34", "@connectrpc/connect": "1.4", "@connectrpc/connect-node": "1.4", "@connectrpc/connect-web": "1.4", - "@utxorpc/blaze-provider": "^0.3.6", "@utxorpc/spec": "0.17.0", "buffer": "^6.0.3" },