Hi. Iâm using "moralis": "^0.0.124", "react-moralis": "^0.2.8".
It seems that under some scenarios I lose âconnectionâ with MetaMask. It happens, for example, if I originally authenticated with MetaMask at the root of the site, and then go to a different route like /mynfts
. In the new page, Moralis still tells me that the user isAuthenticated
, user.attributes.accounts
gives me the correct user address, but MetaMask just doesnât prompt anymore when I call an SDK function that triggers a transaction (like minting an NFT).
I have to Clear Site Data in Chrome to be able to be unauthenticated again, and start the process all over again to be able to prompt MetaMask.
For example, in the /mynfts
route I have this button. When I click on it, Chrome console shows
User authenticated? True
<correct user address>
but I get a 400 Bad Request error, code: 141, error: 'required param address not provided'}
<button onClick={
async () => {
console.log("User authenticated? " + isAuthenticated)
console.log(user.attributes.accounts)
const result = await web3Api.account.getNFTsForContract({
chain: 'bsc testnet',
token_address: contractAddress
})
console.log(result)
}}
>Fetch NFTs</button>
Even if I go back to the root of the site, where some functions were correctly prompting MetaMask before changing the route, those same functions doesnât prompt MetaMask anymore.
Any help will be appreciated!