-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
base unificator + okx,huobi,bitmart networks unification #18495
Draft
ttodua
wants to merge
37
commits into
ccxt:master
Choose a base branch
from
ttodua:bitmart-networks-2
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await e.fetchDepositAddress ('USDT', {network:'TRC20'});
await e.fetchDepositAddress ('USDT', {network:'ETH'});
also supports existing (obsolete exchange specific call) |
ttodua
changed the title
bitmart - networks unification
base unificator + okx,huobi,bitmart networks unification
Jul 22, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Preamble:
There are 3-types of exchanges (with regard to network-identification approach).
Type-1
This is how any normal exchange does -from fetchCurrencies their api returns one currency object with a list of supported networks like:
so, you can easily refer to any currency & network (i.e. in withdraw) with a common structure:
Type-2
Such exchanges (okx, huobi,...) does not return a normal structure from fetchCurrencies, instead they return like:
so, each chain-id is unique "junction" of several slugs (while they might also include some generic "title", which is not anywhere used in their api for I/O purposes) and you have to specifically send request (i.e. in withdraw) like:
There we use additional helpers (
this.setNetworkMappingForCurrencyNetworkJunction
...) during construction of currencies (in 'fetchCurrencies'), where we make an intermediary "common network titles" to link each networkcode to unique exchange-speicfic chain-id, like:Type-3
one of the worst time of exchange api engine structure (bitmart, etc), where fetchCurrencies api response is like:
where each currency object contains only an "unique currency id" which is actually the only way to refer to currency & network together, and in requests (in
withdraw
etc) you dont have separate fields for currency & network, instead you have just to refer them with:similarly to
this.setNetworkMappingFor**NetworkCurrency**Junction
(used in okx, huobi...) here we use a helper in fetchCurrencies:this.setNetworkMappingFor**CurrencyNetwork**Junction
Notes
handle**CurrencyId**AndParams
,handle**NetworkId**AndParams
..) added in base, we can easily wrap & add any such flavours of exchanges with just one line helpers in implementations (and removing massive custom codes from implementations), making the networks-unification possibly complete & ready for all scenarios.that makes such exchanges recognized to be different. for those exchanges, when you do
networkCodeToId ('ERC20')
(i.e. returningEth20
) here theEth20
will not be the exchange-specific chain-id which needs to be sent in request, but an "intermediary" common title, which we further use to locate the unique chain-id (i.e. erc20usdt) in temporarygeneratedNetworkData
container.(fix #15987, fix #16016 , fix #16176, fix #17422, fix #17862, fix #17027)
(related to #15789)