You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
472 B
18 lines
472 B
/**
|
|
* @file util/bitcoin.js
|
|
* Contains utilities to handle magnitudes inside of bitcoin
|
|
*/
|
|
'use strict';
|
|
|
|
var SATOSHIS_PER_BTC = 1e8;
|
|
|
|
module.exports = {
|
|
/**
|
|
* @param number satoshis - amount of satoshis to convert
|
|
* @return string an exact representation of such amount, in form of a string
|
|
* (avoids duplicate representations in ieee756 of the same number)
|
|
*/
|
|
satoshisToBitcoin: function(satoshis) {
|
|
return satoshis / SATOSHIS_PER_BTC;
|
|
}
|
|
};
|
|
|