Skip to content

Wire MoonPay Trade swap provider - #6128

Merged
j0ntz merged 3 commits into
developfrom
jon/1217036054017879
Sep 26, 2026
Merged

j0ntz merged 3 commits into
developfrom
jon/1217036054017879

Conversation

@j0ntz

@j0ntz j0ntz commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

The entry sits under a new ## 4.51.2 (staging) section, since the task targets the 4.51.2 patch release rather than the next minor.

Dependencies

Depends on EdgeApp/edge-exchange-plugins#480 (the MoonPay Trade plugin). This PR is open for review now: it compiles and passes CI standalone. It should only MERGE after EdgeApp/edge-exchange-plugins#480 merges, edge-exchange-plugins publishes a version containing the mptrade and mptradedefi plugins, and this branch bumps edge-exchange-plugins to it. Without that bump the registration resolves to no plugin at runtime.

Requirements

No visual changes (env/config wiring only).

Description

Wire the new MoonPay Trade swap provider so the app initializes it. edge-exchange-plugins ships it as TWO registrations sharing one API key: mptrade, displayed as "MoonPay Trade (Centralized)", and mptradedefi, displayed as "MoonPay Trade (DeFi)" (DEX, Solana-to-Solana routes only); both are wired here:

  • src/envConfig.ts: add MPTRADE_INIT core plugin init (apiKey).
  • src/util/corePlugins.ts: register mptrade: ENV.MPTRADE_INIT in the Centralized Swaps block of swapPlugins, and mptradedefi: ENV.MPTRADE_INIT in the Defi Swaps block (same provider and credentials; the DEX half).
  • src/actions/CategoriesActions.ts: pluginIdIcons entries for both ids so swap transactions carry the provider icon.
  • src/constants/MerchantContacts.ts: MERCHANT_CONTACTS entries keyed on each registration's swapInfo.displayName (MoonPay Trade (Centralized), MoonPay Trade (DeFi)) for the transaction-list thumbnail.
  • AGENTS.md (separate commit): a Swap Provider Integration section listing every wiring point a new swap pluginId needs, since each one fails silently when missed.

No SwapVerifyTermsModal entry. mptrade is centralized (isDex: false, see EdgeApp/edge-exchange-plugins#480), but that modal is for providers whose gate is a terms acceptance the user completes in-app; MoonPay Trade screens pre-quote and simply refuses a route it will not serve, so there is nothing to accept. The provider icons are live on content.edge.app at /exchangeIcons/mptrade/icon.png and /exchangeIcons/mptradedefi/icon.png.

The runtime key is supplied via env.json MPTRADE_INIT.apiKey. With a published edge-exchange-plugins containing the plugin, the app then offers MoonPay Trade quotes.

Verified in-app on the iOS sim (with the plugin linked via updot and the key in env.json): a real Base ETH to USDC swap executed through MoonPay Trade to the success scene, and a real SOL to USDC (Solana) swap executed through the DEX registration to the success scene (1.501804 USDC received against a 1.493 floor), while a SOL to Base USDC quote still routed through the Centralized entry. After the rename, the same Solana pair quoted as "Powered by MoonPay Trade (DeFi)", the provider sheet listed "MoonPay Trade (DeFi)" labeled DEX under both Selected Quote and Fixed Quotes, a real 0.014415 SOL to USDC (Solana) swap reached the Congratulations scene with Exchange Details naming the service "MoonPay Trade (DeFi)", and a USDC (Solana) to USDC (Base) route quoted as "Powered by MoonPay Trade (Centralized)". With the icons live, a USDC to SOL (Solana) quote shows the MoonPay icon in the "Powered by MoonPay Trade (DeFi)" card (frame 42). Swap transaction rows and details resolve their icon from the same pluginIds (pluginIdIcons) and displayNames (MERCHANT_CONTACTS), so no further gui surface needs the rename. Evidence is in the Test evidence table below and on EdgeApp/edge-exchange-plugins#480.

Asana: 1217036054017879


Note

Medium Risk
Enables a new third-party swap path and API-key-backed plugin init; changes are config wiring only but affect exchange routing and user funds once the dependency is published.

Overview
Wires MoonPay Trade into the app as two swap registrations that share MPTRADE_INIT (apiKey in env.json): mptrade (centralized) and mptradedefi (DEX, same credentials).

Adds the usual integration touchpoints—envConfig, swapPlugins in corePlugins.ts, pluginIdIcons, and MERCHANT_CONTACTS for transaction-list thumbnails—plus a CHANGELOG entry. AGENTS.md now documents every swap pluginId wiring step so missed hooks fail silently.

There is no SwapVerifyTermsModal entry (MoonPay Trade does not use in-app terms acceptance). Runtime quotes depend on bumping edge-exchange-plugins after the plugin ships.

Reviewed by Cursor Bugbot for commit ff2d93e. Bugbot is set up for automated code reviews on this repo. Configure here.

Test evidence

(earlier)
Wire swaps.xyz swap provider

2. swap success

4. tx list row

18. solana dex quote

19. provider sheet dex label

20. solana dex swap success

21. solana crosschain stays centralized

22. defi quote moonpay trade name

23. provider sheet defi label

24. defi swap success

25. exchange details service name

26. centralized quote moonpay trade name

30. defi quote after rebase

31. defi swap success after rebase

40. mptradedefi quote after rename

41. mptradedefi swap success after rename
792a189
Wire the MoonPay Trade DEX registration
2026-09-18

42. mptradedefi powered by icon

@j0ntz
j0ntz marked this pull request as ready for review August 3, 2026 21:37
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@peachbits peachbits left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing CategoriesActions and MerchantContacts entries. May also be missing the SwapVerifyTerms entry, if applicable

@j0ntz

j0ntz commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Added both missing entries in a fixup on Wire swaps.xyz swap provider:

  • src/actions/CategoriesActions.ts pluginIdIcons: swapsxyz → /exchangeIcons/swapsxyz/icon.png
  • src/constants/MerchantContacts.ts: { displayName: 'swaps.xyz' }, matching the plugin's swapInfo.displayName, same icon path

No SwapVerifyTermsModal entry: swapsxyz is isDex: true, and that modal's pluginData covers centralized providers with terms/KYC to accept (changenow, changelly, exolix, sideshift, swapuz, xgram). No DEX plugin (lifi, rango, thorchain, unizen, 0xgasless) has one.

The icon itself still 403s on content.edge.app for both /exchangeIcons/swapsxyz/icon.png and /swapsxyz.png, so the asset needs uploading to the content server separately.

Also added a ## Swap Provider Integration section to AGENTS.md as its own commit, listing every wiring point a new swap pluginId needs and noting that each fails silently when missed.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 using default effort and found 1 potential issue.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 61f2066. Configure here.

Comment thread src/actions/CategoriesActions.ts Outdated
@j0ntz
j0ntz force-pushed the jon/1217036054017879 branch 3 times, most recently from 221cffd to 792a189 Compare September 17, 2026 00:55
@j0ntz j0ntz changed the title Wire swaps.xyz swap provider Wire MoonPay Trade swap provider Sep 18, 2026
@j0ntz
j0ntz force-pushed the jon/1217036054017879 branch from 2232ce7 to f10246b Compare September 23, 2026 22:16

@peachbits peachbits left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wiring reviewed at f10246b: MPTRADE_INIT mirrors SWAPTER_INIT (missing key → false, so the registrations stay off until env.json carries it), both ids sit in the right swapPlugins blocks sharing the one init, pluginIdIcons and MERCHANT_CONTACTS cover both display names, and both CDN icons return 200. The 2026-08-03 asks (CategoriesActions, MerchantContacts) are in; no SwapVerifyTermsModal entry is right for a provider that screens pre-quote. Previous provider additions (swapter, nexchange, nym) touched fewer files than this, so the checklist in AGENTS.md is a net gain.

Two notes, neither blocking:

  • Note the swap provider integration points in AGENTS.md is 54 chars; the limit is 50. Suggest Document swap provider wiring points in AGENTS.md (49) at squash.
  • As the description says, this lands only after edge-exchange-plugins publishes with mptrade/mptradedefi and this branch bumps the dependency; ^2.55.0 resolves both ids to nothing today.
  • CHANGELOG: this branch creates the ## 4.51.2 (staging) header itself. Every (staging) header in this repo so far has come from the version-bump commit (v4.51.0 in 45cf042, 4.51.1 in 5b8686a), with feature PRs adding their line under whichever header already exists. Keep the entry, but expect the header to be reconciled with the bump at land, since develop now reads ## 4.51.1 (2026-09-23) where this hunk expects ## 4.51.0 (staging).

Comment thread AGENTS.md Outdated
@j0ntz
j0ntz force-pushed the jon/1217036054017879 branch from f10246b to 15c7a41 Compare September 25, 2026 23:16
@j0ntz

j0ntz commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

All three notes are handled at land, which starts now that both PRs are approved:

  • The subject becomes Document swap provider wiring points in AGENTS.md (49 chars) in the same rebase that folds 1b02fa3.
  • The land runs in dependency order: Implement 'Share' for Private Seeds on WalletList #480 merges and publishes first, the edge-exchange-plugins bump goes to develop, and only then does this branch rebase and merge.
  • The ## 4.51.2 (staging) header gets reconciled against develop's current headers during that rebase, keeping the entry.

Add MPTRADE_INIT core plugin init (envConfig) and register the mptrade
swap plugin in corePlugins so the app initializes the new
edge-exchange-plugins MoonPay Trade provider from env.json MPTRADE_INIT.apiKey.
Requires a published edge-exchange-plugins containing the mptrade plugin
plus a dependency bump before it is functional.
Registering a swap pluginId needs four or five separate entries in this repo,
and every one of them fails silently when missed: a missing pluginIdIcons or
MERCHANT_CONTACTS row renders a blank icon rather than erroring. The MoonPay Trade
wiring shipped without two of them and the omission only surfaced in review.
List the touch points by path, note that MERCHANT_CONTACTS matches on the
plugin's swapInfo.displayName string, and record that SwapVerifyTerms applies
to centralized providers only.
edge-exchange-plugins ships MoonPay Trade as two registrations that share one
API key: mptrade (centralized) and mptradedefi (DEX). Register the second
one in the Defi block, reusing MPTRADE_INIT, and give its id and display
name their own icon and merchant thumbnail. Its routes are Solana-to-Solana
today; the id is venue-generic so the set can grow without a new one.
@j0ntz
j0ntz force-pushed the jon/1217036054017879 branch from 15c7a41 to ff2d93e Compare September 26, 2026 02:26
@j0ntz
j0ntz enabled auto-merge September 26, 2026 02:29
@j0ntz
j0ntz merged commit 8c0b3d9 into develop Sep 26, 2026
7 checks passed
@j0ntz
j0ntz deleted the jon/1217036054017879 branch September 26, 2026 02:44
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