Closed dmlayton closed 2 years ago
Looks good so far. I would like to add a test. Can you also provide an example for how that would look on the implementation side of things?
Yeah, I can add a test here since that appears to be the appropriate place -- I didn't find it the first time around.
Not sure what you mean by "Can you also provide an example for how that would look on the implementation side of things?" is that not what my first comment is? Or do you mean in the docs?
Edit: If you mean the code under test, it looks like this:
const method = 'eth_signTypedData_v4';
const message = JSON.stringify({
domain: {
chainId: chainId,
name
verifyingContract,
version: '1',
},
message: {
...
},
primaryType: 'Person',
types: {
// TODO: Clarify if EIP712Domain refers to the domain the contract is hosted on
EIP712Domain: [
{ name: 'name', type: 'string' },
{ name: 'version', type: 'string' },
{ name: 'chainId', type: 'uint256' },
{ name: 'verifyingContract', type: 'address' },
],
// Not an EIP712Domain definition
Group: [
{ name: 'name', type: 'string' },
{ name: 'members', type: 'Person[]' },
],
// Refer to PrimaryType
Mail: [
{ name: 'from', type: 'Person' },
{ name: 'to', type: 'Person[]' },
{ name: 'contents', type: 'string' },
],
// Not an EIP712Domain definition
Person: [
{ name: 'name', type: 'string' },
{ name: 'wallets', type: 'address[]' },
{ name: 'nonce', type: 'string' },
],
},
});
const params = [from, message];
const result = await ethereum.request({ method, params, from})
Example Usage: