diff --git a/packages/app-democracy/package.json b/packages/app-democracy/package.json index ccc78ab736..b4ee912fbd 100644 --- a/packages/app-democracy/package.json +++ b/packages/app-democracy/package.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "@babel/runtime": "^7.0.0-rc.1", - "@polkadot/storage": "^0.28.16", + "@polkadot/storage": "^0.28.17", "@polkadot/ui-react": "^0.19.36", "@polkadot/ui-react-rx": "^0.19.36", "@polkadot/util-keyring": "^0.28.3" diff --git a/packages/app-example/package.json b/packages/app-example/package.json index e81f37e01f..2c2487719d 100644 --- a/packages/app-example/package.json +++ b/packages/app-example/package.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "@babel/runtime": "^7.0.0-rc.1", - "@polkadot/storage": "^0.28.16", + "@polkadot/storage": "^0.28.17", "@polkadot/ui-react": "^0.19.36", "@polkadot/ui-react-rx": "^0.19.36", "@polkadot/util-keyring": "^0.28.3" diff --git a/packages/app-explorer/package.json b/packages/app-explorer/package.json index 62093a7fab..416246970e 100644 --- a/packages/app-explorer/package.json +++ b/packages/app-explorer/package.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "@babel/runtime": "^7.0.0-rc.1", - "@polkadot/primitives": "^0.28.16", + "@polkadot/primitives": "^0.28.17", "@polkadot/ui-app": "^0.19.36", "@polkadot/util-crypto": "^0.28.3" } diff --git a/packages/app-explorer/src/BlockByHash/BlockByHash.tsx b/packages/app-explorer/src/BlockByHash/BlockByHash.tsx index c39a1523d4..0fac2de8cc 100644 --- a/packages/app-explorer/src/BlockByHash/BlockByHash.tsx +++ b/packages/app-explorer/src/BlockByHash/BlockByHash.tsx @@ -2,37 +2,53 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import { BareProps } from '@polkadot/ui-app/types'; +import { BlockDecoded } from '@polkadot/params/types'; +import { I18nProps } from '@polkadot/ui-app/types'; import { ApiProps } from '@polkadot/ui-react-rx/types'; import React from 'react'; +import withMulti from '@polkadot/ui-react-rx/with/multi'; import withObservable from '@polkadot/ui-react-rx/with/observable'; import AddressMini from '@polkadot/ui-app/AddressMini'; import Card from '@polkadot/ui-app/Card'; import Extrinsic from '@polkadot/ui-app/Extrinsic'; +import numberFormat from '@polkadot/ui-react-rx/util/numberFormat'; +import isBn from '@polkadot/util/is/bn'; +import isHex from '@polkadot/util/is/hex'; +import isU8a from '@polkadot/util/is/u8a'; +import u8aToHex from '@polkadot/util/u8a/toHex'; import BlockHeader from '../BlockHeader'; -import isHex from '@polkadot/util/is/hex'; +import translate from '../translate'; -type Props = ApiProps & BareProps & { - chainGetBlock: any, +type Props = ApiProps & I18nProps & { + chainGetBlock: BlockDecoded, value: string }; +function debugJSON (key: string, value: any) { + return isU8a(value) + ? u8aToHex(value) + : ( + isBn(value) + ? value.toString() + : value + ); +} + // FIXME Duplicated layout here and in democracy, clean up with extrinsics class BlockByHash extends React.PureComponent { render () { - const { chainGetBlock, value } = this.props; + const { chainGetBlock } = this.props; if (!chainGetBlock) { return null; } - const { extrinsics, header } = chainGetBlock; + const { header } = chainGetBlock; // TODO Remove, debug info for reverse-engineering - console.log('hash=', value); - console.log('block=', chainGetBlock); + console.log(JSON.stringify(chainGetBlock, debugJSON)); return (
@@ -40,7 +56,22 @@ class BlockByHash extends React.PureComponent { value={header} withExtrinsics /> -
+ {this.renderExtrinsics()} + {this.renderJustification()} +
+ ); + } + + private renderExtrinsics () { + const { chainGetBlock, t, value } = this.props; + const { extrinsics } = chainGetBlock; + + return ( +
+

{t('block.extrinsics', { + defaultValue: 'extrinsics' + })}

+
{extrinsics.map((extrinsic: any, index: number) => (
{ {extrinsic.extrinsic.description}
- {isHex(extrinsic.address) +
{isHex(extrinsic.address) ? extrinsic.address : - } + }
+
{t('block.nonce', { + defaultValue: 'index' + })} {numberFormat(extrinsic.nonce)}
@@ -69,6 +103,37 @@ class BlockByHash extends React.PureComponent {
); } + + private renderJustification () { + const { chainGetBlock, t, value } = this.props; + const { justification } = chainGetBlock; + + return ( +
+

{t('block.justifications', { + defaultValue: 'justifications' + })}

+
+ {justification.signatures.map(({ address, signature }) => ( +
+ + + {u8aToHex(signature, 64)} + + +
+ ))} +
+
+ ); + } } -export default withObservable('chainGetBlock', { paramProp: 'value' })(BlockByHash); +export default withMulti( + BlockByHash, + translate, + withObservable('chainGetBlock', { paramProp: 'value' }) +); diff --git a/packages/app-explorer/src/BlockByHash/index.tsx b/packages/app-explorer/src/BlockByHash/index.tsx index 6568ef66cd..b4e2cd0977 100644 --- a/packages/app-explorer/src/BlockByHash/index.tsx +++ b/packages/app-explorer/src/BlockByHash/index.tsx @@ -25,7 +25,10 @@ export default class Entry extends React.PureComponent { } return ( - + ); } } diff --git a/packages/app-explorer/src/BlockHeader/index.tsx b/packages/app-explorer/src/BlockHeader/index.tsx index 1287e424db..570e3e4537 100644 --- a/packages/app-explorer/src/BlockHeader/index.tsx +++ b/packages/app-explorer/src/BlockHeader/index.tsx @@ -38,6 +38,7 @@ class BlockHeader extends React.PureComponent { // tslint:disable-next-line:variable-name const { extrinsicsRoot, number, parentHash, stateRoot } = value; const hashHex = u8aToHex(hash); + const parentHex = u8aToHex(parentHash); const linkable = withLink ? {hashHex} : hashHex; @@ -59,7 +60,9 @@ class BlockHeader extends React.PureComponent { parentHash - {u8aToHex(parentHash)} + + {parentHex} + diff --git a/packages/app-explorer/src/index.css b/packages/app-explorer/src/index.css index 0636665e38..f1e3093789 100644 --- a/packages/app-explorer/src/index.css +++ b/packages/app-explorer/src/index.css @@ -30,10 +30,14 @@ text-align: right; } -.explorer--BlockByHash-extrinsics { +.explorer--BlockByHash-extrinsics, +.explorer--BlockByHash-justification { + margin-top: 2em; +} + +.explorer--BlockByHash-flexable { display: flex; flex-wrap: wrap; - margin-top: 2em; } .explorer--BlockByHash-extrinsic { @@ -55,10 +59,23 @@ line-height: 1.2rem; } +.explorer--BlockByHash-accountIndex { + font-size: .75rem; + margin-top: -0.5rem; + opacity: 0.45; + text-align: right; +} + +.explorer--BlockByHash-justification-signature span { + color: rgba(0, 0, 0, 0.6); + font-style: italic; + padding-left: 0.5rem; +} + .explorer--BlockByHash-header-right { position: absolute; - top: 0em; - right: 1em; + top: -0.5rem; + right: 0rem; } .explorer--Summary { diff --git a/packages/app-extrinsics/package.json b/packages/app-extrinsics/package.json index c6c9ada19f..03cc09ae4b 100644 --- a/packages/app-extrinsics/package.json +++ b/packages/app-extrinsics/package.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "@babel/runtime": "^7.0.0-rc.1", - "@polkadot/extrinsics": "^0.28.16", + "@polkadot/extrinsics": "^0.28.17", "@polkadot/ui-app": "^0.19.36", "@polkadot/ui-signer": "^0.19.36", "react-dropzone": "^4.3.0" diff --git a/packages/app-staking/package.json b/packages/app-staking/package.json index 4d3bbc57c8..89613e6419 100644 --- a/packages/app-staking/package.json +++ b/packages/app-staking/package.json @@ -12,7 +12,7 @@ "dependencies": { "@babel/runtime": "^7.0.0-rc.1", "@polkadot/app-extrinsics": "^0.19.36", - "@polkadot/storage": "^0.28.16", + "@polkadot/storage": "^0.28.17", "@polkadot/ui-app": "^0.19.36", "@polkadot/ui-keyring": "^0.19.36", "@polkadot/ui-react": "^0.19.36", diff --git a/packages/apps/src/SideBar/SideBar.css b/packages/apps/src/SideBar/SideBar.css index 9b6c06d9ec..b3b22caaa6 100644 --- a/packages/apps/src/SideBar/SideBar.css +++ b/packages/apps/src/SideBar/SideBar.css @@ -5,7 +5,7 @@ .apps--SideBar { background: #f9f9f9; flex-shrink: 0; - min-width: 12em; + min-width: 10em; padding: 0.75em 0 0 0.75em; position: relative; text-align: left; @@ -13,6 +13,7 @@ .apps--SideBar .ui.vertical.menu { margin: 0; + width: 13em; } .apps--SideBar-github { diff --git a/packages/ui-app/package.json b/packages/ui-app/package.json index 9459498896..335eb59059 100644 --- a/packages/ui-app/package.json +++ b/packages/ui-app/package.json @@ -11,8 +11,8 @@ "license": "ISC", "dependencies": { "@babel/runtime": "^7.0.0-rc.1", - "@polkadot/extrinsics": "^0.28.16", - "@polkadot/storage": "^0.28.16", + "@polkadot/extrinsics": "^0.28.17", + "@polkadot/storage": "^0.28.17", "@polkadot/ui-keyring": "^0.19.36", "@polkadot/ui-react": "^0.19.36", "@polkadot/ui-react-rx": "^0.19.36", diff --git a/packages/ui-app/src/AddressMini.tsx b/packages/ui-app/src/AddressMini.tsx index 9057eead39..318e104f5f 100644 --- a/packages/ui-app/src/AddressMini.tsx +++ b/packages/ui-app/src/AddressMini.tsx @@ -14,6 +14,7 @@ import Balance from './Balance'; type Props = BareProps & { balance?: BN | Array, + children?: React.ReactNode, isPadded?: boolean, isShort?: boolean, value?: string, @@ -22,7 +23,7 @@ type Props = BareProps & { export default class AddressMini extends React.PureComponent { render () { - const { className, isPadded = true, isShort = true, style, value } = this.props; + const { children, className, isPadded = true, isShort = true, style, value } = this.props; if (!value) { return null; @@ -39,6 +40,7 @@ export default class AddressMini extends React.PureComponent { value={value} />
{isShort ? toShortAddress(value) : value}
+ {children}
{this.renderBalance()} diff --git a/packages/ui-app/src/CardSummary.tsx b/packages/ui-app/src/CardSummary.tsx index 80ed3001ad..a388f2e8b9 100644 --- a/packages/ui-app/src/CardSummary.tsx +++ b/packages/ui-app/src/CardSummary.tsx @@ -28,6 +28,13 @@ type Props = BareProps & { export default class CardSummary extends React.PureComponent { render () { const { children, className, progress, label, style } = this.props; + const left = progress && !isUndefined(progress.value) && !isUndefined(progress.total) && progress.value.gten(0) && progress.total.gtn(0) + ? ( + progress.value.gt(progress.total) + ? `>${progress.total.toString()}` + : progress.value.toString() + ) + : undefined; return ( {
{children}{ progress && ( - (isUndefined(progress.value) || isUndefined(progress.total) || progress.value.ltn(0)) || progress.value.gt(progress.total) || progress.total.eqn(0) + !left || isUndefined(progress.total) ? '-' - : `${progress.value.toString()}/${progress.total.toString()}` + : `${left}/${progress.total.toString()}` ) }
diff --git a/packages/ui-react-rx/package.json b/packages/ui-react-rx/package.json index 10e65ff4c7..1eb2a7dbfd 100644 --- a/packages/ui-react-rx/package.json +++ b/packages/ui-react-rx/package.json @@ -31,9 +31,9 @@ "homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-react-rx#readme", "dependencies": { "@babel/runtime": "^7.0.0-rc.1", - "@polkadot/api-rx": "^0.28.16", - "@polkadot/extrinsics": "^0.28.16", - "@polkadot/storage": "^0.28.16", + "@polkadot/api-rx": "^0.28.17", + "@polkadot/extrinsics": "^0.28.17", + "@polkadot/storage": "^0.28.17", "rxjs-compat": "^6.2.2" }, "devDependencies": { diff --git a/packages/ui-react-rx/src/ApiObservable/index.ts b/packages/ui-react-rx/src/ApiObservable/index.ts index 51e3525e9d..dfe7155ef2 100644 --- a/packages/ui-react-rx/src/ApiObservable/index.ts +++ b/packages/ui-react-rx/src/ApiObservable/index.ts @@ -5,7 +5,7 @@ import { Header } from '@polkadot/primitives/header'; import { RxApiInterface, RxApiInterface$Method } from '@polkadot/api-rx/types'; import { Interfaces } from '@polkadot/jsonrpc/types'; -import { ExtrinsicDecoded, SectionItem } from '@polkadot/params/types'; +import { BlockDecoded, ExtrinsicDecoded, SectionItem } from '@polkadot/params/types'; import { Storages } from '@polkadot/storage/types'; import { RxBalance, RxBalanceMap, RxProposal, RxProposalDeposits, RxReferendum, ObservableApiInterface, KeyWithParams, RxReferendumVote } from './types'; @@ -88,7 +88,7 @@ export default class ObservableApi implements ObservableApiInterface { ); } - chainGetBlock = (hash: Uint8Array): Observable => { + chainGetBlock = (hash: Uint8Array): Observable => { return this.api.chain.getBlock(hash); } diff --git a/packages/ui-react-rx/src/ApiObservable/types.d.ts b/packages/ui-react-rx/src/ApiObservable/types.d.ts index abb00c14bd..5b32be7348 100644 --- a/packages/ui-react-rx/src/ApiObservable/types.d.ts +++ b/packages/ui-react-rx/src/ApiObservable/types.d.ts @@ -5,7 +5,7 @@ import BN from 'bn.js'; import { Observable } from 'rxjs'; import { Interfaces } from '@polkadot/jsonrpc/types'; -import { ExtrinsicDecoded, SectionItem } from '@polkadot/params/types'; +import { BlockDecoded, ExtrinsicDecoded, SectionItem } from '@polkadot/params/types'; import { Header } from '@polkadot/primitives/header'; import { Storages } from '@polkadot/storage/types'; @@ -54,7 +54,7 @@ export interface ObservableApiInterface { rawStorage: (key: SectionItem, ...params: Array) => Observable, rawStorageMulti: (...keys: Array<[SectionItem, any]>) => Observable, bestNumber: () => Observable, - chainGetBlock: (hash: Uint8Array) => Observable, + chainGetBlock: (hash: Uint8Array) => Observable, chainNewHead: () => Observable
, democracyLaunchPeriod: () => Observable, democracyNextTally: () => Observable, diff --git a/packages/ui-react/src/Elapsed.tsx b/packages/ui-react/src/Elapsed.tsx index 8afb6060cf..2c45133a12 100644 --- a/packages/ui-react/src/Elapsed.tsx +++ b/packages/ui-react/src/Elapsed.tsx @@ -70,8 +70,10 @@ export default class Elapsed extends React.PureComponent { display = `${elapsed.toFixed(1)}s`; } else if (elapsed < 60) { display = `${elapsed | 0}s`; + } else if (elapsed < 3600) { + display = `${elapsed / 60 | 0}m`; } else { - display = `${ elapsed / 60 | 0}m`; + display = `${elapsed / 3600 | 0}h`; } } diff --git a/packages/ui-signer/package.json b/packages/ui-signer/package.json index 111e6a2059..68bebfd3f4 100644 --- a/packages/ui-signer/package.json +++ b/packages/ui-signer/package.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "@babel/runtime": "^7.0.0-rc.1", - "@polkadot/extrinsics": "^0.28.16", + "@polkadot/extrinsics": "^0.28.17", "@polkadot/ui-app": "^0.19.36", "@polkadot/ui-keyring": "^0.19.36" }, diff --git a/yarn.lock b/yarn.lock index af2ecb38bd..13b8f9d8bd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1291,22 +1291,22 @@ version "1.1.0" resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.0.tgz#50c1e2260ac0ed9439a181de3725a0168d59c48a" -"@polkadot/api-format@^0.28.16": - version "0.28.16" - resolved "https://registry.yarnpkg.com/@polkadot/api-format/-/api-format-0.28.16.tgz#3642cac8f22b8af25715b2d6c27eee5c89982efa" +"@polkadot/api-format@^0.28.17": + version "0.28.17" + resolved "https://registry.yarnpkg.com/@polkadot/api-format/-/api-format-0.28.17.tgz#b7fe73bf6e984842a1c419e93b30745108138b84" dependencies: "@babel/runtime" "^7.0.0-rc.1" - "@polkadot/jsonrpc" "^0.28.16" - "@polkadot/primitives" "^0.28.16" + "@polkadot/jsonrpc" "^0.28.17" + "@polkadot/primitives" "^0.28.17" "@polkadot/util" "^0.28.3" "@polkadot/util-keyring" "^0.28.3" -"@polkadot/api-provider@^0.28.16": - version "0.28.16" - resolved "https://registry.yarnpkg.com/@polkadot/api-provider/-/api-provider-0.28.16.tgz#2c4073dfa86bb426371da5e2e29614785db373e5" +"@polkadot/api-provider@^0.28.17": + version "0.28.17" + resolved "https://registry.yarnpkg.com/@polkadot/api-provider/-/api-provider-0.28.17.tgz#8b178db819588e6a49568d1904b4cf1de309415b" dependencies: "@babel/runtime" "^7.0.0-rc.1" - "@polkadot/storage" "^0.28.16" + "@polkadot/storage" "^0.28.17" "@polkadot/util" "^0.28.3" "@polkadot/util-crypto" "^0.28.3" "@polkadot/util-keyring" "^0.28.3" @@ -1315,25 +1315,25 @@ isomorphic-fetch "^2.2.1" websocket "^1.0.25" -"@polkadot/api-rx@^0.28.16": - version "0.28.16" - resolved "https://registry.yarnpkg.com/@polkadot/api-rx/-/api-rx-0.28.16.tgz#fc8ff96815a57f5224490bcda3e4d0b80c98a579" +"@polkadot/api-rx@^0.28.17": + version "0.28.17" + resolved "https://registry.yarnpkg.com/@polkadot/api-rx/-/api-rx-0.28.17.tgz#6a42cca37df8bda5fdf8268a1cc3134b24f22eee" dependencies: "@babel/runtime" "^7.0.0-rc.1" - "@polkadot/api" "^0.28.16" - "@polkadot/api-provider" "^0.28.16" + "@polkadot/api" "^0.28.17" + "@polkadot/api-provider" "^0.28.17" "@types/rx" "^4.1.1" rxjs "^6.2.2" -"@polkadot/api@^0.28.16": - version "0.28.16" - resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.28.16.tgz#44ff0f39925bf9d0d31b1914691eb25a0052770f" +"@polkadot/api@^0.28.17": + version "0.28.17" + resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.28.17.tgz#44184dfb62ab82463effac777968cbbbda0270f3" dependencies: "@babel/runtime" "^7.0.0-rc.1" - "@polkadot/api-format" "^0.28.16" - "@polkadot/api-provider" "^0.28.16" - "@polkadot/jsonrpc" "^0.28.16" - "@polkadot/params" "^0.28.16" + "@polkadot/api-format" "^0.28.17" + "@polkadot/api-provider" "^0.28.17" + "@polkadot/jsonrpc" "^0.28.17" + "@polkadot/params" "^0.28.17" "@polkadot/util" "^0.28.3" "@polkadot/dev-react@^0.20.16": @@ -1401,48 +1401,48 @@ typedoc "^0.11.1" typescript "^3.0.1" -"@polkadot/extrinsics@^0.28.16": - version "0.28.16" - resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.28.16.tgz#d94a49de59ec7686db6c2e1dd80a0e10c4cbb199" +"@polkadot/extrinsics@^0.28.17": + version "0.28.17" + resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.28.17.tgz#d66777e6dbeb38dcad204aa29f2d75d0b6fa5682" dependencies: "@babel/runtime" "^7.0.0-rc.1" - "@polkadot/params" "^0.28.16" - "@polkadot/primitives" "^0.28.16" + "@polkadot/params" "^0.28.17" + "@polkadot/primitives" "^0.28.17" "@polkadot/util" "^0.28.3" -"@polkadot/jsonrpc@^0.28.16": - version "0.28.16" - resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.28.16.tgz#cf60e160e53aec10eb5cc605e16d8af3182ff344" +"@polkadot/jsonrpc@^0.28.17": + version "0.28.17" + resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.28.17.tgz#5f653e0de344c60ad6cac0a7f1420e900b265adc" dependencies: - "@polkadot/params" "^0.28.16" + "@polkadot/params" "^0.28.17" babel-runtime "^6.26.0" -"@polkadot/params@^0.28.16": - version "0.28.16" - resolved "https://registry.yarnpkg.com/@polkadot/params/-/params-0.28.16.tgz#79422f73266fb317e0327f5ce2c5d1303d883e93" +"@polkadot/params@^0.28.17": + version "0.28.17" + resolved "https://registry.yarnpkg.com/@polkadot/params/-/params-0.28.17.tgz#9eb493a8cff8961f977e1767edfb9a773fbc2221" dependencies: "@babel/runtime" "^7.0.0-rc.1" - "@polkadot/extrinsics" "^0.28.16" - "@polkadot/params" "^0.28.16" - "@polkadot/primitives" "^0.28.16" + "@polkadot/extrinsics" "^0.28.17" + "@polkadot/params" "^0.28.17" + "@polkadot/primitives" "^0.28.17" "@polkadot/util" "^0.28.3" "@polkadot/util-keyring" "^0.28.3" -"@polkadot/primitives@^0.28.16": - version "0.28.16" - resolved "https://registry.yarnpkg.com/@polkadot/primitives/-/primitives-0.28.16.tgz#e44774c077ee3446bd26ac72e09f455ec6d34375" +"@polkadot/primitives@^0.28.17": + version "0.28.17" + resolved "https://registry.yarnpkg.com/@polkadot/primitives/-/primitives-0.28.17.tgz#4cd35c3a68990156dbb0490fa55c271aa44dfc79" dependencies: "@babel/runtime" "^7.0.0-rc.1" "@polkadot/trie-hash" "^0.28.3" "@polkadot/util" "^0.28.3" -"@polkadot/storage@^0.28.16": - version "0.28.16" - resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.28.16.tgz#7207d8a5aa4b21ecd31183ab734a8087458b7a85" +"@polkadot/storage@^0.28.17": + version "0.28.17" + resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.28.17.tgz#3e00d7a22a0fdd8f117144c3dcaf115d6c4407f2" dependencies: "@babel/runtime" "^7.0.0-rc.1" - "@polkadot/params" "^0.28.16" - "@polkadot/primitives" "^0.28.16" + "@polkadot/params" "^0.28.17" + "@polkadot/primitives" "^0.28.17" "@polkadot/util" "^0.28.3" "@polkadot/util-crypto" "^0.28.3" "@polkadot/util-keyring" "^0.28.3"