BestHash.tsx 692 B

12345678910111213141516171819
  1. // Copyright 2017-2018 @polkadot/app-explorer authors & contributors
  2. // This software may be modified and distributed under the terms
  3. // of the ISC license. See the LICENSE file for details.
  4. import { Header } from '@polkadot/primitives/header';
  5. import headerHash from '@polkadot/primitives-codec/header/hash';
  6. import withApiDiv from '@polkadot/ui-react-rx/with/apiDiv';
  7. import u8aToHex from '@polkadot/util/u8a/toHex';
  8. const Component: React.ComponentType<any> = withApiDiv({ name: 'newHead', section: 'chain' })(
  9. (value?: Header): string | undefined =>
  10. value
  11. ? u8aToHex(headerHash(value), 64)
  12. : value,
  13. { className: 'explorer--BestHash' }
  14. );
  15. export default Component;