eliagoris / solana-mint-ui Goto Github PK
View Code? Open in Web Editor NEWUp to date mint UI for NFTs on Solana
Home Page: https://pnfts-mint-pi.vercel.app
License: MIT License
Up to date mint UI for NFTs on Solana
Home Page: https://pnfts-mint-pi.vercel.app
License: MIT License
Hey,
If you have more than 15 wallets, the instruction gets big and it breaks. Any idea how to fix it ?
I have been trying to add wallet.sendTransaction functionality to avoid blowfish wallet flags.
this is what I have done:
let builder = transactionBuilder()
.add(setComputeUnitLimit(umiWalletAdapter, { units: 1_000_000 })) // Increase compute units
.add(
mintV2(umiWalletAdapter, {
candyMachine: candyMachine.publicKey,
nftMint,
collectionMint: candyMachine.collectionMint,
collectionUpdateAuthority: candyMachine.authority,
tokenStandard: candyMachine.tokenStandard,
candyGuard: candyGuard?.publicKey,
mintArgs,
})
);
const {
context: { slot: minContextSlot },
value: { blockhash, lastValidBlockHeight }
} = await connection.getLatestBlockhashAndContext();
builder = builder.setBlockhash(blockhash);
const umiTransaction = builder.build(umi);
const web3Transaction = toWeb3JsTransaction(umiTransaction);
try {
// Simulate the transaction
const simulationResult = await connection.simulateTransaction(web3Transaction, { minContextSlot });
// Save the simulated transaction to file
const response = await fetch('/api/saveSimulationResult', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ simulationResult }),
});
if (!response.ok) {
throw new Error('Failed to save simulation result');
}
// If simulation is successful, send the transaction
const signature = await wallet.sendTransaction(web3Transaction, connection, { minContextSlot });
await connection.confirmTransaction({ blockhash, lastValidBlockHeight, signature });
setFormMessage("Minted successfully!");
and this is the simulation output:
{
"context": {
"apiVersion": "1.18.16",
"slot": 310390568
},
"value": {
"accounts": null,
"err": null,
"innerInstructions": null,
"logs": [
"Program ComputeBudget111111111111111111111111111111 invoke [1]",
"Program ComputeBudget111111111111111111111111111111 success",
"Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g invoke [1]",
"Program log: Instruction: MintV2",
"Program 11111111111111111111111111111111 invoke [2]",
"Program 11111111111111111111111111111111 success",
"Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR invoke [2]",
"Program log: Instruction: MintV2",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [3]",
"Program log: IX: Create",
"Program 11111111111111111111111111111111 invoke [4]",
"Program 11111111111111111111111111111111 success",
"Program 11111111111111111111111111111111 invoke [4]",
"Program 11111111111111111111111111111111 success",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]",
"Program log: Instruction: InitializeMint2",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2828 of 890315 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
"Program log: Allocate space for the account",
"Program 11111111111111111111111111111111 invoke [4]",
"Program 11111111111111111111111111111111 success",
"Program log: Assign the account to the owning program",
"Program 11111111111111111111111111111111 invoke [4]",
"Program 11111111111111111111111111111111 success",
"Program log: Transfer 2853600 lamports to the new account",
"Program 11111111111111111111111111111111 invoke [4]",
"Program 11111111111111111111111111111111 success",
"Program log: Allocate space for the account",
"Program 11111111111111111111111111111111 invoke [4]",
"Program 11111111111111111111111111111111 success",
"Program log: Assign the account to the owning program",
"Program 11111111111111111111111111111111 invoke [4]",
"Program 11111111111111111111111111111111 success",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]",
"Program log: Instruction: SetAuthority",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3090 of 826860 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]",
"Program log: Instruction: SetAuthority",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3250 of 820390 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 101536 of 910625 compute units",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s success",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [3]",
"Program log: IX: Mint",
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [4]",
"Program log: Create",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [5]",
"Program log: Instruction: GetAccountDataSize",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1622 of 766569 compute units",
"Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA=",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
"Program 11111111111111111111111111111111 invoke [5]",
"Program 11111111111111111111111111111111 success",
"Program log: Initialize the associated token account",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [5]",
"Program log: Instruction: InitializeImmutableOwner",
"Program log: Please upgrade to SPL Token 2022 for immutable owner support",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 759929 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [5]",
"Program log: Instruction: InitializeAccount3",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4241 of 756047 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 20443 of 771966 compute units",
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [4]",
"Program log: Instruction: MintTo",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4538 of 743804 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 61551 of 799779 compute units",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s success",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [3]",
"Program log: IX: Update",
"Program log: Auth type: Metadata",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 25665 of 731416 compute units",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s success",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [3]",
"Program log: IX: Verify",
"Program log: Clean write collection metadata",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 35713 of 700460 compute units",
"Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s success",
"Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR consumed 286925 of 948455 compute units",
"Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR success",
"Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g consumed 340427 of 999850 compute units",
"Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g success"
],
"returnData": null,
"unitsConsumed": 340577
}
}
I get this error when minting:
Error sending transaction: WalletSendTransactionError: Unexpected error
at StandardWalletAdapter.sendTransaction (adapter.js:248:23)
at async Object.eval [as sendTransaction] (WalletProviderBase.js:161:16)
at async mint (index.tsx:153:25)
@eliagoris
Hello, thanks for the web app, It works great.
I am trying to add the ability to mint multiple NFTs with one click of the mint button and one wallet approval.
The best I can do is select X amount to mint, click mint once, then have the wallet pop up X times for approval. Are you able to give me a quick overview of how to do this?
thanks
Hey there,
have downloaded this front end mint ui for the latest version of solana candy machine v3, though after updating the env variables as suggested, am only able to run the localhost testing webpage in mainnet. It seems like this is set as a default somewhere in the code.
Have tried to search a number of different terms in vs code to track down anything to do with the network rpc but am unable.
Any assistance with this would be greatly appreciated.
An additional note:
If the guard for 0 sol payment, 0 bot tax, and a defined start time is setup correctly, should the creator wallet be able to mint if intented to be a completely free public mint? Or is it forever restricted as is the creator of the candy machine?
Cheers
What about implementing the NFT payment feature?
As we try to add a TokenGate to it we get a "Account does not have correct owner" warning from the UI
creating the config.json guard in sugar seems to disconnect the guard from the candy-machine:
"guards": {
"default": {
"mintLimit": {
"id": 1,
"limit": 1
},
"startDate": {
"date": "2024-04-01 06:00:00 +0000"
},
"endDate": {
"date": "2024-04-02 18:00:00 +0000"
},
"tokenGate": {
"amount": 100000,
"mint": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
}
}
}
For now we ended up in adding the token Gate at the end and define the public key, but I am not sure if this is correct.
If we only define the tokenGate in the index.tsx and not in the candy-machine config in suger, we get another error: "Public Key mismatch"
const enabledGuardsKeys =
guards && Object.keys(guards).filter((guardKey) => guards[guardKey])
let mintArgs: Partial<DefaultGuardSetMintArgs> = {}
const tokenMintPublicKeyString = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
const tokenMint = publicKey(tokenMintPublicKeyString);
// If there are enabled guards, set the mintArgs
if (enabledGuardsKeys.length) {
// Map enabled guards and set mintArgs automatically based on the fields defined in each guard
enabledGuardsKeys.forEach((guardKey) => {
const guardObject = unwrapOption(candyGuard.guards[guardKey]);
if (!guardObject) return null;
mintArgs = { ...mintArgs, [guardKey]: some(guardObject) };
});
}
mintArgs.tokenGate = some({ mint: tokenMint });
Hi, any suggestion how to fix mint when use guards groups with pNFT?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.