Psychedelic / DAB-js

JS library that wraps necessary methods to integrate DAB and its NFTs.
GNU General Public License v3.0
28 stars 19 forks source link

Some errors with getAllUserNFTs func on localhost #53

Open progforyou opened 2 years ago

progforyou commented 2 years ago

Hello, dab 0.4.4 has some errors with getAllUserNFTs func. In your file nfts_refistry.js this principal not work with plug principal. But if call with string, it work with errors. const userPrincipal = user instanceof principal_1.Principal ? user : principal_1.Principal.fromText(user); 50 errors stack

please, help with this problem

const result = await window.ic.plug.getPrincipal();
const collections = await getAllUserNFTs(
            {user: principal.toString()}
        );

"@psychedelic/dab-js": "^0.4.4", p.s. with stoic same error

but func getUserNFTs work only with plug, with stoic error

StoicIdentity.load().then(async identity => {
            if (identity !== false) {
                //ID is a already connected wallet!
            } else {
                //No existing connection, lets make one!
                identity = await StoicIdentity.connect();
            }

            //Lets display the connected principal!
            console.log(identity.getPrincipal().toText());
            console.log(identity);
            const standard = 'EXT';

            const agent = new HttpAgent({
                identity
            });
            console.log(agent);
            const NFTActor = getNFTActor({canisterId: canisterId, agent: agent, standard: standard});
            const collections = await NFTActor.getUserTokens(identity.getPrincipal());
            console.log(collections);
            //Disconnect after
            StoicIdentity.disconnect();
        })

error stoic

alejo-acevedo-deel commented 2 years ago

Hey @progforyou thanks for bring this to our attention. We really appreciate the time you take for this.

About the principal, we recommend u all use text because there is some breaking changes in the last Principal library published by dfinity and we cannot update it right now without break other things.

About the other errors, those errors are from the canister, except for the DIP721 error which is fixed in the next release. For example, No Token errors is the way that EXT collections say to us that the principal doesn't have any NFT of that collection. It is not the best way but we cannot do anything

About last error, probably the problem here is again the version of agent u are using, please use version 0.9.3 of any dfinity library. It works with plug because Plug use that version of library and u use agent provided by us.

Thanks again.

arkanine1000 commented 2 years ago

@aleacevedo I'm having the same issue, even when using version 0.9.3 of all dfinity libraries. Code is pretty much identical to progforyou's. Plug works fine as well. Any advice? image