Convert to @polkadot/param formatters (#49)
* Convert to @polkadot/param formatters * WIP * Renderinbg operational * Update with checks * Show 'empty' with no array values * Pass-through label properly * Pass through isDisabled property
This commit is contained in:
parent
92cc9c2add
commit
a940292287
@ -11,9 +11,9 @@
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/primitives": "^0.12.9",
|
||||
"@polkadot/primitives-codec": "^0.12.9",
|
||||
"@polkadot/primitives-json": "^0.12.9",
|
||||
"@polkadot/primitives": "^0.13.8",
|
||||
"@polkadot/primitives-codec": "^0.13.8",
|
||||
"@polkadot/primitives-json": "^0.13.8",
|
||||
"@polkadot/ui-app": "^0.4.11",
|
||||
"@polkadot/util-crypto": "^0.19.6"
|
||||
}
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/extrinsics": "^0.12.9",
|
||||
"@polkadot/extrinsics-codec": "^0.12.9",
|
||||
"@polkadot/extrinsics": "^0.13.8",
|
||||
"@polkadot/extrinsics-codec": "^0.13.8",
|
||||
"@polkadot/ui-app": "^0.4.11",
|
||||
"react-dropzone": "^4.2.9"
|
||||
}
|
||||
|
||||
@ -20,7 +20,8 @@ type Props = I18nProps & {
|
||||
isInput?: boolean,
|
||||
label: string,
|
||||
onChange: (publicKey: Uint8Array) => void,
|
||||
type?: KeyringOption$Type
|
||||
type?: KeyringOption$Type,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
type State = {
|
||||
@ -39,7 +40,7 @@ class Account extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
render (): React$Node {
|
||||
const { className, defaultValue, isError, isInput, label, style, t, type } = this.props;
|
||||
const { className, defaultValue, isError, isInput, label, style, t, type, withLabel } = this.props;
|
||||
const { publicKey } = this.state;
|
||||
|
||||
return (
|
||||
@ -56,6 +57,7 @@ class Account extends React.PureComponent<Props, State> {
|
||||
onChange={this.onChange}
|
||||
placeholder='0x...'
|
||||
type={type}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
</div>
|
||||
<Labelled
|
||||
@ -63,6 +65,7 @@ class Account extends React.PureComponent<Props, State> {
|
||||
label={t('account.balance', {
|
||||
defaultValue: 'with an available balance of'
|
||||
})}
|
||||
withLabel={withLabel}
|
||||
>
|
||||
<Balance
|
||||
className='ui disabled dropdown selection'
|
||||
|
||||
@ -72,7 +72,7 @@ export default class ExtrinsicDisplay extends React.PureComponent<Props, State>
|
||||
this.setState(newState, () => {
|
||||
const { onChange } = this.props;
|
||||
const { extrinsic, values } = this.state;
|
||||
const params = Object.values(extrinsic.params || {});
|
||||
const params = Object.values(extrinsic.params);
|
||||
const isValid = values.length === params.length &&
|
||||
params.reduce((isValid, param, index) =>
|
||||
isValid &&
|
||||
|
||||
@ -15,17 +15,19 @@ type Props = BaseProps & {
|
||||
|
||||
export default class Account extends React.PureComponent<Props> {
|
||||
render (): React$Node {
|
||||
const { className, defaultValue, isError, label, style } = this.props;
|
||||
const { className, defaultValue, isDisabled, isError, label, style, withLabel } = this.props;
|
||||
|
||||
return (
|
||||
<BaseAccount
|
||||
className={className}
|
||||
defaultValue={defaultValue}
|
||||
isDisabled={isDisabled}
|
||||
isError={isError}
|
||||
isInput
|
||||
label={label}
|
||||
onChange={this.onChange}
|
||||
style={style}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
31
packages/app-extrinsics/src/Params/Call.js
Normal file
31
packages/app-extrinsics/src/Params/Call.js
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright 2017-2018 Jaco Greeff
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Props } from '@polkadot/ui-app/Params/types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import extrinsics from '@polkadot/extrinsics-substrate';
|
||||
|
||||
import Extrinsic from './Extrinsic';
|
||||
|
||||
const defaultValue = extrinsics.staking.methods.public.transfer;
|
||||
|
||||
export default function Call ({ className, isDisabled, isError, index, label, onChange, style, withLabel }: Props): React$Node {
|
||||
return (
|
||||
<Extrinsic
|
||||
className={className}
|
||||
defaultValue={defaultValue}
|
||||
isDisabled={isDisabled}
|
||||
isError={isError}
|
||||
isPrivate={false}
|
||||
index={index}
|
||||
label={label}
|
||||
onChange={onChange}
|
||||
style={style}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
62
packages/app-extrinsics/src/Params/Extrinsic.js
Normal file
62
packages/app-extrinsics/src/Params/Extrinsic.js
Normal file
@ -0,0 +1,62 @@
|
||||
// Copyright 2017-2018 Jaco Greeff
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Extrinsic } from '@polkadot/extrinsics/types';
|
||||
import type { Props as BaseProps } from '@polkadot/ui-app/Params/types';
|
||||
import type { I18nProps } from '@polkadot/ui-app/types';
|
||||
import type { EncodedMessage } from '../types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import BaseExtrinsic from '../Extrinsic';
|
||||
import translate from '../translate';
|
||||
|
||||
type Props = BaseProps & I18nProps & {
|
||||
defaultValue: Extrinsic,
|
||||
isPrivate: boolean,
|
||||
withLabel?: boolean,
|
||||
};
|
||||
|
||||
class CExtrinsic extends React.PureComponent<Props> {
|
||||
render (): React$Node {
|
||||
const { className, defaultValue, isDisabled, isError, isPrivate, label, style, t, withLabel } = this.props;
|
||||
|
||||
return (
|
||||
<BaseExtrinsic
|
||||
className={className}
|
||||
defaultValue={defaultValue}
|
||||
isDisabled={isDisabled}
|
||||
isError={isError}
|
||||
isPrivate={isPrivate}
|
||||
labelMethod={t('proposal.method', {
|
||||
defaultValue: '{{label}} (extrinsic)',
|
||||
replace: {
|
||||
label
|
||||
}
|
||||
})}
|
||||
labelSection={t('proposal.method', {
|
||||
defaultValue: '{{label}} (section)',
|
||||
replace: {
|
||||
label
|
||||
}
|
||||
})}
|
||||
onChange={this.onChange}
|
||||
style={style}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
onChange = ({ isValid, value }: EncodedMessage): void => {
|
||||
const { index, onChange } = this.props;
|
||||
|
||||
onChange(index, {
|
||||
isValid,
|
||||
value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default translate(CExtrinsic);
|
||||
@ -3,57 +3,29 @@
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Props as BaseProps } from '@polkadot/ui-app/Params/types';
|
||||
import type { I18nProps } from '@polkadot/ui-app/types';
|
||||
import type { EncodedMessage } from '../types';
|
||||
import type { Props } from '@polkadot/ui-app/Params/types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import extrinsics from '@polkadot/extrinsics-substrate';
|
||||
|
||||
import Extrinsic from '../Extrinsic';
|
||||
import translate from '../translate';
|
||||
|
||||
type Props = BaseProps & I18nProps;
|
||||
import Extrinsic from './Extrinsic';
|
||||
|
||||
const defaultValue = extrinsics.consensus.methods.private.setCode;
|
||||
|
||||
class Proposal extends React.PureComponent<Props> {
|
||||
render (): React$Node {
|
||||
const { className, isError, label, style, t } = this.props;
|
||||
|
||||
return (
|
||||
<Extrinsic
|
||||
className={className}
|
||||
defaultValue={defaultValue}
|
||||
isError={isError}
|
||||
isPrivate
|
||||
labelMethod={t('proposal.method', {
|
||||
defaultValue: '{{label}} (extrinsic)',
|
||||
replace: {
|
||||
label
|
||||
}
|
||||
})}
|
||||
labelSection={t('proposal.method', {
|
||||
defaultValue: '{{label}} (section)',
|
||||
replace: {
|
||||
label
|
||||
}
|
||||
})}
|
||||
onChange={this.onChange}
|
||||
style={style}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
onChange = ({ isValid, value }: EncodedMessage): void => {
|
||||
const { index, onChange } = this.props;
|
||||
|
||||
onChange(index, {
|
||||
isValid,
|
||||
value
|
||||
});
|
||||
}
|
||||
export default function Proposal ({ className, isDisabled, isError, index, label, onChange, style, withLabel }: Props): React$Node {
|
||||
return (
|
||||
<Extrinsic
|
||||
className={className}
|
||||
defaultValue={defaultValue}
|
||||
isDisabled={isDisabled}
|
||||
isError={isError}
|
||||
isPrivate
|
||||
index={index}
|
||||
label={label}
|
||||
onChange={onChange}
|
||||
style={style}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default translate(Proposal);
|
||||
|
||||
@ -6,10 +6,12 @@
|
||||
import type { ComponentMap } from '@polkadot/ui-app/Params/types';
|
||||
|
||||
import Account from './Account';
|
||||
import Call from './Call';
|
||||
import Proposal from './Proposal';
|
||||
|
||||
const components: ComponentMap = {
|
||||
const components: $Shape<ComponentMap> = {
|
||||
'AccountId': Account,
|
||||
'Call': Call,
|
||||
'Proposal': Proposal
|
||||
};
|
||||
|
||||
|
||||
@ -4,17 +4,17 @@
|
||||
// @flow
|
||||
|
||||
import type { I18nProps } from '@polkadot/ui-app/types';
|
||||
import type { StorageQuery } from '../types';
|
||||
import type { StorageQuery } from './types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import Button from '@polkadot/ui-app/src/Button';
|
||||
import Labelled from '@polkadot/ui-app/src/Labelled';
|
||||
import typeToText from '@polkadot/ui-app/src/Params/typeToText';
|
||||
import valueToText from '@polkadot/ui-app/src/Params/valueToText';
|
||||
import withStorageDiv from '@polkadot/ui-react-rx/with/storageDiv';
|
||||
|
||||
import translate from '../translate';
|
||||
import format from './format';
|
||||
import translate from './translate';
|
||||
|
||||
type Props = I18nProps & {
|
||||
onRemove: (id: number) => void,
|
||||
@ -38,7 +38,7 @@ class Query extends React.PureComponent<Props, State> {
|
||||
|
||||
cache[id] = withStorageDiv(key, { params: values })(
|
||||
(value) =>
|
||||
format(key.type, value),
|
||||
valueToText(key.type, value),
|
||||
{ className: 'ui disabled dropdown selection' }
|
||||
);
|
||||
}
|
||||
@ -46,10 +46,9 @@ class Query extends React.PureComponent<Props, State> {
|
||||
return cache[id];
|
||||
})();
|
||||
const inputs = Object
|
||||
.keys(key.params || {})
|
||||
.keys(key.params)
|
||||
.map((name, index) => {
|
||||
// $FlowFixMe key.params exists
|
||||
const formatted = format(key.params[name].type, params[index].value, 12);
|
||||
const formatted = valueToText(key.params[name].type, params[index].value);
|
||||
|
||||
return (
|
||||
<span key={`param_${name}_${index}`}>{name}={formatted}</span>
|
||||
@ -1,68 +0,0 @@
|
||||
// Copyright 2017-2018 Jaco Greeff
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Param$Type, Param$TypeArray } from '@polkadot/primitives/param';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
// import IdentityIcon from '@polkadot/ui-react/IdentityIcon';
|
||||
import addressEncode from '@polkadot/util-keyring/address/encode';
|
||||
import u8aToBn from '@polkadot/util/u8a/toBn';
|
||||
import u8aToHexShort from '@polkadot/util/u8a/toHexShort';
|
||||
import isU8a from '@polkadot/util/is/u8a';
|
||||
|
||||
// flowlint-next-line unclear-type:off
|
||||
export default function format (type: Param$Type | Param$TypeArray, value?: any, fontSize?: number = 14): any {
|
||||
if (type === 'bool') {
|
||||
return (
|
||||
<span>{value
|
||||
? 'Yes'
|
||||
: 'No'
|
||||
}</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
return (
|
||||
<span>unknown</span>
|
||||
);
|
||||
}
|
||||
|
||||
// FIXME: this is a hack, but just to get it going, we should be going through and decoding arrays properly
|
||||
if (Array.isArray(type)) {
|
||||
const u8a = (value: Uint8Array);
|
||||
const length = u8aToBn(u8a.slice(0, 4), true).toNumber();
|
||||
const result = [];
|
||||
let offset = 4;
|
||||
|
||||
// FIXME: 32? Only for Hash & AccountId ...
|
||||
for (let i = 0; i < length; i++, offset += 32) {
|
||||
result.push(format(type[0], u8a.slice(offset, offset + 32), fontSize));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if (type === 'AccountId') {
|
||||
const address = addressEncode((value: Uint8Array));
|
||||
|
||||
// const size = Math.floor(fontSize + (fontSize / 14) * 18);
|
||||
// <IdentityIcon size={size} value={address} />
|
||||
|
||||
return (
|
||||
<span>{address}</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (isU8a(value)) {
|
||||
return (
|
||||
<span>{u8aToHexShort((value: Uint8Array), 256)}</span>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<span>{value.toString()}</span>
|
||||
);
|
||||
}
|
||||
@ -34,7 +34,8 @@ let id = -1;
|
||||
|
||||
class Selection extends React.PureComponent<Props, State> {
|
||||
state: State = ({
|
||||
key: defaultValue
|
||||
key: defaultValue,
|
||||
params: []
|
||||
}: $Shape<State>);
|
||||
|
||||
render (): React$Node {
|
||||
@ -75,14 +76,13 @@ class Selection extends React.PureComponent<Props, State> {
|
||||
this.setState(
|
||||
(prevState: State) => {
|
||||
const { key = prevState.key, params = prevState.params } = newState;
|
||||
const keyParams = Object.values(key.params || {});
|
||||
const valParams = params || [];
|
||||
const isValid = valParams.length === keyParams.length &&
|
||||
const keyParams = Object.values(key.params);
|
||||
const isValid = params.length === keyParams.length &&
|
||||
keyParams.reduce((isValid, param, index) =>
|
||||
isValid &&
|
||||
!isUndefined(valParams[index]) &&
|
||||
!isUndefined(valParams[index].value) &&
|
||||
valParams[index].isValid, true);
|
||||
!isUndefined(params[index]) &&
|
||||
!isUndefined(params[index].value) &&
|
||||
params[index].isValid, true);
|
||||
|
||||
return {
|
||||
isValid,
|
||||
|
||||
@ -20,9 +20,9 @@
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.storage--Query span+span {
|
||||
/* .storage--Query span+span {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
} */
|
||||
|
||||
.storage--Query .storage--actionrow-value {
|
||||
padding: 0 0.25rem;
|
||||
|
||||
@ -67,7 +67,7 @@ class App extends React.PureComponent<Props, State> {
|
||||
<div className='ui--row'>
|
||||
<Input
|
||||
className='medium'
|
||||
isDisable={isRunning}
|
||||
isDisabled={isRunning}
|
||||
isError={!isMatchValid}
|
||||
label={t('vanity.matching', {
|
||||
defaultValue: 'generate address containing (? wildcard)'
|
||||
@ -77,6 +77,7 @@ class App extends React.PureComponent<Props, State> {
|
||||
/>
|
||||
<Dropdown
|
||||
className='small'
|
||||
isDisabled={isRunning}
|
||||
label={t('vanity.case', {
|
||||
defaultValue: 'case sensitive match'
|
||||
})}
|
||||
|
||||
@ -11,11 +11,12 @@
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/extrinsics-substrate": "^0.12.9",
|
||||
"@polkadot/storage-substrate": "^0.12.9",
|
||||
"@polkadot/extrinsics-substrate": "^0.13.8",
|
||||
"@polkadot/params": "^0.13.8",
|
||||
"@polkadot/storage-substrate": "^0.13.8",
|
||||
"@polkadot/ui-keyring": "^0.4.11",
|
||||
"@polkadot/ui-react": "^0.11.3",
|
||||
"@polkadot/ui-react-rx": "^0.11.3",
|
||||
"@polkadot/ui-react": "^0.11.9",
|
||||
"@polkadot/ui-react-rx": "^0.11.9",
|
||||
"@polkadot/util": "^0.19.6",
|
||||
"i18next": "^11.1.1",
|
||||
"i18next-browser-languagedetector": "^2.2.0",
|
||||
|
||||
@ -12,12 +12,17 @@ import Labelled from './Labelled';
|
||||
|
||||
type Props = BareProps & {
|
||||
defaultValue?: mixed,
|
||||
isDisabled?: boolean,
|
||||
isError?: boolean,
|
||||
label?: React$Node,
|
||||
// flowlint-next-line unclear-type:off
|
||||
onChange: (value: any) => void,
|
||||
onSearch?: (filteredOptions: Array<*>, query: string) => Array<*>,
|
||||
options: Array<*>,
|
||||
// flowlint-next-line unclear-type:off
|
||||
transform?: (value: any) => any
|
||||
transform?: (value: any) => any,
|
||||
value?: mixed,
|
||||
withLabel?: boolean,
|
||||
};
|
||||
|
||||
type SUIEvent = {
|
||||
@ -27,27 +32,24 @@ type SUIEvent = {
|
||||
|
||||
export default class Dropdown extends React.PureComponent<Props> {
|
||||
render (): React$Node {
|
||||
const { className, isError, label, style } = this.props;
|
||||
const _props = {...this.props};
|
||||
|
||||
delete _props.className;
|
||||
delete _props.isError;
|
||||
delete _props.label;
|
||||
delete _props.onChange;
|
||||
delete _props.style;
|
||||
delete _props.transform;
|
||||
const { className, defaultValue, isDisabled, isError, label, onSearch, options, style, withLabel, value } = this.props;
|
||||
|
||||
return (
|
||||
<Labelled
|
||||
className={['ui--Dropdown', className].join(' ')}
|
||||
label={label}
|
||||
style={style}
|
||||
withLabel={withLabel}
|
||||
>
|
||||
<SUIDropdown
|
||||
selection
|
||||
{..._props}
|
||||
defaultValue={defaultValue}
|
||||
disabled={isDisabled}
|
||||
error={isError}
|
||||
onChange={this.onChange}
|
||||
options={options}
|
||||
search={onSearch}
|
||||
selection
|
||||
value={value}
|
||||
/>
|
||||
</Labelled>
|
||||
);
|
||||
|
||||
@ -25,7 +25,8 @@ type Props = BareProps & {
|
||||
onChange: (value: any) => void,
|
||||
placeholder?: string,
|
||||
type?: Input$Type,
|
||||
value?: mixed
|
||||
value?: mixed,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
type SUIEvent = {
|
||||
@ -45,7 +46,7 @@ export default class Input extends React.PureComponent<Props, State> {
|
||||
};
|
||||
|
||||
render (): React$Node {
|
||||
const { children, className, defaultValue, isAction = false, isDisabled = false, isError = false, label, max, min, placeholder, style, type = 'text', value } = this.props;
|
||||
const { children, className, defaultValue, isAction = false, isDisabled = false, isError = false, label, max, min, placeholder, style, type = 'text', value, withLabel } = this.props;
|
||||
const { name } = this.state;
|
||||
|
||||
return (
|
||||
@ -53,6 +54,7 @@ export default class Input extends React.PureComponent<Props, State> {
|
||||
className={className}
|
||||
label={label}
|
||||
style={style}
|
||||
withLabel={withLabel}
|
||||
>
|
||||
<SUIInput
|
||||
action={isAction}
|
||||
|
||||
@ -25,7 +25,8 @@ type Props = BareProps & {
|
||||
label?: string,
|
||||
onChange: (value: Uint8Array) => void,
|
||||
type?: KeyringOption$Type,
|
||||
value?: string | Uint8Array
|
||||
value?: string | Uint8Array,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
type State = {
|
||||
@ -61,7 +62,7 @@ export default class InputAddress extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
render (): React$Node {
|
||||
const { className, hideAddress = false, isError, label, onChange, style, type = 'all' } = this.props;
|
||||
const { className, hideAddress = false, isError, label, onChange, style, type = 'all', withLabel } = this.props;
|
||||
const { defaultValue, value } = this.state;
|
||||
const options = keyring.getOptions(type);
|
||||
|
||||
@ -72,11 +73,12 @@ export default class InputAddress extends React.Component<Props, State> {
|
||||
isError={isError}
|
||||
label={label}
|
||||
onChange={onChange}
|
||||
onSearch={this.onSearch}
|
||||
options={options}
|
||||
search={this.onSearch}
|
||||
style={style}
|
||||
transform={transform}
|
||||
value={value}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -19,10 +19,11 @@ type Props = I18nProps & {
|
||||
label?: string,
|
||||
onChange: (value: Extrinsic) => void,
|
||||
type: 'private' | 'public',
|
||||
value: Extrinsic
|
||||
value: Extrinsic,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
function SelectMethod ({ className, isError, label = '', onChange, style, t, type, value: { name, section } }: Props): React$Node {
|
||||
function SelectMethod ({ className, isError, label = '', onChange, style, t, type, value: { name, section }, withLabel }: Props): React$Node {
|
||||
// $FlowFixMe string vs ...
|
||||
if (!extrinsics[section]) {
|
||||
return null;
|
||||
@ -45,6 +46,7 @@ function SelectMethod ({ className, isError, label = '', onChange, style, t, typ
|
||||
style={style}
|
||||
transform={transform}
|
||||
value={name}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -18,10 +18,11 @@ type Props = I18nProps & {
|
||||
label?: string,
|
||||
onChange: (value: ExtrinsicSectionName) => void,
|
||||
type: 'private' | 'public',
|
||||
value: Extrinsic
|
||||
value: Extrinsic,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
function SelectSection ({ className, defaultValue, isError, label = '', onChange, style, t, type, value: { section } }: Props): React$Node {
|
||||
function SelectSection ({ className, defaultValue, isError, label = '', onChange, style, t, type, value: { section }, withLabel }: Props): React$Node {
|
||||
const options = createOptions(type);
|
||||
|
||||
return (
|
||||
@ -36,6 +37,7 @@ function SelectSection ({ className, defaultValue, isError, label = '', onChange
|
||||
options={options}
|
||||
style={style}
|
||||
value={section}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -24,7 +24,8 @@ type Props = I18nProps & {
|
||||
isPrivate?: boolean,
|
||||
labelMethod?: string,
|
||||
labelSection?: string,
|
||||
onChange: (value: Extrinsic) => void
|
||||
onChange: (value: Extrinsic) => void,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
type State = {
|
||||
@ -43,7 +44,7 @@ class InputExtrinsic extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
render (): React$Node {
|
||||
const { className, isPrivate = false, labelMethod, labelSection, style } = this.props;
|
||||
const { className, isPrivate = false, labelMethod, labelSection, style, withLabel } = this.props;
|
||||
const { value } = this.state;
|
||||
const type = isPrivate ? 'private' : 'public';
|
||||
|
||||
@ -58,6 +59,7 @@ class InputExtrinsic extends React.PureComponent<Props, State> {
|
||||
onChange={this.onSectionChange}
|
||||
type={type}
|
||||
value={value}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
<SelectMethod
|
||||
className='large'
|
||||
@ -65,6 +67,7 @@ class InputExtrinsic extends React.PureComponent<Props, State> {
|
||||
onChange={this.onKeyChange}
|
||||
value={value}
|
||||
type={type}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -18,10 +18,11 @@ type Props = I18nProps & {
|
||||
isError?: boolean,
|
||||
label?: string,
|
||||
onChange: (value: StorageDef$Key) => void,
|
||||
value: StorageDef$Key
|
||||
value: StorageDef$Key,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
function SelectKey ({ className, isError, label = '', onChange, style, t, value: { name, section } }: Props): React$Node {
|
||||
function SelectKey ({ className, isError, label = '', onChange, style, t, value: { name, section }, withLabel }: Props): React$Node {
|
||||
// $FlowFixMe string vs ...
|
||||
if (!map[section]) {
|
||||
return null;
|
||||
@ -44,6 +45,7 @@ function SelectKey ({ className, isError, label = '', onChange, style, t, value:
|
||||
style={style}
|
||||
transform={transform}
|
||||
value={name}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -17,12 +17,13 @@ type Props = I18nProps & {
|
||||
isError?: boolean,
|
||||
label: string,
|
||||
onChange: (value: StateDb$SectionNames) => void,
|
||||
value: StorageDef$Key
|
||||
value: StorageDef$Key,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
const options = createOptions();
|
||||
|
||||
function SelectSection ({ className, defaultValue, isError, label, onChange, style, t, value: { section } }: Props): React$Node {
|
||||
function SelectSection ({ className, defaultValue, isError, label, onChange, style, t, value: { section }, withLabel }: Props): React$Node {
|
||||
return (
|
||||
<Dropdown
|
||||
className={['ui--DropdownLinked-Sections', className].join(' ')}
|
||||
@ -35,6 +36,7 @@ function SelectSection ({ className, defaultValue, isError, label, onChange, sty
|
||||
options={options}
|
||||
style={style}
|
||||
value={section}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ type Props = I18nProps & {
|
||||
labelMethod?: string,
|
||||
labelSection?: string,
|
||||
onChange: (value: StorageDef$Key) => void,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
type State = {
|
||||
@ -42,7 +43,7 @@ class InputStorage extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
render (): React$Node {
|
||||
const { className, labelMethod, labelSection, style } = this.props;
|
||||
const { className, labelMethod, labelSection, style, withLabel } = this.props;
|
||||
const { value } = this.state;
|
||||
|
||||
return (
|
||||
@ -55,12 +56,14 @@ class InputStorage extends React.PureComponent<Props, State> {
|
||||
label={labelSection}
|
||||
onChange={this.onSectionChange}
|
||||
value={value}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
<SelectKey
|
||||
className='large'
|
||||
label={labelMethod}
|
||||
onChange={this.onKeyChange}
|
||||
value={value}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -11,20 +11,25 @@ import Label from 'semantic-ui-react/dist/es/elements/Label';
|
||||
type Props = BareProps & {
|
||||
// flowlint-next-line unclear-type:off
|
||||
label?: any,
|
||||
children: React$Node
|
||||
children: React$Node,
|
||||
withLabel?: boolean,
|
||||
};
|
||||
|
||||
const defaultLabel: React$Node = (
|
||||
<div> </div>
|
||||
);
|
||||
|
||||
export default function Labelled ({ className, children, label = defaultLabel, style }: Props): React$Node {
|
||||
export default function Labelled ({ className, children, label = defaultLabel, style, withLabel = true }: Props): React$Node {
|
||||
return (
|
||||
<div
|
||||
className={className}
|
||||
style={style}
|
||||
>
|
||||
<Label>{label}</Label>
|
||||
{
|
||||
withLabel
|
||||
? <Label>{label}</Label>
|
||||
: null
|
||||
}
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -12,7 +12,7 @@ import Bare from './Bare';
|
||||
|
||||
export default class Account extends React.PureComponent<Props> {
|
||||
render (): React$Node {
|
||||
const { className, isError, label, style, value: { options: { initValue } = {} } } = this.props;
|
||||
const { className, isDisabled, isError, label, style, value: { options: { initValue } = {} }, withLabel } = this.props;
|
||||
|
||||
// flowlint-next-line unclear-type:off
|
||||
const defaultValue = ((initValue: any): Uint8Array);
|
||||
@ -25,11 +25,13 @@ export default class Account extends React.PureComponent<Props> {
|
||||
<InputAddress
|
||||
className='large'
|
||||
defaultValue={defaultValue}
|
||||
isDisabled={isDisabled}
|
||||
isError={isError}
|
||||
isInput
|
||||
label={label}
|
||||
onChange={this.onChange}
|
||||
placeholder='5...'
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
</Bare>
|
||||
);
|
||||
|
||||
@ -14,7 +14,7 @@ import Bare from './Bare';
|
||||
|
||||
export default class Amount extends React.PureComponent<Props> {
|
||||
render (): React$Node {
|
||||
const { className, isError, label, style, value: { options: { initValue = 0, maxValue, minValue = 0 } = {} } } = this.props;
|
||||
const { className, isDisabled, isError, label, style, value: { options: { initValue = 0, maxValue, minValue = 0 } = {} }, withLabel } = this.props;
|
||||
|
||||
return (
|
||||
<Bare
|
||||
@ -24,12 +24,14 @@ export default class Amount extends React.PureComponent<Props> {
|
||||
<Input
|
||||
className='small'
|
||||
defaultValue={initValue || minValue}
|
||||
isDisabled={isDisabled}
|
||||
isError={isError}
|
||||
label={label}
|
||||
max={maxValue}
|
||||
min={minValue}
|
||||
onChange={this.onChange}
|
||||
type='number'
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
</Bare>
|
||||
);
|
||||
|
||||
@ -14,10 +14,11 @@ import Bare from './Bare';
|
||||
type Props = BareProps & {
|
||||
children: React$Node,
|
||||
label?: string,
|
||||
size?: Size
|
||||
size?: Size,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
export default function Base ({ children, className, label, size = 'medium', style }: Props): React$Node {
|
||||
export default function Base ({ children, className, label, size = 'medium', style, withLabel }: Props): React$Node {
|
||||
return (
|
||||
<Bare
|
||||
className={className}
|
||||
@ -26,6 +27,7 @@ export default function Base ({ children, className, label, size = 'medium', sty
|
||||
<Labelled
|
||||
className={size}
|
||||
label={label}
|
||||
withLabel={withLabel}
|
||||
>
|
||||
{children}
|
||||
</Labelled>
|
||||
|
||||
@ -17,7 +17,7 @@ const options = [
|
||||
|
||||
export default class Bool extends React.PureComponent<Props> {
|
||||
render (): React$Node {
|
||||
const { className, isError, label, style, value: { options: { initValue = false } = {} } } = this.props;
|
||||
const { className, isDisabled, isError, label, style, value: { options: { initValue = false } = {} }, withLabel } = this.props;
|
||||
|
||||
return (
|
||||
<Bare
|
||||
@ -26,11 +26,13 @@ export default class Bool extends React.PureComponent<Props> {
|
||||
>
|
||||
<Dropdown
|
||||
className='small'
|
||||
isDisabled={isDisabled}
|
||||
isError={isError}
|
||||
defaultValue={initValue}
|
||||
label={label}
|
||||
options={options}
|
||||
onChange={this.onChange}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
</Bare>
|
||||
);
|
||||
|
||||
@ -23,7 +23,7 @@ const defaultValidate = (u8a: Uint8Array): boolean =>
|
||||
|
||||
export default class Bytes extends React.PureComponent<Props> {
|
||||
render (): React$Node {
|
||||
const { className, isError, label, size = 'full', style } = this.props;
|
||||
const { className, isDisabled, isError, label, size = 'full', style, withLabel } = this.props;
|
||||
|
||||
return (
|
||||
<Bare
|
||||
@ -32,11 +32,13 @@ export default class Bytes extends React.PureComponent<Props> {
|
||||
>
|
||||
<Input
|
||||
className={size}
|
||||
isDisabled={isDisabled}
|
||||
isError={isError}
|
||||
label={label}
|
||||
onChange={this.onChange}
|
||||
placeholder='0x...'
|
||||
type='text'
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
</Bare>
|
||||
);
|
||||
|
||||
@ -12,17 +12,19 @@ import u8aConcat from '@polkadot/util/u8a/concat';
|
||||
|
||||
import BytesFile from './File';
|
||||
|
||||
export default class Wasm extends React.PureComponent<Props> {
|
||||
export default class Code extends React.PureComponent<Props> {
|
||||
render (): React$Node {
|
||||
const { className, isError, label, style } = this.props;
|
||||
const { className, isDisabled, isError, label, style, withLabel } = this.props;
|
||||
|
||||
return (
|
||||
<BytesFile
|
||||
className={className}
|
||||
isDisabled={isDisabled}
|
||||
isError={isError}
|
||||
label={label}
|
||||
onChange={this.onChange}
|
||||
style={style}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -12,10 +12,12 @@ import translate from '../../translate';
|
||||
import Base from './Base';
|
||||
|
||||
type Props = BareProps & {
|
||||
isDisabled?: boolean,
|
||||
isError?: boolean,
|
||||
label: string,
|
||||
onChange: (contents: Uint8Array) => void,
|
||||
t: I18Next$Translate
|
||||
t: I18Next$Translate,
|
||||
withLabel?: boolean
|
||||
}
|
||||
|
||||
type State = {
|
||||
@ -29,16 +31,18 @@ class BytesFile extends React.PureComponent<Props, State> {
|
||||
state: State = {};
|
||||
|
||||
render (): React$Node {
|
||||
const { className, isError = false, label, t } = this.props;
|
||||
const { className, isDisabled, isError = false, label, t, withLabel } = this.props;
|
||||
const { file } = this.state;
|
||||
|
||||
return (
|
||||
<Base
|
||||
label={label}
|
||||
size='full'
|
||||
withLabel={withLabel}
|
||||
>
|
||||
<Dropzone
|
||||
className={['ui--Param-File', isError ? 'error' : '', className].join(' ')}
|
||||
disabled={isDisabled}
|
||||
multiple={false}
|
||||
onDrop={this.onDrop}
|
||||
>
|
||||
|
||||
@ -9,16 +9,18 @@ import React from 'react';
|
||||
|
||||
import Bytes from './Bytes';
|
||||
|
||||
export default function Hash ({ index, isError, label, onChange, value }: Props): React$Node {
|
||||
export default function Hash ({ index, isDisabled, isError, label, onChange, value, withLabel }: Props): React$Node {
|
||||
return (
|
||||
<Bytes
|
||||
index={index}
|
||||
isDisabled={isDisabled}
|
||||
isError={isError}
|
||||
label={label}
|
||||
length={32}
|
||||
onChange={onChange}
|
||||
size='medium'
|
||||
value={value}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
115
packages/ui-app/src/Params/Param/KeyValue.js
Normal file
115
packages/ui-app/src/Params/Param/KeyValue.js
Normal file
@ -0,0 +1,115 @@
|
||||
// Copyright 2017-2018 Jaco Greeff
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Props } from '../types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import bnToU8a from '@polkadot/util/bn/toU8a';
|
||||
import u8aConcat from '@polkadot/util/u8a/concat';
|
||||
import hexToU8a from '@polkadot/util/hex/toU8a';
|
||||
|
||||
import Input from '../../Input';
|
||||
import Bare from './Bare';
|
||||
|
||||
type State$Param = {
|
||||
isValid: boolean,
|
||||
u8a: Uint8Array
|
||||
}
|
||||
|
||||
type State = {
|
||||
key: State$Param,
|
||||
value: State$Param
|
||||
};
|
||||
|
||||
export default class KeyValue extends React.PureComponent<Props, State> {
|
||||
state: State = {
|
||||
key: {
|
||||
isValid: false,
|
||||
u8a: new Uint8Array([])
|
||||
},
|
||||
value: {
|
||||
isValid: false,
|
||||
u8a: new Uint8Array([])
|
||||
}
|
||||
};
|
||||
|
||||
render (): React$Node {
|
||||
const { className, isDisabled, label, style, withLabel } = this.props;
|
||||
const { key, value } = this.state;
|
||||
|
||||
return (
|
||||
<Bare
|
||||
className={className}
|
||||
style={style}
|
||||
>
|
||||
<Input
|
||||
className='medium'
|
||||
isDisabled={isDisabled}
|
||||
isError={!key.isValid}
|
||||
label={label}
|
||||
onChange={this.onChangeKey}
|
||||
placeholder='0x...'
|
||||
type='text'
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
<Input
|
||||
className='medium'
|
||||
isDisabled={isDisabled}
|
||||
isError={!value.isValid}
|
||||
onChange={this.onChangeValue}
|
||||
placeholder='0x...'
|
||||
type='text'
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
</Bare>
|
||||
);
|
||||
}
|
||||
|
||||
createParam (hex: string, length: number = -1): State$Param {
|
||||
let u8a;
|
||||
|
||||
try {
|
||||
u8a = hexToU8a(hex);
|
||||
} catch (error) {
|
||||
u8a = new Uint8Array([]);
|
||||
}
|
||||
|
||||
const isValidLength = length !== -1
|
||||
? u8a.length === length
|
||||
: u8a.length !== 0;
|
||||
|
||||
return {
|
||||
isValid: isValidLength,
|
||||
u8a
|
||||
};
|
||||
}
|
||||
|
||||
nextState (newState: $Shape<State>): void {
|
||||
this.setState(
|
||||
(prevState: State, { index, onChange }: Props) => {
|
||||
const { key = prevState.key, value = prevState.value } = newState;
|
||||
|
||||
onChange(index, {
|
||||
isValid: key.isValid && value.isValid,
|
||||
value: u8aConcat(
|
||||
u8aConcat(bnToU8a(key.u8a.length, 32, true), key.u8a),
|
||||
u8aConcat(bnToU8a(value.u8a.length, 32, true), value.u8a)
|
||||
)
|
||||
});
|
||||
|
||||
return newState;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onChangeKey = (key: string): void => {
|
||||
this.nextState({ key: this.createParam(key) });
|
||||
};
|
||||
|
||||
onChangeValue = (value: string): void => {
|
||||
this.nextState({ value: this.createParam(value) });
|
||||
};
|
||||
}
|
||||
@ -3,7 +3,8 @@
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Props as BaseProps } from '../types';
|
||||
import type { Param$Types } from '@polkadot/params/types';
|
||||
import type { Props as BareProps } from '../types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
@ -11,15 +12,20 @@ import translate from '../../translate';
|
||||
import Base from './Base';
|
||||
import typeToText from '../typeToText';
|
||||
|
||||
type Props = BaseProps & {
|
||||
t: I18Next$Translate
|
||||
type Props = BareProps & {
|
||||
t: I18Next$Translate,
|
||||
value: {
|
||||
type: Param$Types
|
||||
},
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
function Unknown ({ label, t, value: { type } }: Props): React$Node {
|
||||
function Unknown ({ label, t, value: { type }, withLabel }: Props): React$Node {
|
||||
return (
|
||||
<Base
|
||||
size='full'
|
||||
label={label}
|
||||
withLabel={withLabel}
|
||||
>
|
||||
<div className='ui--Param-Unknown ui dropdown error selection'>
|
||||
{t('param.unknown', {
|
||||
|
||||
@ -19,7 +19,7 @@ const options = [
|
||||
|
||||
export default class VoteThreshold extends React.PureComponent<Props> {
|
||||
render (): React$Node {
|
||||
const { className, label, style, value: { options: { initValue = 0 } = {} } } = this.props;
|
||||
const { className, isDisabled, isError, label, style, value: { options: { initValue = 0 } = {} }, withLabel } = this.props;
|
||||
const defaultValue = initValue || 0;
|
||||
|
||||
return (
|
||||
@ -30,9 +30,12 @@ export default class VoteThreshold extends React.PureComponent<Props> {
|
||||
<Dropdown
|
||||
className='small'
|
||||
defaultValue={defaultValue}
|
||||
isDisabled={isDisabled}
|
||||
isError={isError}
|
||||
label={label}
|
||||
options={options}
|
||||
onChange={this.onChange}
|
||||
withLabel={withLabel}
|
||||
/>
|
||||
</Bare>
|
||||
);
|
||||
|
||||
@ -3,17 +3,18 @@
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Param$Type, Param$TypeArray } from '@polkadot/primitives/param';
|
||||
import type { Param$Types } from '@polkadot/params/types';
|
||||
import type { ComponentMap } from '../types';
|
||||
|
||||
import Account from './Account';
|
||||
import Amount from './Amount';
|
||||
import Bool from './Bool';
|
||||
import Bytes from './Bytes';
|
||||
import Code from './Code';
|
||||
import Hash from './Hash';
|
||||
import KeyValue from './KeyValue';
|
||||
import Unknown from './Unknown';
|
||||
import VoteThreshold from './VoteThreshold';
|
||||
import Wasm from './Wasm';
|
||||
|
||||
const components: ComponentMap = {
|
||||
'AccountId': Account,
|
||||
@ -21,21 +22,32 @@ const components: ComponentMap = {
|
||||
'BlockNumber': Amount,
|
||||
'bool': Bool,
|
||||
'Bytes': Bytes,
|
||||
'Digest': Bytes,
|
||||
'Code': Code,
|
||||
'Call': Unknown,
|
||||
'Digest': Unknown,
|
||||
'Hash': Hash,
|
||||
'Index': Amount,
|
||||
'KeyValue': KeyValue,
|
||||
'MisbehaviorReport': Unknown,
|
||||
'PropIndex': Amount,
|
||||
'Proposal': Unknown,
|
||||
'ReferendumIndex': Amount,
|
||||
'SessionKey': Amount,
|
||||
'Signature': Hash,
|
||||
'Timestamp': Amount,
|
||||
'u32': Amount,
|
||||
'u64': Amount,
|
||||
'VoteThreshold': VoteThreshold,
|
||||
'Wasm': Wasm
|
||||
'VoteIndex': Amount,
|
||||
'VoteThreshold': VoteThreshold
|
||||
};
|
||||
|
||||
export default function findComponent (type: Param$Type | Param$TypeArray, overrides?: ComponentMap = {}): React$ComponentType<*> | Array<React$ComponentType<*>> {
|
||||
export default function findComponent (type: Param$Types, overrides?: ComponentMap = {}): React$ComponentType<*> | Array<React$ComponentType<*>> {
|
||||
if (Array.isArray(type)) {
|
||||
// $FlowFixMe we are ok here
|
||||
return type.map((type) =>
|
||||
findComponent(type, overrides)
|
||||
);
|
||||
return type
|
||||
.map((type) =>
|
||||
// $FlowFixMe running out of options to check the embedded arrays
|
||||
findComponent(type, overrides)
|
||||
);
|
||||
}
|
||||
|
||||
return overrides[type] || components[type] || Unknown;
|
||||
|
||||
@ -3,80 +3,133 @@
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Param, Param$Type } from '@polkadot/primitives/param';
|
||||
import type { Param } from '@polkadot/params/types';
|
||||
import type { I18nProps } from '../../types';
|
||||
import type { ComponentMap, RawParam } from '../types';
|
||||
import type { BaseProps, ComponentMap, RawParam } from '../types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import translate from '../../translate';
|
||||
import typeToText from '../typeToText';
|
||||
import findComponent from './findComponent';
|
||||
import Unknown from './Unknown';
|
||||
|
||||
type Props = I18nProps & {
|
||||
index: number,
|
||||
overrides?: ComponentMap,
|
||||
onChange: (value: RawParam) => void,
|
||||
onChange: (index: number, value: RawParam) => void,
|
||||
value: Param & {
|
||||
name: string
|
||||
};
|
||||
};
|
||||
|
||||
type ComponentProps = BaseProps & {
|
||||
index: number
|
||||
};
|
||||
|
||||
type State = {
|
||||
Component: React$ComponentType<*> | Array<React$ComponentType<*>> | null
|
||||
Components: React$ComponentType<*> | Array<React$ComponentType<*>>
|
||||
| null
|
||||
}
|
||||
|
||||
class ParamComponent extends React.PureComponent<Props, State> {
|
||||
state: State = {
|
||||
Component: null
|
||||
Components: []
|
||||
};
|
||||
|
||||
static getDerivedStateFromProps ({ overrides, value: { type } = {} }: Props): State {
|
||||
return {
|
||||
Component: !type
|
||||
Components: !type
|
||||
? null
|
||||
: findComponent(type, overrides)
|
||||
};
|
||||
}
|
||||
|
||||
render (): React$Node {
|
||||
const { Component } = this.state;
|
||||
const { Components } = this.state;
|
||||
|
||||
if (!Component) {
|
||||
if (Components === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Array.isArray(Component)
|
||||
? Component.map(this.renderComponent)
|
||||
: this.renderComponent(Component);
|
||||
const { value: { type } } = this.props;
|
||||
|
||||
// FIXME We don't handle array or tuple inputs atm
|
||||
return Array.isArray(type)
|
||||
? this.renderUnknown()
|
||||
: this.renderComponents();
|
||||
}
|
||||
|
||||
renderComponent = (Component: React$ComponentType<*>, sub: number = -1): React$Node => {
|
||||
const { className, index, onChange, style, value: { name, type, options = {} } = {} } = this.props;
|
||||
const _type: Param$Type = Array.isArray(type)
|
||||
? type[sub]
|
||||
: type;
|
||||
const text = typeToText(_type);
|
||||
const labelExtra = sub === -1
|
||||
? ''
|
||||
: ` (${index})`;
|
||||
renderComponents = (_Components: React$ComponentType<*> | Array<React$ComponentType<*>> | null = this.state.Components, startIndex: string = '0', { name, type, options = {} } = this.props.value) => {
|
||||
if (!_Components) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { className, index, onChange, style } = this.props;
|
||||
|
||||
if (!Array.isArray(type)) {
|
||||
// flowlint-next-line unclear-type:off
|
||||
const Component = ((_Components: any): React$ComponentType<*>);
|
||||
|
||||
return this.renderComponent(Component, startIndex, {
|
||||
className,
|
||||
index,
|
||||
onChange,
|
||||
style,
|
||||
value: {
|
||||
name,
|
||||
type,
|
||||
options
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// flowlint-next-line unclear-type:off
|
||||
const Components = ((_Components: any): Array<React$ComponentType<*>>);
|
||||
|
||||
return Components.map((Component, index) => {
|
||||
return this.renderComponents(Component, `${startIndex}-${index}`, {
|
||||
name,
|
||||
type: type[index],
|
||||
options: {}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
renderComponent = (Component: React$ComponentType<*>, sub: string, props: ComponentProps): React$Node => {
|
||||
const { className, index, onChange, style, value: { name, type, options = {} } } = props;
|
||||
const text = typeToText(type);
|
||||
|
||||
return (
|
||||
<Component
|
||||
className={['ui--Param', className].join(' ')}
|
||||
index={index}
|
||||
key={`${name}:${text}:${index}}`}
|
||||
label={`${name}: ${text}${labelExtra}`}
|
||||
// FIXME subjects are not for array components (as defined here)
|
||||
label={`${name}: ${text} (${index})`}
|
||||
onChange={onChange}
|
||||
style={style}
|
||||
value={{
|
||||
options,
|
||||
type: _type
|
||||
type
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
renderUnknown = (): React$Node => {
|
||||
const { className, index, onChange, style, value: { name, type } = {} } = this.props;
|
||||
|
||||
return this.renderComponent(Unknown, '0', {
|
||||
className,
|
||||
index,
|
||||
onChange,
|
||||
style,
|
||||
value: {
|
||||
name,
|
||||
type
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default translate(ParamComponent);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Section$Item } from '@polkadot/primitives/param';
|
||||
import type { Section$Item } from '@polkadot/params/types';
|
||||
import type { I18nProps } from '../types';
|
||||
import type { ComponentMap, RawParam, RawParams } from './types';
|
||||
|
||||
|
||||
@ -4,34 +4,26 @@
|
||||
// @flow
|
||||
// flowlint sketchy-null-mixed:off
|
||||
|
||||
import type { Param } from '@polkadot/primitives/param';
|
||||
import type { Param$Type } from '@polkadot/params/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import isUndefined from '@polkadot/util/is/undefined';
|
||||
|
||||
export default function getInitValue ({ options: { initValue, minValue } = {}, type }: Param): mixed {
|
||||
if (Array.isArray(type)) {
|
||||
return type.map((type, index) =>
|
||||
getInitValue(({
|
||||
type,
|
||||
options: {
|
||||
initValue: isUndefined(initValue) || !Array.isArray(initValue)
|
||||
? initValue
|
||||
: initValue[index],
|
||||
minValue: isUndefined(minValue) || !Array.isArray(minValue)
|
||||
? minValue
|
||||
: minValue[index]
|
||||
}
|
||||
}: $Shape<Param>))
|
||||
);
|
||||
}
|
||||
type Options = {
|
||||
initValue?: mixed,
|
||||
minValue?: mixed
|
||||
};
|
||||
|
||||
export default function getInitValue (type: Param$Type, { initValue, minValue }: Options = {}): ?mixed {
|
||||
switch (type) {
|
||||
case 'Balance':
|
||||
case 'BlockNumber':
|
||||
case 'u32':
|
||||
case 'Index':
|
||||
case 'SessionKey':
|
||||
case 'u64':
|
||||
case 'PropIndex':
|
||||
case 'ReferendumIndex':
|
||||
case 'u32':
|
||||
case 'VoteIndex':
|
||||
return new BN(initValue || minValue || 0);
|
||||
|
||||
case 'bool':
|
||||
|
||||
@ -3,12 +3,17 @@
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Param$Type, Param$TypeArray } from '@polkadot/primitives/param';
|
||||
import type { Param$Types } from '@polkadot/params/types';
|
||||
|
||||
export default function typeToText (type: Param$Type | Param$TypeArray): string {
|
||||
if (Array.isArray(type)) {
|
||||
return `Array<${type.map(typeToText).join(', ')}>`;
|
||||
export default function typeToText (type: Param$Types): string {
|
||||
if (!Array.isArray(type)) {
|
||||
return type;
|
||||
}
|
||||
|
||||
return type;
|
||||
// $FlowFixMe hate doing this, but it _looks_ ok
|
||||
const text = type.map(typeToText).join(', ');
|
||||
|
||||
return type.length !== 1
|
||||
? `(${text})`
|
||||
: `Array<${text}>`;
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Param, Param$Type } from '@polkadot/primitives/param';
|
||||
import type { Param$Type, Param$Types } from '@polkadot/params/types';
|
||||
import type { BareProps } from '../types';
|
||||
|
||||
export type RawParam = {
|
||||
@ -15,17 +15,27 @@ export type RawParams = Array<RawParam>;
|
||||
|
||||
export type BaseProps = BareProps & {
|
||||
onChange: (index: number, value: RawParam) => void,
|
||||
value: Param
|
||||
value: {
|
||||
name: string,
|
||||
options?: {
|
||||
initValue?: mixed,
|
||||
minValue?: mixed,
|
||||
maxValue?: mixed
|
||||
},
|
||||
type: Param$Types
|
||||
}
|
||||
};
|
||||
|
||||
export type Props = BaseProps & {
|
||||
isDisabled?: boolean,
|
||||
isError?: boolean,
|
||||
index: number,
|
||||
label: string
|
||||
label: string,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
export type Size = 'full' | 'large' | 'medium' | 'small';
|
||||
|
||||
export type ComponentMap = $Shape<{
|
||||
export type ComponentMap = {
|
||||
[Param$Type]: React$ComponentType<*>
|
||||
}>;
|
||||
};
|
||||
|
||||
54
packages/ui-app/src/Params/valueToText.js
Normal file
54
packages/ui-app/src/Params/valueToText.js
Normal file
@ -0,0 +1,54 @@
|
||||
// Copyright 2017-2018 Jaco Greeff
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { Param$Types } from '@polkadot/params/types';
|
||||
|
||||
// import IdentityIcon from '@polkadot/ui-react/IdentityIcon';
|
||||
import numberFormat from '@polkadot/ui-react-rx/util/numberFormat';
|
||||
import addressEncode from '@polkadot/util-keyring/address/encode';
|
||||
import u8aToHexShort from '@polkadot/util/u8a/toHexShort';
|
||||
import isBn from '@polkadot/util/is/bn';
|
||||
import isU8a from '@polkadot/util/is/u8a';
|
||||
|
||||
// flowlint-next-line unclear-type:off
|
||||
export default function valueToText (type: Param$Types, value: any): string {
|
||||
if (type === 'bool') {
|
||||
return value ? 'Yes' : 'No';
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
if (Array.isArray(type)) {
|
||||
if (value.length === 0) {
|
||||
return 'empty';
|
||||
}
|
||||
|
||||
const values = type.map((_type, index) =>
|
||||
// $FlowFixMe hate doing this, but it _looks_ ok
|
||||
valueToText(_type, value[index])
|
||||
).join(', ');
|
||||
|
||||
return type.length === 1
|
||||
? `(${values})`
|
||||
: values;
|
||||
}
|
||||
|
||||
if (type === 'AccountId') {
|
||||
return addressEncode((value: Uint8Array));
|
||||
}
|
||||
|
||||
if (isU8a(value)) {
|
||||
return u8aToHexShort((value: Uint8Array), 256);
|
||||
}
|
||||
|
||||
if (isBn(value)) {
|
||||
return numberFormat((value: BN));
|
||||
}
|
||||
|
||||
return value.toString();
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
// @flow
|
||||
|
||||
import type { Param, Params } from '@polkadot/primitives/param';
|
||||
import type { Param, Params } from '@polkadot/params/types';
|
||||
import type { RawParam } from './types';
|
||||
|
||||
import isUndefined from '@polkadot/util/is/undefined';
|
||||
@ -14,8 +14,38 @@ export default function values (params: Params): Array<RawParam> {
|
||||
return Object
|
||||
.values(params)
|
||||
// $FlowFixMe yes, we are sure, the type is correct
|
||||
.map((param: Param): RawParam => {
|
||||
const value = getInitValue(param);
|
||||
.map(({ type, options }: Param): RawParam => {
|
||||
if (Array.isArray(type)) {
|
||||
// console.error('Unable to determine default values for array/tuple type', type);
|
||||
//
|
||||
// return {
|
||||
// isValid: false,
|
||||
// value: void 0
|
||||
// };
|
||||
|
||||
if (type.length !== 1) {
|
||||
console.error('Unable to determine default values for tuple type', type);
|
||||
|
||||
return {
|
||||
isValid: false,
|
||||
value: void 0
|
||||
};
|
||||
}
|
||||
|
||||
return type.reduce(({ isValid, value }, type) => {
|
||||
// $FlowFixMe still not sure how to iterate through these
|
||||
const avalue = getInitValue(type, {});
|
||||
|
||||
value.push(avalue);
|
||||
|
||||
return {
|
||||
isValid: isValid && !isUndefined(avalue),
|
||||
value
|
||||
};
|
||||
}, { isValid: true, value: [] });
|
||||
}
|
||||
|
||||
const value = getInitValue(type, options);
|
||||
|
||||
return {
|
||||
isValid: !isUndefined(value),
|
||||
@ -23,3 +53,5 @@ export default function values (params: Params): Array<RawParam> {
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// 0x050000000600000055555555550ae803000000000000
|
||||
|
||||
@ -18,7 +18,8 @@ type Props = BareProps & {
|
||||
label?: string,
|
||||
name?: string,
|
||||
onChange: (value: string) => void,
|
||||
value: mixed
|
||||
value: mixed,
|
||||
withLabel?: boolean
|
||||
};
|
||||
|
||||
type State = {
|
||||
@ -31,7 +32,7 @@ export default class Password extends React.PureComponent<Props, State> {
|
||||
};
|
||||
|
||||
render (): React$Node {
|
||||
const { children, className, defaultValue, isDisabled, isError, label, name, onChange, style, value } = this.props;
|
||||
const { children, className, defaultValue, isDisabled, isError, label, name, onChange, style, value, withLabel } = this.props;
|
||||
const { isVisible } = this.state;
|
||||
|
||||
return (
|
||||
@ -51,6 +52,7 @@ export default class Password extends React.PureComponent<Props, State> {
|
||||
: 'password'
|
||||
}
|
||||
value={value}
|
||||
withLabel={withLabel}
|
||||
>
|
||||
<Button
|
||||
icon={
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
"store": "^2.0.12"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/ui-react": "^0.11.3",
|
||||
"@polkadot/ui-react": "^0.11.9",
|
||||
"react": "^16.3.1",
|
||||
"semantic-ui-react": "^0.79.1"
|
||||
}
|
||||
|
||||
177
yarn.lock
177
yarn.lock
@ -1183,25 +1183,26 @@
|
||||
call-me-maybe "^1.0.1"
|
||||
glob-to-regexp "^0.3.0"
|
||||
|
||||
"@polkadot/api-format@^0.10.3":
|
||||
version "0.10.3"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-format/-/api-format-0.10.3.tgz#d6d56af776c636e3423837a516ea6754dd41ccac"
|
||||
"@polkadot/api-format@^0.10.11":
|
||||
version "0.10.11"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-format/-/api-format-0.10.11.tgz#56031b66ff3c1cdd0d6951e0b1768bd321319100"
|
||||
dependencies:
|
||||
"@polkadot/primitives-json" "^0.12.9"
|
||||
"@polkadot/api-jsonrpc" "^0.10.11"
|
||||
"@polkadot/primitives-json" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/api-jsonrpc@^0.10.3":
|
||||
version "0.10.3"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-jsonrpc/-/api-jsonrpc-0.10.3.tgz#4abe9e5f59a7bf46830e2f775d70fdb6e54fd99c"
|
||||
"@polkadot/api-jsonrpc@^0.10.11":
|
||||
version "0.10.11"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-jsonrpc/-/api-jsonrpc-0.10.11.tgz#7e628803fb454e9ab3610ca7352f058d9a3df2b1"
|
||||
dependencies:
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/api-provider@^0.10.3":
|
||||
version "0.10.3"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-provider/-/api-provider-0.10.3.tgz#bb3201508a42e29b1fb7c96a07620a5302863036"
|
||||
"@polkadot/api-provider@^0.10.11":
|
||||
version "0.10.11"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-provider/-/api-provider-0.10.11.tgz#91676cd29f27f5d4f50ff7d5568f0a461cd3a715"
|
||||
dependencies:
|
||||
"@polkadot/storage-substrate" "^0.12.9"
|
||||
"@polkadot/storage-substrate" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
"@polkadot/util-crypto" "^0.19.6"
|
||||
"@polkadot/util-keyring" "^0.19.6"
|
||||
@ -1210,21 +1211,21 @@
|
||||
isomorphic-fetch "^2.2.1"
|
||||
websocket "^1.0.25"
|
||||
|
||||
"@polkadot/api-rx@^0.10.3":
|
||||
version "0.10.3"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-rx/-/api-rx-0.10.3.tgz#fd1f152c6a6ac75562e78b30325827e7f01edf5d"
|
||||
"@polkadot/api-rx@^0.10.11":
|
||||
version "0.10.11"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-rx/-/api-rx-0.10.11.tgz#2e6e556c33ac9866e154495c8931f4fc1603c069"
|
||||
dependencies:
|
||||
"@polkadot/api" "^0.10.3"
|
||||
"@polkadot/api-provider" "^0.10.3"
|
||||
"@polkadot/api" "^0.10.11"
|
||||
"@polkadot/api-provider" "^0.10.11"
|
||||
rxjs "^5.5.10"
|
||||
|
||||
"@polkadot/api@^0.10.3":
|
||||
version "0.10.3"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.10.3.tgz#6941c63ea6bddb2b7bde552e3543ee90c127ef4f"
|
||||
"@polkadot/api@^0.10.11":
|
||||
version "0.10.11"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.10.11.tgz#1da16368524ade6d9fcb18be3ce1e733ef4185c8"
|
||||
dependencies:
|
||||
"@polkadot/api-format" "^0.10.3"
|
||||
"@polkadot/api-jsonrpc" "^0.10.3"
|
||||
"@polkadot/api-provider" "^0.10.3"
|
||||
"@polkadot/api-format" "^0.10.11"
|
||||
"@polkadot/api-jsonrpc" "^0.10.11"
|
||||
"@polkadot/api-provider" "^0.10.11"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
@ -1266,115 +1267,133 @@
|
||||
stylelint "^9.1.1"
|
||||
stylelint-config-standard "^18.2.0"
|
||||
|
||||
"@polkadot/extrinsics-codec@^0.12.9":
|
||||
version "0.12.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics-codec/-/extrinsics-codec-0.12.9.tgz#1763b17682ee5e2313136e33d65ea9a5520b12a6"
|
||||
"@polkadot/extrinsics-codec@^0.13.8":
|
||||
version "0.13.8"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics-codec/-/extrinsics-codec-0.13.8.tgz#019c8ca199d64eba8bc954d6d85c92ab0db4cf17"
|
||||
dependencies:
|
||||
"@polkadot/extrinsics" "^0.13.8"
|
||||
"@polkadot/params" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
bn.js "^4.11.8"
|
||||
|
||||
"@polkadot/extrinsics-substrate@^0.12.9":
|
||||
version "0.12.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics-substrate/-/extrinsics-substrate-0.12.9.tgz#9d26e0c3e7ea53b668002dd0989adb22e42c392b"
|
||||
"@polkadot/extrinsics-substrate@^0.13.8":
|
||||
version "0.13.8"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics-substrate/-/extrinsics-substrate-0.13.8.tgz#05e3fa69b716106a6a9caa8a1638f49d7c166c7c"
|
||||
dependencies:
|
||||
"@polkadot/extrinsics" "^0.12.9"
|
||||
"@polkadot/extrinsics" "^0.13.8"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/extrinsics@^0.12.9":
|
||||
version "0.12.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.12.9.tgz#1603cc55d95740a619e1ce883dc67fa3a677e761"
|
||||
"@polkadot/extrinsics@^0.13.8":
|
||||
version "0.13.8"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.13.8.tgz#d42e90a26ad441386c1c1e58c552ca320220fed8"
|
||||
dependencies:
|
||||
"@polkadot/primitives" "^0.12.9"
|
||||
"@polkadot/params" "^0.13.8"
|
||||
"@polkadot/primitives" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/primitives-builder@^0.12.9":
|
||||
version "0.12.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/primitives-builder/-/primitives-builder-0.12.9.tgz#17754262e39b0c526f51be0e3531f0e4b91fca88"
|
||||
"@polkadot/params@^0.13.8":
|
||||
version "0.13.8"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/params/-/params-0.13.8.tgz#bb959118e5fcfe3206474fdb3e9c3ba00012e240"
|
||||
dependencies:
|
||||
"@polkadot/primitives" "^0.12.9"
|
||||
"@polkadot/primitives-codec" "^0.12.9"
|
||||
"@polkadot/extrinsics" "^0.13.8"
|
||||
"@polkadot/extrinsics-substrate" "^0.13.8"
|
||||
"@polkadot/primitives" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/primitives-builder@^0.13.8":
|
||||
version "0.13.8"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/primitives-builder/-/primitives-builder-0.13.8.tgz#988ad4d00e2c84bd52bd6044eb6f9610080961b2"
|
||||
dependencies:
|
||||
"@polkadot/primitives" "^0.13.8"
|
||||
"@polkadot/primitives-codec" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
"@polkadot/util-crypto" "^0.19.6"
|
||||
"@polkadot/util-triehash" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/primitives-codec@^0.12.9":
|
||||
version "0.12.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/primitives-codec/-/primitives-codec-0.12.9.tgz#659735a88589416311f31e74646dec7b50c1f503"
|
||||
"@polkadot/primitives-codec@^0.13.8":
|
||||
version "0.13.8"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/primitives-codec/-/primitives-codec-0.13.8.tgz#65acfa0735ee76c4a7f137cc7fbac16774c4d0c5"
|
||||
dependencies:
|
||||
"@polkadot/primitives" "^0.12.9"
|
||||
"@polkadot/primitives-builder" "^0.12.9"
|
||||
"@polkadot/primitives-rlp" "^0.12.9"
|
||||
"@polkadot/primitives" "^0.13.8"
|
||||
"@polkadot/primitives-builder" "^0.13.8"
|
||||
"@polkadot/primitives-rlp" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
"@polkadot/util-keyring" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/primitives-json@^0.12.9":
|
||||
version "0.12.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/primitives-json/-/primitives-json-0.12.9.tgz#e6d2afde7d3cf746abbb2a3d1760d7c8fb1ef49d"
|
||||
"@polkadot/primitives-json@^0.13.8":
|
||||
version "0.13.8"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/primitives-json/-/primitives-json-0.13.8.tgz#5718faaad9bd2e989fd05a3e62cabd393a7d1cbd"
|
||||
dependencies:
|
||||
"@polkadot/primitives" "^0.12.9"
|
||||
"@polkadot/primitives-builder" "^0.12.9"
|
||||
"@polkadot/primitives" "^0.13.8"
|
||||
"@polkadot/primitives-builder" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/primitives-rlp@^0.12.9":
|
||||
version "0.12.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/primitives-rlp/-/primitives-rlp-0.12.9.tgz#1151e61a510ba19d8f5e917d81676a2957ded306"
|
||||
"@polkadot/primitives-rlp@^0.13.8":
|
||||
version "0.13.8"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/primitives-rlp/-/primitives-rlp-0.13.8.tgz#9dfd49ccad795070dac0f29b5271b1f87a50d7f2"
|
||||
dependencies:
|
||||
"@polkadot/primitives" "^0.12.9"
|
||||
"@polkadot/primitives-builder" "^0.12.9"
|
||||
"@polkadot/primitives-json" "^0.12.9"
|
||||
"@polkadot/primitives" "^0.13.8"
|
||||
"@polkadot/primitives-builder" "^0.13.8"
|
||||
"@polkadot/primitives-json" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
"@polkadot/util-crypto" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/primitives@^0.12.9":
|
||||
version "0.12.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/primitives/-/primitives-0.12.9.tgz#bc46d5487f4ddbf4596208e3e514afbe9f4b1248"
|
||||
"@polkadot/primitives@^0.13.8":
|
||||
version "0.13.8"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/primitives/-/primitives-0.13.8.tgz#9765151229224d6330e949f8cd07dd614371de3f"
|
||||
dependencies:
|
||||
"@polkadot/util" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/storage-substrate@^0.12.9":
|
||||
version "0.12.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/storage-substrate/-/storage-substrate-0.12.9.tgz#3822255c8fef11308568d9a7a7694e389ed956f9"
|
||||
"@polkadot/storage-substrate@^0.13.8":
|
||||
version "0.13.8"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/storage-substrate/-/storage-substrate-0.13.8.tgz#56cdb57e65ff67cfef4a89b24c8f214830725e83"
|
||||
dependencies:
|
||||
"@polkadot/storage" "^0.12.9"
|
||||
"@polkadot/storage" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/storage@^0.12.9":
|
||||
version "0.12.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.12.9.tgz#d4540056036ab75b32cc12001b220bce57d3b1be"
|
||||
"@polkadot/storage@^0.13.8":
|
||||
version "0.13.8"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.13.8.tgz#d5bc9213e2401986bc0e3751ee9610f8843db81f"
|
||||
dependencies:
|
||||
"@polkadot/primitives" "^0.12.9"
|
||||
"@polkadot/params" "^0.13.8"
|
||||
"@polkadot/primitives" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/ui-identicon@^0.11.3":
|
||||
version "0.11.3"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/ui-identicon/-/ui-identicon-0.11.3.tgz#b5c28e4e46208db0c12c8639f27eb04a73be1f45"
|
||||
"@polkadot/ui-identicon@^0.11.9":
|
||||
version "0.11.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/ui-identicon/-/ui-identicon-0.11.9.tgz#953437bfe3c2c8526350be1f86f3aab9058e8641"
|
||||
dependencies:
|
||||
babel-runtime "^6.26.0"
|
||||
color "^3.0.0"
|
||||
|
||||
"@polkadot/ui-react-rx@^0.11.3":
|
||||
version "0.11.3"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/ui-react-rx/-/ui-react-rx-0.11.3.tgz#a0659fd7ad9fc0e339a36725064edfcc9d9168cb"
|
||||
"@polkadot/ui-react-rx@^0.11.9":
|
||||
version "0.11.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/ui-react-rx/-/ui-react-rx-0.11.9.tgz#b4f11e89ad9d34d255198112d8c5d57b034a4c7c"
|
||||
dependencies:
|
||||
"@polkadot/api-rx" "^0.10.3"
|
||||
"@polkadot/primitives" "^0.12.9"
|
||||
"@polkadot/storage-substrate" "^0.12.9"
|
||||
"@polkadot/api-jsonrpc" "^0.10.11"
|
||||
"@polkadot/api-provider" "^0.10.11"
|
||||
"@polkadot/api-rx" "^0.10.11"
|
||||
"@polkadot/params" "^0.13.8"
|
||||
"@polkadot/primitives" "^0.13.8"
|
||||
"@polkadot/storage" "^0.13.8"
|
||||
"@polkadot/storage-substrate" "^0.13.8"
|
||||
"@polkadot/util" "^0.19.6"
|
||||
|
||||
"@polkadot/ui-react@^0.11.3":
|
||||
version "0.11.3"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/ui-react/-/ui-react-0.11.3.tgz#90c880466de8e47ba0d526f95976b32eb9663264"
|
||||
"@polkadot/ui-react@^0.11.9":
|
||||
version "0.11.9"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/ui-react/-/ui-react-0.11.9.tgz#fbbfb242008d68ff3e0db94e0b95a0a7a2347198"
|
||||
dependencies:
|
||||
"@polkadot/ui-identicon" "^0.11.3"
|
||||
"@polkadot/ui-identicon" "^0.11.9"
|
||||
babel-runtime "^6.26.0"
|
||||
|
||||
"@polkadot/util-crypto@^0.19.6":
|
||||
|
||||
Loading…
Reference in New Issue
Block a user