|
|
@ -32,9 +32,9 @@ export default class TypedMessageManager extends EventEmitter { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Controller in charge of managing - storing, adding, removing, updating - TypedMessage. |
|
|
|
* Controller in charge of managing - storing, adding, removing, updating - TypedMessage. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
constructor ({ networkController }) { |
|
|
|
constructor ({ getCurrentChainId }) { |
|
|
|
super() |
|
|
|
super() |
|
|
|
this.networkController = networkController |
|
|
|
this._getCurrentChainId = getCurrentChainId |
|
|
|
this.memStore = new ObservableStore({ |
|
|
|
this.memStore = new ObservableStore({ |
|
|
|
unapprovedTypedMessages: {}, |
|
|
|
unapprovedTypedMessages: {}, |
|
|
|
unapprovedTypedMessagesCount: 0, |
|
|
|
unapprovedTypedMessagesCount: 0, |
|
|
@ -167,8 +167,7 @@ export default class TypedMessageManager extends EventEmitter { |
|
|
|
assert.equal(validation.errors.length, 0, 'Signing data must conform to EIP-712 schema. See https://git.io/fNtcx.') |
|
|
|
assert.equal(validation.errors.length, 0, 'Signing data must conform to EIP-712 schema. See https://git.io/fNtcx.') |
|
|
|
const { chainId } = data.domain |
|
|
|
const { chainId } = data.domain |
|
|
|
if (chainId) { |
|
|
|
if (chainId) { |
|
|
|
// eslint-disable-next-line radix
|
|
|
|
const activeChainId = parseInt(this._getCurrentChainId(), 16) |
|
|
|
const activeChainId = parseInt(this.networkController.getNetworkState()) |
|
|
|
|
|
|
|
assert.ok(!Number.isNaN(activeChainId), `Cannot sign messages for chainId "${chainId}", because MetaMask is switching networks.`) |
|
|
|
assert.ok(!Number.isNaN(activeChainId), `Cannot sign messages for chainId "${chainId}", because MetaMask is switching networks.`) |
|
|
|
assert.equal(chainId, activeChainId, `Provided chainId "${chainId}" must match the active chainId "${activeChainId}"`) |
|
|
|
assert.equal(chainId, activeChainId, `Provided chainId "${chainId}" must match the active chainId "${activeChainId}"`) |
|
|
|
} |
|
|
|
} |
|
|
|