Skip to content

rayman1104/scale-codec-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SCALE Codec in Typescript

The SCALE (Simple Concatenated Aggregate Little-Endian) Codec is a lightweight, efficient, binary serialization and deserialization codec.

This is a lightweight implementation of SCALE for Substrate for Typescript.

Features

Decode:

  • Int8, Int32, Int64, Int128, UInt8, UInt32, UInt64, UInt128
  • Option
  • Result
  • Bool
  • Vector
  • String

Install dependencies

yarn

Test

yarn test

Usage

ts-node example.ts

example.ts:

import { ScaleDecoder } from './src/app';
import { hexToBytes } from './src/utils';
const decoder = new ScaleDecoder(hexToBytes("1054657374"));
const res = decoder.processAndUpdateData("String");
console.log(res); // outputs 'Test'

About

SCALE Codec in Typescript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published