Skip to content
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

Does etherjs V5 work in TrustWallet? #1025

Closed
jamesmorgan opened this issue Aug 31, 2020 · 7 comments
Closed

Does etherjs V5 work in TrustWallet? #1025

jamesmorgan opened this issue Aug 31, 2020 · 7 comments
Labels
discussion Questions, feedback and general information.

Comments

@jamesmorgan
Copy link

Hi everyone, I have a little dapp thats using etherjs but I cant seem to get it working in TrustWallet?

I have no empirical evidence that the reason is etherjs V5 at all but I wondered if anyone has successfully used it with TrustWallet?

The reason I ask is that after looking at TW github here - https://github.com/trustwallet/trust-web3-provider - It states that it comes bundled with web3 0.20.x. which is not only an ancient and deprecated lib, but may also not be compatable with ethers V5?

Anyway, thanks for any help or answers.

@ricmoo
Copy link
Member

ricmoo commented Aug 31, 2020

I don't know of any reason it won't be compatible, but I haven't tested it myself.

It works in node 8 and above, ES3 (ish) and above (for browsers) and with the included shims file enables it in React Native. If you are having an issue, you might want to try including the shims package, in case TrustWallet is build using a limited version of JavaScriptCore?

Do you get any errors?

@ricmoo ricmoo added the discussion Questions, feedback and general information. label Aug 31, 2020
@jamesmorgan
Copy link
Author

Thanks @ricmoo I'll have a look at shims. It's. Nuxtjs app so may need something extra as you say.

TBH it's probably something I am doing but just seems odd why I can't get it working in TW but does in others. Will report back any findings I get.

@jamesmorgan
Copy link
Author

I actually got it working, it an ordering thing with the ssr client/server logic. 😄

I have found one thing which you may be able to help with. I am migrating a web3 dapp to nuxt and etherjs - one problem which has come up today is about message signing.

Previous I used to use this from web3js:

web3.eth.personal.sign(Web3.utils.toHex(`Hello world`), account)

And I have migrated it to use this ethersjs library, but I cant seem to get it to generate a valid signature against our API when inside some wallets e.g. trust, coinbase wallet, but works find on MetaMask. Am I using the wrong method?

provider.getSigner().signMessage(`Hello world`);

Provider being the unlocked in web3 account provider.

Any ideas?

@jamesmorgan
Copy link
Author

jamesmorgan commented Sep 2, 2020

I have actually got it working however made the rpc call manually like this:

web3.provider.sendAsync({
          method: 'personal_sign',
          params: [ethers.utils.hexlify(ethers.utils.toUtf8Bytes(`Hello world`)), account]
        }, (error, response) => {
          if (error) {
            return reject(error);
          }
          return resolve(response.result);
        })

@ricmoo
Copy link
Member

ricmoo commented Sep 8, 2020

The JsonRpcSigner uses the eth_sign RPC method. I'm guessing Trust Wallet doesn't support it in favour of the personal_sign RPC method.

I'll try it out and see if there is a way to detect that eth_sign isn't available and fall back onto personal_sign...

@ricmoo ricmoo added investigate Under investigation and may be a bug. on-deck This Enhancement or Bug is currently being worked on. labels Sep 8, 2020
@pinpong
Copy link

pinpong commented Apr 4, 2021

Hello, i'm also not able to connect within the trust wallet browser for dapps. Any news on this issue?

@ricmoo
Copy link
Member

ricmoo commented May 6, 2021

This will be TransactionResponse ned in #1544.

I'll close this issue, as that issue better covers the problem, and what I need form everyone to move forward with a solution.

Thanks! :)

@ricmoo ricmoo closed this as completed May 6, 2021
@ricmoo ricmoo removed the on-deck This Enhancement or Bug is currently being worked on. label Jun 26, 2021
@ricmoo ricmoo removed the investigate Under investigation and may be a bug. label Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Questions, feedback and general information.
Projects
None yet
Development

No branches or pull requests

3 participants