From 25e1748a34d3e6ff63c25bc66c958e0db05f343c Mon Sep 17 00:00:00 2001 From: ricomiles Date: Fri, 13 Dec 2024 01:44:36 +0800 Subject: [PATCH 1/2] feat: add evalTx function to SubmitClient and update spec dependency to version 0.14.0 --- package.json | 2 +- src/cardano.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 571c176..d02cfde 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@connectrpc/connect-node": "1.4", "@connectrpc/connect-web": "1.4", "@types/node": "20.14.10", - "@utxorpc/spec": "0.12.0", + "@utxorpc/spec": "0.14.0", "buffer": "^6.0.3" }, "exports": { diff --git a/src/cardano.ts b/src/cardano.ts index 72a8ac5..b9fc408 100644 --- a/src/cardano.ts +++ b/src/cardano.ts @@ -313,6 +313,14 @@ export class SubmitClient { return res.ref[0]; } + async evalTx(tx: TxCbor): Promise { + const res = await this.inner.evalTx({ + tx: [tx].map((cbor) => ({ type: { case: "raw", value: cbor } })), + }) + + return res; + } + async *waitForTx(txHash: TxHash): AsyncIterable { const updates = this.inner.waitForTx({ ref: [txHash], From cfe505d9ab3366dea28f94775f9f1f86ad00698f Mon Sep 17 00:00:00 2001 From: ricomiles Date: Fri, 13 Dec 2024 02:25:08 +0800 Subject: [PATCH 2/2] chore: code cleanup --- src/cardano.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cardano.ts b/src/cardano.ts index b9fc408..900247e 100644 --- a/src/cardano.ts +++ b/src/cardano.ts @@ -316,7 +316,7 @@ export class SubmitClient { async evalTx(tx: TxCbor): Promise { const res = await this.inner.evalTx({ tx: [tx].map((cbor) => ({ type: { case: "raw", value: cbor } })), - }) + }); return res; }