metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.32k stars 6.26k forks source link

MetaplexError: Account Not Found #2238

Open zhaodong-wang opened 2 years ago

zhaodong-wang commented 2 years ago

Hi there, I got an error when trying to use metaplex SDK, here is the MWE:

const mint = new PublicKey("GkCYKY6iLuNjoRmNuBHDRMUtcUCSE5buiQpPeq9iuq5u");
const nft = await metaplex.nfts().findByMint(mint).run();
console.log(nft);

I should get the nft data as shown here: https://explorer.solana.com/address/GkCYKY6iLuNjoRmNuBHDRMUtcUCSE5buiQpPeq9iuq5u

However, I got the following error:

MetaplexError: Account Not Found
>> Source: SDK
>> Problem: The account of type [MasterEditionV1 | MasterEditionV2 | Edition] was not found at the provided address [9s599qNexG4sPVJ37A6iFeFvipeBvQhzWgvR8VZurxVa].
>> Solution: Ensure the provided address is correct and that an account exists at this address.

    at assertAccountExists (/Users/zhaodongwang/Documents/GitHub/indexer/prisma/node_modules/@metaplex-foundation/js/src/types/Account.ts:115:11)
    at Object.toOriginalOrPrintEditionAccount (/Users/zhaodongwang/Documents/GitHub/indexer/prisma/node_modules/@metaplex-foundation/js/src/types/Account.ts:102:7)
    at Object.handle (/Users/zhaodongwang/Documents/GitHub/indexer/prisma/node_modules/@metaplex-foundation/js/src/plugins/nftModule/findNftByMint.ts:51:30)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at /Users/zhaodongwang/Documents/GitHub/indexer/prisma/node_modules/@metaplex-foundation/js/src/utils/Task.ts:82:23
    at Disposable.run (/Users/zhaodongwang/Documents/GitHub/indexer/prisma/node_modules/@metaplex-foundation/js/src/utils/Disposable.ts:34:14)
    at main (/Users/zhaodongwang/Documents/GitHub/indexer/prisma/tests/solana-tests.ts:21:15)
[ERROR] 00:55:57 MetaplexError: Account Not Found
>> Source: SDK
>> Problem: The account of type [MasterEditionV1 | MasterEditionV2 | Edition] was not found at the provided address [9s599qNexG4sPVJ37A6iFeFvipeBvQhzWgvR8VZurxVa].
>> Solution: Ensure the provided address is correct and that an account exists at this address.

How can I fix this?

kaimzhou commented 2 years ago

I had the same problem.

polarysfoundation commented 2 years ago

I think I've seen that error before, and it usually happens when the address you're trying to make the transaction with has no funds.

Spizzerp commented 1 year ago

Hey, did you figure this out?

jim4067 commented 1 year ago

@Spizzerp, try this answer from stack overflow

JonDelWeb commented 1 year ago

Hi !

I try to fetch metadata for a list of token mint with this method :

const mintAddress = new PublicKey(7drEXLpjGHZew6MBFydX2zmofSErBtyQxexqhQ4c74X9); const nft = await metaplex.nfts().findByMint({ mintAddress });

but I still continue to have the same error ? Are there any solution ?

For example, the error occur with this address :

7drEXLpjGHZew6MBFydX2zmofSErBtyQxexqhQ4c74X9 HqWFwZBbBkNL65XXVAH6wbC8EWmZmooDLJy8uSUj6hYV

and I don't have any idea how to manage with it...

Thanks

paivinayak187 commented 1 year ago

The address mentioned in this issue is that of a "token" and not "nft"

Using the token module, will fetch the correct details

const mint = new PublicKey("GkCYKY6iLuNjoRmNuBHDRMUtcUCSE5buiQpPeq9iuq5u");
const token = await metaplex.tokens().findMintByAddress({
            address: mint
 });
console.log(token);

Output:

{
    "model": "mint",
    "address": "GkCYKY6iLuNjoRmNuBHDRMUtcUCSE5buiQpPeq9iuq5u",
    "mintAuthorityAddress": "NFTsPae8pUuvKHiUHpXfZaQwwbiVPw6dPCWpwfvrwR6",
    "freezeAuthorityAddress": "NFTsPae8pUuvKHiUHpXfZaQwwbiVPw6dPCWpwfvrwR6",
    "decimals": 0,
    "supply": {
        "basisPoints": "2f6c",
        "currency": {
            "symbol": "Token",
            "decimals": 0,
            "namespace": "spl-token"
        }
    },
    "isWrappedSol": false,
    "currency": {
        "symbol": "Token",
        "decimals": 0,
        "namespace": "spl-token"
    }
}