3

When you use the Maiar Exchange with the Chrome Extension and send a transaction, you can see that the extension window automatically closes after sending the transaction.

When I implement the same behavior, the Extension window stays open and the sendTransaction() Promise only resolves after the call is done. If I close the window by myself by clicking somewhere else on the website, I get the following error in the console:

Uncaught (in promise) Extension window was closed without response.

With that error, my promise success resolving code is not executed anymore which basically forces the user to wait about 30 seconds until the transaction is done.

This happens when using the sendTransaction() method of the ExtensionProvider from erdjs.

Does anyone have an explanation how e.g. the Maiar Exchange solves this?

Kali
  • 31
  • 1

1 Answers1

3

The way the Maiar Exchange handles this is slightly different from your approach.

Sending the transaction directly with the ExtensionProvider requires that the extension window stays open until it is finished to return you the result.

However if you only use the ExtensionProvider to sign the transaction using the signTransaction method and send it yourself via the ProxyProvider you won't run into this limitation. The signing is basically instant and quickly closes the extension window. It also allows you to retry sending, without user interaction, if you run into any timeouts or similar.

Martin W
  • 733
  • 4
  • 12