Closed zachzafar closed 2 years ago
Hi there 👋
Sorry for the late reply but yes it is possible. I'm hoping to have enough time to document all of this as soon as I can but here's a snippet of code that explains how to use what we call transaction builders on the SDK.
// Get the transaction builder for the original NFT.
// Note we need to explicitly provide the mint Keypair
// to link the two transaction builders together.
const originalNftKeypair = Keypair.generate();
const originalNftBuilder = await metaplex
.nfts()
.builders()
.create({
uri: "https://arweave.net/123",
name: "My NFT",
sellerFeeBasisPoints: 500, // 5% royalties.
maxSupply: toBigNumber(10), // 10 limited editions.
useNewMint: originalNftKeypair,
});
// Get the transaction builder for the printed NFT.
const printedNftBuilder = await metaplex
.nfts()
.builders()
.printNewEdition({
originalMint: originalNftKeypair.publicKey
});
// Merge the two transaction builders together.
const transactionBuilder = originalNftBuilder.add(printedNftBuilder);
// Execute the merged transaction builder.
await metaplex.rpc().sendAndConfirmTransaction(transactionBuilder);
I hope this helps.
Thank you @lorisleiva
For example say a user wants to create a new nft, I have to upload the metadata which is one transaction, then create the actual mint which is another transaction. how would I make this one transaction?