ghost-portal/packages/react-params/src/Param/OpaqueCall.tsx
Jaco Greeff a0b82d88a4
Use import type { ... } (#4052)
* Use import type { ... }

* value imports

* TypeDefInfo

* Apply suggestions from code review

* fixes... am going blind.
2020-11-19 16:20:14 +01:00

30 lines
678 B
TypeScript

// Copyright 2017-2020 @polkadot/react-params authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Props } from '../types';
import type { Bytes } from '@polkadot/types';
import React from 'react';
import CallDisplay from './Call';
import Unknown from './Unknown';
function OpaqueCall (props: Props): React.ReactElement<Props> {
if (!props.isDisabled) {
return (
<Unknown {...props} />
);
}
const value = props.registry.createType('Call', (props.defaultValue.value as Bytes).toHex());
return (
<CallDisplay
{...props}
defaultValue={{ isValid: true, value }}
/>
);
}
export default React.memo(OpaqueCall);