0.0.4 • Published 10 months ago

satoshi-token v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

satoshi-token

A tiny library with 0 dependencies for converting to and from tsat format given specified number of decimals. tsat is shorthand for token satoshis and is a term coined to refer to the smallest unit of arbitrary tokens.

Main functions are toToken and toTokenSatoshi which take the number to convert, and the number of decimal places the token supports.

Includes convenience functions toBitcoin and toSatoshi for coins with 8 decimals like Bitcoin.

Big Numbers

For tokens with larger tsat values than MAX_SAFE_INTEGER use a string input value and a return type of BigInt.

Example:

toTokenSat("42000000000000.1234", 6, ReturnTypes.BigInt)
// Returns 42000000000000123400n
0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

11 months ago

0.0.1

11 months ago