Add Swapter partner plugin#224
Open
j0ntz wants to merge 1 commit into
Open
Conversation
Adds the Swapter exchange partner integration: querySwapter pages the /personal/exchange/tool-history endpoint with retry handling and latestIsoDate tracking, and processSwapterTx converts Swapter deposit/ withdraw records into StandardTx. Registers the swapter plugin in the query engine.
j0ntz
force-pushed
the
jon/add-swapter-reporting
branch
from
July 14, 2026 18:14
93d5700 to
f053610
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 f053610. Configure here.
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
Adds the Swapter exchange partner integration to the reports server. Recreated under the EdgeApp org from the external contributor PR #219 so we own the branch and can ship it.
Changes:
src/partners/swapter.ts:querySwapterpages thePOST /personal/exchange/tool-historyendpoint (200/page) withX-Api-Keyauth,retryFetch+ snooze-backoff retry handling, andlatestIsoDatetracking to skip already-processed orders.processSwapterTxcleans each raw record and converts it into aStandardTx(deposit/withdraw coin+amount+address,deposit.actual ?? deposit.amount,usdValuefrominfo.equivalentwith the-1unknown guard).Statusmapping covering all nine documented statuses plus anotherfallback for unknown values.swapterplugin (pluginId: swapter) insrc/queryEngine.ts.Testing:
processSwapterTxoutput validated against the canonicalasStandardTxcleaner on a representative order; all status mappings, theactual ?? amountfallback, and theusdValueguard verified.querySwapterrun against the livehttps://api.swapter.io/personal/exchange/tool-historyAPI with a throwaway non-prod key: HTTP 200, response accepted byasSwapterResult, empty history for the key so it returns[]cleanly. Missing-apiKey path short-circuits to[]without throwing.tsc(viaprepare/build.*) andeslinton the changed files pass. Theutil.testsuite is red both on this branch and on pristinemaster(pre-existingsevenDayDataMerge/createQuarterBucketsfailures, unrelated to this change).Asana: https://app.asana.com/0/1215088146871429/1216466181647587
Note
Low Risk
Additive partner integration following existing plugin patterns; no changes to core auth, storage semantics, or shared reporting logic beyond registering one more plugin.
Overview
Adds Swapter as a new exchange partner so the reports query loop can ingest swap history into
StandardTxrecords.The new plugin posts to Swapter’s
tool-historyAPI withX-Api-Key, paginates (200 per page), applies a 5-day lookback fromlatestIsoDate, and retries failed requests with backoff. Raw orders are normalized via cleaners and mapped to standard fields (deposit/withdraw amounts and addresses,exchangeType: 'swap', status mapping for all documented Swapter states).usdValueusesinfo.equivalentwhen positive, otherwise-1. Missing API key returns no transactions without calling the API.swapter(pluginId: 'swapter') is registered in the query engine plugin list, and the unreleased CHANGELOG notes the addition.Reviewed by Cursor Bugbot for commit f053610. Bugbot is set up for automated code reviews on this repo. Configure here.