Add prefixes to settings (#158)

This commit is contained in:
Jaco Greeff
2019-07-16 21:16:08 +02:00
committed by GitHub
parent 467c97eef8
commit 0cf92844f5
7 changed files with 51 additions and 29 deletions
+2 -2
View File
@@ -24,8 +24,8 @@
"react": "*"
},
"devDependencies": {
"@polkadot/keyring": "^0.94.0-beta.11",
"@polkadot/util-crypto": "^0.94.0-beta.11",
"@polkadot/keyring": "^0.94.0-beta.12",
"@polkadot/util-crypto": "^0.94.0-beta.12",
"xmlserializer": "^0.6.1"
}
}
+3 -3
View File
@@ -19,9 +19,9 @@
"styled-components": "^4.3.1"
},
"devDependencies": {
"@polkadot/keyring": "^0.94.0-beta.11",
"@polkadot/types": "^0.82.0-beta.56",
"@polkadot/util": "^0.94.0-beta.11"
"@polkadot/keyring": "^0.94.0-beta.12",
"@polkadot/types": "^0.82.0-beta.67",
"@polkadot/util": "^0.94.0-beta.12"
},
"peerDependencies": {
"@polkadot/keyring": "*",
+1 -1
View File
@@ -14,7 +14,7 @@
"store": "^2.0.12"
},
"devDependencies": {
"@polkadot/util": "^0.94.0-beta.11"
"@polkadot/util": "^0.94.0-beta.12"
},
"peerDependencies": {
"@polkadot/util": "*"
+11 -1
View File
@@ -3,8 +3,9 @@
// of the Apache-2.0 license. See the LICENSE file for details.
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';
export class Settings implements SettingsStruct {
@@ -14,6 +15,8 @@ export class Settings implements SettingsStruct {
private _locking: string;
private _prefix: number;
private _uiMode: string;
private _uiTheme: string;
@@ -24,6 +27,7 @@ export class Settings implements SettingsStruct {
this._apiUrl = settings.apiUrl || process.env.WS_URL || ENDPOINT_DEFAULT;
this._i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
this._locking = settings.locking || LOCKING_DEFAULT;
this._prefix = isUndefined(settings.prefix) ? PREFIX_DEFAULT : settings.prefix;
this._uiMode = settings.uiMode || UIMODE_DEFAULT;
this._uiTheme = settings.uiTheme || UITHEME_DEFAULT;
}
@@ -40,6 +44,10 @@ export class Settings implements SettingsStruct {
return this._locking;
}
public get prefix (): number {
return this._prefix;
}
public get uiMode (): string {
return this._uiMode;
}
@@ -77,6 +85,7 @@ export class Settings implements SettingsStruct {
apiUrl: this._apiUrl,
i18nLang: this._i18nLang,
locking: this._locking,
prefix: this._prefix,
uiMode: this._uiMode,
uiTheme: this._uiTheme
};
@@ -86,6 +95,7 @@ export class Settings implements SettingsStruct {
this._apiUrl = settings.apiUrl || this._apiUrl;
this._i18nLang = settings.i18nLang || this._i18nLang;
this._locking = settings.locking || this._locking;
this._prefix = isUndefined(settings.prefix) ? this._prefix : settings.prefix;
this._uiMode = settings.uiMode || this._uiMode;
this._uiTheme = settings.uiTheme || this._uiTheme;
+11
View File
@@ -47,6 +47,13 @@ const LOCKING: Options = [
{ 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 = [
{ value: 'full', text: 'Fully featured' },
{ value: 'light', text: 'Basic features only' }
@@ -61,6 +68,8 @@ const ENDPOINT_DEFAULT = isPolkadot
? WSS_NODES.parity.nodes.alex
: WSS_NODES.parity.nodes.elm;
const PREFIX_DEFAULT = -1;
const UITHEME_DEFAULT = isPolkadot
? 'polkadot'
: 'substrate';
@@ -78,6 +87,8 @@ export {
LANGUAGES,
LOCKING_DEFAULT,
LOCKING,
PREFIX_DEFAULT,
PREFIXES,
UIMODE_DEFAULT,
UIMODES,
UITHEME_DEFAULT,
+2 -1
View File
@@ -5,13 +5,14 @@
export type Options = {
disabled?: boolean;
text: string;
value: string;
value: string | number;
}[]
export interface SettingsStruct {
apiUrl: string;
i18nLang: string;
locking: string;
prefix: number;
uiMode: string;
uiTheme: string;
}
+21 -21
View File
@@ -1946,14 +1946,14 @@
typescript "^3.5.3"
vuepress "^1.0.2"
"@polkadot/keyring@^0.94.0-beta.11":
version "0.94.0-beta.11"
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.94.0-beta.11.tgz#80352e9679e2f857a9b2d295a87a13ab4244103f"
integrity sha512-2lxZOIOajliBhcAfX8tWcW3fMpkqRVHtYmuOTIGSS2ZyKS5DYPIJHzyBixHzHjyZZBJcKvIbG8UEvAPfYnXeZA==
"@polkadot/keyring@^0.94.0-beta.12":
version "0.94.0-beta.12"
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.94.0-beta.12.tgz#0dd51c41d9452ae0eb08f2e015807384fe4ab223"
integrity sha512-T1rYl0DboMLCsFku/p09DY7SlzS23DSsaHQdcb4qwUfLaggACA6sQ4oxq3dRrXTWIJhYSMopcBEq60BVnXXpuw==
dependencies:
"@babel/runtime" "^7.5.4"
"@polkadot/util" "^0.94.0-beta.11"
"@polkadot/util-crypto" "^0.94.0-beta.11"
"@polkadot/util" "^0.94.0-beta.12"
"@polkadot/util-crypto" "^0.94.0-beta.12"
"@polkadot/ts@^0.1.62":
version "0.1.62"
@@ -1962,22 +1962,22 @@
dependencies:
"@types/chrome" "^0.0.86"
"@polkadot/types@^0.82.0-beta.56":
version "0.82.0-beta.56"
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.82.0-beta.56.tgz#3deb03998e938d17c9f47a9c0fbbcd0e9dd39284"
integrity sha512-72Gv+zo0icM9g74qmTZwgVsZNV/NfTwEOEHLoP2p4yHkJ3Be3t0HsZf2WtIL4vb4lsBjPQ3XaS3V7qvb9dzn+A==
"@polkadot/types@^0.82.0-beta.67":
version "0.82.0-beta.67"
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.82.0-beta.67.tgz#245c3dbfbdaf4718ac8d2f3e75e230602a2b387a"
integrity sha512-HJExJvI7exQeLb35LXKd+rdkvgRPjjIpL4F5Iz/P3LfVbcwlZUXT8CtEr0AUw/W640h8GwcfV94mYlgdCkqR7A==
dependencies:
"@babel/runtime" "^7.5.4"
"@polkadot/util" "^0.94.0-beta.11"
"@polkadot/util-crypto" "^0.94.0-beta.11"
"@polkadot/util" "^0.94.0-beta.12"
"@polkadot/util-crypto" "^0.94.0-beta.12"
"@polkadot/util-crypto@^0.94.0-beta.11":
version "0.94.0-beta.11"
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.94.0-beta.11.tgz#ad10bb25605f7194754724a55d56cbcae75c2f87"
integrity sha512-KAs1be9b3KJo0he4lm4wNzKfu6MI57JGALBiGcQdY2xLuSCBLUhahsjlwvpS9oIuymsz/jmQHPk1AkzM//d91Q==
"@polkadot/util-crypto@^0.94.0-beta.12":
version "0.94.0-beta.12"
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.94.0-beta.12.tgz#b5f42023b3b18e9e6b8601004cd426390b90adbf"
integrity sha512-H+rUBvYIwyxEZj4PNdQOKug4CjA1o1FxtmKqcZCp6ttLdbUVZRBWRtCHE5kjPBtVD5GDQHns9NDme0zbP1F1FA==
dependencies:
"@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"
"@types/bip39" "^2.4.2"
"@types/bs58" "^4.0.0"
@@ -1993,10 +1993,10 @@
tweetnacl "^1.0.1"
xxhashjs "^0.2.2"
"@polkadot/util@^0.94.0-beta.11":
version "0.94.0-beta.11"
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.94.0-beta.11.tgz#0ecac8b025e922e392ec9f9c9572995676c00384"
integrity sha512-0gNbooJLo5VlSq0gKPC7gdp7ULHuyaLiQOBprjtHwJvkThGkDBe+h9VkmGVJsiIsZUt7tFZHP6o9BbCr2Z1+VA==
"@polkadot/util@^0.94.0-beta.12":
version "0.94.0-beta.12"
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.94.0-beta.12.tgz#c05fd3ccad761e691ef195fee508dc12cd97e8b6"
integrity sha512-5/xjHAZ5Eo4nhNC9f+vpTczL1QuFVdKrN2xhjJutAx/lpM+3X9qlp6AAKwiR8IVqcKwPZ1tPAr3do6Ku1Z7dkQ==
dependencies:
"@babel/runtime" "^7.5.4"
"@types/bn.js" "^4.11.5"