You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fetchClient.getSolanaCollectibles() results in error: Module not found: Can't resolve 'encoding' in '/Users/USER/Desktop/audius-nft/audius-nft/node_modules/node-fetch/lib'
#26
Open
tesla809 opened this issue
Oct 26, 2023
· 0 comments
fetchClient.getSolanaCollectibles() as described in the docs does not work and results in the error
error: Module not found: Can't resolve 'encoding' in '/Users/USER/Desktop/audius-nft/audius-nft/node_modules/node-fetch/lib'
Instead, had to use fetchClient.getSolanaCollectibles(["ADDRESS"]).
To Reproduce
see below code: src/app/page.tsx
importReact,{useEffect,useState}from"react";importImagefrom"next/image";import{FetchNFTClient}from"@audius/fetch-nft";importNFTfrom"./NFT";// FETCH test dataasyncfunctiongetPuppers(){constresponse=awaitfetch("https://dog.ceo/api/breeds/image/random",{cache: "no-cache",});constdata=awaitresponse.json();returndata;}// NFT// upon checking Opensea the address: GrWNH9qfwrvoCEoTm65hmnSh4z3CD96SfhtfQY6ZKUfY// doesn't yield anything.// Where is this data being pulled from?asyncfunctiongetSolanaCollectibles(){// Initialize fetch clientconstfetchClient=newFetchNFTClient();// // Fetching Solana collectibles for the given walletsreturnfetchClient.getSolanaCollectibles(["GrWNH9qfwrvoCEoTm65hmnSh4z3CD96SfhtfQY6ZKUfY"]).then(({ res })=>{returnres;});// return fetchClient// .getCollectibles({// solWallets: ["GrWNH9qfwrvoCEoTm65hmnSh4z3CD96SfhtfQY6ZKUfY"],// })// .then((res) => {// return res;// });}// TESTING OUT OPENSEA API since Fetch-API is causing issues for setupasyncfunctiongetEthereumCollectibles(){constsdk=require("api")("@opensea/v2.0#1nqh2zlnvr1o4h");sdk.auth("04c8ae776ac44b4cabebbed161dfbc8c");sdk.server("https://api.opensea.io");returnawaitsdk.list_nfts_by_account({chain: "ethereum",address: "0x5A8443f456f490dceeAD0922B0Cc89AFd598cec9",}).then(({ data })=>{returndata;}).catch((err)=>console.error(err));}exportdefaultasyncfunctionHome(){constdogs=awaitgetPuppers();console.log(dogs);letsolAssets;constgetSolData=awaitgetSolanaCollectibles().then((res)=>{// pluck out the Solana NFT datasolAssets=res;// get base objectconsole.log("WORKING DATA:",solAssets);});solAssets=solAssets.solCollectibles["GrWNH9qfwrvoCEoTm65hmnSh4z3CD96SfhtfQY6ZKUfY"];console.log("??????????:",solAssets);letethAssets;constgetEthData=awaitgetEthereumCollectibles().then((res)=>{ethAssets=res;// get base objectconsole.log("WORKING DATA:",ethAssets);console.log("DATA 1:",ethAssets.nfts);});return(<div><h1>Audius Data</h1><h2>Ethereum Collectables</h2><NFTdata={ethAssets.nfts}/><h2>Solana Collectables</h2><NFTdata={solAssets}/><h1>Doggos Data</h1><Imagesrc={dogs.message}width={500}height={500}alt="doggos"priority/></div>);}
Expected behavior
Expected to see Solana data upon running npm run dev. by using the fetchClient.getSolanaCollectibles()
OS: MacOS 13.4 - Ventura
NextJS: 13
Node version: V20.5.0
Npm version: 9.8.1
Browser name and version: Chrome 118.0.5993.70
Additional context:
The text was updated successfully, but these errors were encountered:
tesla809
changed the title
fetchClient.getSolanaCollectibles() as described in the docs does not work. fetchClient.getSolanaCollectibles() results in error: Module not found: Can't resolve 'encoding' in '/Users/USER/Desktop/audius-nft/audius-nft/node_modules/node-fetch/lib'
Oct 26, 2023
Describe the bug
fetchClient.getSolanaCollectibles()
as described in the docs does not work and results in the errorerror: Module not found: Can't resolve 'encoding' in '/Users/USER/Desktop/audius-nft/audius-nft/node_modules/node-fetch/lib'
Instead, had to use
fetchClient.getSolanaCollectibles(["ADDRESS"])
.To Reproduce
see below code:
src/app/page.tsx
Expected behavior
Expected to see Solana data upon running
npm run dev
. by using thefetchClient.getSolanaCollectibles()
Your environment
Dev Environment
package.json
OS
OS: MacOS 13.4 - Ventura
NextJS: 13
Node version: V20.5.0
Npm version: 9.8.1
Browser name and version: Chrome 118.0.5993.70
Additional context:
The text was updated successfully, but these errors were encountered: