Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 1.47 KB

README.md

File metadata and controls

42 lines (29 loc) · 1.47 KB

Rust Decimal Wrapper

rust-decimal-wrapper is released under the MIT license. Current npm package version. Follow @VyperProtocol

A typescript node module to deserialize rust Decimal values

We created this library to read and use in js based apps decimal values serialized with the rust_decimal library.

Installation

yarn add @vyper-protocol/rust-decimal-wrapper

Usage

import { RustDecimalWrapper } from "@vyper-protocol/rust-decimal-wrapper";

// receive from an external application the bytes serialized with rust_decimal
const bytes = new Uint8Array([0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);

// create a RustDecimalWrapper around the bytes
const wrapper = new RustDecimalWrapper(bytes);

// get the original value
const value = wrapper.toNumber();

// value is 0.1

Getting Help

Join our Discord channel and post a message in #developers