That's my first time creating an nft minting dapp and it's not working. I am using web3.js, connected to phantom wallet on devnet, got some sols, and trying to mint nft. For now minting arweave metadata from some tutorial. I would like to keep the code for the beginning as siple as possible. Code looks like that inside a React component:
async function onClick() {
if (!publicKey) throw new WalletNotConnectedError();
connection.getBalance(publicKey).then((bal) => {
console.log(bal/LAMPORTS_PER_SOL, "lamp sol");
});
let firstWinPrivKey = [190,149,19,..........].slice(0,32);
let secretKey = web3.Keypair.fromSeed(Uint8Array.from(firstWinPrivKey));
const mintNFTResponse = await actions.mintNFT({
connection,
wallet: new NodeWallet(Keypair.fromSecretKey(secretKey.secretKey)),
uri: 'https://www.arweave.net/1r-ImuiIxFl18UQolAoBnwLDMVcjkVAHruhtsaBpA7U?ext=json',
maxSupply: 1
});
}
In return
<div className="central-inner-container">
<button className="btn" onClick={onClick}>mint NFT</button>
</div>