|
|
|
@ -32,9 +32,9 @@ export default class TypedMessageManager extends EventEmitter { |
|
|
|
|
/** |
|
|
|
|
* Controller in charge of managing - storing, adding, removing, updating - TypedMessage. |
|
|
|
|
*/ |
|
|
|
|
constructor ({ networkController }) { |
|
|
|
|
constructor ({ getCurrentChainId }) { |
|
|
|
|
super() |
|
|
|
|
this.networkController = networkController |
|
|
|
|
this._getCurrentChainId = getCurrentChainId |
|
|
|
|
this.memStore = new ObservableStore({ |
|
|
|
|
unapprovedTypedMessages: {}, |
|
|
|
|
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.') |
|
|
|
|
const { chainId } = data.domain |
|
|
|
|
if (chainId) { |
|
|
|
|
// eslint-disable-next-line radix
|
|
|
|
|
const activeChainId = parseInt(this.networkController.getNetworkState()) |
|
|
|
|
const activeChainId = parseInt(this._getCurrentChainId(), 16) |
|
|
|
|
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}"`) |
|
|
|
|
} |
|
|
|
|