How to create a wallet without a private key in Ethers.js

I’ve been working on a front end for a project and have been trying to understand ethers. My problem is that I need to Mint a coin to the persons wallet who has chosen to mint it on the front end. I cannot get my head around how to accomplish this bc of ethers wallet creation. It requires a private key to create a wallet and a wallet is the only way that I have found to be able to sign transactions in ether and proceed with the transaction successfully. How would I create a wallet using the current connected metamask wallet to sign the transaction. I dont want to ask for their private key for security reasons. Is there something that I am missing?

const signer = provider.getSigner(accounts[0]);     contract = contract.connect(signer);               const estGas = await contract.estimateGas.AddToWhitelist(['0x353f4592E1f131CaC58c369fA9758ea37283DAf6'],['1']);     const item = await contract.populateTransaction.AddToWhitelist(['0x353f4592E1f131CaC58c369fA9758ea37283DAf6'],['1']);     item.gasLimit = estGas;     item.gasPrice = await provider.getGasPrice();     item.nonce = await provider.getTransactionCount(wallet.address);          const signed = await signer.signTransaction(item);     const submitted = await provider.sendTransaction(signed);     const approveReceipt = await submitted.wait(); 

The above code is an example where the signer is not able to sign the transaction because of an error stating "signing transactions is unsupported".

How to create a wallet without a private key in Ethers.js

Shopping cart
There are no products in the cart!
Continue shopping