add blockchain install scripts

This commit is contained in:
Josh Harvey 2017-07-01 16:02:46 +03:00
parent 0e9e27b97b
commit 178f576cfb
39 changed files with 3938 additions and 750 deletions

View file

@ -171,7 +171,9 @@ function plugins (settings, deviceId) {
.then(row => row.id)
}
function mapCoinSettings (coin) {
function mapCoinSettings (coinParams) {
const coin = coinParams[0]
const cryptoNetwork = coinParams[1]
const config = configManager.scoped(coin, deviceId, settings.config)
const minimumTx = BN(config.minimumTx)
const cashInFee = BN(config.cashInFee)
@ -180,7 +182,8 @@ function plugins (settings, deviceId) {
cryptoCode: coin,
display: coinUtils.display(coin),
minimumTx: BN.max(minimumTx, cashInFee),
cashInFee: cashInFee
cashInFee: cashInFee,
cryptoNetwork
}
}
@ -191,6 +194,7 @@ function plugins (settings, deviceId) {
const tickerPromises = cryptoCodes.map(c => ticker.getRates(settings, fiatCode, c))
const balancePromises = cryptoCodes.map(c => fiatBalance(fiatCode, c))
const testnetPromises = cryptoCodes.map(c => wallet.cryptoNetwork(settings, c))
const pingPromise = recordPing(serialNumber, deviceTime, deviceRec)
const currentConfigVersionPromise = fetchCurrentConfigVersion()
@ -198,20 +202,25 @@ function plugins (settings, deviceId) {
buildAvailableCassettes(),
pingPromise,
currentConfigVersionPromise
].concat(tickerPromises, balancePromises)
].concat(tickerPromises, balancePromises, testnetPromises)
return Promise.all(promises)
.then(arr => {
const cassettes = arr[0]
const configVersion = arr[2]
const tickers = arr.slice(3, cryptoCodes.length + 3)
const balances = arr.slice(cryptoCodes.length + 3)
const cryptoCodesCount = cryptoCodes.length
const tickers = arr.slice(3, cryptoCodesCount + 3)
const balances = arr.slice(cryptoCodesCount + 3, 2 * cryptoCodesCount + 3)
const testNets = arr.slice(2 * cryptoCodesCount + 3)
const coinParams = _.zip(cryptoCodes, testNets)
console.log('DEBUG200: %j', cryptoCodes)
console.log('DEBUG201: %j', coinParams)
return {
cassettes,
rates: buildRates(tickers),
balances: buildBalances(balances),
coins: _.map(mapCoinSettings, cryptoCodes),
coins: _.map(mapCoinSettings, coinParams),
configVersion
}
})