Skip to content

Conversation

@MMrj9
Copy link

@MMrj9 MMrj9 commented Dec 22, 2025

Add n.exchange centralized swap integration

Description

Integrate n.exchange as a centralized swap provider supporting multiple networks and tokens. The implementation uses contract addresses for token identification, eliminating the need for currency code mapping. This approach provides better support for tokens and aligns with API requirements.

The integration includes support for native currencies and ERC20 tokens across major networks including Ethereum, Polygon, Base, Arbitrum, Optimism, BSC, and others. The plugin handles rate queries, order creation, and payment processing through the n.exchange API v2.

Additional changes include mapctl tooling for automatic provider mappings and updates to existing swap plugins to use the new mapping system.

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Changes

  • Add n.exchange centralized swap plugin implementation
  • Support for contract address-based token identification
  • Integration with n.exchange API v2 for rate queries and order management
  • Support for multiple networks: Ethereum, Polygon, Base, Arbitrum, Optimism, BSC, and others
  • Mapctl tooling for automatic provider mappings
  • Updates to existing swap plugins to use new mapping system

Testing

  • Unit tests added/updated (nexchange tests included in partnerJson.test.ts)
  • Manual testing completed

Checklist

  • Code follows project style guidelines
  • Commit message follows git commit guidelines
  • Branch is synced with upstream master
  • Tests pass locally (26 passing)
  • Documentation updated (CHANGELOG.md updated)
  • Linting passes
  • Type checking passes (nexchange-specific types fixed)

Note

Adds a new centralized swap provider with contract address-based token support and API v2 rate/order flows.

  • New swap/central/nexchange.ts plugin (pluginId: nexchange) using contract-address formatting, mainnet code transcription, min/max checks, and fixed-rate order creation
  • Registered nexchange in src/index.ts
  • Added partner mapping test/partnerJson/nexchangeMap.json and tests in test/partnerJson/partnerJson.test.ts
  • Test config updated with NEXCHANGE_INIT in test/testconfig.ts
  • CHANGELOG entry under Unreleased

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

@MMrj9 MMrj9 force-pushed the feature/nexchange-centralized-swap branch from 0f22bf7 to 663b859 Compare January 6, 2026 16:31
@MMrj9 MMrj9 force-pushed the feature/nexchange-centralized-swap branch from f895046 to 082583a Compare January 6, 2026 17:05
@MMrj9 MMrj9 force-pushed the feature/nexchange-centralized-swap branch from 082583a to 1d42f05 Compare January 6, 2026 17:18
Integrate n.exchange as a centralized swap provider supporting
multiple networks and tokens. The implementation uses contract
addresses for token identification, eliminating the need for
currency code mapping. This approach provides better support for
tokens and aligns with API requirements.

The integration includes support for native currencies and ERC20
tokens across major networks including Ethereum, Polygon, Base,
Arbitrum, Optimism, BSC, and others. The plugin handles rate
queries, order creation, and payment processing through the
n.exchange API v2.

Additional changes include mapctl tooling for automatic provider
mappings and updates to existing swap plugins to use the new
mapping system.
@MMrj9 MMrj9 force-pushed the feature/nexchange-centralized-swap branch from 1d42f05 to 1166816 Compare January 6, 2026 17:25
async fetchSwapQuote(
req: EdgeSwapRequest,
userSettings: Object | undefined,
opts: { promoCode?: string }
Copy link

Choose a reason for hiding this comment

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

Promo code parameter silently ignored in swap

Medium Severity

The opts parameter containing promoCode is declared in fetchSwapQuote but is never used anywhere in the plugin. Other swap plugins like changenow and godex extract and pass this parameter to their respective APIs. In nexchange, if a user provides a promo code expecting a discount or special rate, it gets silently ignored. The promo code is not passed to getFixedQuote or included in the order body sent to the n.exchange API.

Fix in Cursor Fix in Web

Copy link
Author

Choose a reason for hiding this comment

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

promoCode support can be added at some point

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.

1 participant