Closed nielstron closed 1 year ago
I tested this with this funny script
import { ByteArray as HeliosByteArray, Int as HeliosInt, deserializeUplcBytes, hexToBytes, bytesToHex, CborData, textToBytes } from "./helios.js"
const script = deserializeUplcBytes(
CborData.decodeBytes(
hexToBytes(
"4d0100004bd6f7b42f5a205c8261"
)
)
)
console.log(script)
The cbor decompiles to the original UPLC source
(program 1.0.0 (con list<pair<integer, list<bool>>> [(1, [True, False]), (2, [True])]))
I had made a number of fixes, but applied them directly to helios.js and got them overwritten by npm run prebuild :facepalm: re-added them now again
Note that mkCons and tailList/headList currently assume the list being either a UplcMap or UplcDataList, which is too strong of an assumption
Thanks for working on this Niels! Don't worry about mkCons, that can be improved later
I've cleaned everything up and removed UplcDataList, UplcMap and UplcMapItem. Changes are in the dev branch. Could you test that against the script you're deserializing?
Fixes #49
Note that this leaves the shortcuts implemented before in place... I have the feeling that they are used for some unclean matters internally and prefer not to mess with this.