mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
Merge pull request #170 from Permissionless-Software-Foundation/ct-unstable
Updating linting dependencies. fixing lint errors.
This commit is contained in:
Generated
+10732
-11588
File diff suppressed because it is too large
Load Diff
+7
-7
@@ -62,19 +62,19 @@
|
|||||||
"bignumber.js": "^9.0.0",
|
"bignumber.js": "^9.0.0",
|
||||||
"chai": "^4.1.2",
|
"chai": "^4.1.2",
|
||||||
"coveralls": "^3.0.2",
|
"coveralls": "^3.0.2",
|
||||||
"eslint": "5.16.0",
|
"eslint": "7.17.0",
|
||||||
"eslint-config-prettier": "^6.0.0",
|
"eslint-config-prettier": "7.1.0",
|
||||||
"eslint-config-standard": "^13.0.1",
|
"eslint-config-standard": "16.0.2",
|
||||||
"eslint-plugin-prettier": "^3.1.0",
|
"eslint-plugin-node": "11.1.0",
|
||||||
"eslint-plugin-standard": "^4.0.0",
|
"eslint-plugin-prettier": "3.3.1",
|
||||||
|
"eslint-plugin-standard": "4.0.0",
|
||||||
"fs-extra": "^9.0.0",
|
"fs-extra": "^9.0.0",
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
"nock": "^13.0.5",
|
"nock": "^13.0.5",
|
||||||
"nyc": "^15.0.0",
|
"nyc": "^15.0.0",
|
||||||
"prettier": "^2.0.0",
|
|
||||||
"semantic-release": "^17.4.2",
|
"semantic-release": "^17.4.2",
|
||||||
"sinon": "^9.0.0",
|
"sinon": "^9.0.0",
|
||||||
"standard": "^14.3.1"
|
"standard": "^16.0.4"
|
||||||
},
|
},
|
||||||
"release": {
|
"release": {
|
||||||
"publish": [
|
"publish": [
|
||||||
|
|||||||
+6
-3
@@ -100,7 +100,7 @@ app.set('views', path.join(__dirname, 'views'))
|
|||||||
app.set('view engine', 'jade')
|
app.set('view engine', 'jade')
|
||||||
|
|
||||||
// Mount the docs
|
// 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.
|
// Log each request to the console with IP addresses.
|
||||||
// app.use(logger("dev"))
|
// app.use(logger("dev"))
|
||||||
@@ -200,6 +200,9 @@ app.use(`/${v5prefix}/` + 'ninsight', ninsight.router)
|
|||||||
|
|
||||||
app.use(`/${v5prefix}/` + 'bcash/slp', bcashSLP.router)
|
app.use(`/${v5prefix}/` + 'bcash/slp', bcashSLP.router)
|
||||||
|
|
||||||
|
// Daniel:
|
||||||
|
// app.use(`/${v5prefix}/` + 'psfslp', psfSlp.router)
|
||||||
|
|
||||||
// catch 404 and forward to error handler
|
// catch 404 and forward to error handler
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
const err = {
|
const err = {
|
||||||
@@ -285,11 +288,11 @@ function onError (error) {
|
|||||||
case 'EACCES':
|
case 'EACCES':
|
||||||
console.error(`${bind} requires elevated privileges`)
|
console.error(`${bind} requires elevated privileges`)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
// break
|
break
|
||||||
case 'EADDRINUSE':
|
case 'EADDRINUSE':
|
||||||
console.error(`${bind} is already in use`)
|
console.error(`${bind} is already in use`)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
// break
|
break
|
||||||
default:
|
default:
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,8 +105,8 @@ class Slpdb {
|
|||||||
const username = 'BITBOX'
|
const username = 'BITBOX'
|
||||||
const password = SLPDB_PASS
|
const password = SLPDB_PASS
|
||||||
const combined = `${username}:${password}`
|
const combined = `${username}:${password}`
|
||||||
var base64Credential = Buffer.from(combined).toString('base64')
|
const base64Credential = Buffer.from(combined).toString('base64')
|
||||||
var readyCredential = `Basic ${base64Credential}`
|
const readyCredential = `Basic ${base64Credential}`
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
+913
-917
File diff suppressed because it is too large
Load Diff
@@ -433,7 +433,7 @@ class UtilRoute {
|
|||||||
|
|
||||||
// Loop through each input and sign
|
// Loop through each input and sign
|
||||||
let redeemScript
|
let redeemScript
|
||||||
for (var i = 0; i < utxos.length; i++) {
|
for (let i = 0; i < utxos.length; i++) {
|
||||||
const utxo = utxos[i]
|
const utxo = utxos[i]
|
||||||
|
|
||||||
transactionBuilder.sign(
|
transactionBuilder.sign(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Electrum API route
|
bcash node routes for working with SLP tokens.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
@@ -33,14 +33,6 @@ class BcashSlp {
|
|||||||
this.bchjs = bchjs
|
this.bchjs = bchjs
|
||||||
// _this.bitcore = bitcore
|
// _this.bitcore = bitcore
|
||||||
|
|
||||||
this.bcashServer = process.env.BCASH_SERVER
|
|
||||||
if (!this.bcashServer) {
|
|
||||||
// console.warn('FULCRUM_API env var not set. Can not connect to Fulcrum indexer.')
|
|
||||||
throw new Error(
|
|
||||||
'BCASH_SERVER env var not set. Can not connect to bcash full node.'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.router = router
|
this.router = router
|
||||||
this.router.get('/', this.root)
|
this.router.get('/', this.root)
|
||||||
this.router.get('/utxos/:address', this.getUtxos)
|
this.router.get('/utxos/:address', this.getUtxos)
|
||||||
@@ -63,6 +55,14 @@ class BcashSlp {
|
|||||||
try {
|
try {
|
||||||
const address = req.params.address
|
const address = req.params.address
|
||||||
|
|
||||||
|
this.bcashServer = process.env.BCASH_SERVER
|
||||||
|
if (!this.bcashServer) {
|
||||||
|
// console.warn('FULCRUM_API env var not set. Can not connect to Fulcrum indexer.')
|
||||||
|
throw new Error(
|
||||||
|
'BCASH_SERVER env var not set. Can not connect to bcash full node.'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Reject if address is an array.
|
// Reject if address is an array.
|
||||||
if (Array.isArray(address)) {
|
if (Array.isArray(address)) {
|
||||||
res.status(400)
|
res.status(400)
|
||||||
@@ -144,6 +144,14 @@ class BcashSlp {
|
|||||||
throw new Error('tokenId must be string')
|
throw new Error('tokenId must be string')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.bcashServer = process.env.BCASH_SERVER
|
||||||
|
if (!this.bcashServer) {
|
||||||
|
// console.warn('FULCRUM_API env var not set. Can not connect to Fulcrum indexer.')
|
||||||
|
throw new Error(
|
||||||
|
'BCASH_SERVER env var not set. Can not connect to bcash full node.'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const result = await _this.axios.get(
|
const result = await _this.axios.get(
|
||||||
`${_this.bcashServer}token/${tokenId}`
|
`${_this.bcashServer}token/${tokenId}`
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
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')
|
||||||
|
|
||||||
|
class PsfSlpIndexer {
|
||||||
|
constructor () {
|
||||||
|
// Encapsulate dependencies
|
||||||
|
this.axios = axios
|
||||||
|
this.router = router
|
||||||
|
|
||||||
|
// Define routes
|
||||||
|
// this.router.get('/', this.root)
|
||||||
|
// this.router.get('/status', this.getStatus)
|
||||||
|
// this.router.post('/address', this.getAddress)
|
||||||
|
// this.router.post('/txid', this.getTxid)
|
||||||
|
// this.routner.post('/token', this.getTokenStats)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = PsfSlpIndexer
|
||||||
@@ -105,8 +105,8 @@ class Slpdb {
|
|||||||
const username = 'BITBOX'
|
const username = 'BITBOX'
|
||||||
const password = SLPDB_PASS
|
const password = SLPDB_PASS
|
||||||
const combined = `${username}:${password}`
|
const combined = `${username}:${password}`
|
||||||
var base64Credential = Buffer.from(combined).toString('base64')
|
const base64Credential = Buffer.from(combined).toString('base64')
|
||||||
var readyCredential = `Basic ${base64Credential}`
|
const readyCredential = `Basic ${base64Credential}`
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
+913
-917
File diff suppressed because it is too large
Load Diff
@@ -6,24 +6,26 @@
|
|||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
var winston = require('winston')
|
const winston = require('winston')
|
||||||
require('winston-daily-rotate-file')
|
require('winston-daily-rotate-file')
|
||||||
|
|
||||||
var NETWORK = process.env.NETWORK
|
const NETWORK = process.env.NETWORK
|
||||||
|
|
||||||
// Default 1 Megabyte
|
// 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.
|
// Default 5 days.
|
||||||
// This was causing a problem with popularity. Creating over a gigabyte of files.
|
// 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'
|
// var LOG_MAX_FILES = process.env.LOG_MAX_FILES ? process.env.LOG_MAX_FILES : '5d'
|
||||||
|
|
||||||
// 250 files @ 1Meg each = 250 megs
|
// 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.
|
// Configure daily-rotation transport.
|
||||||
var transport = new winston.transports.DailyRotateFile({
|
const transport = new winston.transports.DailyRotateFile({
|
||||||
filename: `${__dirname}/../../logs/rest-${NETWORK}-%DATE%.log`,
|
filename: `${__dirname.toString()}/../../logs/rest-${NETWORK}-%DATE%.log`,
|
||||||
datePattern: 'YYYY-MM-DD',
|
datePattern: 'YYYY-MM-DD',
|
||||||
zippedArchive: false,
|
zippedArchive: false,
|
||||||
maxSize: LOG_MAX_SIZE,
|
maxSize: LOG_MAX_SIZE,
|
||||||
@@ -39,7 +41,7 @@ transport.on('rotate', function (oldFilename, newFilename) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// This controls what goes into the log FILES
|
// This controls what goes into the log FILES
|
||||||
var wlogger = winston.createLogger({
|
const wlogger = winston.createLogger({
|
||||||
level: 'verbose',
|
level: 'verbose',
|
||||||
format: winston.format.json(),
|
format: winston.format.json(),
|
||||||
transports: [
|
transports: [
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.addresses = testArray
|
req.body.addresses = testArray
|
||||||
|
|
||||||
@@ -596,7 +596,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if txid array is too large', async () => {
|
it('should throw 400 error if txid array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -843,7 +843,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if heights array is too large', async () => {
|
it('should throw 400 error if heights array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.heights = testArray
|
req.body.heights = testArray
|
||||||
|
|
||||||
@@ -1206,7 +1206,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.addresses = testArray
|
req.body.addresses = testArray
|
||||||
|
|
||||||
@@ -1494,7 +1494,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.addresses = testArray
|
req.body.addresses = testArray
|
||||||
|
|
||||||
@@ -1781,7 +1781,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.addresses = testArray
|
req.body.addresses = testArray
|
||||||
|
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ describe('#BlockchainRouter', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.hashes = testArray
|
req.body.hashes = testArray
|
||||||
|
|
||||||
@@ -1006,7 +1006,7 @@ describe('#BlockchainRouter', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -1525,7 +1525,7 @@ describe('#BlockchainRouter', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -1729,7 +1729,7 @@ describe('#BlockchainRouter', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.proofs = testArray
|
req.body.proofs = testArray
|
||||||
|
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ describe('#Raw-Transactions', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if hexes array is too large', async () => {
|
it('should throw 400 error if hexes array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.hexes = testArray
|
req.body.hexes = testArray
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@ describe('#Raw-Transactions', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if hexes array is too large', async () => {
|
it('should throw 400 error if hexes array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.hexes = testArray
|
req.body.hexes = testArray
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ describe('#Raw-Transactions', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if txids array is too large', async () => {
|
it('should throw 400 error if txids array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -885,7 +885,7 @@ describe('#Raw-Transactions', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if hexs array is too large', async () => {
|
it('should throw 400 error if hexs array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.hexes = testArray
|
req.body.hexes = testArray
|
||||||
|
|
||||||
|
|||||||
+13
-23
@@ -36,7 +36,7 @@ if (process.env.TEST === 'unit') {
|
|||||||
process.env.BITDB_URL = 'http://fakeurl/'
|
process.env.BITDB_URL = 'http://fakeurl/'
|
||||||
process.env.BITCOINCOM_BASEURL = 'http://fakeurl/'
|
process.env.BITCOINCOM_BASEURL = 'http://fakeurl/'
|
||||||
process.env.SLPDB_URL = 'http://fakeurl/'
|
process.env.SLPDB_URL = 'http://fakeurl/'
|
||||||
mockServerUrl = 'http://fakeurl'
|
// mockServerUrl = 'http://fakeurl'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare the slpRoute for stubbing dependcies on slpjs.
|
// Prepare the slpRoute for stubbing dependcies on slpjs.
|
||||||
@@ -577,7 +577,7 @@ describe('#SLP', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if array is too large', async () => {
|
it('should throw 400 error if array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -787,7 +787,7 @@ describe('#SLP', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if array is too large', async () => {
|
it('should throw 400 error if array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -1406,8 +1406,7 @@ describe('#SLP', () => {
|
|||||||
|
|
||||||
it('should throw error if Array is too long', async () => {
|
it('should throw error if Array is too long', async () => {
|
||||||
const utxo = {
|
const utxo = {
|
||||||
txid:
|
txid: 'bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90',
|
||||||
'bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
amount: 0.00002015,
|
amount: 0.00002015,
|
||||||
satoshis: 2015,
|
satoshis: 2015,
|
||||||
@@ -1435,8 +1434,7 @@ describe('#SLP', () => {
|
|||||||
{
|
{
|
||||||
utxos: [
|
utxos: [
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
value: '6816',
|
value: '6816',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1444,8 +1442,7 @@ describe('#SLP', () => {
|
|||||||
satoshis: 6816
|
satoshis: 6816
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 2,
|
vout: 2,
|
||||||
value: '546',
|
value: '546',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1459,8 +1456,7 @@ describe('#SLP', () => {
|
|||||||
// Mock the external network call.
|
// Mock the external network call.
|
||||||
sandbox.stub(slpRoute.bchjs.SLP.Utils, 'tokenUtxoDetails').resolves([
|
sandbox.stub(slpRoute.bchjs.SLP.Utils, 'tokenUtxoDetails').resolves([
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
value: '6816',
|
value: '6816',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1469,8 +1465,7 @@ describe('#SLP', () => {
|
|||||||
isValid: false
|
isValid: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 2,
|
vout: 2,
|
||||||
value: '546',
|
value: '546',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1581,8 +1576,7 @@ describe('#SLP', () => {
|
|||||||
|
|
||||||
it('should throw error if Array is too long', async () => {
|
it('should throw error if Array is too long', async () => {
|
||||||
const utxo = {
|
const utxo = {
|
||||||
txid:
|
txid: 'bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90',
|
||||||
'bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
amount: 0.00002015,
|
amount: 0.00002015,
|
||||||
satoshis: 2015,
|
satoshis: 2015,
|
||||||
@@ -1610,8 +1604,7 @@ describe('#SLP', () => {
|
|||||||
{
|
{
|
||||||
utxos: [
|
utxos: [
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
value: '6816',
|
value: '6816',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1619,8 +1612,7 @@ describe('#SLP', () => {
|
|||||||
satoshis: 6816
|
satoshis: 6816
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 2,
|
vout: 2,
|
||||||
value: '546',
|
value: '546',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1634,8 +1626,7 @@ describe('#SLP', () => {
|
|||||||
// Mock the external network call.
|
// Mock the external network call.
|
||||||
sandbox.stub(slpRoute.bchjs.SLP.Utils, 'tokenUtxoDetailsWL').resolves([
|
sandbox.stub(slpRoute.bchjs.SLP.Utils, 'tokenUtxoDetailsWL').resolves([
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
value: '6816',
|
value: '6816',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1644,8 +1635,7 @@ describe('#SLP', () => {
|
|||||||
isValid: false
|
isValid: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 2,
|
vout: 2,
|
||||||
value: '546',
|
value: '546',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
|
|||||||
+1
-1
@@ -203,7 +203,7 @@ describe('#Util', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.addresses = testArray
|
req.body.addresses = testArray
|
||||||
|
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.addresses = testArray
|
req.body.addresses = testArray
|
||||||
|
|
||||||
@@ -485,7 +485,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.addresses = testArray
|
req.body.addresses = testArray
|
||||||
|
|
||||||
@@ -729,7 +729,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -1065,7 +1065,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if heights array is too large', async () => {
|
it('should throw 400 error if heights array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.heights = testArray
|
req.body.heights = testArray
|
||||||
|
|
||||||
@@ -1261,7 +1261,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.addresses = testArray
|
req.body.addresses = testArray
|
||||||
|
|
||||||
@@ -1503,7 +1503,7 @@ describe('#Electrumx', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.addresses = testArray
|
req.body.addresses = testArray
|
||||||
|
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ describe('#BlockchainRouter', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.hashes = testArray
|
req.body.hashes = testArray
|
||||||
|
|
||||||
@@ -1006,7 +1006,7 @@ describe('#BlockchainRouter', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -1525,7 +1525,7 @@ describe('#BlockchainRouter', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -1729,7 +1729,7 @@ describe('#BlockchainRouter', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.proofs = testArray
|
req.body.proofs = testArray
|
||||||
|
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ describe('#Raw-Transactions', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if hexes array is too large', async () => {
|
it('should throw 400 error if hexes array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.hexes = testArray
|
req.body.hexes = testArray
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@ describe('#Raw-Transactions', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if hexes array is too large', async () => {
|
it('should throw 400 error if hexes array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.hexes = testArray
|
req.body.hexes = testArray
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ describe('#Raw-Transactions', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if txids array is too large', async () => {
|
it('should throw 400 error if txids array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -885,7 +885,7 @@ describe('#Raw-Transactions', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if hexs array is too large', async () => {
|
it('should throw 400 error if hexs array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.hexes = testArray
|
req.body.hexes = testArray
|
||||||
|
|
||||||
|
|||||||
+13
-23
@@ -36,7 +36,7 @@ if (process.env.TEST === 'unit') {
|
|||||||
process.env.BITDB_URL = 'http://fakeurl/'
|
process.env.BITDB_URL = 'http://fakeurl/'
|
||||||
process.env.BITCOINCOM_BASEURL = 'http://fakeurl/'
|
process.env.BITCOINCOM_BASEURL = 'http://fakeurl/'
|
||||||
process.env.SLPDB_URL = 'http://fakeurl/'
|
process.env.SLPDB_URL = 'http://fakeurl/'
|
||||||
mockServerUrl = 'http://fakeurl'
|
// mockServerUrl = 'http://fakeurl'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare the slpRoute for stubbing dependcies on slpjs.
|
// Prepare the slpRoute for stubbing dependcies on slpjs.
|
||||||
@@ -577,7 +577,7 @@ describe('#SLP', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if array is too large', async () => {
|
it('should throw 400 error if array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -787,7 +787,7 @@ describe('#SLP', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if array is too large', async () => {
|
it('should throw 400 error if array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.txids = testArray
|
req.body.txids = testArray
|
||||||
|
|
||||||
@@ -1406,8 +1406,7 @@ describe('#SLP', () => {
|
|||||||
|
|
||||||
it('should throw error if Array is too long', async () => {
|
it('should throw error if Array is too long', async () => {
|
||||||
const utxo = {
|
const utxo = {
|
||||||
txid:
|
txid: 'bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90',
|
||||||
'bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
amount: 0.00002015,
|
amount: 0.00002015,
|
||||||
satoshis: 2015,
|
satoshis: 2015,
|
||||||
@@ -1435,8 +1434,7 @@ describe('#SLP', () => {
|
|||||||
{
|
{
|
||||||
utxos: [
|
utxos: [
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
value: '6816',
|
value: '6816',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1444,8 +1442,7 @@ describe('#SLP', () => {
|
|||||||
satoshis: 6816
|
satoshis: 6816
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 2,
|
vout: 2,
|
||||||
value: '546',
|
value: '546',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1459,8 +1456,7 @@ describe('#SLP', () => {
|
|||||||
// Mock the external network call.
|
// Mock the external network call.
|
||||||
sandbox.stub(slpRoute.bchjs.SLP.Utils, 'tokenUtxoDetails').resolves([
|
sandbox.stub(slpRoute.bchjs.SLP.Utils, 'tokenUtxoDetails').resolves([
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
value: '6816',
|
value: '6816',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1469,8 +1465,7 @@ describe('#SLP', () => {
|
|||||||
isValid: false
|
isValid: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 2,
|
vout: 2,
|
||||||
value: '546',
|
value: '546',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1581,8 +1576,7 @@ describe('#SLP', () => {
|
|||||||
|
|
||||||
it('should throw error if Array is too long', async () => {
|
it('should throw error if Array is too long', async () => {
|
||||||
const utxo = {
|
const utxo = {
|
||||||
txid:
|
txid: 'bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90',
|
||||||
'bd158c564dd4ef54305b14f44f8e94c44b649f246dab14bcb42fb0d0078b8a90',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
amount: 0.00002015,
|
amount: 0.00002015,
|
||||||
satoshis: 2015,
|
satoshis: 2015,
|
||||||
@@ -1610,8 +1604,7 @@ describe('#SLP', () => {
|
|||||||
{
|
{
|
||||||
utxos: [
|
utxos: [
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
value: '6816',
|
value: '6816',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1619,8 +1612,7 @@ describe('#SLP', () => {
|
|||||||
satoshis: 6816
|
satoshis: 6816
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 2,
|
vout: 2,
|
||||||
value: '546',
|
value: '546',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1634,8 +1626,7 @@ describe('#SLP', () => {
|
|||||||
// Mock the external network call.
|
// Mock the external network call.
|
||||||
sandbox.stub(slpRoute.bchjs.SLP.Utils, 'tokenUtxoDetailsWL').resolves([
|
sandbox.stub(slpRoute.bchjs.SLP.Utils, 'tokenUtxoDetailsWL').resolves([
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 3,
|
vout: 3,
|
||||||
value: '6816',
|
value: '6816',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
@@ -1644,8 +1635,7 @@ describe('#SLP', () => {
|
|||||||
isValid: false
|
isValid: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
txid:
|
txid: 'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
||||||
'd56a2b446d8149c39ca7e06163fe8097168c3604915f631bc58777d669135a56',
|
|
||||||
vout: 2,
|
vout: 2,
|
||||||
value: '546',
|
value: '546',
|
||||||
height: 606848,
|
height: 606848,
|
||||||
|
|||||||
+1
-1
@@ -203,7 +203,7 @@ describe('#Util', () => {
|
|||||||
|
|
||||||
it('should throw 400 error if addresses array is too large', async () => {
|
it('should throw 400 error if addresses array is too large', async () => {
|
||||||
const testArray = []
|
const testArray = []
|
||||||
for (var i = 0; i < 25; i++) testArray.push('')
|
for (let i = 0; i < 25; i++) testArray.push('')
|
||||||
|
|
||||||
req.body.addresses = testArray
|
req.body.addresses = testArray
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user