Skip to content

Commit

Permalink
added back coupon mint
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenRepublic committed Mar 16, 2024
1 parent 49cbd03 commit d353451
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
NEXT_PUBLIC_CANDY_MACHINE_ID=CiAnxgxAtM1pTdNoeZ8nqeTYBM5mPEdQHdwhXfqeS3Th
NEXT_PUBLIC_RPC_ENDPOINT=https://rpc.hellomoon.io/6b758f53-4b78-41a7-86a9-6b61c97711eb

# NEXT_PUBLIC_CANDY_MACHINE_ID=AyHSw2Xxra5zpf5ycsLFzjAYcDDLs4iGWuLMoXFR3bMA
# NEXT_PUBLIC_CANDY_MACHINE_ID=EPDMTLPBkidL1fXamZUXG9Yp4ZSVsg4QpWdPsKuVUx32
# NEXT_PUBLIC_RPC_ENDPOINT=https://devnet.helius-rpc.com/?api-key=14091e35-f13b-4071-9578-410522205b40
42 changes: 36 additions & 6 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,7 @@ export default function Home() {
umi.programs.add(getMplCandyMachineCoreProgram(umi));
umi.programs.add(createSplAssociatedTokenProgram());
umi.programs.add(createSplTokenProgram());

const transactions = await createCouponMintTxs(umi);

const sigs = await sendTransactions(umi, transactions);

await confirmTransactions(umi, sigs);
Expand Down Expand Up @@ -277,6 +275,8 @@ export default function Home() {
umi.programs.add(createSplTokenProgram());

const transactions = await createTokenMintTxs(umi);
await umi.rpc.getLatestBlockhash()
console.log("TEST1")
console.log(transactions[0]);
const sigs = await sendTransactions(umi, transactions);
console.log(sigs[0]);
Expand Down Expand Up @@ -388,7 +388,7 @@ export default function Home() {
{collection?.json?.description}
</p>
<p style={{ color: "#807a82", marginBottom: "32px" }}>
More about Rubians <a href="https://zenwiki.gitbook.io/zen-republic-wiki/nft-collections/rubians" style={{ color: "#007bff", textDecoration: "underline" }}>here</a>
More about Rubians <a href="https://www.bento.me/rubians" style={{ color: "#007bff", textDecoration: "underline" }}>here</a>
</p>

{/* <p style={{textAlign: "center"}}>
Expand Down Expand Up @@ -432,9 +432,9 @@ export default function Home() {
{isLoading ? "Minting Rubian..." : "Use Voucher (Free)"}
</button>
<br></br>
{/* <button disabled={!publicKey || isLoading} onClick={handleCouponMintV2}>
{isLoading ? "Minting Rubian..." : "Use 50% Off Coupon"}
</button> */}
<button disabled={!publicKey || isLoading} onClick={handleCouponMintV2}>
{isLoading ? "Minting Rubian..." : "Use 25% Off Coupon"}
</button>

<WalletMultiButton
style={{
Expand Down Expand Up @@ -517,3 +517,33 @@ export const confirmTransactions = async (
export const base58Signature = (sig: Uint8Array) => {
return base58.encode(sig);
};

// export const confirmTransactions = async (
// umi: Umi,
// signatures: Uint8Array[]
// ) => {
// console.log("Starting confirmTransactions function...");
// try {
// const confirmations = await Promise.all(
// signatures.map(async (sig) => {
// console.log("Processing signature:", sig);
// const latestBlockhash = await umi.rpc.getLatestBlockhash();
// console.log("Latest blockhash:", latestBlockhash);
// const confirmation = await umi.rpc.confirmTransaction(sig, {
// strategy: {
// type: "blockhash",
// ...latestBlockhash,
// },
// commitment: "finalized",
// });
// console.log("Confirmation:", confirmation);
// return confirmation;
// })
// );
// console.log("All transactions confirmed.");
// return confirmations;
// } catch (error) {
// console.error("Error in confirmTransactions:", error);
// throw error;
// }
// };
4 changes: 2 additions & 2 deletions utils/candymachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {

const candyMachine = publicKey(
"CiAnxgxAtM1pTdNoeZ8nqeTYBM5mPEdQHdwhXfqeS3Th"
// "AyHSw2Xxra5zpf5ycsLFzjAYcDDLs4iGWuLMoXFR3bMA"
// "EPDMTLPBkidL1fXamZUXG9Yp4ZSVsg4QpWdPsKuVUx32"
);

const tokenMint = publicKey(
Expand All @@ -31,7 +31,7 @@ import {
);

const couponMint = publicKey(
"F5GmVdKrwdBUgBwKXLVjcd57WBVaVvsiX89kVNmHyfPP"
"2jVEPco6pMAzKG4RijGyarXZcJGuDNZ2ATAjve9dbKc1"
);

const fundReceiver = publicKey("rbyDXhzsM2xXtV3t9aayYR3md9rY6gyBxbQBeLThtSC");
Expand Down

0 comments on commit d353451

Please sign in to comment.