Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vyper-protocol/rust-decimal-wrapper

A typescript node module to deserialize rust Decimal values
https://github.com/vyper-protocol/rust-decimal-wrapper

rust rust-decimal typescript

Last synced: 15 days ago
JSON representation

A typescript node module to deserialize rust Decimal values

Awesome Lists containing this project

README

        

# 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](https://docs.rs/rust_decimal/latest/rust_decimal/) library.

## Installation

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

## Usage

```ts
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](https://discord.gg/CVsFvY9G) and post a message in #developers