mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
fix(linting): Updating linting dependencies and fixing linting issues
This commit is contained in:
+3
-3
@@ -100,7 +100,7 @@ app.set('views', path.join(__dirname, 'views'))
|
||||
app.set('view engine', 'jade')
|
||||
|
||||
// Mount the docs
|
||||
app.use('/docs', express.static(`${__dirname}/../docs`))
|
||||
app.use('/docs', express.static(`${__dirname.toString()}/../docs`))
|
||||
|
||||
// Log each request to the console with IP addresses.
|
||||
// app.use(logger("dev"))
|
||||
@@ -285,11 +285,11 @@ function onError (error) {
|
||||
case 'EACCES':
|
||||
console.error(`${bind} requires elevated privileges`)
|
||||
process.exit(1)
|
||||
// break
|
||||
break
|
||||
case 'EADDRINUSE':
|
||||
console.error(`${bind} is already in use`)
|
||||
process.exit(1)
|
||||
// break
|
||||
break
|
||||
default:
|
||||
throw error
|
||||
}
|
||||
|
||||
@@ -105,8 +105,8 @@ class Slpdb {
|
||||
const username = 'BITBOX'
|
||||
const password = SLPDB_PASS
|
||||
const combined = `${username}:${password}`
|
||||
var base64Credential = Buffer.from(combined).toString('base64')
|
||||
var readyCredential = `Basic ${base64Credential}`
|
||||
const base64Credential = Buffer.from(combined).toString('base64')
|
||||
const readyCredential = `Basic ${base64Credential}`
|
||||
|
||||
const options = {
|
||||
headers: {
|
||||
|
||||
+10
-14
@@ -79,10 +79,7 @@ class Slp {
|
||||
_this.router.post('/list', _this.listBulkToken)
|
||||
_this.router.get('/balancesForAddress/:address', _this.balancesForAddress)
|
||||
_this.router.post('/balancesForAddress', _this.balancesForAddressBulk)
|
||||
_this.router.get(
|
||||
'/balancesForToken/:tokenId',
|
||||
_this.balancesForTokenSingle
|
||||
)
|
||||
_this.router.get('/balancesForToken/:tokenId', _this.balancesForTokenSingle)
|
||||
_this.router.get('/convert/:address', _this.convertAddressSingle)
|
||||
_this.router.post('/convert', _this.convertAddressBulk)
|
||||
_this.router.post('/validateTxid', _this.validateBulk)
|
||||
@@ -421,9 +418,8 @@ class Slp {
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
'graphTxn.outputs.address': _this.bchjs.SLP.Address.toSLPAddress(
|
||||
address
|
||||
),
|
||||
'graphTxn.outputs.address':
|
||||
_this.bchjs.SLP.Address.toSLPAddress(address),
|
||||
'graphTxn.outputs.status': 'UNSPENT',
|
||||
'graphTxn.outputs.slpAmount': { $gte: 0 }
|
||||
}
|
||||
@@ -634,9 +630,8 @@ class Slp {
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
'graphTxn.outputs.address': _this.bchjs.SLP.Address.toSLPAddress(
|
||||
address
|
||||
),
|
||||
'graphTxn.outputs.address':
|
||||
_this.bchjs.SLP.Address.toSLPAddress(address),
|
||||
'graphTxn.outputs.status': 'UNSPENT',
|
||||
'graphTxn.outputs.slpAmount': { $gte: 0 }
|
||||
}
|
||||
@@ -1756,8 +1751,8 @@ class Slp {
|
||||
const password = SLPDB_PASS_GP
|
||||
const combined = `${username}:${password}`
|
||||
// console.log(`combined: ${combined}`)
|
||||
var base64Credential = Buffer.from(combined).toString('base64')
|
||||
var readyCredential = `Basic ${base64Credential}`
|
||||
const base64Credential = Buffer.from(combined).toString('base64')
|
||||
const readyCredential = `Basic ${base64Credential}`
|
||||
|
||||
const options = {
|
||||
headers: {
|
||||
@@ -1776,8 +1771,8 @@ class Slp {
|
||||
const password = SLPDB_PASS_WL
|
||||
const combined = `${username}:${password}`
|
||||
// console.log(`combined: ${combined}`)
|
||||
var base64Credential = Buffer.from(combined).toString('base64')
|
||||
var readyCredential = `Basic ${base64Credential}`
|
||||
const base64Credential = Buffer.from(combined).toString('base64')
|
||||
const readyCredential = `Basic ${base64Credential}`
|
||||
|
||||
const options = {
|
||||
headers: {
|
||||
@@ -1806,6 +1801,7 @@ class Slp {
|
||||
tokenOutputs.map((x) => {
|
||||
const string = parseFloat(x.amount) * 100000000
|
||||
sendOutputs.push(string.toString())
|
||||
return 1 // Making the linter happy
|
||||
})
|
||||
|
||||
// Because you are not using Insight API indexer, you do not get the
|
||||
|
||||
@@ -433,7 +433,7 @@ class UtilRoute {
|
||||
|
||||
// Loop through each input and sign
|
||||
let redeemScript
|
||||
for (var i = 0; i < utxos.length; i++) {
|
||||
for (let i = 0; i < utxos.length; i++) {
|
||||
const utxo = utxos[i]
|
||||
|
||||
transactionBuilder.sign(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Electrum API route
|
||||
bcash node routes for working with SLP tokens.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
Routes for interacting with the psf-slp-indexer
|
||||
*/
|
||||
|
||||
// Public npm libraries
|
||||
// const express = require('express')
|
||||
// const router = express.Router()
|
||||
// const axios = require('axios')
|
||||
//
|
||||
// // Local libraries
|
||||
// const wlogger = require('../../../util/winston-logging')
|
||||
// const config = require('../../../../config')
|
||||
@@ -105,8 +105,8 @@ class Slpdb {
|
||||
const username = 'BITBOX'
|
||||
const password = SLPDB_PASS
|
||||
const combined = `${username}:${password}`
|
||||
var base64Credential = Buffer.from(combined).toString('base64')
|
||||
var readyCredential = `Basic ${base64Credential}`
|
||||
const base64Credential = Buffer.from(combined).toString('base64')
|
||||
const readyCredential = `Basic ${base64Credential}`
|
||||
|
||||
const options = {
|
||||
headers: {
|
||||
|
||||
+10
-14
@@ -79,10 +79,7 @@ class Slp {
|
||||
_this.router.post('/list', _this.listBulkToken)
|
||||
_this.router.get('/balancesForAddress/:address', _this.balancesForAddress)
|
||||
_this.router.post('/balancesForAddress', _this.balancesForAddressBulk)
|
||||
_this.router.get(
|
||||
'/balancesForToken/:tokenId',
|
||||
_this.balancesForTokenSingle
|
||||
)
|
||||
_this.router.get('/balancesForToken/:tokenId', _this.balancesForTokenSingle)
|
||||
_this.router.get('/convert/:address', _this.convertAddressSingle)
|
||||
_this.router.post('/convert', _this.convertAddressBulk)
|
||||
_this.router.post('/validateTxid', _this.validateBulk)
|
||||
@@ -421,9 +418,8 @@ class Slp {
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
'graphTxn.outputs.address': _this.bchjs.SLP.Address.toSLPAddress(
|
||||
address
|
||||
),
|
||||
'graphTxn.outputs.address':
|
||||
_this.bchjs.SLP.Address.toSLPAddress(address),
|
||||
'graphTxn.outputs.status': 'UNSPENT',
|
||||
'graphTxn.outputs.slpAmount': { $gte: 0 }
|
||||
}
|
||||
@@ -634,9 +630,8 @@ class Slp {
|
||||
},
|
||||
{
|
||||
$match: {
|
||||
'graphTxn.outputs.address': _this.bchjs.SLP.Address.toSLPAddress(
|
||||
address
|
||||
),
|
||||
'graphTxn.outputs.address':
|
||||
_this.bchjs.SLP.Address.toSLPAddress(address),
|
||||
'graphTxn.outputs.status': 'UNSPENT',
|
||||
'graphTxn.outputs.slpAmount': { $gte: 0 }
|
||||
}
|
||||
@@ -1756,8 +1751,8 @@ class Slp {
|
||||
const password = SLPDB_PASS_GP
|
||||
const combined = `${username}:${password}`
|
||||
// console.log(`combined: ${combined}`)
|
||||
var base64Credential = Buffer.from(combined).toString('base64')
|
||||
var readyCredential = `Basic ${base64Credential}`
|
||||
const base64Credential = Buffer.from(combined).toString('base64')
|
||||
const readyCredential = `Basic ${base64Credential}`
|
||||
|
||||
const options = {
|
||||
headers: {
|
||||
@@ -1776,8 +1771,8 @@ class Slp {
|
||||
const password = SLPDB_PASS_WL
|
||||
const combined = `${username}:${password}`
|
||||
// console.log(`combined: ${combined}`)
|
||||
var base64Credential = Buffer.from(combined).toString('base64')
|
||||
var readyCredential = `Basic ${base64Credential}`
|
||||
const base64Credential = Buffer.from(combined).toString('base64')
|
||||
const readyCredential = `Basic ${base64Credential}`
|
||||
|
||||
const options = {
|
||||
headers: {
|
||||
@@ -1806,6 +1801,7 @@ class Slp {
|
||||
tokenOutputs.map((x) => {
|
||||
const string = parseFloat(x.amount) * 100000000
|
||||
sendOutputs.push(string.toString())
|
||||
return 1 // Making the linter happy
|
||||
})
|
||||
|
||||
// Because you are not using Insight API indexer, you do not get the
|
||||
|
||||
@@ -6,24 +6,26 @@
|
||||
|
||||
'use strict'
|
||||
|
||||
var winston = require('winston')
|
||||
const winston = require('winston')
|
||||
require('winston-daily-rotate-file')
|
||||
|
||||
var NETWORK = process.env.NETWORK
|
||||
const NETWORK = process.env.NETWORK
|
||||
|
||||
// Default 1 Megabyte
|
||||
var LOG_MAX_SIZE = process.env.LOG_MAX_SIZE ? process.env.LOG_MAX_SIZE : '1m'
|
||||
const LOG_MAX_SIZE = process.env.LOG_MAX_SIZE ? process.env.LOG_MAX_SIZE : '1m'
|
||||
|
||||
// Default 5 days.
|
||||
// This was causing a problem with popularity. Creating over a gigabyte of files.
|
||||
// var LOG_MAX_FILES = process.env.LOG_MAX_FILES ? process.env.LOG_MAX_FILES : '5d'
|
||||
|
||||
// 250 files @ 1Meg each = 250 megs
|
||||
var LOG_MAX_FILES = process.env.LOG_MAX_FILES ? process.env.LOG_MAX_FILES : '250'
|
||||
const LOG_MAX_FILES = process.env.LOG_MAX_FILES
|
||||
? process.env.LOG_MAX_FILES
|
||||
: '250'
|
||||
|
||||
// Configure daily-rotation transport.
|
||||
var transport = new winston.transports.DailyRotateFile({
|
||||
filename: `${__dirname}/../../logs/rest-${NETWORK}-%DATE%.log`,
|
||||
const transport = new winston.transports.DailyRotateFile({
|
||||
filename: `${__dirname.toString()}/../../logs/rest-${NETWORK}-%DATE%.log`,
|
||||
datePattern: 'YYYY-MM-DD',
|
||||
zippedArchive: false,
|
||||
maxSize: LOG_MAX_SIZE,
|
||||
@@ -39,7 +41,7 @@ transport.on('rotate', function (oldFilename, newFilename) {
|
||||
})
|
||||
|
||||
// This controls what goes into the log FILES
|
||||
var wlogger = winston.createLogger({
|
||||
const wlogger = winston.createLogger({
|
||||
level: 'verbose',
|
||||
format: winston.format.json(),
|
||||
transports: [
|
||||
|
||||
Reference in New Issue
Block a user