Skip to content

Swap - Xgram Support#441

Merged
j0ntz merged 2 commits intomasterfrom
jon/xgram
Mar 11, 2026
Merged

Swap - Xgram Support#441
j0ntz merged 2 commits intomasterfrom
jon/xgram

Conversation

@j0ntz
Copy link
Contributor

@j0ntz j0ntz commented Feb 26, 2026

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

Context

Asana: "exch: Swap - Xgram Support" (P1). This branch reapplies the plugin work from #405 so the exchange engine can serve the Xgram team with the new swap flow and mappings.

Changes

Original PR
  • Register the xgram plugin in src/index.ts, include its synchronizer in scripts/allSynchronizers.ts, and add the mapping source plus generated file so EdgeCurrencyPluginIds map to Xgram network codes.
  • Implement src/swap/central/xgram.ts to compose the Xgram API calls, assemble swap estimates, handle memos/mapping metadata, and feed the swap engine usable EdgeSpendInfo.
Additional changes
  • Improve Xgram error handling by parsing ccyAmount limit strings, producing the correct SwapBelowLimitError/SwapAboveLimitError, and recognizing literal error responses via the new asXgramStringError.

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

None

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Note

Medium Risk
Adds a new external swap provider with new API integration and error/limit handling, which could affect quoting and spend construction if mappings or response parsing are wrong.

Overview
Adds Xgram as a new centralized swap provider, including a new xgram swap plugin wired into src/index.ts and a corresponding mapctl synchronizer registered in scripts/allSynchronizers.ts.

Introduces hand-maintained currency/network mappings (scripts/mappings/xgramMappings.ts) with a generated runtime mapping (src/mappings/xgram.ts), plus a new XGRAM_API_KEY config entry. The Xgram plugin implements quote/order creation against Xgram’s API, builds EdgeSpendInfo (including memo/tag handling), and improves error translation for region restrictions, unsupported currencies, and min/max limits (including parsing string ccyAmount limit errors).

Written by Cursor Bugbot for commit fca8baa. This will update automatically on new commits. Configure here.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf884448e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@j0ntz
Copy link
Contributor Author

j0ntz commented Mar 4, 2026

Addressed the review’s only actionable item (reverse-quote limit handling) and resolved the inline thread.

Copy link
Contributor

@peachbits peachbits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, assuming the small ask from bugbot regarding the result flag is addressed

@j0ntz
Copy link
Contributor Author

j0ntz commented Mar 11, 2026

Addressed the bugbot follow-up by only falling back to the requested destination amount for reverse quotes, requiring ccyAmountToExpected for forward quotes, and revalidating the Xgram response shapes with live curl requests.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@j0ntz j0ntz merged commit b71b954 into master Mar 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants