Here's the error:
index.js:1 Error: Returned error: unknown account
I'm getting this error while running this method:
nftMintingContract.methods.mint(account, cid).send({from: account})
The expected behaviour for this is to have metamask opening and requiring you to sign the transaction, but instead, I get this error from the browser console.
I can't wrap my head around why this might be, I've been running other methods with the exact same syntax which have been running properly. notice the .send({from:account})
:
lpContract.methods
.approve(address, ethers.constants.MaxUint256)
.send({ from: account })
masterChefContract.methods
.deposit(pid, new BigNumber(amount).times(new BigNumber(10).pow(18)).toString())
.send({ from: account })
#and so on...
I've done some research and I've found people saying that you have to import the wallet with the private key and so on, but this cannot be the case since I've been running methods with .send({from: account})
which have been launching metamask instead and asking you to sign the transaction.
I'm fairly new to this, so any help would be kindly appreciated. Thanks!
account
?import { useWallet } from '@binance-chain/bsc-use-wallet'
const { account }: { account: string } = useWallet()
This outputs a string with the current connected walletbsc-use-wallet
.bsc-use-wallet
is a fork of Aragon'suse-wallet
, which in turn makes use ofweb3react
. Understandingweb3react
would be very useful in understanding how to connect MetaMask to your code. Are you using a React codebase?