-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove remaining use of
parseInt
(#276)
- Loading branch information
Showing
7 changed files
with
15 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
// Copyright 2023 Parity Technologies (UK) Ltd. | ||
import BN from 'bn.js'; | ||
|
||
/** | ||
* Determines if a chain is a system chain based on the value of its chainId being strictly greater than 0 and less than 2000 | ||
* @param chainId | ||
* @returns boolean | ||
*/ | ||
export const isSystemChain = (chainId: string | number): boolean => { | ||
const chainIdAsNumber = | ||
typeof chainId === 'string' ? parseInt(chainId) : chainId; | ||
|
||
return chainIdAsNumber > 0 && chainIdAsNumber < 2000; | ||
export const isSystemChain = (chainId: string): boolean => { | ||
const chainIdAsNumber = new BN(chainId); | ||
return chainIdAsNumber.gt(new BN(0)) && chainIdAsNumber.lt(new BN(2000)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters