coinUtils fixes
This commit is contained in:
parent
b7aa655587
commit
5a26f718c5
9 changed files with 63 additions and 71 deletions
|
|
@ -1,5 +1,9 @@
|
|||
const path = require('path')
|
||||
|
||||
const _ = require('lodash/fp')
|
||||
|
||||
const options = require('./options')
|
||||
|
||||
const CRYPTO_CURRENCIES = [
|
||||
{
|
||||
cryptoCode: 'BTC',
|
||||
|
|
@ -48,7 +52,7 @@ const CRYPTO_CURRENCIES = [
|
|||
}
|
||||
]
|
||||
|
||||
module.exports = {buildUrl, cryptoCurrencies, getCryptoCurrency}
|
||||
module.exports = {buildUrl, cryptoDir, cryptoConfigDir, cryptoCurrencies, getCryptoCurrency}
|
||||
|
||||
function getCryptoCurrency (cryptoCode) {
|
||||
const cryptoCurrency = _.find(['cryptoCode', cryptoCode], CRYPTO_CURRENCIES)
|
||||
|
|
@ -70,3 +74,14 @@ function buildUrl (cryptoCode, address) {
|
|||
default: throw new Error(`Unsupported crypto: ${cryptoCode}`)
|
||||
}
|
||||
}
|
||||
|
||||
function cryptoDir (cryptoRec) {
|
||||
const code = cryptoRec.code
|
||||
const blockchainDir = options.blockchainDir
|
||||
return path.resolve(blockchainDir, code)
|
||||
}
|
||||
|
||||
function cryptoConfigDir (cryptoRec) {
|
||||
const configFile = cryptoRec.configFile
|
||||
return path.resolve(cryptoDir(cryptoRec), configFile)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue