mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-17 20:41:04 +00:00
+3
-3
@@ -31,9 +31,9 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.9.6",
|
"@babel/core": "^7.9.6",
|
||||||
"@babel/runtime": "^7.9.6",
|
"@babel/runtime": "^7.9.6",
|
||||||
"@polkadot/dev": "^0.53.5",
|
"@polkadot/dev": "^0.54.1",
|
||||||
"@polkadot/ts": "^0.3.22",
|
"@polkadot/ts": "^0.3.23",
|
||||||
"@types/jest": "^25.2.2",
|
"@types/jest": "^25.2.3",
|
||||||
"babel-plugin-transform-vue-template": "^0.4.2",
|
"babel-plugin-transform-vue-template": "^0.4.2",
|
||||||
"empty": "^0.10.1",
|
"empty": "^0.10.1",
|
||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
|
|||||||
@@ -113,7 +113,9 @@ function App ({ className }: Props): React.ReactElement<Props> | null {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
cryptoWaitReady().then((): void => {
|
cryptoWaitReady()
|
||||||
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
|
.then((): void => {
|
||||||
ReactDOM.render(<App />, rootElement);
|
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
|
||||||
});
|
ReactDOM.render(<App />, rootElement);
|
||||||
|
})
|
||||||
|
.catch(console.error);
|
||||||
|
|||||||
@@ -88,10 +88,12 @@ const Example = Vue.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cryptoWaitReady().then((): void => {
|
cryptoWaitReady()
|
||||||
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
|
.then((): void => {
|
||||||
|
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
render: (h): VNode => h(Example)
|
render: (h): VNode => h(Example)
|
||||||
}).$mount('#example');
|
}).$mount('#example');
|
||||||
});
|
})
|
||||||
|
.catch(console.error);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
|
|||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
body: {
|
body: {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
||||||
backgroundColor: Colors.white
|
backgroundColor: Colors.white
|
||||||
},
|
},
|
||||||
buttonContainer: {
|
buttonContainer: {
|
||||||
@@ -20,11 +21,13 @@ const styles = StyleSheet.create({
|
|||||||
flexDirection: 'column'
|
flexDirection: 'column'
|
||||||
},
|
},
|
||||||
mainTitle: {
|
mainTitle: {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontSize: 28,
|
fontSize: 28,
|
||||||
fontWeight: '600'
|
fontWeight: '600'
|
||||||
},
|
},
|
||||||
scrollView: {
|
scrollView: {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
||||||
backgroundColor: Colors.lighter
|
backgroundColor: Colors.lighter
|
||||||
},
|
},
|
||||||
sectionContainer: {
|
sectionContainer: {
|
||||||
@@ -32,12 +35,14 @@ const styles = StyleSheet.create({
|
|||||||
paddingHorizontal: 24
|
paddingHorizontal: 24
|
||||||
},
|
},
|
||||||
sectionDescription: {
|
sectionDescription: {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
||||||
color: Colors.dark,
|
color: Colors.dark,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: '400',
|
fontWeight: '400',
|
||||||
marginTop: 8
|
marginTop: 8
|
||||||
},
|
},
|
||||||
sectionTitle: {
|
sectionTitle: {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
fontWeight: '600'
|
fontWeight: '600'
|
||||||
@@ -46,7 +51,7 @@ const styles = StyleSheet.create({
|
|||||||
|
|
||||||
const globalAny = global as unknown as Window;
|
const globalAny = global as unknown as Window;
|
||||||
|
|
||||||
export default function App (): React.ReactElement<{}> | null {
|
export default function App (): React.ReactElement | null {
|
||||||
const [isReady, setReady] = useState(false);
|
const [isReady, setReady] = useState(false);
|
||||||
const [address, setAddress] = useState<string | null>(null);
|
const [address, setAddress] = useState<string | null>(null);
|
||||||
const [phrase, setPhrase] = useState<string | null>(null);
|
const [phrase, setPhrase] = useState<string | null>(null);
|
||||||
@@ -80,6 +85,7 @@ export default function App (): React.ReactElement<{}> | null {
|
|||||||
console.log('Error loading keyring ', e);
|
console.log('Error loading keyring ', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
await globalAny.localStorage.init();
|
await globalAny.localStorage.init();
|
||||||
await cryptoWaitReady();
|
await cryptoWaitReady();
|
||||||
|
|
||||||
@@ -88,6 +94,7 @@ export default function App (): React.ReactElement<{}> | null {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!isReady) {
|
if (!isReady) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
"@polkadot/reactnative-identicon": "0.54.0-beta.1",
|
"@polkadot/reactnative-identicon": "0.54.0-beta.1",
|
||||||
"@polkadot/ui-keyring": "0.54.0-beta.1",
|
"@polkadot/ui-keyring": "0.54.0-beta.1",
|
||||||
"@polkadot/ui-settings": "0.54.0-beta.1",
|
"@polkadot/ui-settings": "0.54.0-beta.1",
|
||||||
"@react-native-community/async-storage": "^1.10.1",
|
"@react-native-community/async-storage": "^1.10.3",
|
||||||
"fast-text-encoding": "^1.0.2",
|
"fast-text-encoding": "^1.0.2",
|
||||||
"get-yarn-workspaces": "^1.0.2",
|
"get-yarn-workspaces": "^1.0.2",
|
||||||
"os-browserify": "^0.3.0",
|
"os-browserify": "^0.3.0",
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
"@polkadot/keyring": "^2.10.1",
|
"@polkadot/keyring": "^2.10.1",
|
||||||
"@polkadot/util": "^2.10.1",
|
"@polkadot/util": "^2.10.1",
|
||||||
"@polkadot/util-crypto": "^2.10.1",
|
"@polkadot/util-crypto": "^2.10.1",
|
||||||
"@react-native-community/cli-platform-ios": "^4.8.0",
|
"@react-native-community/cli-platform-ios": "^4.9.0",
|
||||||
"@types/react-test-renderer": "16.9.2",
|
"@types/react-test-renderer": "16.9.2",
|
||||||
"babel-jest": "^26.0.1",
|
"babel-jest": "^26.0.1",
|
||||||
"metro-react-native-babel-preset": "^0.59.0",
|
"metro-react-native-babel-preset": "^0.59.0",
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class BaseIcon extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper
|
<Wrapper
|
||||||
className={`ui--IdentityIcon ${className}`}
|
className={`ui--IdentityIcon ${className || ''}`}
|
||||||
key={address}
|
key={address}
|
||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Props } from '../types';
|
|||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { beachballIcon } from '@polkadot/ui-shared';
|
import { beachballIcon } from '@polkadot/ui-shared';
|
||||||
|
|
||||||
function Beachball ({ address, className, size, style }: Props): React.ReactElement<Props> {
|
function Beachball ({ address, className = '', size, style }: Props): React.ReactElement<Props> {
|
||||||
const updateElem = useCallback(
|
const updateElem = useCallback(
|
||||||
(node: HTMLDivElement): void => {
|
(node: HTMLDivElement): void => {
|
||||||
node && node.appendChild(
|
node && node.appendChild(
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Props } from '../types';
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
function Empty ({ className, size, style }: Props): React.ReactElement<Props> {
|
function Empty ({ className = '', size, style }: Props): React.ReactElement<Props> {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`container ${className}`}
|
className={`container ${className}`}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Props } from '../types';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import jdenticon from 'jdenticon';
|
import jdenticon from 'jdenticon';
|
||||||
|
|
||||||
function Jdenticon ({ className, publicKey, size, style }: Props): React.ReactElement<Props> {
|
function Jdenticon ({ className = '', publicKey, size, style }: Props): React.ReactElement<Props> {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`container ${className}`}
|
className={`container ${className}`}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ function renderCircle ({ cx, cy, fill, r }: Circle, key: number): React.ReactNod
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Identicon ({ address, className, isAlternative = false, size, style }: Props): React.ReactElement<Props> {
|
function Identicon ({ address, className = '', isAlternative = false, size, style }: Props): React.ReactElement<Props> {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`container ${className}`}
|
className={`container ${className}`}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function ScanAddress ({ className, onError, onScan, size, style }: Props): React
|
|||||||
decodeAddress(address);
|
decodeAddress(address);
|
||||||
onScan({ address, genesisHash, name });
|
onScan({ address, genesisHash, name });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('@polkadot/react-qr:QrScanAddress', error.message, data);
|
console.error('@polkadot/react-qr:QrScanAddress', (error as Error).message, data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[onScan]
|
[onScan]
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const qrcode: typeof _qrcode = _qrcode;
|
|||||||
|
|
||||||
// HACK The default function take string -> number[], the Uint8array is compatible
|
// HACK The default function take string -> number[], the Uint8array is compatible
|
||||||
// with that signature and the use thereof
|
// with that signature and the use thereof
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
|
||||||
(qrcode as any).stringToBytes = (data: Uint8Array): Uint8Array =>
|
(qrcode as any).stringToBytes = (data: Uint8Array): Uint8Array =>
|
||||||
data;
|
data;
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/util-crypto": "^2.10.1",
|
"@polkadot/util-crypto": "^2.10.1",
|
||||||
"@types/react-native": "^0.62.9"
|
"@types/react-native": "^0.62.11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^2.10.1",
|
"@polkadot/keyring": "^2.10.1",
|
||||||
"@polkadot/types": "^1.15.0-beta.5",
|
"@polkadot/types": "^1.15.1",
|
||||||
"@polkadot/util": "^2.10.1",
|
"@polkadot/util": "^2.10.1",
|
||||||
"@types/ledgerhq__hw-transport-node-hid": "^4.22.1",
|
"@types/ledgerhq__hw-transport-node-hid": "^4.22.1",
|
||||||
|
"@types/ledgerhq__hw-transport-webusb": "^4.70.0",
|
||||||
"@types/mkdirp": "^1.0.0",
|
"@types/mkdirp": "^1.0.0",
|
||||||
"@types/store": "^2.0.2"
|
"@types/store": "^2.0.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ export class Keyring extends Base implements KeyringStruct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Object.keys(meta).forEach((key): void => {
|
Object.keys(meta).forEach((key): void => {
|
||||||
json.meta[key] = meta[key];
|
json.meta[key] = meta[key] as unknown;
|
||||||
});
|
});
|
||||||
|
|
||||||
delete json.meta.isRecent;
|
delete json.meta.isRecent;
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
declare module '@ledgerhq/hw-transport-webusb';
|
|
||||||
@@ -50,6 +50,6 @@ export default class FileStore implements KeyringStore {
|
|||||||
private _readKey (key: string): KeyringJson {
|
private _readKey (key: string): KeyringJson {
|
||||||
return JSON.parse(
|
return JSON.parse(
|
||||||
fs.readFileSync(this._getPath(key)).toString('utf-8')
|
fs.readFileSync(this._getPath(key)).toString('utf-8')
|
||||||
);
|
) as KeyringJson;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ export interface KeyringOptions extends KeyringOptionsBase {
|
|||||||
store?: KeyringStore;
|
store?: KeyringStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/class-name-casing
|
|
||||||
export interface KeyringJson$Meta {
|
export interface KeyringJson$Meta {
|
||||||
contract?: ContractMeta;
|
contract?: ContractMeta;
|
||||||
genesisHash?: string | null;
|
genesisHash?: string | null;
|
||||||
@@ -39,8 +38,7 @@ export interface KeyringJson$Meta {
|
|||||||
whenCreated?: number;
|
whenCreated?: number;
|
||||||
whenEdited?: number;
|
whenEdited?: number;
|
||||||
whenUsed?: number;
|
whenUsed?: number;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
[index: string]: unknown;
|
||||||
[index: string]: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface KeyringJson {
|
export interface KeyringJson {
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ export class Settings implements SettingsStruct {
|
|||||||
#uiTheme: string;
|
#uiTheme: string;
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
const settings = store.get('settings') || {};
|
const settings = (store.get('settings') as SettingsStruct) || {};
|
||||||
|
|
||||||
this.#emitter = new EventEmitter();
|
this.#emitter = new EventEmitter();
|
||||||
|
|
||||||
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || process.env.WS_URL || ENDPOINT_DEFAULT;
|
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || process.env.WS_URL || (ENDPOINT_DEFAULT.value as string);
|
||||||
this.#camera = withDefault(CAMERA, settings.camera, CAMERA_DEFAULT);
|
this.#camera = withDefault(CAMERA, settings.camera, CAMERA_DEFAULT);
|
||||||
this.#ledgerConn = withDefault(LEDGER_CONN, settings.ledgerConn, LEDGER_CONN_DEFAULT);
|
this.#ledgerConn = withDefault(LEDGER_CONN, settings.ledgerConn, LEDGER_CONN_DEFAULT);
|
||||||
this.#i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
|
this.#i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/util": "^2.10.1",
|
"@polkadot/util": "^2.10.1",
|
||||||
"@polkadot/util-crypto": "^2.10.1",
|
"@polkadot/util-crypto": "^2.10.1",
|
||||||
"@types/color": "^3.0.1"
|
"@types/color": "^3.0.1",
|
||||||
|
"@types/xmlserializer": "^0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import container from './container';
|
|||||||
describe('container', (): void => {
|
describe('container', (): void => {
|
||||||
it('applies default styles', (): void => {
|
it('applies default styles', (): void => {
|
||||||
expect(
|
expect(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
|
||||||
(container(100).style as any)._values
|
(container(100).style as any)._values
|
||||||
).toMatchObject({
|
).toMatchObject({
|
||||||
background: 'white',
|
background: 'white',
|
||||||
@@ -23,7 +23,7 @@ describe('container', (): void => {
|
|||||||
|
|
||||||
it('overrides with supplied styles', (): void => {
|
it('overrides with supplied styles', (): void => {
|
||||||
expect(
|
expect(
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access
|
||||||
(container(50, 'black', '', { display: 'block' }).style as any)._values
|
(container(50, 'black', '', { display: 'block' }).style as any)._values
|
||||||
).toMatchObject({
|
).toMatchObject({
|
||||||
background: 'black',
|
background: 'black',
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
// Copyright 2017-2020 @polkadot/ui-shared authors & contributors
|
|
||||||
// This software may be modified and distributed under the terms
|
|
||||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
|
||||||
|
|
||||||
declare module 'xmlserializer';
|
|
||||||
@@ -65,8 +65,8 @@ export const Identicon = Vue.extend({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
createData: function (): void {
|
createData: function (): void {
|
||||||
this.iconSize = this.size || DEFAULT_SIZE;
|
this.iconSize = this.size as number || DEFAULT_SIZE;
|
||||||
this.type = this.theme;
|
this.type = this.theme as 'empty';
|
||||||
|
|
||||||
this.recodeAddress();
|
this.recodeAddress();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const Jdenticon = Vue.extend({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
createSvgHtml: function (): void {
|
createSvgHtml: function (): void {
|
||||||
this.svgHtml = jdenticon.toSvg(this.publicKey.substr(2), this.size);
|
this.svgHtml = jdenticon.toSvg((this.publicKey as string).substr(2), this.size);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: ['publicKey', 'size'],
|
props: ['publicKey', 'size'],
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ interface Data {
|
|||||||
svgHtml: string;
|
svgHtml: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface This {
|
||||||
|
address: string;
|
||||||
|
isAlternative?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name Polkadot
|
* @name Polkadot
|
||||||
* @description The Polkadot default identicon
|
* @description The Polkadot default identicon
|
||||||
@@ -25,11 +30,11 @@ export const Polkadot = Vue.extend({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
createSvgHtml: function (): void {
|
createSvgHtml: function (): void {
|
||||||
const circles = polkadotIcon(this.address, { isAlternative: this.isAlternative || false }).map(({ cx, cy, fill, r }) =>
|
const circles = polkadotIcon(this.address, { isAlternative: (this as This).isAlternative || false }).map(({ cx, cy, fill, r }) =>
|
||||||
`<circle cx=${cx} cy=${cy} fill="${fill}" r=${r} />`
|
`<circle cx=${cx} cy=${cy} fill="${fill}" r=${r} />`
|
||||||
).join('');
|
).join('');
|
||||||
|
|
||||||
this.svgHtml = `<svg height=${this.size} viewBox='0 0 64 64' width=${this.size}>${circles}</svg>`;
|
this.svgHtml = `<svg height=${this.size as number} viewBox='0 0 64 64' width=${this.size as number}>${circles}</svg>`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: ['address', 'isAlternative', 'size'],
|
props: ['address', 'isAlternative', 'size'],
|
||||||
|
|||||||
Reference in New Issue
Block a user