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 NFTActor.getUserTokens on localhost #84

Open icpxy opened 2 years ago

icpxy commented 2 years ago

Hello team,

I am trying to get the pxy nfts using dabjs. I am able to get actor with the call getNFTActor. However, getUserTokens is failing with the error as pasted in the screenshot below. Is there something I am missing? Please help. Thank you for your time and contribution to the dev community :-)

    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());

        const canisterId = '46sy3-aiaaa-aaaah-qczza-cai';
        const standard = 'EXT';

        const agent = new HttpAgent({identity});
        console.log('agent: ' + agent);

        const NFTActor = getNFTActor({ canisterId, agent, standard });
        console.log('actor: ' + NFTActor);

        const userTokens = await NFTActor.getUserTokens(identity.getPrincipal());
        console.log('tokens: ' + userTokens);

       //Disconnect after
        StoicIdentity.disconnect();
      })

image

icpxy commented 2 years ago

And if I specify the host-url,

        const agent = new HttpAgent({host: 'https://boundary.ic0.app', identity});

it throws new error below on the getUserTokens call...

(BLS DER-encoded public key must be 133 bytes long....)

image

icpxy commented 2 years ago

I added agent.fetchRootKey().catch(console.error); but to no avail. It times out after 3 mins or 30 mins (i dont exactly remember).

Sorry to flood the channel...

ozwaldorf commented 2 years ago

host should just be https://ic0.app for mainnet, might fix this issue