Skip to content

Commit

Permalink
Move metaplex umi code. JSON and images into it's own folder
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemaccana committed Aug 23, 2024
1 parent a3a66e9 commit 81defb5
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ console.log("Loaded user:", user.publicKey.toBase58());
// and using our user to sign transactions
const umi = createUmi(connection.rpcEndpoint);
umi.use(mplTokenMetadata());
const umiKeypair = umi.eddsa.createKeypairFromSecretKey(user.secretKey);
umi.use(keypairIdentity(umiKeypair));
const umiUser = umi.eddsa.createKeypairFromSecretKey(user.secretKey);
umi.use(keypairIdentity(umiUser));

console.log(`Creating collection...`);
// This mint is like a factory for creating NFTs
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
19 changes: 10 additions & 9 deletions labs/update-metaplex-nft.ts → labs/metaplex-umi/update-nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,28 @@ const umi = createUmi(connection.rpcEndpoint).use(mplTokenMetadata());
const umiKeypair = umi.eddsa.createKeypairFromSecretKey(user.secretKey);
umi.use(keypairIdentity(umiKeypair));

// Our NFT address we made earlier
// const mint = publicKey("YOUR_MINT_ADDRESS_HERE");
const mint = publicKey("4CpLPpxvZJJViUrUpnLj5gX1ZNRvCB7jdcrjLGb9Wixi");
// Our NFT we made earlier
const nftAddress = publicKey("YOUR_NFT_ADDRESS_HERE");

// Update the NFT metadata
const initialMetadata = await fetchMetadataFromSeeds(umi, {
mint,
mint: nftAddress,
});
await updateV1(umi, {
mint,
const transaction = await updateV1(umi, {
mint: nftAddress,
data: {
...initialMetadata,
name: "Updated Asset",
symbol: "Updated",
},
}).sendAndConfirm(umi);
});

await transaction.sendAndConfirm(umi);

const createdNft = await fetchDigitalAsset(umi, mint);
const createdNft = await fetchDigitalAsset(umi, nftAddress);

console.log(
`NFT updated with new metadata URI: ${getExplorerLink(
`🆕 NFT updated with new metadata: ${getExplorerLink(
"address",
createdNft.mint.publicKey,
"devnet"
Expand Down
File renamed without changes.

0 comments on commit 81defb5

Please sign in to comment.