Add TSLint (#106)

This commit is contained in:
Jaco Greeff 2018-06-27 12:43:07 +02:00 committed by GitHub
parent 4b5c3733ad
commit f523383216
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 288 additions and 258 deletions

View File

@ -11,7 +11,7 @@
],
"scripts": {
"build": "polkadot-dev-build-ts",
"check": "tsc --noEmit",
"check": "tslint --project . && tsc --noEmit",
"clean": "polkadot-dev-clean-build",
"postinstall": "polkadot-dev-yarn-only",
"test": "jest --coverage",
@ -23,7 +23,7 @@
"start": "cd packages/apps && webpack-serve --config webpack.config.js --port 3000"
},
"devDependencies": {
"@polkadot/dev-react": "^0.20.7",
"@polkadot/dev-react": "^0.20.8",
"@polkadot/ts": "^0.1.3",
"autoprefixer": "^8.6.2",
"gh-pages": "^1.1.0",

View File

@ -16,14 +16,14 @@ import addressEncode from '@polkadot/util-keyring/address/encode';
type Props = BareProps & {
value: string;
}
};
type State = {
address: string,
isValid: boolean,
publicKey: Uint8Array | null,
shortValue: string
}
};
const DEFAULT_ADDR = '5'.padEnd(16, 'x');
const DEFAULT_SHORT = `${DEFAULT_ADDR.slice(0, 7)}…${DEFAULT_ADDR.slice(-7)}`;

View File

@ -35,7 +35,7 @@ type State = {
name: string,
password: string,
seed: string
}
};
function formatSeed (seed: string): Uint8Array {
return isHex(seed)

View File

@ -25,7 +25,7 @@ type State = {
defaultValue?: string,
editedName: string,
isEdited: boolean
}
};
class Editor extends React.PureComponent<Props, State> {
state: State;

View File

@ -21,7 +21,7 @@ type Actions = 'create' | 'edit';
type State = {
action: Actions
}
};
// FIXME React-router would probably be the best route, not home-grown
const Components: { [index: string]: React.ComponentType<any> } = {

View File

@ -26,7 +26,7 @@ type State = {
isNameValid: boolean,
isValid: boolean,
name: string
}
};
class Creator extends React.PureComponent<Props, State> {
state: State;

View File

@ -25,7 +25,7 @@ type State = {
defaultValue?: string,
editedName: string,
isEdited: boolean
}
};
class Editor extends React.PureComponent<Props, State> {
state: State;

View File

@ -21,7 +21,7 @@ type Actions = 'create' | 'edit';
type State = {
action: Actions
}
};
// FIXME React-router would probably be the best route, not home-grown
const Components: { [index: string]: React.ComponentType<any> } = {

View File

@ -16,9 +16,8 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/primitives-codec": "^0.20.3",
"@polkadot/primitives-json": "^0.20.3",
"@polkadot/primitives": "^0.26.6",
"@polkadot/ui-app": "^0.18.3",
"@polkadot/util-crypto": "^0.24.9"
"@polkadot/util-crypto": "^0.26.6"
}
}

View File

@ -4,7 +4,7 @@
import { Header } from '@polkadot/primitives/header';
import headerHash from '@polkadot/primitives-codec/header/hash';
import headerHash from '@polkadot/primitives/codec/header/hash';
import withApiDiv from '@polkadot/ui-react-rx/with/apiDiv';
import u8aToHex from '@polkadot/util/u8a/toHex';

View File

@ -9,7 +9,7 @@ import './BlockHeader.css';
import React from 'react';
import headerHash from '@polkadot/primitives-codec/header/hash';
import headerHash from '@polkadot/primitives/codec/header/hash';
import classes from '@polkadot/ui-app/util/classes';
import numberFormat from '@polkadot/ui-react-rx/util/numberFormat';
import u8aToHex from '@polkadot/util/u8a/toHex';
@ -26,6 +26,7 @@ function BlockHeader ({ className, value, style }: Props) {
}
const hash = headerHash(value);
// tslint:disable-next-line:variable-name
const { extrinsicsRoot, number, parentHash, stateRoot } = value;
return (

View File

@ -16,7 +16,7 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/extrinsics-codec": "^0.20.3",
"@polkadot/extrinsics": "^0.26.6",
"@polkadot/ui-app": "^0.18.3",
"@polkadot/ui-signer": "^0.18.3",
"react-dropzone": "^4.2.9"

View File

@ -84,7 +84,7 @@ class Account extends React.PureComponent<Props, State> {
this.setState({ publicKey }, () =>
onChange(publicKey)
);
};
}
}
export default translate(Account);

View File

@ -11,7 +11,7 @@ import { EncodedMessage } from '@polkadot/ui-signer/types';
import React from 'react';
import encode from '@polkadot/extrinsics-codec/encode/extrinsic';
import encode from '@polkadot/extrinsics/codec/encode/extrinsic';
import InputExtrinsic from '@polkadot/ui-app/InputExtrinsic';
import Params from '@polkadot/ui-app/Params';
import classes from '@polkadot/ui-app/util/classes';
@ -101,7 +101,7 @@ class Extrinsic extends React.PureComponent<Props, State> {
onChangeExtrinsic = (extrinsic: SectionItem<Extrinsics>): void => {
this.nextState({ extrinsic } as State);
};
}
onChangeValues = (values: Array<RawParam>): void => {
this.nextState({ values } as State);

View File

@ -20,7 +20,7 @@ type Props = I18nProps & {
isPrivate: boolean,
label: string,
onChange: RawParam$OnChange,
withLabel?: boolean,
withLabel?: boolean
};
class Extrinsic extends React.PureComponent<Props> {

View File

@ -92,7 +92,7 @@ class Account extends React.PureComponent<Props, State> {
this.setState({ publicKey }, () =>
onChange(publicKey, this.state.nonce)
);
};
}
onChangeNonce = (nonce: BN): void => {
const { onChange } = this.props;
@ -100,7 +100,7 @@ class Account extends React.PureComponent<Props, State> {
this.setState({ nonce }, () =>
onChange(this.state.publicKey, nonce)
);
};
}
}
export default translate(Account);

View File

@ -33,7 +33,7 @@ type State = {
publicKey?: Uint8Array | null,
rpc: SectionItem<Interfaces>,
values: Array<RawParam>
}
};
const defaultMethod = rpc.author.public.submitExtrinsic;

View File

@ -19,7 +19,7 @@ type Props = I18nProps & {};
type State = {
queue: Array<StorageQuery>
}
};
class StorageApp extends React.PureComponent<Props, State> {
state: State = {

View File

@ -229,9 +229,6 @@ class Sign extends React.PureComponent<Props, State> {
this.nextState({ data, isHexData } as State);
}
onUnlock = (): void => {
}
}
export default translate(Sign);

View File

@ -24,7 +24,7 @@ type Props = I18nProps & {
type UnlockI18n = {
key: string,
value: any // I18Next$Translate$Config
}
};
type State = {
address: string,
@ -176,7 +176,7 @@ class Unlock extends React.PureComponent<Props, State> {
}
onClose();
};
}
}
export default translate(Unlock);

View File

@ -22,7 +22,7 @@ type Props = I18nProps & {};
type State = {
action: Actions
}
};
// FIXME React-router would probably be the best route, not home-grown
const Components: { [index: string]: React.ComponentType<any> } = { // Actions

View File

@ -18,7 +18,7 @@ type Props = BareProps & {
offset: number;
onRemove: (address: string) => void,
seed: Uint8Array;
}
};
type State = {
hexSeed: string

View File

@ -16,7 +16,7 @@ type Best = {
count: number,
offset: number,
seed?: Uint8Array
}
};
const { match, withCase } = yargs
.option('match', {

View File

@ -28,4 +28,4 @@ export default function sort (a: Generator$Match, b: Generator$Match): number {
}
return a.address.localeCompare(b.address);
};
}

View File

@ -33,7 +33,7 @@ type State = {
matches: Generator$Matches,
startAt: number,
withCase: boolean
}
};
const DEFAULT_MATCH = 'Some';
const BOOL_OPTIONS = [

View File

@ -17,7 +17,7 @@ import translate from '../translate';
import Item from './Item';
type Props = I18nProps & {
children?: any, // React$Node
children?: any // React$Node
};
function SideBar ({ children, className, style, t }: Props) {

View File

@ -37,7 +37,8 @@ function App ({ className, style }: Props) {
}
createApp(App, {
url: process.env.WS_URL === null || process.env.WS_URL === ''
// tslint:disable-next-line
url: (process.env.WS_URL === null) || (process.env.WS_URL === '')
? undefined
: process.env.WS_URL
});

View File

@ -16,8 +16,8 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/extrinsics": "^0.20.3",
"@polkadot/storage": "^0.20.3",
"@polkadot/extrinsics": "^0.26.6",
"@polkadot/storage": "^0.26.6",
"@polkadot/ui-keyring": "^0.18.3",
"@polkadot/ui-react": "^0.18.3",
"@polkadot/ui-react-rx": "^0.18.3",

View File

@ -16,7 +16,7 @@ type Props = BareProps & {
isPrimary?: boolean,
size?: Button$Sizes,
value?: any
}
};
export default function CopyButton ({ className, icon = 'copy', isCircular = true, isPrimary = true, size = 'tiny', style, value }: Props) {
return (

View File

@ -21,7 +21,7 @@ type Props<Option> = BareProps & {
placeholder?: string,
transform?: (value: any) => any,
value?: any,
withLabel?: boolean,
withLabel?: boolean
};
type SUIEvent = {

View File

@ -39,7 +39,7 @@ type SUIEvent = {
type State = {
name: string;
}
};
let counter = 0;

View File

@ -35,7 +35,7 @@ type State = {
defaultValue: string | undefined,
options: KeyringOptions,
value?: string
}
};
const RECENT_KEY = 'header-recent';
@ -138,5 +138,5 @@ export default class InputAddress extends React.Component<Props, State> {
return false;
});
};
}
}

View File

@ -13,10 +13,10 @@ type Props = BareProps & {
isHidden?: boolean,
label?: any,
children: any, // node?
withLabel?: boolean,
withLabel?: boolean
};
const defaultLabel: any = ( // node?
const defaultLabel: any = (// node?
<div>&nbsp;</div>
);

View File

@ -62,5 +62,5 @@ export default class BaseBytes extends React.PureComponent<Props> {
isValid: isValidLength && validate(u8a),
value: u8a
});
};
}
}

View File

@ -19,7 +19,7 @@ type Props = BareProps & {
onChange: (contents: Uint8Array) => void,
t: TranslationFunction,
withLabel?: boolean
}
};
type State = {
file?: {
@ -76,8 +76,12 @@ class BytesFile extends React.PureComponent<Props, State> {
files.forEach((file) => {
const reader = new FileReader();
reader.onabort = () => {};
reader.onerror = () => {};
reader.onabort = () => {
// ignore
};
reader.onerror = () => {
// ignore
};
// @ts-ignore ummm... events are not properly specoified here?
reader.onload = ({ target: { result } }: LoadEvent) => {
const data = new Uint8Array(result);
@ -94,7 +98,7 @@ class BytesFile extends React.PureComponent<Props, State> {
reader.readAsArrayBuffer(file);
});
};
}
}
export default translate(BytesFile);

View File

@ -16,7 +16,7 @@ import Bare from './Bare';
type State$Param = {
isValid: boolean,
u8a: Uint8Array
}
};
type State = {
key: State$Param,
@ -106,9 +106,9 @@ export default class KeyValue extends React.PureComponent<Props, State> {
onChangeKey = (key: string): void => {
this.nextState({ key: this.createParam(key) } as State);
};
}
onChangeValue = (value: string): void => {
this.nextState({ value: this.createParam(value) } as State);
};
}
}

View File

@ -41,5 +41,5 @@ export default class StringParam extends React.PureComponent<Props> {
isValid,
value
});
};
}
}

View File

@ -19,7 +19,7 @@ type Props = I18nProps & BaseProps & {
type State = {
Component: React.ComponentType<ComponentProps> | null
}
};
class ParamComponent extends React.PureComponent<Props, State> {
state: State = {

View File

@ -9,7 +9,7 @@ import BN from 'bn.js';
import typeToString from '@polkadot/params/typeToString';
export default function getInitValue (type: Param$Types): RawParam$Value | Array<RawParam$Value>{
export default function getInitValue (type: Param$Types): RawParam$Value | Array<RawParam$Value> {
switch (type) {
case 'Balance':
return new BN(1);
@ -61,7 +61,8 @@ export default function getInitValue (type: Param$Types): RawParam$Value | Array
);
}
(type as never); // eslint-disable-line no-unused-expressions
// tslint:disable-next-line
(type as never);
throw new Error(`Unable to determine default type for ${typeToString(type)}`);
}
}

View File

@ -2,7 +2,6 @@
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import BN from 'bn.js';
import { Param$Types, Param$Type$Array, ExtrinsicDecoded } from '@polkadot/params/types';
import numberFormat from '@polkadot/ui-react-rx/util/numberFormat';
@ -56,19 +55,19 @@ function valueToText (type: Param$Types, value: any, swallowError: boolean = tru
}
if (type === 'AccountId') {
return addressEncode((value as Uint8Array));
return addressEncode(value as Uint8Array);
}
if (type === 'Proposal') {
return proposalToText((value as ExtrinsicDecoded));
return proposalToText(value as ExtrinsicDecoded);
}
if (isU8a(value)) {
return u8aToHex((value as Uint8Array), 256);
return u8aToHex(value, 256);
}
if (isBn(value)) {
return numberFormat((value as BN));
return numberFormat(value);
}
} catch (error) {
if (!swallowError) {

View File

@ -23,7 +23,7 @@ type Props = BareProps & {
type State = {
isVisible: boolean
}
};
export default class Password extends React.PureComponent<Props, State> {
state: State = {

View File

@ -19,7 +19,7 @@ type Props = BareProps & {
api?: RxApiInterface,
provider?: ProviderInterface,
url?: string
}
};
export default function createApp (App: React.ComponentType<BareProps>, { api, className, provider, style, url }: Props = {}, rootId: string = 'root'): void {
const rootElement = document.getElementById(rootId);

View File

@ -22,7 +22,7 @@
"color": "^3.0.0"
},
"devDependencies": {
"@polkadot/util-crypto": "^0.24.9",
"@polkadot/util-crypto": "^0.26.6",
"xmlserializer": "^0.6.1"
}
}

View File

@ -26,4 +26,4 @@ export default function colors (seeder: Seeder): ColorGen {
.alpha(alpha)
.string();
};
};
}

View File

@ -25,4 +25,4 @@ export default function container (diameter: number, background: string = 'white
});
return element;
};
}

View File

@ -28,4 +28,4 @@ export default function identicon (seed: string | Uint8Array, diameter: number =
}
return outer;
};
}

View File

@ -29,4 +29,4 @@ export default function seeder (_seed: string | Uint8Array = new Uint8Array(32))
return (): number => {
return ((next() * 256) + next()) / DIVISOR;
};
};
}

View File

@ -20,4 +20,4 @@ export default function circle (seeder: Seeder, fill: string, diameter: number,
svg.setAttributeNS('', 'fill', fill);
return svg;
};
}

View File

@ -23,4 +23,4 @@ export default function square (seeder: Seeder, fill: string, diameter: number,
svg.setAttributeNS('', 'fill', fill);
return svg;
};
}

View File

@ -12,4 +12,4 @@ export default function circle (r: number, cx: number, cy: number): Element {
elem.setAttributeNS('', 'r', `${r}`);
return elem;
};
}

View File

@ -14,4 +14,4 @@ export default function element (size: number, type: string = 'svg', x: number =
elem.setAttributeNS('', 'height', `${size}`);
return elem;
};
}

View File

@ -11,4 +11,4 @@ export default function rect (size: number): Element {
elem.setAttributeNS('', 'ry', `${size / 16}`);
return elem;
};
}

View File

@ -17,7 +17,7 @@
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/ui-react": "^0.18.3",
"@polkadot/util-keyring": "^0.24.9",
"@polkadot/util-keyring": "^0.26.6",
"store": "^2.0.12"
},
"peerDependencies": {

View File

@ -26,7 +26,7 @@ export default function saveMeta (state: State, address: string, meta: KeyringPa
delete json.meta.isRecent;
store.set(addressKey(address), json);
state.available.address[address] = (json as KeyringJson);
state.available.address[address] = json;
createOptions(state);
}

View File

@ -36,9 +36,9 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/api-rx": "^0.14.8",
"@polkadot/extrinsics-codec": "^0.20.3",
"@polkadot/storage": "^0.20.3"
"@polkadot/api-rx": "^0.14.9",
"@polkadot/extrinsics": "^0.26.6",
"@polkadot/storage": "^0.26.6"
},
"devDependencies": {
"babel-loader": "^8.0.0-beta.2",

View File

@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import { OnChangeCb, OnChangeCb$Obs, OnChangeCb$Fn } from '../types';
import { OnChangeCb, OnChangeCb$Obs } from '../types';
import isFunction from '@polkadot/util/is/function';
import isObservable from '@polkadot/util/is/observable';
@ -16,7 +16,7 @@ export default function triggerChange<T> (value?: T, ...onChange: Array<OnChange
if (isObservable(onChange)) {
(onChange as OnChangeCb$Obs<T>).next(value);
} else if (isFunction(onChange)) {
(onChange as OnChangeCb$Fn<T>)(value);
onChange(value);
}
});
}

View File

@ -10,7 +10,7 @@ import assert from '@polkadot/util/assert';
import { ApiConsumer } from '../Api/Context';
export default function withApi <T, P extends object>(Inner: React.ComponentType<P & ApiProps>, defaultProps: DefaultProps<T> = {}): React.ComponentType<P> {
export default function withApi <T, P extends object> (Inner: React.ComponentType<P & ApiProps>, defaultProps: DefaultProps<T> = {}): React.ComponentType<P> {
return class WithApi extends React.PureComponent<P> {
constructor (props: any) {
super(props);

View File

@ -3,7 +3,7 @@
// of the ISC license. See the LICENSE file for details.
import { RxApiInterface$Method } from '@polkadot/api-rx/types';
import { ApiProps, BareProps, ChangeProps, ParamProps, RxProps } from '../types';
import { ParamProps } from '../types';
import { ApiMethod, HOC, Options, DefaultProps } from './types';
import React from 'react';
@ -13,16 +13,10 @@ import isEqual from '../util/isEqual';
import withObservable from './observable';
import withApi from './api';
type InProps<T> = BareProps & ChangeProps<T> & ParamProps;
type WithApiProps<T> = InProps<T> & ApiProps;
type OutProps<T> = WithApiProps<T> & RxProps<T>;
type State = ParamProps & {
Component: React.ComponentType<any>,
fn: RxApiInterface$Method
}
};
// FIXME properly type input and agumented props, e.g. P extends object (in) & P & AugProps (out)
@ -38,7 +32,7 @@ export default function withApiCall<T> ({ name, section }: ApiMethod, options?:
const fn: RxApiInterface$Method = section
? props.api[section][name]
: ((props.api[name] as any) as RxApiInterface$Method);
: ((props.api[name]) as RxApiInterface$Method);
assert(fn, `Unable to find 'api${section ? '.' : ''}${section || ''}.${name}'`);

View File

@ -19,7 +19,7 @@ import echoTransform from './transform/echo';
type State<T> = RxProps<T> & {
subscriptions: Array<any>;
}
};
// FIXME Observables here are NOT any, horribly defined (leave until rx-lite decicion is made)
// FIXME proper props augmentation

View File

@ -6,7 +6,7 @@
import { SectionItem } from '@polkadot/params/types';
import { Storages, Storage$Key$Value } from '@polkadot/storage/types';
import { ApiProps, BareProps, ChangeProps, ParamProps, RxProps } from '../types';
import { RxProps } from '../types';
import { HOC, StorageOptions, DefaultProps, Transform } from './types';
import React from 'react';
@ -21,17 +21,9 @@ import echoTransform from './transform/echo';
import createTransform from './transform/storage';
import withApi from './api';
type InProps<T> = BareProps & ChangeProps<T> & ParamProps & {
transform?: Transform
};
type InApiProps<T> = ApiProps & InProps<T>;
type OutProps<T> = InApiProps<T> & RxProps<T>;
type State<T> = RxProps<T> & {
subscriptions: Array<any>; // FIXME subscriptions
}
};
// FIXME proper types for attributes
@ -66,9 +58,9 @@ export default function withStorage<T> (key: SectionItem<Storages>, { onChange,
};
}
componentDidUpdate (prevProps: any) {
async componentDidUpdate (prevProps: any) {
if (!isEqual(this.props.params, prevProps.params)) {
this.triggerUpdate();
await this.triggerUpdate();
}
}
@ -76,8 +68,8 @@ export default function withStorage<T> (key: SectionItem<Storages>, { onChange,
const subscriptions = [
this.props.api.chain
.newHead()
.subscribe((value: any) => {
this.triggerUpdate();
.subscribe(async (value: any) => {
await this.triggerUpdate();
}),
intervalSubscribe(this)
];

View File

@ -19,7 +19,7 @@
"@polkadot/ui-identicon": "^0.18.3"
},
"devDependencies": {
"@polkadot/util-keyring": "^0.24.9",
"@polkadot/util-keyring": "^0.26.6",
"babel-loader": "^8.0.0-beta.2",
"css-loader": "0.28.9",
"empty": "^0.10.1",

View File

@ -16,7 +16,7 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/extrinsics": "^0.20.3",
"@polkadot/extrinsics": "^0.26.6",
"@polkadot/ui-app": "^0.18.3",
"@polkadot/ui-keyring": "^0.18.3"
},

View File

@ -43,7 +43,7 @@ function findExtrinsic (sectionId: number, methodId: number): { method: string |
class Extrinsic extends React.PureComponent<Props> {
render () {
const { children, className, style, t, value: { nonce = new BN(0), publicKey, values: [_value] } } = this.props;
const { children, t, value: { nonce = new BN(0), publicKey, values: [_value] } } = this.props;
const unknown = t('decoded.unknown', {
defaultValue: 'unknown'

View File

@ -29,8 +29,8 @@ type Props = I18nProps & ApiProps & BaseProps;
type UnlockI18n = {
key: string,
value: any, // I18Next$Translate$Config
}
value: any // I18Next$Translate$Config
};
type State = {
currentItem?: QueueTx,
@ -72,11 +72,11 @@ class Signer extends React.PureComponent<Props, State> {
};
}
componentDidUpdate (prevProps: Props, prevState: State) {
async componentDidUpdate (prevProps: Props, prevState: State) {
const { currentItem } = this.state;
if (currentItem && currentItem.status === 'queued' && currentItem.rpc.isSigned !== true) {
this.sendItem(currentItem);
return this.sendItem(currentItem);
}
}
@ -206,7 +206,7 @@ class Signer extends React.PureComponent<Props, State> {
queueSetStatus(currentItem.id, 'cancelled');
}
onSend = (): void => {
onSend = async (): Promise<any> => {
const { currentItem, password } = this.state;
// This should never be executed
@ -214,8 +214,8 @@ class Signer extends React.PureComponent<Props, State> {
return;
}
this.sendItem(currentItem, password);
};
return this.sendItem(currentItem, password);
}
sendItem = async ({ id, nonce, publicKey, rpc, values }: QueueTx, password?: string): Promise<void> => {
if (rpc.isSigned === true && publicKey) {

View File

@ -11,10 +11,10 @@ import classes from '@polkadot/ui-app/util/classes';
type Props = BareProps & {
queue: Array<QueueTx>
}
};
export default function Status ({ className, queue, style }: Props) {
const available = queue.filter(({ isValid, status }) =>
const available = queue.filter(({ status }) =>
!['completed', 'incomplete'].includes(status)
);

View File

@ -17,14 +17,14 @@ type Props = I18nProps & {
error?: string,
onChange: (password: string) => void,
password: string,
value?: Uint8Array | null,
}
value?: Uint8Array | null
};
type State = {
isError: boolean,
isLocked: boolean,
pair: KeyringPair
}
};
class Unlock extends React.PureComponent<Props, State> {
state: State = {} as State;

View File

@ -20,7 +20,7 @@ type Props = BareProps & {
export type SignerType = React.ComponentType<Props> & {
Queue: React.ComponentType<QueueComponentProps>
}
};
function Signer ({ children, className, style }: Props) {
return (

View File

@ -6,8 +6,8 @@ import BN from 'bn.js';
import { EncodingVersions } from '@polkadot/params/types';
import { Signed } from './types';
import encodeCall from '@polkadot/extrinsics-codec/encode/call';
import prefixes from '@polkadot/extrinsics-codec/encode/prefixes';
import encodeCall from '@polkadot/extrinsics/codec/encode/call';
import prefixes from '@polkadot/extrinsics/codec/encode/prefixes';
import keyring from '@polkadot/ui-keyring/index';
import u8aConcat from '@polkadot/util/u8a/concat';
import u8aToHex from '@polkadot/util/u8a/toHex';

View File

@ -3,14 +3,13 @@
// of the ISC license. See the LICENSE file for details.
import { RxApiInterface } from '@polkadot/api-rx/types';
import { SectionItem } from '@polkadot/params/types';
import { Interfaces, Interface$Sections } from '@polkadot/jsonrpc/types';
import { Param$Values } from '@polkadot/params/types';
import { Param$Values, SectionItem } from '@polkadot/params/types';
import { Interfaces } from '@polkadot/jsonrpc/types';
import { QueueTx$Result } from './types';
export default async function submitMessage (api: RxApiInterface, params: Array<Param$Values>, { name, section }: SectionItem<Interfaces>): Promise<QueueTx$Result> {
try {
const result = await api[section as Interface$Sections][name].apply(null, params).toPromise();
const result = await api[section][name].apply(null, params).toPromise();
console.log(`${section}.${name}: result ::`, result);

3
tslint.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "@polkadot/dev/config/tslint"
}

300
yarn.lock
View File

@ -871,58 +871,58 @@
version "1.0.2"
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.0.2.tgz#d056b68999769728a1cff8d643bc59eb6f0be436"
"@polkadot/api-format@^0.14.8":
version "0.14.8"
resolved "https://registry.yarnpkg.com/@polkadot/api-format/-/api-format-0.14.8.tgz#2562b621a04b9ba380ed6d9cdb19656e14ca36c0"
"@polkadot/api-format@^0.14.9":
version "0.14.9"
resolved "https://registry.yarnpkg.com/@polkadot/api-format/-/api-format-0.14.9.tgz#59bcf2e864d31904d059bb745c4dce6b4e4d10d6"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/jsonrpc" "^0.20.3"
"@polkadot/primitives-json" "^0.20.3"
"@polkadot/util" "^0.24.9"
"@polkadot/util-keyring" "^0.24.9"
"@polkadot/jsonrpc" "^0.26.6"
"@polkadot/primitives" "^0.26.6"
"@polkadot/util" "^0.26.6"
"@polkadot/util-keyring" "^0.26.6"
"@polkadot/api-provider@^0.14.8":
version "0.14.8"
resolved "https://registry.yarnpkg.com/@polkadot/api-provider/-/api-provider-0.14.8.tgz#d9031101ad03dbbf291df478496b829971d94f07"
"@polkadot/api-provider@^0.14.9":
version "0.14.9"
resolved "https://registry.yarnpkg.com/@polkadot/api-provider/-/api-provider-0.14.9.tgz#4cd88f51ad7c558b65bd001986fe8047524ed379"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/storage" "^0.20.3"
"@polkadot/util" "^0.24.9"
"@polkadot/util-crypto" "^0.24.9"
"@polkadot/util-keyring" "^0.24.9"
"@polkadot/storage" "^0.26.6"
"@polkadot/util" "^0.26.6"
"@polkadot/util-crypto" "^0.26.6"
"@polkadot/util-keyring" "^0.26.6"
"@types/nock" "^9.1.3"
eventemitter3 "^2.0.3"
isomorphic-fetch "^2.2.1"
websocket "^1.0.25"
"@polkadot/api-rx@^0.14.8":
version "0.14.8"
resolved "https://registry.yarnpkg.com/@polkadot/api-rx/-/api-rx-0.14.8.tgz#d5236bf80f92262e80e3876ab071a77eb9c4f863"
"@polkadot/api-rx@^0.14.9":
version "0.14.9"
resolved "https://registry.yarnpkg.com/@polkadot/api-rx/-/api-rx-0.14.9.tgz#e7cda950cb381f6a508c72cbc799afc98117801d"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/api" "^0.14.8"
"@polkadot/api-provider" "^0.14.8"
"@polkadot/api" "^0.14.9"
"@polkadot/api-provider" "^0.14.9"
"@types/rx" "^4.1.1"
rxjs "^5.5.10"
"@polkadot/api@^0.14.8":
version "0.14.8"
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.14.8.tgz#6b4088079f116fce79fb91089f49e9769ba17de9"
"@polkadot/api@^0.14.9":
version "0.14.9"
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.14.9.tgz#c590217e8b3246d44db67b342733e96ef6f32bb1"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/api-format" "^0.14.8"
"@polkadot/api-provider" "^0.14.8"
"@polkadot/jsonrpc" "^0.20.3"
"@polkadot/params" "^0.20.3"
"@polkadot/util" "^0.24.9"
"@polkadot/api-format" "^0.14.9"
"@polkadot/api-provider" "^0.14.9"
"@polkadot/jsonrpc" "^0.26.6"
"@polkadot/params" "^0.26.6"
"@polkadot/util" "^0.26.6"
"@polkadot/dev-react@^0.20.7":
version "0.20.7"
resolved "https://registry.yarnpkg.com/@polkadot/dev-react/-/dev-react-0.20.7.tgz#aaef67fa7647e04ed83075c535deab926acd8c46"
"@polkadot/dev-react@^0.20.8":
version "0.20.8"
resolved "https://registry.yarnpkg.com/@polkadot/dev-react/-/dev-react-0.20.8.tgz#3a6fff9631e6d61a29248177c8b75e6fd9e03a67"
dependencies:
"@babel/core" "^7.0.0-beta.51"
"@babel/preset-react" "^7.0.0-beta.51"
"@polkadot/dev" "^0.20.7"
"@polkadot/dev" "^0.20.8"
"@types/react" "^16.3.17"
"@types/react-dom" "^16.0.6"
browserslist "^3.2.7"
@ -937,9 +937,9 @@
webpack-cli "^2.1.3"
webpack-serve "^1.0.2"
"@polkadot/dev@^0.20.7":
version "0.20.7"
resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.20.7.tgz#d62daacb0bc66bd5eee464ecc7524cf33ff2c929"
"@polkadot/dev@^0.20.8":
version "0.20.8"
resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.20.8.tgz#48d96f5b8c9b16c3abb94fa0df25705b48055bba"
dependencies:
"@babel/cli" "^7.0.0-beta.51"
"@babel/core" "^7.0.0-beta.51"
@ -978,139 +978,98 @@
mkdirp "^0.5.1"
ncp "^2.0.0"
rimraf "^2.6.2"
tslint "^5.10.0"
tslint-config-semistandard "^7.0.0"
typescript "^2.9.2"
"@polkadot/extrinsics-codec@^0.20.3":
version "0.20.3"
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics-codec/-/extrinsics-codec-0.20.3.tgz#38d92a0df016dbabef06cf2f7717516047434c76"
"@polkadot/extrinsics@^0.26.6":
version "0.26.6"
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.26.6.tgz#20706a5ad2b153144048e97d2d493fe4d90ea0a3"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/extrinsics" "^0.20.3"
"@polkadot/params" "^0.20.3"
"@polkadot/util" "^0.24.9"
"@polkadot/util-keyring" "^0.24.9"
bn.js "^4.11.8"
"@polkadot/params" "^0.26.6"
"@polkadot/primitives" "^0.26.6"
"@polkadot/util" "^0.26.6"
"@polkadot/extrinsics@^0.20.3":
version "0.20.3"
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.20.3.tgz#31c511a6ef0fc40a4156f235888f5d178543d6f1"
"@polkadot/jsonrpc@^0.26.6":
version "0.26.6"
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.26.6.tgz#e3eedf0175ab754deacdf0ea8a9eb49f901ac744"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/params" "^0.20.3"
"@polkadot/primitives" "^0.20.3"
"@polkadot/util" "^0.24.9"
"@polkadot/jsonrpc@^0.20.3":
version "0.20.3"
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.20.3.tgz#48f48e2bdac7d1a4c316b580c9b000333d12c1b7"
dependencies:
"@polkadot/params" "^0.20.3"
"@polkadot/params" "^0.26.6"
babel-runtime "^6.26.0"
"@polkadot/params@^0.20.3":
version "0.20.3"
resolved "https://registry.yarnpkg.com/@polkadot/params/-/params-0.20.3.tgz#9322a6f78ca11976b3bf6aad20e3dc869d8e8324"
"@polkadot/params@^0.26.6":
version "0.26.6"
resolved "https://registry.yarnpkg.com/@polkadot/params/-/params-0.26.6.tgz#7aed34e68bde18fa46a32da9099c2aa25072261e"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/extrinsics" "^0.20.3"
"@polkadot/extrinsics-codec" "^0.20.3"
"@polkadot/primitives" "^0.20.3"
"@polkadot/util" "^0.24.9"
"@polkadot/extrinsics" "^0.26.6"
"@polkadot/primitives" "^0.26.6"
"@polkadot/util" "^0.26.6"
"@polkadot/primitives-builder@^0.20.3":
version "0.20.3"
resolved "https://registry.yarnpkg.com/@polkadot/primitives-builder/-/primitives-builder-0.20.3.tgz#71f48d1c2135e5fb4aa55f565bc813887e2e2e70"
"@polkadot/primitives@^0.26.6":
version "0.26.6"
resolved "https://registry.yarnpkg.com/@polkadot/primitives/-/primitives-0.26.6.tgz#c3ccc7f22846d8e048ab44e2985ff0004f0e5393"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/extrinsics-codec" "^0.20.3"
"@polkadot/primitives" "^0.20.3"
"@polkadot/primitives-codec" "^0.20.3"
"@polkadot/util" "^0.24.9"
"@polkadot/util-crypto" "^0.24.9"
"@polkadot/util-triehash" "^0.24.9"
"@polkadot/trie-hash" "^0.26.6"
"@polkadot/util" "^0.26.6"
"@polkadot/primitives-codec@^0.20.3":
version "0.20.3"
resolved "https://registry.yarnpkg.com/@polkadot/primitives-codec/-/primitives-codec-0.20.3.tgz#fa89820999490cc351a6b2bedbd67bc33340ef52"
"@polkadot/storage@^0.26.6":
version "0.26.6"
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.26.6.tgz#7fc0e7ae54885af8ecf8f26afeeff3e2746ce8c4"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/primitives" "^0.20.3"
"@polkadot/primitives-builder" "^0.20.3"
"@polkadot/util" "^0.24.9"
"@polkadot/util-crypto" "^0.24.9"
"@polkadot/util-keyring" "^0.24.9"
"@polkadot/params" "^0.26.6"
"@polkadot/primitives" "^0.26.6"
"@polkadot/util" "^0.26.6"
"@polkadot/util-crypto" "^0.26.6"
"@polkadot/util-keyring" "^0.26.6"
"@polkadot/primitives-json@^0.20.3":
version "0.20.3"
resolved "https://registry.yarnpkg.com/@polkadot/primitives-json/-/primitives-json-0.20.3.tgz#3c262aed11670268e228f03d74b850da1444c2c9"
"@polkadot/trie-hash@^0.26.6":
version "0.26.6"
resolved "https://registry.yarnpkg.com/@polkadot/trie-hash/-/trie-hash-0.26.6.tgz#5b128c44bd63234bbf871a48c40141022f1d5790"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/primitives" "^0.20.3"
"@polkadot/primitives-builder" "^0.20.3"
"@polkadot/util" "^0.24.9"
"@polkadot/primitives@^0.20.3":
version "0.20.3"
resolved "https://registry.yarnpkg.com/@polkadot/primitives/-/primitives-0.20.3.tgz#c3bc7a84f32a452d7bd5f1e291f6526582a4f8e9"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/util" "^0.24.9"
"@polkadot/storage@^0.20.3":
version "0.20.3"
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.20.3.tgz#4f18fc0a195325752f6baf2484134a2cdb3b208f"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/params" "^0.20.3"
"@polkadot/primitives" "^0.20.3"
"@polkadot/util" "^0.24.9"
"@polkadot/util-crypto" "^0.24.9"
"@polkadot/util-keyring" "^0.24.9"
"@polkadot/util" "^0.26.6"
"@polkadot/util-crypto" "^0.26.6"
"@polkadot/util-rlp" "^0.26.6"
"@polkadot/ts@^0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.3.tgz#e277fb89c43a64b244a6d1ae03fc4ede128b155d"
"@polkadot/util-crypto@^0.24.9":
version "0.24.9"
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.24.9.tgz#7764703ec817ab4977d7afcfa7de838dcd64f36f"
"@polkadot/util-crypto@^0.26.6":
version "0.26.6"
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.26.6.tgz#c7a000066b1ed4ce5dab1ab558833907a9a5d399"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/util" "^0.24.9"
"@polkadot/util" "^0.26.6"
blakejs "^1.1.0"
js-sha3 "^0.7.0"
tweetnacl "^1.0.0"
xxhashjs "^0.2.2"
"@polkadot/util-keyring@^0.24.9":
version "0.24.9"
resolved "https://registry.yarnpkg.com/@polkadot/util-keyring/-/util-keyring-0.24.9.tgz#daf1fc4adc7e4963ffab4f605730f0011d827716"
"@polkadot/util-keyring@^0.26.6":
version "0.26.6"
resolved "https://registry.yarnpkg.com/@polkadot/util-keyring/-/util-keyring-0.26.6.tgz#a7aa5dd8162f469616d9839c872d7ca50d83fd5d"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/util" "^0.24.9"
"@polkadot/util-crypto" "^0.24.9"
"@polkadot/util" "^0.26.6"
"@polkadot/util-crypto" "^0.26.6"
"@types/bs58" "^3.0.30"
bs58 "^4.0.1"
"@polkadot/util-rlp@^0.24.9":
version "0.24.9"
resolved "https://registry.yarnpkg.com/@polkadot/util-rlp/-/util-rlp-0.24.9.tgz#8ac9a472ae4b8206cedc82f473de3c6b2afa512f"
"@polkadot/util-rlp@^0.26.6":
version "0.26.6"
resolved "https://registry.yarnpkg.com/@polkadot/util-rlp/-/util-rlp-0.26.6.tgz#bc66fc975760e9d5999eb243c66298c2e940ac7f"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/util" "^0.24.9"
"@polkadot/util" "^0.26.6"
"@polkadot/util-triehash@^0.24.9":
version "0.24.9"
resolved "https://registry.yarnpkg.com/@polkadot/util-triehash/-/util-triehash-0.24.9.tgz#59900a171b80ac3ed843329f5cee0ec3b623dfaa"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@polkadot/util" "^0.24.9"
"@polkadot/util-crypto" "^0.24.9"
"@polkadot/util-rlp" "^0.24.9"
"@polkadot/util@^0.24.9":
version "0.24.9"
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.24.9.tgz#5eebdd304ebb14baa64904247b1ba27bcc3a6a34"
"@polkadot/util@^0.26.6":
version "0.26.6"
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.26.6.tgz#0405175f4d9fb39e8e5f9d30b504ea566c1ba42e"
dependencies:
"@babel/runtime" "^7.0.0-beta.51"
"@types/deasync" "^0.1.0"
@ -2761,7 +2720,7 @@ buffer@^4.3.0:
ieee754 "^1.1.4"
isarray "^1.0.0"
builtin-modules@^1.0.0:
builtin-modules@^1.0.0, builtin-modules@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
@ -3292,7 +3251,7 @@ commander@2.11.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
commander@2.15.x, commander@^2.5.0, commander@^2.8.1, commander@^2.9.0, commander@~2.15.0:
commander@2.15.x, commander@^2.12.1, commander@^2.5.0, commander@^2.8.1, commander@^2.9.0, commander@~2.15.0:
version "2.15.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f"
@ -4108,6 +4067,13 @@ docopt@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/docopt/-/docopt-0.6.2.tgz#b28e9e2220da5ec49f7ea5bb24a47787405eeb11"
doctrine@0.7.2, doctrine@^0.7.2:
version "0.7.2"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-0.7.2.tgz#7cb860359ba3be90e040b26b729ce4bfa654c523"
dependencies:
esutils "^1.1.6"
isarray "0.0.1"
doctrine@1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa"
@ -4612,6 +4578,10 @@ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"
esutils@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.1.6.tgz#c01ccaa9ae4b897c6d0c3e210ae52f3c7a844375"
esutils@^2.0.0, esutils@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
@ -10792,6 +10762,76 @@ trough@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.2.tgz#7f1663ec55c480139e2de5e486c6aef6cc24a535"
tslib@1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
tslib@^1.0.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1:
version "1.9.3"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
tslint-config-semistandard@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/tslint-config-semistandard/-/tslint-config-semistandard-7.0.0.tgz#c2d3214b6282a4fed07e875dd9f0691be4e832f1"
dependencies:
tslint-config-standard "^7.0.0"
tslint-eslint-rules "^4.1.1"
tslint-config-standard@^7.0.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/tslint-config-standard/-/tslint-config-standard-7.1.0.tgz#6bcc435a179478e365f6cc62312a561221985760"
dependencies:
tslint-eslint-rules "^5.3.1"
tslint-eslint-rules@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/tslint-eslint-rules/-/tslint-eslint-rules-4.1.1.tgz#7c30e7882f26bc276bff91d2384975c69daf88ba"
dependencies:
doctrine "^0.7.2"
tslib "^1.0.0"
tsutils "^1.4.0"
tslint-eslint-rules@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/tslint-eslint-rules/-/tslint-eslint-rules-5.3.1.tgz#10dec4361df0b3e4385d91ff8e0226bda4ec2ad4"
dependencies:
doctrine "0.7.2"
tslib "1.9.0"
tsutils "2.8.0"
tslint@^5.10.0:
version "5.10.0"
resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.10.0.tgz#11e26bccb88afa02dd0d9956cae3d4540b5f54c3"
dependencies:
babel-code-frame "^6.22.0"
builtin-modules "^1.1.1"
chalk "^2.3.0"
commander "^2.12.1"
diff "^3.2.0"
glob "^7.1.1"
js-yaml "^3.7.0"
minimatch "^3.0.4"
resolve "^1.3.2"
semver "^5.3.0"
tslib "^1.8.0"
tsutils "^2.12.1"
tsutils@2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.8.0.tgz#0160173729b3bf138628dd14a1537e00851d814a"
dependencies:
tslib "^1.7.1"
tsutils@^1.4.0:
version "1.9.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.9.1.tgz#b9f9ab44e55af9681831d5f28d0aeeaf5c750cb0"
tsutils@^2.12.1:
version "2.27.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.27.1.tgz#ab0276ac23664f36ce8fd4414daec4aebf4373ee"
dependencies:
tslib "^1.8.1"
tty-browserify@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"