0
Unknown processing time 
Max fee:0ETH  

This error occurs while testing a front end application with smart contract.

code :-

//this is deposit function
  function Depoist(){
    var depAmt = document.getElementById("deptAmt").value;
    web3.eth.getAccounts().then(function(account){
        var acc = account[0];
        contract.methods.depoist(depAmt).send({from : acc, maxPriorityFeePerGas: null,
    maxFeePerGas: null}).then(function(tx){
            alert(tx);
        }).catch(function(err){
            swal("Oops",err);
        })
    })

While calling this deposit function from the front end there's a gas price error in Metamask.

.


same issue . See in Photo code and issue in meta mask . Please give solution

enter image description here


code here

code of deposit and withdraw . i had changed networks but not working .

2
  • What does the function deposit do? Can you provide the contract source code?
    – Ismael
    Jun 21, 2022 at 4:11
  • function depoist(uint amt) public { require(amt > 0,"Depoist amt must greater than Zero"); balance[msg.sender] += amt; numCustomer.push(payable(msg.sender)); } Jun 22, 2022 at 5:24

1 Answer 1

0

You should provide proper amount of gasPrice. And if you're to send some Eth values to the contract, you should also provide the value like below.

Below code with gasPrice 400000 might work, but you'd better calculate it with your transaction for an accurate gas price value.

web3.eth.getAccounts().then(function (account) {
    var acc = account[0];
    contract.methods.depoist().send({
        from: acc,
        to: <YOUR_CONTRACT_ADDRESS>,
        value: <DEPOSIT_AMOUNT_IN_WEI>,
        gasPrice: 400000,
    }).then(function (tx) {
        alert(tx);
    }).catch(function (err) {
        swal("Oops", err);
    })
})
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.