hi everybody , i want to run a code after request confirmed . how ?
this is my code :
ethereum.request({
method: 'eth_sendTransaction',
params: [txConfig],
}).then((data)=>{
if(data.message==undefined){
console.log(data);
}else{
console.log('err transaction');
}
}).catch((errors)=>{
console.log(errors);
});
1 Like
Hello @ho3einfaramarzi, welcome to MetaMask community!
You can try going through the MetaMask docs and Github repository for a solution to your issue.
1 Like
@ho3einfaramarzi
Hello, I don’t quite understand what your problem is, perhaps incorrect type casting in comparison
(line 5)
Please see the javascript documentation as requested Strict Equality
2 Likes
hi , this is a simple code .
i want to wait for confirmation transaction
Hi, try a finally block to mutate the state after the transaction is completed
try {
return await contract.methods
.someContractFunction()
.send({ from: account.account, value: priceInWei });
} catch (error) {
throw new Error(error.message);
} finally {
// immediately update state after tx
}
1 Like
system
Closed
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.