Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
refactor: No need to parseInt on the signerChainId
Browse files Browse the repository at this point in the history
  • Loading branch information
ltfschoen committed Apr 12, 2019
1 parent 91d43a7 commit 0197108
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// SPDX-License-Identifier: BSD-3-Clause

import React, { Component } from 'react';
import BigNumber from 'bignumber.js';
import { chainId$, chainName$ } from '@parity/light.js';
import light from '@parity/light.js-react';
import { inject, observer } from 'mobx-react';
Expand Down Expand Up @@ -115,24 +114,22 @@ class AccountImportOptions extends Component {
* to prevent replay attacks between `foundation` and `classic` chains, which both have
* `networkID` of `1`.
*/
handleSignerImported = async ({ address, chainId: chainIdString }) => {
handleSignerImported = async ({ address, chainId: signerChainId }) => {
const {
chainId: currentChainIdBN,
chainName,
createAccountStore: { importFromSigner }
} = this.props;

if (!address || !chainIdString) {
if (!address || !signerChainId) {
this.setState({ error: 'Invalid QR code.' });

return;
}

const signerChainId = parseInt(chainIdString);

if (!BigNumber(signerChainId).eq(currentChainIdBN)) {
if (!currentChainIdBN.eq(signerChainId)) {
console.error(
`Parity Signer account chainId ${chainIdString} must match current chainId ${currentChainIdBN.valueOf()} (${chainName}).`
`Parity Signer account chainId ${signerChainId} must match current chainId ${currentChainIdBN.valueOf()} (${chainName}).`
);

this.setState({
Expand Down

0 comments on commit 0197108

Please sign in to comment.