npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@marlowe.io/marlowe-object

v0.4.0-beta

Published

Large contract support

Downloads

16

Readme

Description

The marlowe-object package is an extension of {@link @marlowe.io/language-core-v1!} that allows for referencing {@link index.Party}, {@link index.Value}, {@link index.Observation}, {@link index.Token}, {@link index.Contract}, and {@link index.Action} types in a bundle. This approach flattens the tree structure a bit and allows reusability.

This package exposes a {@link index | main module} with the extended constructs and two modules to bundle them, {@link bundle-list} and {@link bundle-map}. Both bundle types provide the same information but are useful in different contexts. {@link bundle-list.ContractBundleList} is the type expected by the runtime and is used in the {@link @marlowe.io/runtime-rest-client!index.RestClient#createContractSources} of the {@link @marlowe.io/runtime-rest-client!} package. On the other hand, {@link bundle-map.ContractBundleMap} is more ergonomic for developers as it is order-independent and is used when creating source maps to have O(1) access. You can convert between the different bundle types using {@link index.bundleMapToList} or {@link index.bundleListToMap}.

While you can manually define a contract using {@link bundle-list.ContractBundleList} or {@link bundle-map.ContractBundleMap}, the primary intention of this package is to serve as the output of a higher-level abstraction, potentially even a new language that compiles to Marlowe. The name marlowe-object is inspired by the .o files generated when you compile a .c file, with {@link @marlowe.io/runtime-rest-client!index.RestClient#createContractSources} acting as a linker.

This package also simplifies the creation of large contracts. A Marlowe contract is a Tree structure, and if the tree is big enough it won't fit on the blockchain. To solve that, the Marlowe Core specification has a concept called Merkleization, which represents large contracts as a Merkle tree's. The splitting and hashing of a large contract into a Merkle Tree is done through the runtime calls ({@link @marlowe.io/runtime-rest-client!index.RestClient#createContractSources}), and we use marlowe-object to define the large contract in a more approachable way.

The marlowe-object package also extends the core types with the ability to {@link index.Annotated | annotate contract nodes}. This can simplify UI development by tagging nodes with information that can be used to infere a logical state and also allow source mapping from a higer level language.