mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-22 01:02:05 -07:00
Refactored util.js lib
This commit is contained in:
+3
-2
@@ -32,7 +32,7 @@ const ControlV4 = require('./routes/v4/full-node/control')
|
||||
const MiningV4 = require('./routes/v4/full-node/mining')
|
||||
const networkV4 = require('./routes/v4/full-node/network')
|
||||
const RawtransactionsV4 = require('./routes/v4/full-node/rawtransactions')
|
||||
const utilV4 = require('./routes/v4/util')
|
||||
const UtilV4 = require('./routes/v4/util')
|
||||
const SlpV4 = require('./routes/v4/slp')
|
||||
const xpubV4 = require('./routes/v4/xpub')
|
||||
const ElectrumXV4 = require('./routes/v4/electrumx')
|
||||
@@ -52,6 +52,7 @@ const electrumxv4 = new ElectrumXV4()
|
||||
electrumxv4.connect()
|
||||
const encryptionv4 = new EncryptionV4()
|
||||
const pricev4 = new PriceV4()
|
||||
const utilV4 = new UtilV4()
|
||||
|
||||
const app = express()
|
||||
|
||||
@@ -114,12 +115,12 @@ app.use(`/${v4prefix}/` + 'control', controlV4.router)
|
||||
app.use(`/${v4prefix}/` + 'mining', miningV4.router)
|
||||
app.use(`/${v4prefix}/` + 'network', networkV4)
|
||||
app.use(`/${v4prefix}/` + 'rawtransactions', rawtransactionsV4.router)
|
||||
app.use(`/${v4prefix}/` + 'util', utilV4.router)
|
||||
app.use(`/${v4prefix}/` + 'slp', slpV4.router)
|
||||
app.use(`/${v4prefix}/` + 'xpub', xpubV4.router)
|
||||
app.use(`/${v4prefix}/` + 'electrumx', electrumxv4.router)
|
||||
app.use(`/${v4prefix}/` + 'encryption', encryptionv4.router)
|
||||
app.use(`/${v4prefix}/` + 'price', pricev4.router)
|
||||
app.use(`/${v4prefix}/` + 'util', utilV4.router)
|
||||
|
||||
const ninsight = new Ninsight()
|
||||
app.use(`/${v4prefix}/` + 'ninsight', ninsight.router)
|
||||
|
||||
@@ -6,6 +6,7 @@ const axios = require('axios')
|
||||
|
||||
const routeUtils = require('./route-utils')
|
||||
const wlogger = require('../../util/winston-logging')
|
||||
|
||||
const Blockbook = require('./blockbook')
|
||||
const blockbook = new Blockbook()
|
||||
|
||||
@@ -41,6 +42,12 @@ class UtilRoute {
|
||||
this.bchjs = bchjs
|
||||
this.blockbook = blockbook
|
||||
|
||||
this.router = router
|
||||
this.router.get('/', this.root)
|
||||
this.router.get('/validateAddress/:address', this.validateAddressSingle)
|
||||
this.router.post('/validateAddress', this.validateAddressBulk)
|
||||
this.router.post('/sweep', this.sweepWif)
|
||||
|
||||
_this = this
|
||||
}
|
||||
|
||||
@@ -585,13 +592,6 @@ class UtilRoute {
|
||||
}
|
||||
}
|
||||
|
||||
const utilRoute = new UtilRoute()
|
||||
|
||||
router.get('/', utilRoute.root)
|
||||
router.get('/validateAddress/:address', utilRoute.validateAddressSingle)
|
||||
router.post('/validateAddress', utilRoute.validateAddressBulk)
|
||||
router.post('/sweep', utilRoute.sweepWif)
|
||||
|
||||
module.exports = {
|
||||
router,
|
||||
// testableComponents: {
|
||||
|
||||
Reference in New Issue
Block a user