Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)*
Expand Down
2 changes: 2 additions & 0 deletions cmv3-demo-initialization/mintWithAllowlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 3 additions & 1 deletion src/hooks/useCandyMachineV3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,15 @@ export default function useCandyMachineV3(
const proofMemo = React.useMemo(() => {
if (!candyMachineOpts.allowLists?.length) {
return {
merkles: {},
verifyProof() {
return true;
},
};
}
if (!wallet.publicKey) {
return {
merkles: {},
verifyProof() {
return false;
},
Expand All @@ -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;
};
Expand Down
9 changes: 5 additions & 4 deletions src/hooks/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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 ${
Expand All @@ -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.`);
}

Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down