mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-04-22 04:28:00 +00:00
Swap to eslint (#154)
* 311 problems (173 errors, 138 warnings) * Make a start... * swap to react config * Literally a handful left * Clean. * any removal * Use Record * Adjust versions * Update with latest eslint-standard ruleset * Update defaults.ts
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
**/build/*
|
||||
**/coverage/*
|
||||
**/node_modules/*
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('@polkadot/dev-react/config/eslint');
|
||||
@@ -1,3 +1,4 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const config = require('@polkadot/dev-react/config/jest');
|
||||
|
||||
module.exports = Object.assign({}, config, {
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
"scripts": {
|
||||
"build": "polkadot-dev-build-ts && polkadot-dev-build-docs",
|
||||
"check": "yarn lint",
|
||||
"lint": "tslint --project . && tsc --noEmit --pretty",
|
||||
"lint": "eslint --ext .js,.jsx,.ts,.tsx . && tsc --noEmit --pretty",
|
||||
"clean": "polkadot-dev-clean-build",
|
||||
"demo:identicon": "webpack-serve --config packages/ui-identicon/webpack.config.js --content packages/ui-identicon --port 3000",
|
||||
"postinstall": "polkadot-dev-yarn-only",
|
||||
|
||||
Vendored
+1
@@ -3,6 +3,7 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
declare module '*.svg' {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const content: any;
|
||||
export default content;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import { encodeAddress, randomAsU8a } from '@polkadot/util-crypto';
|
||||
import IdentityIcon from '.';
|
||||
|
||||
export default class Demo extends React.PureComponent {
|
||||
render () {
|
||||
const identities: Array<string> = [];
|
||||
public render (): React.ReactNode {
|
||||
const identities: string[] = [];
|
||||
|
||||
while (identities.length !== 50) {
|
||||
identities.push(
|
||||
@@ -18,7 +18,7 @@ export default class Demo extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
|
||||
return identities.map((value) => (
|
||||
return identities.map((value): React.ReactNode => (
|
||||
<IdentityIcon
|
||||
key={value.toString()}
|
||||
theme='jdenticon'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
import { IdentityProps as Props } from './types';
|
||||
import { IdentityProps as Props, Props as ComponentProps } from './types';
|
||||
|
||||
import React from 'react';
|
||||
import CopyToClipboard from 'react-copy-to-clipboard';
|
||||
@@ -16,17 +16,17 @@ import { Beachball, Empty, Jdenticon, Polkadot } from './icons';
|
||||
|
||||
const Fallback = Beachball;
|
||||
|
||||
type State = {
|
||||
address: string,
|
||||
publicKey: string
|
||||
};
|
||||
interface State {
|
||||
address: string;
|
||||
publicKey: string;
|
||||
}
|
||||
|
||||
const DEFAULT_SIZE = 64;
|
||||
const Components: { [index: string]: React.ComponentType<any> } = {
|
||||
'beachball': Beachball,
|
||||
'jdenticon': Jdenticon,
|
||||
'polkadot': Polkadot,
|
||||
'substrate': Jdenticon
|
||||
const Components: { [index: string]: React.ComponentType<ComponentProps> } = {
|
||||
beachball: Beachball,
|
||||
jdenticon: Jdenticon,
|
||||
polkadot: Polkadot,
|
||||
substrate: Jdenticon
|
||||
};
|
||||
const Wrapper = styled.div`
|
||||
cursor: copy;
|
||||
@@ -59,18 +59,18 @@ const Wrapper = styled.div`
|
||||
`;
|
||||
|
||||
export default class IdentityIcon extends React.PureComponent<Props, State> {
|
||||
state: State = {
|
||||
public state: State = {
|
||||
address: '',
|
||||
publicKey: '0x'
|
||||
};
|
||||
|
||||
private static prefix?: Prefix = undefined;
|
||||
|
||||
static setDefaultPrefix (prefix: Prefix) {
|
||||
public static setDefaultPrefix (prefix: Prefix): void {
|
||||
IdentityIcon.prefix = prefix;
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps ({ prefix = IdentityIcon.prefix, value }: Props, prevState: State): State | null {
|
||||
public static getDerivedStateFromProps ({ prefix = IdentityIcon.prefix, value }: Props, prevState: State): State | null {
|
||||
try {
|
||||
const address = isU8a(value) || isHex(value)
|
||||
? encodeAddress(value, prefix)
|
||||
@@ -91,7 +91,7 @@ export default class IdentityIcon extends React.PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
public render (): React.ReactNode {
|
||||
const { address } = this.state;
|
||||
const wrapped = this.getWrapped(this.state);
|
||||
|
||||
@@ -107,7 +107,7 @@ export default class IdentityIcon extends React.PureComponent<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
private getWrapped ({ address, publicKey }: State) {
|
||||
private getWrapped ({ address, publicKey }: State): React.ReactNode {
|
||||
const { className, isHighlight = false, size = DEFAULT_SIZE, style, theme = settings.uiTheme } = this.props;
|
||||
const Component = !address
|
||||
? Empty
|
||||
|
||||
@@ -7,14 +7,14 @@ import { ColorGen } from './types';
|
||||
import newSeeder from './seeder';
|
||||
import newColors from './colors';
|
||||
|
||||
describe('colors', () => {
|
||||
describe('colors', (): void => {
|
||||
let colors: ColorGen;
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach((): void => {
|
||||
colors = newColors(newSeeder());
|
||||
});
|
||||
|
||||
it('generates using default alpha', () => {
|
||||
it('generates using default alpha', (): void => {
|
||||
expect(
|
||||
colors()
|
||||
).toEqual(
|
||||
@@ -23,7 +23,7 @@ describe('colors', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('applies specified alpha', () => {
|
||||
it('applies specified alpha', (): void => {
|
||||
expect(
|
||||
colors(0.5)
|
||||
).toEqual(
|
||||
@@ -32,7 +32,7 @@ describe('colors', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('rolates colors', () => {
|
||||
it('rolates colors', (): void => {
|
||||
colors();
|
||||
|
||||
expect(
|
||||
@@ -40,7 +40,7 @@ describe('colors', () => {
|
||||
).not.toEqual('hsla(166.70000000000005, 98.6%, 27.6%, 0.9)');
|
||||
});
|
||||
|
||||
it('works in edge conditions (0xff)', () => {
|
||||
it('works in edge conditions (0xff)', (): void => {
|
||||
const u8a = new Uint8Array(32);
|
||||
|
||||
u8a.fill(255);
|
||||
|
||||
@@ -13,7 +13,7 @@ const WOBBLE = 30;
|
||||
|
||||
export default function colors (seeder: Seeder): ColorGen {
|
||||
const amount = (seeder() * WOBBLE) - (WOBBLE / 2);
|
||||
const all = COLORS.map((hex) =>
|
||||
const all = COLORS.map((hex): Color =>
|
||||
Color(hex).rotate(amount)
|
||||
);
|
||||
|
||||
|
||||
@@ -4,38 +4,40 @@
|
||||
|
||||
import container from './container';
|
||||
|
||||
describe('container', () => {
|
||||
it('applies default styles', () => {
|
||||
describe('container', (): void => {
|
||||
it('applies default styles', (): void => {
|
||||
expect(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(container(100).style as any)._values
|
||||
).toMatchObject({
|
||||
'background': 'white',
|
||||
background: 'white',
|
||||
'border-radius': '50px',
|
||||
'display': 'inline-block',
|
||||
'height': '100px',
|
||||
'margin': '0px',
|
||||
'overflow': 'hidden',
|
||||
'padding': '0px',
|
||||
'width': '100px'
|
||||
display: 'inline-block',
|
||||
height: '100px',
|
||||
margin: '0px',
|
||||
overflow: 'hidden',
|
||||
padding: '0px',
|
||||
width: '100px'
|
||||
});
|
||||
});
|
||||
|
||||
it('overrides with supplied styles', () => {
|
||||
it('overrides with supplied styles', (): void => {
|
||||
expect(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(container(50, 'black', '', { display: 'block' }).style as any)._values
|
||||
).toMatchObject({
|
||||
'background': 'black',
|
||||
background: 'black',
|
||||
'border-radius': '25px',
|
||||
'display': 'block',
|
||||
'height': '50px',
|
||||
'margin': '0px',
|
||||
'overflow': 'hidden',
|
||||
'padding': '0px',
|
||||
'width': '50px'
|
||||
display: 'block',
|
||||
height: '50px',
|
||||
margin: '0px',
|
||||
overflow: 'hidden',
|
||||
padding: '0px',
|
||||
width: '50px'
|
||||
});
|
||||
});
|
||||
|
||||
it('applies the specified className', () => {
|
||||
it('applies the specified className', (): void => {
|
||||
expect(
|
||||
container(100, 'blue', 'testClass').className
|
||||
).toEqual('testClass');
|
||||
|
||||
@@ -19,8 +19,8 @@ export default function container (diameter: number, background: string = 'white
|
||||
element.className = className;
|
||||
element.style.background = background;
|
||||
|
||||
Object.keys(style).forEach((key: any) => {
|
||||
element.style[key] = style[key];
|
||||
Object.keys(style).forEach((key: unknown): void => {
|
||||
element.style[key as number] = style[key as number];
|
||||
});
|
||||
|
||||
return element;
|
||||
|
||||
@@ -3,17 +3,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
const COLORS: Array<string> = [
|
||||
// '#01888C', // teal
|
||||
// '#FC7500', // bright orange
|
||||
// '#034F5D', // dark teal
|
||||
// '#F73F01', // orangered
|
||||
// '#FC1960', // magenta
|
||||
// '#C7144C', // raspberry
|
||||
// '#F3C100', // goldenrod
|
||||
// '#1598F2', // lightning blue
|
||||
// '#2465E1', // sail blue
|
||||
// '#F19E02' // gold
|
||||
const COLORS: string[] = [
|
||||
// https://sashat.me/2017/01/11/list-of-20-simple-distinct-colors/
|
||||
'#ffe119', '#4363d8', '#f58231', '#fabebe', '#e6beff', '#800000', '#000075', '#a9a9a9', '#ffffff', '#000000'
|
||||
];
|
||||
|
||||
@@ -6,8 +6,8 @@ import xmlserializer from 'xmlserializer';
|
||||
|
||||
import identicon from '.';
|
||||
|
||||
describe('identicon', () => {
|
||||
it('generates a basic [0,..,0] identicon', () => {
|
||||
describe('identicon', (): void => {
|
||||
it('generates a basic [0,..,0] identicon', (): void => {
|
||||
expect(
|
||||
xmlserializer.serializeToString(
|
||||
identicon(new Uint8Array(32))
|
||||
@@ -17,7 +17,7 @@ describe('identicon', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('allows overrides', () => {
|
||||
it('allows overrides', (): void => {
|
||||
expect(
|
||||
xmlserializer.serializeToString(
|
||||
identicon(new Uint8Array(32), 100, 'testClass', { display: 'block' })
|
||||
|
||||
@@ -6,20 +6,20 @@ import { Seeder } from './types';
|
||||
|
||||
import newSeeder from './seeder';
|
||||
|
||||
describe('seeder', () => {
|
||||
describe('seeder', (): void => {
|
||||
let seeder: Seeder;
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach((): void => {
|
||||
seeder = newSeeder(new Uint8Array([1, 2, 3, 4]));
|
||||
});
|
||||
|
||||
it('generates numbers using 2 spaces', () => {
|
||||
it('generates numbers using 2 spaces', (): void => {
|
||||
expect(
|
||||
seeder()
|
||||
).toEqual(0.0156402587890625);
|
||||
});
|
||||
|
||||
it('generates numbers using 2 spaces (incremented)', () => {
|
||||
it('generates numbers using 2 spaces (incremented)', (): void => {
|
||||
seeder();
|
||||
|
||||
expect(
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function seeder (_seed: string | Uint8Array = new Uint8Array(32))
|
||||
|
||||
let index = (seed[Math.floor(seed.length / 2)] % seed.length) - 1;
|
||||
|
||||
const next = () => {
|
||||
const next = (): number => {
|
||||
index += 1;
|
||||
|
||||
if (index === seed.length) {
|
||||
|
||||
@@ -7,8 +7,8 @@ import xmlserializer from 'xmlserializer';
|
||||
import seeder from '../seeder';
|
||||
import circle from './circle';
|
||||
|
||||
describe('circle', () => {
|
||||
it('creates a circle shape', () => {
|
||||
describe('circle', (): void => {
|
||||
it('creates a circle shape', (): void => {
|
||||
expect(
|
||||
xmlserializer.serializeToString(
|
||||
circle(seeder(), 'blue', 50, 2)
|
||||
|
||||
@@ -6,8 +6,8 @@ import xmlserializer from 'xmlserializer';
|
||||
|
||||
import circle from './circle';
|
||||
|
||||
describe('circle', () => {
|
||||
it('creates a basic SVG circle element', () => {
|
||||
describe('circle', (): void => {
|
||||
it('creates a basic SVG circle element', (): void => {
|
||||
expect(
|
||||
xmlserializer.serializeToString(
|
||||
circle(123, 12, 34)
|
||||
|
||||
@@ -6,8 +6,8 @@ import xmlserializer from 'xmlserializer';
|
||||
|
||||
import element from './element';
|
||||
|
||||
describe('element', () => {
|
||||
it('creates a basic SVG element', () => {
|
||||
describe('element', (): void => {
|
||||
it('creates a basic SVG element', (): void => {
|
||||
expect(
|
||||
xmlserializer.serializeToString(
|
||||
element(123)
|
||||
|
||||
@@ -6,8 +6,8 @@ import xmlserializer from 'xmlserializer';
|
||||
|
||||
import rect from './rect';
|
||||
|
||||
describe('rect', () => {
|
||||
it('creates a basic SVG rect element', () => {
|
||||
describe('rect', (): void => {
|
||||
it('creates a basic SVG rect element', (): void => {
|
||||
expect(
|
||||
xmlserializer.serializeToString(
|
||||
rect(123)
|
||||
|
||||
@@ -6,8 +6,8 @@ import xmlserializer from 'xmlserializer';
|
||||
|
||||
import svg from './svg';
|
||||
|
||||
describe('svg', () => {
|
||||
it('creates a basic SVG element', () => {
|
||||
describe('svg', (): void => {
|
||||
it('creates a basic SVG element', (): void => {
|
||||
expect(
|
||||
xmlserializer.serializeToString(
|
||||
svg('rect')
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
|
||||
export type Seeder = () => number;
|
||||
|
||||
export type ColorGen = {
|
||||
(alpha?: number): string
|
||||
};
|
||||
export interface ColorGen {
|
||||
(alpha?: number): string;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import React from 'react';
|
||||
import identicon from '../beachball';
|
||||
|
||||
export default class Beachball extends React.PureComponent<Props> {
|
||||
render () {
|
||||
public render (): React.ReactNode {
|
||||
const { className, style } = this.props;
|
||||
|
||||
return (
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Props } from '../types';
|
||||
import React from 'react';
|
||||
|
||||
export default class Empty extends React.PureComponent<Props> {
|
||||
render () {
|
||||
public render (): React.ReactNode {
|
||||
const { className, size, style } = this.props;
|
||||
|
||||
return (
|
||||
|
||||
@@ -8,7 +8,7 @@ import React from 'react';
|
||||
import jdenticon from 'jdenticon';
|
||||
|
||||
export default class Jdenticon extends React.PureComponent<Props> {
|
||||
render () {
|
||||
public render (): React.ReactNode {
|
||||
const { className, publicKey, size, style } = this.props;
|
||||
|
||||
return (
|
||||
|
||||
@@ -21,16 +21,16 @@ import { Props as BaseProps } from '../types';
|
||||
import React from 'react';
|
||||
import { blake2AsU8a, decodeAddress } from '@polkadot/util-crypto';
|
||||
|
||||
type Props = BaseProps & {
|
||||
sixPoint?: boolean
|
||||
};
|
||||
interface Props extends BaseProps {
|
||||
sixPoint?: boolean;
|
||||
}
|
||||
|
||||
type Scheme = {
|
||||
freq: number,
|
||||
colors: Array<number>
|
||||
};
|
||||
interface Scheme {
|
||||
freq: number;
|
||||
colors: number[];
|
||||
}
|
||||
|
||||
const blake2 = (value: Uint8Array) =>
|
||||
const blake2 = (value: Uint8Array): Uint8Array =>
|
||||
blake2AsU8a(value, 512);
|
||||
|
||||
const s = 64;
|
||||
@@ -49,7 +49,7 @@ const schema: { [index: string]: Scheme } = {
|
||||
};
|
||||
|
||||
export default class Identicon extends React.PureComponent<Props> {
|
||||
render () {
|
||||
public render (): React.ReactNode {
|
||||
const { address, className, size, style } = this.props;
|
||||
const xy = this.getCircleXY();
|
||||
const colors = this.getColors();
|
||||
@@ -68,7 +68,7 @@ export default class Identicon extends React.PureComponent<Props> {
|
||||
>
|
||||
{this.renderCircle(s / 2, s / 2, s / 2, '#eee', -1)}
|
||||
{
|
||||
xy.map(([x, y], index) =>
|
||||
xy.map(([x, y], index): React.ReactNode =>
|
||||
this.renderCircle(x, y, z, colors[index], index)
|
||||
)
|
||||
}
|
||||
@@ -77,7 +77,7 @@ export default class Identicon extends React.PureComponent<Props> {
|
||||
);
|
||||
}
|
||||
|
||||
private renderCircle (cx: number, cy: number, r: number, fill: string, key: number) {
|
||||
private renderCircle (cx: number, cy: number, r: number, fill: string, key: number): React.ReactNode {
|
||||
return (
|
||||
<circle
|
||||
key={key}
|
||||
@@ -89,7 +89,7 @@ export default class Identicon extends React.PureComponent<Props> {
|
||||
);
|
||||
}
|
||||
|
||||
private getCircleXY () {
|
||||
private getCircleXY (): [number, number][] {
|
||||
const { r, ro2, r3o4, ro4, rroot3o2, rroot3o4 } = this.getRotation();
|
||||
|
||||
return [
|
||||
@@ -115,7 +115,7 @@ export default class Identicon extends React.PureComponent<Props> {
|
||||
];
|
||||
}
|
||||
|
||||
private getRotation () {
|
||||
private getRotation (): { r: number; ro2: number; r3o4: number; ro4: number; rroot3o2: number; rroot3o4: number } {
|
||||
const { sixPoint = false } = this.props;
|
||||
const r = sixPoint
|
||||
? (s / 2 / 8 * 5)
|
||||
@@ -129,15 +129,15 @@ export default class Identicon extends React.PureComponent<Props> {
|
||||
return { r, ro2, r3o4, ro4, rroot3o2, rroot3o4 };
|
||||
}
|
||||
|
||||
private getColors () {
|
||||
private getColors (): string[] {
|
||||
const { address } = this.props;
|
||||
const total = Object.keys(schema).map(k => schema[k].freq).reduce((a, b) => a + b);
|
||||
const id = Array.from(blake2(decodeAddress(address))).map((x, i) => (x + 256 - zero[i]) % 256);
|
||||
const total = Object.keys(schema).map((k): number => schema[k].freq).reduce((a, b): number => a + b);
|
||||
const id = Array.from(blake2(decodeAddress(address))).map((x, i): number => (x + 256 - zero[i]) % 256);
|
||||
const d = Math.floor((id[30] + id[31] * 256) % total);
|
||||
const rot = (id[28] % 6) * 3;
|
||||
const sat = (Math.floor(id[29] * 70 / 256 + 26) % 80) + 30;
|
||||
const scheme = this.findScheme(d);
|
||||
const palette = Array.from(id).map((x, i) => {
|
||||
const palette = Array.from(id).map((x, i): string => {
|
||||
const b = (x + i % 28 * 58) % 256;
|
||||
|
||||
if (b === 0) {
|
||||
@@ -152,7 +152,7 @@ export default class Identicon extends React.PureComponent<Props> {
|
||||
return `hsl(${h}, ${sat}%, ${l}%)`;
|
||||
});
|
||||
|
||||
return scheme.colors.map((_, i) =>
|
||||
return scheme.colors.map((_, i): string =>
|
||||
palette[scheme.colors[i < 18 ? (i + rot) % 18 : 18]]
|
||||
);
|
||||
}
|
||||
@@ -161,7 +161,7 @@ export default class Identicon extends React.PureComponent<Props> {
|
||||
let cum = 0;
|
||||
const ks = Object.keys(schema);
|
||||
|
||||
for (let i in ks) {
|
||||
for (const i in ks) {
|
||||
cum += schema[ks[i]].freq;
|
||||
|
||||
if (d < cum) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { default as Identicon } from './Identicon';
|
||||
import Identicon from './Identicon';
|
||||
export * from './icons';
|
||||
|
||||
export default Identicon;
|
||||
|
||||
@@ -4,24 +4,23 @@
|
||||
|
||||
import { Prefix } from '@polkadot/util-crypto/address/types';
|
||||
|
||||
export type BaseProps = {
|
||||
className?: string,
|
||||
style?: {
|
||||
[index: string]: any
|
||||
}
|
||||
};
|
||||
export interface BaseProps {
|
||||
className?: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
style?: Record<string, any>;
|
||||
}
|
||||
|
||||
export type Props = BaseProps & {
|
||||
address: string,
|
||||
publicKey: string,
|
||||
size: number
|
||||
};
|
||||
export interface Props extends BaseProps {
|
||||
address: string;
|
||||
publicKey: string;
|
||||
size: number;
|
||||
}
|
||||
|
||||
export type IdentityProps = BaseProps & {
|
||||
isHighlight?: boolean,
|
||||
onCopy?: (value: string) => void,
|
||||
prefix?: Prefix,
|
||||
size?: number,
|
||||
theme?: 'beachball' | 'jdenticon' | 'polkadot' | 'substrate',
|
||||
value?: string | Uint8Array | null
|
||||
};
|
||||
export interface IdentityProps extends BaseProps {
|
||||
isHighlight?: boolean;
|
||||
onCopy?: (value: string) => void;
|
||||
prefix?: Prefix;
|
||||
size?: number;
|
||||
theme?: 'beachball' | 'jdenticon' | 'polkadot' | 'substrate';
|
||||
value?: string | Uint8Array | null;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const path = require('path');
|
||||
|
||||
const ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^0.94.0-beta.9",
|
||||
"@polkadot/types": "^0.82.0-beta.48",
|
||||
"@polkadot/types": "^0.82.0-beta.53",
|
||||
"@polkadot/util": "^0.94.0-beta.9"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -19,34 +19,39 @@ import { MAX_PASS_LEN } from './defaults';
|
||||
|
||||
export default class Base {
|
||||
private _accounts: AddressSubject;
|
||||
private _addresses: AddressSubject;
|
||||
private _contracts: AddressSubject;
|
||||
private _keyring?: KeyringInstance;
|
||||
private _prefix?: Prefix;
|
||||
protected _genesisHash?: string;
|
||||
protected _store: KeyringStore;
|
||||
|
||||
constructor () {
|
||||
private _addresses: AddressSubject;
|
||||
|
||||
private _contracts: AddressSubject;
|
||||
|
||||
private _keyring?: KeyringInstance;
|
||||
|
||||
private _prefix?: Prefix;
|
||||
|
||||
protected _genesisHash?: string;
|
||||
|
||||
protected _store!: KeyringStore;
|
||||
|
||||
public constructor () {
|
||||
this._accounts = accounts;
|
||||
this._addresses = addresses;
|
||||
this._contracts = contracts;
|
||||
this._keyring = undefined;
|
||||
this._store = null as any;
|
||||
}
|
||||
|
||||
get accounts () {
|
||||
public get accounts (): AddressSubject {
|
||||
return this._accounts;
|
||||
}
|
||||
|
||||
get addresses () {
|
||||
public get addresses (): AddressSubject {
|
||||
return this._addresses;
|
||||
}
|
||||
|
||||
get contracts () {
|
||||
public get contracts (): AddressSubject {
|
||||
return this._contracts;
|
||||
}
|
||||
|
||||
get keyring (): KeyringInstance {
|
||||
public get keyring (): KeyringInstance {
|
||||
if (this._keyring) {
|
||||
return this._keyring;
|
||||
}
|
||||
@@ -54,29 +59,29 @@ export default class Base {
|
||||
throw new Error(`Keyring should be initialised via 'loadAll' before use`);
|
||||
}
|
||||
|
||||
get genesisHash () {
|
||||
public get genesisHash (): string | undefined {
|
||||
return this._genesisHash;
|
||||
}
|
||||
|
||||
decodeAddress = (key: string | Uint8Array, ignoreChecksum?: boolean): Uint8Array => {
|
||||
public decodeAddress = (key: string | Uint8Array, ignoreChecksum?: boolean): Uint8Array => {
|
||||
return this.keyring.decodeAddress(key, ignoreChecksum);
|
||||
}
|
||||
|
||||
encodeAddress = (key: string | Uint8Array): string => {
|
||||
public encodeAddress = (key: string | Uint8Array): string => {
|
||||
return this.keyring.encodeAddress(key);
|
||||
}
|
||||
|
||||
getPair (address: string | Uint8Array): KeyringPair {
|
||||
public getPair (address: string | Uint8Array): KeyringPair {
|
||||
return this.keyring.getPair(address);
|
||||
}
|
||||
|
||||
getPairs (): Array<KeyringPair> {
|
||||
return this.keyring.getPairs().filter((pair: KeyringPair) =>
|
||||
public getPairs (): KeyringPair[] {
|
||||
return this.keyring.getPairs().filter((pair: KeyringPair): boolean =>
|
||||
env.isDevelopment() || pair.meta.isTesting !== true
|
||||
);
|
||||
}
|
||||
|
||||
isAvailable (_address: Uint8Array | string): boolean {
|
||||
public isAvailable (_address: Uint8Array | string): boolean {
|
||||
const accountsValue = this.accounts.subject.getValue();
|
||||
const addressesValue = this.addresses.subject.getValue();
|
||||
const contractsValue = this.contracts.subject.getValue();
|
||||
@@ -87,15 +92,15 @@ export default class Base {
|
||||
return !accountsValue[address] && !addressesValue[address] && !contractsValue[address];
|
||||
}
|
||||
|
||||
isPassValid (password: string): boolean {
|
||||
public isPassValid (password: string): boolean {
|
||||
return password.length > 0 && password.length <= MAX_PASS_LEN;
|
||||
}
|
||||
|
||||
setAddressPrefix (prefix: number): void {
|
||||
public setAddressPrefix (prefix: number): void {
|
||||
this._prefix = prefix as Prefix;
|
||||
}
|
||||
|
||||
setDevMode (isDevelopment: boolean): void {
|
||||
public setDevMode (isDevelopment: boolean): void {
|
||||
env.set(isDevelopment);
|
||||
}
|
||||
|
||||
@@ -116,7 +121,7 @@ export default class Base {
|
||||
protected addAccountPairs (): void {
|
||||
this.keyring
|
||||
.getPairs()
|
||||
.forEach(({ address, meta }: KeyringPair) => {
|
||||
.forEach(({ address, meta }: KeyringPair): void => {
|
||||
this.accounts.add(this._store, address, { address, meta });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { KeyringPair, KeyringPair$Meta, KeyringPair$Json } from '@polkadot/keyring/types';
|
||||
import { KeypairType } from '@polkadot/util-crypto/types';
|
||||
import { SingleAddress } from './observable/types';
|
||||
import { AddressSubject, SingleAddress } from './observable/types';
|
||||
import { CreateResult, KeyringAddress, KeyringAddressType, KeyringItemType, KeyringJson, KeyringJson$Meta, KeyringOptions, KeyringStruct } from './types';
|
||||
|
||||
import createPair from '@polkadot/keyring/pair';
|
||||
@@ -21,13 +21,13 @@ const RECENT_EXPIRY = 24 * 60 * 60;
|
||||
// Chain determination occurs outside of Keyring. Loading `keyring.loadAll({ type: 'ed25519' | 'sr25519' })` is triggered
|
||||
// from the API after the chain is received
|
||||
export class Keyring extends Base implements KeyringStruct {
|
||||
stores = {
|
||||
address: () => this.addresses,
|
||||
contract: () => this.contracts,
|
||||
account: () => this.accounts
|
||||
private stores = {
|
||||
address: (): AddressSubject => this.addresses,
|
||||
contract: (): AddressSubject => this.contracts,
|
||||
account: (): AddressSubject => this.accounts
|
||||
};
|
||||
|
||||
addExternal (publicKey: Uint8Array, meta: KeyringPair$Meta = {}): CreateResult {
|
||||
public addExternal (publicKey: Uint8Array, meta: KeyringPair$Meta = {}): CreateResult {
|
||||
const pair = this.keyring.addFromAddress(publicKey, { ...meta, isExternal: true }, null);
|
||||
const json = this.saveAccount(pair);
|
||||
|
||||
@@ -37,7 +37,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
};
|
||||
}
|
||||
|
||||
addPair (pair: KeyringPair, password: string): CreateResult {
|
||||
public addPair (pair: KeyringPair, password: string): CreateResult {
|
||||
this.keyring.addPair(pair);
|
||||
const json = this.saveAccount(pair, password);
|
||||
|
||||
@@ -47,7 +47,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
};
|
||||
}
|
||||
|
||||
addUri (suri: string, password?: string, meta: KeyringPair$Meta = {}, type?: KeypairType): CreateResult {
|
||||
public addUri (suri: string, password?: string, meta: KeyringPair$Meta = {}, type?: KeypairType): CreateResult {
|
||||
const pair = this.keyring.addFromUri(suri, meta, type);
|
||||
const json = this.saveAccount(pair, password);
|
||||
|
||||
@@ -57,7 +57,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
};
|
||||
}
|
||||
|
||||
backupAccount (pair: KeyringPair, password: string): KeyringPair$Json {
|
||||
public backupAccount (pair: KeyringPair, password: string): KeyringPair$Json {
|
||||
if (!pair.isLocked) {
|
||||
pair.lock();
|
||||
}
|
||||
@@ -67,11 +67,11 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return pair.toJson(password);
|
||||
}
|
||||
|
||||
createFromUri (suri: string, meta: KeyringPair$Meta = {}, type?: KeypairType): KeyringPair {
|
||||
public createFromUri (suri: string, meta: KeyringPair$Meta = {}, type?: KeypairType): KeyringPair {
|
||||
return this.keyring.createFromUri(suri, meta, type);
|
||||
}
|
||||
|
||||
encryptAccount (pair: KeyringPair, password: string): void {
|
||||
public encryptAccount (pair: KeyringPair, password: string): void {
|
||||
const json = pair.toJson(password);
|
||||
|
||||
json.meta.whenEdited = Date.now();
|
||||
@@ -80,33 +80,33 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
this.accounts.add(this._store, pair.address, json);
|
||||
}
|
||||
|
||||
forgetAccount (address: string): void {
|
||||
public forgetAccount (address: string): void {
|
||||
this.keyring.removePair(address);
|
||||
this.accounts.remove(this._store, address);
|
||||
}
|
||||
|
||||
forgetAddress (address: string): void {
|
||||
public forgetAddress (address: string): void {
|
||||
this.addresses.remove(this._store, address);
|
||||
}
|
||||
|
||||
forgetContract (address: string): void {
|
||||
public forgetContract (address: string): void {
|
||||
this.contracts.remove(this._store, address);
|
||||
}
|
||||
|
||||
getAccount (address: string | Uint8Array): KeyringAddress | undefined {
|
||||
public getAccount (address: string | Uint8Array): KeyringAddress | undefined {
|
||||
return this.getAddress(address, 'account');
|
||||
}
|
||||
|
||||
getAccounts (): Array<KeyringAddress> {
|
||||
public getAccounts (): KeyringAddress[] {
|
||||
const available = this.accounts.subject.getValue();
|
||||
|
||||
return Object
|
||||
.keys(available)
|
||||
.map((address) => this.getAddress(address, 'account') as KeyringAddress)
|
||||
.filter((account) => env.isDevelopment() || account.meta.isTesting !== true);
|
||||
.map((address): KeyringAddress => this.getAddress(address, 'account') as KeyringAddress)
|
||||
.filter((account): boolean => env.isDevelopment() || account.meta.isTesting !== true);
|
||||
}
|
||||
|
||||
getAddress (_address: string | Uint8Array, type: KeyringItemType | null = null): KeyringAddress | undefined {
|
||||
public getAddress (_address: string | Uint8Array, type: KeyringItemType | null = null): KeyringAddress | undefined {
|
||||
const address = isString(_address)
|
||||
? _address
|
||||
: this.encodeAddress(_address);
|
||||
@@ -116,9 +116,8 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
? [this.stores[type]]
|
||||
: Object.values(this.stores);
|
||||
|
||||
const info = stores.reduce<SingleAddress | undefined>((lastInfo, store) =>
|
||||
(store().subject.getValue()[address] || lastInfo),
|
||||
undefined);
|
||||
const info = stores.reduce<SingleAddress | undefined>((lastInfo, store): SingleAddress | undefined =>
|
||||
(store().subject.getValue()[address] || lastInfo), undefined);
|
||||
|
||||
return info && {
|
||||
address,
|
||||
@@ -127,31 +126,32 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
};
|
||||
}
|
||||
|
||||
getAddresses (): Array<KeyringAddress> {
|
||||
public getAddresses (): KeyringAddress[] {
|
||||
const available = this.addresses.subject.getValue();
|
||||
|
||||
return Object
|
||||
.keys(available)
|
||||
.map((address) => this.getAddress(address) as KeyringAddress);
|
||||
.map((address): KeyringAddress => this.getAddress(address) as KeyringAddress);
|
||||
}
|
||||
|
||||
getContract (address: string | Uint8Array): KeyringAddress | undefined {
|
||||
public getContract (address: string | Uint8Array): KeyringAddress | undefined {
|
||||
return this.getAddress(address, 'contract');
|
||||
}
|
||||
|
||||
getContracts (): Array<KeyringAddress> {
|
||||
public getContracts (): KeyringAddress[] {
|
||||
const available = this.contracts.subject.getValue();
|
||||
|
||||
return Object
|
||||
.entries(available)
|
||||
.filter(([, data]) => {
|
||||
.filter(([, data]): boolean => {
|
||||
const { json: { meta: { contract } } } = data;
|
||||
return contract && contract.genesisHash === this.genesisHash;
|
||||
|
||||
return !!contract && contract.genesisHash === this.genesisHash;
|
||||
})
|
||||
.map(([address]) => this.getContract(address) as KeyringAddress);
|
||||
.map(([address]): KeyringAddress => this.getContract(address) as KeyringAddress);
|
||||
}
|
||||
|
||||
private rewriteKey (json: KeyringJson, key: string, hexAddr: string, creator: (addr: string) => string) {
|
||||
private rewriteKey (json: KeyringJson, key: string, hexAddr: string, creator: (addr: string) => string): void {
|
||||
if (hexAddr.substr(0, 2) === '0x') {
|
||||
return;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
this._store.set(creator(hexAddr), json);
|
||||
}
|
||||
|
||||
private loadAccount (json: KeyringJson, key: string) {
|
||||
private loadAccount (json: KeyringJson, key: string): void {
|
||||
if (!json.meta.isTesting && (json as KeyringPair$Json).encoded) {
|
||||
// FIXME Just for the transition period (ignoreChecksum)
|
||||
const pair = this.keyring.addFromJson(json as KeyringPair$Json, true);
|
||||
@@ -173,7 +173,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
this.rewriteKey(json, key, hexAddr.trim(), accountKey);
|
||||
}
|
||||
|
||||
private loadAddress (json: KeyringJson, key: string) {
|
||||
private loadAddress (json: KeyringJson, key: string): void {
|
||||
const { isRecent, whenCreated = 0 } = json.meta;
|
||||
|
||||
if (isRecent && (Date.now() - whenCreated) > RECENT_EXPIRY) {
|
||||
@@ -193,7 +193,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
this.rewriteKey(json, key, hexAddr, addressKey);
|
||||
}
|
||||
|
||||
private loadContract (json: KeyringJson, key: string) {
|
||||
private loadContract (json: KeyringJson, key: string): void {
|
||||
const address = this.encodeAddress(
|
||||
this.decodeAddress(json.address)
|
||||
);
|
||||
@@ -203,7 +203,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
this.rewriteKey(json, key, hexAddr, contractKey);
|
||||
}
|
||||
|
||||
private loadInjected (address: string, meta: KeyringJson$Meta) {
|
||||
private loadInjected (address: string, meta: KeyringJson$Meta): void {
|
||||
const json = {
|
||||
address,
|
||||
meta: {
|
||||
@@ -216,10 +216,10 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
this.accounts.add(this._store, pair.address, json);
|
||||
}
|
||||
|
||||
loadAll (options: KeyringOptions, injected: Array<{ address: string, meta: KeyringJson$Meta }> = []): void {
|
||||
public loadAll (options: KeyringOptions, injected: { address: string; meta: KeyringJson$Meta }[] = []): void {
|
||||
super.initKeyring(options);
|
||||
|
||||
this._store.all((key: string, json: KeyringJson) => {
|
||||
this._store.all((key: string, json: KeyringJson): void => {
|
||||
if (options.filter ? options.filter(json) : true) {
|
||||
if (accountRegex.test(key)) {
|
||||
this.loadAccount(json, key);
|
||||
@@ -237,14 +237,14 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
}
|
||||
});
|
||||
|
||||
injected.forEach(({ address, meta }) =>
|
||||
injected.forEach(({ address, meta }): void =>
|
||||
this.loadInjected(address, meta)
|
||||
);
|
||||
|
||||
keyringOption.init(this);
|
||||
}
|
||||
|
||||
restoreAccount (json: KeyringPair$Json, password: string): KeyringPair {
|
||||
public restoreAccount (json: KeyringPair$Json, password: string): KeyringPair {
|
||||
const type = Array.isArray(json.encoding.content) ? json.encoding.content[1] : 'ed25519';
|
||||
const pair = createPair(
|
||||
type,
|
||||
@@ -264,7 +264,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return pair;
|
||||
}
|
||||
|
||||
saveAccount (pair: KeyringPair, password?: string): KeyringPair$Json {
|
||||
public saveAccount (pair: KeyringPair, password?: string): KeyringPair$Json {
|
||||
this.addTimestamp(pair);
|
||||
|
||||
const json = pair.toJson(password);
|
||||
@@ -275,10 +275,10 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return json;
|
||||
}
|
||||
|
||||
saveAccountMeta (pair: KeyringPair, meta: KeyringPair$Meta): void {
|
||||
public saveAccountMeta (pair: KeyringPair, meta: KeyringPair$Meta): void {
|
||||
const address = pair.address;
|
||||
|
||||
this._store.get(accountKey(address), (json: KeyringJson) => {
|
||||
this._store.get(accountKey(address), (json: KeyringJson): void => {
|
||||
pair.setMeta(meta);
|
||||
json.meta = pair.meta;
|
||||
|
||||
@@ -286,7 +286,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
});
|
||||
}
|
||||
|
||||
saveAddress (address: string, meta: KeyringPair$Meta, type: KeyringAddressType = 'address'): KeyringPair$Json {
|
||||
public saveAddress (address: string, meta: KeyringPair$Meta, type: KeyringAddressType = 'address'): KeyringPair$Json {
|
||||
const available = this.addresses.subject.getValue();
|
||||
|
||||
const json = (available[address] && available[address].json) || {
|
||||
@@ -297,7 +297,7 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
}
|
||||
};
|
||||
|
||||
Object.keys(meta).forEach((key) => {
|
||||
Object.keys(meta).forEach((key): void => {
|
||||
json.meta[key] = meta[key];
|
||||
});
|
||||
|
||||
@@ -308,11 +308,11 @@ export class Keyring extends Base implements KeyringStruct {
|
||||
return json as KeyringPair$Json;
|
||||
}
|
||||
|
||||
saveContract (address: string, meta: KeyringPair$Meta): KeyringPair$Json {
|
||||
public saveContract (address: string, meta: KeyringPair$Meta): KeyringPair$Json {
|
||||
return this.saveAddress(address, meta, 'contract');
|
||||
}
|
||||
|
||||
saveRecent (address: string): SingleAddress {
|
||||
public saveRecent (address: string): SingleAddress {
|
||||
const available = this.addresses.subject.getValue();
|
||||
|
||||
if (!available[address]) {
|
||||
|
||||
@@ -10,20 +10,19 @@ import { BehaviorSubject } from 'rxjs';
|
||||
import createOptionItem from '../options/item';
|
||||
import development from './development';
|
||||
|
||||
function callNext (current: SubjectInfo, subject: BehaviorSubject<any>, withTest: boolean) {
|
||||
function callNext (current: SubjectInfo, subject: BehaviorSubject<SubjectInfo>, withTest: boolean): void {
|
||||
const isDevMode = development.isDevelopment();
|
||||
const filtered: SubjectInfo = {};
|
||||
|
||||
subject.next(
|
||||
Object.keys(current).reduce((filtered, key) => {
|
||||
const { json: { meta: { isTesting = false } = {} } = {} } = current[key];
|
||||
Object.keys(current).forEach((key): void => {
|
||||
const { json: { meta: { isTesting = false } = {} } = {} } = current[key];
|
||||
|
||||
if (!withTest || isDevMode || isTesting !== true) {
|
||||
filtered[key] = current[key];
|
||||
}
|
||||
if (!withTest || isDevMode || isTesting !== true) {
|
||||
filtered[key] = current[key];
|
||||
}
|
||||
});
|
||||
|
||||
return filtered;
|
||||
}, {} as SubjectInfo)
|
||||
);
|
||||
subject.next(filtered);
|
||||
}
|
||||
|
||||
export default function genericSubject (keyCreator: (address: string) => string, withTest: boolean = false): AddressSubject {
|
||||
@@ -56,7 +55,7 @@ export default function genericSubject (keyCreator: (address: string) => string,
|
||||
|
||||
return current[address];
|
||||
},
|
||||
remove: (store: KeyringStore, address: string) => {
|
||||
remove: (store: KeyringStore, address: string): void => {
|
||||
current = { ...current };
|
||||
|
||||
delete current[address];
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { SubjectInfo } from './types';
|
||||
|
||||
import { combineLatest } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@@ -9,12 +11,18 @@ import accounts from './accounts';
|
||||
import addresses from './addresses';
|
||||
import contracts from './contracts';
|
||||
|
||||
interface Result {
|
||||
accounts: SubjectInfo;
|
||||
addresses: SubjectInfo;
|
||||
contracts: SubjectInfo;
|
||||
}
|
||||
|
||||
export default combineLatest(
|
||||
accounts.subject,
|
||||
addresses.subject,
|
||||
contracts.subject
|
||||
).pipe(
|
||||
map(([accounts, addresses, contracts]) => ({
|
||||
map(([accounts, addresses, contracts]): Result => ({
|
||||
accounts,
|
||||
addresses,
|
||||
contracts
|
||||
|
||||
@@ -6,17 +6,17 @@ import { BehaviorSubject } from 'rxjs';
|
||||
import { KeyringSectionOption } from '../options/types';
|
||||
import { KeyringJson, KeyringStore } from '../types';
|
||||
|
||||
export type SingleAddress = {
|
||||
json: KeyringJson,
|
||||
option: KeyringSectionOption
|
||||
};
|
||||
export interface SingleAddress {
|
||||
json: KeyringJson;
|
||||
option: KeyringSectionOption;
|
||||
}
|
||||
|
||||
export type SubjectInfo = {
|
||||
[index: string]: SingleAddress
|
||||
};
|
||||
export interface SubjectInfo {
|
||||
[index: string]: SingleAddress;
|
||||
}
|
||||
|
||||
export type AddressSubject = {
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson) => SingleAddress,
|
||||
remove: (store: KeyringStore, address: string) => void,
|
||||
subject: BehaviorSubject<SubjectInfo>
|
||||
};
|
||||
export interface AddressSubject {
|
||||
add: (store: KeyringStore, address: string, json: KeyringJson) => SingleAddress;
|
||||
remove: (store: KeyringStore, address: string) => void;
|
||||
subject: BehaviorSubject<SubjectInfo>;
|
||||
}
|
||||
|
||||
@@ -6,15 +6,13 @@ import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import IdentityIcon from '@polkadot/ui-identicon';
|
||||
|
||||
type Props = {
|
||||
address: string,
|
||||
className?: string,
|
||||
isUppercase: boolean,
|
||||
name: string,
|
||||
style?: {
|
||||
[index: string]: string
|
||||
}
|
||||
};
|
||||
interface Props {
|
||||
address: string;
|
||||
className?: string;
|
||||
isUppercase: boolean;
|
||||
name: string;
|
||||
style?: Record<string, string>;
|
||||
}
|
||||
|
||||
const Wrapper = styled.div`
|
||||
display: flex;
|
||||
@@ -54,7 +52,7 @@ const Wrapper = styled.div`
|
||||
`;
|
||||
|
||||
export default class KeyPair extends React.PureComponent<Props> {
|
||||
render () {
|
||||
public render (): React.ReactNode {
|
||||
const { address, className, isUppercase, name, style } = this.props;
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,17 +2,19 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { KeyringStruct } from '../types';
|
||||
import keyringOptionInstance from '.';
|
||||
|
||||
describe('KeyringOption', () => {
|
||||
it('should not allow initOptions to be called more than once', () => {
|
||||
const state = {};
|
||||
describe('KeyringOption', (): void => {
|
||||
it('should not allow initOptions to be called more than once', (): void => {
|
||||
const state: Partial<KeyringStruct> = {};
|
||||
|
||||
// first call
|
||||
keyringOptionInstance.init(state as any);
|
||||
keyringOptionInstance.init(state as KeyringStruct);
|
||||
|
||||
// second call
|
||||
expect(() => {
|
||||
keyringOptionInstance.init(state as any);
|
||||
expect((): void => {
|
||||
keyringOptionInstance.init(state as KeyringStruct);
|
||||
}).toThrowError('Unable to initialise options more than once');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,14 +13,14 @@ import observableAll from '../observable';
|
||||
|
||||
let hasCalledInitOptions = false;
|
||||
|
||||
const sortByName = (a: SingleAddress, b: SingleAddress) => {
|
||||
const sortByName = (a: SingleAddress, b: SingleAddress): number => {
|
||||
const valueA = a.option.name;
|
||||
const valueB = b.option.name;
|
||||
|
||||
return valueA.localeCompare(valueB);
|
||||
};
|
||||
|
||||
const sortByCreated = (a: SingleAddress, b: SingleAddress) => {
|
||||
const sortByCreated = (a: SingleAddress, b: SingleAddress): number => {
|
||||
const valueA = a.json.meta.whenCreated || 0;
|
||||
const valueB = b.json.meta.whenCreated || 0;
|
||||
|
||||
@@ -36,9 +36,9 @@ const sortByCreated = (a: SingleAddress, b: SingleAddress) => {
|
||||
};
|
||||
|
||||
class KeyringOption implements KeyringOptionInstance {
|
||||
optionsSubject: BehaviorSubject<KeyringOptions> = new BehaviorSubject(this.emptyOptions());
|
||||
public readonly optionsSubject: BehaviorSubject<KeyringOptions> = new BehaviorSubject(this.emptyOptions());
|
||||
|
||||
createOptionHeader (name: string): KeyringSectionOption {
|
||||
public createOptionHeader (name: string): KeyringSectionOption {
|
||||
return {
|
||||
className: 'header disabled',
|
||||
name,
|
||||
@@ -48,10 +48,10 @@ class KeyringOption implements KeyringOptionInstance {
|
||||
};
|
||||
}
|
||||
|
||||
init (keyring: KeyringStruct): void {
|
||||
public init (keyring: KeyringStruct): void {
|
||||
assert(!hasCalledInitOptions, 'Unable to initialise options more than once');
|
||||
|
||||
observableAll.subscribe(() => {
|
||||
observableAll.subscribe((): void => {
|
||||
const options = this.emptyOptions();
|
||||
|
||||
this.addAccounts(keyring, options);
|
||||
@@ -59,15 +59,15 @@ class KeyringOption implements KeyringOptionInstance {
|
||||
this.addContracts(keyring, options);
|
||||
|
||||
options.address = this.linkItems({
|
||||
'Addresses': options.address,
|
||||
'Recent': options.recent
|
||||
Addresses: options.address,
|
||||
Recent: options.recent
|
||||
});
|
||||
options.account = this.linkItems({
|
||||
'Accounts': options.account,
|
||||
'Development': options.testing
|
||||
Accounts: options.account,
|
||||
Development: options.testing
|
||||
});
|
||||
options.contract = this.linkItems({
|
||||
'Contracts': options.contract
|
||||
Contracts: options.contract
|
||||
});
|
||||
|
||||
options.all = ([] as KeyringSectionOptions).concat(
|
||||
@@ -87,8 +87,8 @@ class KeyringOption implements KeyringOptionInstance {
|
||||
hasCalledInitOptions = true;
|
||||
}
|
||||
|
||||
private linkItems (items: { [index: string]: KeyringSectionOptions }) {
|
||||
return Object.keys(items).reduce((result, header) => {
|
||||
private linkItems (items: { [index: string]: KeyringSectionOptions }): KeyringSectionOptions {
|
||||
return Object.keys(items).reduce((result, header): KeyringSectionOptions => {
|
||||
const options = items[header];
|
||||
|
||||
return result.concat(
|
||||
@@ -106,7 +106,7 @@ class KeyringOption implements KeyringOptionInstance {
|
||||
Object
|
||||
.values(available)
|
||||
.sort(sortByName)
|
||||
.forEach(({ json: { meta: { isTesting = false } }, option }: SingleAddress) => {
|
||||
.forEach(({ json: { meta: { isTesting = false } }, option }: SingleAddress): void => {
|
||||
if (!isTesting) {
|
||||
options.account.push(option);
|
||||
} else {
|
||||
@@ -120,21 +120,17 @@ class KeyringOption implements KeyringOptionInstance {
|
||||
|
||||
Object
|
||||
.values(available)
|
||||
.filter(({ json }: SingleAddress) => {
|
||||
return json.meta.isRecent;
|
||||
})
|
||||
.filter(({ json }: SingleAddress): boolean => !!json.meta.isRecent)
|
||||
.sort(sortByCreated)
|
||||
.forEach(({ option }: SingleAddress) => {
|
||||
.forEach(({ option }: SingleAddress): void => {
|
||||
options.recent.push(option);
|
||||
});
|
||||
|
||||
Object
|
||||
.values(available)
|
||||
.filter(({ json }: SingleAddress) => {
|
||||
return !json.meta.isRecent;
|
||||
})
|
||||
.filter(({ json }: SingleAddress): boolean => !json.meta.isRecent)
|
||||
.sort(sortByName)
|
||||
.forEach(({ option }: SingleAddress) => {
|
||||
.forEach(({ option }: SingleAddress): void => {
|
||||
options.address.push(option);
|
||||
});
|
||||
}
|
||||
@@ -145,7 +141,7 @@ class KeyringOption implements KeyringOptionInstance {
|
||||
Object
|
||||
.values(available)
|
||||
.sort(sortByName)
|
||||
.forEach(({ option }: SingleAddress) => {
|
||||
.forEach(({ option }: SingleAddress): void => {
|
||||
options.contract.push(option);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,17 +4,19 @@
|
||||
|
||||
import { KeyringItemType, KeyringStruct } from '../types';
|
||||
|
||||
export type KeyringSectionOption = {
|
||||
className?: string,
|
||||
disabled?: boolean,
|
||||
content?: any | string, // node?
|
||||
key: string | null,
|
||||
name: string,
|
||||
text: any | string, // node?
|
||||
value: string | null
|
||||
};
|
||||
import React from 'react';
|
||||
|
||||
export type KeyringSectionOptions = Array<KeyringSectionOption>;
|
||||
export interface KeyringSectionOption {
|
||||
className?: string;
|
||||
disabled?: boolean;
|
||||
content?: React.ReactNode;
|
||||
key: string | null;
|
||||
name: string;
|
||||
text: React.ReactNode;
|
||||
value: string | null;
|
||||
}
|
||||
|
||||
export type KeyringSectionOptions = KeyringSectionOption[];
|
||||
|
||||
export type KeyringOptions = {
|
||||
[type in KeyringItemType | 'all' | 'allPlus' | 'recent' | 'testing']: KeyringSectionOptions
|
||||
|
||||
@@ -2,27 +2,27 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { KeyringStore } from '../types';
|
||||
import { KeyringStore, KeyringJson } from '../types';
|
||||
|
||||
import store from 'store';
|
||||
|
||||
export default class BrowserStore implements KeyringStore {
|
||||
all (cb: (key: string, value: any) => void): void {
|
||||
store.each((value: any, key: string) =>
|
||||
cb(key, value)
|
||||
);
|
||||
public all (cb: (key: string, value: KeyringJson) => void): void {
|
||||
store.each((value: KeyringJson, key: string): void => {
|
||||
cb(key, value);
|
||||
});
|
||||
}
|
||||
|
||||
get (key: string, cb: (value: any) => void): void {
|
||||
public get (key: string, cb: (value: KeyringJson) => void): void {
|
||||
cb(store.get(key));
|
||||
}
|
||||
|
||||
remove (key: string, cb?: () => void): void {
|
||||
public remove (key: string, cb?: () => void): void {
|
||||
store.remove(key);
|
||||
cb && cb();
|
||||
}
|
||||
|
||||
set (key: string, value: any, cb?: () => void): void {
|
||||
public set (key: string, value: KeyringJson, cb?: () => void): void {
|
||||
store.set(key, value);
|
||||
cb && cb();
|
||||
}
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { KeyringStore } from '../types';
|
||||
import { KeyringStore, KeyringJson } from '../types';
|
||||
|
||||
import extension from 'extensionizer';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type StoreValue = Record<string, any>;
|
||||
|
||||
const lastError = (type: string): void => {
|
||||
const error = extension.runtime.lastError;
|
||||
|
||||
@@ -15,33 +18,34 @@ const lastError = (type: string): void => {
|
||||
};
|
||||
|
||||
export default class ExtensionStore implements KeyringStore {
|
||||
all (cb: (key: string, value: any) => void): void {
|
||||
extension.storage.local.get(null, (result: { [index: string]: any }) => {
|
||||
public all (cb: (key: string, value: KeyringJson) => void): void {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
extension.storage.local.get(null, (result: StoreValue): void => {
|
||||
lastError('all');
|
||||
|
||||
Object.entries(result).forEach(([key, value]) =>
|
||||
cb(key, value)
|
||||
);
|
||||
Object.entries(result).forEach(([key, value]): void => {
|
||||
cb(key, value);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
get (key: string, cb: (value: any) => void): void {
|
||||
extension.storage.local.get([key], (result: { [index: string]: any }) => {
|
||||
public get (key: string, cb: (value: KeyringJson) => void): void {
|
||||
extension.storage.local.get([key], (result: StoreValue): void => {
|
||||
lastError('get');
|
||||
|
||||
cb(result[key]);
|
||||
});
|
||||
}
|
||||
|
||||
remove (key: string, cb?: () => void): void {
|
||||
extension.storage.local.remove(key, () => {
|
||||
public remove (key: string, cb?: () => void): void {
|
||||
extension.storage.local.remove(key, (): void => {
|
||||
lastError('remove');
|
||||
|
||||
cb && cb();
|
||||
});
|
||||
}
|
||||
|
||||
set (key: string, value: any, cb?: () => void): void {
|
||||
public set (key: string, value: KeyringJson, cb?: () => void): void {
|
||||
// shortcut, don't save testing accounts in extension storage
|
||||
if (key.indexOf('account:') === 0 && value.meta && value.meta.isTesting) {
|
||||
cb && cb();
|
||||
@@ -49,7 +53,7 @@ export default class ExtensionStore implements KeyringStore {
|
||||
return;
|
||||
}
|
||||
|
||||
extension.storage.local.set({ [key]: value }, () => {
|
||||
extension.storage.local.set({ [key]: value }, (): void => {
|
||||
lastError('set');
|
||||
|
||||
cb && cb();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { KeyringStore } from '../types';
|
||||
import { KeyringStore, KeyringJson } from '../types';
|
||||
|
||||
import fs from 'fs';
|
||||
import mkdirp from 'mkdirp';
|
||||
@@ -12,7 +12,7 @@ import path from 'path';
|
||||
export default class FileStore implements KeyringStore {
|
||||
private _path: string;
|
||||
|
||||
constructor (path: string) {
|
||||
public constructor (path: string) {
|
||||
if (!fs.existsSync(path)) {
|
||||
mkdirp.sync(path);
|
||||
}
|
||||
@@ -20,23 +20,25 @@ export default class FileStore implements KeyringStore {
|
||||
this._path = path;
|
||||
}
|
||||
|
||||
all (cb: (key: string, value: any) => void): void {
|
||||
public all (cb: (key: string, value: KeyringJson) => void): void {
|
||||
fs
|
||||
.readdirSync(this._path)
|
||||
.filter((key) => !['.', '..'].includes(key))
|
||||
.forEach((key) => cb(key, this._readKey(key)));
|
||||
.filter((key): boolean => !['.', '..'].includes(key))
|
||||
.forEach((key): void => {
|
||||
cb(key, this._readKey(key));
|
||||
});
|
||||
}
|
||||
|
||||
get (key: string, cb: (value: any) => void): void {
|
||||
public get (key: string, cb: (value: KeyringJson) => void): void {
|
||||
cb(this._readKey(key));
|
||||
}
|
||||
|
||||
remove (key: string, cb?: () => void): void {
|
||||
public remove (key: string, cb?: () => void): void {
|
||||
fs.unlinkSync(this._getPath(key));
|
||||
cb && cb();
|
||||
}
|
||||
|
||||
set (key: string, value: any, cb?: () => void): void {
|
||||
public set (key: string, value: KeyringJson, cb?: () => void): void {
|
||||
fs.writeFileSync(this._getPath(key), Buffer.from(JSON.stringify(value), 'utf-8'));
|
||||
cb && cb();
|
||||
}
|
||||
@@ -45,7 +47,7 @@ export default class FileStore implements KeyringStore {
|
||||
return path.join(this._path, key);
|
||||
}
|
||||
|
||||
private _readKey (key: string): any {
|
||||
private _readKey (key: string): KeyringJson {
|
||||
return JSON.parse(
|
||||
fs.readFileSync(this._getPath(key)).toString('utf-8')
|
||||
);
|
||||
|
||||
@@ -7,56 +7,58 @@ import { KeyringInstance as BaseKeyringInstance, KeyringPair, KeyringPair$Meta,
|
||||
import { KeypairType } from '@polkadot/util-crypto/types';
|
||||
import { AddressSubject, SingleAddress } from './observable/types';
|
||||
|
||||
export type ContractMeta = {
|
||||
abi: string,
|
||||
genesisHash?: string
|
||||
};
|
||||
|
||||
export interface KeyringStore {
|
||||
all: (cb: (key: string, value: any) => void) => void;
|
||||
get: (key: string, cb: (value: any) => void) => void;
|
||||
remove: (key: string, cb?: () => void) => void;
|
||||
set: (key: string, value: any, cb?: () => void) => void;
|
||||
export interface ContractMeta {
|
||||
abi: string;
|
||||
genesisHash?: string;
|
||||
}
|
||||
|
||||
export type KeyringOptions = KeyringOptionsBase & {
|
||||
filter?: (json: KeyringJson) => boolean,
|
||||
genesisHash?: Hash,
|
||||
isDevelopment?: boolean,
|
||||
store?: KeyringStore
|
||||
};
|
||||
export interface KeyringStore {
|
||||
all: (cb: (key: string, value: KeyringJson) => void) => void;
|
||||
get: (key: string, cb: (value: KeyringJson) => void) => void;
|
||||
remove: (key: string, cb?: () => void) => void;
|
||||
set: (key: string, value: KeyringJson, cb?: () => void) => void;
|
||||
}
|
||||
|
||||
export type KeyringJson$Meta = {
|
||||
contract?: ContractMeta,
|
||||
isInjected?: boolean,
|
||||
isRecent?: boolean,
|
||||
isTesting?: boolean,
|
||||
name?: string,
|
||||
whenCreated?: number,
|
||||
whenEdited?: number,
|
||||
whenUsed?: number,
|
||||
[index: string]: any
|
||||
};
|
||||
export interface KeyringOptions extends KeyringOptionsBase {
|
||||
filter?: (json: KeyringJson) => boolean;
|
||||
genesisHash?: Hash;
|
||||
isDevelopment?: boolean;
|
||||
store?: KeyringStore;
|
||||
}
|
||||
|
||||
export type KeyringJson = {
|
||||
address: string,
|
||||
meta: KeyringJson$Meta
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/class-name-casing
|
||||
export interface KeyringJson$Meta {
|
||||
contract?: ContractMeta;
|
||||
isInjected?: boolean;
|
||||
isRecent?: boolean;
|
||||
isTesting?: boolean;
|
||||
name?: string;
|
||||
whenCreated?: number;
|
||||
whenEdited?: number;
|
||||
whenUsed?: number;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[index: string]: any;
|
||||
}
|
||||
|
||||
export type KeyringAddress = {
|
||||
readonly address: string,
|
||||
readonly meta: KeyringJson$Meta,
|
||||
readonly publicKey: Uint8Array
|
||||
};
|
||||
export interface KeyringJson {
|
||||
address: string;
|
||||
meta: KeyringJson$Meta;
|
||||
}
|
||||
|
||||
export interface KeyringAddress {
|
||||
readonly address: string;
|
||||
readonly meta: KeyringJson$Meta;
|
||||
readonly publicKey: Uint8Array;
|
||||
}
|
||||
|
||||
export type KeyringAddressType = 'address' | 'contract';
|
||||
|
||||
export type KeyringItemType = 'account' | KeyringAddressType;
|
||||
|
||||
export type CreateResult = {
|
||||
json: KeyringPair$Json,
|
||||
pair: KeyringPair
|
||||
};
|
||||
export interface CreateResult {
|
||||
json: KeyringPair$Json;
|
||||
pair: KeyringPair;
|
||||
}
|
||||
|
||||
export interface KeyringStruct {
|
||||
readonly accounts: AddressSubject;
|
||||
@@ -77,13 +79,13 @@ export interface KeyringStruct {
|
||||
forgetAddress: (address: string) => void;
|
||||
forgetContract: (address: string) => void;
|
||||
getAccount: (address: string | Uint8Array) => KeyringAddress | undefined;
|
||||
getAccounts: () => Array<KeyringAddress>;
|
||||
getAccounts: () => KeyringAddress[];
|
||||
getAddress: (address: string | Uint8Array, type: KeyringItemType | null) => KeyringAddress | undefined;
|
||||
getAddresses: () => Array<KeyringAddress>;
|
||||
getAddresses: () => KeyringAddress[];
|
||||
getContract: (address: string | Uint8Array) => KeyringAddress | undefined;
|
||||
getContracts: (genesisHash?: string) => Array<KeyringAddress>;
|
||||
getContracts: (genesisHash?: string) => KeyringAddress[];
|
||||
getPair: (address: string | Uint8Array) => KeyringPair;
|
||||
getPairs: () => Array<KeyringPair>;
|
||||
getPairs: () => KeyringPair[];
|
||||
isAvailable: (address: string | Uint8Array) => boolean;
|
||||
isPassValid: (password: string) => boolean;
|
||||
loadAll: (options: KeyringOptions) => void;
|
||||
|
||||
@@ -9,12 +9,16 @@ import { Options, SettingsStruct } from './types';
|
||||
|
||||
export class Settings implements SettingsStruct {
|
||||
private _apiUrl: string;
|
||||
|
||||
private _i18nLang: string;
|
||||
|
||||
private _locking: string;
|
||||
|
||||
private _uiMode: string;
|
||||
|
||||
private _uiTheme: string;
|
||||
|
||||
constructor () {
|
||||
public constructor () {
|
||||
const settings = store.get('settings') || {};
|
||||
|
||||
this._apiUrl = settings.apiUrl || process.env.WS_URL || ENDPOINT_DEFAULT;
|
||||
@@ -24,51 +28,51 @@ export class Settings implements SettingsStruct {
|
||||
this._uiTheme = settings.uiTheme || UITHEME_DEFAULT;
|
||||
}
|
||||
|
||||
get apiUrl (): string {
|
||||
public get apiUrl (): string {
|
||||
return this._apiUrl;
|
||||
}
|
||||
|
||||
get i18nLang (): string {
|
||||
public get i18nLang (): string {
|
||||
return this._i18nLang;
|
||||
}
|
||||
|
||||
get locking (): string {
|
||||
public get locking (): string {
|
||||
return this._locking;
|
||||
}
|
||||
|
||||
get uiMode (): string {
|
||||
public get uiMode (): string {
|
||||
return this._uiMode;
|
||||
}
|
||||
|
||||
get uiTheme (): string {
|
||||
public get uiTheme (): string {
|
||||
return this._uiTheme;
|
||||
}
|
||||
|
||||
get availableNodes (): Options {
|
||||
public get availableNodes (): Options {
|
||||
return ENDPOINTS;
|
||||
}
|
||||
|
||||
get availableCryptos (): Options {
|
||||
public get availableCryptos (): Options {
|
||||
return CRYPTOS;
|
||||
}
|
||||
|
||||
get availableLanguages (): Options {
|
||||
public get availableLanguages (): Options {
|
||||
return LANGUAGES;
|
||||
}
|
||||
|
||||
get availableLocking (): Options {
|
||||
public get availableLocking (): Options {
|
||||
return LOCKING;
|
||||
}
|
||||
|
||||
get availableUIModes (): Options {
|
||||
public get availableUIModes (): Options {
|
||||
return UIMODES;
|
||||
}
|
||||
|
||||
get availableUIThemes (): Options {
|
||||
public get availableUIThemes (): Options {
|
||||
return UITHEMES;
|
||||
}
|
||||
|
||||
get (): SettingsStruct {
|
||||
public get (): SettingsStruct {
|
||||
return {
|
||||
apiUrl: this._apiUrl,
|
||||
i18nLang: this._i18nLang,
|
||||
@@ -78,7 +82,7 @@ export class Settings implements SettingsStruct {
|
||||
};
|
||||
}
|
||||
|
||||
set (settings: Partial<SettingsStruct>): void {
|
||||
public set (settings: Partial<SettingsStruct>): void {
|
||||
this._apiUrl = settings.apiUrl || this._apiUrl;
|
||||
this._i18nLang = settings.i18nLang || this._i18nLang;
|
||||
this._locking = settings.locking || this._locking;
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export type Options = Array<{
|
||||
disabled?: boolean,
|
||||
text: string,
|
||||
value: string
|
||||
}>;
|
||||
export type Options = {
|
||||
disabled?: boolean;
|
||||
text: string;
|
||||
value: string;
|
||||
}[]
|
||||
|
||||
export interface SettingsStruct {
|
||||
apiUrl: string;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "@polkadot/dev-react/config/tslint"
|
||||
}
|
||||
@@ -1962,10 +1962,10 @@
|
||||
dependencies:
|
||||
"@types/chrome" "^0.0.86"
|
||||
|
||||
"@polkadot/types@^0.82.0-beta.48":
|
||||
version "0.82.0-beta.48"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.82.0-beta.48.tgz#9e746d8860fb691e3a4fcc25d974843f321e7dd9"
|
||||
integrity sha512-nMKAejUbM9rTWfUxBQvTBYNGd7Ga2D4cRVO7xjRUk96w+QTY/KKxpEA1KaENnTrqubHDcauNP39hcChMTGXNGw==
|
||||
"@polkadot/types@^0.82.0-beta.53":
|
||||
version "0.82.0-beta.53"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.82.0-beta.53.tgz#aba4053fde27609484039f7e1c460927b01c9bc0"
|
||||
integrity sha512-lKTMVZLilimjRs079LEe7nl+HAdwpwIjLpv9ByrdXYBTIDIUXi+LkGrZ+cV7k4Rk/YNM/R1MDttf6EYbx/j++w==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.5.4"
|
||||
"@polkadot/util" "^0.94.0-beta.9"
|
||||
@@ -2299,38 +2299,38 @@
|
||||
integrity sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw==
|
||||
|
||||
"@typescript-eslint/eslint-plugin@^1.11.0":
|
||||
version "1.11.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.11.0.tgz#870f752c520db04db6d3668af7479026a6f2fb9a"
|
||||
integrity sha512-mXv9ccCou89C8/4avKHuPB2WkSZyY/XcTQUXd5LFZAcLw1I3mWYVjUu6eS9Ja0QkP/ClolbcW9tb3Ov/pMdcqw==
|
||||
version "1.12.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.12.0.tgz#96b4e08b5f998a198b8414508b1a289f9e8c549a"
|
||||
integrity sha512-J/ZTZF+pLNqjXBGNfq5fahsoJ4vJOkYbitWPavA05IrZ7BXUaf4XWlhUB/ic1lpOGTRpLWF+PLAePjiHp6dz8g==
|
||||
dependencies:
|
||||
"@typescript-eslint/experimental-utils" "1.11.0"
|
||||
"@typescript-eslint/experimental-utils" "1.12.0"
|
||||
eslint-utils "^1.3.1"
|
||||
functional-red-black-tree "^1.0.1"
|
||||
regexpp "^2.0.1"
|
||||
tsutils "^3.7.0"
|
||||
|
||||
"@typescript-eslint/experimental-utils@1.11.0":
|
||||
version "1.11.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.11.0.tgz#594abe47091cbeabac1d6f9cfed06d0ad99eb7e3"
|
||||
integrity sha512-7LbfaqF6B8oa8cp/315zxKk8FFzosRzzhF8Kn/ZRsRsnpm7Qcu25cR/9RnAQo5utZ2KIWVgaALr+ZmcbG47ruw==
|
||||
"@typescript-eslint/experimental-utils@1.12.0":
|
||||
version "1.12.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.12.0.tgz#98417ee2e0c6fe8d1e50d934a6535d9c0f4277b6"
|
||||
integrity sha512-s0soOTMJloytr9GbPteMLNiO2HvJ+qgQkRNplABXiVw6vq7uQRvidkby64Gqt/nA7pys74HksHwRULaB/QRVyw==
|
||||
dependencies:
|
||||
"@typescript-eslint/typescript-estree" "1.11.0"
|
||||
"@typescript-eslint/typescript-estree" "1.12.0"
|
||||
eslint-scope "^4.0.0"
|
||||
|
||||
"@typescript-eslint/parser@^1.11.0":
|
||||
version "1.11.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.11.0.tgz#2f6d4f7e64eeb1e7c25b422f8df14d0c9e508e36"
|
||||
integrity sha512-5xBExyXaxVyczrZvbRKEXvaTUFFq7gIM9BynXukXZE0zF3IQP/FxF4mPmmh3gJ9egafZFqByCpPTFm3dk4SY7Q==
|
||||
version "1.12.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.12.0.tgz#9965895ec4745578185965d63f21510f93a3f35a"
|
||||
integrity sha512-0uzbaa9ZLCA5yMWJywnJJ7YVENKGWVUhJDV5UrMoldC5HoI54W5kkdPhTfmtFKpPFp93MIwmJj0/61ztvmz5Dw==
|
||||
dependencies:
|
||||
"@types/eslint-visitor-keys" "^1.0.0"
|
||||
"@typescript-eslint/experimental-utils" "1.11.0"
|
||||
"@typescript-eslint/typescript-estree" "1.11.0"
|
||||
"@typescript-eslint/experimental-utils" "1.12.0"
|
||||
"@typescript-eslint/typescript-estree" "1.12.0"
|
||||
eslint-visitor-keys "^1.0.0"
|
||||
|
||||
"@typescript-eslint/typescript-estree@1.11.0":
|
||||
version "1.11.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.11.0.tgz#b7b5782aab22e4b3b6d84633652c9f41e62d37d5"
|
||||
integrity sha512-fquUHF5tAx1sM2OeRCC7wVxFd1iMELWMGCzOSmJ3pLzArj9+kRixdlC4d5MncuzXpjEqc6045p3KwM0o/3FuUA==
|
||||
"@typescript-eslint/typescript-estree@1.12.0":
|
||||
version "1.12.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.12.0.tgz#d8dd0a7cffb5e3c0c3e98714042d83e316dfc9a9"
|
||||
integrity sha512-nwN6yy//XcVhFs0ZyU+teJHB8tbCm7AIA8mu6E2r5hu6MajwYBY3Uwop7+rPZWUN/IUOHpL8C+iUPMDVYUU3og==
|
||||
dependencies:
|
||||
lodash.unescape "4.0.1"
|
||||
semver "5.5.0"
|
||||
@@ -4392,12 +4392,12 @@ cosmiconfig@^5.0.0, cosmiconfig@^5.1.0:
|
||||
parse-json "^4.0.0"
|
||||
|
||||
coveralls@^3.0.3:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.4.tgz#f50233c9c62fd0973f710fce85fd19dba24cff4b"
|
||||
integrity sha512-eyqUWA/7RT0JagiL0tThVhjbIjoiEUyWCjtUJoOPcWoeofP5WK/jb2OJYoBFrR6DvplR+AxOyuBqk4JHkk5ykA==
|
||||
version "3.0.5"
|
||||
resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.5.tgz#28d7274c6c9827aa85537eab82d66e7e62d0d527"
|
||||
integrity sha512-/KD7PGfZv/tjKB6LoW97jzIgFqem0Tu9tZL9/iwBnBd8zkIZp7vT1ZSHNvnr0GSQMV/LTMxUstWg8WcDDUVQKg==
|
||||
dependencies:
|
||||
growl "~> 1.10.0"
|
||||
js-yaml "^3.11.0"
|
||||
js-yaml "^3.13.1"
|
||||
lcov-parse "^0.0.10"
|
||||
log-driver "^1.2.7"
|
||||
minimist "^1.2.0"
|
||||
@@ -5431,9 +5431,9 @@ eslint-config-semistandard@^13.0.0:
|
||||
integrity sha512-ZuImKnf/9LeZjr6dtRJ0zEdQbjBwXu0PJR3wXJXoQeMooICMrYPyD70O1tIA9Ng+wutgLjB7UXvZOKYPvzHg+w==
|
||||
|
||||
eslint-config-standard@^13.0.0:
|
||||
version "13.0.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-13.0.0.tgz#8032d6fe954f651399763ba4607294aa3c201a23"
|
||||
integrity sha512-GRvEpe2lnML3qPqNryLPjgbU0nDeGBEWOC/IMfn/DjDLyO7DoASyDtGtPhN+Z+XDGUzrHWF8dKDLdDx2bO6CGw==
|
||||
version "13.0.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-13.0.1.tgz#c9c6ffe0cfb8a51535bc5c7ec9f70eafb8c6b2c0"
|
||||
integrity sha512-zLKp4QOgq6JFgRm1dDCVv1Iu0P5uZ4v5Wa4DTOkg2RFMxdCX/9Qf7lz9ezRj2dBRa955cWQF/O/LWEiYWAHbTw==
|
||||
|
||||
eslint-import-resolver-node@^0.3.2:
|
||||
version "0.3.2"
|
||||
@@ -8324,9 +8324,9 @@ levn@^0.3.0, levn@~0.3.0:
|
||||
type-check "~0.3.2"
|
||||
|
||||
linkify-it@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.1.0.tgz#c4caf38a6cd7ac2212ef3c7d2bde30a91561f9db"
|
||||
integrity sha512-4REs8/062kV2DSHxNfq5183zrqXMl7WP0WzABH9IeJI+NLm429FgE1PDecltYfnOoFDFlZGh2T8PfZn0r+GTRg==
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf"
|
||||
integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==
|
||||
dependencies:
|
||||
uc.micro "^1.0.1"
|
||||
|
||||
@@ -10036,9 +10036,9 @@ pn@^1.1.0:
|
||||
integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==
|
||||
|
||||
portfinder@^1.0.13, portfinder@^1.0.20:
|
||||
version "1.0.20"
|
||||
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.20.tgz#bea68632e54b2e13ab7b0c4775e9b41bf270e44a"
|
||||
integrity sha512-Yxe4mTyDzTd59PZJY4ojZR8F+E5e97iq2ZOHPz3HDgSvYC5siNad2tLooQ5y5QHyQhc3xVqvyk/eNA3wuoa7Sw==
|
||||
version "1.0.21"
|
||||
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.21.tgz#60e1397b95ac170749db70034ece306b9a27e324"
|
||||
integrity sha512-ESabpDCzmBS3ekHbmpAIiESq3udRsCBGiBZLsC+HgBKv2ezb0R4oG+7RnYEVZ/ZCfhel5Tx3UzdNWA0Lox2QCA==
|
||||
dependencies:
|
||||
async "^1.5.2"
|
||||
debug "^2.2.0"
|
||||
@@ -12610,9 +12610,9 @@ typedoc-plugin-markdown@^2.0.8:
|
||||
integrity sha512-lpaesvB5N2teG6uI9CvaX0YF0O78EGo8HAk24LYe8lkEfR4+ymgZe178luGaJiOc54fKycW+MoS8qZPoX065fg==
|
||||
|
||||
typedoc-plugin-no-inherit@^1.1.8:
|
||||
version "1.1.8"
|
||||
resolved "https://registry.yarnpkg.com/typedoc-plugin-no-inherit/-/typedoc-plugin-no-inherit-1.1.8.tgz#4abc1ca18babb1ad73ff303fb358ffff111b76bc"
|
||||
integrity sha512-bcyYnRxXG1Wz1pA9ZUeFQHoO1sZJsgbPc7ynC+HxSCfeamUX228pVed03OzMJPFsmSNdV0/OmD/SPYhQ6jQXig==
|
||||
version "1.1.9"
|
||||
resolved "https://registry.yarnpkg.com/typedoc-plugin-no-inherit/-/typedoc-plugin-no-inherit-1.1.9.tgz#918b05247136ac1252f4444e685a175922156cb6"
|
||||
integrity sha512-Mw9569aOopX/OdcVgjG2GxsfDpPhvXPbptlYLgDWjvgWYZjzeKxkMFZOU9zbTUnB9KGDj8fFuG9yvcczq09Kyw==
|
||||
|
||||
typedoc@^0.14.2:
|
||||
version "0.14.2"
|
||||
|
||||
Reference in New Issue
Block a user