Which chain are you using in Web3Auth and what does your code look like? Are you using the latest @web3auth/web3auth
or CDN package? Are you using the address that Web3Auth generated for your particular login/credentials?
I used the latest @web3auth/web3auth
package 0.5.1
I used chain Rinkeby: 0x4
await enableWeb3({ provider: 'web3Auth', clientId: AppConfig.web3AuthClientId, chainId: '0x4' });
I used account from useMoralis()
const { account } = useMoralis();
I used Moralis.executeFunction
to call contract, it works with read function but not for write.
Please help me
Can you post your executeFunction code. Also check your transaction hash on https://rinkeby.etherscan.io/:
const transaction = await Moralis.executeFunction(options);
console.log(transaction);
Moralis.executeFunction({
contractAddress: CollectionConfig.contractAddress,
abi: nftContractAbi,
params: { _mintAmount: amount },
msgValue: values.tokenPrice.mul(amount),
functionName: 'mint',
})
It throw exception immediately so canât log transaction and there is no any transaction hash on scan.
I used it with provider metamask and it works well, but the error occurs with provider web3Auth
Try another testnet like Goerli / 0x5
, maybe itâs Rinkeby related. Also double check all your params/options, make sure theyâre correct.
Checked params/options, it still works well if i authenticate by metamask provider.
Most of stuffs are now on Rinkeby and try another testnet to get over this error is not really good.
Most of stuffs are now on Rinkeby and try another testnet to get over this error is not really good.
Itâs to test if Rinkeby is the problem or not with Web3Auth. Try another testnet in Web3Auth with the same wallet and do any kind of transaction e.g. send some native currency to a random address to see if it works. Make sure to transfer some money over so the wallet can pay for gas.
i found the error is âtransaction underpricedâ, is there any idea on it
Is this on Rinkeby?
Try re-authenticating via Web3Auth (clear your browserâs cache and localStorage for your app). Or just wait after trying a transaction. The âtransaction underpricedâ error occurs when youâre trying to replace a transaction and the replacing gas price is too low.
Itâs still not works for Rinkeby.
I have just changed to Goerli and there is another exception but itâs something like the transaction underpriced
{"jsonrpc":"2.0","id":7756290482616316,"error":{"code":-32000,"message":"intrinsic gas too low"}}
I know that exception belongs to gas price and gas limit, but what i used is just execute function from Moralis and i did not touch on that values.
Could you please tell me how to get over it by Moralis.
Try using a different RPC URL for Goerli (use the rpcTarget
parameter in your Moralis.authenticate along with your chainId, clientId, etc.):
I have tested Goerli with Web3Auth, I can do a Moralis.transfer normally with just the default settings:
await authenticate({
provider: 'web3Auth',
chainId: '0x5',
clientId: '',
});
So may be an issue with interacting with your contract also; you can post your contract address.
I also specificed rpcTarget
but it still dispaly error intrinsic gas too low
I also able to do a Moralis.transfer
but not able to do executeFuction
(write function)
I donât think itâs contract issue because i can read/write function with metamask provider
As itâs not possible to set gas currently in executeFunction, you can look at using ethers.js (which is what executeFunction uses) instead.
Iâm not sure why this is happening with your contract call, do you mind sharing your address and required params / value for the function. I can call a function (minting an NFT) on a Goerli contract I deployed with executeFunction
successfully. Are you using the latest Web3Auth/Moralis/react-moralis?
^ Solved over Discord, user updated to the latest Moralis SDK v1.11.0. Please create a new topic for any other issues or questions.