Repository navigation
Publish as @runonflux/insight-api 2.0.0 on Node 24 - #41
Merged
Merged
Conversation
The suite stopped loading: controllers take an options object and a node logger, and every fixture was Bitcoin data that the Flux bitcore-lib rejects. Fixtures now use Flux addresses with the original hash160s, generated Flux proof-of-work and proof-of-node blocks, and a Flux-key message signature; expectations match what the API answers. New coverage: the services and their caches, the markets ticker, fee estimates, published socket events, and an HTTP test that drives every route through express and compares status, content type and body with test/data/routes.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The controllers and services take lodash 4 directly instead of the lodash 3 that bitcore-lib bundles. async.whilst tests are asynchronous and doDuring is doWhilst. Caches come from CacheHelper, which bounds an lru-cache by entry count through maxSize so the large limits the statistics caches use are not allocated up front; per-entry expiry is the ttl set option. BigNumber's mul and greaterThanOrEqualTo are times and isGreaterThanOrEqualTo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mongoose dropped callbacks, so each repository method is a promise function wrapped with util.callbackify: callers keep the (err, result) callback, and the callback runs outside the promise chain. Model.remove, count and update are deleteMany, countDocuments and updateOne, and the returned document is chosen with returnDocument. Db.connect resolves mongoose.connect into its callback. strictQuery stays at its default, false, which is how filters have always been cast. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HttpHelper.get calls back with (err, {statusCode}, body) as the
currency controller and markets service expect, parses JSON when asked,
and runs the callback outside the fetch promise chain. fetch applies
undici's default timeouts (10 s to connect, 300 s for headers and for
the body); request ran with none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
body-parser 2 leaves req.body undefined when it parses nothing, and express 5 does the same. The address, message and fluxnode handlers read req.body on GET requests too, so setupRoutes gives every request without a parsed body an empty object. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…quire 2 and express 5 Sandboxes come from sinon.createSandbox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bitcore-lib and bitcore-message are pinned to their master heads, 8f5453f and ec2fb0a. npm 12 installs git dependencies only when allowed, and bitcore-message's own bitcore-lib is one, so .npmrc sets allow-git=all. package-lock.json is written by npm 12.2.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The service is published to npm under the runonflux scope and takes @runonflux/bitcore-lib ^0.16.0 and @runonflux/bitcore-message ^2.0.0 from npm, so it has no git dependency. It ships its runtime directories and pools.json, with BitPay's MIT licence as LICENSE. bitcore-node loads it, and reads its settings, under the service name @runonflux/insight-api. Its routes stay at /insight-api unless routePrefix says otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bitcore-node names the service a scoped package provides without its scope, so the routes default to /insight-api from the service's name and the README configures it under servicesConfig.insight-api. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI runs the tests on every push and pull request. A published GitHub release sets the package version from its tag, runs the tests and stages that version on npm through trusted publishing: it stays unpublished until a maintainer approves it on npmjs.com with 2FA. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The routes that take several addresses (/addrs/... and /fluxnode/addrs/utxo, by form or path) answered a request with neither a form nor a path value with HTTP 500 and the error's stack trace. checkAddrs now treats it as an empty list, which check() answers with 400 "Must include address", as it does an empty value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
servicesConfig."insight-api".proxy names an HTTP proxy for the Coinpaprika requests behind /currency, /markets/info and the markets_info event; without it they go direct. Requests use undici's fetch, with its ProxyAgent for the proxy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
npm verifies a provenance-signed publish by comparing repository.url with the GitHub repository the workflow ran in, case-sensitively. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
….1 from npm Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A release sets the version from its tag before running the tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 24 h and 1 h statistics caches give each block an expiry, but an expired entry left the cache only when its key was read again, and a past block's height never is: every block's entries, full block JSON among them, stayed until 999,999 per cache. Expired entries are now purged, and the caches are bounded by their window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Publishes
@runonflux/insight-api2.0.0: Node 24, mongoose 9, current dependencies; every route answers as 1.3.0 does (route snapshot test). Includes #40's PoN subsidy reduction. One fix: a multi-address route (/addrs/...,/fluxnode/addrs/utxo) given no addresses at all answered HTTP 500 with the error's stack trace; it now answers 400 "Must include address", as an empty value already did. One option:servicesConfig."insight-api".proxynames an HTTP proxy for the Coinpaprika price requests (/currency,/markets/info, themarkets_infoevent); without it they go direct.249 tests pass, including #40's PoN tests. Running on labnet (the lab's own Flux chain) beside 1.3.0's stack on the same node: the API answers identically, the socket.io events and socket RPC answers are identical, and with internet through a proxy
/currency,/markets/infoand everymarkets_infoevent match 1.3.0's over ten minutes. The React UI works against it in a browser, and a transaction sent through/api/tx/sendwas mined.Publishing. This package is released through npm's staged publishing. Publishing a
GitHub release (tag
vX.Y.Z) runs CI, which sets the version from the tag, runs the tests andstages that version on npm through trusted publishing (GitHub's OIDC; no npm token is stored).
A staged version is not public: nobody can install it until a maintainer approves it on
npmjs.com, or with
npm stage approve, which requires 2FA. Each package needs a trustedpublisher on npmjs.com for this repository's
ci.yml, allowing staged publishing only.Order: each layer is published before the one above it. The packages depend on each other
by version, so they are released lowest first, each approved before the next:
bitcoind-rpcandbitcore-libbitcore-messagebitcore-node,insight-apiandinsight-uiUntil the packages below this one are on npm, this PR's CI cannot install them and fails; that
is the order, not a broken change. Once they are published, this PR refreshes its
package-lock.jsonagainst npm in one commit, and CI passes.🤖 Generated with Claude Code