Add NYM Swap (nymswap) reporting plugin#226
Open
j0ntz wants to merge 1 commit into
Open
Conversation
j0ntz
force-pushed
the
jon/nymswap-reports
branch
from
July 23, 2026 00:57
b6b27fd to
caf38d4
Compare
j0ntz
force-pushed
the
jon/nymswap-reports
branch
from
July 23, 2026 01:01
caf38d4 to
0be7ad3
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0be7ad3. Configure here.
j0ntz
force-pushed
the
jon/nymswap-reports
branch
2 times, most recently
from
July 24, 2026 22:12
fbc8882 to
971a2d7
Compare
Query NYM's partner reporting API for completed swap orders and map them into StandardTx, modeled on the clean shape of swapuz. Register nymswap in queryEngine and the demo partners config. Add a transform unit test. The reporting endpoint, auth scheme, and order field names are the documented assumption to confirm with NYM; credentials are human/ops set.
j0ntz
force-pushed
the
jon/nymswap-reports
branch
from
July 24, 2026 23:09
971a2d7 to
834e37a
Compare
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.

CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
none
Description
Add a new reports-server partner plugin
nymswapso NYM swaps surface in the reportspipeline. Asana: https://app.asana.com/0/1215088146871429/1216728226940270
The reporting contract is confirmed against NYM's live "Edge Partner" API (OpenAPI at
https://nym-swap-api.nymtech.cc/api/docs/) and a live query run under the GUI's existing
NYM swap key (
NYM_SWAP_INIT.apiKey), which had real order history to read.What it does:
src/partners/nym.ts-queryNymwalksGET /api/partner/v1/reports/transactions(auth
x-api-key, paramsstartDate/endDate/limit<=500/cursor, envelope{ transactions, nextCursor }), followingnextCursoruntil null with a 5-day lookback,retry/snooze on throttling, and a conservative progress save (advance
latestIsoDateonlyafter the full cursor walk completes).
processNymTxmaps eachEdgeTransactionRecordinto
StandardTx.GET /api/partner/v1/currenciesdecimals (keyed by currency code + tokenId), with abuilt-in fallback map for the current asset set if that fetch fails.
createdDatebecause NYM leavescompletedDatenull on mostcompleted orders (observed 7 of 8 in the live sample).
pending/processing/infoNeeded/expired/refunded/completedto EdgeStandardTx statuses.
nymswapinsrc/queryEngine.tsandsrc/demo/partners.ts. ThepluginIdis
nymswap, matching the NYM swap plugin in edge-exchange-plugins.test/nym.test.ts- unit tests forprocessNymTxusing real capturedEdgeTransactionRecordpayloads (amount decimal conversion, unknown-status degradation, null-txid tolerance,
unknown-asset skip, non-numeric amount clamp).
Credentials are human/ops only for production (partner dashboard + production CouchDB
reports_apps partnerIds.nymswap.apiKeys); no production credential is fetched or set bythis code. The live verification used the GUI's existing swap key at the operator's request.
Open questions raised with the NYM team (see the Asana task):
completedDateis null on completed orders - should reporting rely oncreatedDateforthe settlement time, or will
completedDatebe populated?sourceNetwork/destinationNetworkcasing is inconsistent (ethereumvsBTC/NYM) anddoes not map 1:1 to Edge plugin ids; chain plugin fields are left undefined for now.
reporting credential.
Testing:
GET /api/partner/v1/reports/transactionsunder the GUI key returned21 real records (8 completed, 13 expired); the response matched the OpenAPI
TransactionReportschema exactly and drove the cleaner design.
tsc/build.types) clean of the new code; eslint clean on changed files.test/nym.test.tspasses (5/5).date-math) unrelated to this change.
Note
Medium Risk
New external API integration affects reported swap amounts and timestamps (createdDate vs settlement); mis-scaled decimals are guarded by skipping unknown assets, but ops must configure the API key in CouchDB.
Overview
Adds NYM Swap (
nymswap) to the reports pipeline so Edge can ingest partner swap history from NYM’s Partner API.A new plugin in
src/partners/nym.tspagesGET /api/partner/v1/reports/transactionswithx-api-key, a 5-day lookback, cursor pagination, and retries;latestIsoDateadvances only after the full cursor walk finishes so partial runs do not skip data. Native amount strings are scaled to major units using live/currenciesdecimals (with a static fallback), records map toStandardTx(status mapping,createdDatefor timestamps becausecompletedDateis often null), and bad rows are skipped instead of failing the whole page.nymswapis wired intoqueryEngineand the demo partner list; CHANGELOG andtest/nym.test.tscoverprocessNymTxconversion and edge cases.Reviewed by Cursor Bugbot for commit 834e37a. Bugbot is set up for automated code reviews on this repo. Configure here.