Anastasia-Labs / lucid-evolution

https://anastasia-labs.github.io/lucid-evolution/
22 stars 7 forks source link

Refactor and Deprecate Redundant Types (Native Script) #164

Closed itsmestale closed 2 weeks ago

itsmestale commented 2 weeks ago

Overview

This pull request refactors the lucid-evolution library by deprecating the NativeScript 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):

Transaction Builder (packages/lucid/src/tx-builder/Native.ts):

Utilities (packages/utils/src/native.ts):

Scripts (packages/utils/src/scripts.ts):

changeset-bot[bot] commented 2 weeks ago

🦋 Changeset detected

Latest commit: 7a8956f95a4ae08e520a8a5f0b0ea4a3eabe869a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages | Name | Type | | --------------------------- | ----- | | @lucid-evolution/core-types | Patch | | @lucid-evolution/lucid | Patch | | @lucid-evolution/utils | Patch | | @lucid-evolution/plutus | Patch | | @lucid-evolution/provider | Patch | | @lucid-evolution/sign_data | Patch | | @lucid-evolution/wallet | Patch |

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

solidsnakedev commented 2 weeks ago

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(),
  };
};