1.0.31 • Published 7 months ago

translib v1.0.31

Weekly downloads
32
License
MIT
Repository
-
Last release
7 months 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

7 months ago

1.0.30

8 months ago

1.0.28

10 months ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago