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

Failed with recursive data #34

Open
Pana opened this issue Oct 18, 2021 · 5 comments
Open

Failed with recursive data #34

Pana opened this issue Oct 18, 2021 · 5 comments

Comments

@Pana
Copy link

Pana commented Oct 18, 2021

For example

{
        CIP23Domain: [
          { name: 'name', type: 'string' },
          { name: 'version', type: 'string' },
          { name: 'chainId', type: 'uint256' },
          { name: 'verifyingContract', type: 'address' }
        ],
        Person: [
          { name: 'name', type: 'string' },
          { name: 'mother', type: 'Person' },
          { name: 'father', type: 'Person' }
        ]
}
@Mrtenz
Copy link
Owner

Mrtenz commented Oct 18, 2021

Could you provide an example of the message, and what the expected result would be?

@Pana
Copy link
Author

Pana commented Oct 19, 2021

For example:

{
  "types": {
    "EIP712Domain": [
      { "name": "name", "type": "string" },
      { "name": "version", "type": "string" },
      { "name": "chainId", "type": "uint256" },
      { "name": "verifyingContract", "type": "address" }
    ],
    "Person": [
      { "name": "name", "type": "string" },
      { "name": "wallet", "type": "address" }
    ],
    "Mail": [
      { "name": "from", "type": "Person" },
      { "name": "to", "type": "Person" },
      { "name": "contents", "type": "string" },
      { "name": "replyTo", "type": "Mail" }
    ]
  },
  "primaryType": "Mail",
  "domain": {
    "name": "Ether Mail",
    "version": "1",
    "chainId": 1,
    "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"
  },
  "message": {
    "from": {
      "name": "Cow",
      "wallet": "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"
    },
    "to": {
      "name": "Bob",
      "wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"
    },
    "contents": "Hello, Bob!"
  }
}

The result is : 1901f2cee375fa42b42143804025fc449deafd50cc031ca257e0b194a650a912090fe51b671bc20a4046c6cfd629f9361edc9ea3c6ee0b20b767bcff06e1e8973930

eth_typedDataV4 support recursive data, when encode the omit value it will use a 0x0000000000000000000000000000000000000000000000000000000000000000

@Mrtenz
Copy link
Owner

Mrtenz commented Oct 19, 2021

Thank you, will look into this.

@Mrtenz
Copy link
Owner

Mrtenz commented Oct 23, 2021

Is there any documentation or a reference implementation for recursive types? I looked into this a little bit and I don't quite understand how it's supposed to work currently.

@alex-miller-0
Copy link

Running into similar issues. Opened #35 as mine is related to encodeType.

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