[英]How to cancel a payment that awaits confirmation in Metamask using web3?
I'm working on a crypto payment system using ethers Web3Provider我正在使用 ethers Web3Provider 开发加密支付系统
web3.eth.sendTransaction(transactionObject)
After the user calls this method, this dialog is shown:用户调用此方法后,将显示此对话框:
In the app the user is able to close the payment dialog leaving this pending.在应用程序中,用户可以关闭付款对话框,使其处于待处理状态。 Is there a way to reject this payment using JS when closing the dialog inside the app?
关闭应用程序内的对话框时,有没有办法使用 JS 拒绝此付款? Clearing all payments would also be a solution but in the documentation I can't find anything about this case.
清除所有付款也是一种解决方案,但在文档中我找不到有关此案的任何信息。
Here's an article that might help: https://chainstack.com/a-developers-guide-to-the-transactions-in-mempool-metamask-edition/这是一篇可能有帮助的文章: https://chainstack.com/a-developers-guide-to-the-transactions-in-mempool-metamask-edition/
You can basically send a no eth transaction with a high fee and same account nounce as the pending transaction.你基本上可以发送一个高费用的无 eth 交易,并且与待处理的交易相同的账户通知。 This will help drop the pending transaction.
这将有助于删除待处理的事务。 This is how metamask "cancel" a transaction
这就是元掩码“取消”交易的方式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.