ghost-portal/packages/ui-reactive/src/Nonce.tsx
Jaco Greeff eb0abb8307
Cleanup api call usage (#617)
* Rename apiPromise -> api

* First attemp at React render component (unused)

* Cleanup api call usage

* Cleanup linting

* Remove render component

* Adjustments on HOC types (& usage)
2019-01-18 23:04:13 +01:00

39 lines
1008 B
TypeScript

// 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 { BareProps, CallProps } from '@polkadot/ui-api/types';
import React from 'react';
import { Index } from '@polkadot/types';
import { withCall } from '@polkadot/ui-api/index';
import { numberFormat } from './util/index';
type Props = BareProps & CallProps & {
children?: React.ReactNode,
label?: string,
system_accountNonce?: Index
};
class Nonce extends React.PureComponent<Props> {
render () {
const { children, className, label = '', style, system_accountNonce } = this.props;
return (
<div
className={className}
style={style}
>
{label}{
system_accountNonce
? numberFormat(system_accountNonce)
: '0'
}{children}
</div>
);
}
}
export default withCall('query.system.accountNonce')(Nonce);