-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
web3.js v1 not working with Trust Wallet #58
Comments
@superoo7 we do not support sync methods on purpose. Best practice to always use async calls on web3. |
I tried wrap the function with Promises (error first approach), it still getting that error. The only way i manage to make it work is via "window.web3" with older web3js API (0.20.x) public getId(): Promise<number> {
return new Promise((resolve, reject) => {
// v1
this.web3.eth.net.getId((err1, res1) => {
if (err1) {
// < v1
(window.web3!.version as any).getNetwork((err2: any, res2: any) => {
if (err2) {
reject(err2);
}
resolve(res2);
});
} else {
resolve(res1);
}
});
});
} |
@superoo7 Hi, we're using web3 0.20.x, it's not compatible with 1.0 right now |
Would be nice if this info was more available. Any estimate on when you will be supporting 1.0 beta? |
@superoo7 @codydjango we once supported 1.0 beta, but not compatible with most dapps, and Metamask is still using "0.20.3". I'm afraid we have to wait metamask for web3 1.0 |
Thanks @hewigovens, makes sense to me. We're just at a bit of a weird spot right now, where 1.0 beta has gained a lot of traction and it's increasingly common to reinitialize web3 with the given provider. I think listing Trusts web3 requirements either on the website or github could be really helpful for dapp developers, especially for new developers. I know this would have helped save me at least a couple of hours. For example, right now the trust website says "Fully functioning Web3 browser that can be used to interact with any decentralized application (DApp)". The Github has no notes for Dapp developers looking to support the trust wallet other than: "If trust provider injected properly isTrust will be true". I'd like to humbly suggest an extra line of text, something along the lines of: "Trust currently supports Web3 version 0.20.3". It's becoming increasingly common for Dapp developers to work with 1.0.0 beta, so I think additional clarity could go a long way during this grey period... Thanks for the consideration. |
@codydjango readme updated |
Trust wallet should work with web3 1.0 and ethers.js as soon as possible or many new dapps will not work at Trust wallet. |
is trust-web3-provider working with web3 1.0 yet ? |
Trust wallet should be working at ethers.js, if this issue can be fixed. |
@BigMurry Thanks for debugging and finding a solution 🙏 |
I guess they are still working on it. I got the error not confirm transaction at send() function |
@HoangJerry web3 is quite unstable by nature, we will wait until the final version is released and then adopt, web3 developers tend to break it every other release |
Is this still the case? "Fully functioning Web3 browser that can be used to interact with any decentralized application (DApp)" is like a bad joke then. |
Calling async methods is the best practice for using web3. |
What about the web.js 1.0 support? |
It does not matter anymore, you should not be using injected provider at all, use your own: https://medium.com/metamask/no-longer-injecting-web3-js-4a899ad6e59e You only use injected provider to call sign message or transaction |
How can I integrate trust wallet in my browser dApp? |
Can be refer to #3
Currently, I had issue making the code work in TrustWallet, if I write in vanilla js (without webpack or babel), it will work. ( Links to the testing, Code )
I used truffle box to generate a new react project to regenerate the problem.
Version
Create project
On trust wallet, this is what I got:
I added a repo to reproduce this bug. (I tweak a bit of code in "src/App.js"), https://github.com/superoo7/trustwallet-web3-bug
Possible reason
The text was updated successfully, but these errors were encountered: