fix(electrumx): Added hooks for testnet

This commit is contained in:
Chris Troutner
2020-04-07 20:49:23 -07:00
parent 5af843ee45
commit fe15354b9b
2 changed files with 19 additions and 12 deletions
+5
View File
@@ -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
View File
@@ -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