mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-05-30 05:51:04 +00:00
Add prefixes to settings (#158)
This commit is contained in:
@@ -24,8 +24,8 @@
|
|||||||
"react": "*"
|
"react": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^0.94.0-beta.11",
|
"@polkadot/keyring": "^0.94.0-beta.12",
|
||||||
"@polkadot/util-crypto": "^0.94.0-beta.11",
|
"@polkadot/util-crypto": "^0.94.0-beta.12",
|
||||||
"xmlserializer": "^0.6.1"
|
"xmlserializer": "^0.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
"styled-components": "^4.3.1"
|
"styled-components": "^4.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^0.94.0-beta.11",
|
"@polkadot/keyring": "^0.94.0-beta.12",
|
||||||
"@polkadot/types": "^0.82.0-beta.56",
|
"@polkadot/types": "^0.82.0-beta.67",
|
||||||
"@polkadot/util": "^0.94.0-beta.11"
|
"@polkadot/util": "^0.94.0-beta.12"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@polkadot/keyring": "*",
|
"@polkadot/keyring": "*",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"store": "^2.0.12"
|
"store": "^2.0.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/util": "^0.94.0-beta.11"
|
"@polkadot/util": "^0.94.0-beta.12"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@polkadot/util": "*"
|
"@polkadot/util": "*"
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||||
|
|
||||||
import store from 'store';
|
import store from 'store';
|
||||||
|
import { isUndefined } from '@polkadot/util';
|
||||||
|
|
||||||
import { CRYPTOS, ENDPOINT_DEFAULT, ENDPOINTS, LANGUAGE_DEFAULT, LANGUAGES, LOCKING_DEFAULT, LOCKING, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './defaults';
|
import { CRYPTOS, ENDPOINT_DEFAULT, ENDPOINTS, LANGUAGE_DEFAULT, LANGUAGES, LOCKING_DEFAULT, LOCKING, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES, PREFIX_DEFAULT } from './defaults';
|
||||||
import { Options, SettingsStruct } from './types';
|
import { Options, SettingsStruct } from './types';
|
||||||
|
|
||||||
export class Settings implements SettingsStruct {
|
export class Settings implements SettingsStruct {
|
||||||
@@ -14,6 +15,8 @@ export class Settings implements SettingsStruct {
|
|||||||
|
|
||||||
private _locking: string;
|
private _locking: string;
|
||||||
|
|
||||||
|
private _prefix: number;
|
||||||
|
|
||||||
private _uiMode: string;
|
private _uiMode: string;
|
||||||
|
|
||||||
private _uiTheme: string;
|
private _uiTheme: string;
|
||||||
@@ -24,6 +27,7 @@ export class Settings implements SettingsStruct {
|
|||||||
this._apiUrl = settings.apiUrl || process.env.WS_URL || ENDPOINT_DEFAULT;
|
this._apiUrl = settings.apiUrl || process.env.WS_URL || ENDPOINT_DEFAULT;
|
||||||
this._i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
|
this._i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
|
||||||
this._locking = settings.locking || LOCKING_DEFAULT;
|
this._locking = settings.locking || LOCKING_DEFAULT;
|
||||||
|
this._prefix = isUndefined(settings.prefix) ? PREFIX_DEFAULT : settings.prefix;
|
||||||
this._uiMode = settings.uiMode || UIMODE_DEFAULT;
|
this._uiMode = settings.uiMode || UIMODE_DEFAULT;
|
||||||
this._uiTheme = settings.uiTheme || UITHEME_DEFAULT;
|
this._uiTheme = settings.uiTheme || UITHEME_DEFAULT;
|
||||||
}
|
}
|
||||||
@@ -40,6 +44,10 @@ export class Settings implements SettingsStruct {
|
|||||||
return this._locking;
|
return this._locking;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get prefix (): number {
|
||||||
|
return this._prefix;
|
||||||
|
}
|
||||||
|
|
||||||
public get uiMode (): string {
|
public get uiMode (): string {
|
||||||
return this._uiMode;
|
return this._uiMode;
|
||||||
}
|
}
|
||||||
@@ -77,6 +85,7 @@ export class Settings implements SettingsStruct {
|
|||||||
apiUrl: this._apiUrl,
|
apiUrl: this._apiUrl,
|
||||||
i18nLang: this._i18nLang,
|
i18nLang: this._i18nLang,
|
||||||
locking: this._locking,
|
locking: this._locking,
|
||||||
|
prefix: this._prefix,
|
||||||
uiMode: this._uiMode,
|
uiMode: this._uiMode,
|
||||||
uiTheme: this._uiTheme
|
uiTheme: this._uiTheme
|
||||||
};
|
};
|
||||||
@@ -86,6 +95,7 @@ export class Settings implements SettingsStruct {
|
|||||||
this._apiUrl = settings.apiUrl || this._apiUrl;
|
this._apiUrl = settings.apiUrl || this._apiUrl;
|
||||||
this._i18nLang = settings.i18nLang || this._i18nLang;
|
this._i18nLang = settings.i18nLang || this._i18nLang;
|
||||||
this._locking = settings.locking || this._locking;
|
this._locking = settings.locking || this._locking;
|
||||||
|
this._prefix = isUndefined(settings.prefix) ? this._prefix : settings.prefix;
|
||||||
this._uiMode = settings.uiMode || this._uiMode;
|
this._uiMode = settings.uiMode || this._uiMode;
|
||||||
this._uiTheme = settings.uiTheme || this._uiTheme;
|
this._uiTheme = settings.uiTheme || this._uiTheme;
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,13 @@ const LOCKING: Options = [
|
|||||||
{ text: 'On each transaction', value: 'tx' }
|
{ text: 'On each transaction', value: 'tx' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PREFIXES: Options = [
|
||||||
|
{ text: 'Default for the connected node', value: -1 },
|
||||||
|
{ text: 'Substrate (development)', value: 42 },
|
||||||
|
{ text: 'Kusama (canary)', value: 2 },
|
||||||
|
{ text: 'Polkadot (live)', value: 0 }
|
||||||
|
];
|
||||||
|
|
||||||
const UIMODES: Options = [
|
const UIMODES: Options = [
|
||||||
{ value: 'full', text: 'Fully featured' },
|
{ value: 'full', text: 'Fully featured' },
|
||||||
{ value: 'light', text: 'Basic features only' }
|
{ value: 'light', text: 'Basic features only' }
|
||||||
@@ -61,6 +68,8 @@ const ENDPOINT_DEFAULT = isPolkadot
|
|||||||
? WSS_NODES.parity.nodes.alex
|
? WSS_NODES.parity.nodes.alex
|
||||||
: WSS_NODES.parity.nodes.elm;
|
: WSS_NODES.parity.nodes.elm;
|
||||||
|
|
||||||
|
const PREFIX_DEFAULT = -1;
|
||||||
|
|
||||||
const UITHEME_DEFAULT = isPolkadot
|
const UITHEME_DEFAULT = isPolkadot
|
||||||
? 'polkadot'
|
? 'polkadot'
|
||||||
: 'substrate';
|
: 'substrate';
|
||||||
@@ -78,6 +87,8 @@ export {
|
|||||||
LANGUAGES,
|
LANGUAGES,
|
||||||
LOCKING_DEFAULT,
|
LOCKING_DEFAULT,
|
||||||
LOCKING,
|
LOCKING,
|
||||||
|
PREFIX_DEFAULT,
|
||||||
|
PREFIXES,
|
||||||
UIMODE_DEFAULT,
|
UIMODE_DEFAULT,
|
||||||
UIMODES,
|
UIMODES,
|
||||||
UITHEME_DEFAULT,
|
UITHEME_DEFAULT,
|
||||||
|
|||||||
@@ -5,13 +5,14 @@
|
|||||||
export type Options = {
|
export type Options = {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
text: string;
|
text: string;
|
||||||
value: string;
|
value: string | number;
|
||||||
}[]
|
}[]
|
||||||
|
|
||||||
export interface SettingsStruct {
|
export interface SettingsStruct {
|
||||||
apiUrl: string;
|
apiUrl: string;
|
||||||
i18nLang: string;
|
i18nLang: string;
|
||||||
locking: string;
|
locking: string;
|
||||||
|
prefix: number;
|
||||||
uiMode: string;
|
uiMode: string;
|
||||||
uiTheme: string;
|
uiTheme: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1946,14 +1946,14 @@
|
|||||||
typescript "^3.5.3"
|
typescript "^3.5.3"
|
||||||
vuepress "^1.0.2"
|
vuepress "^1.0.2"
|
||||||
|
|
||||||
"@polkadot/keyring@^0.94.0-beta.11":
|
"@polkadot/keyring@^0.94.0-beta.12":
|
||||||
version "0.94.0-beta.11"
|
version "0.94.0-beta.12"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.94.0-beta.11.tgz#80352e9679e2f857a9b2d295a87a13ab4244103f"
|
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.94.0-beta.12.tgz#0dd51c41d9452ae0eb08f2e015807384fe4ab223"
|
||||||
integrity sha512-2lxZOIOajliBhcAfX8tWcW3fMpkqRVHtYmuOTIGSS2ZyKS5DYPIJHzyBixHzHjyZZBJcKvIbG8UEvAPfYnXeZA==
|
integrity sha512-T1rYl0DboMLCsFku/p09DY7SlzS23DSsaHQdcb4qwUfLaggACA6sQ4oxq3dRrXTWIJhYSMopcBEq60BVnXXpuw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.5.4"
|
"@babel/runtime" "^7.5.4"
|
||||||
"@polkadot/util" "^0.94.0-beta.11"
|
"@polkadot/util" "^0.94.0-beta.12"
|
||||||
"@polkadot/util-crypto" "^0.94.0-beta.11"
|
"@polkadot/util-crypto" "^0.94.0-beta.12"
|
||||||
|
|
||||||
"@polkadot/ts@^0.1.62":
|
"@polkadot/ts@^0.1.62":
|
||||||
version "0.1.62"
|
version "0.1.62"
|
||||||
@@ -1962,22 +1962,22 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/chrome" "^0.0.86"
|
"@types/chrome" "^0.0.86"
|
||||||
|
|
||||||
"@polkadot/types@^0.82.0-beta.56":
|
"@polkadot/types@^0.82.0-beta.67":
|
||||||
version "0.82.0-beta.56"
|
version "0.82.0-beta.67"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.82.0-beta.56.tgz#3deb03998e938d17c9f47a9c0fbbcd0e9dd39284"
|
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.82.0-beta.67.tgz#245c3dbfbdaf4718ac8d2f3e75e230602a2b387a"
|
||||||
integrity sha512-72Gv+zo0icM9g74qmTZwgVsZNV/NfTwEOEHLoP2p4yHkJ3Be3t0HsZf2WtIL4vb4lsBjPQ3XaS3V7qvb9dzn+A==
|
integrity sha512-HJExJvI7exQeLb35LXKd+rdkvgRPjjIpL4F5Iz/P3LfVbcwlZUXT8CtEr0AUw/W640h8GwcfV94mYlgdCkqR7A==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.5.4"
|
"@babel/runtime" "^7.5.4"
|
||||||
"@polkadot/util" "^0.94.0-beta.11"
|
"@polkadot/util" "^0.94.0-beta.12"
|
||||||
"@polkadot/util-crypto" "^0.94.0-beta.11"
|
"@polkadot/util-crypto" "^0.94.0-beta.12"
|
||||||
|
|
||||||
"@polkadot/util-crypto@^0.94.0-beta.11":
|
"@polkadot/util-crypto@^0.94.0-beta.12":
|
||||||
version "0.94.0-beta.11"
|
version "0.94.0-beta.12"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.94.0-beta.11.tgz#ad10bb25605f7194754724a55d56cbcae75c2f87"
|
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.94.0-beta.12.tgz#b5f42023b3b18e9e6b8601004cd426390b90adbf"
|
||||||
integrity sha512-KAs1be9b3KJo0he4lm4wNzKfu6MI57JGALBiGcQdY2xLuSCBLUhahsjlwvpS9oIuymsz/jmQHPk1AkzM//d91Q==
|
integrity sha512-H+rUBvYIwyxEZj4PNdQOKug4CjA1o1FxtmKqcZCp6ttLdbUVZRBWRtCHE5kjPBtVD5GDQHns9NDme0zbP1F1FA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.5.4"
|
"@babel/runtime" "^7.5.4"
|
||||||
"@polkadot/util" "^0.94.0-beta.11"
|
"@polkadot/util" "^0.94.0-beta.12"
|
||||||
"@polkadot/wasm-crypto" "^0.11.1"
|
"@polkadot/wasm-crypto" "^0.11.1"
|
||||||
"@types/bip39" "^2.4.2"
|
"@types/bip39" "^2.4.2"
|
||||||
"@types/bs58" "^4.0.0"
|
"@types/bs58" "^4.0.0"
|
||||||
@@ -1993,10 +1993,10 @@
|
|||||||
tweetnacl "^1.0.1"
|
tweetnacl "^1.0.1"
|
||||||
xxhashjs "^0.2.2"
|
xxhashjs "^0.2.2"
|
||||||
|
|
||||||
"@polkadot/util@^0.94.0-beta.11":
|
"@polkadot/util@^0.94.0-beta.12":
|
||||||
version "0.94.0-beta.11"
|
version "0.94.0-beta.12"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.94.0-beta.11.tgz#0ecac8b025e922e392ec9f9c9572995676c00384"
|
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.94.0-beta.12.tgz#c05fd3ccad761e691ef195fee508dc12cd97e8b6"
|
||||||
integrity sha512-0gNbooJLo5VlSq0gKPC7gdp7ULHuyaLiQOBprjtHwJvkThGkDBe+h9VkmGVJsiIsZUt7tFZHP6o9BbCr2Z1+VA==
|
integrity sha512-5/xjHAZ5Eo4nhNC9f+vpTczL1QuFVdKrN2xhjJutAx/lpM+3X9qlp6AAKwiR8IVqcKwPZ1tPAr3do6Ku1Z7dkQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.5.4"
|
"@babel/runtime" "^7.5.4"
|
||||||
"@types/bn.js" "^4.11.5"
|
"@types/bn.js" "^4.11.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user