fix: json-rpc exporting and undefined blockchain dir

This commit is contained in:
Sérgio Salgado 2021-11-30 19:35:38 +00:00
parent bbde0fc2b6
commit 50c07c5e8f
7 changed files with 16 additions and 24 deletions

View file

@ -1,32 +1,19 @@
const _ = require('lodash/fp')
const jsonRpc = require('../../common/json-rpc')
const options = require('../../../options')
const BN = require('../../../bn')
const E = require('../../../error')
const { utils: coinUtils } = require('lamassu-coins')
const cryptoRec = coinUtils.getCryptoCurrency('BCH')
const configPath = coinUtils.configPath(cryptoRec, options.blockchainDir)
const unitScale = cryptoRec.unitScale
const SUPPORTS_BATCHING = false
function rpcConfig () {
try {
const config = jsonRpc.parseConf(configPath)
return {
username: config.rpcuser,
password: config.rpcpassword,
port: config.rpcport || cryptoRec.defaultPort
}
} catch (err) {
throw new Error('wallet is currently not installed')
}
}
const rpcConfig = jsonRpc.rpcConfig(cryptoRec)
function fetch (method, params) {
return jsonRpc.fetch(rpcConfig(), method, params)
return jsonRpc.fetch(rpcConfig, method, params)
}
function checkCryptoCode (cryptoCode) {