Repository navigation
fix: make webhooks and price trackers network-aware (#188) - #205
Merged
Miracle656 merged 1 commit intoSep 30, 2026
Conversation
|
@Ingenious-02 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Miracle656
added a commit
that referenced
this pull request
Sep 30, 2026
Every function in src/aggregator/vwap.ts now takes a required network and filters price_points and pool_snapshots on it, getAMMPrice filters both legs of its pool lookup, /price/:assetA/:assetB passes req.network through to the aggregator, and the aggregate refresh worker runs once per enabled network instead of pinning itself to whichever network the instance happens to be indexing. Merged locally: src/__tests__/price.test.ts conflicted only because #184 and 1c7e200 appended test blocks to the same tail; resolved as a union. The README paragraph was corrected on merge — #195, #202 and #205 landed network scoping for /screener, /pools, /depth and /prices/history after this branch was written, so the list of still-unscoped endpoints was stale. Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
This was referenced Sep 30, 2026
Miracle656
added a commit
that referenced
this pull request
Sep 30, 2026
#193 replaced db.getIndexerCursor with getIndexerState, which returns {cursor, ledger} so an ingester can fall back to the last stored ledger when a Horizon trade id will not parse as a TOID. It branched before tests/ingestMetrics.test.ts (#203) and dualNetworkAlerts.test.ts (#205) landed, so those two files still mocked the old name. The merge is clean and tsc passes, but at runtime getIndexerState is undefined and 11 tests fail. Both suites use synthetic paging tokens that carry no TOID, so they now supply a stored ledger and exercise the documented fallback path. Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
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.
Summary
Closes #188
Fixes the dual-network seam where price trackers and webhooks were network-blind:
lastPricemaps insrc/ingesters/sdex.ts,src/ingesters/amm.ts,src/ingesters/soroswap.ts, andsrc/ingest/venues/aquarius.tsby(network, pairKey)rather thanpairKeyalone. A tick on testnet now never pollutes or supplies the "previous price" for a mainnet threshold crossing (and vice versa).dispatchPriceUpdateinsrc/webhookDispatcher.tsto acceptnetworkand filter webhooks specifically by the network that emitted the price event, rather than filtering by the process'sactiveNetwork.sdex,ammsnapshot + trades,soroswap, andaquarius) now forward their activenetworkintodispatchPriceUpdate.POST /webhooksnow supports explicitnetworkselection fromreq.body.network(validated against allowed networks), falling back toreq.networkoractiveNetwork.src/ingesters/amm.ts,snapshotPoolwas writingnetwork: activeNetworktoprisma.poolSnapshot.create, now properly tags with thenetworkparameter.Acceptance Criteria Verification
src/__tests__/dualNetworkAlerts.test.ts.src/__tests__/dualNetworkAlerts.test.tsandsrc/__tests__/webhooks.test.ts.lastPricestate is keyed by${network}:${pairKey}.Test Verification
npx tsc --noEmitpasses with 0 errors.