-
Notifications
You must be signed in to change notification settings - Fork 42
Sam/mapctl #422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sam/mapctl #422
Conversation
scripts/mappings/swapuzMappings.ts
Outdated
|
|
||
| // Display Name: TELOS(EVM) | ||
| swapuz.set('TLOSEVM', null) | ||
| swapuz.set('TLOSEVM', 'telos') |
There was a problem hiding this comment.
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
scripts/mapctl.ts
Outdated
| } | ||
| } | ||
|
|
||
| async function addPluginId(id: string): Promise<void> { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
peachbits
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Одобрено
ef72be5 to
d0a877c
Compare
51ae591 to
7332d71
Compare
- 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
7332d71 to
54ee0e8
Compare
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneDescription
noneNote
Add a
mapctltool 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; addedyarn mapctlscript and.env/mapctlConfig.jsonignores.changehero,changenow,exolix,godex,letsexchange,lifi,mayaprotocol,rango,sideshift,swapkit,thorchainwith API clients and cleaners (scripts/synchronizers/**).scripts/mappings/*Mappings.ts(provider→EdgeCurrencyPluginId) and auto‑generatedsrc/mappings/*.ts(pluginId→provider network code) with headers and comments.src/util/edgeCurrencyPluginIds.ts(canonical plugin IDs); addedmapToRecord/mapToStringMaphelpers; string similarity utility (scripts/util/stringSimilarity.ts).refactor(swaps)
MAINNET_CODE_TRANSCRIPTIONmaps in central/defi plugins (changehero,changenow,exolix,godex,letsexchange,sideshift,swapuz,lifi,rango,mayaprotocol,thorchain,swapkit) to consume generated maps fromsrc/mappings/*viamapToRecord/mapToStringMap.swapHelpersto use newEdgeCurrencyPluginIdtype and mapping helpers; removed inline union type.docs/build
CHANGELOG.md: note about new mappings across swap providers.package.json: addedmapctlscript;@cleaner-configdependency;edgeCurrencyPluginIdsfile..gitignore: ignoremapctlConfig.jsonand.env.Written by Cursor Bugbot for commit 54ee0e8. This will update automatically on new commits. Configure here.