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

eth_signTypedData example #35

Open
alko89 opened this issue Mar 18, 2019 · 6 comments
Open

eth_signTypedData example #35

alko89 opened this issue Mar 18, 2019 · 6 comments

Comments

@alko89
Copy link

alko89 commented Mar 18, 2019

Please provide an example for eth_signTypedData method. I'm trying to use your library instead of web3 and so far it works great!
However I'm trying to implement signTypedData and don't know exactly how. I'm getting Method not found error. Having a working example would help a lot.

@xf00f
Copy link
Owner

xf00f commented Mar 23, 2019

@alko89 Could this be due to the provider you are using not supporting eth_signTypedData? Usage should be as simple as calling it with TypedSigningData as per the function signature. If you can provide an example of what you're trying that would help diagnose.

@alko89
Copy link
Author

alko89 commented Mar 24, 2019

Yes I think this was also the case. I ended up calling the providers send function directly.

However when looking at the code I noticed dataToSign type is defined as dataToSign: { type: string; name: string; value: string }[] which would make it incompatible with EIPs structure (I might be wrong since I'm new to ts).
You can have a look at the sample structure in EIP712 example: https://github.com/ethereum/EIPs/blob/master/assets/eip-712/Example.js

@xf00f
Copy link
Owner

xf00f commented Mar 25, 2019

@alko89 To be honest I implemented this very quickly to get it working in MetaMask a few months back. I wouldn't be surprised if it's now broken.

I will leave the issue open but will probably not get round to doing a proper job on this for a few weeks. I'll gladly accept a PR if you have the time yourself.

@hickscorp
Copy link

Is there any movement on this issue? We're trying to understand how to sign data using Web3x.

@alko89
Copy link
Author

alko89 commented Jun 27, 2019

Unfortunately I'm not working on the project I have been using web3x for and am currently not involved in Ethereum development.

@hickscorp
Copy link

hickscorp commented Jun 28, 2019

We were able to get this to work:

// Here, eth is an instance of Web3x/Eth.
// data is an instance of Web3x/Eth/TypedSigningData.
eth.signTypedData(state.account, data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants