1.0.3 • Published 4 years ago

@hexcommunity/hex v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

HEX

a repo for all things hex solidity / truffle development

WARNING

this package is untested

need tests for all code (.sol + .js)

contracts

use contracts/* to test the contracts you plan to build on hex.

utils

const { UNITS, fromHeart, toHeart, convert } = require('@hexcommunity/hex/utils')

UNITS

an object with the units as keys and the factor (1e8) as values.

heart
microhex
millihex
hex
hectohex
kilohex
megahex
gigahex
terahex

convert

convert any unit into any other unit returns a BN.js value

convert('heart', 200000000, 'hex') // 2<BN>

fromHeart

convert heart unit to any other unit, default destination hex

fromHeart(200000000)             // 2<BN>
fromHeart(200000000, 'hex')      // 2<BN>
fromHeart(200000000, 'millihex') // 2000<BN>

toHeart

convert from any other unit to heart, default source hex

fromHeart(2)                // 200000000<BN>
fromHeart(2, 'hex')         // 200000000<BN>
fromHeart(2000, 'millihex') // 200000000<BN>
1.0.3

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago