diff --git a/src/plutus/data.ts b/src/plutus/data.ts index b9022aa1..57ff44af 100644 --- a/src/plutus/data.ts +++ b/src/plutus/data.ts @@ -33,13 +33,11 @@ export const Data = { ) => { const bytes: Record = { dataType: "bytes" }; if (typeof options === "number") { - bytes.minLength = options * 2; - bytes.maxLength = options * 2; + bytes.minLength = options; + bytes.maxLength = options; } else if (options) { Object.entries(options).forEach(([key, value]) => { - bytes[key] = (key === "minLength" || key === "maxLength") - ? value as number * 2 - : value; + bytes[key] = value; }); } return bytes as unknown as string; diff --git a/tests/data.test.ts b/tests/data.test.ts index 84d8b3d7..e303d85c 100644 --- a/tests/data.test.ts +++ b/tests/data.test.ts @@ -52,9 +52,9 @@ Deno.test("Roundtrip data recursive $ref", () => { Deno.test("Exact bytes length", () => { const MyDatum = Data.Bytes(28); - const datum: typeof MyDatum = "00".repeat(56); + const datum: typeof MyDatum = "00".repeat(28); assert(Data.to(datum, MyDatum)); - const wrongDatum: typeof MyDatum = "00".repeat(28); + const wrongDatum: typeof MyDatum = "00".repeat(20); let isError = false; try { Data.to(wrongDatum, MyDatum);