Skip to content

Conversation

@xlassix
Copy link
Collaborator

@xlassix xlassix commented Nov 19, 2025

Summary by CodeRabbit

  • New Features

    • Added account ID retrieval support for MEXC, Binance, and Bybit exchanges.
    • Added new UID endpoint for MEXC.
  • Chores

    • Bumped library version to 0.0.13.

✏️ Tip: You can customize this high-level summary in your review settings.

Copy link
Member

@rsoury rsoury left a comment

Choose a reason for hiding this comment

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

verityUrlMap seems to be why ExchangeMap exists.

Let's try keep CCXT agnostic to Verity please

Verity integration conducted inside of the Prover's CEX Broker Sidecar.

Furthermore, are there not existing function available to fetch account details for MEXC that we had to incorporate a new one?

spotPrivateGetOrder(params?: {}): Promise<implicitReturnType>;
spotPrivateGetOpenOrders(params?: {}): Promise<implicitReturnType>;
spotPrivateGetAllOrders(params?: {}): Promise<implicitReturnType>;
spotPrivateGetAccount(params?: {}): Promise<implicitReturnType>;
Copy link
Member

Choose a reason for hiding this comment

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

Would this existing function not work?

Maybe run a check to determine what the TLS Proof outcome is for this function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i couldn't justify saving 100 times the data need and sending that to zkvm when an api exist with just what we need
https://www.mexc.com/api-docs/spot-v3/spot-account-trade#query-uid

Copy link
Member

Choose a reason for hiding this comment

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

Fair.

@@ -2838,6 +2886,7 @@ export default class Exchange {
this[property] = value
}
}
this.urlToMethodMap = mergeExchangeMaps(this.urlToMethodMap, userConfig.verityUrlMap)
Copy link
Member

Choose a reason for hiding this comment

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

What is userConfig.verityUrlMap ?
Is this set inside of the CEX Broker?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

verityUrlMap is a way to add to the urlToMethodMap so we dont have to redeploy if we want to support/add other Options like FetchAccountId with it corresponding Urls

Copy link
Member

@rsoury rsoury Nov 25, 2025

Choose a reason for hiding this comment

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

But in FetchAccountId, you're not using verityUrlMap ?

Additionally:

verityUrlMap seems to be why ExchangeMap exists.

Let's try keep CCXT agnostic to Verity please

Verity integration conducted inside of the Prover's CEX Broker Sidecar.

Copy link
Member

Choose a reason for hiding this comment

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

In case if we want to keep the opportunity to extend the map dynamically without redeploying the package, and meanwhile keep the package Verity agnostic, we can rename the verityUrlMap to something like extraExchangeMap.

But I think it's not enough to merge maps only without extending an exchange's interface which requires package redeployment anyway.

Copy link
Member

Choose a reason for hiding this comment

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

Based on my review, there was no evidence explaijning what verityUrlMap is used for…

keep the package Verity agnostic

This is a correct objective for our CCXT package

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

verityUrlMap could be renamed to extraExchangeMap.

verityUrlMap only extends the map dynamically without redeploying.
@victorshevtsov I am not sure what you mean by

But I think it's not enough to merge maps only without extending an exchange's interface which requires package redeployment anyway.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, maybe remove for now until we need something like this in the future.

Let's make an effort to remove features we create that are not used to minimise tech debt.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, you are right, verityUrlMap is never used, but introduced for a future use in case we need to update the map to call a specific API which currently not defined in the map, without redeploying the package.

@coderabbitai
Copy link

coderabbitai bot commented Dec 23, 2025

Walkthrough

This PR bumps the library version from 0.0.12 to 0.0.13 and adds support for fetching account identifiers across multiple exchanges (MEXC, Binance, and Bybit) by introducing new spotPrivateGetUid API methods and routing corresponding endpoints to the fetchAccountId handler.

Changes

Cohort / File(s) Summary
Version Bumps
package.json, js/ccxt.js, js/ccxt.d.ts, ts/ccxt.ts
Updated version constant from 0.0.12 to 0.0.13 across all entry points
MEXC API Methods
js/src/abstract/mexc.d.ts, ts/src/abstract/mexc.ts
Added new public method spotPrivateGetUid(params?: {}): Promise<implicitReturnType> to Exchange interface
MEXC Endpoints
js/src/mexc.js, ts/src/mexc.ts
Added new 'uid' endpoint with value 1 under spot/private/get API mappings
Exchange URL Mappings
js/src/base/Exchange.js, ts/src/base/Exchange.ts
Added URL-to-method routing for fetchAccountId: MEXC (https://api.mexc.com/api/v3/uid), Binance (https://api.binance.com/api/v5/user/query-api), and Bybit (production and testnet endpoints)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A version hops up, from twelve to thirteen, ✨
New UIDs to fetch across exchanges serene,
MEXC, Binance, Bybit align with delight,
Account IDs flow like carrots at night! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Fiet/update' is vague and generic, using non-descriptive terms that don't convey meaningful information about the changeset. Replace with a descriptive title that reflects the main changes, such as 'Bump version to 0.0.13 and add account ID endpoints' or 'Add fetchAccountId support for MEXC, Binance, and Bybit exchanges'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch FIET/Update

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
ts/src/base/Exchange.ts (1)

1308-1318: Binance account‑ID mapping: consider testnet parity and confirm endpoint

Adding "https://api.binance.com/api/v5/user/query-api": "fetchAccountId" will correctly map mainnet UID queries to fetchAccountId in the override flow. Two follow‑ups:

  • Confirm this is the exact REST URL your Binance fetchAccountId implementation uses (path, version, and host).
  • Decide if you also need a testnet mapping (e.g., a testnet.binance.* host), as is done for many other Binance URLs in this map; if not, a short comment explaining why mainnet‑only is sufficient would help future readers.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ba69ee5 and 822ae5a.

📒 Files selected for processing (10)
  • js/ccxt.d.ts
  • js/ccxt.js
  • js/src/abstract/mexc.d.ts
  • js/src/base/Exchange.js
  • js/src/mexc.js
  • package.json
  • ts/ccxt.ts
  • ts/src/abstract/mexc.ts
  • ts/src/base/Exchange.ts
  • ts/src/mexc.ts
🧰 Additional context used
🧬 Code graph analysis (3)
ts/ccxt.ts (2)
js/ccxt.d.ts (1)
  • version (555-555)
js/ccxt.js (1)
  • version (41-41)
js/ccxt.js (2)
js/ccxt.d.ts (1)
  • version (555-555)
ts/ccxt.ts (1)
  • version (431-431)
js/ccxt.d.ts (2)
js/ccxt.js (1)
  • version (41-41)
ts/ccxt.ts (1)
  • version (431-431)
🔇 Additional comments (14)
package.json (1)

3-3: LGTM! Version bump is clean.

The version increment from 0.0.12 to 0.0.13 follows semantic versioning for a patch release.

js/ccxt.d.ts (1)

7-7: LGTM! Type declaration updated correctly.

The version declaration is consistent with the version bump in package.json.

ts/ccxt.ts (1)

43-43: LGTM! Version constant updated consistently.

The version is correctly synchronized with package.json and js/ccxt.d.ts, and properly assigned to Exchange.ccxtVersion on line 45.

js/src/mexc.js (1)

192-237: UID endpoint wiring into MEXC spot private GET looks structurally correct

The new 'uid': 1 entry is consistent with surrounding spot private GET definitions and ccxt’s naming scheme (it will map cleanly to spotPrivateGetUid). No structural issues in the api description.

Given that other account-related routes here use higher weights (account, tradeFee are 10), please double‑check the documented rate‑limit weight and exact path name for this UID endpoint in the MEXC spot v3 docs to avoid throttling surprises.

ts/src/abstract/mexc.ts (1)

25-35: Abstract interface update for UID endpoint is consistent with existing pattern

The spotPrivateGetUid declaration matches the established naming and typing of other spot private GET methods and lines up with the new 'uid' entry in js/src/mexc.js. Interface surface looks good.

If this file is generated, ensure the underlying generator/TS source is updated so the change is not lost on rebuild.

js/ccxt.js (1)

40-42: Version constant bump to 0.0.13 is fine—ensure all manifests are aligned

The version update and Exchange.ccxtVersion assignment are consistent here.

Please confirm that js/ccxt.d.ts, ts/ccxt.ts, and package.json all expose 0.0.13 as well so published artifacts and typings stay in sync.

js/src/abstract/mexc.d.ts (1)

23-23: UID endpoint declaration matches existing mexc interface conventions

spotPrivateGetUid follows the same naming and implicitReturnType pattern as the other spotPrivateGet* methods, so this cleanly exposes the new /api/v3/uid endpoint at the abstract layer.

ts/src/mexc.ts (1)

191-199: UID endpoint mapping looks correct; just verify end‑to‑end wiring

Adding 'uid': 1 under spot.private.get correctly represents the documented GET /api/v3/uid endpoint and keeps the rate‑limit weight consistent with MEXC’s spec. Assuming the base Exchange routing now points this path at fetchAccountId, the mexc side of that flow should work as expected; worth a quick live/API test to confirm the response shape matches what fetchAccountId expects.

js/src/base/Exchange.js (3)

336-382: MEXC uid endpoint mapping looks correct

https://api.mexc.com/api/v3/uid is added under the mexc map and routed to fetchAccountId, so methodCalled will resolve correctly for your override client. No functional issues spotted.

Please double‑check against MEXC’s latest API docs that /api/v3/uid is the exact path used by your spotPrivateGetUid call (including version and host) and that you don’t also need a separate testnet host mapped here.


1118-1305: Binance user/query-api correctly routed to fetchAccountId

The new entry "https://api.binance.com/api/v5/user/query-api": "fetchAccountId" fits the existing binance mapping pattern and will allow fetch() to tag these calls with methodCalled = 'fetchAccountId'. The prefix matching logic won’t conflict with other Binance URLs.

Confirm from Binance’s API reference that:

  • api.binance.com/api/v5/user/query-api is the endpoint your fetchAccountId implementation actually hits, and
  • you don’t also invoke a testnet or alternative host variant that should be added to this map.

1530-1578: Bybit mainnet & testnet query-api mappings are consistent

Both mainnet and testnet Bybit URLs (https://api.bybit.com/v5/user/query-api and https://api-testnet.bybit.com/v5/user/query-api) are mapped to fetchAccountId under the bybit section, matching how other Bybit endpoints are handled. This ensures the override metadata is populated for both environments.

Verify that your Bybit fetchAccountId/user/query-api calls only ever use these two hosts and paths; if any regional or legacy hosts are in use, consider adding them here as well so methodCalled is set consistently.

ts/src/base/Exchange.ts (3)

540-550: MEXC UID → fetchAccountId mapping looks consistent; please verify URL usage

The new "https://api.mexc.com/api/v3/uid": "fetchAccountId" entry aligns with the existing urlToMethodMap pattern and will correctly surface methodCalled === "fetchAccountId" for overrides when this endpoint is hit. Please double‑check:

  • That your MEXC implementation of fetchAccountId actually uses this exact URL (no trailing slash / different base host).
  • Whether you also need a testnet or futures variant mapped here, similar to other MEXC entries.

1738-1746: Bybit prod + testnet user/query-apifetchAccountId mappings align with existing pattern

The new Bybit mappings:

  • https://api.bybit.com/v5/user/query-api
  • https://api-testnet.bybit.com/v5/user/query-api

both routing to "fetchAccountId" are consistent with the rest of urlToMethodMap and ensure your override predicate/meta can distinguish account‑ID fetches for both environments.

Just make sure these are the exact URLs your Bybit implementation calls and that there are no additional network variants you care about.


3158-3170: Refactored matchedEntry / methodCalled block is behavior‑preserving

The reformatting to:

const matchedEntry: any = Object.entries(idMap).find(([prefix]) =>
    path.startsWith(prefix)
);
const methodCalled: string = matchedEntry?.[1] ?? "";

keeps the previous semantics while improving readability; methodCalled still defaults to "" when no prefix matches and logging remains guarded by this.verbose.

@victorshevtsov victorshevtsov merged commit d97e665 into main Dec 23, 2025
5 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.

4 participants