diff --git a/package.json b/package.json index 0b5581147be3..a0f421d58141 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,10 @@ "packages/*" ], "resolutions": { - "@polkadot/api": "^0.99.0-beta.11", - "@polkadot/api-contract": "^0.99.0-beta.11", + "@polkadot/api": "^0.99.0-beta.13", + "@polkadot/api-contract": "^0.99.0-beta.13", "@polkadot/keyring": "^1.7.1", - "@polkadot/types": "^0.99.0-beta.11", + "@polkadot/types": "^0.99.0-beta.13", "@polkadot/util": "^1.7.1", "@polkadot/util-crypto": "^1.7.1", "babel-core": "^7.0.0-bridge.0", diff --git a/packages/app-accounts/src/modals/Backup.tsx b/packages/app-accounts/src/modals/Backup.tsx index 240d7ce9e93c..7366f2e84894 100644 --- a/packages/app-accounts/src/modals/Backup.tsx +++ b/packages/app-accounts/src/modals/Backup.tsx @@ -67,9 +67,9 @@ export default function ({ address, onClose }: Props): React.ReactElement return ( - {t('Backup account')} { return ( - {t('Change account password')} {this.renderContent()} {this.renderButtons()} diff --git a/packages/app-accounts/src/modals/Create.tsx b/packages/app-accounts/src/modals/Create.tsx index e59bedb72026..263d29bf9509 100644 --- a/packages/app-accounts/src/modals/Create.tsx +++ b/packages/app-accounts/src/modals/Create.tsx @@ -189,9 +189,9 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type: return ( - {t('Add an account via seed')} {address && isConfirmationOpen && ( | null { return ( - - - {t('Important notice')} - + - {t('Derive account from pair')} {address && isConfirmationOpen && ( { const { isFileValid, isPassValid } = this.state; return ( - - {t('Add via backup file')} + {this.renderInput()} diff --git a/packages/app-accounts/src/modals/Qr.tsx b/packages/app-accounts/src/modals/Qr.tsx index 69a69581ebb5..61bf73df6f21 100644 --- a/packages/app-accounts/src/modals/Qr.tsx +++ b/packages/app-accounts/src/modals/Qr.tsx @@ -49,9 +49,9 @@ function QrModal ({ className, onClose, onStatusChange, t }: Props): React.React return ( - {t('Add account via Qr')} { scanned diff --git a/packages/app-accounts/src/modals/Transfer.tsx b/packages/app-accounts/src/modals/Transfer.tsx index 46c04e3d8260..d8f32ebc514f 100644 --- a/packages/app-accounts/src/modals/Transfer.tsx +++ b/packages/app-accounts/src/modals/Transfer.tsx @@ -89,9 +89,9 @@ function Transfer ({ className, onClose, recipientId: propRecipientId, senderId: return ( - {t('Send funds')}
- {t('Add an address')} + | null { return ( - - {t('Call a contract')} - {callContract && (
diff --git a/packages/app-contracts/src/Modal.tsx b/packages/app-contracts/src/Modal.tsx index 379e311c8967..989988ca39be 100644 --- a/packages/app-contracts/src/Modal.tsx +++ b/packages/app-contracts/src/Modal.tsx @@ -54,12 +54,10 @@ class ContractModal

return ( - - {t(this.headerText)} - {this.renderContent()} diff --git a/packages/app-contracts/src/RemoveABI.tsx b/packages/app-contracts/src/RemoveABI.tsx index 42ecf9b6b7a5..3e740f7db886 100644 --- a/packages/app-contracts/src/RemoveABI.tsx +++ b/packages/app-contracts/src/RemoveABI.tsx @@ -24,12 +24,10 @@ function RemoveABI ({ code, onClose, onRemove, t }: Props): React.ReactElement

- - {t('Confirm ABI removal')} - ; voteValue: BN; - // voterPositions: DerivedVoterPositions; } // const MAX_VOTES = 16; -// const AlreadyVoted = styled.article` -// display: flex; -// align-items: center; -// margin: 0.5rem 0; - -// & > :first-child { -// flex: 1 1; -// } - -// & > :not(:first-child) { -// margin: 0; -// } -// `; - const Candidates = styled.div` display: flex; flex-wrap: wrap; @@ -121,29 +102,17 @@ class Vote extends TxModal { protected txMethod = (): string => this.props.api.tx.electionsPhragmen ? 'electionsPhragmen.vote' - : 'elections.setApprovals'; + : 'elections.vote'; protected txParams = (): [boolean[] | null, VoteIndex, BN | null] | [string[], BN] => { - const { api, electionsInfo: { candidates, nextVoterSet, voteCount }, voterPositions } = this.props; - const { accountId, votes, voteValue } = this.state; - - if (api.tx.electionsPhragmen) { - return [ - Object.entries(votes).filter(([, vote]): boolean => vote).map(([accountId]): string => accountId), - voteValue - ]; - } - - const approvals = candidates.map((accountId): boolean => votes[accountId.toString()] === true); + const { votes, voteValue } = this.state; return [ - approvals - ? approvals.slice(0, 1 + approvals.lastIndexOf(true)) - : [], - createType(registry, 'VoteIndex', voteCount), - voterPositions && accountId && voterPositions[accountId] - ? voterPositions[accountId].setIndex - : nextVoterSet || null + Object + .entries(votes) + .filter(([, vote]): boolean => vote) + .map(([accountId]): string => accountId), + voteValue ]; } @@ -155,13 +124,11 @@ class Vote extends TxModal { } protected renderTrigger = (): React.ReactNode => { - const { api, electionsInfo: { candidates, members, runnersUp }, t } = this.props; - const available = api.tx.electionsPhragmen - ? members - .map(([accountId]): AccountId => accountId) - .concat(runnersUp.map(([accountId]): AccountId => accountId)) - .concat(candidates) - : candidates; + const { electionsInfo: { candidates, members, runnersUp }, t } = this.props; + const available = members + .map(([accountId]): AccountId => accountId) + .concat(runnersUp.map(([accountId]): AccountId => accountId)) + .concat(candidates); return (

- ); -} - -// FIXME This is _very_ similar to what we have in democracy/Item function renderExtrinsic (props: Props, extrinsic: Extrinsic, index: number): React.ReactNode { const { blockNumber, t } = props; const { meta, method, section } = registry.findMetaCall(extrinsic.callIndex); @@ -57,14 +39,19 @@ function renderExtrinsic (props: Props, extrinsic: Extrinsic, index: number): Re

{section}.{method} (#{formatNumber(index)})

- {renderSigner(props, extrinsic)} + {extrinsic.isSigned && ( +
+
+ +
+
+ {t('index')} {formatNumber(extrinsic.nonce)} +
+
+ )}
- { - meta && meta.documentation - ? meta.documentation.join(' ') - : t('Details') - } + {meta?.documentation.join(' ') || t('Details')} { - try { - return renderExtrinsic(props, extrinsic, index); - } catch (error) { - console.error(error); - - return props.t('Unable to render extrinsic'); - } - }); -} - function Extrinsics (props: Props): React.ReactElement { - const { className, label, t } = props; + const { className, label, t, value } = props; return ( { emptyText={t('No pending extrinsics are in the queue')} headerText={label || t('extrinsics')} > - {renderContent(props)} + {value?.map((extrinsic, index): React.ReactNode => { + try { + return renderExtrinsic(props, extrinsic, index); + } catch (error) { + console.error(error); + + return props.t('Unable to render extrinsic'); + } + })} ); } diff --git a/packages/app-generic-asset/src/modals/Create.tsx b/packages/app-generic-asset/src/modals/Create.tsx index 556dfc826915..5feb01f592b8 100644 --- a/packages/app-generic-asset/src/modals/Create.tsx +++ b/packages/app-generic-asset/src/modals/Create.tsx @@ -28,8 +28,10 @@ function Create ({ onClose, onRegister, t }: Props): React.ReactElement { }; return ( - - {t('Register an Asset')} + { return ( @@ -103,36 +104,31 @@ class BondExtra extends TxComponent { const isUnsafeChain = detectUnsafe(systemChain); return ( - <> - - {t('Bond more funds')} - - - } - /> - - - - + + } + /> + + + ); } diff --git a/packages/app-staking/src/Actions/Account/InjectKeys.tsx b/packages/app-staking/src/Actions/Account/InjectKeys.tsx index 6662fe57fee3..5bd68a3bcf24 100644 --- a/packages/app-staking/src/Actions/Account/InjectKeys.tsx +++ b/packages/app-staking/src/Actions/Account/InjectKeys.tsx @@ -71,12 +71,10 @@ function InjectKeys ({ isOpen = true, onClose, t }: Props): React.ReactElement

- - {t('Inject Keys')} - - - {t('Nominate Validators')} - { return ( - - {t('Change controller account')} - {isValidating && (

diff --git a/packages/app-staking/src/Actions/Account/SetRewardDestination.tsx b/packages/app-staking/src/Actions/Account/SetRewardDestination.tsx index 8df6102a73a8..16c9faa820e3 100644 --- a/packages/app-staking/src/Actions/Account/SetRewardDestination.tsx +++ b/packages/app-staking/src/Actions/Account/SetRewardDestination.tsx @@ -38,6 +38,7 @@ class SetRewardDestination extends TxComponent { return ( @@ -73,29 +74,24 @@ class SetRewardDestination extends TxComponent { const { destination } = this.state; return ( - <> - - {t('Bonding Preferences')} - - - - - - + + + + ); } diff --git a/packages/app-staking/src/Actions/Account/SetSessionKey.tsx b/packages/app-staking/src/Actions/Account/SetSessionKey.tsx index 23471518c30c..d69dfcee8daa 100644 --- a/packages/app-staking/src/Actions/Account/SetSessionKey.tsx +++ b/packages/app-staking/src/Actions/Account/SetSessionKey.tsx @@ -41,12 +41,10 @@ function SetSessionKey ({ controllerId, isOpen, onClose, sessionIds, stashId, t return ( - - {t('Set Session Key')} - { return ( @@ -97,37 +98,32 @@ class Unbond extends TxComponent { const { maxBalance } = this.state; return ( - <> - - {t('Unbond funds')} - - - + + + - - - - - - + + + ); } diff --git a/packages/app-staking/src/Actions/Account/Validate.tsx b/packages/app-staking/src/Actions/Account/Validate.tsx index 6aa29bccb640..f6e8137650db 100644 --- a/packages/app-staking/src/Actions/Account/Validate.tsx +++ b/packages/app-staking/src/Actions/Account/Validate.tsx @@ -74,7 +74,7 @@ class Validate extends TxComponent { // } public render (): React.ReactNode { - const { isOpen } = this.props; + const { isOpen, t } = this.props; if (!isOpen) { return null; @@ -83,6 +83,7 @@ class Validate extends TxComponent { return ( @@ -134,65 +135,60 @@ class Validate extends TxComponent { const defaultThreshold = validatorPrefs && (validatorPrefs as ValidatorPrefsTo145).unstakeThreshold && (validatorPrefs as ValidatorPrefsTo145).unstakeThreshold.toBn(); return ( - <> - - {t('Set validator preferences')} - - - - - {!isSubstrateV2 && ( - <> - - - - )} - { - hasCommission - ? - : - } - - + + + + {!isSubstrateV2 && ( + <> + + + + )} + { + hasCommission + ? + : + } + ); } diff --git a/packages/app-staking/src/Actions/NewStake.tsx b/packages/app-staking/src/Actions/NewStake.tsx index 3039bbcf4d9b..81482ffcee61 100644 --- a/packages/app-staking/src/Actions/NewStake.tsx +++ b/packages/app-staking/src/Actions/NewStake.tsx @@ -58,12 +58,10 @@ class NewStake extends TxComponent { return ( - - {t('Bonding Preferences')} - { defaultValue={defaultValue} label={t('selected constant query')} onChange={setValue} - help={meta && meta.documentation && meta.documentation.join(' ')} + help={meta?.documentation.join(' ')} />
diff --git a/packages/app-storage/src/Selection/Modules.tsx b/packages/app-storage/src/Selection/Modules.tsx index f8b15c46df7e..5654c20fc754 100644 --- a/packages/app-storage/src/Selection/Modules.tsx +++ b/packages/app-storage/src/Selection/Modules.tsx @@ -91,7 +91,7 @@ function Modules ({ onAdd, t }: Props): React.ReactElement { defaultValue={api.query.timestamp.now} label={t('selected state query')} onChange={_onChangeKey} - help={meta && meta.documentation && meta.documentation.join(' ')} + help={meta?.documentation.join(' ')} /> | nu <> {isVotingOpen && ( - {t('Vote on proposal')} { return ( - - {t('Unlock account')} - {this.renderContent()} {this.renderActions()} diff --git a/packages/app-treasury/src/Overview/Voting.tsx b/packages/app-treasury/src/Overview/Voting.tsx index de4521d8c28d..fe662ec5b28b 100644 --- a/packages/app-treasury/src/Overview/Voting.tsx +++ b/packages/app-treasury/src/Overview/Voting.tsx @@ -64,10 +64,10 @@ function Voting ({ proposals, t }: Props): React.ReactElement | null { <> {isVotingOpen && ( - {t('Vote on proposal')} - {t('Select Network')} (endpoint: string, { const meta = apiSection[method].meta; - if (area === 'query' && meta && meta.type.isMap) { + if (area === 'query' && meta?.type.isMap) { const arg = newParams[0]; assert((!isUndefined(arg) && !isNull(arg)) || meta.type.asMap.kind.isLinkedMap, `${meta.name} expects one argument`); diff --git a/packages/react-components/src/Extrinsic.tsx b/packages/react-components/src/Extrinsic.tsx index 9ab0e8a4d6f0..34c87cc5816e 100644 --- a/packages/react-components/src/Extrinsic.tsx +++ b/packages/react-components/src/Extrinsic.tsx @@ -77,7 +77,7 @@ export default function ExtrinsicDisplay ({ defaultValue, isDisabled, isError, i label={label} onChange={_onChangeMethod} withLabel={withLabel} - help={meta && meta.documentation && meta.documentation.join(' ')} + help={meta?.documentation.join(' ')} /> { return ( - - {getHeaderText(props)} - - - {renderContent(props)} - + {renderContent(props)}