mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
fix(bcash): Moved env var check so it does not prevent bch-api from starting
This commit is contained in:
+911
-911
File diff suppressed because it is too large
Load Diff
@@ -33,14 +33,6 @@ class BcashSlp {
|
|||||||
this.bchjs = bchjs
|
this.bchjs = bchjs
|
||||||
// _this.bitcore = bitcore
|
// _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 = router
|
||||||
this.router.get('/', this.root)
|
this.router.get('/', this.root)
|
||||||
this.router.get('/utxos/:address', this.getUtxos)
|
this.router.get('/utxos/:address', this.getUtxos)
|
||||||
@@ -63,6 +55,14 @@ class BcashSlp {
|
|||||||
try {
|
try {
|
||||||
const address = req.params.address
|
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.
|
// Reject if address is an array.
|
||||||
if (Array.isArray(address)) {
|
if (Array.isArray(address)) {
|
||||||
res.status(400)
|
res.status(400)
|
||||||
@@ -144,6 +144,14 @@ class BcashSlp {
|
|||||||
throw new Error('tokenId must be string')
|
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(
|
const result = await _this.axios.get(
|
||||||
`${_this.bcashServer}token/${tokenId}`
|
`${_this.bcashServer}token/${tokenId}`
|
||||||
)
|
)
|
||||||
|
|||||||
+911
-911
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user