Add command to generate eip712 type data for msg
Description
This PR implements an command eip-712 data-type to output the EIP-712 type schema for any message. The client library may use this instead of hard code the json.
$ ethermintd eip-712 data-type "/cosmos.bank.v1beta1.MsgSend"
For contributor use:
- [ ] Targeted PR against correct branch (see CONTRIBUTING.md)
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [ ] Code follows the module structure standards.
- [ ] Wrote unit and integration tests
- [ ] Updated relevant documentation (
docs/) or specification (x/<module>/spec/) - [ ] Added relevant
godoccomments. - [ ] Added a relevant changelog entry to the
Unreleasedsection inCHANGELOG.md - [ ] Re-reviewed
Files changedin the Github PR explorer
For admin use:
- [ ] Added appropriate labels to PR (ex.
WIP,R4R,docs, etc) - [ ] Reviewers assigned
- [ ] Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)
There's one issue that the result of ./build/ethermintd gen-eip712-data-type "/cosmos.bank.v1beta1.MsgSend" | jq don't contain the amount field in the bank send msg, maybe because it's a sdk.Coins rather than sdk.Coin.
There's one issue that the result of
./build/ethermintd gen-eip712-data-type "/cosmos.bank.v1beta1.MsgSend" | jqdon't contain theamountfield in the bank send msg, maybe because it's asdk.Coinsrather thansdk.Coin.
this one is fixed.
@yihuang can you add a PR description about what users can do with this?
done. sorry I didn't follow up closely on this PR, because we didn't start to use eip-712 yet, and frankly I'm not very familiar with all the details about eip-712 yet, feel free to take over if it interests you.
@yihuang can you add a PR description about what users can do with this?
done. sorry I didn't follow up closely on this PR, because we didn't start to use eip-712 yet, and frankly I'm not very familiar with all the details about eip-712 yet, feel free to take over if it interests you.
@yihuang If you're not planning to finish the PR, I'm converting this into draft. I don't a specific need for this at the moment. @hanchon @ramacarlucho Are you interested in this functionality?
Right now when I'm adding a new message to evmosjs I need to debug the Ethermint code, having this cmd function will simplify the eip712 generation
╰─❯ ./build/ethermintd eip-712 data-type "/cosmos.gov.v1beta1.MsgSubmitProposal"
Error: fail to extract msg types: panicked with error: runtime error: invalid memory address or nil pointer dereference
Usage:
ethermintd eip-712 data-type <msg-url> [flags]
I'm getting nil pointer on MsgSubmitProposal
For MsgVote is working fine:
{"Coin":[{"name":"denom","type":"string"},{"name":"amount","type":"string"}],"EIP712Domain":[{"name":"name","type":"string"},{"name":"version","type":"string"},{"name":"chainId","type":"uint256"},{"name":"verifyingContract","type":"string"},{"name":"salt","type":"string"}],"Fee":[{"name":"amount","type":"Coin[]"},{"name":"gas","type":"string"}],"Msg":[{"name":"type","type":"string"},{"name":"value","type":"MsgValue"}],"MsgValue":[{"name":"proposal_id","type":"uint64"},{"name":"voter","type":"string"},{"name":"option","type":"int32"}],"Tx":[{"name":"account_number","type":"string"},{"name":"chain_id","type":"string"},{"name":"fee","type":"Fee"},{"name":"memo","type":"string"},{"name":"msgs","type":"Msg[]"},{"name":"sequence","type":"string"}]}
This is probably related to the issue that @ramacarlucho was talking about, with the messages containing proto.Any
I don't know if having the cosmos sdk 0.46 will solve this problem or if it's not related
closing this