elrond-sdk-erdjs
elrond-sdk-erdjs copied to clipboard
Tokens are missing properties from the API
Hello Team,
I work with the Tokens FungibleTokenOfAccountOnNetwork and NonFungibleTokenOfAccountOnNetwork and I notice they are missing a lot of properties from the API. I try to get the Assets from it with the Token Logo and so but it is not possible at the moment.
Thank you!
Is the import incorrect too? Because I need to import like this import { FungibleTokenOfAccountOnNetwork } from '@elrondnetwork/erdjs/out/networkProvider/tokens'
But this is the normal I think which is not working import { FungibleTokenOfAccountOnNetwork } from '@elrondnetwork/erdjs'
Hello @keyur555!
Please use getToken()
/ getNFTToken()
from the old (current) provider for the moment: https://github.com/ElrondNetwork/elrond-sdk-erdjs/blob/main/src/apiProvider.ts.
The new INetworkProvider
interface is designed to be a replacement for IApiProvider
and IProxyProvider
. Though, it's not finalized yet.
Hello @keyur555!
Do you think you can specify which function of the provider do you use?
In erdjs 10, the network providers have been extracted to a separate repository:
- https://github.com/ElrondNetwork/elrond-sdk-erdjs-network-providers/blob/main/src/proxyNetworkProvider.ts
- https://github.com/ElrondNetwork/elrond-sdk-erdjs-network-providers/blob/main/src/apiNetworkProvider.ts
Extra reference:
- https://docs.elrond.com/sdk-and-tools/erdjs/erdjs-cookbook/#creating-network-providers
@andreibancioiu Sorry to reopen this again. I use the ApiNetworkProvider from ErdJs 10 and the method getFungibleTokensOfAccount
and I would like to access all properties of the Tokens. Including the Assets like the Logo image URL of the tokens.
I don't know it but i think it is just missing properties in the code because the API returns it?
Indeed, the API returns it: https://devnet-api.elrond.com/tokens/WEB-5d08be
We will add the missing fields in https://github.com/ElrondNetwork/elrond-sdk-erdjs-network-providers, as well. Thanks for raising the issue :pray:
However, until then, you can switch to performing direct HTTP requests against the API (and using your own, tailored data structures). This is our current recommendation:
The default classes
ApiNetworkProvider
/ProxyNetworkProvider
should only be used as a starting point. As your dApp matures, make sure you switch to using your own network provider, tailored to your requirements (whether deriving from the default ones or writing a new one, from scratch) that directly interacts with the Elrond API (or Gateway).
Further reference:
- https://docs.elrond.com/sdk-and-tools/erdjs/extending-erdjs/
Close the issue, thanks to: https://github.com/multiversx/mx-sdk-js-network-providers/pull/14.