import React from 'react'; import Help from 'components/ui/Help'; import { isPositiveInteger } from 'utils/helpers'; interface PublicProps { placeholder: string; value: number | null | undefined; onChange(value: number): void; } const isValidNonce = (value: string | null | undefined) => { let valid; if (value === '0') { valid = true; } else if (!value) { valid = false; } else { valid = isPositiveInteger(parseInt(value, 10)); } return valid; }; export default class NonceField extends React.Component { public render() { const { placeholder, value } = this.props; const strValue = value ? value.toString() : ''; return (
); } private onChange = (e: any) => { this.props.onChange(e.target.value); }; }