Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@cartbc/codecs-core

cartallum21MIT0.0.4TypeScript support: included

Core types and helpers for encoding and decoding byte arrays on Cartes

blockchain, cartbc, cartes, web3

readme

[![npm][npm-image]][npm-url] [![npm-downloads][npm-downloads-image]][npm-url] [![semantic-release][semantic-release-image]][semantic-release-url]
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

Status of the GitHub Workflow: codes-core NPM version NPM downloads
ThanksDev donate button Patreon donate button Flattr donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

@cartbc/codecs-core

This package contains the core types and function for encoding and decoding data structures on Cartes. It can be used standalone, but it is also exported as part of the Cartes JavaScript SDK @cartbc/cartes-web3.js.

Types

bytes

Concatenates an array of Uint8Arrays into a single Uint8Array. Reuses the original byte array when applicable.

codec

Defines an offset in bytes

Functions

assertions

Asserts that a given byte array is not empty

combine-codec

Combines an encoder and a decoder into a codec. The encoder and decoder must have the same fixed size, max size and description. If a description is provided, it will override the encoder and decoder descriptions.

fix-codec

Creates a fixed-size encoder from a given encoder.

@param encoder - The encoder to wrap into a fixed-size encoder. @param fixedBytes - The fixed number of bytes to write. @param description - A custom description for the encoder.

map-codec

Converts an encoder A to a encoder B by mapping their values.

reverse-codec

Reverses the bytes of a fixed-size encoder.