mirror of
https://github.com/Permissionless-Software-Foundation/psf-bch-api-base.git
synced 2026-09-21 16:52:00 -07:00
fix(startup): Ensuring REST URL is passed correctly to bch-js on startup
This commit is contained in:
Generated
+106
-57
@@ -9,7 +9,7 @@
|
||||
"version": "7.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@psf/bch-js": "6.8.3",
|
||||
"@psf/bch-js": "/home/trout/work/psf/code/api-dev/bch-js",
|
||||
"axios": "1.7.7",
|
||||
"cors": "2.8.5",
|
||||
"dotenv": "16.3.1",
|
||||
@@ -30,6 +30,51 @@
|
||||
"standard": "17.1.2"
|
||||
}
|
||||
},
|
||||
"../bch-js": {
|
||||
"name": "@psf/bch-js",
|
||||
"version": "7.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chris.troutner/bip32-utils": "1.0.5",
|
||||
"@psf/bip21": "2.0.1",
|
||||
"@psf/bitcoincash-ops": "2.0.0",
|
||||
"@psf/bitcoincashjs-lib": "4.0.3",
|
||||
"@psf/coininfo": "4.0.0",
|
||||
"axios": "1.13.2",
|
||||
"bc-bip68": "1.0.5",
|
||||
"bchaddrjs-slp": "0.2.14",
|
||||
"bigi": "1.4.2",
|
||||
"bignumber.js": "9.3.1",
|
||||
"bip-schnorr": "0.6.7",
|
||||
"bip38": "3.1.1",
|
||||
"bip39": "3.1.0",
|
||||
"bip66": "1.1.5",
|
||||
"bitcoinjs-message": "2.2.0",
|
||||
"bs58": "4.0.1",
|
||||
"ecashaddrjs": "1.0.7",
|
||||
"ini": "6.0.0",
|
||||
"randombytes": "2.1.0",
|
||||
"safe-buffer": "5.2.1",
|
||||
"satoshi-bitcoin": "1.0.5",
|
||||
"slp-mdm": "0.0.7",
|
||||
"slp-parser": "0.0.4",
|
||||
"wif": "2.0.6",
|
||||
"x402-bch-axios": "1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"apidoc": "1.2.0",
|
||||
"assert": "2.1.0",
|
||||
"c8": "10.1.3",
|
||||
"chai": "4.1.2",
|
||||
"husky": "4.3.8",
|
||||
"lodash.clonedeep": "4.5.0",
|
||||
"mocha": "11.7.5",
|
||||
"nyc": "15.1.0",
|
||||
"semantic-release": "24.2.9",
|
||||
"sinon": "9.2.2",
|
||||
"standard": "17.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@bcoe/v8-coverage": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz",
|
||||
@@ -805,62 +850,8 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js": {
|
||||
"version": "6.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-6.8.3.tgz",
|
||||
"integrity": "sha512-LhbfRg9c5GFddNyEHvZ7QWB61452hZ8xygaZ8JJHw8HJBMvuURwaHItv971A6LvO8nl4Fcf9GPTJ5YIggnGhVQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chris.troutner/bip32-utils": "1.0.5",
|
||||
"@psf/bip21": "2.0.1",
|
||||
"@psf/bitcoincash-ops": "2.0.0",
|
||||
"@psf/bitcoincashjs-lib": "4.0.3",
|
||||
"@psf/coininfo": "4.0.0",
|
||||
"axios": "1.12.2",
|
||||
"bc-bip68": "1.0.5",
|
||||
"bchaddrjs-slp": "0.2.5",
|
||||
"bigi": "1.4.2",
|
||||
"bignumber.js": "9.0.0",
|
||||
"bip-schnorr": "0.3.0",
|
||||
"bip38": "2.0.2",
|
||||
"bip39": "3.0.2",
|
||||
"bip66": "1.1.5",
|
||||
"bitcoinjs-message": "2.0.0",
|
||||
"bs58": "4.0.1",
|
||||
"ecashaddrjs": "1.0.7",
|
||||
"ini": "1.3.8",
|
||||
"randombytes": "2.0.6",
|
||||
"safe-buffer": "5.1.2",
|
||||
"satoshi-bitcoin": "1.0.4",
|
||||
"slp-mdm": "0.0.6",
|
||||
"slp-parser": "0.0.4",
|
||||
"wif": "2.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/axios": {
|
||||
"version": "1.12.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
|
||||
"integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.4",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/randombytes": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz",
|
||||
"integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"license": "MIT"
|
||||
"resolved": "../bch-js",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@psf/bip21": {
|
||||
"version": "2.0.1",
|
||||
@@ -10104,6 +10095,64 @@
|
||||
"@psf/bch-js": "6.8.3"
|
||||
}
|
||||
},
|
||||
"node_modules/x402-bch-express/node_modules/@psf/bch-js": {
|
||||
"version": "6.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-6.8.3.tgz",
|
||||
"integrity": "sha512-LhbfRg9c5GFddNyEHvZ7QWB61452hZ8xygaZ8JJHw8HJBMvuURwaHItv971A6LvO8nl4Fcf9GPTJ5YIggnGhVQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chris.troutner/bip32-utils": "1.0.5",
|
||||
"@psf/bip21": "2.0.1",
|
||||
"@psf/bitcoincash-ops": "2.0.0",
|
||||
"@psf/bitcoincashjs-lib": "4.0.3",
|
||||
"@psf/coininfo": "4.0.0",
|
||||
"axios": "1.12.2",
|
||||
"bc-bip68": "1.0.5",
|
||||
"bchaddrjs-slp": "0.2.5",
|
||||
"bigi": "1.4.2",
|
||||
"bignumber.js": "9.0.0",
|
||||
"bip-schnorr": "0.3.0",
|
||||
"bip38": "2.0.2",
|
||||
"bip39": "3.0.2",
|
||||
"bip66": "1.1.5",
|
||||
"bitcoinjs-message": "2.0.0",
|
||||
"bs58": "4.0.1",
|
||||
"ecashaddrjs": "1.0.7",
|
||||
"ini": "1.3.8",
|
||||
"randombytes": "2.0.6",
|
||||
"safe-buffer": "5.1.2",
|
||||
"satoshi-bitcoin": "1.0.4",
|
||||
"slp-mdm": "0.0.6",
|
||||
"slp-parser": "0.0.4",
|
||||
"wif": "2.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/x402-bch-express/node_modules/axios": {
|
||||
"version": "1.12.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
|
||||
"integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.4",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/x402-bch-express/node_modules/randombytes": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz",
|
||||
"integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/x402-bch-express/node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/xdg-basedir": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz",
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
"license": "MIT",
|
||||
"description": "REST API proxy to Bitcoin Cash infrastructure",
|
||||
"dependencies": {
|
||||
"@psf/bch-js": "6.8.3",
|
||||
"@psf/bch-js": "/home/trout/work/psf/code/api-dev/bch-js",
|
||||
"axios": "1.7.7",
|
||||
"cors": "2.8.5",
|
||||
"dotenv": "16.3.1",
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
|
||||
import wlogger from '../../../adapters/wlogger.js'
|
||||
import BCHJS from '@psf/bch-js'
|
||||
import config from '../../../config/index.js'
|
||||
|
||||
const bchjs = new BCHJS()
|
||||
const bchjs = new BCHJS({ restURL: config.restURL })
|
||||
|
||||
class FulcrumRESTController {
|
||||
constructor (localConfig = {}) {
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
|
||||
import wlogger from '../../../adapters/wlogger.js'
|
||||
import BCHJS from '@psf/bch-js'
|
||||
import config from '../../../config/index.js'
|
||||
|
||||
const bchjs = new BCHJS()
|
||||
const bchjs = new BCHJS({ restURL: config.restURL })
|
||||
|
||||
class SlpRESTController {
|
||||
constructor (localConfig = {}) {
|
||||
@@ -201,6 +202,7 @@ class SlpRESTController {
|
||||
const result = await this.slpUseCases.getTokenData({ tokenId, withTxHistory })
|
||||
return res.status(200).json(result)
|
||||
} catch (err) {
|
||||
console.log('Error in /v6/slp/token/data getTokenData(): ', err)
|
||||
return this.handleError(err, res)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
|
||||
import wlogger from '../adapters/wlogger.js'
|
||||
import BCHJS from '@psf/bch-js'
|
||||
import config from '../config/index.js'
|
||||
|
||||
const bchjs = new BCHJS()
|
||||
const bchjs = new BCHJS({ restURL: config.restURL })
|
||||
|
||||
class FulcrumUseCases {
|
||||
constructor (localConfig = {}) {
|
||||
@@ -53,7 +54,14 @@ class FulcrumUseCases {
|
||||
}
|
||||
|
||||
async getTransactionDetails ({ txid }) {
|
||||
return this.fulcrum.get(`electrumx/tx/data/${txid}`)
|
||||
try {
|
||||
const response = await this.fulcrum.get(`electrumx/tx/data/${txid}`)
|
||||
console.log(`getTransactionDetails() TXID ${txid}: ${JSON.stringify(response, null, 2)}`)
|
||||
return response
|
||||
} catch (err) {
|
||||
wlogger.error('Error in FulcrumUseCases.getTransactionDetails()', err)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
async getTransactionDetailsBulk ({ txids, verbose }) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import SlpTokenMedia from 'slp-token-media'
|
||||
import axios from 'axios'
|
||||
import config from '../config/index.js'
|
||||
|
||||
const bchjs = new BCHJS()
|
||||
const bchjs = new BCHJS({ restURL: config.restURL })
|
||||
|
||||
class SlpUseCases {
|
||||
constructor (localConfig = {}) {
|
||||
@@ -259,6 +259,7 @@ class SlpUseCases {
|
||||
|
||||
return mutableCid
|
||||
} catch (err) {
|
||||
console.log('Error in SlpUseCases.getMutableCid()', err)
|
||||
wlogger.error('Error in SlpUseCases.getMutableCid()', err)
|
||||
return false
|
||||
}
|
||||
@@ -271,7 +272,9 @@ class SlpUseCases {
|
||||
}
|
||||
|
||||
// Get transaction data
|
||||
console.log('Decoding OP_RETURN for TXID: ', txid)
|
||||
const txData = await this.bchjs.Electrumx.txData(txid)
|
||||
console.log(`TXID ${txid}: ${JSON.stringify(txData, null, 2)}`)
|
||||
let data = false
|
||||
|
||||
// Map the vout of the transaction in search of an OP_RETURN
|
||||
@@ -291,6 +294,7 @@ class SlpUseCases {
|
||||
|
||||
return data
|
||||
} catch (error) {
|
||||
console.log('Error in SlpUseCases.decodeOpReturn()', error)
|
||||
wlogger.error('Error in SlpUseCases.decodeOpReturn()', error)
|
||||
throw error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user