Skip to content

Commit

Permalink
Merge pull request #36 from Fair-Squares/fix-lint-warnings
Browse files Browse the repository at this point in the history
fix: lint warnings
  • Loading branch information
cuteolaf authored Mar 14, 2023
2 parents b1193b2 + 6090682 commit ae2dad3
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 34 deletions.
9 changes: 1 addition & 8 deletions src/contexts/Balances/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0

import { Option } from '@polkadot/types-codec';
import BN from 'bn.js';
import {
BalanceLedger,
BalancesAccount,
Expand All @@ -28,7 +27,7 @@ export const BalancesProvider = ({
children: React.ReactNode;
}) => {
const { api, isReady, network, consts } = useApi();
const { accounts: connectAccounts, addExternalAccount } = useConnect();
const { accounts: connectAccounts } = useConnect();

// existential amount of unit for an account
const existentialAmount = consts.existentialDeposit;
Expand Down Expand Up @@ -166,12 +165,6 @@ export const BalancesProvider = ({
// get account balances
const { free } = data;

// calculate free balance after app reserve
let freeAfterReserve = new BN(free).sub(existentialAmount);
freeAfterReserve = freeAfterReserve.lt(new BN(0))
? new BN(0)
: freeAfterReserve;

// set account balances to context
_account.balance = {
total: free,
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/Democracy/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DemocracyContextInterface } from './types';

export const defaultDemocracyContext: DemocracyContextInterface = {
fetchDemocracyVotes: async (index: number) => ({}),
fetchDemocracyVotes: async () => ({}),
};
4 changes: 2 additions & 2 deletions src/contexts/ShareDistributor/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { ShareDistributorContextInterface } from './types';

export const defaultShareDistributorContext: ShareDistributorContextInterface =
{
fetchAssetShareInfo: async (_collId: number, _itemId: number) => null,
getTokenShares: async (_virtualAccount: string) => null,
getTokenShares: async () => null,
fetchAssetShareInfo: async () => null,
};
2 changes: 1 addition & 1 deletion src/contexts/TransferOptions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const TransferOptionsProvider = ({
}: {
children: React.ReactNode;
}) => {
const { getAccount, getAccountBalance, getLedgerForStash } = useBalances();
const { getAccount, getAccountBalance } = useBalances();

// get the bond and unbond amounts available to the user
const getTransferOptions = (address: MaybeAccount): TransferOptions => {
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/Voting/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defaultAssetProposal, VotingContextInterface } from './types';

export const defaultVotingContext: VotingContextInterface = {
fetchProposals: async (hash: string) => defaultAssetProposal,
fetchProposals: async () => defaultAssetProposal,
};
4 changes: 0 additions & 4 deletions src/library/NetworkBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@
// SPDX-License-Identifier: Apache-2.0

import { useApi } from 'contexts/Api';
import { usePlugins } from 'contexts/Plugins';
import { useOutsideAlerter } from 'library/Hooks';
import { usePrices } from 'library/Hooks/usePrices';
import { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { capitalizeFirstLetter } from 'Utils';
import { Status } from './Status';
import { NetworkInfo, Separator, Summary, Wrapper } from './Wrappers';

export const NetworkBar = () => {
const { plugins } = usePlugins();
const { network, isLightClient } = useApi();
const prices = usePrices();
const { t } = useTranslation('library');

// currently not in use
Expand Down
2 changes: 0 additions & 2 deletions src/library/SideMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { faCompressAlt, faExpandAlt } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { SideMenuStickyThreshold } from 'consts';
import { useApi } from 'contexts/Api';
import { useHelp } from 'contexts/Help';
import { useModal } from 'contexts/Modal';
import { useTheme } from 'contexts/Themes';
import { useUi } from 'contexts/UI';
Expand Down Expand Up @@ -36,7 +35,6 @@ export const SideMenu = () => {
userSideMenuMinimised,
setUserSideMenuMinimised,
}: UIContextInterface = useUi();
const { openHelpWith } = useHelp();
const { t } = useTranslation('base');

// listen to window resize to hide SideMenu
Expand Down
2 changes: 1 addition & 1 deletion src/locale/cn/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,4 @@
"totalValidators": "所有验证人"
}
}
}
}
2 changes: 1 addition & 1 deletion src/locale/en/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,4 @@
"totalValidators": "Total Validators"
}
}
}
}
13 changes: 0 additions & 13 deletions src/modals/ConnectAccounts/Accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,21 @@
import { faCog } from '@fortawesome/free-solid-svg-icons';
import { ButtonSecondary } from '@rossbulat/polkadot-dashboard-ui';
import { useApi } from 'contexts/Api';
import { useBalances } from 'contexts/Balances';
import { useConnect } from 'contexts/Connect';
import { useModal } from 'contexts/Modal';
import { forwardRef, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { AnyJson } from 'types';
import { AccountButton } from './Account';
import { ControllerAccount, StashAcount } from './types';
import { AccountWrapper, ContentWrapper, PaddingWrapper } from './Wrappers';

export const Accounts = forwardRef((props: AnyJson, ref: AnyJson) => {
const { setSection } = props;

const { isReady } = useApi();
const { getAccount, activeAccount } = useConnect();
const {
getLedgerForController,
accounts: balanceAccounts,
ledgers,
} = useBalances();
const { connectToAccount } = useConnect();
const { setStatus } = useModal();
const { accounts } = useConnect();
const { t } = useTranslation('modals');

const _controllers: Array<ControllerAccount> = [];
const _stashes: Array<StashAcount> = [];

// store local copy of accounts
const [localAccounts, setLocalAccounts] = useState(accounts);
const [inactive, setInactive] = useState<string[]>([]);
Expand Down

0 comments on commit ae2dad3

Please sign in to comment.