mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 11:38:12 +00:00
Merge branch 'ethers-units' into experimental-hex-checksum
This commit is contained in:
commit
9fc4f508dc
@ -1,3 +1,3 @@
|
|||||||
ethereum:web3@0.15.1
|
ethereum:web3@0.15.2
|
||||||
meteor@1.1.10
|
meteor@1.1.10
|
||||||
underscore@1.0.4
|
underscore@1.0.4
|
||||||
|
@ -42,12 +42,15 @@ var unitMap = {
|
|||||||
'noether': '0',
|
'noether': '0',
|
||||||
'wei': '1',
|
'wei': '1',
|
||||||
'kwei': '1000',
|
'kwei': '1000',
|
||||||
'ada': '1000',
|
'Kwei': '1000',
|
||||||
|
'babbage': '1000',
|
||||||
'femtoether': '1000',
|
'femtoether': '1000',
|
||||||
'mwei': '1000000',
|
'mwei': '1000000',
|
||||||
'babbage': '1000000',
|
'Mwei': '1000000',
|
||||||
|
'lovelace': '1000000',
|
||||||
'picoether': '1000000',
|
'picoether': '1000000',
|
||||||
'gwei': '1000000000',
|
'gwei': '1000000000',
|
||||||
|
'Gwei': '1000000000',
|
||||||
'shannon': '1000000000',
|
'shannon': '1000000000',
|
||||||
'nanoether': '1000000000',
|
'nanoether': '1000000000',
|
||||||
'nano': '1000000000',
|
'nano': '1000000000',
|
||||||
@ -60,7 +63,6 @@ var unitMap = {
|
|||||||
'ether': '1000000000000000000',
|
'ether': '1000000000000000000',
|
||||||
'kether': '1000000000000000000000',
|
'kether': '1000000000000000000000',
|
||||||
'grand': '1000000000000000000000',
|
'grand': '1000000000000000000000',
|
||||||
'einstein': '1000000000000000000000',
|
|
||||||
'mether': '1000000000000000000000000',
|
'mether': '1000000000000000000000000',
|
||||||
'gether': '1000000000000000000000000000',
|
'gether': '1000000000000000000000000000',
|
||||||
'tether': '1000000000000000000000000000000'
|
'tether': '1000000000000000000000000000000'
|
||||||
@ -295,13 +297,13 @@ var getValueOfUnit = function (unit) {
|
|||||||
*
|
*
|
||||||
* Possible units are:
|
* Possible units are:
|
||||||
* SI Short SI Full Effigy Other
|
* SI Short SI Full Effigy Other
|
||||||
* - kwei femtoether ada
|
* - kwei femtoether babbage
|
||||||
* - mwei picoether babbage
|
* - mwei picoether lovelace
|
||||||
* - gwei nanoether shannon nano
|
* - gwei nanoether shannon nano
|
||||||
* - -- microether szabo micro
|
* - -- microether szabo micro
|
||||||
* - -- milliether finney milli
|
* - -- milliether finney milli
|
||||||
* - ether -- --
|
* - ether -- --
|
||||||
* - kether einstein grand
|
* - kether -- grand
|
||||||
* - mether
|
* - mether
|
||||||
* - gether
|
* - gether
|
||||||
* - tether
|
* - tether
|
||||||
@ -322,13 +324,14 @@ var fromWei = function(number, unit) {
|
|||||||
*
|
*
|
||||||
* Possible units are:
|
* Possible units are:
|
||||||
* SI Short SI Full Effigy Other
|
* SI Short SI Full Effigy Other
|
||||||
* - kwei femtoether ada
|
* - kwei femtoether babbage
|
||||||
* - mwei picoether babbage
|
* - mwei picoether lovelace
|
||||||
* - gwei nanoether shannon nano
|
* - gwei nanoether shannon nano
|
||||||
* - -- microether szabo micro
|
* - -- microether szabo micro
|
||||||
|
* - -- microether szabo micro
|
||||||
* - -- milliether finney milli
|
* - -- milliether finney milli
|
||||||
* - ether -- --
|
* - ether -- --
|
||||||
* - kether einstein grand
|
* - kether -- grand
|
||||||
* - mether
|
* - mether
|
||||||
* - gether
|
* - gether
|
||||||
* - tether
|
* - tether
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"lib": "./lib"
|
"lib": "./lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bignumber.js": "debris/bignumber.js#master",
|
"bignumber.js": "git+https://github.com/debris/bignumber.js#master",
|
||||||
"crypto-js": "^3.1.4",
|
"crypto-js": "^3.1.4",
|
||||||
"utf8": "^2.1.1",
|
"utf8": "^2.1.1",
|
||||||
"xmlhttprequest": "*"
|
"xmlhttprequest": "*"
|
||||||
|
@ -8,8 +8,14 @@ describe('lib/utils/utils', function () {
|
|||||||
|
|
||||||
assert.equal(utils.toWei(1, 'wei'), '1');
|
assert.equal(utils.toWei(1, 'wei'), '1');
|
||||||
assert.equal(utils.toWei(1, 'kwei'), '1000');
|
assert.equal(utils.toWei(1, 'kwei'), '1000');
|
||||||
|
assert.equal(utils.toWei(1, 'Kwei'), '1000');
|
||||||
|
assert.equal(utils.toWei(1, 'babbage'), '1000');
|
||||||
assert.equal(utils.toWei(1, 'mwei'), '1000000');
|
assert.equal(utils.toWei(1, 'mwei'), '1000000');
|
||||||
|
assert.equal(utils.toWei(1, 'Mwei'), '1000000');
|
||||||
|
assert.equal(utils.toWei(1, 'lovelace'), '1000000');
|
||||||
assert.equal(utils.toWei(1, 'gwei'), '1000000000');
|
assert.equal(utils.toWei(1, 'gwei'), '1000000000');
|
||||||
|
assert.equal(utils.toWei(1, 'Gwei'), '1000000000');
|
||||||
|
assert.equal(utils.toWei(1, 'shannon'), '1000000000');
|
||||||
assert.equal(utils.toWei(1, 'szabo'), '1000000000000');
|
assert.equal(utils.toWei(1, 'szabo'), '1000000000000');
|
||||||
assert.equal(utils.toWei(1, 'finney'), '1000000000000000');
|
assert.equal(utils.toWei(1, 'finney'), '1000000000000000');
|
||||||
assert.equal(utils.toWei(1, 'ether'), '1000000000000000000');
|
assert.equal(utils.toWei(1, 'ether'), '1000000000000000000');
|
||||||
@ -20,8 +26,6 @@ describe('lib/utils/utils', function () {
|
|||||||
assert.equal(utils.toWei(1, 'tether'), '1000000000000000000000000000000');
|
assert.equal(utils.toWei(1, 'tether'), '1000000000000000000000000000000');
|
||||||
|
|
||||||
assert.equal(utils.toWei(1, 'kwei'), utils.toWei(1, 'femtoether'));
|
assert.equal(utils.toWei(1, 'kwei'), utils.toWei(1, 'femtoether'));
|
||||||
assert.equal(utils.toWei(1, 'babbage'), utils.toWei(1, 'picoether'));
|
|
||||||
assert.equal(utils.toWei(1, 'shannon'), utils.toWei(1, 'nanoether'));
|
|
||||||
assert.equal(utils.toWei(1, 'szabo'), utils.toWei(1, 'microether'));
|
assert.equal(utils.toWei(1, 'szabo'), utils.toWei(1, 'microether'));
|
||||||
assert.equal(utils.toWei(1, 'finney'), utils.toWei(1, 'milliether'));
|
assert.equal(utils.toWei(1, 'finney'), utils.toWei(1, 'milliether'));
|
||||||
assert.equal(utils.toWei(1, 'milli'), utils.toWei(1, 'milliether'));
|
assert.equal(utils.toWei(1, 'milli'), utils.toWei(1, 'milliether'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user