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.
yarn add @vyper-protocol/rust-decimal-wrapper
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
Join our Discord channel and post a message in #developers