From 3946a63d4905da9ac0d5865c292bf15ec8713d64 Mon Sep 17 00:00:00 2001 From: Joaquin Hoyos Date: Fri, 6 Sep 2024 17:23:01 +0200 Subject: [PATCH] feat: add toCbor() for debugging --- .changeset/nasty-emus-teach.md | 5 +++++ packages/blaze-tx/src/tx.ts | 9 +++++++++ 2 files changed, 14 insertions(+) create mode 100644 .changeset/nasty-emus-teach.md diff --git a/.changeset/nasty-emus-teach.md b/.changeset/nasty-emus-teach.md new file mode 100644 index 0000000..1254fa1 --- /dev/null +++ b/.changeset/nasty-emus-teach.md @@ -0,0 +1,5 @@ +--- +"@blaze-cardano/tx": patch +--- + +Add toCbor() function to print partial transaction diff --git a/packages/blaze-tx/src/tx.ts b/packages/blaze-tx/src/tx.ts index 9fd3adc..0d84ec8 100644 --- a/packages/blaze-tx/src/tx.ts +++ b/packages/blaze-tx/src/tx.ts @@ -1238,6 +1238,15 @@ export class TxBuilder { this.body.setTotalCollateral(totalCollateral); } + /** + * Prints the transaction cbor in its current state without trying to complete it + * @returns {string} The CBOR representation of the transaction + * */ + toCbor(): string { + const tw = this.buildTransactionWitnessSet(); + return new Transaction(this.body, tw, this.auxiliaryData).toCbor(); + } + /** * Completes the transaction by performing several key operations: * - Verifies the presence of a change address.