Nonce.tsx 922 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2017-2020 @polkadot/react-components authors & contributors
  2. // This software may be modified and distributed under the terms
  3. // of the Apache-2.0 license. See the LICENSE file for details.
  4. import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
  5. import { BareProps } from './types';
  6. import React from 'react';
  7. import { Nonce } from '@polkadot/react-query';
  8. import { classes } from './util';
  9. export interface Props extends BareProps {
  10. label?: React.ReactNode;
  11. params?: AccountId | AccountIndex | Address | string | Uint8Array | null;
  12. }
  13. function NonceDisplay ({ className, label, params, style }: Props): React.ReactElement<Props> | null {
  14. if (!params) {
  15. return null;
  16. }
  17. return (
  18. <Nonce
  19. className={classes('ui--Nonce', className)}
  20. label={label}
  21. params={params.toString()}
  22. style={style}
  23. />
  24. );
  25. }
  26. export default React.memo(NonceDisplay);