mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-22 09:12:05 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f52a04a337 | ||
|
|
9aa3e5b52a | ||
|
|
71452f4834 | ||
|
|
96f1cb6ad4 | ||
|
|
36dd64db22 | ||
|
|
05de04a569 | ||
|
|
c661799095 |
@@ -16,9 +16,10 @@ export RPC_USERNAME=bitcoin
|
|||||||
export RPC_PASSWORD=password
|
export RPC_PASSWORD=password
|
||||||
|
|
||||||
# SLPDB
|
# SLPDB
|
||||||
|
export SLPDB_PASS_GP=somelongpassword
|
||||||
export SLPDB_URL=http://172.17.0.1:12300/
|
export SLPDB_URL=http://172.17.0.1:12300/
|
||||||
export SLPDB_PASS=somelongpassword
|
|
||||||
# Use the same address as SLPDB_URL if you don't have a separate whitelist server.
|
# Use the same address as SLPDB_URL if you don't have a separate whitelist server.
|
||||||
|
export SLPDB_PASS_WL=somelongpassword
|
||||||
export SLPDB_WHITELIST_URL=http://172.17.0.1:12300/
|
export SLPDB_WHITELIST_URL=http://172.17.0.1:12300/
|
||||||
# slp-api alternative SLP validator using slp-validate:
|
# slp-api alternative SLP validator using slp-validate:
|
||||||
# https://github.com/Permissionless-Software-Foundation/slp-api
|
# https://github.com/Permissionless-Software-Foundation/slp-api
|
||||||
@@ -54,4 +55,10 @@ export ANON_RATE_LIMIT=50
|
|||||||
# 10 = 100 RPM
|
# 10 = 100 RPM
|
||||||
export WHITELIST_RATE_LIMIT=10
|
export WHITELIST_RATE_LIMIT=10
|
||||||
|
|
||||||
|
# Set logging parameters
|
||||||
|
#1m means no more than 1 megabyte
|
||||||
|
export LOG_MAX_SIZE=1m
|
||||||
|
#5d means store no more than 5 days
|
||||||
|
export LOG_MAX_FILES=5d
|
||||||
|
|
||||||
npm start
|
npm start
|
||||||
|
|||||||
Generated
+330
-1225
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -29,7 +29,7 @@
|
|||||||
"node": ">=10.15.1"
|
"node": ">=10.15.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@psf/bch-js": "^4.11.1",
|
"@psf/bch-js": "^4.15.2",
|
||||||
"apidoc": "^0.26.0",
|
"apidoc": "^0.26.0",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"bitcore-lib-cash": "^8.23.1",
|
"bitcore-lib-cash": "^8.23.1",
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
"nock": "^13.0.5",
|
"nock": "^13.0.5",
|
||||||
"nyc": "^15.0.0",
|
"nyc": "^15.0.0",
|
||||||
"prettier": "^2.0.0",
|
"prettier": "^2.0.0",
|
||||||
"semantic-release": "^17.3.1",
|
"semantic-release": "^17.3.9",
|
||||||
"sinon": "^9.0.0",
|
"sinon": "^9.0.0",
|
||||||
"standard": "^14.3.1"
|
"standard": "^14.3.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -147,6 +147,11 @@ class RateLimits {
|
|||||||
|
|
||||||
wlogger.info(`origin: ${origin}`)
|
wlogger.info(`origin: ${origin}`)
|
||||||
|
|
||||||
|
const bodyOrigin = req.body.origin
|
||||||
|
if (bodyOrigin) {
|
||||||
|
console.log(`bodyOrigin: ${bodyOrigin}`)
|
||||||
|
}
|
||||||
|
|
||||||
// If the request originates from one of the approved wallet apps, then
|
// If the request originates from one of the approved wallet apps, then
|
||||||
// apply paid-access rate limits.
|
// apply paid-access rate limits.
|
||||||
// console.log(`origin: ${JSON.stringify(origin, null, 2)}`)
|
// console.log(`origin: ${JSON.stringify(origin, null, 2)}`)
|
||||||
|
|||||||
@@ -1755,7 +1755,7 @@ class Slp {
|
|||||||
const username = 'BITBOX'
|
const username = 'BITBOX'
|
||||||
const password = SLPDB_PASS_WL
|
const password = SLPDB_PASS_WL
|
||||||
const combined = `${username}:${password}`
|
const combined = `${username}:${password}`
|
||||||
console.log(`combined: ${combined}`)
|
// console.log(`combined: ${combined}`)
|
||||||
var base64Credential = Buffer.from(combined).toString('base64')
|
var base64Credential = Buffer.from(combined).toString('base64')
|
||||||
var readyCredential = `Basic ${base64Credential}`
|
var readyCredential = `Basic ${base64Credential}`
|
||||||
|
|
||||||
@@ -1979,6 +1979,9 @@ class Slp {
|
|||||||
try {
|
try {
|
||||||
const utxos = req.body.utxos
|
const utxos = req.body.utxos
|
||||||
|
|
||||||
|
console.log(`req._remoteAddress: ${req._remoteAddress}`)
|
||||||
|
const origin = req._remoteAddress
|
||||||
|
|
||||||
// Validate inputs
|
// Validate inputs
|
||||||
if (!Array.isArray(utxos)) {
|
if (!Array.isArray(utxos)) {
|
||||||
res.status(422)
|
res.status(422)
|
||||||
@@ -2013,7 +2016,7 @@ class Slp {
|
|||||||
const theseUtxos = utxos[i].utxos
|
const theseUtxos = utxos[i].utxos
|
||||||
|
|
||||||
// Get SLP token details.
|
// Get SLP token details.
|
||||||
const details = await _this.bchjs.SLP.Utils.tokenUtxoDetails(theseUtxos)
|
const details = await _this.bchjs.SLP.Utils.tokenUtxoDetails(theseUtxos, origin)
|
||||||
// console.log('details: ', details)
|
// console.log('details: ', details)
|
||||||
|
|
||||||
// Replace the original UTXO data with the hydrated data.
|
// Replace the original UTXO data with the hydrated data.
|
||||||
|
|||||||
Reference in New Issue
Block a user