Allow selectable targets (#2637)
This commit is contained in:
parent
504a998120
commit
e410cc1473
12
package.json
12
package.json
@ -8,12 +8,12 @@
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^1.12.0-beta.9",
|
||||
"@polkadot/api-contract": "^1.12.0-beta.9",
|
||||
"@polkadot/keyring": "^2.9.0-beta.1",
|
||||
"@polkadot/types": "^1.12.0-beta.9",
|
||||
"@polkadot/util": "^2.9.0-beta.1",
|
||||
"@polkadot/util-crypto": "^2.9.0-beta.1",
|
||||
"@polkadot/api": "^1.12.0-beta.11",
|
||||
"@polkadot/api-contract": "^1.12.0-beta.11",
|
||||
"@polkadot/keyring": "^2.9.0-beta.3",
|
||||
"@polkadot/types": "^1.12.0-beta.11",
|
||||
"@polkadot/util": "^2.9.0-beta.3",
|
||||
"@polkadot/util-crypto": "^2.9.0-beta.3",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
|
||||
@ -12,6 +12,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.2",
|
||||
"@polkadot/api-contract": "^1.12.0-beta.9"
|
||||
"@polkadot/api-contract": "^1.12.0-beta.11"
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import { BlockNumber } from '@polkadot/types/interfaces';
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { Button, LinkExternal, Tag } from '@polkadot/react-components';
|
||||
import { Badge, Button, Icon, LinkExternal } from '@polkadot/react-components';
|
||||
import { useApi, useCall } from '@polkadot/react-hooks';
|
||||
import { BlockToTime } from '@polkadot/react-query';
|
||||
import { formatNumber, isBoolean } from '@polkadot/util';
|
||||
@ -72,12 +72,13 @@ function Referendum ({ className, value: { allAye, allNay, image, imageHash, ind
|
||||
total={votedNay}
|
||||
votes={allNay}
|
||||
/>
|
||||
<td>
|
||||
<td className='badge'>
|
||||
{isBoolean(isPassing) && (
|
||||
<Tag
|
||||
color={isPassing ? 'green' : 'red'}
|
||||
<Badge
|
||||
hover={isPassing ? t('{{threshold}}, passing', { replace: { threshold } }) : t('{{threshold}}, not passing', { replace: { threshold } })}
|
||||
label={isPassing ? t('passing') : t('failing')}
|
||||
info={<Icon name={isPassing ? 'check' : 'cancel'} />}
|
||||
isTooltip
|
||||
type={isPassing ? 'green' : 'brown'}
|
||||
/>
|
||||
)}
|
||||
</td>
|
||||
|
||||
@ -3,15 +3,13 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { DeriveBalancesAll, DeriveStakingAccount } from '@polkadot/api-derive/types';
|
||||
import { AccountId, EraIndex, Exposure, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces';
|
||||
import { Codec, ITuple } from '@polkadot/types/types';
|
||||
import { EraIndex } from '@polkadot/types/interfaces';
|
||||
import { StakerState } from '@polkadot/react-hooks/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { AddressInfo, AddressMini, AddressSmall, Button, Expander, Menu, Popup, StakingBonded, StakingRedeemable, StakingUnbonding, TxButton } from '@polkadot/react-components';
|
||||
import { useAccounts, useApi, useCall, useToggle } from '@polkadot/react-hooks';
|
||||
import { u8aConcat, u8aToHex } from '@polkadot/util';
|
||||
import { useApi, useCall, useToggle } from '@polkadot/react-hooks';
|
||||
|
||||
import { useTranslation } from '../../translate';
|
||||
import useInactives from '../useInactives';
|
||||
@ -24,82 +22,21 @@ import SetSessionKey from './SetSessionKey';
|
||||
import Unbond from './Unbond';
|
||||
import Validate from './Validate';
|
||||
|
||||
type ValidatorInfo = ITuple<[ValidatorPrefs, Codec]> | ValidatorPrefs;
|
||||
|
||||
interface Props {
|
||||
activeEra?: EraIndex;
|
||||
allStashes?: string[];
|
||||
className?: string;
|
||||
isDisabled?: boolean;
|
||||
isOwnStash: boolean;
|
||||
info: StakerState;
|
||||
next?: string[];
|
||||
onUpdateType: (stashId: string, type: 'validator' | 'nominator' | 'started' | 'other') => void;
|
||||
setBonded: (account: string, bonded: BN) => void;
|
||||
stashId: string;
|
||||
validators?: string[];
|
||||
}
|
||||
|
||||
interface StakeState {
|
||||
controllerId: string | null;
|
||||
destination?: string;
|
||||
destinationId: number;
|
||||
exposure?: Exposure;
|
||||
hexSessionIdNext: string | null;
|
||||
hexSessionIdQueue: string | null;
|
||||
isLoading: boolean;
|
||||
isOwnController: boolean;
|
||||
isStashNominating: boolean;
|
||||
isStashValidating: boolean;
|
||||
nominating?: string[];
|
||||
sessionIds: string[];
|
||||
stakingLedger?: StakingLedger;
|
||||
validatorPrefs?: ValidatorPrefs;
|
||||
}
|
||||
|
||||
function toIdString (id?: AccountId | null): string | null {
|
||||
return id
|
||||
? id.toString()
|
||||
: null;
|
||||
}
|
||||
|
||||
function getStakeState (allAccounts: string[], allStashes: string[] | undefined, { controllerId: _controllerId, exposure, nextSessionIds, nominators, rewardDestination, sessionIds, stakingLedger, validatorPrefs }: DeriveStakingAccount, stashId: string, validateInfo: ValidatorInfo): StakeState {
|
||||
const isStashNominating = !!(nominators?.length);
|
||||
const isStashValidating = !(Array.isArray(validateInfo) ? validateInfo[1].isEmpty : validateInfo.isEmpty) || !!allStashes?.includes(stashId);
|
||||
const nextConcat = u8aConcat(...nextSessionIds.map((id): Uint8Array => id.toU8a()));
|
||||
const currConcat = u8aConcat(...sessionIds.map((id): Uint8Array => id.toU8a()));
|
||||
const controllerId = toIdString(_controllerId);
|
||||
|
||||
return {
|
||||
controllerId,
|
||||
destination: rewardDestination?.toString().toLowerCase(),
|
||||
destinationId: rewardDestination?.toNumber() || 0,
|
||||
exposure,
|
||||
hexSessionIdNext: u8aToHex(nextConcat, 48),
|
||||
hexSessionIdQueue: u8aToHex(currConcat.length ? currConcat : nextConcat, 48),
|
||||
isLoading: false,
|
||||
isOwnController: allAccounts.includes(controllerId || ''),
|
||||
isStashNominating,
|
||||
isStashValidating,
|
||||
// we assume that all ids are non-null
|
||||
nominating: nominators?.map(toIdString) as string[],
|
||||
sessionIds: (
|
||||
nextSessionIds.length
|
||||
? nextSessionIds
|
||||
: sessionIds
|
||||
).map(toIdString) as string[],
|
||||
stakingLedger,
|
||||
validatorPrefs
|
||||
};
|
||||
}
|
||||
|
||||
function Account ({ allStashes, className, isDisabled, isOwnStash, next, onUpdateType, setBonded, stashId, validators }: Props): React.ReactElement<Props> {
|
||||
function Account ({ className, info: { controllerId, destination, destinationId, hexSessionIdNext, hexSessionIdQueue, isLoading, isOwnController, isOwnStash, isStashNominating, isStashValidating, nominating, sessionIds, stakingLedger, stashId }, isDisabled, next, validators }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
const { allAccounts } = useAccounts();
|
||||
const validateInfo = useCall<ValidatorInfo>(api.query.staking.validators, [stashId]);
|
||||
const balancesAll = useCall<DeriveBalancesAll>(api.derive.balances.all, [stashId]);
|
||||
const stakingAccount = useCall<DeriveStakingAccount>(api.derive.staking.account, [stashId]);
|
||||
const [{ controllerId, destination, destinationId, hexSessionIdNext, hexSessionIdQueue, isLoading, isOwnController, isStashNominating, isStashValidating, nominating, sessionIds, stakingLedger }, setStakeState] = useState<StakeState>({ controllerId: null, destinationId: 0, hexSessionIdNext: null, hexSessionIdQueue: null, isLoading: true, isOwnController: false, isStashNominating: false, isStashValidating: false, sessionIds: [] });
|
||||
const [activeNoms, setActiveNoms] = useState<string[]>([]);
|
||||
const inactiveNoms = useInactives(stashId, nominating);
|
||||
const [isBondExtraOpen, toggleBondExtra] = useToggle();
|
||||
@ -112,26 +49,6 @@ function Account ({ allStashes, className, isDisabled, isOwnStash, next, onUpdat
|
||||
const [isUnbondOpen, toggleUnbond] = useToggle();
|
||||
const [isValidateOpen, toggleValidate] = useToggle();
|
||||
|
||||
useEffect((): void => {
|
||||
if (stakingAccount && validateInfo) {
|
||||
const state = getStakeState(allAccounts, allStashes, stakingAccount, stashId, validateInfo);
|
||||
|
||||
if (state.stakingLedger) {
|
||||
setBonded(stashId, state.stakingLedger.total.unwrap());
|
||||
}
|
||||
|
||||
setStakeState(state);
|
||||
onUpdateType(
|
||||
stashId,
|
||||
state.isStashValidating
|
||||
? 'validator'
|
||||
: state.isStashNominating
|
||||
? 'nominator'
|
||||
: 'other'
|
||||
);
|
||||
}
|
||||
}, [allAccounts, allStashes, onUpdateType, stakingAccount, setBonded, stashId, validateInfo]);
|
||||
|
||||
useEffect((): void => {
|
||||
nominating && setActiveNoms(
|
||||
nominating.filter((id): boolean => !inactiveNoms.includes(id))
|
||||
|
||||
@ -3,11 +3,12 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ActiveEraInfo, EraIndex } from '@polkadot/types/interfaces';
|
||||
import { StakerState } from '@polkadot/react-hooks/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { Table } from '@polkadot/react-components';
|
||||
import { useCall, useApi, useOwnStashes } from '@polkadot/react-hooks';
|
||||
import { useCall, useApi } from '@polkadot/react-hooks';
|
||||
import { FormatBalance } from '@polkadot/react-query';
|
||||
import { Option } from '@polkadot/types';
|
||||
|
||||
@ -17,60 +18,38 @@ import Account from './Account';
|
||||
import NewStake from './NewStake';
|
||||
|
||||
interface Props {
|
||||
allStashes?: string[];
|
||||
className?: string;
|
||||
isInElection?: boolean;
|
||||
ownStashes?: StakerState[];
|
||||
next?: string[];
|
||||
validators?: string[];
|
||||
}
|
||||
|
||||
interface Balances {
|
||||
accounts: Record<string, BN>;
|
||||
interface State {
|
||||
bondedTotal?: BN;
|
||||
foundStashes?: StakerState[];
|
||||
}
|
||||
|
||||
function Actions ({ allStashes, className, isInElection, next, validators }: Props): React.ReactElement<Props> {
|
||||
function Actions ({ className, isInElection, next, ownStashes, validators }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
const activeEra = useCall<EraIndex | undefined>(api.query.staking?.activeEra, [], {
|
||||
transform: (activeEra: Option<ActiveEraInfo>) => activeEra.unwrapOr({ index: undefined }).index
|
||||
});
|
||||
const ownStashes = useOwnStashes();
|
||||
const [{ bondedTotal }, setBonded] = useState<Balances>({ accounts: {} });
|
||||
const [foundStashes, setFoundStashes] = useState<[string, boolean][] | null>(null);
|
||||
const [stashTypes, setStashTypes] = useState<Record<string, number>>({});
|
||||
const [{ bondedTotal, foundStashes }, setState] = useState<State>({});
|
||||
|
||||
useEffect((): void => {
|
||||
ownStashes && setFoundStashes(
|
||||
ownStashes.sort((a, b) => (stashTypes[a[0]] || 99) - (stashTypes[b[0]] || 99))
|
||||
);
|
||||
}, [ownStashes, stashTypes]);
|
||||
|
||||
const _setBonded = useCallback(
|
||||
(account: string, bonded: BN) =>
|
||||
setBonded(({ accounts }: Balances): Balances => {
|
||||
accounts[account] = bonded;
|
||||
|
||||
return {
|
||||
accounts,
|
||||
bondedTotal: Object.values(accounts).reduce((total: BN, value: BN) => total.add(value), new BN(0))
|
||||
};
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
||||
const _onUpdateType = useCallback(
|
||||
(stashId: string, type: 'validator' | 'nominator' | 'started' | 'other'): void =>
|
||||
setStashTypes((stashTypes: Record<string, number>) => ({
|
||||
...stashTypes,
|
||||
[stashId]: type === 'validator'
|
||||
? 1
|
||||
: type === 'nominator'
|
||||
? 5
|
||||
: 9
|
||||
})),
|
||||
[]
|
||||
);
|
||||
ownStashes && setState({
|
||||
bondedTotal: ownStashes.reduce((total: BN, { stakingLedger }) =>
|
||||
stakingLedger
|
||||
? total.add(stakingLedger.total.unwrap())
|
||||
: total,
|
||||
new BN(0)),
|
||||
foundStashes: ownStashes.sort((a, b) =>
|
||||
(a.isStashValidating ? 1 : (a.isStashNominating ? 5 : 99)) - (b.isStashValidating ? 1 : (b.isStashNominating ? 5 : 99))
|
||||
)
|
||||
});
|
||||
}, [ownStashes]);
|
||||
|
||||
const header = useMemo(() => [
|
||||
[t('stashes'), 'start'],
|
||||
@ -95,21 +74,17 @@ function Actions ({ allStashes, className, isInElection, next, validators }: Pro
|
||||
<NewStake />
|
||||
<ElectionBanner isInElection={isInElection} />
|
||||
<Table
|
||||
empty={t('No funds staked yet. Bond funds to validate or nominate a validator')}
|
||||
empty={foundStashes && t('No funds staked yet. Bond funds to validate or nominate a validator')}
|
||||
footer={footer}
|
||||
header={header}
|
||||
>
|
||||
{foundStashes?.map(([stashId, isOwnStash]): React.ReactNode => (
|
||||
{foundStashes?.map((info): React.ReactNode => (
|
||||
<Account
|
||||
activeEra={activeEra}
|
||||
allStashes={allStashes}
|
||||
info={info}
|
||||
isDisabled={isInElection}
|
||||
isOwnStash={isOwnStash}
|
||||
key={stashId}
|
||||
key={info.stashId}
|
||||
next={next}
|
||||
onUpdateType={_onUpdateType}
|
||||
setBonded={_setBonded}
|
||||
stashId={stashId}
|
||||
validators={validators}
|
||||
/>
|
||||
))}
|
||||
|
||||
95
packages/page-staking/src/Targets/Nominate.tsx
Normal file
95
packages/page-staking/src/Targets/Nominate.tsx
Normal file
@ -0,0 +1,95 @@
|
||||
// Copyright 2017-2020 @polkadot/app-staking authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { StakerState } from '@polkadot/react-hooks/types';
|
||||
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { AddressMini, Button, InputAddress, Modal, Static, TxButton } from '@polkadot/react-components';
|
||||
import { useToggle } from '@polkadot/react-hooks';
|
||||
|
||||
import { useTranslation } from '../translate';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
ownNominators?: StakerState[];
|
||||
targets: string[];
|
||||
}
|
||||
|
||||
function Nominate ({ ownNominators, targets }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const [ids, setIds] = useState<{ controllerId?: string | null; stashId: string } | null>(null);
|
||||
const [filter, setFilter] = useState<string[]>([]);
|
||||
const [isOpen, toggleOpen] = useToggle();
|
||||
|
||||
useEffect((): void => {
|
||||
ownNominators && setFilter(
|
||||
ownNominators.map(({ stashId }) => stashId)
|
||||
);
|
||||
}, [ownNominators]);
|
||||
|
||||
const _onChangeStash = useCallback(
|
||||
(accountId?: string | null): void => {
|
||||
const acc = ownNominators?.find(({ stashId }) => stashId === accountId);
|
||||
|
||||
setIds(
|
||||
acc
|
||||
? { controllerId: acc.controllerId, stashId: acc.stashId }
|
||||
: null
|
||||
);
|
||||
},
|
||||
[ownNominators]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
icon='hand paper outline'
|
||||
isDisabled={!filter.length || !targets.length}
|
||||
label={t('Nominate selected')}
|
||||
onClick={toggleOpen}
|
||||
/>
|
||||
{isOpen && (
|
||||
<Modal header={t('Nominate validators')}>
|
||||
<Modal.Content>
|
||||
<Static
|
||||
label={t('selected validators')}
|
||||
value={
|
||||
targets.map((validatorId) => (
|
||||
<AddressMini
|
||||
key={validatorId}
|
||||
value={validatorId}
|
||||
/>
|
||||
))
|
||||
}
|
||||
/>
|
||||
<InputAddress
|
||||
filter={filter}
|
||||
help={t('Your stash account. The transaction will be sent from the associated controller.')}
|
||||
label={t('the stash account to nominate with')}
|
||||
onChange={_onChangeStash}
|
||||
value={ids?.stashId}
|
||||
/>
|
||||
<InputAddress
|
||||
isDisabled
|
||||
label={t('the associated controller')}
|
||||
onChange={_onChangeStash}
|
||||
value={ids?.controllerId}
|
||||
/>
|
||||
</Modal.Content>
|
||||
<Modal.Actions onCancel={toggleOpen}>
|
||||
<TxButton
|
||||
accountId={ids?.controllerId}
|
||||
label={t('Nominate')}
|
||||
onStart={toggleOpen}
|
||||
params={[targets]}
|
||||
tx='staking.nominate'
|
||||
/>
|
||||
</Modal.Actions>
|
||||
</Modal>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(Nominate);
|
||||
@ -5,18 +5,21 @@
|
||||
import { ValidatorInfo } from './types';
|
||||
|
||||
import React, { useCallback } from 'react';
|
||||
import { AddressSmall, Icon } from '@polkadot/react-components';
|
||||
import { AddressSmall, Icon, Toggle } from '@polkadot/react-components';
|
||||
import { FormatBalance } from '@polkadot/react-query';
|
||||
import { formatNumber } from '@polkadot/util';
|
||||
|
||||
import Favorite from '../Overview/Address/Favorite';
|
||||
|
||||
interface Props {
|
||||
canSelect: boolean;
|
||||
info: ValidatorInfo;
|
||||
isSelected: boolean;
|
||||
toggleFavorite: (accountId: string) => void;
|
||||
toggleSelected: (accountId: string) => void;
|
||||
}
|
||||
|
||||
function Validator ({ info: { accountId, bondOther, bondOwn, bondTotal, commissionPer, isCommission, isFavorite, isNominating, key, numNominators, rankOverall, rewardPayout, validatorPayment }, toggleFavorite }: Props): React.ReactElement<Props> {
|
||||
function Validator ({ canSelect, info: { accountId, bondOther, bondOwn, bondTotal, commissionPer, isCommission, isFavorite, isNominating, key, numNominators, rankOverall, rewardPayout, validatorPayment }, isSelected, toggleFavorite, toggleSelected }: Props): React.ReactElement<Props> {
|
||||
const _onQueryStats = useCallback(
|
||||
(): void => {
|
||||
window.location.hash = `/staking/query/${key}`;
|
||||
@ -24,6 +27,11 @@ function Validator ({ info: { accountId, bondOther, bondOwn, bondTotal, commissi
|
||||
[key]
|
||||
);
|
||||
|
||||
const _toggleSelected = useCallback(
|
||||
() => toggleSelected(key),
|
||||
[key, toggleSelected]
|
||||
);
|
||||
|
||||
return (
|
||||
<tr className={`${isNominating && 'isHighlight'}`}>
|
||||
<Favorite
|
||||
@ -51,6 +59,15 @@ function Validator ({ info: { accountId, bondOther, bondOwn, bondTotal, commissi
|
||||
/>
|
||||
</td>
|
||||
<td className='number together'><FormatBalance value={rewardPayout} /></td>
|
||||
<td>
|
||||
{(canSelect || isSelected) && (
|
||||
<Toggle
|
||||
asSwitch={false}
|
||||
onChange={_toggleSelected}
|
||||
value={isSelected}
|
||||
/>
|
||||
)}
|
||||
</td>
|
||||
<td>
|
||||
<Icon
|
||||
className='staking--stats'
|
||||
|
||||
@ -4,23 +4,27 @@
|
||||
|
||||
import { DeriveStakingElected, DeriveSessionIndexes } from '@polkadot/api-derive/types';
|
||||
import { Balance, ValidatorPrefs, ValidatorPrefsTo196 } from '@polkadot/types/interfaces';
|
||||
import { StakerState } from '@polkadot/react-hooks/types';
|
||||
import { ValidatorInfo } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { registry } from '@polkadot/react-api';
|
||||
import { Icon, InputBalance, Table } from '@polkadot/react-components';
|
||||
import { Icon, InputBalance, Table, Button } from '@polkadot/react-components';
|
||||
import { useAccounts, useApi, useCall, useDebounce, useFavorites } from '@polkadot/react-hooks';
|
||||
import { createType, Option } from '@polkadot/types';
|
||||
|
||||
import { STORE_FAVS_BASE } from '../constants';
|
||||
import { useTranslation } from '../translate';
|
||||
import Nominate from './Nominate';
|
||||
import Summary from './Summary';
|
||||
import Validator from './Validator';
|
||||
import useOwnNominators from './useOwnNominators';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
ownStashes?: StakerState[];
|
||||
}
|
||||
|
||||
interface AllInfo {
|
||||
@ -32,6 +36,7 @@ interface AllInfo {
|
||||
|
||||
type SortBy = 'rankOverall' | 'rankBondOwn' | 'rankBondOther' | 'rankBondTotal' | 'rankComm';
|
||||
|
||||
const MAX_NOMINATIONS = 16;
|
||||
const PERBILL = new BN(1_000_000_000);
|
||||
|
||||
function sortValidators (list: ValidatorInfo[]): ValidatorInfo[] {
|
||||
@ -88,7 +93,11 @@ function sortValidators (list: ValidatorInfo[]): ValidatorInfo[] {
|
||||
info.rankOverall = index + 1;
|
||||
|
||||
return info;
|
||||
});
|
||||
})
|
||||
.sort((a, b): number => a.isFavorite === b.isFavorite
|
||||
? 0
|
||||
: (a.isFavorite ? -1 : 1)
|
||||
);
|
||||
}
|
||||
|
||||
function extractInfo (allAccounts: string[], amount: BN = new BN(0), electedInfo: DeriveStakingElected, favorites: string[], lastReward = new BN(1)): AllInfo {
|
||||
@ -157,7 +166,7 @@ function extractInfo (allAccounts: string[], amount: BN = new BN(0), electedInfo
|
||||
}
|
||||
|
||||
function sort (sortBy: SortBy, sortFromMax: boolean, validators: ValidatorInfo[]): ValidatorInfo[] {
|
||||
return validators
|
||||
return [...validators]
|
||||
.sort((a, b): number => sortFromMax
|
||||
? a[sortBy] - b[sortBy]
|
||||
: b[sortBy] - a[sortBy]
|
||||
@ -168,12 +177,12 @@ function sort (sortBy: SortBy, sortFromMax: boolean, validators: ValidatorInfo[]
|
||||
);
|
||||
}
|
||||
|
||||
function Targets ({ className }: Props): React.ReactElement<Props> {
|
||||
function Targets ({ className, ownStashes }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
const { allAccounts } = useAccounts();
|
||||
const ownNominators = useOwnNominators(ownStashes);
|
||||
const lastEra = useCall<BN>(api.derive.session.indexes, [], {
|
||||
defaultValue: new BN(0),
|
||||
transform: ({ activeEra }: DeriveSessionIndexes) => activeEra.gtn(0) ? activeEra.subn(1) : new BN(0)
|
||||
}) || new BN(0);
|
||||
const lastReward = useCall<BN>(api.query.staking.erasValidatorReward, [lastEra], {
|
||||
@ -182,6 +191,7 @@ function Targets ({ className }: Props): React.ReactElement<Props> {
|
||||
const [_amount, setAmount] = useState<BN | undefined>(new BN(1_000));
|
||||
const electedInfo = useCall<DeriveStakingElected>(api.derive.staking.electedInfo, []);
|
||||
const [favorites, toggleFavorite] = useFavorites(STORE_FAVS_BASE);
|
||||
const [selected, setSelected] = useState<string[]>([]);
|
||||
const [{ nominators, sorted, totalStaked, validators }, setWorkable] = useState<AllInfo>({ nominators: [], validators: [] });
|
||||
const [{ sortBy, sortFromMax }, setSortBy] = useState<{ sortBy: SortBy; sortFromMax: boolean }>({ sortBy: 'rankOverall', sortFromMax: true });
|
||||
const amount = useDebounce(_amount);
|
||||
@ -201,6 +211,24 @@ function Targets ({ className }: Props): React.ReactElement<Props> {
|
||||
[]
|
||||
);
|
||||
|
||||
const _toggleSelected = useCallback(
|
||||
(address: string) => setSelected(
|
||||
selected.includes(address)
|
||||
? selected.filter((accountId): boolean => address !== accountId)
|
||||
: [...selected, address]
|
||||
),
|
||||
[selected]
|
||||
);
|
||||
|
||||
const _selectProfitable = useCallback(
|
||||
(): void => setSelected(
|
||||
validators
|
||||
.filter((_, index) => index < MAX_NOMINATIONS)
|
||||
.map(({ key }) => key)
|
||||
),
|
||||
[validators]
|
||||
);
|
||||
|
||||
useEffect((): void => {
|
||||
if (electedInfo) {
|
||||
const { nominators, totalStaked, validators } = extractInfo(allAccounts, amount, electedInfo, favorites, lastReward);
|
||||
@ -224,7 +252,7 @@ function Targets ({ className }: Props): React.ReactElement<Props> {
|
||||
const filter = useMemo(() => (
|
||||
<InputBalance
|
||||
className='balanceInput'
|
||||
help={t('The amount that will be used on a per-validator basis to calculate rewards for that validator.')}
|
||||
help={t('The amount that will be used on a per-validator basis to calculate profits for that validator.')}
|
||||
isFull
|
||||
label={t('amount to use for estimation')}
|
||||
onChange={setAmount}
|
||||
@ -240,16 +268,32 @@ function Targets ({ className }: Props): React.ReactElement<Props> {
|
||||
numValidators={validators.length}
|
||||
totalStaked={totalStaked}
|
||||
/>
|
||||
<Button.Group>
|
||||
<Button
|
||||
icon='check'
|
||||
isDisabled={!validators.length || !ownNominators?.length}
|
||||
label={t('Select best')}
|
||||
onClick={_selectProfitable}
|
||||
/>
|
||||
<Button.Or />
|
||||
<Nominate
|
||||
ownNominators={ownNominators}
|
||||
targets={selected}
|
||||
/>
|
||||
</Button.Group>
|
||||
<Table
|
||||
empty={sorted && t('No active validators to check for rewards available')}
|
||||
empty={sorted && t('No active validators to check')}
|
||||
filter={filter}
|
||||
header={header}
|
||||
>
|
||||
{sorted?.map((info): React.ReactNode =>
|
||||
<Validator
|
||||
canSelect={selected.length < MAX_NOMINATIONS}
|
||||
info={info}
|
||||
isSelected={selected.includes(info.key)}
|
||||
key={info.key}
|
||||
toggleFavorite={toggleFavorite}
|
||||
toggleSelected={_toggleSelected}
|
||||
/>
|
||||
)}
|
||||
</Table>
|
||||
@ -259,7 +303,7 @@ function Targets ({ className }: Props): React.ReactElement<Props> {
|
||||
|
||||
export default React.memo(styled(Targets)`
|
||||
text-align: center;
|
||||
|
||||
|
||||
th {
|
||||
i.icon {
|
||||
margin-left: 0.5rem;
|
||||
|
||||
19
packages/page-staking/src/Targets/useOwnNominators.ts
Normal file
19
packages/page-staking/src/Targets/useOwnNominators.ts
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2017-2020 @polkadot/app-staking authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { StakerState } from '@polkadot/react-hooks/types';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export default function useOwnNominators (ownStashes?: StakerState[]): StakerState[] | undefined {
|
||||
const [state, setState] = useState<StakerState[] | undefined>();
|
||||
|
||||
useEffect((): void => {
|
||||
ownStashes && setState(
|
||||
ownStashes.filter(({ isOwnController, isStashValidating }) => isOwnController && !isStashValidating)
|
||||
);
|
||||
}, [ownStashes]);
|
||||
|
||||
return state;
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
import { DeriveStakingOverview } from '@polkadot/api-derive/types';
|
||||
import { AppProps as Props } from '@polkadot/react-components/types';
|
||||
import { AccountId, ElectionStatus } from '@polkadot/types/interfaces';
|
||||
import { ElectionStatus } from '@polkadot/types/interfaces';
|
||||
|
||||
import React, { useEffect, useMemo, useReducer, useState } from 'react';
|
||||
import { Route, Switch } from 'react-router';
|
||||
@ -12,7 +12,7 @@ import { useLocation } from 'react-router-dom';
|
||||
import styled from 'styled-components';
|
||||
import { HelpOverlay } from '@polkadot/react-components';
|
||||
import Tabs from '@polkadot/react-components/Tabs';
|
||||
import { useAccounts, useApi, useCall } from '@polkadot/react-hooks';
|
||||
import { useAccounts, useApi, useCall, useOwnStashInfos, useStashIds } from '@polkadot/react-hooks';
|
||||
|
||||
import basicMd from './md/basic.md';
|
||||
import Actions from './Actions';
|
||||
@ -38,10 +38,8 @@ function StakingApp ({ basePath, className }: Props): React.ReactElement<Props>
|
||||
const { hasAccounts } = useAccounts();
|
||||
const { pathname } = useLocation();
|
||||
const [{ next, validators }, setValidators] = useState<Validators>({});
|
||||
const allStashes = useCall<string[]>(api.derive.staking.stashes, [], {
|
||||
transform: (stashes: AccountId[]): string[] =>
|
||||
stashes.map((accountId): string => accountId.toString())
|
||||
});
|
||||
const allStashes = useStashIds();
|
||||
const ownStashes = useOwnStashInfos();
|
||||
const stakingOverview = useCall<DeriveStakingOverview>(api.derive.staking.overview, []);
|
||||
const isInElection = useCall<boolean>(api.query.staking?.eraElectionStatus, [], {
|
||||
transform: (status: ElectionStatus) => status.isOpen
|
||||
@ -69,8 +67,8 @@ function StakingApp ({ basePath, className }: Props): React.ReactElement<Props>
|
||||
}
|
||||
: null,
|
||||
{
|
||||
name: 'calculator',
|
||||
text: t('Calculator')
|
||||
name: 'targets',
|
||||
text: t('Targets')
|
||||
},
|
||||
{
|
||||
name: 'waiting',
|
||||
@ -116,15 +114,15 @@ function StakingApp ({ basePath, className }: Props): React.ReactElement<Props>
|
||||
stakingOverview={stakingOverview}
|
||||
/>
|
||||
<Switch>
|
||||
<Route path={`${basePath}/calculator`}>
|
||||
<Targets />
|
||||
</Route>
|
||||
<Route path={`${basePath}/payout`}>
|
||||
<Payouts isInElection={isInElection} />
|
||||
</Route>
|
||||
<Route path={[`${basePath}/query/:value`, `${basePath}/query`]}>
|
||||
<Query />
|
||||
</Route>
|
||||
<Route path={`${basePath}/targets`}>
|
||||
<Targets ownStashes={ownStashes} />
|
||||
</Route>
|
||||
<Route path={`${basePath}/waiting`}>
|
||||
<Overview
|
||||
className={`${basePath}/waiting` === pathname ? '' : 'staking--hidden'}
|
||||
@ -136,10 +134,10 @@ function StakingApp ({ basePath, className }: Props): React.ReactElement<Props>
|
||||
</Route>
|
||||
</Switch>
|
||||
<Actions
|
||||
allStashes={allStashes}
|
||||
className={pathname === `${basePath}/actions` ? '' : 'staking--hidden'}
|
||||
isInElection={isInElection}
|
||||
next={next}
|
||||
ownStashes={ownStashes}
|
||||
validators={validators}
|
||||
/>
|
||||
<Overview
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.2",
|
||||
"@polkadot/api": "^1.12.0-beta.9",
|
||||
"@polkadot/api": "^1.12.0-beta.11",
|
||||
"@polkadot/extension-dapp": "^0.25.0-beta.3",
|
||||
"rxjs-compat": "^6.5.5"
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.9.2",
|
||||
"@polkadot/keyring": "^2.9.0-beta.1",
|
||||
"@polkadot/keyring": "^2.9.0-beta.3",
|
||||
"@polkadot/react-api": "0.42.0-beta.39",
|
||||
"@polkadot/react-identicon": "^0.53.0-beta.1",
|
||||
"@polkadot/react-query": "0.42.0-beta.39",
|
||||
|
||||
@ -103,11 +103,11 @@ export default React.memo(styled(Expander)`
|
||||
|
||||
.ui--Expander-summary {
|
||||
margin: 0;
|
||||
min-width: 13.5rem;
|
||||
min-width: 12.5rem;
|
||||
overflow: hidden;
|
||||
|
||||
.ui--Expander-summary-header > .ui--FormatBalance {
|
||||
min-width: 11rem;
|
||||
min-width: 10rem;
|
||||
}
|
||||
|
||||
> div {
|
||||
|
||||
@ -145,19 +145,15 @@ class InputAddress extends React.PureComponent<Props, State> {
|
||||
const actualValue = transformToAddress(
|
||||
isDisabled || (defaultValue && this.hasValue(defaultValue))
|
||||
? defaultValue
|
||||
: (
|
||||
this.hasValue(lastValue)
|
||||
? lastValue
|
||||
: (lastOption && lastOption.value)
|
||||
)
|
||||
: this.hasValue(lastValue)
|
||||
? lastValue
|
||||
: (lastOption && lastOption.value)
|
||||
);
|
||||
const actualOptions: Option[] = options
|
||||
? options.map((o): Option => createItem(o))
|
||||
: (
|
||||
isDisabled && actualValue
|
||||
? [createOption(actualValue)]
|
||||
: this.getFiltered()
|
||||
);
|
||||
: isDisabled && actualValue
|
||||
? [createOption(actualValue)]
|
||||
: this.getFiltered();
|
||||
const _defaultValue = (isMultiple || !isUndefined(value))
|
||||
? undefined
|
||||
: actualValue;
|
||||
|
||||
@ -75,6 +75,10 @@ export default React.memo(styled(Body)`
|
||||
padding: 0.85rem 1rem;
|
||||
}
|
||||
|
||||
&.badge {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&.button {
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
|
||||
@ -32,7 +32,7 @@ function Toggle ({ asSwitch = true, className, defaultValue, isDisabled, label,
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
<div className={`ui--Toggle ${asSwitch ? 'isToggle' : 'isCheckbox'} ${className}`}>
|
||||
<label>{label}</label>
|
||||
<SUICheckbox
|
||||
checked={value}
|
||||
@ -59,4 +59,8 @@ export default React.memo(styled(Toggle)`
|
||||
.ui.checkbox + label {
|
||||
color: rgba(78, 78, 78, 0.75);
|
||||
}
|
||||
|
||||
&.isCheckbox label {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
`);
|
||||
|
||||
@ -18,7 +18,9 @@ export { default as useMembers } from './useMembers';
|
||||
export { default as useModal } from './useModal';
|
||||
export { default as useOwnEraRewards } from './useOwnEraRewards';
|
||||
export { default as useOwnStashes, useOwnStashIds } from './useOwnStashes';
|
||||
export { default as useOwnStashInfos } from './useOwnStashInfos';
|
||||
export { default as usePassword } from './usePassword';
|
||||
export { default as useRegistrars } from './useRegistrars';
|
||||
export { default as useStashIds } from './useStashIds';
|
||||
export { default as useSudo } from './useSudo';
|
||||
export { default as useToggle } from './useToggle';
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
import { DeriveAccountFlags, DeriveAccountRegistration } from '@polkadot/api-derive/types';
|
||||
import { ConstructTxFn, StringOrNull, VoidFn } from '@polkadot/react-components/types';
|
||||
import { AccountId, Balance, BlockNumber, Call, Hash, SessionIndex } from '@polkadot/types/interfaces';
|
||||
import { AccountId, Balance, BlockNumber, Call, Exposure, Hash, SessionIndex, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces';
|
||||
import { IExtrinsic } from '@polkadot/types/types';
|
||||
import { SubmittableExtrinsic } from '@polkadot/api/promise/types';
|
||||
|
||||
@ -112,3 +112,22 @@ export interface UseAccountInfo {
|
||||
onSetGenesisHash: (genesisHash: string | null) => void;
|
||||
onForgetAddress: VoidFn;
|
||||
}
|
||||
|
||||
export interface StakerState {
|
||||
controllerId: string | null;
|
||||
destination?: string;
|
||||
destinationId: number;
|
||||
exposure?: Exposure;
|
||||
hexSessionIdNext: string | null;
|
||||
hexSessionIdQueue: string | null;
|
||||
isLoading: boolean;
|
||||
isOwnController: boolean;
|
||||
isOwnStash: boolean;
|
||||
isStashNominating: boolean;
|
||||
isStashValidating: boolean;
|
||||
nominating?: string[];
|
||||
sessionIds: string[];
|
||||
stakingLedger?: StakingLedger;
|
||||
stashId: string;
|
||||
validatorPrefs?: ValidatorPrefs;
|
||||
}
|
||||
|
||||
109
packages/react-hooks/src/useOwnStashInfos.ts
Normal file
109
packages/react-hooks/src/useOwnStashInfos.ts
Normal file
@ -0,0 +1,109 @@
|
||||
// Copyright 2017-2020 @polkadot/react-hooks authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { DeriveStakingAccount } from '@polkadot/api-derive/types';
|
||||
import { AccountId, ValidatorPrefs } from '@polkadot/types/interfaces';
|
||||
import { Codec, ITuple } from '@polkadot/types/types';
|
||||
import { StakerState } from './types';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import { u8aConcat, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import useAccounts from './useAccounts';
|
||||
import useApi from './useApi';
|
||||
import useIsMountedRef from './useIsMountedRef';
|
||||
import useOwnStashes from './useOwnStashes';
|
||||
import useStashIds from './useStashIds';
|
||||
|
||||
type ValidatorInfo = ITuple<[ValidatorPrefs, Codec]> | ValidatorPrefs;
|
||||
type Queried = Record<string, [boolean, DeriveStakingAccount, ValidatorInfo]>;
|
||||
|
||||
function toIdString (id?: AccountId | null): string | null {
|
||||
return id
|
||||
? id.toString()
|
||||
: null;
|
||||
}
|
||||
|
||||
function getStakerState (stashId: string, allAccounts: string[], allStashes: string[] | undefined, [isOwnStash, { controllerId: _controllerId, exposure, nextSessionIds, nominators, rewardDestination, sessionIds, stakingLedger, validatorPrefs }, validateInfo]: [boolean, DeriveStakingAccount, ValidatorInfo]): StakerState {
|
||||
const isStashNominating = !!(nominators?.length);
|
||||
const isStashValidating = !(Array.isArray(validateInfo) ? validateInfo[1].isEmpty : validateInfo.isEmpty) || !!allStashes?.includes(stashId);
|
||||
const nextConcat = u8aConcat(...nextSessionIds.map((id): Uint8Array => id.toU8a()));
|
||||
const currConcat = u8aConcat(...sessionIds.map((id): Uint8Array => id.toU8a()));
|
||||
const controllerId = toIdString(_controllerId);
|
||||
|
||||
return {
|
||||
controllerId,
|
||||
destination: rewardDestination?.toString().toLowerCase(),
|
||||
destinationId: rewardDestination?.toNumber() || 0,
|
||||
exposure,
|
||||
hexSessionIdNext: u8aToHex(nextConcat, 48),
|
||||
hexSessionIdQueue: u8aToHex(currConcat.length ? currConcat : nextConcat, 48),
|
||||
isLoading: false,
|
||||
isOwnController: allAccounts.includes(controllerId || ''),
|
||||
isOwnStash,
|
||||
isStashNominating,
|
||||
isStashValidating,
|
||||
// we assume that all ids are non-null
|
||||
nominating: nominators?.map(toIdString) as string[],
|
||||
sessionIds: (
|
||||
nextSessionIds.length
|
||||
? nextSessionIds
|
||||
: sessionIds
|
||||
).map(toIdString) as string[],
|
||||
stakingLedger,
|
||||
stashId,
|
||||
validatorPrefs
|
||||
};
|
||||
}
|
||||
|
||||
export default function useOwnStashInfos (): StakerState[] | undefined {
|
||||
const { api } = useApi();
|
||||
const { allAccounts } = useAccounts();
|
||||
const mountedRef = useIsMountedRef();
|
||||
const ownStashes = useOwnStashes();
|
||||
const allStashes = useStashIds();
|
||||
const [queried, setQueried] = useState<Queried | undefined>();
|
||||
const [state, setState] = useState<StakerState[] | undefined>();
|
||||
|
||||
useEffect((): () => void => {
|
||||
let unsub: (() => void) | undefined;
|
||||
|
||||
if (ownStashes) {
|
||||
if (ownStashes.length) {
|
||||
const stashIds = ownStashes.map(([stashId]) => stashId);
|
||||
const fns: any[] = [
|
||||
[api.derive.staking.accounts as any, stashIds],
|
||||
[api.query.staking.validators.multi as any, stashIds]
|
||||
];
|
||||
|
||||
api.combineLatest<[DeriveStakingAccount[], ValidatorInfo[]]>(fns, ([accounts, validators]): void => {
|
||||
mountedRef.current && ownStashes.length === accounts.length && ownStashes.length === validators.length && setQueried(
|
||||
ownStashes.reduce((queried: Queried, [stashId, isOwnStash], index): Queried => ({
|
||||
...queried,
|
||||
[stashId]: [isOwnStash, accounts[index], validators[index]]
|
||||
}), {})
|
||||
);
|
||||
}).then((_unsub): void => {
|
||||
unsub = _unsub;
|
||||
});
|
||||
} else {
|
||||
mountedRef.current && setQueried({});
|
||||
}
|
||||
}
|
||||
|
||||
return (): void => {
|
||||
unsub && unsub();
|
||||
};
|
||||
}, [api, mountedRef, ownStashes]);
|
||||
|
||||
useEffect((): void => {
|
||||
allAccounts && allStashes && ownStashes && queried && ownStashes.length === Object.keys(queried).length && setState(
|
||||
ownStashes
|
||||
.filter(([stashId]) => queried[stashId])
|
||||
.map(([stashId]) => getStakerState(stashId, allAccounts, allStashes, queried[stashId]))
|
||||
);
|
||||
}, [allAccounts, allStashes, ownStashes, queried]);
|
||||
|
||||
return state;
|
||||
}
|
||||
@ -25,7 +25,7 @@ function getStashes (allAccounts: string[], ownBonded: Option<AccountId>[], ownL
|
||||
if (ledger.isSome) {
|
||||
const stashId = ledger.unwrap().stash.toString();
|
||||
|
||||
!result.some(([accountId]): boolean => accountId === stashId) && result.push([stashId, false]);
|
||||
!result.some(([accountId]) => accountId === stashId) && result.push([stashId, false]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
17
packages/react-hooks/src/useStashIds.ts
Normal file
17
packages/react-hooks/src/useStashIds.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2017-2020 @polkadot/react-hooks authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId } from '@polkadot/types/interfaces';
|
||||
|
||||
import useApi from './useApi';
|
||||
import useCall from './useCall';
|
||||
|
||||
export default function useStashIds (): string[] | undefined {
|
||||
const { api } = useApi();
|
||||
const allStashes = useCall<string[]>(api.derive.staking.stashes, [], {
|
||||
transform: (stashes: AccountId[]) => stashes.map((accountId) => accountId.toString())
|
||||
});
|
||||
|
||||
return allStashes;
|
||||
}
|
||||
144
yarn.lock
144
yarn.lock
@ -2837,57 +2837,57 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/api-contract@npm:^1.12.0-beta.9":
|
||||
version: 1.12.0-beta.9
|
||||
resolution: "@polkadot/api-contract@npm:1.12.0-beta.9"
|
||||
"@polkadot/api-contract@npm:^1.12.0-beta.11":
|
||||
version: 1.12.0-beta.11
|
||||
resolution: "@polkadot/api-contract@npm:1.12.0-beta.11"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/api": 1.12.0-beta.9
|
||||
"@polkadot/rpc-core": 1.12.0-beta.9
|
||||
"@polkadot/types": 1.12.0-beta.9
|
||||
"@polkadot/api": 1.12.0-beta.11
|
||||
"@polkadot/rpc-core": 1.12.0-beta.11
|
||||
"@polkadot/types": 1.12.0-beta.11
|
||||
"@polkadot/util": ^2.9.0-beta.1
|
||||
bn.js: ^5.1.1
|
||||
rxjs: ^6.5.5
|
||||
checksum: 2/a18128414dae5e962cc71be75b302b96d64dafc0bf3809056e19d0573cb7a7a0e83b6e1fb48f922418054568ebadf2022d6f4ee6e7e77c05fb771bbfb106709b
|
||||
checksum: 2/1f7d964033971778c276e45afd898049d2a5e022deffced8967d819e05b21dfbdbedec2120420d744972c0e8c4e3b53e918f2a662bf5cae729be38b088794c18
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/api-derive@npm:1.12.0-beta.9":
|
||||
version: 1.12.0-beta.9
|
||||
resolution: "@polkadot/api-derive@npm:1.12.0-beta.9"
|
||||
"@polkadot/api-derive@npm:1.12.0-beta.11":
|
||||
version: 1.12.0-beta.11
|
||||
resolution: "@polkadot/api-derive@npm:1.12.0-beta.11"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/api": 1.12.0-beta.9
|
||||
"@polkadot/rpc-core": 1.12.0-beta.9
|
||||
"@polkadot/rpc-provider": 1.12.0-beta.9
|
||||
"@polkadot/types": 1.12.0-beta.9
|
||||
"@polkadot/api": 1.12.0-beta.11
|
||||
"@polkadot/rpc-core": 1.12.0-beta.11
|
||||
"@polkadot/rpc-provider": 1.12.0-beta.11
|
||||
"@polkadot/types": 1.12.0-beta.11
|
||||
"@polkadot/util": ^2.9.0-beta.1
|
||||
"@polkadot/util-crypto": ^2.9.0-beta.1
|
||||
bn.js: ^5.1.1
|
||||
memoizee: ^0.4.14
|
||||
rxjs: ^6.5.5
|
||||
checksum: 2/bb0e4ed3bfd2c78affa3bcf4b180cfac338673bbb8309980b9f6554c01b745917907a4086c166400704d9ae0ef1f923f6af26ce1861c67c8b3132d089d91c40c
|
||||
checksum: 2/83b431b7d1a806710de97fea63b285a46ff8fd8bc59d6e8066b8f1064400b92a208fdd634303a9f314ffdd9a14b48fa493eb891844d5908d041b1949ca535774
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/api@npm:^1.12.0-beta.9":
|
||||
version: 1.12.0-beta.9
|
||||
resolution: "@polkadot/api@npm:1.12.0-beta.9"
|
||||
"@polkadot/api@npm:^1.12.0-beta.11":
|
||||
version: 1.12.0-beta.11
|
||||
resolution: "@polkadot/api@npm:1.12.0-beta.11"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/api-derive": 1.12.0-beta.9
|
||||
"@polkadot/api-derive": 1.12.0-beta.11
|
||||
"@polkadot/keyring": ^2.9.0-beta.1
|
||||
"@polkadot/metadata": 1.12.0-beta.9
|
||||
"@polkadot/rpc-core": 1.12.0-beta.9
|
||||
"@polkadot/rpc-provider": 1.12.0-beta.9
|
||||
"@polkadot/types": 1.12.0-beta.9
|
||||
"@polkadot/types-known": 1.12.0-beta.9
|
||||
"@polkadot/metadata": 1.12.0-beta.11
|
||||
"@polkadot/rpc-core": 1.12.0-beta.11
|
||||
"@polkadot/rpc-provider": 1.12.0-beta.11
|
||||
"@polkadot/types": 1.12.0-beta.11
|
||||
"@polkadot/types-known": 1.12.0-beta.11
|
||||
"@polkadot/util": ^2.9.0-beta.1
|
||||
"@polkadot/util-crypto": ^2.9.0-beta.1
|
||||
bn.js: ^5.1.1
|
||||
eventemitter3: ^4.0.0
|
||||
rxjs: ^6.5.5
|
||||
checksum: 2/c473b273f579d7a9bec3b27042cf77c34f0eb9698a74eea87931ea30336ef513a73e2656e38ee51f4c87f03a3de2f3d6ba13b669206f75cc8f70fca2f1472a40
|
||||
checksum: 2/b59304e26d75df39c88a2c94108d3df691c52ba09adbf64328ec5277ebda8197ff27dddffef976ccd5e829d55953f276e701b010b736e49ebd0e9d9df0c4deec
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -2928,7 +2928,7 @@ __metadata:
|
||||
resolution: "@polkadot/app-contracts@workspace:packages/page-contracts"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/api-contract": ^1.12.0-beta.9
|
||||
"@polkadot/api-contract": ^1.12.0-beta.11
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@ -3252,28 +3252,28 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/keyring@npm:^2.9.0-beta.1":
|
||||
version: 2.9.0-beta.1
|
||||
resolution: "@polkadot/keyring@npm:2.9.0-beta.1"
|
||||
"@polkadot/keyring@npm:^2.9.0-beta.3":
|
||||
version: 2.9.0-beta.3
|
||||
resolution: "@polkadot/keyring@npm:2.9.0-beta.3"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/util": 2.9.0-beta.1
|
||||
"@polkadot/util-crypto": 2.9.0-beta.1
|
||||
checksum: 2/e250a3c1a7b556d3d47f12c353dab99bceda512872b21ad22804d19c5ce2f279dcd30b506406819dae8c9eda57d90ada0ab98e7142ff75095a0d60f6d7c1b500
|
||||
"@polkadot/util": 2.9.0-beta.3
|
||||
"@polkadot/util-crypto": 2.9.0-beta.3
|
||||
checksum: 2/5b7c4baeed6a8d133c425f341b557202657e7b94a9489f50792425fda3c90104916714c256518fee79c034cad85ca7ff6131444eb7fc7947f65466dc3410f1bc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/metadata@npm:1.12.0-beta.9":
|
||||
version: 1.12.0-beta.9
|
||||
resolution: "@polkadot/metadata@npm:1.12.0-beta.9"
|
||||
"@polkadot/metadata@npm:1.12.0-beta.11":
|
||||
version: 1.12.0-beta.11
|
||||
resolution: "@polkadot/metadata@npm:1.12.0-beta.11"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/types": 1.12.0-beta.9
|
||||
"@polkadot/types-known": 1.12.0-beta.9
|
||||
"@polkadot/types": 1.12.0-beta.11
|
||||
"@polkadot/types-known": 1.12.0-beta.11
|
||||
"@polkadot/util": ^2.9.0-beta.1
|
||||
"@polkadot/util-crypto": ^2.9.0-beta.1
|
||||
bn.js: ^5.1.1
|
||||
checksum: 2/e0c38041390b9efcc287d4522188f869f30a56c0df1e269e6dfe468763e6449931641a9ecdc761f983cc3324f6b436d8042af6def25c1e7f728802f41183b20d
|
||||
checksum: 2/7176263ddb1b220cac47ebb1b8da090149d1e8c57b1461b3f38120e25d4036e0d4437bb6bc0b720791603e59d926ae7f2ecff6fb2ceb6d582d15f4249ece3c19
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -3282,7 +3282,7 @@ __metadata:
|
||||
resolution: "@polkadot/react-api@workspace:packages/react-api"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/api": ^1.12.0-beta.9
|
||||
"@polkadot/api": ^1.12.0-beta.11
|
||||
"@polkadot/extension-dapp": ^0.25.0-beta.3
|
||||
rxjs-compat: ^6.5.5
|
||||
languageName: unknown
|
||||
@ -3293,7 +3293,7 @@ __metadata:
|
||||
resolution: "@polkadot/react-components@workspace:packages/react-components"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/keyring": ^2.9.0-beta.1
|
||||
"@polkadot/keyring": ^2.9.0-beta.3
|
||||
"@polkadot/react-api": 0.42.0-beta.39
|
||||
"@polkadot/react-identicon": ^0.53.0-beta.1
|
||||
"@polkadot/react-query": 0.42.0-beta.39
|
||||
@ -3399,35 +3399,35 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@polkadot/rpc-core@npm:1.12.0-beta.9":
|
||||
version: 1.12.0-beta.9
|
||||
resolution: "@polkadot/rpc-core@npm:1.12.0-beta.9"
|
||||
"@polkadot/rpc-core@npm:1.12.0-beta.11":
|
||||
version: 1.12.0-beta.11
|
||||
resolution: "@polkadot/rpc-core@npm:1.12.0-beta.11"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/metadata": 1.12.0-beta.9
|
||||
"@polkadot/rpc-provider": 1.12.0-beta.9
|
||||
"@polkadot/types": 1.12.0-beta.9
|
||||
"@polkadot/metadata": 1.12.0-beta.11
|
||||
"@polkadot/rpc-provider": 1.12.0-beta.11
|
||||
"@polkadot/types": 1.12.0-beta.11
|
||||
"@polkadot/util": ^2.9.0-beta.1
|
||||
memoizee: ^0.4.14
|
||||
rxjs: ^6.5.5
|
||||
checksum: 2/ed045b5461615cdc8678fc5a4415d6e5ccf62b777216c57bc16545373307d1c89ecfed9b9f2ce7d79b7cd86c055aa7d9ed786243181068b722f25ee2cb4b45a3
|
||||
checksum: 2/5fdbd93bc8524746c0b399441e7ad46a0dcbab0954cf05f404fe3afdd4c978c15a399b05d46d81904fb820bbfea8d02fd67a719911273576c2d64f0db83d62eb
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/rpc-provider@npm:1.12.0-beta.9":
|
||||
version: 1.12.0-beta.9
|
||||
resolution: "@polkadot/rpc-provider@npm:1.12.0-beta.9"
|
||||
"@polkadot/rpc-provider@npm:1.12.0-beta.11":
|
||||
version: 1.12.0-beta.11
|
||||
resolution: "@polkadot/rpc-provider@npm:1.12.0-beta.11"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/metadata": 1.12.0-beta.9
|
||||
"@polkadot/types": 1.12.0-beta.9
|
||||
"@polkadot/metadata": 1.12.0-beta.11
|
||||
"@polkadot/types": 1.12.0-beta.11
|
||||
"@polkadot/util": ^2.9.0-beta.1
|
||||
"@polkadot/util-crypto": ^2.9.0-beta.1
|
||||
bn.js: ^5.1.1
|
||||
eventemitter3: ^4.0.0
|
||||
isomorphic-fetch: ^2.2.1
|
||||
websocket: ^1.0.31
|
||||
checksum: 2/19e789398e2c5b7ca62a2f9688b08f59f9a73ff519ac15d9b15740e4093088276dbc878428385d19e7f6fca374094533e0c9cfef7a8aae42025bceaf0d2165b4
|
||||
checksum: 2/ae4d2e8125c56e2cedeaa25b0d40cbcd5fec0b2e52e5fc5f5ee42613edfe4893bafc76184c9f2b257a19831f273bf5d3426b5691b4ed2b70313bc0cf569dd402
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -3440,31 +3440,31 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/types-known@npm:1.12.0-beta.9":
|
||||
version: 1.12.0-beta.9
|
||||
resolution: "@polkadot/types-known@npm:1.12.0-beta.9"
|
||||
"@polkadot/types-known@npm:1.12.0-beta.11":
|
||||
version: 1.12.0-beta.11
|
||||
resolution: "@polkadot/types-known@npm:1.12.0-beta.11"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/types": 1.12.0-beta.9
|
||||
"@polkadot/types": 1.12.0-beta.11
|
||||
"@polkadot/util": ^2.9.0-beta.1
|
||||
bn.js: ^5.1.1
|
||||
checksum: 2/f3505dd113d97f900fd6c2dd71abc08af3c1790d31901a097421912e8764e6e56d07455c5e0284818188a60be8cf8ba34f87cf8ae700d020404bec99b1787d71
|
||||
checksum: 2/1ddca8deefcdbb643e921accefcf6a67c77b48a6889d10ef8a4850e0a1fdb85500854bec0ec7a0370b2f96d16f6005db1c46bf981cfdfd9583f824167dac9950
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/types@npm:^1.12.0-beta.9":
|
||||
version: 1.12.0-beta.9
|
||||
resolution: "@polkadot/types@npm:1.12.0-beta.9"
|
||||
"@polkadot/types@npm:^1.12.0-beta.11":
|
||||
version: 1.12.0-beta.11
|
||||
resolution: "@polkadot/types@npm:1.12.0-beta.11"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/metadata": 1.12.0-beta.9
|
||||
"@polkadot/metadata": 1.12.0-beta.11
|
||||
"@polkadot/util": ^2.9.0-beta.1
|
||||
"@polkadot/util-crypto": ^2.9.0-beta.1
|
||||
"@types/bn.js": ^4.11.6
|
||||
bn.js: ^5.1.1
|
||||
memoizee: ^0.4.14
|
||||
rxjs: ^6.5.5
|
||||
checksum: 2/c1e522284ef0865feccde24c62de6655e32a05914d3dd74298b02c41c4311492e9313e02bc0c2eacdb702a29ad7ad880c1071a0b09a3ec8a78414c1e2828762e
|
||||
checksum: 2/ac3bdd1effcc57830935d8e3534331378b12d8ade4e78f6a2657f7bb12c22e9646eba143c8052a4d77c58d54727f8cf2c7f348781c9382e29dfee548f2d87945
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -3517,12 +3517,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/util-crypto@npm:^2.9.0-beta.1":
|
||||
version: 2.9.0-beta.1
|
||||
resolution: "@polkadot/util-crypto@npm:2.9.0-beta.1"
|
||||
"@polkadot/util-crypto@npm:^2.9.0-beta.3":
|
||||
version: 2.9.0-beta.3
|
||||
resolution: "@polkadot/util-crypto@npm:2.9.0-beta.3"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@polkadot/util": 2.9.0-beta.1
|
||||
"@polkadot/util": 2.9.0-beta.3
|
||||
"@polkadot/wasm-crypto": ^1.2.1
|
||||
base-x: ^3.0.8
|
||||
bip39: ^3.0.2
|
||||
@ -3534,13 +3534,13 @@ __metadata:
|
||||
pbkdf2: ^3.0.17
|
||||
tweetnacl: ^1.0.3
|
||||
xxhashjs: ^0.2.2
|
||||
checksum: 2/ec3339cce2808102cf6c645a522f08d844e1010d504e9cf3ee8f67a4fea249cd90b3d9acb7dc0c0f63bb16ecf8812a6ec1986c666c00d84a3f8a0adb0f1e7bd2
|
||||
checksum: 2/f3825919b8d8b94cf977937d3113afd1d350b47f89903959778ed4b618d7a95fac37f22d69af0c16fe95657049acf8579c3ebc907ad0bb702d4e9025d3d52a6a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/util@npm:^2.9.0-beta.1":
|
||||
version: 2.9.0-beta.1
|
||||
resolution: "@polkadot/util@npm:2.9.0-beta.1"
|
||||
"@polkadot/util@npm:^2.9.0-beta.3":
|
||||
version: 2.9.0-beta.3
|
||||
resolution: "@polkadot/util@npm:2.9.0-beta.3"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.9.2
|
||||
"@types/bn.js": ^4.11.6
|
||||
@ -3548,7 +3548,7 @@ __metadata:
|
||||
camelcase: ^5.3.1
|
||||
chalk: ^4.0.0
|
||||
ip-regex: ^4.1.0
|
||||
checksum: 2/4d2d9f16413ae2b23c49dab1681907563196db3e41c0a926e72b0aa8f689ac860a2066f16be78d1301edf7d5ef176024f6a3776d49920386fb85eb992189734f
|
||||
checksum: 2/c2231b36075654bf7e7b91a682ac647028d351f48fa651e2d54d1c424cede45612a2bd896f4b06264f7c1e165d50c44f125df5a38046a21ea53735f316209428
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user