Closed itsmestale closed 2 weeks ago
Latest commit: 7a8956f95a4ae08e520a8a5f0b0ea4a3eabe869a
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
I made some changes to improve readability of the functions, so we can support cardano-cli JSON script syntax
and CMLJ SON script syntax
export const scriptFromNative = (native: Native): Script => {
return {
type: "Native",
script: toCMLNativeScript(native).to_cbor_hex(),
};
};
export const scriptFromCMLNative = (cmlNative: CMLNative): Script => {
return {
type: "Native",
script: CML.NativeScript.from_json(JSON.stringify(cmlNative)).to_cbor_hex(),
};
};
Overview
This pull request refactors the
lucid-evolution
library by deprecating theNativeScript
type, consolidating script type definitions, and removing duplicate functions. These changes aim to streamline the codebase and maintain compatibility with existing codebases that rely on the library.Changes Summary
Core Types (
packages/core-types/src/types.ts
):NativeScript
:NativeScript
type as it is obsolete and not used by anything other than a non-functional converter function.Native
type, which provides the same functionality and is actively used by the library, is retained.Transaction Builder (
packages/lucid/src/tx-builder/Native.ts
):Native
type declaration.toNativeScript
function to eliminate redundancy.Utilities (
packages/utils/src/native.ts
):toNativeScript
function to avoid redundancy and maintain a single source of truth.Scripts (
packages/utils/src/scripts.ts
):nativeScriptFromJson
function and recommended using theNative
type and thenativeFromJson
function instead to handle script conversion.