-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Use personal_sign
when injected web3provider is TrustWallet
#1542
Conversation
FYI, we kind of need this change sooner rather than later, so I went ahead and published the providers package under my account https://www.npmjs.com/package/ethers_providers_alfetopito I made a mistake and screwed the package name, but it's working and makes it explicit for us that this is just a temporary fork. |
I would live to make this change, but am waiting for someone to provide the research outlined here: I’ll open a new issue to track this. |
Please see #1544. Add any environments you have access to. :) |
Based on git issue ethers-io#1542 by alfetopito
Any update on this? We need this change as well. |
I’ll be making the switch on the next minor version bump. |
Any timeline for this? |
Not yet, I’ve just finished off a few major tasks, and have 2 presentations to prepare for. Maybe within 2 weeks? |
Thanks @ricmoo. Will be watching this and implement a workaround in the meantime. |
Ping @ricmoo any update here? |
Useful info: WalletConnect/walletconnect-monorepo#1395 Starting in v5, the JsonRpcSigner will use |
This has been updated in 5.5.0. For those who require the old behaviour, the JsonRpcSigner has a Thanks! :) |
Summary
Using
personal_sign
instead ofeth_sign
for TrustWallet.This sort of a follow up to my comment on a similar PR #1285 (comment)
TrustWallet's
eth_sign
method does not properly encode the data.With this workaround I'm able to perform the signing as expected.
The flag
isTrust
is set by TrustWallet's web3 provider https://github.com/trustwallet/trust-web3-provider/blob/93395938bb6838e35e3e358bcf952124131186fa/README.md#L15 similar toisMetaMask
andisStatus
flags.According to MM docs,
personal_sign
is preferred instead ofeth_sign
.And now that I went through TrustWallet's web3 provider code I found out the reasoning for different choice of method: trustwallet/trust-web3-provider#102 (comment)
Although, to be honest, I'm not 100% clear on that.
Testing
Well, I would have published a RC npm package with these changes under my NPM account, or at a minimum publish it using
yalc
locally, but setting up ethers.js is a bit tricky.So I went with the good old "copy generated files to destination
node_modules
folder". And it worked as expected :)If you insist, I can work on a minimum code sample.