worldwide-asset-exchange / waxjs

Javascript API for integration with the WAX Cloud Wallet.
MIT License
126 stars 103 forks source link

Cannot read property 'length' of undefined #77

Closed vaibhavyadav12 closed 2 years ago

vaibhavyadav12 commented 2 years ago

Hi, I have an issue when i use the wax sample code of wax ref- https://developer.wax.io/waa/waxjs-demo/
i click the sendToken button for send transaction function to transfer WAX, I got an error (Cannot read property 'length' of undefined) before the window popup .

I m using this function to send the transfer function Code--> async function sendToken() { if (!wax.api) { return document.getElementById('response').append(' Login first '); } try { const result = await wax.api.transact({ actions: [{ account: 'eosio.token', name: 'transfer', authorization: [{ actor: wax.userAccount, permission: 'active', }], data: { from: wax.userAccount, to: 'jahvu.wam', quantity: '0.1 WAX', memo: 'demo ', }, }] }, { blocksBehind: 3, expireSeconds: 1200, }); // console.log("result===>", result); document.getElementById('response').append(JSON.stringify(result, null, 2)) } catch (e) { // console.log("hello", e); document.getElementById('response').append(e.message); } }

If anyone know about how to solve this error..!!

Screenshot from 2021-08-30 19-27-02

GuiiDo commented 2 years ago

Hi, seems like you are missing the amount precision. For wax this is 8. Meaning that you have to provide 8 decimals. So your amount you would like to transfer would need to be 0.10000000. Hope this helps you out!

vaibhavyadav12 commented 2 years ago

Hi, seems like you are missing the amount precision. For wax this is 8. Meaning that you have to provide 8 decimals. So your amount you would like to transfer would need to be 0.10000000. Hope this helps you out!

Thank u for your response It showing the same error

includenull commented 2 years ago

We are aware of this error and are tracking it, there is a pull request in that we think will resolve this but it is ultimately caused by the WAX Cloud Wallet signing window firing events twice. It seems to effect some users more than others, not sure if its a latency issue or something.

But yes, we're looking to get this resolved soon, the same issue has presented itself as many different error messages in the last year but its been the same cause.

nhhoang commented 2 years ago

Hi @includenull, did you fix this issue, I'm getting this issue too

racquemis commented 2 years ago

Any updates regarding this issue?

abdulmanan7 commented 2 years ago

Any update on this error , i am also facing same error

includenull commented 2 years ago

waxjs has been updated to version 1.0.4 and has changes implemented that should mitigate this and similar issues.

It will be up to site/dapp owners to ensure they are running the latest version. WAX should have this updated across their own sites in the next few days.

We're also still working to fix the root cause of the issue within the WAX Cloud Wallet signing window which should stop these errors even on sites using outdated versions of waxjs.