Handle BN type-only imports correctly (#5428)

* Handle BN type-only imports correctly

* lint fixes
This commit is contained in:
Jaco 2021-06-03 11:41:55 +03:00 committed by GitHub
parent 50befce6f2
commit 8a95b1a93b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
100 changed files with 123 additions and 114 deletions

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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)));

View File

@ -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';

View File

@ -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());

View File

@ -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());
}

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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;

View File

@ -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';

View File

@ -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;
}

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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;

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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<string, Balance>;

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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;

View File

@ -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';

View File

@ -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;

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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<string, string[]>;
export type AccountFilter = 'all' | 'controller' | 'session' | 'stash' | 'unbonded';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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,

View File

@ -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[];

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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<string>('Locked6x'), value: 6 }
]);
const defaultValue = value instanceof BN
const defaultValue = isBn(value)
? value.toNumber()
: value instanceof GenericVote
? (value.isAye ? -1 : 0)

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';