Compare commits

...
9 Commits
Author SHA1 Message Date
Chris Troutner 9bf271b4c2 Merge pull request #130 from Permissionless-Software-Foundation/ct-unstable
fix(rate limits): Making internal rate limits an env var
2021-04-20 16:01:45 -07:00
Chris Troutner 82af58e8b3 fix(rate limits): Making internal rate limits an env var 2021-04-20 15:57:37 -07:00
Chris Troutner 6d00681d6e Merge pull request #129 from Permissionless-Software-Foundation/joey
Removing BigNumber reset
2021-04-13 11:07:15 -07:00
Chris Troutner 59043bc154 Updating npm dependencies 2021-04-13 10:59:42 -07:00
Chris Troutner ffb63125e1 Merge pull request #128 from BytesOfMan/remove-bignumber-decimal-mod
URGENT: Remove bignumberjs mod to 8 decimal places
2021-04-13 10:57:46 -07:00
Joey King a3cd832c63 Remove bignumberjs mod to 8 decimal places 2021-04-12 13:27:45 -07:00
Chris Troutner 12d88e8846 Adding info about rate limits. 2021-04-05 12:08:39 -07:00
Chris Troutner 17fe219773 Merge pull request #126 from Permissionless-Software-Foundation/ct-unstable
fix(error handling): Hanling 429 rate limit error better with hyrateU…
2021-04-01 08:47:44 -08:00
Chris Troutner d76c663f25 fix(error handling): Hanling 429 rate limit error better with hyrateUtxos() 2021-04-01 09:46:33 -07:00
7 changed files with 1098 additions and 2587 deletions
+5
View File
@@ -82,6 +82,11 @@ installation.
`docker-compose up`
## Rate Limits
The rate limits for [api.fullstack.cash](https://api.fullstack.cash) are controlled by a JWT token. You can increase your rate limits by [purchasing a JWT token](https://https://fullstack.cash). If you're using bch-js, [check the readme for instructions on increasing rate limits](https://github.com/Permissionless-Software-Foundation/bch-js#api-key). For interacting with bch-api directly, you can then include the JWT token in the HTTP header like this:
- `Authorization: Token <JWT token>`
## Support
Have questions? Need help? Join our community support
[Telegram channel](https://t.me/bch_js_toolkit)
+3
View File
@@ -16,6 +16,9 @@ const config = {
whitelistRateLimit: process.env.WHITELIST_RATE_LIMIT
? Number(process.env.WHITELIST_RATE_LIMIT)
: 10,
internalRateLimit: process.env.INTERNAL_RATE_LIMIT
? Number(process.env.INTERNAL_RATE_LIMIT)
: 10,
pointsPerMinute: process.env.POINTS_PER_MINUTE
? Number(process.env.POINTS_PER_MINUTE)
: 10000,
+1078 -2580
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -16,7 +16,7 @@
"dev": "nodemon ./dist/app.js",
"test": "npm run lint && npm run test-v4",
"lint": "standard --env mocha --fix",
"test-v4": "export NETWORK=mainnet && nyc --reporter=text mocha --timeout 60000 test/v4/",
"test-v4": "export NETWORK=mainnet && nyc --reporter=text mocha --exit --timeout 60000 test/v4/",
"test:integration": "mocha test/v4/integration",
"test:integration:slpdb": "mocha --timeout 25000 -g '#validate2Single' test/v4/integration/slp*.js",
"coverage": "nyc report --reporter=text-lcov | coveralls",
@@ -29,7 +29,7 @@
"node": ">=10.15.1"
},
"dependencies": {
"@psf/bch-js": "^4.17.6",
"@psf/bch-js": "^4.18.0",
"apidoc": "^0.26.0",
"axios": "^0.21.1",
"bitcore-lib-cash": "^8.23.1",
@@ -70,7 +70,7 @@
"nock": "^13.0.5",
"nyc": "^15.0.0",
"prettier": "^2.0.0",
"semantic-release": "^17.3.9",
"semantic-release": "^17.4.2",
"sinon": "^9.0.0",
"standard": "^14.3.1"
},
+1 -1
View File
@@ -56,7 +56,7 @@ const ANON_LIMITS = config.anonRateLimit
const WHITELIST_DOMAINS = config.whitelistDomains
const WHITELIST_POINTS_TO_CONSUME = config.whitelistRateLimit
const POINTS_PER_MINUTE = config.pointsPerMinute
const INTERNAL_POINTS_TO_CONSUME = 10
const INTERNAL_POINTS_TO_CONSUME = config.internalRateLimit
class RateLimits {
constructor () {
-2
View File
@@ -1780,8 +1780,6 @@ class Slp {
// Format the response from SLPDB into an object.
async formatToRestObject (slpDBFormat) {
_this.BigNumber.set({ DECIMAL_PLACES: 8 })
// console.log(`slpDBFormat.data: ${JSON.stringify(slpDBFormat.data, null, 2)}`)
const transaction = slpDBFormat.data.u.length
+8 -1
View File
@@ -154,16 +154,23 @@ class RouteUtils {
}
}
// Handle 429 errors thrown by nginx
// Handle 429 errors
if (err.error) {
console.log('decodeError: err: ', err)
// Error thrown by nginx (usually the SLPDB load balancer.)
if (err.error.includes('429 Too Many Requests')) {
const internalMsg =
'429 error thrown by nginx caught by route-utils.js/decodeError()'
console.error(internalMsg)
wlogger.error(internalMsg)
return {
msg: '429 Too Many Requests',
status: 429
}
} else if (err.error.includes('Too many requests')) {
// Error is being thrown by bch-api rate limit middleware.
return {
msg: '429 Too Many Requests',
status: 429