@midnight-ntwrk/compact-runtime
TypeScript icon, indicating that this package has built-in type declarations

0.6.13 • Public • Published

Compact runtime library

This API provides runtime primitives used by Compact's TypeScript output, both for use by the compiler output directly, and to utilise it or reproduce its behaviour. This API re-exports a number of items from @midnight-ntwrk/onchain-runtime, and wraps others in a more TypeScript-friendly API. Key parts of the API are:

  • {@link setNetworkId}, required to ensure the right network is being targeted
  • {@link CircuitContext}, and {@link CircuitResults} part of the input and output definition of all circuits
  • {@link WitnessContext}, part of the input definition of all circuits
  • Built-in functions:
    • Hashing/commitment
      • {@link transientHash}
      • {@link transientCommit}
      • {@link persistentHash}
      • {@link persistentCommit}
      • {@link degradeToTransient}
    • Elliptic curve
      • {@link ecAdd}
      • {@link ecMul}
      • {@link ecMulGenerator}
      • {@link hashToCurve}
  • {@link ContractState}, encapsulating the entirety of a smart contract's on-chain state
  • {@link StateValue}, encoding data a contract maintains on-chain
  • {@link QueryContext}, providing an annotated view into the contract state, against which on-chain VM programs can be run
  • {@link CompactType}, providing a runtime representation of basic Compact datatypes
  • Various TypeScript types matching same-named Compact types

Readme

Keywords

none

Package Sidebar

Install

npm i @midnight-ntwrk/compact-runtime

Weekly Downloads

8

Version

0.6.13

License

Apache-2.0

Unpacked Size

58 kB

Total Files

8

Last publish

Collaborators

  • ntwrk-bot