1

Im surching and trying now about 3 days, but I never find a simple answer:

Where do I find, a step by step doc, to install the metaplex-foundation "file". I´ve already done the "npm install @metaplex-foundation/js @solana/web3.js" then tried with:

import { Metaplex } from "@metaplex-foundation/js"; import { Connection, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection(clusterApiUrl("mainnet-beta")); const metaplex = new Metaplex(connection);

and getting this error: -bash: syntax error near unexpected token `('

Can someone provide with a really simple doc to install and create then the metaplex account V 2 or 3?

I´ve already created a token wiht metaboss, but could not update my metadata. So I tried to do a new one with a pic (I forgot the pic at the first time). I generate the token with metaboss, but already do not see the pic, just "Token Logo" but not my pic. May someone also help me here? I put the uri in the metadata (uploadet up on pinata).

I searched for all this stuff, but as newbie, its not that easy :D

Thank you

1
  • For your first error: This indicates a syntax error in your code, so it would be helpful if you could post the full code you're using. The second part is unrelated, so I suggest you open a separate question for that.
    – Jon C Fan
    Commented Jan 2 at 8:05

1 Answer 1

2

It looks like you are running your javascript file as a bash script. You will need to install and use Node. Name your file index.mjs, then run it with node ./index.mjs

You will need to bring in the private key for the update authority and do something like this:

const connection = new Connection(clusterApiUrl("mainnet-beta"));
const metaplex = new Metaplex(connection);
const mint = "The mint address of the NFT you want to update";
const keypair = Keypair.fromSecretKey(Uint8Array.from([The funded update authority key here in an array of decimal numbers]))
(async () => {
    metaplex.use(keypair);
    const nft = await metaplex.nfts().findByMint({ mintAddress: new PublicKey(mint)});
    const sig = await metaplex.nfts().update({
        nftOrSft: nft,
        uri: "http://example.com/new-metadata.json",
    })
    console.log(sig);
})()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.