浏览代码

docs: Update mint without Guards and mint with Guards example (#290)

coderhyy 11 月之前
父节点
当前提交
f9f43d2cf3
共有 1 个文件被更改,包括 17 次插入17 次删除
  1. 17 17
      src/pages/candy-machine/guides/airdrop-mint-to-another-wallet.md

+ 17 - 17
src/pages/candy-machine/guides/airdrop-mint-to-another-wallet.md

@@ -81,7 +81,7 @@ In this section the code Snippets for the mint functions in Javascript are shown
 
 
 When minting to another wallet using Typescript, there are two main approaches depending on whether your Candy Machine uses guards:
 When minting to another wallet using Typescript, there are two main approaches depending on whether your Candy Machine uses guards:
 
 
-### Mint without guards
+### Mint without Guards
 For Candy Machines without guards, use `mintFromCandyMachineV2`. This function allows you to directly specify the recipient as the `nftOwner`.
 For Candy Machines without guards, use `mintFromCandyMachineV2`. This function allows you to directly specify the recipient as the `nftOwner`.
 
 
 ```js
 ```js
@@ -93,21 +93,13 @@ const mintTx = await transactionBuilder()
   .add(setComputeUnitLimit(umi, { units: 800_000 }))
   .add(setComputeUnitLimit(umi, { units: 800_000 }))
   .add(createMintWithAssociatedToken(umi, { mint: nftMint, owner: recipient }))
   .add(createMintWithAssociatedToken(umi, { mint: nftMint, owner: recipient }))
   .add(
   .add(
-    mintV2(umi, {
-      candyMachine: candyMachineAccount.publicKey,
+    mintFromCandyMachineV2(umi, {
+      candyMachine: candyMachine.publicKey,
+      mintAuthority: umi.identity,
+      nftOwner: recipient,
       nftMint,
       nftMint,
-      token: findAssociatedTokenPda(umi, {
-        mint: nftMint.publicKey,
-        owner: recipient,
-      }),
       collectionMint: candyMachineAccount.collectionMint,
       collectionMint: candyMachineAccount.collectionMint,
       collectionUpdateAuthority: candyMachineAccount.authority,
       collectionUpdateAuthority: candyMachineAccount.authority,
-      tokenStandard: TokenStandard.NonFungible,
-      mintArgs: {
-        mintLimit: some({ // The guards that require mintArgs have to be specified here 
-          id: 1,
-        }),
-      },
     })
     })
   )
   )
   .sendAndConfirm(umi, {
   .sendAndConfirm(umi, {
@@ -283,13 +275,21 @@ const mintTx = await transactionBuilder()
   .add(setComputeUnitLimit(umi, { units: 800_000 }))
   .add(setComputeUnitLimit(umi, { units: 800_000 }))
   .add(createMintWithAssociatedToken(umi, { mint: nftMint, owner: recipient }))
   .add(createMintWithAssociatedToken(umi, { mint: nftMint, owner: recipient }))
   .add(
   .add(
-    mintFromCandyMachineV2(umi, {
-      candyMachine: candyMachine.publicKey,
-      mintAuthority: umi.identity,
-      nftOwner: recipient,
+    mintV2(umi, {
+      candyMachine: candyMachineAccount.publicKey,
       nftMint,
       nftMint,
+      token: findAssociatedTokenPda(umi, {
+        mint: nftMint.publicKey,
+        owner: recipient,
+      }),
       collectionMint: candyMachineAccount.collectionMint,
       collectionMint: candyMachineAccount.collectionMint,
       collectionUpdateAuthority: candyMachineAccount.authority,
       collectionUpdateAuthority: candyMachineAccount.authority,
+      tokenStandard: TokenStandard.NonFungible,
+      mintArgs: {
+        mintLimit: some({ // The guards that require mintArgs have to be specified here 
+          id: 1,
+        }),
+      },
     })
     })
   )
   )
   .sendAndConfirm(umi, {
   .sendAndConfirm(umi, {