diff --git a/packages/apps-config/src/links/commonwealth.ts b/packages/apps-config/src/links/commonwealth.ts index 0d9ebe4d69..e89282bcd8 100644 --- a/packages/apps-config/src/links/commonwealth.ts +++ b/packages/apps-config/src/links/commonwealth.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; import { externalLogos } from '../ui/logos'; diff --git a/packages/apps-config/src/links/dotscanner.ts b/packages/apps-config/src/links/dotscanner.ts index 657e7dcc4e..e28967c8f5 100644 --- a/packages/apps-config/src/links/dotscanner.ts +++ b/packages/apps-config/src/links/dotscanner.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; import { externalLogos } from '../ui/logos'; diff --git a/packages/apps-config/src/links/polkascan.ts b/packages/apps-config/src/links/polkascan.ts index 53a68cc3c0..4d9b54d2c0 100644 --- a/packages/apps-config/src/links/polkascan.ts +++ b/packages/apps-config/src/links/polkascan.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; import { externalLogos } from '../ui/logos'; diff --git a/packages/apps-config/src/links/polkassembly.ts b/packages/apps-config/src/links/polkassembly.ts index 155fbdf61f..3c4e92ced0 100644 --- a/packages/apps-config/src/links/polkassembly.ts +++ b/packages/apps-config/src/links/polkassembly.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; import { externalLogos } from '../ui/logos'; diff --git a/packages/apps-config/src/links/polkastats.ts b/packages/apps-config/src/links/polkastats.ts index f8da460b24..9bf4349674 100644 --- a/packages/apps-config/src/links/polkastats.ts +++ b/packages/apps-config/src/links/polkastats.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; import { externalLogos } from '../ui/logos'; diff --git a/packages/apps-config/src/links/subscan.ts b/packages/apps-config/src/links/subscan.ts index e586bb44b4..8791b6cc76 100644 --- a/packages/apps-config/src/links/subscan.ts +++ b/packages/apps-config/src/links/subscan.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; import { externalLogos } from '../ui/logos'; diff --git a/packages/apps-config/src/links/types.ts b/packages/apps-config/src/links/types.ts index 334512c7c4..fed8796bc3 100644 --- a/packages/apps-config/src/links/types.ts +++ b/packages/apps-config/src/links/types.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; export type LinkTypes = 'address' | 'block' | 'bounty' | 'council' | 'extrinsic' | 'proposal' | 'referendum' | 'techcomm' | 'tip' | 'treasury'; diff --git a/packages/page-accounts/src/Accounts/Account.tsx b/packages/page-accounts/src/Accounts/Account.tsx index e8e2982c49..7772ef565c 100644 --- a/packages/page-accounts/src/Accounts/Account.tsx +++ b/packages/page-accounts/src/Accounts/Account.tsx @@ -1,6 +1,7 @@ // Copyright 2017-2021 @polkadot/app-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { SubmittableExtrinsic } from '@polkadot/api/types'; import type { DeriveBalancesAll, DeriveDemocracyLock } from '@polkadot/api-derive/types'; import type { Ledger } from '@polkadot/hw-ledger'; @@ -11,7 +12,6 @@ import type { ProxyDefinition, RecoveryConfig } from '@polkadot/types/interfaces import type { KeyringAddress, KeyringJson$Meta } from '@polkadot/ui-keyring/types'; import type { Delegation } from '../types'; -import BN from 'bn.js'; import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; import styled, { ThemeContext } from 'styled-components'; diff --git a/packages/page-accounts/src/Accounts/index.tsx b/packages/page-accounts/src/Accounts/index.tsx index f378484af4..cf454cb743 100644 --- a/packages/page-accounts/src/Accounts/index.tsx +++ b/packages/page-accounts/src/Accounts/index.tsx @@ -1,11 +1,11 @@ // Copyright 2017-2021 @polkadot/app-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { ActionStatus } from '@polkadot/react-components/Status/types'; import type { AccountId, ProxyDefinition, ProxyType, Voting } from '@polkadot/types/interfaces'; import type { Delegation, SortedAccount } from '../types'; -import BN from 'bn.js'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/page-accounts/src/Accounts/useProxies.ts b/packages/page-accounts/src/Accounts/useProxies.ts index 4afad5608f..cce6670237 100644 --- a/packages/page-accounts/src/Accounts/useProxies.ts +++ b/packages/page-accounts/src/Accounts/useProxies.ts @@ -1,11 +1,11 @@ // Copyright 2017-2021 @polkadot/app-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Vec } from '@polkadot/types'; import type { AccountId, BalanceOf, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces'; import type { ITuple } from '@polkadot/types/types'; -import BN from 'bn.js'; import { useEffect, useState } from 'react'; import { useAccounts, useApi, useIsMountedRef } from '@polkadot/react-hooks'; diff --git a/packages/page-accounts/src/modals/Delegate.tsx b/packages/page-accounts/src/modals/Delegate.tsx index 5123a70803..711744f266 100644 --- a/packages/page-accounts/src/modals/Delegate.tsx +++ b/packages/page-accounts/src/modals/Delegate.tsx @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Conviction } from '@polkadot/types/interfaces'; import type { AmountValidateState } from '../Accounts/types'; -import BN from 'bn.js'; import React, { useState } from 'react'; import { ConvictionDropdown, InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components'; diff --git a/packages/page-accounts/src/modals/InputValidateAmount.tsx b/packages/page-accounts/src/modals/InputValidateAmount.tsx index 752735fbc8..19063d885e 100644 --- a/packages/page-accounts/src/modals/InputValidateAmount.tsx +++ b/packages/page-accounts/src/modals/InputValidateAmount.tsx @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveBalancesAll } from '@polkadot/api-derive/types'; import type { AmountValidateState } from '../Accounts/types'; -import BN from 'bn.js'; import React, { useEffect, useState } from 'react'; import { MarkError, MarkWarning } from '@polkadot/react-components'; diff --git a/packages/page-accounts/src/modals/ProxyOverview.tsx b/packages/page-accounts/src/modals/ProxyOverview.tsx index 4fc20a0191..e775830dc1 100644 --- a/packages/page-accounts/src/modals/ProxyOverview.tsx +++ b/packages/page-accounts/src/modals/ProxyOverview.tsx @@ -1,11 +1,11 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { ApiPromise } from '@polkadot/api'; import type { SubmittableExtrinsic } from '@polkadot/api/types'; import type { AccountId, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/page-accounts/src/modals/RecoverSetup.tsx b/packages/page-accounts/src/modals/RecoverSetup.tsx index 78da262d49..0cf4bcd0c6 100644 --- a/packages/page-accounts/src/modals/RecoverSetup.tsx +++ b/packages/page-accounts/src/modals/RecoverSetup.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useState } from 'react'; import { InputAddress, InputAddressMulti, InputNumber, Modal, TxButton } from '@polkadot/react-components'; diff --git a/packages/page-accounts/src/modals/Transfer.tsx b/packages/page-accounts/src/modals/Transfer.tsx index f36652184b..8a96471496 100644 --- a/packages/page-accounts/src/modals/Transfer.tsx +++ b/packages/page-accounts/src/modals/Transfer.tsx @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/app-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveBalancesAll } from '@polkadot/api-derive/types'; import type { AccountInfoWithProviders, AccountInfoWithRefCount } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useEffect, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/page-bounties/src/BountyActions/BountyAcceptCurator.tsx b/packages/page-bounties/src/BountyActions/BountyAcceptCurator.tsx index 29451a37c8..da6d922b48 100644 --- a/packages/page-bounties/src/BountyActions/BountyAcceptCurator.tsx +++ b/packages/page-bounties/src/BountyActions/BountyAcceptCurator.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { AccountId, BountyIndex } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useMemo } from 'react'; import { Button, InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components'; diff --git a/packages/page-bounties/src/BountyActions/BountyClaimAction.tsx b/packages/page-bounties/src/BountyActions/BountyClaimAction.tsx index 84f8e5cfc4..1cfe2a14dd 100644 --- a/packages/page-bounties/src/BountyActions/BountyClaimAction.tsx +++ b/packages/page-bounties/src/BountyActions/BountyClaimAction.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { AccountId, BountyIndex } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useMemo } from 'react'; import { useBounties } from '@polkadot/app-bounties/hooks'; diff --git a/packages/page-bounties/src/BountyActions/index.tsx b/packages/page-bounties/src/BountyActions/index.tsx index dfbd744e61..ecf9819e05 100644 --- a/packages/page-bounties/src/BountyActions/index.tsx +++ b/packages/page-bounties/src/BountyActions/index.tsx @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveCollectiveProposal } from '@polkadot/api-derive/types'; import type { Balance, BlockNumber, BountyIndex, BountyStatus } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useMemo } from 'react'; import { useBountyStatus } from '../hooks'; diff --git a/packages/page-bounties/src/BountyCreate.tsx b/packages/page-bounties/src/BountyCreate.tsx index 99926ea6aa..fd077a0254 100644 --- a/packages/page-bounties/src/BountyCreate.tsx +++ b/packages/page-bounties/src/BountyCreate.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useCallback, useEffect, useState } from 'react'; import { useBalance, useBounties } from '@polkadot/app-bounties/hooks'; diff --git a/packages/page-bounties/src/DueBlocks.tsx b/packages/page-bounties/src/DueBlocks.tsx index c6ab6ad902..b95764a171 100644 --- a/packages/page-bounties/src/DueBlocks.tsx +++ b/packages/page-bounties/src/DueBlocks.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React from 'react'; import { BlockToTime } from '@polkadot/react-query'; diff --git a/packages/page-bounties/src/helpers/calculateBountyBond.ts b/packages/page-bounties/src/helpers/calculateBountyBond.ts index c43939f087..66d7e5870e 100644 --- a/packages/page-bounties/src/helpers/calculateBountyBond.ts +++ b/packages/page-bounties/src/helpers/calculateBountyBond.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; export function calculateBountyBond (description: string, depositBase: BN, depositPerByte: BN): BN { return depositBase.add(depositPerByte.muln(countUtf8Bytes(description))); diff --git a/packages/page-bounties/src/helpers/determineUnassignCuratorAction.ts b/packages/page-bounties/src/helpers/determineUnassignCuratorAction.ts index 151b8f0919..7b51f8ffe6 100644 --- a/packages/page-bounties/src/helpers/determineUnassignCuratorAction.ts +++ b/packages/page-bounties/src/helpers/determineUnassignCuratorAction.ts @@ -1,10 +1,9 @@ // Copyright 2017-2021 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { BountyStatus } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; - import { BN_ZERO } from '@polkadot/util'; import { UserRole, ValidUnassignCuratorAction } from '../types'; diff --git a/packages/page-bounties/src/helpers/increaseDateByBlocks.ts b/packages/page-bounties/src/helpers/increaseDateByBlocks.ts index a1b4c04581..0d2921c747 100644 --- a/packages/page-bounties/src/helpers/increaseDateByBlocks.ts +++ b/packages/page-bounties/src/helpers/increaseDateByBlocks.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/app-treasury authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; export function increaseDateByBlocks (blocks: BN, blockTime: number): Date { return new Date(Date.now() + blocks.muln(blockTime).toNumber()); diff --git a/packages/page-bounties/src/helpers/isClaimable.ts b/packages/page-bounties/src/helpers/isClaimable.ts index 335f4df861..1d4bd4f0e5 100644 --- a/packages/page-bounties/src/helpers/isClaimable.ts +++ b/packages/page-bounties/src/helpers/isClaimable.ts @@ -1,10 +1,9 @@ // Copyright 2017-2021 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { AccountId } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; - export function isClaimable (accounts: string[], beneficiary: AccountId, payoutDue: BN): boolean { return payoutDue.ltn(0) && accounts.includes(beneficiary.toString()); } diff --git a/packages/page-bounties/src/helpers/permillOf.ts b/packages/page-bounties/src/helpers/permillOf.ts index ff1db95bf3..0dda91b87f 100644 --- a/packages/page-bounties/src/helpers/permillOf.ts +++ b/packages/page-bounties/src/helpers/permillOf.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; import { BN_MILLION } from '@polkadot/util'; diff --git a/packages/page-bounties/src/hooks/useBounties.tsx b/packages/page-bounties/src/hooks/useBounties.tsx index 3f689b49f6..dee9dc39de 100644 --- a/packages/page-bounties/src/hooks/useBounties.tsx +++ b/packages/page-bounties/src/hooks/useBounties.tsx @@ -1,10 +1,9 @@ // Copyright 2017-2021 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { SubmittableExtrinsic } from '@polkadot/api/types'; -import BN from 'bn.js'; - import { DeriveBounties } from '@polkadot/api-derive/types'; import { useApi, useBestNumber, useCall } from '@polkadot/react-hooks'; import { BalanceOf, BlockNumber, BountyIndex } from '@polkadot/types/interfaces'; diff --git a/packages/page-contracts/src/Contracts/Summary.tsx b/packages/page-contracts/src/Contracts/Summary.tsx index 3d730b078d..ec5ab57f3c 100644 --- a/packages/page-contracts/src/Contracts/Summary.tsx +++ b/packages/page-contracts/src/Contracts/Summary.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-contracts authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useEffect, useState } from 'react'; import { CardSummary, SummaryBox } from '@polkadot/react-components'; diff --git a/packages/page-contracts/src/shared/InputMegaGas.tsx b/packages/page-contracts/src/shared/InputMegaGas.tsx index a5059c2c86..2a7ed8b978 100644 --- a/packages/page-contracts/src/shared/InputMegaGas.tsx +++ b/packages/page-contracts/src/shared/InputMegaGas.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-contracts authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { UseWeight } from '../types'; -import BN from 'bn.js'; import React, { useEffect, useMemo, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/page-contracts/src/types.ts b/packages/page-contracts/src/types.ts index a1d014982a..99b908c1d9 100644 --- a/packages/page-contracts/src/types.ts +++ b/packages/page-contracts/src/types.ts @@ -1,9 +1,8 @@ // Copyright 2017-2021 @polkadot/app-contracts authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; - -import { Abi } from '@polkadot/api-contract'; +import type BN from 'bn.js'; +import type { Abi } from '@polkadot/api-contract'; export interface CodeJson { abi?: string | null; diff --git a/packages/page-contracts/src/useWeight.ts b/packages/page-contracts/src/useWeight.ts index e4637f4895..a4823fa380 100644 --- a/packages/page-contracts/src/useWeight.ts +++ b/packages/page-contracts/src/useWeight.ts @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/react-hooks authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Weight } from '@polkadot/types/interfaces'; import type { UseWeight } from './types'; -import BN from 'bn.js'; import { useCallback, useMemo, useState } from 'react'; import { useApi, useBlockTime } from '@polkadot/react-hooks'; diff --git a/packages/page-council/src/Overview/types.ts b/packages/page-council/src/Overview/types.ts index 944322332e..3b01c59526 100644 --- a/packages/page-council/src/Overview/types.ts +++ b/packages/page-council/src/Overview/types.ts @@ -1,11 +1,10 @@ // Copyright 2017-2021 @polkadot/app-democracy authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveElectionsInfo } from '@polkadot/api-derive/types'; import type { SetIndex } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; - export interface ComponentProps { electionsInfo?: DeriveElectionsInfo; } diff --git a/packages/page-democracy/src/Overview/Propose.tsx b/packages/page-democracy/src/Overview/Propose.tsx index 2ece7a32fb..88536b3b7b 100644 --- a/packages/page-democracy/src/Overview/Propose.tsx +++ b/packages/page-democracy/src/Overview/Propose.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-democracy authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useCallback, useState } from 'react'; import { Input, InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components'; diff --git a/packages/page-democracy/src/Overview/ReferendumVotes.tsx b/packages/page-democracy/src/Overview/ReferendumVotes.tsx index 17f24133a1..114c0e3c8a 100644 --- a/packages/page-democracy/src/Overview/ReferendumVotes.tsx +++ b/packages/page-democracy/src/Overview/ReferendumVotes.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-democracy authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveReferendumVote } from '@polkadot/api-derive/types'; -import BN from 'bn.js'; import React, { useMemo } from 'react'; import { Expander } from '@polkadot/react-components'; diff --git a/packages/page-democracy/src/Overview/Seconding.tsx b/packages/page-democracy/src/Overview/Seconding.tsx index 0c1c6ca3f1..dc849e6695 100644 --- a/packages/page-democracy/src/Overview/Seconding.tsx +++ b/packages/page-democracy/src/Overview/Seconding.tsx @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/app-democracy authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveProposalImage } from '@polkadot/api-derive/types'; import type { AccountId, Balance } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useState } from 'react'; import { Button, InputAddress, InputBalance, Modal, ProposedAction, TxButton } from '@polkadot/react-components'; diff --git a/packages/page-democracy/src/Overview/Summary.tsx b/packages/page-democracy/src/Overview/Summary.tsx index 93709fbad3..66d776dc14 100644 --- a/packages/page-democracy/src/Overview/Summary.tsx +++ b/packages/page-democracy/src/Overview/Summary.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-democracy authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React from 'react'; import { CardSummary, SummaryBox } from '@polkadot/react-components'; diff --git a/packages/page-democracy/src/Overview/Voting.tsx b/packages/page-democracy/src/Overview/Voting.tsx index 2583b4a80f..9bcfe2dcb3 100644 --- a/packages/page-democracy/src/Overview/Voting.tsx +++ b/packages/page-democracy/src/Overview/Voting.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-democracy authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { PropIndex, Proposal } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useMemo, useState } from 'react'; import { Button, ConvictionDropdown, Modal, ProposedAction, TxButton, VoteAccount, VoteValue } from '@polkadot/react-components'; diff --git a/packages/page-democracy/src/useChangeCalc.ts b/packages/page-democracy/src/useChangeCalc.ts index 2b5d122796..df7830c9e9 100644 --- a/packages/page-democracy/src/useChangeCalc.ts +++ b/packages/page-democracy/src/useChangeCalc.ts @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-democracy authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { VoteThreshold } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import { useEffect, useState } from 'react'; import { useApi, useCall } from '@polkadot/react-hooks'; diff --git a/packages/page-parachains/src/Overview/Parachains.tsx b/packages/page-parachains/src/Overview/Parachains.tsx index e42578c7df..4864a6f64c 100644 --- a/packages/page-parachains/src/Overview/Parachains.tsx +++ b/packages/page-parachains/src/Overview/Parachains.tsx @@ -1,6 +1,7 @@ // Copyright 2017-2021 @polkadot/app-parachains authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { ApiPromise } from '@polkadot/api'; import type { SignedBlockExtended } from '@polkadot/api-derive/types'; import type { AccountId, CandidateReceipt, CoreAssignment, Event, GroupIndex, ParaId, ParaValidatorIndex } from '@polkadot/types/interfaces'; @@ -8,7 +9,6 @@ import type { IEvent } from '@polkadot/types/types'; import type { LeasePeriod, QueuedAction, ScheduledProposals } from '../types'; import type { EventMapInfo, ValidatorInfo } from './types'; -import BN from 'bn.js'; import React, { useEffect, useMemo, useRef, useState } from 'react'; import { Table } from '@polkadot/react-components'; diff --git a/packages/page-parachains/src/Overview/Periods.tsx b/packages/page-parachains/src/Overview/Periods.tsx index 9ce1b8d3b9..8281ad5ed0 100644 --- a/packages/page-parachains/src/Overview/Periods.tsx +++ b/packages/page-parachains/src/Overview/Periods.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-parachains authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { LeasePeriod } from '../types'; -import BN from 'bn.js'; import React, { useMemo } from 'react'; import { BN_ONE, formatNumber } from '@polkadot/util'; diff --git a/packages/page-rpc/src/Rpc/Account.tsx b/packages/page-rpc/src/Rpc/Account.tsx index 0be9d769d1..9e703211da 100644 --- a/packages/page-rpc/src/Rpc/Account.tsx +++ b/packages/page-rpc/src/Rpc/Account.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-rpc authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useEffect, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/page-society/src/Candidates/BidNew.tsx b/packages/page-society/src/Candidates/BidNew.tsx index 32a9a77aa2..14469c9453 100644 --- a/packages/page-society/src/Candidates/BidNew.tsx +++ b/packages/page-society/src/Candidates/BidNew.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-society authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useState } from 'react'; import { InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components'; diff --git a/packages/page-staking/src/Actions/Account/InputValidationUnstakeThreshold.tsx b/packages/page-staking/src/Actions/Account/InputValidationUnstakeThreshold.tsx index 50aa1509f0..0a975dab23 100644 --- a/packages/page-staking/src/Actions/Account/InputValidationUnstakeThreshold.tsx +++ b/packages/page-staking/src/Actions/Account/InputValidationUnstakeThreshold.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useEffect, useState } from 'react'; import { MarkWarning } from '@polkadot/react-components'; diff --git a/packages/page-staking/src/Actions/Account/ListNominees.tsx b/packages/page-staking/src/Actions/Account/ListNominees.tsx index 80e82e943b..1b69fa1cfe 100644 --- a/packages/page-staking/src/Actions/Account/ListNominees.tsx +++ b/packages/page-staking/src/Actions/Account/ListNominees.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveEraExposure, DeriveSessionIndexes } from '@polkadot/api-derive/types'; -import BN from 'bn.js'; import React, { useMemo } from 'react'; import { AddressMini, Expander, MarkWarning } from '@polkadot/react-components'; diff --git a/packages/page-staking/src/Actions/Account/Unbond.tsx b/packages/page-staking/src/Actions/Account/Unbond.tsx index ab7990eb6b..77bd135df7 100644 --- a/packages/page-staking/src/Actions/Account/Unbond.tsx +++ b/packages/page-staking/src/Actions/Account/Unbond.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { AccountId, StakingLedger } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/page-staking/src/Actions/partials/Bond.tsx b/packages/page-staking/src/Actions/partials/Bond.tsx index 48a344e872..8cf7a2368c 100644 --- a/packages/page-staking/src/Actions/partials/Bond.tsx +++ b/packages/page-staking/src/Actions/partials/Bond.tsx @@ -1,11 +1,11 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveBalancesAll } from '@polkadot/api-derive/types'; import type { AmountValidateState, DestinationType } from '../types'; import type { BondInfo } from './types'; -import BN from 'bn.js'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { Dropdown, InputAddress, InputBalance, MarkError, Modal, Static } from '@polkadot/react-components'; diff --git a/packages/page-staking/src/Actions/types.ts b/packages/page-staking/src/Actions/types.ts index 1a71c7fe51..b7166350ba 100644 --- a/packages/page-staking/src/Actions/types.ts +++ b/packages/page-staking/src/Actions/types.ts @@ -1,10 +1,9 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { AccountId, Balance, UnappliedSlashOther } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; - export interface AmountValidateState { error: string | null; warning: string | null; diff --git a/packages/page-staking/src/Actions/useUnbondDuration.ts b/packages/page-staking/src/Actions/useUnbondDuration.ts index fa96951101..6b5a6cb99f 100644 --- a/packages/page-staking/src/Actions/useUnbondDuration.ts +++ b/packages/page-staking/src/Actions/useUnbondDuration.ts @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveSessionInfo } from '@polkadot/api-derive/types'; -import BN from 'bn.js'; import { useMemo } from 'react'; import { useApi, useCall } from '@polkadot/react-hooks'; diff --git a/packages/page-staking/src/Overview/Address/Status.tsx b/packages/page-staking/src/Overview/Address/Status.tsx index 9299f233e1..08ab7c59b3 100644 --- a/packages/page-staking/src/Overview/Address/Status.tsx +++ b/packages/page-staking/src/Overview/Address/Status.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useMemo } from 'react'; import { Badge, Icon } from '@polkadot/react-components'; diff --git a/packages/page-staking/src/Overview/Address/index.tsx b/packages/page-staking/src/Overview/Address/index.tsx index 49c9b0496b..19a1a11cf4 100644 --- a/packages/page-staking/src/Overview/Address/index.tsx +++ b/packages/page-staking/src/Overview/Address/index.tsx @@ -1,13 +1,13 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveAccountInfo, DeriveHeartbeatAuthor } from '@polkadot/api-derive/types'; import type { Option } from '@polkadot/types'; import type { SlashingSpans, ValidatorPrefs } from '@polkadot/types/interfaces'; import type { NominatedBy as NominatedByType, ValidatorInfo } from '../../types'; import type { NominatorValue } from './types'; -import BN from 'bn.js'; import React, { useCallback, useMemo } from 'react'; import { ApiPromise } from '@polkadot/api'; diff --git a/packages/page-staking/src/Payouts/Stash.tsx b/packages/page-staking/src/Payouts/Stash.tsx index 01b6714938..57b8a74c6f 100644 --- a/packages/page-staking/src/Payouts/Stash.tsx +++ b/packages/page-staking/src/Payouts/Stash.tsx @@ -1,11 +1,11 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { SubmittableExtrinsic } from '@polkadot/api/types'; import type { DeriveStakerReward, DeriveStakingAccount } from '@polkadot/api-derive/types'; import type { PayoutStash } from './types'; -import BN from 'bn.js'; import React, { useEffect, useState } from 'react'; import { ApiPromise } from '@polkadot/api'; diff --git a/packages/page-staking/src/Payouts/Validator.tsx b/packages/page-staking/src/Payouts/Validator.tsx index 7dd1ce959d..9b512fd06b 100644 --- a/packages/page-staking/src/Payouts/Validator.tsx +++ b/packages/page-staking/src/Payouts/Validator.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { PayoutValidator } from './types'; -import BN from 'bn.js'; import React, { useMemo } from 'react'; import { AddressMini, AddressSmall, Expander } from '@polkadot/react-components'; diff --git a/packages/page-staking/src/Payouts/types.ts b/packages/page-staking/src/Payouts/types.ts index a5630e3d3b..a93b8af6e4 100644 --- a/packages/page-staking/src/Payouts/types.ts +++ b/packages/page-staking/src/Payouts/types.ts @@ -1,11 +1,10 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveStakerReward } from '@polkadot/api-derive/types'; import type { Balance, EraIndex } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; - export interface PayoutEraValidator { era: EraIndex; stashes: Record; diff --git a/packages/page-staking/src/Payouts/useEraBlocks.ts b/packages/page-staking/src/Payouts/useEraBlocks.ts index b2c1420dee..81fb72f8d8 100644 --- a/packages/page-staking/src/Payouts/useEraBlocks.ts +++ b/packages/page-staking/src/Payouts/useEraBlocks.ts @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveSessionProgress } from '@polkadot/api-derive/types'; import type { Forcing } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import { useMemo } from 'react'; import { useApi, useCall } from '@polkadot/react-hooks'; diff --git a/packages/page-staking/src/Payouts/useStakerPayouts.ts b/packages/page-staking/src/Payouts/useStakerPayouts.ts index b8bed6187a..ef1637a4d9 100644 --- a/packages/page-staking/src/Payouts/useStakerPayouts.ts +++ b/packages/page-staking/src/Payouts/useStakerPayouts.ts @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Option } from '@polkadot/types'; import type { EraIndex } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import { useMemo } from 'react'; import { useApi, useCall } from '@polkadot/react-hooks'; diff --git a/packages/page-staking/src/Payouts/util.tsx b/packages/page-staking/src/Payouts/util.tsx index 57555a8768..62f54cf641 100644 --- a/packages/page-staking/src/Payouts/util.tsx +++ b/packages/page-staking/src/Payouts/util.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React from 'react'; import { BN_ONE, formatNumber } from '@polkadot/util'; diff --git a/packages/page-staking/src/Query/types.ts b/packages/page-staking/src/Query/types.ts index a5f091c045..f77b1411af 100644 --- a/packages/page-staking/src/Query/types.ts +++ b/packages/page-staking/src/Query/types.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; export interface Props { className?: string; diff --git a/packages/page-staking/src/Query/util.ts b/packages/page-staking/src/Query/util.ts index 8d81d40b33..de97ebdd5f 100644 --- a/packages/page-staking/src/Query/util.ts +++ b/packages/page-staking/src/Query/util.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; import { BN_THOUSAND, BN_ZERO, isBn, isFunction } from '@polkadot/util'; diff --git a/packages/page-staking/src/Slashes/types.ts b/packages/page-staking/src/Slashes/types.ts index 93899d918b..5db5a5478f 100644 --- a/packages/page-staking/src/Slashes/types.ts +++ b/packages/page-staking/src/Slashes/types.ts @@ -1,10 +1,9 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { UnappliedSlash } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; - export interface Slash { era: BN; isMine: boolean; diff --git a/packages/page-staking/src/Targets/Summary.tsx b/packages/page-staking/src/Targets/Summary.tsx index 1292179fa7..f7d2812626 100644 --- a/packages/page-staking/src/Targets/Summary.tsx +++ b/packages/page-staking/src/Targets/Summary.tsx @@ -1,11 +1,11 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveSessionIndexes } from '@polkadot/api-derive/types'; import type { Option } from '@polkadot/types'; import type { Balance } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useMemo } from 'react'; import { CardSummary, SummaryBox } from '@polkadot/react-components'; diff --git a/packages/page-staking/src/Targets/Validator.tsx b/packages/page-staking/src/Targets/Validator.tsx index ee30881e4e..aad15af152 100644 --- a/packages/page-staking/src/Targets/Validator.tsx +++ b/packages/page-staking/src/Targets/Validator.tsx @@ -1,11 +1,11 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveAccountInfo } from '@polkadot/api-derive/types'; import type { UnappliedSlash } from '@polkadot/types/interfaces'; import type { NominatedBy, ValidatorInfo } from '../types'; -import BN from 'bn.js'; import React, { useCallback, useMemo } from 'react'; import { AddressSmall, Badge, Checkbox, Icon } from '@polkadot/react-components'; diff --git a/packages/page-staking/src/Targets/index.tsx b/packages/page-staking/src/Targets/index.tsx index 937196c3fe..77d08f9907 100644 --- a/packages/page-staking/src/Targets/index.tsx +++ b/packages/page-staking/src/Targets/index.tsx @@ -1,11 +1,11 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveHasIdentity, DeriveStakingOverview } from '@polkadot/api-derive/types'; import type { StakerState } from '@polkadot/react-hooks/types'; import type { NominatedBy, SortedTargets, TargetSortBy, ValidatorInfo } from '../types'; -import BN from 'bn.js'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/page-staking/src/types.ts b/packages/page-staking/src/types.ts index 4b290b24e1..508e04f3f8 100644 --- a/packages/page-staking/src/types.ts +++ b/packages/page-staking/src/types.ts @@ -1,11 +1,10 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Inflation } from '@polkadot/react-hooks/types'; import type { AccountId, Balance, BlockNumber, EraIndex, Exposure, Hash, SessionIndex, ValidatorPrefs, ValidatorPrefsTo196 } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; - export type Nominators = Record; export type AccountFilter = 'all' | 'controller' | 'session' | 'stash' | 'unbonded'; diff --git a/packages/page-sudo/src/Sudo.tsx b/packages/page-sudo/src/Sudo.tsx index d6fd5841fe..bd97611da8 100644 --- a/packages/page-sudo/src/Sudo.tsx +++ b/packages/page-sudo/src/Sudo.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-js authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { SubmittableExtrinsic } from '@polkadot/api/types'; -import BN from 'bn.js'; import React, { useCallback, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/page-tech-comm/src/Proposals/Voting.tsx b/packages/page-tech-comm/src/Proposals/Voting.tsx index dab28c91b6..2190f42b06 100644 --- a/packages/page-tech-comm/src/Proposals/Voting.tsx +++ b/packages/page-tech-comm/src/Proposals/Voting.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-tech-comm authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { AccountId, Hash } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useState } from 'react'; import { Button, MarkWarning, Modal, TxButton, VoteAccount } from '@polkadot/react-components'; diff --git a/packages/page-treasury/src/Overview/ProposalCreate.tsx b/packages/page-treasury/src/Overview/ProposalCreate.tsx index 8596f74422..93f206c736 100644 --- a/packages/page-treasury/src/Overview/ProposalCreate.tsx +++ b/packages/page-treasury/src/Overview/ProposalCreate.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-treasury authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useMemo, useState } from 'react'; import { Button, InputAddress, InputBalance, MarkWarning, Modal, Static, TxButton } from '@polkadot/react-components'; diff --git a/packages/page-treasury/src/Overview/Summary.tsx b/packages/page-treasury/src/Overview/Summary.tsx index 1109448c29..ec39aaca0e 100644 --- a/packages/page-treasury/src/Overview/Summary.tsx +++ b/packages/page-treasury/src/Overview/Summary.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-treasury authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React from 'react'; import { CardSummary, SummaryBox } from '@polkadot/react-components'; diff --git a/packages/page-treasury/src/Tips/Tip.tsx b/packages/page-treasury/src/Tips/Tip.tsx index 6e5e2ab871..b678e1266c 100644 --- a/packages/page-treasury/src/Tips/Tip.tsx +++ b/packages/page-treasury/src/Tips/Tip.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-treasury authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { AccountId, Balance, BlockNumber, OpenTip, OpenTipTo225 } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useEffect, useMemo, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/page-treasury/src/Tips/TipCreate.tsx b/packages/page-treasury/src/Tips/TipCreate.tsx index 32a2cb6f7d..bcab92d852 100644 --- a/packages/page-treasury/src/Tips/TipCreate.tsx +++ b/packages/page-treasury/src/Tips/TipCreate.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-treasury authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useEffect, useState } from 'react'; import { Button, Input, InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components'; diff --git a/packages/page-treasury/src/Tips/TipEndorse.tsx b/packages/page-treasury/src/Tips/TipEndorse.tsx index aab26e5495..e92292eba5 100644 --- a/packages/page-treasury/src/Tips/TipEndorse.tsx +++ b/packages/page-treasury/src/Tips/TipEndorse.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/app-treasury authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useState } from 'react'; import { Button, InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components'; diff --git a/packages/page-treasury/src/Tips/Tips.tsx b/packages/page-treasury/src/Tips/Tips.tsx index afd962f48a..adb4c1dee1 100644 --- a/packages/page-treasury/src/Tips/Tips.tsx +++ b/packages/page-treasury/src/Tips/Tips.tsx @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/app-treasury authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Option } from '@polkadot/types'; import type { OpenTip, OpenTipTo225 } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useMemo, useRef, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/page-treasury/src/Tips/index.tsx b/packages/page-treasury/src/Tips/index.tsx index 245a962641..7c1f37d8c0 100644 --- a/packages/page-treasury/src/Tips/index.tsx +++ b/packages/page-treasury/src/Tips/index.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-treasury authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { SubmittableExtrinsic } from '@polkadot/api/types'; -import BN from 'bn.js'; import React, { useCallback, useMemo, useState } from 'react'; import { Button, TxButton } from '@polkadot/react-components'; diff --git a/packages/react-components/src/AddressInfo.tsx b/packages/react-components/src/AddressInfo.tsx index d643f56729..14cd209c76 100644 --- a/packages/react-components/src/AddressInfo.tsx +++ b/packages/react-components/src/AddressInfo.tsx @@ -1,11 +1,11 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { TFunction } from 'i18next'; import type { DeriveBalancesAccountData, DeriveBalancesAll, DeriveDemocracyLock, DeriveStakingAccount } from '@polkadot/api-derive/types'; import type { BlockNumber, LockIdentifier, ValidatorPrefsTo145, Voting } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useRef } from 'react'; import styled from 'styled-components'; diff --git a/packages/react-components/src/AddressMini.tsx b/packages/react-components/src/AddressMini.tsx index 146888df87..2d831bd751 100644 --- a/packages/react-components/src/AddressMini.tsx +++ b/packages/react-components/src/AddressMini.tsx @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces'; import type { KeyringItemType } from '@polkadot/ui-keyring/types'; -import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; diff --git a/packages/react-components/src/Balance.tsx b/packages/react-components/src/Balance.tsx index 415b30e9af..de1e48302b 100644 --- a/packages/react-components/src/Balance.tsx +++ b/packages/react-components/src/Balance.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React from 'react'; import { Balance, FormatBalance } from '@polkadot/react-query'; diff --git a/packages/react-components/src/Bonded.tsx b/packages/react-components/src/Bonded.tsx index 835b82f696..1d7148ebe8 100644 --- a/packages/react-components/src/Bonded.tsx +++ b/packages/react-components/src/Bonded.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React from 'react'; import { Bonded } from '@polkadot/react-query'; diff --git a/packages/react-components/src/Call.tsx b/packages/react-components/src/Call.tsx index f0e26f9755..85a03532f3 100644 --- a/packages/react-components/src/Call.tsx +++ b/packages/react-components/src/Call.tsx @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { ExtrinsicSignature } from '@polkadot/types/interfaces'; import type { Codec, IExtrinsic, IMethod, TypeDef } from '@polkadot/types/types'; -import BN from 'bn.js'; import React, { useEffect, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/react-components/src/CardSummary.tsx b/packages/react-components/src/CardSummary.tsx index 76e1477a61..fe4c8ab37d 100644 --- a/packages/react-components/src/CardSummary.tsx +++ b/packages/react-components/src/CardSummary.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { UInt } from '@polkadot/types'; -import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; diff --git a/packages/react-components/src/Chart/Line.tsx b/packages/react-components/src/Chart/Line.tsx index 791dd0b626..398c1ea6ce 100644 --- a/packages/react-components/src/Chart/Line.tsx +++ b/packages/react-components/src/Chart/Line.tsx @@ -1,13 +1,15 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { LineProps } from './types'; -import BN from 'bn.js'; import ChartJs from 'chart.js'; import React, { useMemo } from 'react'; import * as Chart from 'react-chartjs-2'; +import { isBn } from '@polkadot/util'; + interface State { chartData: ChartJs.ChartData; chartOptions: ChartJs.ChartOptions; @@ -50,7 +52,7 @@ const chartOptions = { function calculateOptions (colors: (string | undefined)[] = [], legends: string[], labels: string[], values: (number | BN)[][]): State { const chartData = values.reduce((chartData, values, index): Config => { const color = colors[index] || alphaColor(COLORS[index]); - const data = values.map((value): number => BN.isBN(value) ? value.toNumber() : value); + const data = values.map((value): number => isBn(value) ? value.toNumber() : value); chartData.datasets.push({ backgroundColor: color, diff --git a/packages/react-components/src/Chart/types.ts b/packages/react-components/src/Chart/types.ts index 2a75c3f5de..93d597dd04 100644 --- a/packages/react-components/src/Chart/types.ts +++ b/packages/react-components/src/Chart/types.ts @@ -1,7 +1,7 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; export interface DoughnutValue { colors: string[]; diff --git a/packages/react-components/src/DemocracyLocks.tsx b/packages/react-components/src/DemocracyLocks.tsx index 250fa953e0..64ece827fc 100644 --- a/packages/react-components/src/DemocracyLocks.tsx +++ b/packages/react-components/src/DemocracyLocks.tsx @@ -1,11 +1,11 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { TFunction } from 'i18next'; import type { DeriveDemocracyLock } from '@polkadot/api-derive/types'; import type { Balance } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useEffect, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/react-components/src/LinkExternal.tsx b/packages/react-components/src/LinkExternal.tsx index aa38201cdd..d01136a2b5 100644 --- a/packages/react-components/src/LinkExternal.tsx +++ b/packages/react-components/src/LinkExternal.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { LinkTypes } from '@polkadot/apps-config/links/types'; -import BN from 'bn.js'; import React, { useMemo } from 'react'; import styled from 'styled-components'; diff --git a/packages/react-components/src/Progress.tsx b/packages/react-components/src/Progress.tsx index b7aa0479ed..d6f80f0d1e 100644 --- a/packages/react-components/src/Progress.tsx +++ b/packages/react-components/src/Progress.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { UInt } from '@polkadot/types'; -import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; diff --git a/packages/react-components/src/ProposedAction.tsx b/packages/react-components/src/ProposedAction.tsx index 9643c6726f..0bf940a638 100644 --- a/packages/react-components/src/ProposedAction.tsx +++ b/packages/react-components/src/ProposedAction.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/app-democracy authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Proposal } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; diff --git a/packages/react-components/src/VoteValue.tsx b/packages/react-components/src/VoteValue.tsx index 9472975046..5767e9ed4c 100644 --- a/packages/react-components/src/VoteValue.tsx +++ b/packages/react-components/src/VoteValue.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveBalancesAll } from '@polkadot/api-derive/types'; -import BN from 'bn.js'; import React, { useCallback, useEffect, useState } from 'react'; import { useApi, useCall } from '@polkadot/react-hooks'; diff --git a/packages/react-hooks/src/useInflation.ts b/packages/react-hooks/src/useInflation.ts index 23be4cae1a..8a4fd06d4d 100644 --- a/packages/react-hooks/src/useInflation.ts +++ b/packages/react-hooks/src/useInflation.ts @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/react-hooks authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { ApiPromise } from '@polkadot/api'; import type { Inflation } from './types'; -import BN from 'bn.js'; import { useEffect, useState } from 'react'; import { getInflationParams } from '@polkadot/apps-config'; diff --git a/packages/react-hooks/src/useTreasury.ts b/packages/react-hooks/src/useTreasury.ts index d58c44f0df..2b77b19467 100644 --- a/packages/react-hooks/src/useTreasury.ts +++ b/packages/react-hooks/src/useTreasury.ts @@ -1,9 +1,9 @@ // Copyright 2017-2020 @polkadot/react-hooks authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Balance } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import { useEffect, useState } from 'react'; import { DeriveBalancesAccount } from '@polkadot/api-derive/types'; diff --git a/packages/react-hooks/src/useVotingStatus.ts b/packages/react-hooks/src/useVotingStatus.ts index cf20b24a0c..981190f79c 100644 --- a/packages/react-hooks/src/useVotingStatus.ts +++ b/packages/react-hooks/src/useVotingStatus.ts @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-hooks authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { BlockNumber, Votes } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import { useMemo } from 'react'; import { ApiPromise } from '@polkadot/api'; diff --git a/packages/react-hooks/src/useWeight.ts b/packages/react-hooks/src/useWeight.ts index 3ad77a5007..66c85defc7 100644 --- a/packages/react-hooks/src/useWeight.ts +++ b/packages/react-hooks/src/useWeight.ts @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-hooks authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Call } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import { useEffect, useState } from 'react'; import { BN_ZERO, isFunction } from '@polkadot/util'; diff --git a/packages/react-params/src/Param/Amount.tsx b/packages/react-params/src/Param/Amount.tsx index 1af1ffb875..5f7b1ba54d 100644 --- a/packages/react-params/src/Param/Amount.tsx +++ b/packages/react-params/src/Param/Amount.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-params authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Props } from '../types'; -import BN from 'bn.js'; import React, { useCallback, useMemo } from 'react'; import { Input, InputNumber } from '@polkadot/react-components'; diff --git a/packages/react-params/src/Param/Vote.tsx b/packages/react-params/src/Param/Vote.tsx index 58dd5357a5..dff113fe40 100644 --- a/packages/react-params/src/Param/Vote.tsx +++ b/packages/react-params/src/Param/Vote.tsx @@ -3,11 +3,11 @@ import type { Props } from '../types'; -import BN from 'bn.js'; import React, { useRef } from 'react'; import { Dropdown } from '@polkadot/react-components'; import { GenericVote } from '@polkadot/types'; +import { isBn } from '@polkadot/util'; import { useTranslation } from '../translate'; import Bare from './Bare'; @@ -39,7 +39,7 @@ function Vote ({ className = '', defaultValue: { value }, isDisabled, isError, o { text: t('Locked6x'), value: 6 } ]); - const defaultValue = value instanceof BN + const defaultValue = isBn(value) ? value.toNumber() : value instanceof GenericVote ? (value.isAye ? -1 : 0) diff --git a/packages/react-query/src/BlockToTime.tsx b/packages/react-query/src/BlockToTime.tsx index ea9cca0b09..cbe4a6c028 100644 --- a/packages/react-query/src/BlockToTime.tsx +++ b/packages/react-query/src/BlockToTime.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-query authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { ApiPromise } from '@polkadot/api'; -import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; diff --git a/packages/react-query/src/Elapsed.tsx b/packages/react-query/src/Elapsed.tsx index e73164a757..e643756014 100644 --- a/packages/react-query/src/Elapsed.tsx +++ b/packages/react-query/src/Elapsed.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/react-query authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useEffect, useState } from 'react'; import styled from 'styled-components'; diff --git a/packages/react-query/src/FormatBalance.tsx b/packages/react-query/src/FormatBalance.tsx index 10dc41456a..e149d71845 100644 --- a/packages/react-query/src/FormatBalance.tsx +++ b/packages/react-query/src/FormatBalance.tsx @@ -1,10 +1,10 @@ // Copyright 2017-2021 @polkadot/react-query authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Compact } from '@polkadot/types'; import type { Registry } from '@polkadot/types/types'; -import BN from 'bn.js'; import React, { useMemo } from 'react'; import styled from 'styled-components'; diff --git a/packages/react-query/src/Nonce.tsx b/packages/react-query/src/Nonce.tsx index 3121c29452..49de71872d 100644 --- a/packages/react-query/src/Nonce.tsx +++ b/packages/react-query/src/Nonce.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-query authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveBalancesAll } from '@polkadot/api-derive/types'; -import BN from 'bn.js'; import React from 'react'; import { useApi, useCall } from '@polkadot/react-hooks'; diff --git a/packages/react-query/src/SessionToTime.tsx b/packages/react-query/src/SessionToTime.tsx index 1b9890e8e0..1b2596763b 100644 --- a/packages/react-query/src/SessionToTime.tsx +++ b/packages/react-query/src/SessionToTime.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-query authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { DeriveSessionProgress } from '@polkadot/api-derive/types'; -import BN from 'bn.js'; import React, { useMemo } from 'react'; import { useApi, useCall } from '@polkadot/react-hooks'; diff --git a/packages/react-query/src/TimeNow.tsx b/packages/react-query/src/TimeNow.tsx index 99a814fbb5..b867201d14 100644 --- a/packages/react-query/src/TimeNow.tsx +++ b/packages/react-query/src/TimeNow.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-query authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { Moment } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useEffect, useState } from 'react'; import { useApi, useCall } from '@polkadot/react-hooks'; diff --git a/packages/react-signer/src/PaymentInfo.tsx b/packages/react-signer/src/PaymentInfo.tsx index be2dce92d3..8dc883e23e 100644 --- a/packages/react-signer/src/PaymentInfo.tsx +++ b/packages/react-signer/src/PaymentInfo.tsx @@ -1,11 +1,11 @@ // Copyright 2017-2021 @polkadot/react-signer authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { SubmittableExtrinsic } from '@polkadot/api/promise/types'; import type { DeriveBalancesAll } from '@polkadot/api-derive/types'; import type { RuntimeDispatchInfo } from '@polkadot/types/interfaces'; -import BN from 'bn.js'; import React, { useEffect, useState } from 'react'; import { Trans } from 'react-i18next'; diff --git a/packages/react-signer/src/Tip.tsx b/packages/react-signer/src/Tip.tsx index cc03c6a7a0..330aa2b4f5 100644 --- a/packages/react-signer/src/Tip.tsx +++ b/packages/react-signer/src/Tip.tsx @@ -1,7 +1,8 @@ // Copyright 2017-2021 @polkadot/react-signer authors & contributors // SPDX-License-Identifier: Apache-2.0 -import BN from 'bn.js'; +import type BN from 'bn.js'; + import React, { useEffect, useState } from 'react'; import { InputBalance, Modal, Toggle } from '@polkadot/react-components'; diff --git a/packages/react-signer/src/Transaction.tsx b/packages/react-signer/src/Transaction.tsx index 774eeccbde..cb01f2b2fa 100644 --- a/packages/react-signer/src/Transaction.tsx +++ b/packages/react-signer/src/Transaction.tsx @@ -1,9 +1,9 @@ // Copyright 2017-2021 @polkadot/react-signer authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; import type { QueueTx } from '@polkadot/react-components/Status/types'; -import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; diff --git a/packages/test-support/scripts/lib/changeBountyStateFunctions.ts b/packages/test-support/scripts/lib/changeBountyStateFunctions.ts index 784b19eeef..3f4d1e209f 100644 --- a/packages/test-support/scripts/lib/changeBountyStateFunctions.ts +++ b/packages/test-support/scripts/lib/changeBountyStateFunctions.ts @@ -1,11 +1,10 @@ // Copyright 2017-2021 @polkadot/test-support authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type BN from 'bn.js'; +import type { ApiPromise } from '@polkadot/api'; import type { KeyringPair } from '@polkadot/keyring/types'; -import BN from 'bn.js'; - -import { ApiPromise } from '@polkadot/api'; import { execute } from '@polkadot/test-support/transaction'; import { acceptMotion, fillTreasury, getMotion, proposeMotion } from './helpers';