multiversx / mx-sdk-js-network-providers

Network Provider (API, Gateway) components (compatible with sdk-js).
Other
6 stars 6 forks source link

Assets is returning empty array #15

Closed ilyich-erd closed 1 year ago

ilyich-erd commented 2 years ago

I'm calling

apiNetworkProvider.getNonFungibleToken(
      collection,
      nonce
);

in it's response assets is an empty array [].

I think this issue is related to: https://github.com/ElrondNetwork/elrond-sdk-erdjs-network-providers/blob/af289fa7e89107d26c9b6a3827579906063cf046/src/tokens.ts#L80

since payload does not have assets key, it instead has uris.

Is it something that we can fix?

andreibancioiu commented 2 years ago

Hello @ilyichvismara, and thank you for the details :pray:

We will most probably include a fix for this in https://github.com/ElrondNetwork/elrond-sdk-erdjs-network-providers/pull/14.

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:

ilyich-erd commented 2 years ago

Hello @ilyichvismara, and thank you for the details 🙏

We will most probably include a fix for this in #14.

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:

Yeah It's what I did, thanks for the incoming fix

schimih commented 1 year ago

Fix in #14