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: 9 months ago
JSON representation
A typescript node module to deserialize rust Decimal values
- Host: GitHub
- URL: https://github.com/vyper-protocol/rust-decimal-wrapper
- Owner: vyper-protocol
- Created: 2022-08-29T07:48:03.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-26T18:42:29.000Z (over 3 years ago)
- Last Synced: 2025-08-11T20:50:15.214Z (10 months ago)
- Topics: rust, rust-decimal, typescript
- Language: TypeScript
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rust Decimal Wrapper
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