From 4aa39348e8763e1f8eabc85b826c8ee5130270eb Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Fri, 17 Jan 2020 18:37:39 -0400 Subject: [PATCH] Use current `chainId` for `signTypedData` instead of `3` Instead of using the `chainId` "3" for the `signTypedData` button (i.e. Ropsten), the test dapp will now use the `chainId` of whichever network is currently selected (falling back to the `networkId` if there is no `chainId`). --- contract.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contract.js b/contract.js index bb1d58bb..6bf7922f 100644 --- a/contract.js +++ b/contract.js @@ -269,6 +269,9 @@ const initialize = () => { } signTypedData.onclick = () => { + const networkId = parseInt(networkDiv.innerHTML) + const chainId = parseInt(chainIdDiv.innerHTML) || networkId + const typedData = { types: { EIP712Domain: [ @@ -291,7 +294,7 @@ const initialize = () => { domain: { name: 'Ether Mail', version: '1', - chainId: 3, + chainId, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, message: {