1.0.31 • Published 4 years ago

translib v1.0.31

Weekly downloads
31
License
MIT
Repository
-
Last release
4 years ago

translib

A small library of functions routinely used in the transledger architecture. They are all bunched here for easy access, easy modification and to give a uniform convention for the different recurrent quantities.

#Installation In the liteAuditor directory, simply issue:

npm install --save translib

Usage

Simply import the module.

const TransLib = require("translib")
const translib = new TransLib();

Then you can invoke the methods:

let value = translib.convertAmountToInteger(amount, ticker);

Methods

convertAmountToInteger(amount, ticker) 

This method is used for converting amounts to a representation in terms of their smallest unit (BTC => Satoshi, ETH => Wei, etc).

Parameters:

amount: string or number ticker: token symbol, one of (TBTC, TLTC, TBCH, TETH, TEOS, TXLM, TXRP, BTC, LTC, BCH, ETH, EOS, XLM, XRP)

convertAmountToDecimal(amount, ticker) 

This method is used for converting amounts from integer to decimal representations (ex: 200000 Satoshi => 0.002 BTC).

Parameters:

amount: string or number ticker: token symbol, one of (TBTC, TLTC, TBCH, TETH, TEOS, TXLM, TXRP, BTC, LTC, BCH, ETH, EOS, XLM, XRP)

uuidv4()

Generate a random uuid with pattern 8-4-4-4-12.

getNetworkSymbol(Network)

Returns a symbol representing the network. For now, they all point towards the testnets.

Parameter:

Network: one of (TBTC, TLTC, TBCH, TETH, TEOS, TXLM, TXRP, BTC, LTC, BCH, ETH, EOS, XLM, XRP)

getBlockchainType(Network)

Returns the type of blockchains (UTXO or Account)

Parameter:

Network: one of (TBTC, TLTC, TBCH, TETH, TEOS, TXLM, TXRP, BTC, LTC, BCH, ETH, EOS, XLM, XRP)

logTime()

Returns the Date and Time in a chosen format

Prerequisite

  • node: install node from here

Prior to run, install all dependencies with npm install. To view dependencies, please refer to the package.json file.

1.0.31

4 years ago

1.0.30

4 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago