zilpay / zil-pay

ZilPay browser extension enables browsing Zilliqa blockchain enabled websites.
https://zilpay.io
Other
3 stars 1 forks source link

await - different behaviour than node + JS JDK 0.8.6 / 0.8.7 #22

Closed SvenMeyer closed 4 years ago

SvenMeyer commented 4 years ago

After spending the last days on this topic, I have the "impression" that await deployed_contract.call(...) waits on node ( + JS JDK 0.8.6 / 0.8.7) until the transaction has been fully confirmed, while in the browser/Zilpay environment a Promise is immediately returned after the transaction has been sent off ... and further requests on the status of the transactions are needed to determine when it has been confirmed. Can somebody confirm this behavior ?

The browser (I use Chromium on LInux) supports await but I have the impression that the behaviour is different: 1) node with JS JDK 0.8.6/0.8.7 : await deployed_contract.call(...) waits until the transaction has been confirmed, tx.receipt is valid thereafter 2) Chromium / Zilpay / JS JDK 0.8.1 : Promise is immediately returned after the transaction has been sent off and accepted (so ~ 1 sec after I confirmed the transaction within Zilpay), but therafter the is no (not yet) tx.receipt and blockchain.getTransaction(txhash) returns a rejected Promise as txHash is not yet valid. I assume it is independent from the application (at the moment). Maybe its a JS JDK thing as Zilpay is still using 0.8.1 ?

I just had a look at JS JDK 0.8.7 and the updated Helloword example and saw that createTransactionWithoutConfirm(...) and getPendingTxn(...) is now being used. Maybe some article / documentation and the whole topic would help adoption? Also, Zilpay would likely benefit from an upgrade to the latest JS JDK 0.8.7

hicaru commented 4 years ago

Hello, thanks for your issue. Yeah it so work, when ZIlliqa.js will tested, i will just upgrade it.

SvenMeyer commented 4 years ago

Any timeline when zilpay will come with the latest (0.8.7) JS API? I developed some stuff which worked fine on node with JS API 0.8.6 / 0.8.7 and now in the Browser nothing works. contract.getSubState does not return anything, if I use contract.getState and try to extract the relevant information myself, the state I get looks totally different from what I got from node with JS API 0.8.6 / 0.8.7 :-( Would be great if you would find some time just to upgrade the JS JDK and maybe work on furthe enhancements thereafter ... ?

hicaru commented 4 years ago

fixed by release 0.3.5