diff --git a/config/electrumx.js b/config/electrumx.js index 7f6f36e..2dddaed 100644 --- a/config/electrumx.js +++ b/config/electrumx.js @@ -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 diff --git a/src/routes/v3/electrumx.js b/src/routes/v3/electrumx.js index 6e60920..a8a8bfb 100644 --- a/src/routes/v3/electrumx.js +++ b/src/routes/v3/electrumx.js @@ -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