Support electionsPhragmen (#1768)
* Support electionsPhragmen * Base voting * Allow voting
This commit is contained in:
parent
8f2a0af6b4
commit
2a874e4dd9
@ -10,10 +10,10 @@
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^0.96.0-beta.0",
|
||||
"@polkadot/api-contract": "^0.96.0-beta.0",
|
||||
"@polkadot/api": "^0.96.0-beta.2",
|
||||
"@polkadot/api-contract": "^0.96.0-beta.2",
|
||||
"@polkadot/keyring": "^1.6.1",
|
||||
"@polkadot/types": "^0.96.0-beta.0",
|
||||
"@polkadot/types": "^0.96.0-beta.2",
|
||||
"@polkadot/util": "^1.6.1",
|
||||
"@polkadot/util-crypto": "^1.6.1",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
|
||||
@ -125,7 +125,7 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type:
|
||||
const { isDevelopment } = useContext(ApiContext);
|
||||
const [{ address, deriveError, derivePath, isSeedValid, pairType, seed, seedType }, setAddress] = useState<AddressState>(generateSeed(propsSeed, '', propsSeed ? 'raw' : 'bip', propsType));
|
||||
const [isConfirmationOpen, setIsConfirmationOpen] = useState(false);
|
||||
const [{ isNameValid, name }, setName] = useState({ isNameValid: true, name: 'new account' });
|
||||
const [{ isNameValid, name }, setName] = useState({ isNameValid: false, name: '' });
|
||||
const [{ isPassValid, password }, setPassword] = useState({ isPassValid: false, password: '' });
|
||||
const isValid = !!address && !deriveError && isNameValid && isPassValid && isSeedValid;
|
||||
|
||||
@ -142,7 +142,7 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type:
|
||||
setAddress(generateSeed(null, derivePath, newSeedType, pairType));
|
||||
}
|
||||
};
|
||||
const _onChangeName = (name: string): void => setName({ isNameValid: !!name.trim(), name });
|
||||
const _onChangeName = (name: string): void => setName({ isNameValid: name.trim().length !== 0, name });
|
||||
const _toggleConfirmation = (): void => setIsConfirmationOpen(!isConfirmationOpen);
|
||||
|
||||
const _onCommit = (): void => {
|
||||
@ -203,6 +203,7 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type:
|
||||
label={t('name')}
|
||||
onChange={_onChangeName}
|
||||
onEnter={_onCommit}
|
||||
placeholder={t('new account')}
|
||||
value={name}
|
||||
/>
|
||||
<Input
|
||||
|
||||
@ -16,7 +16,7 @@ import translate from '../translate';
|
||||
interface Props extends ModalProps, I18nProps {}
|
||||
|
||||
function Create ({ onClose, onStatusChange, t }: Props): React.ReactElement<Props> {
|
||||
const [{ isNameValid, name }, setName] = useState<{ isNameValid: boolean; name: string }>({ isNameValid: true, name: 'new address' });
|
||||
const [{ isNameValid, name }, setName] = useState<{ isNameValid: boolean; name: string }>({ isNameValid: false, name: '' });
|
||||
const [{ address, isAddressExisting, isAddressValid }, setAddress] = useState<{ address: string; isAddressExisting: boolean; isAddressValid: boolean }>({ address: '', isAddressExisting: false, isAddressValid: false });
|
||||
const isValid = isAddressValid && isNameValid;
|
||||
|
||||
@ -40,7 +40,7 @@ function Create ({ onClose, onStatusChange, t }: Props): React.ReactElement<Prop
|
||||
isAddressExisting = true;
|
||||
isAddressValid = true;
|
||||
|
||||
setName({ isNameValid: !!newName, name: newName });
|
||||
setName({ isNameValid: (newName || '').trim().length !== 0, name: newName });
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@ -95,6 +95,7 @@ function Create ({ onClose, onStatusChange, t }: Props): React.ReactElement<Prop
|
||||
label={t('address')}
|
||||
onChange={_onChangeAddress}
|
||||
onEnter={_onCommit}
|
||||
placeholder={t('new address')}
|
||||
value={address}
|
||||
/>
|
||||
<Input
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@polkadot/api-contract": "^0.96.0-beta.0",
|
||||
"@polkadot/api-contract": "^0.96.0-beta.2",
|
||||
"@polkadot/react-components": "^0.37.0-beta.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,15 +2,15 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Call, Proposal } from '@polkadot/types/interfaces';
|
||||
import { ApiProps } from '@polkadot/react-api/types';
|
||||
import { Call, Proposal } from '@polkadot/types/interfaces';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React from 'react';
|
||||
import { createType } from '@polkadot/types';
|
||||
import { Button, Extrinsic, InputNumber } from '@polkadot/react-components';
|
||||
import TxModal, { TxModalState, TxModalProps } from '@polkadot/react-components/TxModal';
|
||||
import { withApi, withCalls, withMulti } from '@polkadot/react-api';
|
||||
import { withCalls, withMulti } from '@polkadot/react-api';
|
||||
|
||||
import translate from '../translate';
|
||||
|
||||
@ -136,9 +136,9 @@ class Propose extends TxModal<Props, State> {
|
||||
export default withMulti(
|
||||
Propose,
|
||||
translate,
|
||||
withApi,
|
||||
withCalls(
|
||||
['query.elections.members', {
|
||||
['query.electionsPhragmen.members', {
|
||||
fallbacks: ['query.elections.members'],
|
||||
propName: 'memberCount',
|
||||
transform: (value: any[]): number =>
|
||||
value.length
|
||||
|
||||
@ -2,24 +2,21 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { BlockNumber } from '@polkadot/types/interfaces';
|
||||
import { I18nProps } from '@polkadot/react-components/types';
|
||||
import { AccountId } from '@polkadot/types/interfaces';
|
||||
|
||||
import React from 'react';
|
||||
import { AddressCard } from '@polkadot/react-components';
|
||||
import { formatNumber } from '@polkadot/util';
|
||||
|
||||
import translate from '../translate';
|
||||
|
||||
interface Props extends I18nProps {
|
||||
address: string;
|
||||
block: BlockNumber;
|
||||
address: AccountId;
|
||||
}
|
||||
|
||||
function Member ({ address, block, t }: Props): React.ReactElement<Props> {
|
||||
function Member ({ address, t }: Props): React.ReactElement<Props> {
|
||||
return (
|
||||
<AddressCard
|
||||
buttons={<div><label>{t('active until')}</label>#{formatNumber(block)}</div>}
|
||||
defaultName={t('council member')}
|
||||
value={address}
|
||||
/>
|
||||
|
||||
@ -22,16 +22,15 @@ function Members ({ electionsInfo: { candidates, members }, t }: Props): React.R
|
||||
emptyText={t('No members found')}
|
||||
headerText={t('members')}
|
||||
>
|
||||
{Object.entries(members).map(([address, block]): React.ReactNode => (
|
||||
{members.map((address): React.ReactNode => (
|
||||
<Member
|
||||
address={address}
|
||||
block={block}
|
||||
key={address}
|
||||
key={address.toString()}
|
||||
/>
|
||||
))}
|
||||
</Column>
|
||||
<Column
|
||||
emptyText={t('No members found')}
|
||||
emptyText={t('No candidates found')}
|
||||
headerText={t('candidates')}
|
||||
>
|
||||
{candidates.map((address): React.ReactNode => (
|
||||
|
||||
@ -2,16 +2,18 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiProps } from '@polkadot/react-api/types';
|
||||
import { ComponentProps } from './types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React from 'react';
|
||||
import { withApi } from '@polkadot/react-api';
|
||||
import { Button } from '@polkadot/react-components';
|
||||
import TxModal, { TxModalState as State, TxModalProps } from '@polkadot/react-components/TxModal';
|
||||
|
||||
import translate from '../translate';
|
||||
|
||||
interface Props extends ComponentProps, TxModalProps {}
|
||||
interface Props extends ApiProps, ComponentProps, TxModalProps {}
|
||||
|
||||
class SubmitCandidacy extends TxModal<Props, State> {
|
||||
protected headerText = (): string => this.props.t('Submit your council candidacy');
|
||||
@ -20,14 +22,17 @@ class SubmitCandidacy extends TxModal<Props, State> {
|
||||
|
||||
protected accountHelp = (): string => this.props.t('This account will be nominated to fill the council slot you specify.');
|
||||
|
||||
protected txMethod = (): string => 'elections.submitCandidacy';
|
||||
protected txMethod = (): string =>
|
||||
this.props.api.tx.electionsPhragmen
|
||||
? 'electionsPhragmen.submitCandidacy'
|
||||
: 'elections.submitCandidacy';
|
||||
|
||||
protected txParams = (): [BN] => {
|
||||
const { electionsInfo: { candidateCount } } = this.props;
|
||||
protected txParams = (): [BN] | [] => {
|
||||
const { api, electionsInfo: { candidateCount } } = this.props;
|
||||
|
||||
return [
|
||||
candidateCount
|
||||
];
|
||||
return api.tx.electionsPhragmen
|
||||
? []
|
||||
: [candidateCount];
|
||||
}
|
||||
|
||||
protected isDisabled = (): boolean => {
|
||||
@ -50,4 +55,4 @@ class SubmitCandidacy extends TxModal<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate(SubmitCandidacy);
|
||||
export default translate(withApi(SubmitCandidacy));
|
||||
|
||||
@ -25,12 +25,13 @@ function Summary ({ electionsInfo: { members, candidateCount, desiredSeats, term
|
||||
{formatNumber(candidateCount)}
|
||||
</CardSummary>
|
||||
</section>
|
||||
<section>
|
||||
<CardSummary label={t('voting round')}>
|
||||
#{formatNumber(voteCount)}
|
||||
</CardSummary>
|
||||
</section>
|
||||
|
||||
{voteCount && (
|
||||
<section>
|
||||
<CardSummary label={t('voting round')}>
|
||||
#{formatNumber(voteCount)}
|
||||
</CardSummary>
|
||||
</section>
|
||||
)}
|
||||
<section>
|
||||
<CardSummary label={t('term duration')}>
|
||||
{formatNumber(termDuration)}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { VoteIndex } from '@polkadot/types/interfaces';
|
||||
import { AccountId, VoteIndex } from '@polkadot/types/interfaces';
|
||||
import { DerivedVoterPositions } from '@polkadot/api-derive/types';
|
||||
import { ApiProps } from '@polkadot/react-api/types';
|
||||
import { ComponentProps } from './types';
|
||||
@ -11,8 +11,8 @@ import BN from 'bn.js';
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { createType } from '@polkadot/types';
|
||||
import { withApi, withCalls, withMulti } from '@polkadot/react-api';
|
||||
import { AddressRow, Button, Icon, Toggle, TxButton } from '@polkadot/react-components';
|
||||
import { withCalls, withMulti } from '@polkadot/react-api';
|
||||
import { AddressRow, Button, Icon, InputBalance, Toggle, TxButton } from '@polkadot/react-components';
|
||||
import TxModal, { TxModalState, TxModalProps } from '@polkadot/react-components/TxModal';
|
||||
|
||||
import translate from '../translate';
|
||||
@ -24,6 +24,7 @@ interface Props extends ApiProps, ComponentProps, TxModalProps {
|
||||
interface State extends TxModalState {
|
||||
approvals: boolean[] | null;
|
||||
oldApprovals: boolean[] | null;
|
||||
voteValue: BN;
|
||||
// voterPositions: DerivedVoterPositions;
|
||||
}
|
||||
|
||||
@ -78,26 +79,14 @@ class Vote extends TxModal<Props, State> {
|
||||
return [...new Array(length).keys()].map((): boolean => false);
|
||||
}
|
||||
|
||||
public static getDerivedStateFromProps ({ electionsInfo: { candidateCount } }: Props, { approvals }: State): Partial<State> {
|
||||
const state: Partial<State> = {};
|
||||
// if (voterPositions) {
|
||||
// state.voters = Object.keys(voterSets).reduce(
|
||||
// (result: Record<string, VoterPosition>, accountId, globalIndex): Record<string, VoterPosition> => {
|
||||
// result[accountId] = {
|
||||
// setIndex: voterSets[accountId],
|
||||
// globalIndex: new BN(globalIndex)
|
||||
// };
|
||||
// return result;
|
||||
// },
|
||||
// {}
|
||||
// );
|
||||
// }
|
||||
|
||||
if (candidateCount && !approvals) {
|
||||
state.approvals = state.oldApprovals || Vote.emptyApprovals(candidateCount.toNumber());
|
||||
public static getDerivedStateFromProps ({ electionsInfo: { candidateCount } }: Props, { approvals }: State): Partial<State> | null {
|
||||
if (candidateCount && (!approvals || !candidateCount.eq(approvals.length))) {
|
||||
return {
|
||||
approvals: Vote.emptyApprovals(candidateCount.toNumber())
|
||||
};
|
||||
}
|
||||
|
||||
return state;
|
||||
return null;
|
||||
}
|
||||
|
||||
public constructor (props: Props) {
|
||||
@ -106,7 +95,8 @@ class Vote extends TxModal<Props, State> {
|
||||
this.defaultState = {
|
||||
...this.defaultState,
|
||||
approvals: null,
|
||||
oldApprovals: null
|
||||
oldApprovals: null,
|
||||
voteValue: new BN(0)
|
||||
};
|
||||
|
||||
this.state = {
|
||||
@ -132,25 +122,40 @@ class Vote extends TxModal<Props, State> {
|
||||
|
||||
protected accountHelp = (): string => this.props.t('This account will be use to approve or disapprove each candidate.');
|
||||
|
||||
protected txMethod = (): string => 'elections.setApprovals';
|
||||
protected txMethod = (): string =>
|
||||
this.props.api.tx.electionsPhragmen
|
||||
? 'electionsPhragmen.vote'
|
||||
: 'elections.setApprovals';
|
||||
|
||||
protected txParams = (): [boolean[] | null, VoteIndex, BN | null] => {
|
||||
const { electionsInfo: { nextVoterSet, voteCount }, voterPositions } = this.props;
|
||||
const { accountId, approvals } = this.state;
|
||||
protected txParams = (): [boolean[] | null, VoteIndex, BN | null] | [AccountId[], BN] => {
|
||||
const { api, electionsInfo: { candidates, nextVoterSet, voteCount }, voterPositions } = this.props;
|
||||
const { accountId, approvals, voteValue } = this.state;
|
||||
|
||||
if (api.tx.electionsPhragmen) {
|
||||
return [
|
||||
candidates.filter((candidate, index): boolean => !!approvals && approvals[index] === true),
|
||||
voteValue
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
approvals ? approvals.slice(0, 1 + approvals.lastIndexOf(true)) : [],
|
||||
approvals
|
||||
? approvals.slice(0, 1 + approvals.lastIndexOf(true))
|
||||
: [],
|
||||
createType('VoteIndex', voteCount),
|
||||
voterPositions && accountId && voterPositions[accountId]
|
||||
? voterPositions[accountId].setIndex
|
||||
: nextVoterSet
|
||||
: nextVoterSet || null
|
||||
];
|
||||
}
|
||||
|
||||
protected isDisabled = (): boolean => {
|
||||
const { accountId, oldApprovals } = this.state;
|
||||
const { accountId, approvals, oldApprovals } = this.state;
|
||||
|
||||
return !accountId || !!oldApprovals;
|
||||
return !accountId ||
|
||||
!!oldApprovals ||
|
||||
!approvals ||
|
||||
!approvals.some((val): boolean => val === true);
|
||||
}
|
||||
|
||||
protected renderTrigger = (): React.ReactNode => {
|
||||
@ -168,89 +173,70 @@ class Vote extends TxModal<Props, State> {
|
||||
}
|
||||
|
||||
protected renderContent = (): React.ReactNode => {
|
||||
const { electionsInfo: { candidates }, voterPositions, t } = this.props;
|
||||
const { api, electionsInfo: { candidates }, voterPositions, t } = this.props;
|
||||
const { accountId, approvals, oldApprovals } = this.state;
|
||||
|
||||
return (
|
||||
<>
|
||||
{
|
||||
(oldApprovals && accountId && voterPositions && voterPositions[accountId]) && (
|
||||
<AlreadyVoted className='warning padded'>
|
||||
<div>
|
||||
<Icon name='warning sign' />
|
||||
{t('You have already voted in this round')}
|
||||
</div>
|
||||
<Button.Group>
|
||||
<TxButton
|
||||
accountId={accountId}
|
||||
isNegative
|
||||
label={t('Retract vote')}
|
||||
icon='delete'
|
||||
onSuccess={this.onRetractVote}
|
||||
params={[voterPositions[accountId].globalIndex]}
|
||||
tx='elections.retractVoter'
|
||||
/>
|
||||
</Button.Group>
|
||||
</AlreadyVoted>
|
||||
)
|
||||
}
|
||||
{api.tx.electionsPhragmen && (
|
||||
<InputBalance
|
||||
label={t('value')}
|
||||
onChange={this.setVoteValue}
|
||||
/>
|
||||
)}
|
||||
{(oldApprovals && accountId && voterPositions && voterPositions[accountId]) && (
|
||||
<AlreadyVoted className='warning padded'>
|
||||
<div>
|
||||
<Icon name='warning sign' />
|
||||
{t('You have already voted in this round')}
|
||||
</div>
|
||||
<Button.Group>
|
||||
<TxButton
|
||||
accountId={accountId}
|
||||
isNegative
|
||||
label={t('Retract vote')}
|
||||
icon='delete'
|
||||
onSuccess={this.onRetractVote}
|
||||
params={[voterPositions[accountId].globalIndex]}
|
||||
tx='elections.retractVoter'
|
||||
/>
|
||||
</Button.Group>
|
||||
</AlreadyVoted>
|
||||
)}
|
||||
<Candidates>
|
||||
{
|
||||
candidates.map((accountId, index): React.ReactNode => {
|
||||
if (!approvals) {
|
||||
return null;
|
||||
}
|
||||
const { [index]: isAye } = approvals;
|
||||
return (
|
||||
<Candidate
|
||||
className={isAye ? 'aye' : 'nay'}
|
||||
key={accountId.toString()}
|
||||
{...(
|
||||
!oldApprovals
|
||||
? { onClick: (): void => this.onChangeVote(index)() }
|
||||
: {}
|
||||
)}
|
||||
{approvals && candidates.map((accountId, index): React.ReactNode => {
|
||||
const { [index]: isAye } = approvals;
|
||||
|
||||
return (
|
||||
<Candidate
|
||||
className={isAye ? 'aye' : 'nay'}
|
||||
key={accountId.toString()}
|
||||
>
|
||||
<AddressRow
|
||||
isInline
|
||||
value={accountId}
|
||||
>
|
||||
<AddressRow
|
||||
isInline
|
||||
value={accountId}
|
||||
>
|
||||
{this.renderToggle(index)}
|
||||
</AddressRow>
|
||||
</Candidate>
|
||||
);
|
||||
})
|
||||
}
|
||||
<Toggle
|
||||
isDisabled={!!oldApprovals}
|
||||
label={
|
||||
isAye
|
||||
? t('Aye')
|
||||
: t('Nay')
|
||||
}
|
||||
onChange={this.onChangeVote(index)}
|
||||
value={isAye}
|
||||
/>
|
||||
</AddressRow>
|
||||
</Candidate>
|
||||
);
|
||||
})}
|
||||
</Candidates>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
private renderToggle = (index: number): React.ReactNode => {
|
||||
const { t } = this.props;
|
||||
const { approvals, oldApprovals } = this.state;
|
||||
|
||||
if (!approvals) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { [index]: bool } = approvals;
|
||||
|
||||
return (
|
||||
<Toggle
|
||||
isDisabled={!!oldApprovals}
|
||||
label={
|
||||
bool
|
||||
? (
|
||||
<b>{t('Aye')}</b>
|
||||
)
|
||||
: (
|
||||
<b>{t('No vote')}</b>
|
||||
)
|
||||
}
|
||||
value={bool}
|
||||
/>
|
||||
);
|
||||
private setVoteValue = (voteValue?: BN): void => {
|
||||
this.setState({ voteValue: voteValue || new BN(0) });
|
||||
}
|
||||
|
||||
private emptyApprovals = (): boolean[] => {
|
||||
@ -263,7 +249,7 @@ class Vote extends TxModal<Props, State> {
|
||||
const { api, electionsInfo: { voteCount }, voterPositions } = this.props;
|
||||
const { accountId } = this.state;
|
||||
|
||||
if (!accountId) {
|
||||
if (!accountId || !voteCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -291,16 +277,13 @@ class Vote extends TxModal<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
private onChangeVote = (index: number): (isChecked?: boolean) => void =>
|
||||
(isChecked?: boolean): void => {
|
||||
this.setState(({ approvals }: State): Pick<State, never> => {
|
||||
if (!approvals) {
|
||||
return {};
|
||||
}
|
||||
return {
|
||||
approvals: approvals.map((b, i): boolean => i === index ? isChecked || !approvals[index] : b)
|
||||
};
|
||||
});
|
||||
private onChangeVote = (index: number): (isChecked: boolean) => void =>
|
||||
(isChecked: boolean): void => {
|
||||
this.setState(({ approvals }: State): Pick<State, never> =>
|
||||
approvals
|
||||
? { approvals: approvals.map((b, i): boolean => i === index ? isChecked : (b || false)) }
|
||||
: {}
|
||||
);
|
||||
}
|
||||
|
||||
private onRetractVote = (): void => {
|
||||
@ -314,7 +297,6 @@ class Vote extends TxModal<Props, State> {
|
||||
export default withMulti(
|
||||
Vote,
|
||||
translate,
|
||||
withApi,
|
||||
withCalls<Props>(
|
||||
['derive.elections.voterPositions', { propName: 'voterPositions' }]
|
||||
)
|
||||
|
||||
@ -16,14 +16,11 @@ import Summary from './Summary';
|
||||
import Vote from './Vote';
|
||||
|
||||
const NULL_INFO: DerivedElectionsInfo = {
|
||||
members: {},
|
||||
candidates: [],
|
||||
candidateCount: createType('u32'),
|
||||
desiredSeats: createType('u32'),
|
||||
nextVoterSet: createType('SetIndex'),
|
||||
termDuration: createType('BlockNumber'),
|
||||
voteCount: createType('VoteIndex'),
|
||||
voterCount: createType('SetIndex')
|
||||
members: [],
|
||||
termDuration: createType('BlockNumber')
|
||||
};
|
||||
|
||||
function Overview ({ electionsInfo = NULL_INFO }: Props): React.ReactElement<Props> {
|
||||
@ -41,10 +38,7 @@ function Overview ({ electionsInfo = NULL_INFO }: Props): React.ReactElement<Pro
|
||||
}
|
||||
|
||||
export default withCalls<Props>(
|
||||
[
|
||||
'derive.elections.info',
|
||||
{
|
||||
propName: 'electionsInfo'
|
||||
}
|
||||
]
|
||||
['derive.elections.info', {
|
||||
propName: 'electionsInfo'
|
||||
}]
|
||||
)(Overview);
|
||||
|
||||
@ -11,7 +11,10 @@ export default ([
|
||||
Component: Council,
|
||||
display: {
|
||||
needsApi: [
|
||||
'query.elections.candidates'
|
||||
[
|
||||
'query.electionsPhragmen.candidates',
|
||||
'query.elections.candidates'
|
||||
]
|
||||
]
|
||||
},
|
||||
i18n: {
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@polkadot/api": "^0.96.0-beta.0",
|
||||
"@polkadot/api": "^0.96.0-beta.2",
|
||||
"@polkadot/extension-dapp": "^0.14.0-beta.0",
|
||||
"edgeware-node-types": "^1.0.10",
|
||||
"rxjs-compat": "^6.5.3"
|
||||
|
||||
@ -102,7 +102,7 @@ function Vector ({ className, defaultValue, isDisabled = false, label, onChange,
|
||||
icon='add'
|
||||
/>
|
||||
<Button
|
||||
isDisabled={values.length === 1}
|
||||
isDisabled={values.length === 0}
|
||||
isNegative
|
||||
onClick={_rowRemove}
|
||||
label={t('Remove item')}
|
||||
|
||||
90
yarn.lock
90
yarn.lock
@ -1993,45 +1993,45 @@
|
||||
once "^1.4.0"
|
||||
universal-user-agent "^4.0.0"
|
||||
|
||||
"@polkadot/api-contract@^0.96.0-beta.0":
|
||||
version "0.96.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-0.96.0-beta.0.tgz#2ab095f37540d9090014ba68b222f69a114602dc"
|
||||
integrity sha512-riD6IZx3EGXd2iOXjNoiuxF45Ji1Am7nDC37cCU/tHt0XfUQMbPZSf9YsCkqPRX8p+YTsAdu1BsF0ri9Kq3Mmw==
|
||||
"@polkadot/api-contract@^0.96.0-beta.2":
|
||||
version "0.96.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-contract/-/api-contract-0.96.0-beta.2.tgz#a16e565a60b129b586bc59da10dc45e26ed4dc23"
|
||||
integrity sha512-TpVssXZwbXBq5G5pD0FLz/TquTMgKoMY/y4tmGKvRqX7U0/XFqD8pPeX7RDuAKdl7BjgiHn7pWjqvizUxQqa9g==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
"@polkadot/types" "^0.96.0-beta.0"
|
||||
"@polkadot/types" "^0.96.0-beta.2"
|
||||
|
||||
"@polkadot/api-derive@^0.96.0-beta.0":
|
||||
version "0.96.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-0.96.0-beta.0.tgz#4a14be7bf85c61a21a202994c241cb52e0ef2463"
|
||||
integrity sha512-pyc9x0ZD48uSbDbahqpGyJNdAkF22+CWB9NJ1teSF86KIrgI+7opNATUMoAL7v7bOPK/37RsTMQLhoqrn5Inxg==
|
||||
"@polkadot/api-derive@^0.96.0-beta.2":
|
||||
version "0.96.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-0.96.0-beta.2.tgz#b1669a72c45dff806af63ac3caa79ed04018a710"
|
||||
integrity sha512-0yc/2aW/mpn8XHZurwn0ZlW7uGP4Hl5U6ZhNJ/fCy9qTZ21ou1m0OoP37KKhG7eTrKP5e2PDZTA5o/V0nKCKgg==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
"@polkadot/api" "^0.96.0-beta.0"
|
||||
"@polkadot/types" "^0.96.0-beta.0"
|
||||
"@polkadot/api" "^0.96.0-beta.2"
|
||||
"@polkadot/types" "^0.96.0-beta.2"
|
||||
|
||||
"@polkadot/api-metadata@^0.96.0-beta.0":
|
||||
version "0.96.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-metadata/-/api-metadata-0.96.0-beta.0.tgz#1255cca07aaaff7d2362c88408e3b11fa8d1b007"
|
||||
integrity sha512-6tYG7slOpuatyKykzDBzPoKkjxd3xZ8S3POQtLQLqh5l3hPe61Y/jgHBu/zxyAynY30at4LbY5ZCBo/KXZQZlw==
|
||||
"@polkadot/api-metadata@^0.96.0-beta.2":
|
||||
version "0.96.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-metadata/-/api-metadata-0.96.0-beta.2.tgz#21de2506ab14c9b8c2577fd217a6e560055578c9"
|
||||
integrity sha512-o7ya1CKnDX/C9BfK8otdljLoci71Pxi1FCYo1m2ihHjiB2PZyLzgs/P6sgsg/anNSoFhy6hHfqmr/bTPTGgc5A==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
"@polkadot/types" "^0.96.0-beta.0"
|
||||
"@polkadot/types" "^0.96.0-beta.2"
|
||||
"@polkadot/util" "^1.6.1"
|
||||
"@polkadot/util-crypto" "^1.6.1"
|
||||
|
||||
"@polkadot/api@^0.96.0-beta.0":
|
||||
version "0.96.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.96.0-beta.0.tgz#06fb29979e1fd0bfc88db02a509aad00545d4a96"
|
||||
integrity sha512-gPWw5rw6hABwiRRyDz5jeaqE7h/K9zo7oYFLpcUMRC8kpYWJ9tdtz5LYqfRrMzBsxMGXWj+V2kTug7WRM06zoA==
|
||||
"@polkadot/api@^0.96.0-beta.2":
|
||||
version "0.96.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.96.0-beta.2.tgz#766c46e71211ba2efc77ca2b74c00bcab3142dc7"
|
||||
integrity sha512-M+aIsbIHQkt8O2Mb4f0fqHpUsVTlyW6lY4ARINK8ZtIHqffWs6qQXB/8PkRSoXLhwCp3GWforWm+H9p0gwsKzQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
"@polkadot/api-derive" "^0.96.0-beta.0"
|
||||
"@polkadot/api-metadata" "^0.96.0-beta.0"
|
||||
"@polkadot/api-derive" "^0.96.0-beta.2"
|
||||
"@polkadot/api-metadata" "^0.96.0-beta.2"
|
||||
"@polkadot/keyring" "^1.6.1"
|
||||
"@polkadot/rpc-core" "^0.96.0-beta.0"
|
||||
"@polkadot/rpc-provider" "^0.96.0-beta.0"
|
||||
"@polkadot/types" "^0.96.0-beta.0"
|
||||
"@polkadot/rpc-core" "^0.96.0-beta.2"
|
||||
"@polkadot/rpc-provider" "^0.96.0-beta.2"
|
||||
"@polkadot/types" "^0.96.0-beta.2"
|
||||
"@polkadot/util-crypto" "^1.6.1"
|
||||
|
||||
"@polkadot/dev-react@^0.32.0-beta.11":
|
||||
@ -2133,10 +2133,10 @@
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
|
||||
"@polkadot/jsonrpc@^0.96.0-beta.0":
|
||||
version "0.96.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.96.0-beta.0.tgz#1ba1ef5c8a061778593c9d6ca60e1f5dcad61941"
|
||||
integrity sha512-1BG3nwFzY44zIFj7Ge8fjlV6DoZlqTsoriikfbIxy9OvPqOw9dytb6WAKI4wKsoIZqdY8MWNXOC4/GGdAoLfDA==
|
||||
"@polkadot/jsonrpc@^0.96.0-beta.2":
|
||||
version "0.96.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.96.0-beta.2.tgz#8407583b678fba337505006ae17a9d9648dd863f"
|
||||
integrity sha512-8iBWemsb4geV7arUITXrk/P7SWJjmKW/Zy/ebdYxr3W/y0eq+aIWq3PHvjtDPjaPLKnKgB3g7UspCiOJyNFXww==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
|
||||
@ -2174,25 +2174,25 @@
|
||||
qrcode-generator "^1.4.4"
|
||||
react-qr-reader "^2.2.1"
|
||||
|
||||
"@polkadot/rpc-core@^0.96.0-beta.0":
|
||||
version "0.96.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-0.96.0-beta.0.tgz#6c8c0069e3a7e0f2bc2e01665da3f8970b98ec59"
|
||||
integrity sha512-BMSz2FOwqMLr6YY2HJGvyQ++cJzJOk2eB/2/E+rBXhabnVGopiGdmXWmVlbeAVfFIdbolR1dGAyPI7EnVkZsdw==
|
||||
"@polkadot/rpc-core@^0.96.0-beta.2":
|
||||
version "0.96.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-0.96.0-beta.2.tgz#168355237580c4c1950a576852805148e92e3b1f"
|
||||
integrity sha512-mKlvRFmNchA9qLlKjBP1xgHJWq6zxA8LXO4Z0ag6l8z12T9PZZ48fDkRHU/S6+rmS4CWqx74bct8RMG98XmmOw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
"@polkadot/jsonrpc" "^0.96.0-beta.0"
|
||||
"@polkadot/rpc-provider" "^0.96.0-beta.0"
|
||||
"@polkadot/types" "^0.96.0-beta.0"
|
||||
"@polkadot/jsonrpc" "^0.96.0-beta.2"
|
||||
"@polkadot/rpc-provider" "^0.96.0-beta.2"
|
||||
"@polkadot/types" "^0.96.0-beta.2"
|
||||
"@polkadot/util" "^1.6.1"
|
||||
rxjs "^6.5.3"
|
||||
|
||||
"@polkadot/rpc-provider@^0.96.0-beta.0":
|
||||
version "0.96.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-0.96.0-beta.0.tgz#fc2c35c563dfc96718b2a5d93ac5bd246baf578d"
|
||||
integrity sha512-+mUSCYFwYgkAyyuwCDtAV3gkVOhKkXUhG4PWMJaYLtRFgKmVlqyCAhqvEwYZiKi3j8dFZu6OwBsdN3I7xfSKAQ==
|
||||
"@polkadot/rpc-provider@^0.96.0-beta.2":
|
||||
version "0.96.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-0.96.0-beta.2.tgz#f672e537ffac71a88d7c8eb7de007f04bbfb8fd3"
|
||||
integrity sha512-h/Y1c6u1Z/wQaGWejngmD6Xi/T07Iq66Tfb60iwTofE1d6PvB+fXMKnOLb7Jas/Jvcf4Iae4QfHGpyXCC0b/PQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
"@polkadot/api-metadata" "^0.96.0-beta.0"
|
||||
"@polkadot/api-metadata" "^0.96.0-beta.2"
|
||||
"@polkadot/util" "^1.6.1"
|
||||
"@polkadot/util-crypto" "^1.6.1"
|
||||
"@types/nock" "^11.1.0"
|
||||
@ -2207,10 +2207,10 @@
|
||||
dependencies:
|
||||
"@types/chrome" "^0.0.91"
|
||||
|
||||
"@polkadot/types@^0.96.0-beta.0":
|
||||
version "0.96.0-beta.0"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.96.0-beta.0.tgz#6a51a0c675538ed9dec3ef796c1cbf043f6b61e0"
|
||||
integrity sha512-mYZZX7wPPEev+btyFzaJxBYO3LNN7ztPsfSEbRjeuPo163MysFTIb/Rqso6TGeD1FNfBxtLTIS90kkq1qdTcHA==
|
||||
"@polkadot/types@^0.96.0-beta.2":
|
||||
version "0.96.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.96.0-beta.2.tgz#ccf30c8e035f5042867477975fcd64e099876fdf"
|
||||
integrity sha512-jzVvUjxYrqnobP8kyJe3+AsT1DjrLIHeYf85OtHX73wqKzLdOMhxEB//E7Rnketikb0sUVva8MP+TA5GpPdU6A==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
"@polkadot/util" "^1.6.1"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user