
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@harmoniclabs/uplc
Advanced tools
Typescript/Javascript representation of UPLC (Untyped PLutus Core).
Typescript/Javascript representation of UPLC (Untyped PLutus Core).
npm install @harmoniclabs/uplc
parse and print uplc form flat hex (@harmoniclabs/uint8array-utils
works in every js runtime)
import { fromHex } from "@harmoniclabs/uint8array-utils";
import { parseUPLC, prettyUPLC } from "@harmoniclabs/uplc";
const serialized: Uint8Array = fromHex( "0100003233700900219b8248050005200801" );
const program = parseUPLC( serialized, "flat" );
console.log(
prettyUPLC(
program.body, // UPLCTerm
4 // indentation spaces
)
);
/*
expected output:
[
(lam a
[
[
(builtin addInteger)
(con integer 2)
]
[
[
(builtin multiplyInteger)
(con integer 10)
]
a
]
]
)
(con integer 4)
]
*/
import { parseUPLCText, prettyUPLC } from "@harmoniclabs/uplc";
const uplc_source = `
[
(lam a
[
[
(builtin addInteger)
(con integer 2)
]
[
[
(builtin multiplyInteger)
(con integer 10)
]
a
]
]
)
(con integer 4)
]`;
const uplc = parseUPLCText( uplc_source );
// expected output: true
console.log(
prettyUPLC( uplc, 4 ) === uplc_source
);
import { toHex } from "@harmoniclabs/uint8array-utils";
import { Application, Builtin, UPLCConst, compileUPLC, UPLCProgram } from "@harmoniclabs/uplc";
const body = new Application(
new Application(
Builtin.addInteger,
UPLCConst.int( 2 )
),
UPLCConst.int( 2 )
);
const compiled = compileUPLC(
new UPLCProgram(
[1,0,0],
body
)
).toBuffer().buffer;
console.log( toHex( compiled ) );// expected output: "01000033700900224009"
FAQs
Typescript/Javascript representation of UPLC (Untyped PLutus Core).
The npm package @harmoniclabs/uplc receives a total of 1,615 weekly downloads. As such, @harmoniclabs/uplc popularity was classified as popular.
We found that @harmoniclabs/uplc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.