Skip to content

Conversation

@samholmes
Copy link
Contributor

@samholmes samholmes commented Nov 26, 2025

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

Note

Add a mapctl tool and provider synchronizers to auto‑generate swap provider network mappings, centralize plugin IDs, and refactor all swap plugins to use the generated mapping modules, plus update build/config and docs.

  • feat(tools/infra)

    • scripts/mapctl.ts + scripts/mapctlConfig.ts: New CLI to fetch/sync provider chain IDs and generate inverted plugin→network mappings; added yarn mapctl script and .env/mapctlConfig.json ignores.
    • Provider synchronizers: Added modules for changehero, changenow, exolix, godex, letsexchange, lifi, mayaprotocol, rango, sideshift, swapkit, thorchain with API clients and cleaners (scripts/synchronizers/**).
    • Mapping sources: Added scripts/mappings/*Mappings.ts (provider→EdgeCurrencyPluginId) and auto‑generated src/mappings/*.ts (pluginId→provider network code) with headers and comments.
    • Core types/utilities: Introduced src/util/edgeCurrencyPluginIds.ts (canonical plugin IDs); added mapToRecord/mapToStringMap helpers; string similarity utility (scripts/util/stringSimilarity.ts).
  • refactor(swaps)

    • Replaced hard‑coded MAINNET_CODE_TRANSCRIPTION maps in central/defi plugins (changehero, changenow, exolix, godex, letsexchange, sideshift, swapuz, lifi, rango, mayaprotocol, thorchain, swapkit) to consume generated maps from src/mappings/* via mapToRecord/mapToStringMap.
    • Updated swapHelpers to use new EdgeCurrencyPluginId type and mapping helpers; removed inline union type.
  • docs/build

    • CHANGELOG.md: note about new mappings across swap providers.
    • package.json: added mapctl script; @cleaner-config dependency; edgeCurrencyPluginIds file.
    • .gitignore: ignore mapctlConfig.json and .env.

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



// Display Name: TELOS(EVM)
swapuz.set('TLOSEVM', null)
swapuz.set('TLOSEVM', 'telos')
Copy link
Contributor

Choose a reason for hiding this comment

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

TLOS and TLOSEVM shouldn't point to the same pluginId, right? Also, TLOSEVM isn't support in Edge

}
}

async function addPluginId(id: string): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

One of the purposes of the EdgeCurrencyPluginId type was to add some friction to adding a new pluginId by forcing each swap partner to map it (hence why it is string | null and not just string). Adding a 'shinynewevm' to the list meant type errors on each swap partner file because 'shinynewevm' wasn't accounted for.

Copy link
Contributor Author

@samholmes samholmes Dec 1, 2025

Choose a reason for hiding this comment

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

So you're asking to preserve some prompt to the user to "make sure to map this new pluginId across these providers"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not asking for a specific change, just complaining. As someone who regularly updates these mappings I don't actually find much value in this PR and it removes something I liked about how it performed before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@peachbits I've added an additional commit to resolve your concerns and make this tool more useful.

const filteredSynchronizers =
filter != null
? synchronizers.filter(s => s.name === filter)
: synchronizers
Copy link

Choose a reason for hiding this comment

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

Bug: Filtered sync-providers command fails with unrelated missing API keys

The syncSynchronizers function creates ALL synchronizer instances before applying the filter parameter. Several synchronizer factories (like makeChangeHeroSynchronizer, makeChangeNowSynchronizer, etc.) throw errors if their API keys are missing. This means running yarn mapctl sync-providers godex (which doesn't require any API key) will fail if any other provider's API key is missing, because all factories are instantiated at line 71 before the filter is applied at lines 72-75. The same pattern affects updateMappings where factory(config) is called outside the try-catch block, and addPluginId where factories are called in loops without error handling.

Additional Locations (2)

Fix in Cursor Fix in Web

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.

Одобрено

@samholmes samholmes force-pushed the sam/mapctl branch 2 times, most recently from ef72be5 to d0a877c Compare December 5, 2025 23:14
- exolix: ZKSYNCERA -> zksync
- lifi: son -> sonic
- rango: DASH, DOGE, LTC, SUI, TELOS, TON, TRON, XRPL mappings
- swapkit: ARB, DASH, DOT, OP, POL, SOL, SUI mappings
- swapuz: ALGORAND, ARB, AVAX, OSMO, RAVENCOIN, SONIC, TLOS, TLOSEVM mappings
@samholmes samholmes merged commit 0c92f31 into master Dec 10, 2025
2 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.

3 participants