Skip to content

Commit

Permalink
chore: make script data hash only valid for chang (#130)
Browse files Browse the repository at this point in the history
Credit to @cjkoepke
  • Loading branch information
Quantumplation authored Aug 31, 2024
1 parent bc849b5 commit fbe047a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/afraid-ads-happen.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 3 additions & 1 deletion packages/blaze-tx/src/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit fbe047a

Please sign in to comment.