From fbe047a5b3a5a563f60f5769525a9860cecd31b9 Mon Sep 17 00:00:00 2001 From: Pi Lanningham Date: Sat, 31 Aug 2024 08:24:40 -0400 Subject: [PATCH] chore: make script data hash only valid for chang (#130) Credit to @cjkoepke --- .changeset/afraid-ads-happen.md | 5 +++++ packages/blaze-tx/src/tx.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/afraid-ads-happen.md diff --git a/.changeset/afraid-ads-happen.md b/.changeset/afraid-ads-happen.md new file mode 100644 index 0000000..ba2e8ef --- /dev/null +++ b/.changeset/afraid-ads-happen.md @@ -0,0 +1,5 @@ +--- +"@blaze-cardano/tx": minor +--- + +This checks the protocol version to determine if the new script data hash requirements are current yet or not. diff --git a/packages/blaze-tx/src/tx.ts b/packages/blaze-tx/src/tx.ts index 43192ae..ac59740 100644 --- a/packages/blaze-tx/src/tx.ts +++ b/packages/blaze-tx/src/tx.ts @@ -955,7 +955,9 @@ export class TxBuilder { // Initialize a CBOR writer to encode the script data. const writer = new CborWriter(); // Encode redeemers and datums into CBOR format. - if (redeemers.length === 0) { + // In the conway era, the format changes + const conway = this.params.protocolVersion.major === 9; + if (conway && redeemers.length === 0) { // An empty redeemer set is always an empty map, as of conway writer.writeStartMap(0); } else {