admin管理员组文章数量:1023102
Since metamask's injected web3 follows
But there seems to be no coding to catch the confirm/cancel button clicking event (img below) when calling contract.new()
Is there a way to catch the event?
Since metamask's injected web3 follows https://github./ethereum/wiki/wiki/JavaScript-API
But there seems to be no coding to catch the confirm/cancel button clicking event (img below) when calling contract.new()
Is there a way to catch the event?
Share Improve this question edited Mar 23, 2023 at 20:55 TylerH 21.1k79 gold badges79 silver badges114 bronze badges asked Sep 26, 2018 at 6:52 UnrealityUnreality 4,21211 gold badges50 silver badges68 bronze badges2 Answers
Reset to default 2To handle Confirm/Cancel response of user on your contract functions, you can use the transactionHash event & error event from send function.
"transactionHash" returns transactionHash: String: Fired when the transaction hash is available.
"error" returns error: Error: Fired if an error occurs during sending. If the transaction was rejected by the network with a receipt, the receipt will be available as a property on the error object.
You can see detail here.
When you click on Confirm button then you can handle this case in the transactionHash event.
When you click on Cancel button then you can handle this case in the error event.
If the user clicked the 'cancel' button, the 'processedContract' variable below will be undefined.
If confirmed, it will be the contract and if it has an address ( processedContract.address ) then it is being mined.
newContract.new({...}, function(e, processedContract) {...});
Since metamask's injected web3 follows
But there seems to be no coding to catch the confirm/cancel button clicking event (img below) when calling contract.new()
Is there a way to catch the event?
Since metamask's injected web3 follows https://github./ethereum/wiki/wiki/JavaScript-API
But there seems to be no coding to catch the confirm/cancel button clicking event (img below) when calling contract.new()
Is there a way to catch the event?
Share Improve this question edited Mar 23, 2023 at 20:55 TylerH 21.1k79 gold badges79 silver badges114 bronze badges asked Sep 26, 2018 at 6:52 UnrealityUnreality 4,21211 gold badges50 silver badges68 bronze badges2 Answers
Reset to default 2To handle Confirm/Cancel response of user on your contract functions, you can use the transactionHash event & error event from send function.
"transactionHash" returns transactionHash: String: Fired when the transaction hash is available.
"error" returns error: Error: Fired if an error occurs during sending. If the transaction was rejected by the network with a receipt, the receipt will be available as a property on the error object.
You can see detail here.
When you click on Confirm button then you can handle this case in the transactionHash event.
When you click on Cancel button then you can handle this case in the error event.
If the user clicked the 'cancel' button, the 'processedContract' variable below will be undefined.
If confirmed, it will be the contract and if it has an address ( processedContract.address ) then it is being mined.
newContract.new({...}, function(e, processedContract) {...});
本文标签:
版权声明:本文标题:javascript - How to listen to Metamask's web3's "confirm""cancel" event of a 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745580541a2157284.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论