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.
Decode:
- Int8, Int32, Int64, Int128, UInt8, UInt32, UInt64, UInt128
- Option
- Result
- Bool
- Vector
- String
yarn
yarn test
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'