Closed keyan-m closed 2 months ago
Is this not subjective? Because now the "fix" breaks other codebases. How do you deem the new solution correct and the old solution incorrect?
Commit 721d971b1ae5df49c0a38baadb57c58b27da3d95 broke our codebase with error: CBOR decode error: too many terminals, data makes no sense
.
To workaround this, I had to use the previous version instead of importing it from this library:
import { Exact } from "@lucid-evolution/core-types";
import { Data } from "@lucid-evolution/plutus";
import * as UPLC from "@lucid-evolution/uplc";
import { fromHex, toHex } from "@lucid-evolution/core-utils";
const applyParamsToScript = <T extends unknown[] = Data[]>(
plutusScript: string,
params: Exact<[...T]>,
type?: T,
): string => {
const p = (type ? Data.castTo<T>(params, type) : params) as Data[];
return toHex(
UPLC.apply_params_to_script(fromHex(Data.to(p)), fromHex(plutusScript)),
);
};
export { applyParamsToScript };
The Problem
applyParamsToScript
seems to generate incorrect CBOR.How to Reproduce
Clone the
test/lucid-evolution
branch of thedirect-offer-offchain
repo and run the following commands:This should log the following CBORs, comparing one generated using
@anastasia-labs/lucid-cardano-fork
, and the other using Lucid Evolution: