Input Uknown types as hex (underlying) (#1551)
This commit is contained in:
parent
fb4856d1f9
commit
cc2f442245
@ -12,6 +12,7 @@ import { hexToU8a, isHex, u8aToHex } from '@polkadot/util';
|
||||
import Bare from './Bare';
|
||||
|
||||
interface Props extends BaseProps {
|
||||
asHex?: boolean;
|
||||
children?: React.ReactNode;
|
||||
length?: number;
|
||||
size?: Size;
|
||||
@ -59,7 +60,7 @@ export default class BaseBytes extends React.PureComponent<Props> {
|
||||
}
|
||||
|
||||
private onChange = (hex: string): void => {
|
||||
const { length = -1, onChange, validate = defaultValidate, withLength } = this.props;
|
||||
const { asHex, length = -1, onChange, validate = defaultValidate, withLength } = this.props;
|
||||
|
||||
let value: Uint8Array;
|
||||
let isValid = true;
|
||||
@ -83,7 +84,9 @@ export default class BaseBytes extends React.PureComponent<Props> {
|
||||
|
||||
onChange && onChange({
|
||||
isValid,
|
||||
value
|
||||
value: asHex
|
||||
? u8aToHex(value)
|
||||
: value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ export default class Unknown extends React.PureComponent<Props> {
|
||||
|
||||
return (
|
||||
<BaseBytes
|
||||
asHex
|
||||
className={className}
|
||||
defaultValue={defaultValue}
|
||||
isDisabled={isDisabled}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user