Anastasia-Labs / lucid-evolution

https://anastasia-labs.github.io/lucid-evolution/
39 stars 14 forks source link

Fix NativeScript type enums #160

Closed itsmestale closed 3 months ago

itsmestale commented 3 months ago

Issue when creating a Native Script using the provided JSON example

When utilizing the following JSON structure to create a Native Script:

{
  "type": "all",
  "scripts": [
    {
      "type": "sig",
      "keyHash": "e09d36c79dec9bd1b3d9e152247701cd0bb860b5ebfd1de8abb6735a"
    },
    {
      "type": "sig",
      "keyHash": "a687dcc24e00dd3caafbeb5e68f97ca8ef269cb6fe971345eb951756"
    },
    {
      "type": "sig",
      "keyHash": "0bd1d702b2e6188fe0857a6dc7ffb0675229bab58c86638ffa87ed6d"
    }
  ]
}

We encounter the following error:

Error: NativeScript::from_json: unknown variant `type`, expected one of `ScriptPubkey`, `ScriptAll`, `ScriptAny`, `ScriptNOfK`, `ScriptInvalidBefore`, `ScriptInvalidHereafter`

This issue arises because the current CML implementation utilizes different JSON keys or native script enums compared to those expected and declared by Lucid's types.

Note: More files may require changes but these are all I could find that referenced the available script type variants.

changeset-bot[bot] commented 3 months ago

⚠️ No Changeset found

Latest commit: d71549450f80a7321badd8cbbf8785fa7420341b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR