ghost-portal/packages/app-explorer/src/BestHash.tsx
Jaco Greeff b4de745cda
Support latest api (with dynamic types) (#1447)
* Make a start, halfway down with issues found...

* Around  80% through untangling  the linter

* Seems linted...

* Adjust latest

* Update for latest (Moment -> u64)

* Method -> Call

* Bump api from npm

* formatNumber (no unwrap needed)

* Update to latest ui packages

* Revert internal version downgrades
2019-07-29 12:24:43 +02:00

37 lines
1.0 KiB
TypeScript

/* eslint-disable @typescript-eslint/camelcase */
// Copyright 2017-2019 @polkadot/ui-reactive authors & contributors
// 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 { withCalls } from '@polkadot/ui-api';
type Props = BareProps & CallProps & {
label?: string;
chain_subscribeNewHead?: Header;
};
class BestHash extends React.PureComponent<Props> {
public render (): React.ReactNode {
const { className, label = '', style, chain_subscribeNewHead } = this.props;
return (
<div
className={className}
style={style}
>
{label}{
chain_subscribeNewHead
? chain_subscribeNewHead.hash.toHex()
: undefined
}
</div>
);
}
}
export default withCalls<Props>('rpc.chain.subscribeNewHead')(BestHash);