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

Array support in encodeData for EIP712 signature. #6106

Closed
Amxx opened this issue Feb 4, 2019 · 0 comments · Fixed by #6930
Closed

Array support in encodeData for EIP712 signature. #6106

Amxx opened this issue Feb 4, 2019 · 0 comments · Fixed by #6930

Comments

@Amxx
Copy link

Amxx commented Feb 4, 2019

I have been working with metamask support of EIP712 signatures for a long time, but when I recently tryied signing an array of structs I got an error:

```RPC Error: Error: MetaMask Message Signature: Error: Arrays currently unimplemented in encodeData`` `

To reproduce the error, just run the following code:

TYPES =
{
	EIP712Domain: [
		{ name: "name",              type: "string"  },
		{ name: "version",           type: "string"  },
		{ name: "chainId",           type: "uint256" },
		{ name: "verifyingContract", type: "address" },
	],
	Entry: [
		{ name: "id",                 type: "address" },
		{ name: "value",              type: "uint256" },
	],
	Entries: [
		{ name: "content",            type: "Entry[]" },
	],
};
DOMAIN =
{
	name:              "test-domain",
	version:           "0.0.1",
	chainId:           await web3.eth.net.getId(),
	verifyingContract: 0,
};
wallet = "0x......."; // Your wallet address here
message = { content: [{ id: 0, value: 0 }] };
await web3.currentProvider.sendAsync({
	method: "eth_signTypedData_v3",
	params: [ wallet, JSON.stringify({ types: TYPES, domain: DOMAIN, primaryType: "Entries", message: message }) ],
	from: wallet,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants