简体   繁体   English

如何在Metamask扩展中处理拒绝交易

[英]How to handle reject transaction in metamask extension

If we creating a transaction to smart contract via metamask and user doesn't confirm it, it stays in list of transactions and user can send it much later, or reject it in another tab. 如果我们通过元掩码创建到智能合约的交易,但用户未确认该交易,则该交易会保留在交易列表中,并且用户可以稍后发送该交易,或在其他选项卡中拒绝该交易。 Is there any way to check that transaction was rejected or still waits for user confirmation 有什么方法可以检查交易是否被拒绝还是仍在等待用户确认

You have to take the address of user from which he/she is sending amount. 您必须输入要发送其金额的用户的地址。 And then keep listening for pay event of your contract passing user's address in filter. 然后继续在过滤器中侦听您的合同传递用户地址的工资事件。 This will trigger pay event only when the amount is send from user's address and you can do further processing there. 仅当从用户地址发送金额并且您可以在那里进行进一步处理时,这才会触发支付事件。

Upon 'Reject' in Metamask you can examine the 'error' callback. 在Metamask中单击“拒绝”后,您可以检查“错误”回调。 The field "message" will contain: - "User denied transaction signature" for Metamask - "User denied transaction signature" for Cipher - "Invalid Message Body" for Toshi/Coinbase - "cancelled" for Trust 字段“消息”将包含:-Metamask的“用户拒绝交易签名”-密码的“用户拒绝交易签名”-Toshi / Coinbase的“无效消息正文”-信任的“取消”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM