diff --git a/package.json b/package.json index 82a032af3f..bdf438b2b5 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,12 @@ "packages/*" ], "resolutions": { - "@polkadot/api": "^0.82.0-beta.95", - "@polkadot/api-contract": "^0.82.0-beta.95", - "@polkadot/keyring": "^0.95.0-beta.0", - "@polkadot/types": "^0.82.0-beta.95", - "@polkadot/util": "^0.95.0-beta.0", - "@polkadot/util-crypto": "^0.95.0-beta.0", + "@polkadot/api": "^0.90.0-beta.1", + "@polkadot/api-contract": "^0.90.0-beta.1", + "@polkadot/keyring": "^0.95.0-beta.2", + "@polkadot/types": "^0.90.0-beta.1", + "@polkadot/util": "^0.95.0-beta.2", + "@polkadot/util-crypto": "^0.95.0-beta.2", "@types/styled-components": "4.1.8", "babel-core": "^7.0.0-bridge.0", "typescript": "^3.5.3" diff --git a/packages/app-123code/src/SummaryBar.tsx b/packages/app-123code/src/SummaryBar.tsx index 15294a412e..d0973cd887 100644 --- a/packages/app-123code/src/SummaryBar.tsx +++ b/packages/app-123code/src/SummaryBar.tsx @@ -3,12 +3,12 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { AccountId, RuntimeVersion } from '@polkadot/types/interfaces'; import { ApiProps } from '@polkadot/ui-api/types'; import { BareProps, I18nProps } from '@polkadot/ui-app/types'; import BN from 'bn.js'; import React from 'react'; -import { AccountId, RuntimeVersion } from '@polkadot/types'; import { withCalls } from '@polkadot/ui-api/with'; import { Bubble, IdentityIcon } from '@polkadot/ui-app'; import { formatBalance, formatNumber } from '@polkadot/util'; diff --git a/packages/app-accounts/src/modals/Transfer.tsx b/packages/app-accounts/src/modals/Transfer.tsx index fdfd0a4536..599c995c87 100644 --- a/packages/app-accounts/src/modals/Transfer.tsx +++ b/packages/app-accounts/src/modals/Transfer.tsx @@ -3,15 +3,15 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { SubmittableExtrinsic } from '@polkadot/api/promise/types'; +import { Index } from '@polkadot/types/interfaces'; import { ApiProps } from '@polkadot/ui-api/types'; import { DerivedFees } from '@polkadot/api-derive/types'; import { I18nProps } from '@polkadot/ui-app/types'; -import { SubmittableExtrinsic } from '@polkadot/api/promise/types'; import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; -import { Index } from '@polkadot/types'; import { Button, InputAddress, InputBalance, Modal, TxButton } from '@polkadot/ui-app'; import { Available } from '@polkadot/ui-reactive'; import Checks, { calcSignatureLength } from '@polkadot/ui-signer/Checks'; diff --git a/packages/app-contracts/package.json b/packages/app-contracts/package.json index c29cb13e2c..c8d48fab76 100644 --- a/packages/app-contracts/package.json +++ b/packages/app-contracts/package.json @@ -11,7 +11,7 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.5.5", - "@polkadot/api-contract": "^0.82.0-beta.95", + "@polkadot/api-contract": "^0.90.0-beta.1", "@polkadot/ui-app": "^0.34.0-beta.87" } } diff --git a/packages/app-contracts/src/Codes/Add.tsx b/packages/app-contracts/src/Codes/Add.tsx index 77df592d11..dffa6ddd0a 100644 --- a/packages/app-contracts/src/Codes/Add.tsx +++ b/packages/app-contracts/src/Codes/Add.tsx @@ -3,8 +3,8 @@ // of the Apache-2.0 license. See the LICENSE file for details. import React from 'react'; +import { createType } from '@polkadot/types'; import { Button, Input } from '@polkadot/ui-app'; -import { Hash } from '@polkadot/types'; import ContractModal, { ContractModalProps, ContractModalState } from '../Modal'; import ValidateCode from './ValidateCode'; @@ -94,7 +94,7 @@ class Add extends ContractModal { this.setState({ isBusy: true }, (): void => { store - .saveCode(new Hash(codeHash), { abi, name, tags }) + .saveCode(createType('Hash', codeHash), { abi, name, tags }) .then((): void => { this.setState( { isBusy: false }, diff --git a/packages/app-contracts/src/Codes/Upload.tsx b/packages/app-contracts/src/Codes/Upload.tsx index 1d2457077d..e5f0d171fe 100644 --- a/packages/app-contracts/src/Codes/Upload.tsx +++ b/packages/app-contracts/src/Codes/Upload.tsx @@ -2,6 +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 { Hash } from '@polkadot/types/interfaces'; import { ApiProps } from '@polkadot/ui-api/types'; import { SubmittableResult } from '@polkadot/api/SubmittableExtrinsic'; @@ -10,7 +11,6 @@ import React from 'react'; import { withApi, withMulti } from '@polkadot/ui-api'; import { Button, InputFile, TxButton } from '@polkadot/ui-app'; import { compactAddLength } from '@polkadot/util'; -import { Hash } from '@polkadot/types'; import ContractModal, { ContractModalProps, ContractModalState } from '../Modal'; import store from '../store'; diff --git a/packages/app-contracts/src/Codes/ValidateCode.tsx b/packages/app-contracts/src/Codes/ValidateCode.tsx index 88fdada11f..32ff9f9f04 100644 --- a/packages/app-contracts/src/Codes/ValidateCode.tsx +++ b/packages/app-contracts/src/Codes/ValidateCode.tsx @@ -3,7 +3,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { PrefabWasmModule } from '@polkadot/types/srml/contracts/types'; +import { PrefabWasmModule } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import { ApiProps } from '@polkadot/ui-api/types'; diff --git a/packages/app-contracts/src/Contracts/ValidateAddr.tsx b/packages/app-contracts/src/Contracts/ValidateAddr.tsx index 0e6bda1854..594b46a544 100644 --- a/packages/app-contracts/src/Contracts/ValidateAddr.tsx +++ b/packages/app-contracts/src/Contracts/ValidateAddr.tsx @@ -3,7 +3,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { ContractInfo } from '@polkadot/types/srml/contracts/types'; +import { ContractInfo } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import { ApiProps } from '@polkadot/ui-api/types'; diff --git a/packages/app-contracts/src/Deploy.tsx b/packages/app-contracts/src/Deploy.tsx index 403653c925..dd3906492c 100644 --- a/packages/app-contracts/src/Deploy.tsx +++ b/packages/app-contracts/src/Deploy.tsx @@ -2,6 +2,8 @@ // 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 { TypeDef } from '@polkadot/types/types'; import { ApiProps } from '@polkadot/ui-api/types'; import { SubmittableResult } from '@polkadot/api/SubmittableExtrinsic'; import { I18nProps } from '@polkadot/ui-app/types'; @@ -14,7 +16,7 @@ import { Abi } from '@polkadot/api-contract'; import { withApi, withMulti } from '@polkadot/ui-api'; import keyring from '@polkadot/ui-keyring'; import { Button, Dropdown, InputBalance, TxButton } from '@polkadot/ui-app'; -import { AccountId, TypeDef, getTypeDef } from '@polkadot/types'; +import { getTypeDef } from '@polkadot/types'; import createValues from '@polkadot/ui-params/values'; import ContractModal, { ContractModalProps, ContractModalState } from './Modal'; diff --git a/packages/app-contracts/src/Params.tsx b/packages/app-contracts/src/Params.tsx index 0885cc72a6..437443e91e 100644 --- a/packages/app-contracts/src/Params.tsx +++ b/packages/app-contracts/src/Params.tsx @@ -3,11 +3,12 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { ContractABIFnArg } from '@polkadot/api-contract/types'; +import { TypeDef } from '@polkadot/types/types'; import { RawParams } from '@polkadot/ui-params/types'; import React from 'react'; import UIParams from '@polkadot/ui-params'; -import { getTypeDef, TypeDef } from '@polkadot/types'; +import { getTypeDef } from '@polkadot/types'; interface Props { isDisabled?: boolean; diff --git a/packages/app-contracts/src/store.ts b/packages/app-contracts/src/store.ts index e82fe68fc9..7f783aa015 100644 --- a/packages/app-contracts/src/store.ts +++ b/packages/app-contracts/src/store.ts @@ -2,12 +2,13 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { Hash } from '@polkadot/types/interfaces'; import { CodeJson, CodeStored } from './types'; import EventEmitter from 'eventemitter3'; import store from 'store'; import { Abi } from '@polkadot/api-contract'; -import { Hash } from '@polkadot/types'; +import { createType } from '@polkadot/types'; import { api } from '@polkadot/ui-api'; const KEY_CODE = 'code:'; @@ -30,7 +31,7 @@ class Store extends EventEmitter { } public async saveCode (codeHash: string | Hash, partial: Partial): Promise { - const hex = (typeof codeHash === 'string' ? new Hash(codeHash) : codeHash).toHex(); + const hex = (typeof codeHash === 'string' ? createType('Hash', codeHash) : codeHash).toHex(); const existing = this.getCode(hex); diff --git a/packages/app-council/src/Motions/Motion.tsx b/packages/app-council/src/Motions/Motion.tsx index 049c0e52f9..436e40c6d4 100644 --- a/packages/app-council/src/Motions/Motion.tsx +++ b/packages/app-council/src/Motions/Motion.tsx @@ -2,11 +2,13 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { Proposal as ProposalType, Votes } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; -import { Option, Proposal as ProposalType, Votes } from '@polkadot/types'; import BN from 'bn.js'; import React from 'react'; +import { Option } from '@polkadot/types'; + import { ActionItem, InputAddress, Labelled, Voting } from '@polkadot/ui-app'; import { withCalls, withMulti } from '@polkadot/ui-api'; diff --git a/packages/app-council/src/Motions/Propose.tsx b/packages/app-council/src/Motions/Propose.tsx index fe1aab53eb..52e6773ec7 100644 --- a/packages/app-council/src/Motions/Propose.tsx +++ b/packages/app-council/src/Motions/Propose.tsx @@ -2,12 +2,12 @@ // 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/ui-api/types'; -import { Method, Proposal } from '@polkadot/types'; import BN from 'bn.js'; import React from 'react'; - +import { createType } from '@polkadot/types'; import { Button, Extrinsic, InputNumber } from '@polkadot/ui-app'; import TxModal, { TxModalState, TxModalProps } from '@polkadot/ui-app/TxModal'; import { withApi, withCalls, withMulti } from '@polkadot/ui-api'; @@ -19,7 +19,7 @@ interface Props extends TxModalProps, ApiProps { } interface State extends TxModalState { - method: Method | null; + method: Call | null; threshold: BN | null; } @@ -54,7 +54,7 @@ class Propose extends TxModal { return [ threshold, - ...(method ? [new Proposal(method)] : []) + ...(method ? [createType('Proposal', method)] : []) ]; } @@ -124,7 +124,7 @@ class Propose extends TxModal { this.setState({ threshold }); } - private onChangeExtrinsic = (method: Method): void => { + private onChangeExtrinsic = (method: Call): void => { if (!method) { return; } diff --git a/packages/app-council/src/Motions/index.tsx b/packages/app-council/src/Motions/index.tsx index 810556e598..531e450cba 100644 --- a/packages/app-council/src/Motions/index.tsx +++ b/packages/app-council/src/Motions/index.tsx @@ -3,7 +3,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { Hash } from '@polkadot/types'; +import { Hash } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import React from 'react'; diff --git a/packages/app-council/src/Overview/Candidate.tsx b/packages/app-council/src/Overview/Candidate.tsx index 0b5c57eb10..d6f98b5b0d 100644 --- a/packages/app-council/src/Overview/Candidate.tsx +++ b/packages/app-council/src/Overview/Candidate.tsx @@ -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 { AccountId } from '@polkadot/types'; +import { AccountId } from '@polkadot/types/interfaces'; import React from 'react'; import { AddressCard } from '@polkadot/ui-app'; diff --git a/packages/app-council/src/Overview/Member.tsx b/packages/app-council/src/Overview/Member.tsx index 7d7100c0f9..46e00c5f1f 100644 --- a/packages/app-council/src/Overview/Member.tsx +++ b/packages/app-council/src/Overview/Member.tsx @@ -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 { BlockNumber } from '@polkadot/types'; +import { BlockNumber } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import React from 'react'; diff --git a/packages/app-council/src/Overview/Vote.tsx b/packages/app-council/src/Overview/Vote.tsx index 0d1783cad4..fdb635881d 100644 --- a/packages/app-council/src/Overview/Vote.tsx +++ b/packages/app-council/src/Overview/Vote.tsx @@ -2,8 +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'; -// import { SetIndex } from '@polkadot/types/srml/types'; +import { VoteIndex } from '@polkadot/types/interfaces'; import { DerivedVoterPositions } from '@polkadot/api-derive/types'; import { ApiProps } from '@polkadot/ui-api/types'; import { ComponentProps } from './types'; @@ -11,6 +10,7 @@ import { ComponentProps } from './types'; 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/ui-api'; import { AddressRow, Button, Icon, Toggle, TxButton } from '@polkadot/ui-app'; import TxModal, { TxModalState, TxModalProps } from '@polkadot/ui-app/TxModal'; @@ -140,7 +140,7 @@ class Vote extends TxModal { return [ approvals ? approvals.slice(0, 1 + approvals.lastIndexOf(true)) : [], - new VoteIndex(voteCount), + createType('VoteIndex', voteCount), voterPositions && accountId && voterPositions[accountId] ? voterPositions[accountId].setIndex : nextVoterSet diff --git a/packages/app-council/src/Overview/index.tsx b/packages/app-council/src/Overview/index.tsx index 610e45a7a2..0d2b5c5e63 100644 --- a/packages/app-council/src/Overview/index.tsx +++ b/packages/app-council/src/Overview/index.tsx @@ -2,14 +2,12 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { createType, BlockNumber, VoteIndex } from '@polkadot/types'; -import { SetIndex } from '@polkadot/types/srml/elections/types'; import { DerivedElectionsInfo } from '@polkadot/api-derive/types'; import { ComponentProps as Props } from './types'; import BN from 'bn.js'; import React from 'react'; - +import { createType } from '@polkadot/types'; import { withCalls } from '@polkadot/ui-api'; import { Button } from '@polkadot/ui-app'; @@ -23,10 +21,10 @@ const NULL_INFO: DerivedElectionsInfo = { candidates: [], candidateCount: new BN(0), desiredSeats: new BN(0), - nextVoterSet: createType('SetIndex', 0), - termDuration: new BlockNumber(0), - voteCount: new VoteIndex(0), - voterCount: createType('SetIndex', 0) + nextVoterSet: createType('SetIndex'), + termDuration: createType('BlockNumber'), + voteCount: createType('VoteIndex'), + voterCount: createType('SetIndex') }; class Overview extends React.PureComponent { diff --git a/packages/app-council/src/Overview/types.ts b/packages/app-council/src/Overview/types.ts index f2bccd0086..8e1d3534df 100644 --- a/packages/app-council/src/Overview/types.ts +++ b/packages/app-council/src/Overview/types.ts @@ -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 { SetIndex } from '@polkadot/types/srml/types'; +import { SetIndex } from '@polkadot/types/interfaces'; import { DerivedElectionsInfo } from '@polkadot/api-derive/types'; import BN from 'bn.js'; diff --git a/packages/app-democracy/src/Overview/Proposal.tsx b/packages/app-democracy/src/Overview/Proposal.tsx index a74d51e7a2..d2e411eb4d 100644 --- a/packages/app-democracy/src/Overview/Proposal.tsx +++ b/packages/app-democracy/src/Overview/Proposal.tsx @@ -3,11 +3,12 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { AccountId, Balance, Proposal } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import BN from 'bn.js'; import React from 'react'; -import { AccountId, Balance, Option, Proposal, Tuple, Vector } from '@polkadot/types'; +import { Option, Tuple, Vec } from '@polkadot/types'; import { ActionItem, InputAddress, Labelled, Static } from '@polkadot/ui-app'; import { withCalls, withMulti } from '@polkadot/ui-api'; import { formatBalance } from '@polkadot/util'; @@ -16,7 +17,7 @@ import translate from '../translate'; import Seconding from './Seconding'; interface Props extends I18nProps { - democracy_depositOf?: [Balance, Vector] | null; + democracy_depositOf?: [Balance, Vec] | null; idNumber: BN; value: Proposal; } diff --git a/packages/app-democracy/src/Overview/Proposals.tsx b/packages/app-democracy/src/Overview/Proposals.tsx index 0443fc632d..2c85f393d2 100644 --- a/packages/app-democracy/src/Overview/Proposals.tsx +++ b/packages/app-democracy/src/Overview/Proposals.tsx @@ -3,11 +3,11 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { Proposal } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import BN from 'bn.js'; import React from 'react'; -import { Proposal } from '@polkadot/types'; import { withCalls, withMulti } from '@polkadot/ui-api'; import { Column } from '@polkadot/ui-app'; diff --git a/packages/app-democracy/src/Overview/Seconding.tsx b/packages/app-democracy/src/Overview/Seconding.tsx index d843f3e6ca..5f0a19f152 100644 --- a/packages/app-democracy/src/Overview/Seconding.tsx +++ b/packages/app-democracy/src/Overview/Seconding.tsx @@ -2,12 +2,12 @@ // 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 { I18nProps } from '@polkadot/ui-app/types'; import { SubjectInfo } from '@polkadot/ui-keyring/observable/types'; import BN from 'bn.js'; import React from 'react'; -import { AccountId } from '@polkadot/types'; import { Button, InputAddress, Modal, TxButton } from '@polkadot/ui-app'; import accountObservable from '@polkadot/ui-keyring/observable/accounts'; import { withMulti, withObservable } from '@polkadot/ui-api'; diff --git a/packages/app-democracy/src/Propose.tsx b/packages/app-democracy/src/Propose.tsx index e6a014a72c..73febb0a7e 100644 --- a/packages/app-democracy/src/Propose.tsx +++ b/packages/app-democracy/src/Propose.tsx @@ -2,6 +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 { Call } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import { ApiProps } from '@polkadot/ui-api/types'; @@ -9,8 +10,7 @@ import BN from 'bn.js'; import React from 'react'; import { RouteComponentProps } from 'react-router'; import { withRouter } from 'react-router-dom'; -import { Method, Proposal } from '@polkadot/types'; - +import { createType } from '@polkadot/types'; import { Button, Extrinsic, InputAddress, InputBalance, TxButton, TxComponent } from '@polkadot/ui-app'; import { withApi, withMulti } from '@polkadot/ui-api'; @@ -22,7 +22,7 @@ type Props = I18nProps & ApiProps & RouteComponentProps & { interface State { accountId?: string; - method: Method | null; + method: Call | null; value: BN; isValid: boolean; } @@ -69,7 +69,7 @@ class Propose extends TxComponent { tx='democracy.propose' isDisabled={!isValid} params={[ - ...(method ? [new Proposal(method)] : []), + ...(method ? [createType('Proposal', method)] : []), ...(hasValue ? [value] : []) ]} onSuccess={this.onSubmitProposal} @@ -100,7 +100,7 @@ class Propose extends TxComponent { this.nextState({ accountId }); } - private onChangeExtrinsic = (method: Method): void => { + private onChangeExtrinsic = (method: Call): void => { if (!method) { return; } diff --git a/packages/app-explorer/src/BestHash.tsx b/packages/app-explorer/src/BestHash.tsx index b431ab3505..99a7f22a2c 100644 --- a/packages/app-explorer/src/BestHash.tsx +++ b/packages/app-explorer/src/BestHash.tsx @@ -3,10 +3,10 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { Header } from '@polkadot/types/interfaces'; import { BareProps, CallProps } from '@polkadot/ui-api/types'; import React from 'react'; -import { Header } from '@polkadot/types'; import { withCalls } from '@polkadot/ui-api'; type Props = BareProps & CallProps & { diff --git a/packages/app-explorer/src/BlockHeader/index.tsx b/packages/app-explorer/src/BlockHeader/index.tsx index f873e09c92..fd419a364b 100644 --- a/packages/app-explorer/src/BlockHeader/index.tsx +++ b/packages/app-explorer/src/BlockHeader/index.tsx @@ -27,9 +27,8 @@ export default class BlockHeader extends React.PureComponent { return null; } - const { author, blockNumber, hash } = value; - const hashHex = hash.toHex(); - const textNumber = formatNumber(blockNumber); + const hashHex = value.hash.toHex(); + const textNumber = formatNumber(value.number); return (
@@ -42,8 +41,8 @@ export default class BlockHeader extends React.PureComponent { } 
{hashHex}
{ - author - ? + value.author + ? : undefined }
@@ -62,7 +61,7 @@ export default class BlockHeader extends React.PureComponent { ); } - private renderDetails ({ blockNumber, extrinsicsRoot, parentHash, stateRoot }: HeaderExtended): React.ReactNode { + private renderDetails ({ number: blockNumber, extrinsicsRoot, parentHash, stateRoot }: HeaderExtended): React.ReactNode { const parentHex = parentHash.toHex(); return ( @@ -70,7 +69,7 @@ export default class BlockHeader extends React.PureComponent {
{ - blockNumber.gtn(1) + blockNumber.unwrap().gtn(1) ? {parentHex} : parentHex } diff --git a/packages/app-explorer/src/BlockHeaders.tsx b/packages/app-explorer/src/BlockHeaders.tsx index 2addb9894b..0410a682c3 100644 --- a/packages/app-explorer/src/BlockHeaders.tsx +++ b/packages/app-explorer/src/BlockHeaders.tsx @@ -21,7 +21,7 @@ const transform = (header: HeaderExtended): HeaderExtended[] => { blockHeaders = blockHeaders .filter((old, index): boolean => - index < MAX_ITEMS && old.blockNumber.lt(header.blockNumber) + index < MAX_ITEMS && old.number.unwrap().lt(header.number.unwrap()) ) .reduce((next, header): HeaderExtended[] => { next.push(header); @@ -29,7 +29,7 @@ const transform = (header: HeaderExtended): HeaderExtended[] => { return next; }, [header]) .sort((a, b): number => - b.blockNumber.cmp(a.blockNumber) + b.number.unwrap().cmp(a.number.unwrap()) ); return blockHeaders; @@ -46,9 +46,9 @@ class BlockHeaders extends React.PureComponent { return headers.map((header, index): React.ReactNode => ( )); } diff --git a/packages/app-explorer/src/BlockInfo/ByHash.tsx b/packages/app-explorer/src/BlockInfo/ByHash.tsx index 0d812dfc00..d4eabbc0e0 100644 --- a/packages/app-explorer/src/BlockInfo/ByHash.tsx +++ b/packages/app-explorer/src/BlockInfo/ByHash.tsx @@ -3,12 +3,12 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { EventRecord, SignedBlock } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import { ApiProps } from '@polkadot/ui-api/types'; import React from 'react'; import { HeaderExtended } from '@polkadot/api-derive'; -import { EventRecord, SignedBlock } from '@polkadot/types'; import { withCalls } from '@polkadot/ui-api'; import { Columar } from '@polkadot/ui-app'; @@ -43,7 +43,7 @@ class BlockByHash extends React.PureComponent { diff --git a/packages/app-explorer/src/BlockInfo/ByNumber.tsx b/packages/app-explorer/src/BlockInfo/ByNumber.tsx index 77e7571184..f8a6c292c6 100644 --- a/packages/app-explorer/src/BlockInfo/ByNumber.tsx +++ b/packages/app-explorer/src/BlockInfo/ByNumber.tsx @@ -3,10 +3,10 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { Hash } from '@polkadot/types/interfaces'; import { ApiProps } from '@polkadot/ui-api/types'; import React from 'react'; -import { Hash } from '@polkadot/types'; import { withCalls } from '@polkadot/ui-api'; import BlockByHash from './ByHash'; diff --git a/packages/app-explorer/src/BlockInfo/Events.tsx b/packages/app-explorer/src/BlockInfo/Events.tsx index d32aff0413..aaf0a4f039 100644 --- a/packages/app-explorer/src/BlockInfo/Events.tsx +++ b/packages/app-explorer/src/BlockInfo/Events.tsx @@ -2,10 +2,10 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { EventRecord } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import React from 'react'; -import { EventRecord } from '@polkadot/types'; import { Column } from '@polkadot/ui-app'; import EventsDisplay from '../Events'; diff --git a/packages/app-explorer/src/BlockInfo/Extrinsics.tsx b/packages/app-explorer/src/BlockInfo/Extrinsics.tsx index 2db2dde338..0bcdf8b21b 100644 --- a/packages/app-explorer/src/BlockInfo/Extrinsics.tsx +++ b/packages/app-explorer/src/BlockInfo/Extrinsics.tsx @@ -2,13 +2,14 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { BlockNumber, Extrinsic } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import React from 'react'; import styled from 'styled-components'; +import { GenericCall } from '@polkadot/types'; import { AddressMini, Call, Column, LinkPolkascan } from '@polkadot/ui-app'; import { formatNumber } from '@polkadot/util'; -import { BlockNumber, Extrinsic, Method } from '@polkadot/types'; import translate from '../translate'; @@ -42,7 +43,7 @@ class Extrinsics extends React.PureComponent { // FIXME This is _very_ similar to what we have in democracy/Item private renderExtrinsic = (extrinsic: Extrinsic, index: number): React.ReactNode => { const { blockNumber, t } = this.props; - const { meta, method, section } = Method.findFunction(extrinsic.callIndex); + const { meta, method, section } = GenericCall.findFunction(extrinsic.callIndex); const isMortal = extrinsic.era.isMortalEra; let eraEnd; let eraStart; diff --git a/packages/app-explorer/src/BlockInfo/Logs.tsx b/packages/app-explorer/src/BlockInfo/Logs.tsx index 275917e83d..3f564f5d0b 100644 --- a/packages/app-explorer/src/BlockInfo/Logs.tsx +++ b/packages/app-explorer/src/BlockInfo/Logs.tsx @@ -2,11 +2,12 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { Codec } from '@polkadot/types/types'; +import { DigestItem } from '@polkadot/types/interfaces'; +import { Codec, TypeDef } from '@polkadot/types/types'; import { I18nProps } from '@polkadot/ui-app/types'; import React from 'react'; -import { DigestItem, Struct, Tuple, TypeDef, U8a, Vector, getTypeDef } from '@polkadot/types'; +import { Struct, Tuple, U8a, Vec, getTypeDef } from '@polkadot/types'; import { Column } from '@polkadot/ui-app'; import Params from '@polkadot/ui-params'; @@ -39,7 +40,7 @@ class Logs extends React.PureComponent { content = this.formatStruct(item.value); } else if (item.value instanceof Tuple) { content = this.formatTuple(item.value); - } else if (item.value instanceof Vector) { + } else if (item.value instanceof Vec) { content = this.formatVector(item.value); } else if (item.value instanceof U8a) { content = this.formatU8a(item.value); @@ -114,7 +115,7 @@ class Logs extends React.PureComponent { ); } - private formatVector (vector: Vector): React.ReactNode { + private formatVector (vector: Vec): React.ReactNode { const type = getTypeDef(vector.Type); const values = vector.toArray().map((value): { isValid: boolean; value: Codec } => ({ isValid: true, diff --git a/packages/app-explorer/src/BlockInfo/index.tsx b/packages/app-explorer/src/BlockInfo/index.tsx index 52f0b4045d..76200366f1 100644 --- a/packages/app-explorer/src/BlockInfo/index.tsx +++ b/packages/app-explorer/src/BlockInfo/index.tsx @@ -3,12 +3,12 @@ // 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 { BareProps } from '@polkadot/ui-app/types'; import React from 'react'; import { withCalls, withMulti } from '@polkadot/ui-api'; import { isHex } from '@polkadot/util'; -import { BlockNumber } from '@polkadot/types'; import Query from '../Query'; import BlockByHash from './ByHash'; diff --git a/packages/app-explorer/src/NodeInfo/Peers.tsx b/packages/app-explorer/src/NodeInfo/Peers.tsx index a6b546a374..7d9ecac70e 100644 --- a/packages/app-explorer/src/NodeInfo/Peers.tsx +++ b/packages/app-explorer/src/NodeInfo/Peers.tsx @@ -2,10 +2,10 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { PeerInfo } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import React from 'react'; -import { PeerInfo } from '@polkadot/types'; import { formatNumber } from '@polkadot/util'; import translate from './translate'; diff --git a/packages/app-explorer/src/NodeInfo/index.tsx b/packages/app-explorer/src/NodeInfo/index.tsx index d4bbdbb1c3..685709af21 100644 --- a/packages/app-explorer/src/NodeInfo/index.tsx +++ b/packages/app-explorer/src/NodeInfo/index.tsx @@ -2,13 +2,14 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { Health, PeerInfo, Extrinsic } from '@polkadot/types/interfaces'; import { ApiProps } from '@polkadot/ui-api/types'; import { AppProps, I18nProps } from '@polkadot/ui-app/types'; import { Info } from './types'; import React from 'react'; import { withApi, withMulti } from '@polkadot/ui-api'; -import { Health, PeerInfo, PendingExtrinsics, Vector } from '@polkadot/types'; +import { Vec } from '@polkadot/types'; import './index.css'; @@ -89,8 +90,8 @@ class App extends React.PureComponent { const [blockNumber, health, peers, extrinsics] = await Promise.all([ api.derive.chain.bestNumber(), api.rpc.system.health(), - api.rpc.system.peers>(), - api.rpc.author.pendingExtrinsics() + api.rpc.system.peers>(), + api.rpc.author.pendingExtrinsics>() ]); this.setInfo({ blockNumber, extrinsics, health, peers }); diff --git a/packages/app-explorer/src/NodeInfo/types.ts b/packages/app-explorer/src/NodeInfo/types.ts index 306e394d57..11017acb33 100644 --- a/packages/app-explorer/src/NodeInfo/types.ts +++ b/packages/app-explorer/src/NodeInfo/types.ts @@ -2,11 +2,13 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { BlockNumber, Health, PeerInfo, PendingExtrinsics } from '@polkadot/types'; +import { BlockNumber, Extrinsic, Health, PeerInfo } from '@polkadot/types/interfaces'; + +import { Vec } from '@polkadot/types'; export interface Info { blockNumber?: BlockNumber; health?: Health | null; peers?: PeerInfo[] | null; - extrinsics?: PendingExtrinsics | null; + extrinsics?: Vec | null; } diff --git a/packages/app-explorer/src/index.tsx b/packages/app-explorer/src/index.tsx index 9e556aa4d0..d38ac856ea 100644 --- a/packages/app-explorer/src/index.tsx +++ b/packages/app-explorer/src/index.tsx @@ -3,6 +3,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { EventRecord } from '@polkadot/types/interfaces'; import { AppProps, BareProps, I18nProps } from '@polkadot/ui-app/types'; import { KeyedEvent } from './types'; @@ -11,7 +12,6 @@ import './index.css'; import React from 'react'; import { Route, Switch } from 'react-router'; import styled from 'styled-components'; -import { EventRecord } from '@polkadot/types'; import { withCalls, withMulti } from '@polkadot/ui-api'; import Tabs, { TabItem } from '@polkadot/ui-app/Tabs'; import uiSettings from '@polkadot/ui-settings'; diff --git a/packages/app-explorer/src/types.ts b/packages/app-explorer/src/types.ts index 9b2e627b4e..ca9251ce89 100644 --- a/packages/app-explorer/src/types.ts +++ b/packages/app-explorer/src/types.ts @@ -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 { EventRecord } from '@polkadot/types'; +import { EventRecord } from '@polkadot/types/interfaces'; export interface KeyedEvent { key: string; diff --git a/packages/app-extrinsics/src/Selection.tsx b/packages/app-extrinsics/src/Selection.tsx index 19b239155c..784bd597bc 100644 --- a/packages/app-extrinsics/src/Selection.tsx +++ b/packages/app-extrinsics/src/Selection.tsx @@ -2,14 +2,14 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import BN from 'bn.js'; +import { Call } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import { QueueTxExtrinsicAdd } from '@polkadot/ui-app/Status/types'; import { ApiProps } from '@polkadot/ui-api/types'; import { SubmittableExtrinsic } from '@polkadot/api/promise/types'; +import BN from 'bn.js'; import React from 'react'; -import { Method } from '@polkadot/types'; import { Button, Extrinsic, InputAddress, Labelled, TxButton, TxComponent } from '@polkadot/ui-app'; import { withApi, withMulti } from '@polkadot/ui-api'; import { Nonce } from '@polkadot/ui-reactive'; @@ -24,7 +24,7 @@ type Props = ApiProps & I18nProps & { interface State { isValid: boolean; isValidUnsigned: boolean; - method: Method | null; + method: Call | null; accountNonce?: BN; accountId?: string; } @@ -116,7 +116,7 @@ class Selection extends TxComponent { ); } - private onChangeExtrinsic = (method: Method | null = null): void => { + private onChangeExtrinsic = (method: Call | null = null): void => { this.nextState({ method }); } @@ -136,7 +136,7 @@ class Selection extends TxComponent { return null; } - const fn = Method.findFunction(method.callIndex); + const fn = api.findCall(method.callIndex); return api.tx[fn.section][fn.method](...method.args); } diff --git a/packages/app-staking/src/Actions/Account/InputValidationController.tsx b/packages/app-staking/src/Actions/Account/InputValidationController.tsx index c0a7beab9d..0923c8aa1f 100644 --- a/packages/app-staking/src/Actions/Account/InputValidationController.tsx +++ b/packages/app-staking/src/Actions/Account/InputValidationController.tsx @@ -2,11 +2,12 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { AccountId, StakingLedger } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import React from 'react'; import { Icon } from '@polkadot/ui-app'; -import { AccountId, Option, StakingLedger } from '@polkadot/types'; +import { Option } from '@polkadot/types'; import { withCalls } from '@polkadot/ui-api'; import translate from '../../translate'; diff --git a/packages/app-staking/src/Actions/Account/Unbond.tsx b/packages/app-staking/src/Actions/Account/Unbond.tsx index c8ea1e3776..06ec2fdeea 100644 --- a/packages/app-staking/src/Actions/Account/Unbond.tsx +++ b/packages/app-staking/src/Actions/Account/Unbond.tsx @@ -3,13 +3,14 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { AccountId, StakingLedger } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import { ApiProps } from '@polkadot/ui-api/types'; import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; -import { AccountId, Option, StakingLedger } from '@polkadot/types'; +import { Option } from '@polkadot/types'; import { AddressInfo, Button, InputAddress, InputBalance, Modal, TxButton, TxComponent } from '@polkadot/ui-app'; import { withCalls, withApi, withMulti } from '@polkadot/ui-api'; @@ -147,10 +148,10 @@ class Unbond extends TxComponent { return; } - const { active: maxBalance } = staking_ledger.unwrap(); + const { active } = staking_ledger.unwrap(); this.nextState({ - maxBalance + maxBalance: active.unwrap() }); } diff --git a/packages/app-staking/src/Actions/Account/Validate.tsx b/packages/app-staking/src/Actions/Account/Validate.tsx index 29a07aea8a..d83d8545aa 100644 --- a/packages/app-staking/src/Actions/Account/Validate.tsx +++ b/packages/app-staking/src/Actions/Account/Validate.tsx @@ -2,11 +2,11 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { ValidatorPrefs } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import BN from 'bn.js'; import React from 'react'; -import { ValidatorPrefs } from '@polkadot/types'; import { Button, InputAddress, InputBalance, InputNumber, Modal, TxButton, TxComponent } from '@polkadot/ui-app'; import InputValidationUnstakeThreshold from './InputValidationUnstakeThreshold'; diff --git a/packages/app-staking/src/Actions/Account/index.tsx b/packages/app-staking/src/Actions/Account/index.tsx index 7a85fd8041..5a02c4232c 100644 --- a/packages/app-staking/src/Actions/Account/index.tsx +++ b/packages/app-staking/src/Actions/Account/index.tsx @@ -4,7 +4,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { RecentlyOfflineMap } from '../../types'; -import { AccountId, Exposure, StakingLedger, ValidatorPrefs } from '@polkadot/types'; +import { AccountId, Exposure, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces'; import { ApiProps } from '@polkadot/ui-api/types'; import { DerivedBalances, DerivedStaking } from '@polkadot/api-derive/types'; import { I18nProps } from '@polkadot/ui-app/types'; diff --git a/packages/app-staking/src/Overview/Address.tsx b/packages/app-staking/src/Overview/Address.tsx index 524b29a460..357a3aa70f 100644 --- a/packages/app-staking/src/Overview/Address.tsx +++ b/packages/app-staking/src/Overview/Address.tsx @@ -3,13 +3,13 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { AccountId, Balance, Exposure } from '@polkadot/types/interfaces'; import { DerivedBalancesMap, DerivedStaking } from '@polkadot/api-derive/types'; import { I18nProps } from '@polkadot/ui-app/types'; import { ValidatorFilter, RecentlyOfflineMap } from '../types'; import React from 'react'; import styled from 'styled-components'; -import { AccountId, Balance, Exposure } from '@polkadot/types'; import { withCalls, withMulti } from '@polkadot/ui-api/with'; import { AddressCard, AddressMini, RecentlyOffline } from '@polkadot/ui-app'; import keyring from '@polkadot/ui-keyring'; @@ -79,8 +79,8 @@ class Address extends React.PureComponent { public render (): React.ReactNode { const { className, defaultName, filter } = this.props; const { controllerId, stakers, stashId } = this.state; - const bonded = stakers && !stakers.own.isZero() - ? [stakers.own, stakers.total.sub(stakers.own)] + const bonded = stakers && !stakers.own.isEmpty + ? [stakers.own.unwrap(), stakers.total.unwrap().sub(stakers.own.unwrap())] : true; if ((filter === 'hasNominators' && !this.hasNominators()) || @@ -148,7 +148,7 @@ class Address extends React.PureComponent { const { stakers } = this.state; return stakers - ? stakers.others.map(({ who, value }): [AccountId, Balance] => [who, value]) + ? stakers.others.map(({ who, value }): [AccountId, Balance] => [who, value.unwrap()]) : []; } diff --git a/packages/app-staking/src/Overview/index.tsx b/packages/app-staking/src/Overview/index.tsx index d6175b6718..c2d80e8449 100644 --- a/packages/app-staking/src/Overview/index.tsx +++ b/packages/app-staking/src/Overview/index.tsx @@ -41,7 +41,7 @@ class Overview extends React.PureComponent { let lastAuthor: string | undefined; if (chain_subscribeNewHead) { - lastBlock = formatNumber(chain_subscribeNewHead.blockNumber); + lastBlock = formatNumber(chain_subscribeNewHead.number); lastAuthor = (chain_subscribeNewHead.author || '').toString(); } diff --git a/packages/app-staking/src/index.tsx b/packages/app-staking/src/index.tsx index 141a0afde9..0b134772c2 100644 --- a/packages/app-staking/src/index.tsx +++ b/packages/app-staking/src/index.tsx @@ -3,6 +3,7 @@ // 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 { AppProps, I18nProps } from '@polkadot/ui-app/types'; import { ApiProps } from '@polkadot/ui-api/types'; import { SubjectInfo } from '@polkadot/ui-keyring/observable/types'; @@ -10,7 +11,7 @@ import { ComponentProps, RecentlyOffline, RecentlyOfflineMap } from './types'; import React from 'react'; import { Route, Switch } from 'react-router'; -import { AccountId, Option } from '@polkadot/types'; +import { Option } from '@polkadot/types'; import { HelpOverlay } from '@polkadot/ui-app'; import Tabs, { TabItem } from '@polkadot/ui-app/Tabs'; import { withCalls, withMulti, withObservable } from '@polkadot/ui-api'; diff --git a/packages/app-staking/src/types.ts b/packages/app-staking/src/types.ts index 9a43998d97..7d25d60fb1 100644 --- a/packages/app-staking/src/types.ts +++ b/packages/app-staking/src/types.ts @@ -2,11 +2,12 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { AccountId, BlockNumber } from '@polkadot/types'; -import BN from 'bn.js'; +import { AccountId, BlockNumber } from '@polkadot/types/interfaces'; import { DerivedFees, DerivedBalances } from '@polkadot/api-derive/types'; import { SubjectInfo } from '@polkadot/ui-keyring/observable/types'; +import BN from 'bn.js'; + export type Nominators = Record; export interface ComponentProps { diff --git a/packages/app-storage/src/Selection/Modules.tsx b/packages/app-storage/src/Selection/Modules.tsx index f0437df3c2..c3caf51e8a 100644 --- a/packages/app-storage/src/Selection/Modules.tsx +++ b/packages/app-storage/src/Selection/Modules.tsx @@ -3,13 +3,14 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { StorageEntryPromise } from '@polkadot/api/types'; -import { TypeDef, getTypeDef } from '@polkadot/types'; +import { TypeDef } from '@polkadot/types/types'; import { I18nProps } from '@polkadot/ui-app/types'; import { RawParams } from '@polkadot/ui-params/types'; import { ApiProps } from '@polkadot/ui-api/types'; import { ComponentProps } from '../types'; import React from 'react'; +import { getTypeDef } from '@polkadot/types'; import { Button, InputStorage, TxComponent } from '@polkadot/ui-app'; import Params from '@polkadot/ui-params'; import { withApi, withMulti } from '@polkadot/ui-api'; diff --git a/packages/app-sudo/src/Sudo.tsx b/packages/app-sudo/src/Sudo.tsx index 4515985616..9796a3215e 100644 --- a/packages/app-sudo/src/Sudo.tsx +++ b/packages/app-sudo/src/Sudo.tsx @@ -2,12 +2,13 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { Call } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import { ApiProps } from '@polkadot/ui-api/types'; import { ComponentProps } from './types'; import React from 'react'; -import { Method, Proposal } from '@polkadot/types'; +import { createType } from '@polkadot/types'; import { Button, Icon, Extrinsic, TxButton, TxComponent } from '@polkadot/ui-app'; import { withApi, withMulti } from '@polkadot/ui-api'; @@ -18,7 +19,7 @@ type Props = I18nProps & ApiProps & ComponentProps & { }; interface State { - method: Method | null; + method: Call | null; isValid: boolean; } @@ -48,7 +49,7 @@ class Propose extends TxComponent { label={t('Submit')} tx='sudo.sudo' isDisabled={!method || !isValid} - params={method ? [new Proposal(method)] : []} + params={method ? [createType('Proposal', method)] : []} ref={this.button} /> @@ -78,7 +79,7 @@ class Propose extends TxComponent { ); } - private onChangeExtrinsic = (method: Method): void => { + private onChangeExtrinsic = (method: Call): void => { if (!method) { return; } diff --git a/packages/app-toolbox/src/Rpc/Selection.tsx b/packages/app-toolbox/src/Rpc/Selection.tsx index 5c522362a2..2a00ec527d 100644 --- a/packages/app-toolbox/src/Rpc/Selection.tsx +++ b/packages/app-toolbox/src/Rpc/Selection.tsx @@ -3,13 +3,14 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { RpcMethod } from '@polkadot/jsonrpc/types'; +import { TypeDef } from '@polkadot/types/types'; import { RawParam } from '@polkadot/ui-params/types'; import { I18nProps } from '@polkadot/ui-app/types'; import { QueueTxRpcAdd } from '@polkadot/ui-app/Status/types'; import React from 'react'; import rpc from '@polkadot/jsonrpc'; -import { TypeDef, getTypeDef } from '@polkadot/types'; +import { getTypeDef } from '@polkadot/types'; import { Button, InputRpc, TxComponent } from '@polkadot/ui-app'; import Params from '@polkadot/ui-params'; diff --git a/packages/app-treasury/src/Overview/Approve.tsx b/packages/app-treasury/src/Overview/Approve.tsx index 3c6d527ae8..d654185a3d 100644 --- a/packages/app-treasury/src/Overview/Approve.tsx +++ b/packages/app-treasury/src/Overview/Approve.tsx @@ -2,9 +2,9 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { AccountId, BlockNumber } from '@polkadot/types/interfaces'; import { ApiProps } from '@polkadot/ui-api/types'; import { I18nProps } from '@polkadot/ui-app/types'; -import { AccountId, BlockNumber } from '@polkadot/types'; import React from 'react'; import { Button, Dropdown } from '@polkadot/ui-app'; diff --git a/packages/app-treasury/src/Overview/Proposal.tsx b/packages/app-treasury/src/Overview/Proposal.tsx index 4cea12cc86..26740be9d3 100644 --- a/packages/app-treasury/src/Overview/Proposal.tsx +++ b/packages/app-treasury/src/Overview/Proposal.tsx @@ -2,12 +2,13 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { TreasuryProposal as TreasuryProposalType } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import { SubjectInfo } from '@polkadot/ui-keyring/observable/types'; import React from 'react'; import styled from 'styled-components'; -import { Option, TreasuryProposal as TreasuryProposalType } from '@polkadot/types'; +import { Option } from '@polkadot/types'; import { ActionItem, Icon, TreasuryProposal } from '@polkadot/ui-app'; import { withCalls, withMulti, withObservable } from '@polkadot/ui-api'; import keyring from '@polkadot/ui-keyring'; diff --git a/packages/app-treasury/src/Overview/Proposals.tsx b/packages/app-treasury/src/Overview/Proposals.tsx index f943b07c21..4ff68075fb 100644 --- a/packages/app-treasury/src/Overview/Proposals.tsx +++ b/packages/app-treasury/src/Overview/Proposals.tsx @@ -3,8 +3,8 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { ProposalIndex } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; -import { ProposalIndex } from '@polkadot/types'; import BN from 'bn.js'; import React from 'react'; diff --git a/packages/app-treasury/src/Settings.tsx b/packages/app-treasury/src/Settings.tsx index 7dd287c5f9..3788204e09 100644 --- a/packages/app-treasury/src/Settings.tsx +++ b/packages/app-treasury/src/Settings.tsx @@ -2,9 +2,9 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { BlockNumber, BalanceOf, Permill } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/ui-app/types'; import { ApiProps } from '@polkadot/ui-api/types'; -import { BlockNumber, BalanceOf, Permill } from '@polkadot/types'; import BN from 'bn.js'; import React from 'react'; diff --git a/packages/apps/package.json b/packages/apps/package.json index 569288a635..75c5330072 100644 --- a/packages/apps/package.json +++ b/packages/apps/package.json @@ -14,7 +14,7 @@ "dependencies": { "@babel/runtime": "^7.5.5", "@polkadot/ui-app": "^0.34.0-beta.87", - "@polkadot/ui-assets": "^0.42.0-beta.16", + "@polkadot/ui-assets": "^0.42.0-beta.19", "@polkadot/ui-signer": "^0.34.0-beta.87", "query-string": "^6.8.1" } diff --git a/packages/apps/src/Content/Status.tsx b/packages/apps/src/Content/Status.tsx index 34324afbea..cb9e58f336 100644 --- a/packages/apps/src/Content/Status.tsx +++ b/packages/apps/src/Content/Status.tsx @@ -3,13 +3,13 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { EventRecord } from '@polkadot/types/interfaces'; import { KeyringOptions } from '@polkadot/ui-keyring/options/types'; import { QueueStatus, QueueTx, QueueAction$Add } from '@polkadot/ui-app/Status/types'; import { I18nProps } from '@polkadot/ui-app/types'; import React from 'react'; import keyringOption from '@polkadot/ui-keyring/options'; -import { EventRecord } from '@polkadot/types'; import { Status as StatusDisplay } from '@polkadot/ui-app'; import { withCalls, withMulti, withObservable } from '@polkadot/ui-api'; import { stringToU8a } from '@polkadot/util'; diff --git a/packages/apps/src/SideBar/Item.tsx b/packages/apps/src/SideBar/Item.tsx index ece0dfa176..8f261f01a2 100644 --- a/packages/apps/src/SideBar/Item.tsx +++ b/packages/apps/src/SideBar/Item.tsx @@ -25,6 +25,8 @@ type Props = I18nProps & ApiProps & { }; class Item extends React.PureComponent { + private _disabledLog: Map = new Map(); + public render (): React.ReactNode { const { route: { Modal, i18n, icon, name }, t, isCollapsed, onClick } = this.props; @@ -78,6 +80,14 @@ class Item extends React.PureComponent { ); } + private logDisabled (route: string, message: string): void { + if (!this._disabledLog.get(route)) { + this._disabledLog.set(route, message); + + console.warn(`Disabling ${route}: ${message}`); + } + } + private hasApi (endpoint: string): boolean { const { api } = this.props; const [area, section, method] = endpoint.split('.'); @@ -104,7 +114,7 @@ class Item extends React.PureComponent { return false; } else if (needsSudo) { if (!hasSudo) { - console.info('Disabling route sudo, no authority'); + this.logDisabled('sudo', 'Sudo key not available'); return false; } } @@ -118,7 +128,7 @@ class Item extends React.PureComponent { }); if (notFound.length !== 0) { - console.info(`Disabling route ${name}, API ${notFound} not available`); + this.logDisabled(name, `API not available: ${notFound}`); } return notFound.length === 0; diff --git a/packages/ui-api/package.json b/packages/ui-api/package.json index 2a9fd3f677..4708867e6f 100644 --- a/packages/ui-api/package.json +++ b/packages/ui-api/package.json @@ -31,8 +31,8 @@ "homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme", "dependencies": { "@babel/runtime": "^7.5.5", - "@polkadot/api": "^0.82.0-beta.95", - "@polkadot/extension-dapp": "^0.5.0-beta.5", + "@polkadot/api": "^0.90.0-beta.1", + "@polkadot/extension-dapp": "^0.5.1", "rxjs-compat": "^6.4.0" } } diff --git a/packages/ui-api/src/Api.tsx b/packages/ui-api/src/Api.tsx index 488ffed38f..c5b763ffc2 100644 --- a/packages/ui-api/src/Api.tsx +++ b/packages/ui-api/src/Api.tsx @@ -3,6 +3,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { ProviderInterface } from '@polkadot/rpc-provider/types'; +import { ChainProperties } from '@polkadot/types/interfaces'; import { QueueTxPayloadAdd, QueueTxMessageSetStatus } from '@polkadot/ui-app/Status/types'; import { Prefix } from '@polkadot/util-crypto/address/types'; import { ApiProps } from './types'; @@ -16,7 +17,7 @@ import { InputNumber } from '@polkadot/ui-app/InputNumber'; import keyring from '@polkadot/ui-keyring'; import uiSettings from '@polkadot/ui-settings'; import ApiSigner from '@polkadot/ui-signer/ApiSigner'; -import { ChainProperties, Text } from '@polkadot/types'; +import { createType, Text } from '@polkadot/types'; import { formatBalance, isTestChain } from '@polkadot/util'; import ApiContext from './ApiContext'; @@ -107,13 +108,16 @@ export default class Api extends React.PureComponent { } private async loadOnReady (api: ApiPromise): Promise { - const [properties = new ChainProperties(), value] = await Promise.all([ + const [properties = createType('ChainProperties'), value] = await Promise.all([ api.rpc.system.properties(), api.rpc.system.chain() ]); - const addressPrefix = uiSettings.prefix === -1 - ? properties.get('networkId') - : uiSettings.prefix as Prefix; + const addressPrefix = ( + uiSettings.prefix === -1 + ? 42 + : uiSettings.prefix + ) as Prefix; + const tokenSymbol = properties.tokenSymbol.toString() || 'Unit'; const chain = value ? value.toString() : null; @@ -132,10 +136,10 @@ export default class Api extends React.PureComponent { // first setup the UI helpers formatBalance.setDefaults({ - decimals: properties.tokenDecimals, - unit: properties.tokenSymbol + decimals: properties.tokenDecimals.toNumber(), + unit: tokenSymbol }); - InputNumber.setUnit(properties.tokenSymbol); + InputNumber.setUnit(tokenSymbol); // finally load the keyring keyring.loadAll({ diff --git a/packages/ui-app/package.json b/packages/ui-app/package.json index 20fa26ec80..8a5c70d271 100644 --- a/packages/ui-app/package.json +++ b/packages/ui-app/package.json @@ -11,12 +11,12 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.5.5", - "@polkadot/keyring": "^0.95.0-beta.0", + "@polkadot/keyring": "^0.95.0-beta.2", + "@polkadot/react-identicon": "^0.42.0-beta.19", "@polkadot/ui-api": "^0.34.0-beta.87", - "@polkadot/ui-identicon": "^0.42.0-beta.16", - "@polkadot/ui-keyring": "^0.42.0-beta.16", + "@polkadot/ui-keyring": "^0.42.0-beta.19", "@polkadot/ui-reactive": "^0.34.0-beta.87", - "@polkadot/ui-settings": "^0.42.0-beta.16", + "@polkadot/ui-settings": "^0.42.0-beta.19", "@types/chart.js": "^2.7.55", "@types/i18next": "^12.1.0", "@types/react-copy-to-clipboard": "^4.2.6", diff --git a/packages/ui-app/src/ActionItem.tsx b/packages/ui-app/src/ActionItem.tsx index d1ace85f9e..574b04ba7b 100644 --- a/packages/ui-app/src/ActionItem.tsx +++ b/packages/ui-app/src/ActionItem.tsx @@ -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 { Proposal } from '@polkadot/types'; +import { Proposal } from '@polkadot/types/interfaces'; import BN from 'bn.js'; import React from 'react'; diff --git a/packages/ui-app/src/AddressInfo.tsx b/packages/ui-app/src/AddressInfo.tsx index d7d6ef8ea0..933ede9bca 100644 --- a/packages/ui-app/src/AddressInfo.tsx +++ b/packages/ui-app/src/AddressInfo.tsx @@ -255,8 +255,9 @@ class AddressInfo extends React.PureComponent { {validatorPrefsDisplay.validatorPayment && staking_info.validatorPrefs.validatorPayment && ( <>