diff --git a/AGENTS.md b/AGENTS.md index 0ace72e693c..5ff92e8cbee 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -18,6 +18,18 @@ - `npm run precommit` - Full pre-commit check (localize, lint-staged, tsc, test) - `tsc` - TypeScript type checking (via package.json script) +## Swap Provider Integration + +The plugin itself lives in `edge-exchange-plugins`; this repo only wires it up, and every wiring point below fails SILENTLY when missed (no error, just a blank icon or a provider that never initializes). Registering a new swap `pluginId` means all of: + +- `src/envConfig.ts` - `_INIT` via `asCorePluginInit`, when the plugin takes init options (an `apiKey`) +- `src/util/corePlugins.ts` - `swapPlugins` entry mapping the `pluginId` to that init (or `true` when it needs none) +- `src/actions/CategoriesActions.ts` - `pluginIdIcons` entry, or swap transactions render without a provider icon +- `src/constants/MerchantContacts.ts` - `MERCHANT_CONTACTS` entry whose `displayName` matches the plugin's `swapInfo.displayName` exactly, since the tx list matches thumbnails by that string +- `src/components/modals/SwapVerifyTermsModal.tsx` - `pluginData` entry ONLY for centralized providers with terms/KYC to accept; DEX plugins (`isDex: true`) take none + +New swap icons live at `https://content.edge.app/exchangeIcons//icon.png` (`getSwapPluginIconUri` in `src/util/CdnUris.ts`) and must be uploaded to the content server separately, or the URL 403s. The wiring stays inert until `package.json` bumps `edge-exchange-plugins` to a published version containing the plugin. + ## Code Style Guidelines - **Formatting**: Prettier with single quotes, no semicolons, no trailing commas, 80 char width diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f72bf436d7..cf9f71d3a39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased (develop) +- added: swaps.xyz swap provider wiring (SWAPSXYZ_INIT core plugin init and registration). - added: Verbose logging for exchange rate queries: the request body, resolved/rate-less counts, and errors are captured when the Verbose Logging setting is enabled. - added: Exchange-rate cache snapshot in the support log output, plus a `rates-cache-replay` script that re-runs those queries against the rates server and reports the result for each pair. - added: "-m" tag on the version number in the Help scene for Maestro test builds diff --git a/src/actions/CategoriesActions.ts b/src/actions/CategoriesActions.ts index d00a39a6b15..dd544c30569 100644 --- a/src/actions/CategoriesActions.ts +++ b/src/actions/CategoriesActions.ts @@ -725,6 +725,7 @@ export const pluginIdIcons: Record = { rango: EDGE_CONTENT_SERVER_URI + '/rango.png', sideshift: EDGE_CONTENT_SERVER_URI + '/sideshift-logo.png', simplex: EDGE_CONTENT_SERVER_URI + '/simplex.png', + swapsxyz: EDGE_CONTENT_SERVER_URI + '/exchangeIcons/swapsxyz/icon.png', swapuz: EDGE_CONTENT_SERVER_URI + '/swapuz.png', thorchain: EDGE_CONTENT_SERVER_URI + '/thorchain.png', unizen: EDGE_CONTENT_SERVER_URI + '/unizen.png', diff --git a/src/constants/MerchantContacts.ts b/src/constants/MerchantContacts.ts index dafa01582a1..0cba435475f 100644 --- a/src/constants/MerchantContacts.ts +++ b/src/constants/MerchantContacts.ts @@ -78,6 +78,10 @@ export const MERCHANT_CONTACTS: MerchantContact[] = [ displayName: 'Simplex', thumbnailPath: `${EDGE_CONTENT_SERVER_URI}/simplex.png` }, + { + displayName: 'swaps.xyz', + thumbnailPath: `${EDGE_CONTENT_SERVER_URI}/exchangeIcons/swapsxyz/icon.png` + }, { displayName: 'Swapuz', thumbnailPath: `${EDGE_CONTENT_SERVER_URI}/swapuz.png` diff --git a/src/envConfig.ts b/src/envConfig.ts index 20df307be82..1148d1803a6 100644 --- a/src/envConfig.ts +++ b/src/envConfig.ts @@ -425,6 +425,11 @@ export const asEnvConfig = asObject({ quiknodeApiKey: asOptional(asString, '') }).withRest ), + SWAPSXYZ_INIT: asCorePluginInit( + asObject({ + apiKey: asOptional(asString, '') + }).withRest + ), SWAPUZ_INIT: asCorePluginInit( asObject({ apiKey: asOptional(asString, '') diff --git a/src/util/corePlugins.ts b/src/util/corePlugins.ts index 55c017dad00..06a7013c49e 100644 --- a/src/util/corePlugins.ts +++ b/src/util/corePlugins.ts @@ -99,6 +99,7 @@ export const swapPlugins = { letsexchange: ENV.LETSEXCHANGE_INIT, nexchange: ENV.NEXCHANGE_INIT, sideshift: ENV.SIDESHIFT_INIT, + swapsxyz: ENV.SWAPSXYZ_INIT, swapuz: ENV.SWAPUZ_INIT, xgram: ENV.XGRAM_INIT, nymswap: ENV.NYM_SWAP_INIT,