Skip to content
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

How do I get a list of all available tokens? #399

Closed
BlinkyStitt opened this issue Mar 22, 2019 · 2 comments
Closed

How do I get a list of all available tokens? #399

BlinkyStitt opened this issue Mar 22, 2019 · 2 comments
Labels

Comments

@BlinkyStitt
Copy link

I see that I can get a list of all the possible tokens to trade by calling the rest api, but I am wanting to get the token list by making calls with web3.

I was hoping for a "get_tokens" function on KyberNetworkProxy, but I'm not seeing one. Am I missing it, or do I need to make several web3 calls? I am wanting to give my program the KyberNetworkProxy address and it should connect to web3 and make some calls and then print out all the supported tokens. It looks like this will be a multi-step process.

  1. KyberNetwork = KyberNetworkProxy.kyberNetworkContract()
  2. reserves = KyberNetwork.get_reserves()
  3. for each reserve, crc = reserve.conversionRatesContract() and then crc.getListedTokens()

I'd also like to optionally be able to limit the call to official reserves just like the rest API can, but I'm not seeing how to do that.

@yaronvel
Copy link
Contributor

Please join our telegram dev channel at
https://t.me/KyberDeveloper
For questions on the api.
As for the contract, no get tokens function, it can be collected by reading events

@ilanDoron
Copy link
Contributor

The method presented above is valid.
I would add a last step.
KyberNetworkProxy.getExpectedRate(eth, token, qty)
and
KyberNetworkProxy.getExpectedRate(token, eth, qty)
to make sure the token is actually active.

Not sure what do u mean by official reserves, but to avoid getting responses with permission less reserves.
set the flag:
PERM_HINT_GET_RATE in call to get expected rate.
this way you are sure only got rate from permission-ed liquidity resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants