fix(bcash): Moved env var check so it does not prevent bch-api from starting

This commit is contained in:
Chris Troutner
2022-01-08 14:24:35 -08:00
parent 1b6bc5acc8
commit 7df1a1a1ed
3 changed files with 1838 additions and 1830 deletions
+911 -911
View File
File diff suppressed because it is too large Load Diff
+16 -8
View File
@@ -33,14 +33,6 @@ class BcashSlp {
this.bchjs = bchjs
// _this.bitcore = bitcore
this.bcashServer = process.env.BCASH_SERVER
if (!this.bcashServer) {
// console.warn('FULCRUM_API env var not set. Can not connect to Fulcrum indexer.')
throw new Error(
'BCASH_SERVER env var not set. Can not connect to bcash full node.'
)
}
this.router = router
this.router.get('/', this.root)
this.router.get('/utxos/:address', this.getUtxos)
@@ -63,6 +55,14 @@ class BcashSlp {
try {
const address = req.params.address
this.bcashServer = process.env.BCASH_SERVER
if (!this.bcashServer) {
// console.warn('FULCRUM_API env var not set. Can not connect to Fulcrum indexer.')
throw new Error(
'BCASH_SERVER env var not set. Can not connect to bcash full node.'
)
}
// Reject if address is an array.
if (Array.isArray(address)) {
res.status(400)
@@ -144,6 +144,14 @@ class BcashSlp {
throw new Error('tokenId must be string')
}
this.bcashServer = process.env.BCASH_SERVER
if (!this.bcashServer) {
// console.warn('FULCRUM_API env var not set. Can not connect to Fulcrum indexer.')
throw new Error(
'BCASH_SERVER env var not set. Can not connect to bcash full node.'
)
}
const result = await _this.axios.get(
`${_this.bcashServer}token/${tokenId}`
)
+911 -911
View File
File diff suppressed because it is too large Load Diff