ghost-portal/packages/app-explorer/src/BestHash.js
Jaco Greeff 19495e590e
Use ui-react-rx & api-rx packages (#27)
* Use ui-react-rx & api-rx packages

* Install
2018-05-07 12:54:51 +02:00

20 lines
630 B
JavaScript

// Copyright 2017-2018 Jaco Greeff
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
// @flow
import type { Header } from '@polkadot/primitives/header';
import headerHash from '@polkadot/primitives-codec/header/hash';
import withApiDiv from '@polkadot/ui-react-rx/with/apiDiv';
import u8aToHexShort from '@polkadot/util/u8a/toHexShort';
export default withApiDiv({ name: 'newHead', section: 'chain' })(
(value?: Header): ?string => {
return value
? u8aToHexShort(headerHash(value))
: value;
},
{ className: 'explorer--BestHash' }
);