Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metaplex create nft fails on testnet #544

Open
niket-satschel opened this issue Feb 12, 2024 · 3 comments
Open

Metaplex create nft fails on testnet #544

niket-satschel opened this issue Feb 12, 2024 · 3 comments

Comments

@niket-satschel
Copy link

niket-satschel commented Feb 12, 2024

Hi, I am trying to create an nft with @metaplex-foundation/js. It works fine on the devnet, however does not work on the testnet.

Code snippet:

async function main() {
    // create a new connection to the cluster's API
    const connection = new Connection(clusterApiUrl('testnet'), 'confirmed');

    // initialize a keypair for the user
    const user = await initializeKeypair(connection);

    console.log("PublicKey:", user.publicKey.toBase58());

    const metaplex = Metaplex.make(connection)
    .use(keypairIdentity(user))
    .use(nftStorage({ token: process.env.NFT_STORAGE_TOKEN }));

    // upload NFT data and get the URI for the metadata
    // Till this point everything is fine on testnet
    const uri = await uploadMetadata(metaplex, carNftData);

    // create an NFT using the helper function and the URI from the metadata
    const nft = await metaplex.nfts().create(
        {
            uri: uri,
            name: carNftData.name,
            sellerFeeBasisPoints: carNftData.sellerFeeBasisPoints,
            symbol: carNftData.symbol,
        },
        { commitment: "finalized" },
    );
    console.log(`NFT mintAddress: ${nft.mintAddress}`);
    console.log(`NFT metadataAddress: ${nft.metadataAddress}`);
    console.log(`NFT masterEditionAddress: ${nft.masterEditionAddress}`);
    console.log(`NFT tokenAddress: ${nft.tokenAddress}`);
    console.log(`NFT response blockhash: ${nft.response.blockhash}`);
    console.log(`NFT response signature: ${nft.response.signature}`);    
    console.log(`Token Mint: https://explorer.solana.com/address/${nft.mintAddress}?cluster=testnet`);
}

Error:

cause: SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Failed to serialize or deserialize account data: Unknown
      at Connection.sendEncodedTransaction (/home/solana/solana-workspace/solana-airdrop/node_modules/@solana/web3.js/lib/index.cjs.js:8026:13)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Connection.sendRawTransaction (/home/solana/solana-workspace/solana-airdrop/node_modules/@solana/web3.js/lib/index.cjs.js:7992:20)
      at async RpcClient.sendTransaction (/home/solana/solana-workspace/solana-airdrop/node_modules/@metaplex-foundation/js/dist/cjs/plugins/rpcModule/RpcClient.cjs:69:14)
      at async RpcClient.sendAndConfirmTransaction (/home/solana/solana-workspace/solana-airdrop/node_modules/@metaplex-foundation/js/dist/cjs/plugins/rpcModule/RpcClient.cjs:96:23)
      at async TransactionBuilder.sendAndConfirm (/home/solana/solana-workspace/solana-airdrop/node_modules/@metaplex-foundation/js/dist/cjs/utils/TransactionBuilder.cjs:115:22)
      at async Object.handle (/home/solana/solana-workspace/solana-airdrop/node_modules/@metaplex-foundation/js/dist/cjs/plugins/nftModule/operations/createNft.cjs:71:20)
      at async Disposable.run (/home/solana/solana-workspace/solana-airdrop/node_modules/@metaplex-foundation/js/dist/cjs/utils/Disposable.cjs:26:14)
      at async main (/home/solana/solana-workspace/solana-airdrop/createNFT.js:67:17) {
    logs: [
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]',
      'Program log: Error: BorshIoError',
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 3504 of 400000 compute units',
      'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: Failed to serialize or deserialize account data: Unknown'
    ]
  },
  program: {
    name: 'TokenMetadataProgram',
    address: PublicKey [PublicKey(metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s)] {
      _bn: <BN: b7065b1e3d17c45389d527f6b04c3cd58b86c731aa0fdb549b6d1bc03f82946>
    },
    errorResolver: [Function: errorResolver]
  },
  logs: [
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]',
    'Program log: Error: BorshIoError',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 3504 of 400000 compute units',
    'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: Failed to serialize or deserialize account data: Unknown'
  ]

Versions:
node.js: v18.17.1
@metaplex-foundation/js: 0.20.1
@metaplex-foundation/js-plugin-nft-storage: 0.20.0
@solana/spl-token: 0.3.11
@solana/web3.js: 1.89.1

Is this feature supported on testnet? Is there any issue with this?

@davidespataro
Copy link

Facing similar issues on testnet as well.

@niket-satschel
Copy link
Author

niket-satschel commented Feb 13, 2024

Hi @davidespataro, looks like metaplex features are not loaded on testnet. So, we can only use devnet or mainnet-beta for testing our development features. As per solana developers, testnet is used for validator testing only.

You can refer these tickets:
#345
mpl-token-metadata#91

Even in other libraries, this issue of serialize or deserialize exists. Better use devnet for testing this.

@kkHAIKE
Copy link

kkHAIKE commented Apr 5, 2024

We really need the testnet network for testing because the official devnet does not have the getSignaturesForAddress feature.😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants