add blockchain install scripts
This commit is contained in:
parent
0e9e27b97b
commit
178f576cfb
39 changed files with 3938 additions and 750 deletions
|
|
@ -1,22 +1,64 @@
|
|||
const _ = require('lodash/fp')
|
||||
|
||||
const coins = {
|
||||
BTC: {unitScale: 8},
|
||||
ETH: {unitScale: 18},
|
||||
ZEC: {unitScale: 8},
|
||||
LTC: {unitScale: 8},
|
||||
DASH: {unitScale: 8}
|
||||
}
|
||||
|
||||
const cryptoDisplays = [
|
||||
{cryptoCode: 'BTC', display: 'Bitcoin'},
|
||||
{cryptoCode: 'ETH', display: 'Ethereum'},
|
||||
{cryptoCode: 'ZEC', display: 'Zcash'},
|
||||
{cryptoCode: 'LTC', display: 'Litecoin'},
|
||||
{cryptoCode: 'DASH', display: 'Dash'}
|
||||
const CRYPTO_CURRENCIES = [
|
||||
{
|
||||
cryptoCode: 'BTC',
|
||||
display: 'Bitcoin',
|
||||
code: 'bitcoin',
|
||||
configFile: 'bitcoin.conf',
|
||||
daemon: 'bitcoind',
|
||||
defaultPort: 8332,
|
||||
unitScale: 8
|
||||
},
|
||||
{
|
||||
cryptoCode: 'ETH',
|
||||
display: 'Ethereum',
|
||||
code: 'ethereum',
|
||||
configFile: 'geth.conf',
|
||||
daemon: 'geth',
|
||||
defaultPort: 8545,
|
||||
unitScale: 18
|
||||
},
|
||||
{
|
||||
cryptoCode: 'LTC',
|
||||
display: 'Litecoin',
|
||||
code: 'litecoin',
|
||||
configFile: 'litecoin.conf',
|
||||
daemon: 'litecoind',
|
||||
defaultPort: 9332,
|
||||
unitScale: 8
|
||||
},
|
||||
{
|
||||
cryptoCode: 'DASH',
|
||||
display: 'Dash',
|
||||
code: 'dash',
|
||||
configFile: 'dash.conf',
|
||||
daemon: 'dashd',
|
||||
defaultPort: 9998,
|
||||
unitScale: 8
|
||||
},
|
||||
{
|
||||
cryptoCode: 'ZEC',
|
||||
display: 'Zcash',
|
||||
code: 'zcash',
|
||||
configFile: 'zcash.conf',
|
||||
daemon: 'zcashd',
|
||||
defaultPort: 8232,
|
||||
unitScale: 8
|
||||
}
|
||||
]
|
||||
|
||||
module.exports = {coins, cryptoDisplays, buildUrl, unitScale, display}
|
||||
module.exports = {buildUrl, cryptoCurrencies, getCryptoCurrency}
|
||||
|
||||
function getCryptoCurrency (cryptoCode) {
|
||||
const cryptoCurrency = _.find(['cryptoCode', cryptoCode], CRYPTO_CURRENCIES)
|
||||
if (!cryptoCurrency) throw new Error(`Unsupported crypto: ${cryptoCode}`)
|
||||
return cryptoCurrency
|
||||
}
|
||||
|
||||
function cryptoCurrencies () {
|
||||
return CRYPTO_CURRENCIES
|
||||
}
|
||||
|
||||
function buildUrl (cryptoCode, address) {
|
||||
switch (cryptoCode) {
|
||||
|
|
@ -28,15 +70,3 @@ function buildUrl (cryptoCode, address) {
|
|||
default: throw new Error(`Unsupported crypto: ${cryptoCode}`)
|
||||
}
|
||||
}
|
||||
|
||||
function display (cryptoCode) {
|
||||
const rec = _.find(['cryptoCode', cryptoCode], cryptoDisplays)
|
||||
if (!rec) throw new Error(`Unsupported crypto: ${cryptoCode}`)
|
||||
return rec.display
|
||||
}
|
||||
|
||||
function unitScale (cryptoCode) {
|
||||
const scaleRec = coins[cryptoCode]
|
||||
if (!scaleRec) throw new Error(`Unsupported crypto: ${cryptoCode}`)
|
||||
return scaleRec.unitScale
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue