diff --git a/README.md b/README.md index 4dbaf30a..1edcc8de 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,9 @@ Reference UI to implement Metaplex Candy Machine V3 on frontend. - [x] Address Gate - [x] Allow List - [x] Gatekeeper -- [ ] Multi Group - - [x] Functionality - - [ ] UI +### Multi Group +*For Multi-group functionality use [restructure/multi-group](https://github.com/Solana-Studio/Candy-Machine-V3-UI/tree/restructure/multi-group) branch* ### Env Variables *All of them are optional at this moment as we're using default if they are not exists in [config.ts](src/config.ts)* diff --git a/cmv3-demo-initialization/mintWithAllowlist.ts b/cmv3-demo-initialization/mintWithAllowlist.ts index 44c6b499..57115de1 100644 --- a/cmv3-demo-initialization/mintWithAllowlist.ts +++ b/cmv3-demo-initialization/mintWithAllowlist.ts @@ -94,6 +94,8 @@ const mintingWallet = metaplex.identity().publicKey; await signers[signer].signAllTransactions(transactions); } const allowListCallGuardRouteTx = signedTransactions.shift(); + transactionBuilders.shift(); + transactions.shift(); await metaplex.rpc().sendAndConfirmTransaction(allowListCallGuardRouteTx, { commitment: "processed", }); diff --git a/package.json b/package.json index b9ceeb72..e07247c3 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "lint": "next lint" }, "dependencies": { - "@civic/solana-gateway-react": "^0.10.0", + "@civic/solana-gateway-react": "^0.11.0", "@material-ui/core": "^4.12.3", "@material-ui/icons": "^4.11.2", "@material-ui/lab": "^4.0.0-alpha.60", diff --git a/src/Home.tsx b/src/Home.tsx index 5a4c233d..865db508 100644 --- a/src/Home.tsx +++ b/src/Home.tsx @@ -380,7 +380,7 @@ const Home = (props: HomeProps) => { signTransaction: wallet.signTransaction, }} gatekeeperNetwork={guards.gatekeeperNetwork} - clusterUrl={connection.rpcEndpoint} + connection={connection} cluster={ process.env.NEXT_PUBLIC_SOLANA_NETWORK || "devnet" } diff --git a/src/hooks/useCandyMachineV3.tsx b/src/hooks/useCandyMachineV3.tsx index 84c12152..6789ef62 100644 --- a/src/hooks/useCandyMachineV3.tsx +++ b/src/hooks/useCandyMachineV3.tsx @@ -83,6 +83,7 @@ export default function useCandyMachineV3( const proofMemo = React.useMemo(() => { if (!candyMachineOpts.allowLists?.length) { return { + merkles: {}, verifyProof() { return true; }, @@ -90,6 +91,7 @@ export default function useCandyMachineV3( } if (!wallet.publicKey) { return { + merkles: {}, verifyProof() { return false; }, @@ -112,7 +114,7 @@ export default function useCandyMachineV3( ) => { let merkle = merkles[label]; if (!merkle) return; - const verifiedProof = !!merkle.proof; + const verifiedProof = !!merkle.proof.length; const compareRoot = merkle.tree.getRoot().equals(Buffer.from(merkleRoot)); return verifiedProof && compareRoot; }; diff --git a/src/hooks/utils.ts b/src/hooks/utils.ts index 9ef50771..1cab7264 100644 --- a/src/hooks/utils.ts +++ b/src/hooks/utils.ts @@ -255,7 +255,7 @@ export const parseGuardGroup = async ( nfts: nftHoldings.filter((y) => y.collection?.address.equals(guardsInput.nftBurn.requiredCollection) ), - requiredCollection: guardsInput.nftPayment.requiredCollection, + requiredCollection: guardsInput.nftBurn.requiredCollection, }; // guardsParsed.payments.push({ // criteria: 'pay', @@ -295,7 +295,7 @@ export const parseGuardGroup = async ( nfts: nftHoldings.filter((y) => y.collection?.address.equals(guardsInput.nftGate.requiredCollection) ), - requiredCollection: guardsInput.nftPayment.requiredCollection, + requiredCollection: guardsInput.nftGate.requiredCollection, }; // guardsParsed.payments.push({ // criteria: 'have', @@ -446,7 +446,8 @@ export const parseGuardStates = ({ const tokenAccount = tokenHoldings.find((x) => x.mint.equals(guards.gate?.token.mint) ); - let canPayFor = tokenAccount.balance > guards.gate?.token.amount ? 10 : 0; + let canPayFor = + tokenAccount && tokenAccount.balance > guards.gate?.token.amount ? 10 : 0; if (!canPayFor) states.messages.push( `Don't have enough ${ @@ -468,7 +469,7 @@ export const parseGuardStates = ({ states.isWalletWhitelisted = !!guards.allowed.find((x) => x.equals(walletAddress) ); - if (states.isWalletWhitelisted) + if (!states.isWalletWhitelisted) states.messages.push(`Not allowed to mint.`); } diff --git a/yarn.lock b/yarn.lock index 7fa0e2b5..e53d27f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -172,22 +172,22 @@ near-api-js "^0.44.2" near-seed-phrase "^0.2.0" -"@civic/common-gateway-react@^0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@civic/common-gateway-react/-/common-gateway-react-0.5.0.tgz#b9ea5df8e47822874c620213293f058c0883c32b" - integrity sha512-vgUKxTZViDB82fOnJ6dLl0KnG7M7V39vKoT7YtLt+vijlo8JjUdT2s6agp8RfZ3aK92fELg71bgEv68tee+Huw== +"@civic/common-gateway-react@^0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@civic/common-gateway-react/-/common-gateway-react-0.6.0.tgz#29a24764b7ff87ab87d96cfc54731085ddbaca87" + integrity sha512-qKft9147Bluzkb+jnocHWZcQ+qbYD59T4nzsnv46kr88oGBNtNmr6Sk5KEIGLbj9Vrfiwgthq9LokaqCeitOuA== dependencies: fetch-retry-ts "^1.1.24" iframe-resizer-react "^1.1.0" ramda "^0.27.1" styled-components "^5.3.1" -"@civic/solana-gateway-react@^0.10.0": - version "0.10.0" - resolved "https://registry.yarnpkg.com/@civic/solana-gateway-react/-/solana-gateway-react-0.10.0.tgz#5d0954414792bc82036a1a79eb61f9713b0ab091" - integrity sha512-WYYv7z3EvjJm4AAuReyz7j8t0mpY8DrnZ+CN6rwQ/SuFTmBQ4oKtTBANNlLOLDJp19GAHceTWvbHRwrY0CygYQ== +"@civic/solana-gateway-react@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@civic/solana-gateway-react/-/solana-gateway-react-0.11.0.tgz#b7d025e6855b94bab1cb5100c383798775536285" + integrity sha512-oyJhc+Mm9/qc8wpkD0l3FsNsJ8R5W64/nJxn022WJPVweS+Qk+iUTkIzJ2D/r6Em/vQaR+iqnKq5AVHNiXDhKQ== dependencies: - "@civic/common-gateway-react" "^0.5.0" + "@civic/common-gateway-react" "^0.6.0" "@identity.com/prove-solana-wallet" "^0.3.1" "@identity.com/solana-gateway-ts" "0.9.0" "@solana/web3.js" "^1.63.0"