mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
fix(electrumx): Added hooks for testnet
This commit is contained in:
@@ -27,4 +27,9 @@ const config = {
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.NETWORK === 'testnet') {
|
||||
config.electrum.serverUrl = 'blackie.c3-soft.com'
|
||||
config.electrum.serverPort = '60002'
|
||||
}
|
||||
|
||||
module.exports = config
|
||||
|
||||
+14
-12
@@ -32,14 +32,6 @@ class Electrum {
|
||||
_this.bchjs = bchjs
|
||||
_this.bitcore = bitcore
|
||||
|
||||
// Configure the ElectrumX/Fulcrum server.
|
||||
// _this.electrumx = new ElectrumCash(
|
||||
// config.electrumx.application,
|
||||
// config.electrumx.version,
|
||||
// config.electrumx.confidence,
|
||||
// config.electrumx.distribution,
|
||||
// ElectrumCash.ORDER.PRIORITY
|
||||
// )
|
||||
_this.electrumx = new ElectrumCash(
|
||||
config.electrumx.electrum.application,
|
||||
config.electrumx.electrum.version,
|
||||
@@ -58,7 +50,7 @@ class Electrum {
|
||||
// Initializes a connection to electrum servers.
|
||||
async connect () {
|
||||
try {
|
||||
console.log('Entering connectToServers()')
|
||||
console.log('Attempting to connect to ElectrumX server...)')
|
||||
|
||||
// Return immediately if a connection has already been established.
|
||||
if (_this.isReady) return true
|
||||
@@ -69,12 +61,14 @@ class Electrum {
|
||||
// Set the connection flag.
|
||||
_this.isReady = true
|
||||
|
||||
console.log(`...Successfully connected to ElectrumX server.`)
|
||||
|
||||
// console.log(`_this.isReady: ${_this.isReady}`)
|
||||
return _this.isReady
|
||||
} catch (err) {
|
||||
// console.log(`err: `, err)
|
||||
wlogger.error('Error in electrumx.js/connect()')
|
||||
throw err
|
||||
console.log(`err: `, err)
|
||||
wlogger.error('Error in electrumx.js/connect(): ', err)
|
||||
// throw err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +118,14 @@ class Electrum {
|
||||
return res.json({ status: 'electrumx' })
|
||||
}
|
||||
|
||||
async utxosFromElectrumx (address) {
|
||||
try {
|
||||
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /electrumx/utxos/{addr} Get utxos for a single address.
|
||||
* @apiName UTXOs for a single address
|
||||
|
||||
Reference in New Issue
Block a user