Skip to content

Update Exolix swap to network/address-based API#458

Open
j0ntz wants to merge 1 commit into
masterfrom
jon/exolix-update-api
Open

Update Exolix swap to network/address-based API#458
j0ntz wants to merge 1 commit into
masterfrom
jon/exolix-update-api

Conversation

@j0ntz

@j0ntz j0ntz commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

Internal mirror of Exolix partner PR #433 ("update api"), re-authored on an Edge-owned branch rather than merging the partner branch directly.

Asana: https://app.asana.com/0/1215088146871429/1213596310518725

What changed

  • Migrate the Exolix integration to Exolix's newer network/address-based API:
    • Requests now send networkFrom / networkTo, including an evmGeneric path that carries evmChainId (networkFromChainId / networkToChainId), plus optional token coinAddressFrom / coinAddressTo resolved via getContractAddresses.
    • The /rate response now carries a rateId that is threaded through to /transactions.
  • Replace the hardcoded $70k USD cap (and the associated fetchRates lookup) with min/max limits taken directly from Exolix: minAmount / maxAmount for from quotes and withdrawMin / withdrawMax for to quotes, throwing SwapBelowLimitError / SwapAboveLimitError accordingly.
  • Add test/exolix.test.ts (mocked Exolix API) covering the new request shaping, EVM/token paths, and min/max limit handling.

API requirements review (per API_REQUIREMENTS.md; non-blocking)

  • Req 1 (Chain and Token Identification): now MET. This migration is exactly what satisfies it: the quote/order request specifies the chain (networkFrom/networkTo, evmGeneric + evmChainId) and the token (coinAddressFrom/coinAddressTo contract address) directly.
  • Req 4 (Bi-directional quoting): MET. Both from (amount) and to (withdrawalAmount) directions are supported.
  • Req 3 (Error Handling): GAP. Exolix returns limits inline on the /rate response (minAmount/maxAmount, withdrawMin/withdrawMax), single-sided per quote direction, rather than the spec's structured errors[] array carrying both sourceAmountLimit and destinationAmountLimit in one response. The 422 handling also reflects inconsistent provider error behavior on under-minimum from quotes. Non-blocking; flagged for the provider.
  • Amount representation: Exolix exchanges amounts in display (denomination) units, not native units; the plugin converts via nativeToDenomination / denominationToNative. The doc states native units "should" be used (soft), so this is a note, not a violation.
  • Reqs 5-8 (transaction status, reporting API, account activation, affiliate withdrawal): provider-side concerns not observable from the plugin diff; not assessed here.

Testing

  • tsc clean; full mocha suite passes (39 tests, including the new Exolix tests, ~94.8% line coverage on exolix.ts); eslint clean on changed files; verify-repo PASSED.
  • Real in-app swap execution was deferred to staging QA: executing a live Exolix swap requires real funds and is irreversible, and Exolix is under an active security incident (https://www.rastersec.com/blog/exolix-swapper-dump). The task handoff likewise calls for testing on staging before accepting/merging.

Note

Medium Risk
Changes live Exolix quote/order request shape and swap size limits for a centralized exchange; behavior is covered by new tests but staging QA with real API is still advised.

Overview
The Exolix swap plugin now uses Exolix’s network/address-based /rate and /transactions API instead of coin/network currency fields. Quotes send networkFrom / networkTo, optional coinAddressFrom / coinAddressTo, and for EVM wallets evmGeneric plus networkFromChainId / networkToChainId; the rateId from /rate is required on order creation.

Limits no longer use the hardcoded $70k USD cap and info-server fetchRates check. Min/max come from Exolix (minAmount / maxAmount for quoteFor: 'from', withdrawMin / withdrawMax for to), with ceil/floor when converting limits and quote amounts to native atomic units. HTTP 422 responses that still parse as rate payloads continue to drive SwapBelowLimitError / SwapAboveLimitError.

Adds test/exolix.test.ts (mocked API) for request shaping, EVM path, rateId, and limit errors. CHANGELOG updated under Unreleased.

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

Comment thread src/swap/central/exolix.ts
@j0ntz j0ntz force-pushed the jon/exolix-update-api branch from 3577595 to 12b3b22 Compare June 10, 2026 01:54

@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 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 12b3b22. Configure here.

Comment thread src/swap/central/exolix.ts
Mirror Exolix partner PR #433. Switch the
Exolix integration to the newer network-based API: send networkFrom/
networkTo (with an evmGeneric path carrying evmChainId) plus optional
token coinAddressFrom/coinAddressTo, and thread the /rate rateId through
to /transactions. Replace the hardcoded $70k USD cap and the rates fetch
with min/max enforcement from Exolix (minAmount/maxAmount and withdrawMin/
withdrawMax), throwing SwapBelowLimitError/SwapAboveLimitError. Add unit
tests covering the new request shaping and limit handling.
@j0ntz j0ntz force-pushed the jon/exolix-update-api branch from 12b3b22 to 2ce37ad Compare June 10, 2026 02:00
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