Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@polkadot/ui-settings

Package Overview
Dependencies
Maintainers
2
Versions
686
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/ui-settings - npm Package Compare versions

Comparing version 2.12.1 to 3.0.1

610

bundle-polkadot-ui-settings.js

@@ -958,63 +958,71 @@ (function (global, factory) {

const CRYPTOS = [{
info: 'sr25519',
text: 'Schnorrkel (sr25519, recommended)',
value: 'sr25519'
}, {
info: 'ed25519',
text: 'Edwards (ed25519, alternative)',
value: 'ed25519'
}, {
info: 'ecdsa',
text: 'ECDSA (Non BTC/ETH compatible)',
value: 'ecdsa'
}];
const CRYPTOS_ETH = [{
info: 'ethereum',
text: 'ECDSA (ETH compatible)',
value: 'ethereum'
}];
const CRYPTOS_LEDGER = [...CRYPTOS, {
info: 'ed25519-ledger',
text: 'Ledger (ed25519, BIP32 derivation)',
value: 'ed25519-ledger'
}];
const CRYPTOS = [
{
info: 'sr25519',
text: 'Schnorrkel (sr25519, recommended)',
value: 'sr25519'
},
{
info: 'ed25519',
text: 'Edwards (ed25519, alternative)',
value: 'ed25519'
},
{
info: 'ecdsa',
text: 'ECDSA (Non BTC/ETH compatible)',
value: 'ecdsa'
}
];
const CRYPTOS_ETH = [
{
info: 'ethereum',
text: 'ECDSA (ETH compatible)',
value: 'ethereum'
}
];
const CRYPTOS_LEDGER = [
...CRYPTOS,
{
info: 'ed25519-ledger',
text: 'Ledger (ed25519, BIP32 derivation)',
value: 'ed25519-ledger'
}
];
const ENDPOINTS = [{
info: 'local',
text: 'Local Node (Own, 127.0.0.1:9944)',
value: 'ws://127.0.0.1:9944/'
}];
info: 'local',
text: 'Local Node (Own, 127.0.0.1:9944)',
value: 'ws://127.0.0.1:9944/'
}];
const ENDPOINT_DEFAULT = ENDPOINTS[0];
const LEDGER_CONN_DEFAULT = 'none';
const LEDGER_CONN = [{
info: 'none',
text: 'Do not attach Ledger devices',
value: 'none'
},
{
info: 'webusb',
text: 'Attach Ledger via WebUSB (Chrome, recommended)',
value: 'webusb'
}, {
info: 'hid',
text: 'Attach Ledger via WebHID (Chrome, experimental)',
value: 'hid'
}];
const LEDGER_CONN = [
{
info: 'none',
text: 'Do not attach Ledger devices',
value: 'none'
},
{
info: 'webusb',
text: 'Attach Ledger via WebUSB (Chrome, recommended)',
value: 'webusb'
},
{
info: 'hid',
text: 'Attach Ledger via WebHID (Chrome, experimental)',
value: 'hid'
}
];
const PREFIX_DEFAULT = -1;
const defaultNetwork = {
info: 'default',
text: 'Default for the connected node',
value: -1
info: 'default',
text: 'Default for the connected node',
value: -1
};
const networks = utilCrypto.availableNetworks.map(({
displayName,
network,
prefix
}) => ({
info: network,
text: displayName,
value: prefix
const networks = utilCrypto.availableNetworks.map(({ displayName, network, prefix }) => ({
info: network,
text: displayName,
value: prefix
}));

@@ -1025,258 +1033,276 @@ const PREFIXES = [defaultNetwork, ...networks];

const UIMODE_DEFAULT = !isPolkadot && typeof window !== 'undefined' && window.location.host.includes('ui-light') ? 'light' : 'full';
const UIMODES = [{
info: 'full',
text: 'Fully featured',
value: 'full'
}, {
info: 'light',
text: 'Basic features only',
value: 'light'
}];
const UITHEME_DEFAULT = isPolkadot ? 'polkadot' : 'substrate';
const UITHEMES = [{
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
}, {
info: 'substrate',
text: 'Substrate',
value: 'substrate'
}];
const UIMODE_DEFAULT = !isPolkadot && typeof window !== 'undefined' && window.location.host.includes('ui-light')
? 'light'
: 'full';
const UIMODES = [
{
info: 'full',
text: 'Fully featured',
value: 'full'
},
{
info: 'light',
text: 'Basic features only',
value: 'light'
}
];
const UITHEME_DEFAULT = isPolkadot
? 'polkadot'
: 'substrate';
const UITHEMES = [
{
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
},
{
info: 'substrate',
text: 'Substrate',
value: 'substrate'
}
];
const ICON_DEFAULT = 'default';
const ICON_DEFAULT_HOST = isPolkadot ? 'polkadot' : 'substrate';
const ICONS = [{
info: 'default',
text: 'Default for the connected node',
value: 'default'
}, {
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
}, {
info: 'substrate',
text: 'Substrate',
value: 'substrate'
}, {
info: 'beachball',
text: 'Beachball',
value: 'beachball'
}];
const ICON_DEFAULT_HOST = isPolkadot
? 'polkadot'
: 'substrate';
const ICONS = [
{
info: 'default',
text: 'Default for the connected node',
value: 'default'
},
{
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
},
{
info: 'substrate',
text: 'Substrate',
value: 'substrate'
},
{
info: 'beachball',
text: 'Beachball',
value: 'beachball'
}
];
const NOTIFICATION_DEFAULT = 'popup';
const CAMERA_DEFAULT = 'off';
const CAMERA = [{
info: 'on',
text: 'Allow camera access',
value: 'on'
}, {
info: 'off',
text: 'Do not allow camera access',
value: 'off'
}];
const CAMERA = [
{
info: 'on',
text: 'Allow camera access',
value: 'on'
},
{
info: 'off',
text: 'Do not allow camera access',
value: 'off'
}
];
const LANGUAGE_DEFAULT = 'default';
const LOCKING_DEFAULT = 'session';
const LOCKING = [{
info: 'session',
text: 'Once per session',
value: 'session'
}, {
info: 'tx',
text: 'On each transaction',
value: 'tx'
}];
const LOCKING = [
{
info: 'session',
text: 'Once per session',
value: 'session'
},
{
info: 'tx',
text: 'On each transaction',
value: 'tx'
}
];
const METADATA_UP_DEFAULT = 'off';
const METADATA_UP = [{
info: 'off',
text: 'Do not auto-update extension metadata',
value: 'off'
}, {
info: 'on',
text: 'Auto-update extension metadata',
value: 'on'
}];
const METADATA_UP = [
{
info: 'off',
text: 'Do not auto-update extension metadata',
value: 'off'
},
{
info: 'on',
text: 'Auto-update extension metadata',
value: 'on'
}
];
const STORAGE_DEFAULT = 'off';
const STORAGE = [{
info: 'on',
text: 'Allow local in-browser account storage',
value: 'on'
}, {
info: 'off',
text: 'Do not allow local in-browser account storage',
value: 'off'
}];
const STORAGE = [
{
info: 'on',
text: 'Allow local in-browser account storage',
value: 'on'
},
{
info: 'off',
text: 'Do not allow local in-browser account storage',
value: 'off'
}
];
function withDefault(options, option, fallback) {
const _option = option || fallback;
return options.some(({
value
}) => value === _option) ? _option : fallback;
const _option = option || fallback;
return options.some(({ value }) => value === _option)
? _option
: fallback;
}
class Settings {
#emitter;
#apiType;
#apiUrl;
#camera;
#i18nLang;
#icon;
#ledgerConn;
#locking;
#metadataUp;
#prefix;
#storage;
#uiMode;
#uiTheme;
#notification;
constructor() {
const settings = store_legacy.get('settings') || {};
this.#emitter = new eventemitter3Exports();
this.#apiUrl = typeof settings.apiUrl === 'string' && settings.apiUrl || util$7.hasProcess && process.env && process.env.WS_URL || ENDPOINT_DEFAULT.value;
this.#apiType = {
param: this.#apiUrl,
type: 'json-rpc'
};
this.#camera = withDefault(CAMERA, settings.camera, CAMERA_DEFAULT);
this.#ledgerConn = withDefault(LEDGER_CONN, settings.ledgerConn, LEDGER_CONN_DEFAULT);
this.#i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
this.#icon = settings.icon || ICON_DEFAULT;
this.#locking = settings.locking || LOCKING_DEFAULT;
this.#metadataUp = withDefault(METADATA_UP, settings.storage, METADATA_UP_DEFAULT);
this.#notification = settings.notification || NOTIFICATION_DEFAULT;
this.#prefix = util$7.isUndefined(settings.prefix) ? PREFIX_DEFAULT : settings.prefix;
this.#storage = withDefault(STORAGE, settings.storage, STORAGE_DEFAULT);
this.#uiMode = settings.uiMode || UIMODE_DEFAULT;
this.#uiTheme = settings.uiTheme || UITHEME_DEFAULT;
}
get camera() {
return this.#camera;
}
get apiType() {
return this.#apiType;
}
get apiUrl() {
return this.#apiUrl;
}
get i18nLang() {
return this.#i18nLang;
}
get icon() {
return this.#icon;
}
get notification() {
return this.#notification;
}
get ledgerConn() {
return this.#ledgerConn;
}
get locking() {
return this.#locking;
}
get metadataUp() {
return this.#metadataUp;
}
get prefix() {
return this.#prefix;
}
get storage() {
return this.#storage;
}
get uiMode() {
return this.#uiMode;
}
get uiTheme() {
return this.#uiTheme;
}
get availableCamera() {
return CAMERA;
}
get availableCryptos() {
return CRYPTOS;
}
get availableCryptosEth() {
return CRYPTOS_ETH;
}
get availableCryptosLedger() {
return CRYPTOS_LEDGER;
}
get availableIcons() {
return ICONS;
}
get availableLedgerConn() {
return LEDGER_CONN;
}
get availableLocking() {
return LOCKING;
}
get availableMetadataUp() {
return METADATA_UP;
}
get availableNodes() {
return ENDPOINTS;
}
get availablePrefixes() {
return PREFIXES;
}
get availableStorage() {
return STORAGE;
}
get availableUIModes() {
return UIMODES;
}
get availableUIThemes() {
return UITHEMES;
}
get() {
return {
apiType: this.#apiType,
apiUrl: this.#apiUrl,
camera: this.#camera,
i18nLang: this.#i18nLang,
icon: this.#icon,
ledgerConn: this.#ledgerConn,
locking: this.#locking,
metadataUp: this.#metadataUp,
notification: this.#notification,
prefix: this.#prefix,
storage: this.#storage,
uiMode: this.#uiMode,
uiTheme: this.#uiTheme
};
}
set(settings) {
this.#apiType = settings.apiType || this.#apiType;
this.#apiUrl = settings.apiUrl || this.#apiUrl;
this.#camera = settings.camera || this.#camera;
this.#ledgerConn = settings.ledgerConn || this.#ledgerConn;
this.#i18nLang = settings.i18nLang || this.#i18nLang;
this.#icon = settings.icon || this.#icon;
this.#locking = settings.locking || this.#locking;
this.#metadataUp = settings.metadataUp || this.#metadataUp;
this.#notification = settings.notification || this.#notification;
this.#prefix = util$7.isUndefined(settings.prefix) ? this.#prefix : settings.prefix;
this.#storage = settings.storage || this.#storage;
this.#uiMode = settings.uiMode || this.#uiMode;
this.#uiTheme = settings.uiTheme || this.#uiTheme;
const newValues = this.get();
store_legacy.set('settings', newValues);
this.#emitter.emit('change', newValues);
}
on(type, cb) {
this.#emitter.on(type, cb);
}
#emitter;
#apiType;
#apiUrl;
#camera;
#i18nLang;
#icon;
#ledgerConn;
#locking;
#metadataUp;
#prefix;
#storage;
#uiMode;
#uiTheme;
#notification;
constructor() {
const settings = store_legacy.get('settings') || {};
this.#emitter = new eventemitter3Exports();
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || (util$7.hasProcess && process.env && process.env.WS_URL) || ENDPOINT_DEFAULT.value;
this.#apiType = { param: this.#apiUrl, type: 'json-rpc' };
this.#camera = withDefault(CAMERA, settings.camera, CAMERA_DEFAULT);
this.#ledgerConn = withDefault(LEDGER_CONN, settings.ledgerConn, LEDGER_CONN_DEFAULT);
this.#i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
this.#icon = settings.icon || ICON_DEFAULT;
this.#locking = settings.locking || LOCKING_DEFAULT;
this.#metadataUp = withDefault(METADATA_UP, settings.storage, METADATA_UP_DEFAULT);
this.#notification = settings.notification || NOTIFICATION_DEFAULT;
this.#prefix = util$7.isUndefined(settings.prefix) ? PREFIX_DEFAULT : settings.prefix;
this.#storage = withDefault(STORAGE, settings.storage, STORAGE_DEFAULT);
this.#uiMode = settings.uiMode || UIMODE_DEFAULT;
this.#uiTheme = settings.uiTheme || UITHEME_DEFAULT;
}
get camera() {
return this.#camera;
}
get apiType() {
return this.#apiType;
}
get apiUrl() {
return this.#apiUrl;
}
get i18nLang() {
return this.#i18nLang;
}
get icon() {
return this.#icon;
}
get notification() {
return this.#notification;
}
get ledgerConn() {
return this.#ledgerConn;
}
get locking() {
return this.#locking;
}
get metadataUp() {
return this.#metadataUp;
}
get prefix() {
return this.#prefix;
}
get storage() {
return this.#storage;
}
get uiMode() {
return this.#uiMode;
}
get uiTheme() {
return this.#uiTheme;
}
get availableCamera() {
return CAMERA;
}
get availableCryptos() {
return CRYPTOS;
}
get availableCryptosEth() {
return CRYPTOS_ETH;
}
get availableCryptosLedger() {
return CRYPTOS_LEDGER;
}
get availableIcons() {
return ICONS;
}
get availableLedgerConn() {
return LEDGER_CONN;
}
get availableLocking() {
return LOCKING;
}
get availableMetadataUp() {
return METADATA_UP;
}
get availableNodes() {
return ENDPOINTS;
}
get availablePrefixes() {
return PREFIXES;
}
get availableStorage() {
return STORAGE;
}
get availableUIModes() {
return UIMODES;
}
get availableUIThemes() {
return UITHEMES;
}
get() {
return {
apiType: this.#apiType,
apiUrl: this.#apiUrl,
camera: this.#camera,
i18nLang: this.#i18nLang,
icon: this.#icon,
ledgerConn: this.#ledgerConn,
locking: this.#locking,
metadataUp: this.#metadataUp,
notification: this.#notification,
prefix: this.#prefix,
storage: this.#storage,
uiMode: this.#uiMode,
uiTheme: this.#uiTheme
};
}
set(settings) {
this.#apiType = settings.apiType || this.#apiType;
this.#apiUrl = settings.apiUrl || this.#apiUrl;
this.#camera = settings.camera || this.#camera;
this.#ledgerConn = settings.ledgerConn || this.#ledgerConn;
this.#i18nLang = settings.i18nLang || this.#i18nLang;
this.#icon = settings.icon || this.#icon;
this.#locking = settings.locking || this.#locking;
this.#metadataUp = settings.metadataUp || this.#metadataUp;
this.#notification = settings.notification || this.#notification;
this.#prefix = util$7.isUndefined(settings.prefix) ? this.#prefix : settings.prefix;
this.#storage = settings.storage || this.#storage;
this.#uiMode = settings.uiMode || this.#uiMode;
this.#uiTheme = settings.uiTheme || this.#uiTheme;
const newValues = this.get();
store_legacy.set('settings', newValues);
this.#emitter.emit('change', newValues);
}
on(type, cb) {
this.#emitter.on(type, cb);
}
}
const settings = new Settings();
const chains = utilCrypto.selectableNetworks.filter(n => n.genesisHash.length).reduce((chains, {
genesisHash,
network
}) => util$7.objectSpread(chains, {
[network]: genesisHash
}), {});
const chains = utilCrypto.selectableNetworks
.filter((n) => n.genesisHash.length)
.reduce((chains, { genesisHash, network }) => util$7.objectSpread(chains, { [network]: genesisHash }), {});
const packageInfo = {
name: '@polkadot/ui-settings',
path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-ui-settings.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-ui-settings.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-ui-settings.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-ui-settings.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto',
type: 'esm',
version: '2.12.1'
};
const packageInfo = { name: '@polkadot/ui-settings', path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-ui-settings.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-ui-settings.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-ui-settings.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-ui-settings.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '3.0.1' };

@@ -1283,0 +1309,0 @@ exports.ENDPOINT_DEFAULT = ENDPOINT_DEFAULT;

@@ -1,8 +0,5 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { Settings, settings } from "./Settings.js";
export { ENDPOINT_DEFAULT, ICON_DEFAULT, ICON_DEFAULT_HOST, LANGUAGE_DEFAULT, LOCKING_DEFAULT, PREFIX_DEFAULT, UIMODE_DEFAULT, UITHEME_DEFAULT } from "./defaults/index.js";
export { chains } from "./defaults/chains.js";
export { packageInfo } from "./packageInfo.js";
import { Settings, settings } from './Settings.js';
export { ENDPOINT_DEFAULT, ICON_DEFAULT, ICON_DEFAULT_HOST, LANGUAGE_DEFAULT, LOCKING_DEFAULT, PREFIX_DEFAULT, UIMODE_DEFAULT, UITHEME_DEFAULT } from './defaults/index.js';
export { chains } from './defaults/chains.js';
export { packageInfo } from './packageInfo.js';
export { settings, Settings };
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ENDPOINT_DEFAULT", {
enumerable: true,
get: function () {
return _defaults.ENDPOINT_DEFAULT;
}
});
Object.defineProperty(exports, "ICON_DEFAULT", {
enumerable: true,
get: function () {
return _defaults.ICON_DEFAULT;
}
});
Object.defineProperty(exports, "ICON_DEFAULT_HOST", {
enumerable: true,
get: function () {
return _defaults.ICON_DEFAULT_HOST;
}
});
Object.defineProperty(exports, "LANGUAGE_DEFAULT", {
enumerable: true,
get: function () {
return _defaults.LANGUAGE_DEFAULT;
}
});
Object.defineProperty(exports, "LOCKING_DEFAULT", {
enumerable: true,
get: function () {
return _defaults.LOCKING_DEFAULT;
}
});
Object.defineProperty(exports, "PREFIX_DEFAULT", {
enumerable: true,
get: function () {
return _defaults.PREFIX_DEFAULT;
}
});
Object.defineProperty(exports, "Settings", {
enumerable: true,
get: function () {
return _Settings.Settings;
}
});
Object.defineProperty(exports, "UIMODE_DEFAULT", {
enumerable: true,
get: function () {
return _defaults.UIMODE_DEFAULT;
}
});
Object.defineProperty(exports, "UITHEME_DEFAULT", {
enumerable: true,
get: function () {
return _defaults.UITHEME_DEFAULT;
}
});
Object.defineProperty(exports, "chains", {
enumerable: true,
get: function () {
return _chains.chains;
}
});
Object.defineProperty(exports, "packageInfo", {
enumerable: true,
get: function () {
return _packageInfo.packageInfo;
}
});
Object.defineProperty(exports, "settings", {
enumerable: true,
get: function () {
return _Settings.settings;
}
});
var _Settings = require("./Settings");
var _defaults = require("./defaults");
var _chains = require("./defaults/chains");
var _packageInfo = require("./packageInfo");
Object.defineProperty(exports, "__esModule", { value: true });
exports.Settings = exports.settings = exports.packageInfo = exports.chains = exports.UITHEME_DEFAULT = exports.UIMODE_DEFAULT = exports.PREFIX_DEFAULT = exports.LOCKING_DEFAULT = exports.LANGUAGE_DEFAULT = exports.ICON_DEFAULT_HOST = exports.ICON_DEFAULT = exports.ENDPOINT_DEFAULT = void 0;
const Settings_1 = require("./Settings");
Object.defineProperty(exports, "Settings", { enumerable: true, get: function () { return Settings_1.Settings; } });
Object.defineProperty(exports, "settings", { enumerable: true, get: function () { return Settings_1.settings; } });
var defaults_1 = require("./defaults");
Object.defineProperty(exports, "ENDPOINT_DEFAULT", { enumerable: true, get: function () { return defaults_1.ENDPOINT_DEFAULT; } });
Object.defineProperty(exports, "ICON_DEFAULT", { enumerable: true, get: function () { return defaults_1.ICON_DEFAULT; } });
Object.defineProperty(exports, "ICON_DEFAULT_HOST", { enumerable: true, get: function () { return defaults_1.ICON_DEFAULT_HOST; } });
Object.defineProperty(exports, "LANGUAGE_DEFAULT", { enumerable: true, get: function () { return defaults_1.LANGUAGE_DEFAULT; } });
Object.defineProperty(exports, "LOCKING_DEFAULT", { enumerable: true, get: function () { return defaults_1.LOCKING_DEFAULT; } });
Object.defineProperty(exports, "PREFIX_DEFAULT", { enumerable: true, get: function () { return defaults_1.PREFIX_DEFAULT; } });
Object.defineProperty(exports, "UIMODE_DEFAULT", { enumerable: true, get: function () { return defaults_1.UIMODE_DEFAULT; } });
Object.defineProperty(exports, "UITHEME_DEFAULT", { enumerable: true, get: function () { return defaults_1.UITHEME_DEFAULT; } });
var chains_1 = require("./defaults/chains");
Object.defineProperty(exports, "chains", { enumerable: true, get: function () { return chains_1.chains; } });
var packageInfo_1 = require("./packageInfo");
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_1.packageInfo; } });
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.chains = void 0;
var _networks = require("@polkadot/networks");
var _util = require("@polkadot/util");
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
const chains = _networks.selectableNetworks.filter(n => n.genesisHash.length).reduce((chains, _ref) => {
let {
genesisHash,
network
} = _ref;
return (0, _util.objectSpread)(chains, {
[network]: genesisHash
});
}, {});
const networks_1 = require("@polkadot/networks");
const util_1 = require("@polkadot/util");
const chains = networks_1.selectableNetworks
.filter((n) => n.genesisHash.length)
.reduce((chains, { genesisHash, network }) => (0, util_1.objectSpread)(chains, { [network]: genesisHash }), {});
exports.chains = chains;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.CRYPTOS_LEDGER = exports.CRYPTOS_ETH = exports.CRYPTOS = void 0;
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
const CRYPTOS = [{
info: 'sr25519',
text: 'Schnorrkel (sr25519, recommended)',
value: 'sr25519'
}, {
info: 'ed25519',
text: 'Edwards (ed25519, alternative)',
value: 'ed25519'
}, {
info: 'ecdsa',
text: 'ECDSA (Non BTC/ETH compatible)',
value: 'ecdsa'
}];
exports.CRYPTOS = CRYPTOS;
const CRYPTOS_ETH = [{
info: 'ethereum',
text: 'ECDSA (ETH compatible)',
value: 'ethereum'
}];
exports.CRYPTOS_ETH = CRYPTOS_ETH;
const CRYPTOS_LEDGER = [...CRYPTOS, {
info: 'ed25519-ledger',
text: 'Ledger (ed25519, BIP32 derivation)',
value: 'ed25519-ledger'
}];
exports.CRYPTOS_LEDGER = CRYPTOS_LEDGER;
exports.CRYPTOS = [
{
info: 'sr25519',
text: 'Schnorrkel (sr25519, recommended)',
value: 'sr25519'
},
{
info: 'ed25519',
text: 'Edwards (ed25519, alternative)',
value: 'ed25519'
},
{
info: 'ecdsa',
text: 'ECDSA (Non BTC/ETH compatible)',
value: 'ecdsa'
}
];
exports.CRYPTOS_ETH = [
{
info: 'ethereum',
text: 'ECDSA (ETH compatible)',
value: 'ethereum'
}
];
exports.CRYPTOS_LEDGER = [
...exports.CRYPTOS,
{
info: 'ed25519-ledger',
text: 'Ledger (ed25519, BIP32 derivation)',
value: 'ed25519-ledger'
}
];
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.ENDPOINT_DEFAULT = exports.ENDPOINTS = void 0;
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
const ENDPOINTS = [{
info: 'local',
text: 'Local Node (Own, 127.0.0.1:9944)',
value: 'ws://127.0.0.1:9944/'
}];
exports.ENDPOINTS = ENDPOINTS;
const ENDPOINT_DEFAULT = ENDPOINTS[0];
exports.ENDPOINT_DEFAULT = ENDPOINT_DEFAULT;
exports.ENDPOINTS = [{
info: 'local',
text: 'Local Node (Own, 127.0.0.1:9944)',
value: 'ws://127.0.0.1:9944/'
}];
exports.ENDPOINT_DEFAULT = exports.ENDPOINTS[0];
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.CAMERA_DEFAULT = exports.CAMERA = void 0;
Object.defineProperty(exports, "CRYPTOS", {
enumerable: true,
get: function () {
return _crypto.CRYPTOS;
}
});
Object.defineProperty(exports, "CRYPTOS_ETH", {
enumerable: true,
get: function () {
return _crypto.CRYPTOS_ETH;
}
});
Object.defineProperty(exports, "CRYPTOS_LEDGER", {
enumerable: true,
get: function () {
return _crypto.CRYPTOS_LEDGER;
}
});
Object.defineProperty(exports, "ENDPOINTS", {
enumerable: true,
get: function () {
return _endpoints.ENDPOINTS;
}
});
Object.defineProperty(exports, "ENDPOINT_DEFAULT", {
enumerable: true,
get: function () {
return _endpoints.ENDPOINT_DEFAULT;
}
});
Object.defineProperty(exports, "ICONS", {
enumerable: true,
get: function () {
return _ui.ICONS;
}
});
Object.defineProperty(exports, "ICON_DEFAULT", {
enumerable: true,
get: function () {
return _ui.ICON_DEFAULT;
}
});
Object.defineProperty(exports, "ICON_DEFAULT_HOST", {
enumerable: true,
get: function () {
return _ui.ICON_DEFAULT_HOST;
}
});
exports.LANGUAGE_DEFAULT = void 0;
Object.defineProperty(exports, "LEDGER_CONN", {
enumerable: true,
get: function () {
return _ledger.LEDGER_CONN;
}
});
Object.defineProperty(exports, "LEDGER_CONN_DEFAULT", {
enumerable: true,
get: function () {
return _ledger.LEDGER_CONN_DEFAULT;
}
});
exports.METADATA_UP_DEFAULT = exports.METADATA_UP = exports.LOCKING_DEFAULT = exports.LOCKING = void 0;
Object.defineProperty(exports, "NOTIFICATION_DEFAULT", {
enumerable: true,
get: function () {
return _ui.NOTIFICATION_DEFAULT;
}
});
Object.defineProperty(exports, "PREFIXES", {
enumerable: true,
get: function () {
return _ss.PREFIXES;
}
});
Object.defineProperty(exports, "PREFIX_DEFAULT", {
enumerable: true,
get: function () {
return _ss.PREFIX_DEFAULT;
}
});
exports.STORAGE_DEFAULT = exports.STORAGE = void 0;
Object.defineProperty(exports, "UIMODES", {
enumerable: true,
get: function () {
return _ui.UIMODES;
}
});
Object.defineProperty(exports, "UIMODE_DEFAULT", {
enumerable: true,
get: function () {
return _ui.UIMODE_DEFAULT;
}
});
Object.defineProperty(exports, "UITHEMES", {
enumerable: true,
get: function () {
return _ui.UITHEMES;
}
});
Object.defineProperty(exports, "UITHEME_DEFAULT", {
enumerable: true,
get: function () {
return _ui.UITHEME_DEFAULT;
}
});
var _crypto = require("./crypto");
var _endpoints = require("./endpoints");
var _ledger = require("./ledger");
var _ss = require("./ss58");
var _ui = require("./ui");
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.UITHEMES = exports.UITHEME_DEFAULT = exports.UIMODES = exports.UIMODE_DEFAULT = exports.STORAGE_DEFAULT = exports.STORAGE = exports.PREFIXES = exports.PREFIX_DEFAULT = exports.NOTIFICATION_DEFAULT = exports.METADATA_UP_DEFAULT = exports.METADATA_UP = exports.LOCKING = exports.LOCKING_DEFAULT = exports.LEDGER_CONN = exports.LEDGER_CONN_DEFAULT = exports.LANGUAGE_DEFAULT = exports.ICONS = exports.ICON_DEFAULT_HOST = exports.ICON_DEFAULT = exports.ENDPOINTS = exports.ENDPOINT_DEFAULT = exports.CRYPTOS_LEDGER = exports.CRYPTOS_ETH = exports.CRYPTOS = exports.CAMERA = exports.CAMERA_DEFAULT = void 0;
const crypto_1 = require("./crypto");
Object.defineProperty(exports, "CRYPTOS", { enumerable: true, get: function () { return crypto_1.CRYPTOS; } });
Object.defineProperty(exports, "CRYPTOS_ETH", { enumerable: true, get: function () { return crypto_1.CRYPTOS_ETH; } });
Object.defineProperty(exports, "CRYPTOS_LEDGER", { enumerable: true, get: function () { return crypto_1.CRYPTOS_LEDGER; } });
const endpoints_1 = require("./endpoints");
Object.defineProperty(exports, "ENDPOINT_DEFAULT", { enumerable: true, get: function () { return endpoints_1.ENDPOINT_DEFAULT; } });
Object.defineProperty(exports, "ENDPOINTS", { enumerable: true, get: function () { return endpoints_1.ENDPOINTS; } });
const ledger_1 = require("./ledger");
Object.defineProperty(exports, "LEDGER_CONN", { enumerable: true, get: function () { return ledger_1.LEDGER_CONN; } });
Object.defineProperty(exports, "LEDGER_CONN_DEFAULT", { enumerable: true, get: function () { return ledger_1.LEDGER_CONN_DEFAULT; } });
const ss58_1 = require("./ss58");
Object.defineProperty(exports, "PREFIX_DEFAULT", { enumerable: true, get: function () { return ss58_1.PREFIX_DEFAULT; } });
Object.defineProperty(exports, "PREFIXES", { enumerable: true, get: function () { return ss58_1.PREFIXES; } });
const ui_1 = require("./ui");
Object.defineProperty(exports, "ICON_DEFAULT", { enumerable: true, get: function () { return ui_1.ICON_DEFAULT; } });
Object.defineProperty(exports, "ICON_DEFAULT_HOST", { enumerable: true, get: function () { return ui_1.ICON_DEFAULT_HOST; } });
Object.defineProperty(exports, "ICONS", { enumerable: true, get: function () { return ui_1.ICONS; } });
Object.defineProperty(exports, "NOTIFICATION_DEFAULT", { enumerable: true, get: function () { return ui_1.NOTIFICATION_DEFAULT; } });
Object.defineProperty(exports, "UIMODE_DEFAULT", { enumerable: true, get: function () { return ui_1.UIMODE_DEFAULT; } });
Object.defineProperty(exports, "UIMODES", { enumerable: true, get: function () { return ui_1.UIMODES; } });
Object.defineProperty(exports, "UITHEME_DEFAULT", { enumerable: true, get: function () { return ui_1.UITHEME_DEFAULT; } });
Object.defineProperty(exports, "UITHEMES", { enumerable: true, get: function () { return ui_1.UITHEMES; } });
const CAMERA_DEFAULT = 'off';
exports.CAMERA_DEFAULT = CAMERA_DEFAULT;
const CAMERA = [{
info: 'on',
text: 'Allow camera access',
value: 'on'
}, {
info: 'off',
text: 'Do not allow camera access',
value: 'off'
}];
const CAMERA = [
{
info: 'on',
text: 'Allow camera access',
value: 'on'
},
{
info: 'off',
text: 'Do not allow camera access',
value: 'off'
}
];
exports.CAMERA = CAMERA;

@@ -136,35 +45,44 @@ const LANGUAGE_DEFAULT = 'default';

exports.LOCKING_DEFAULT = LOCKING_DEFAULT;
const LOCKING = [{
info: 'session',
text: 'Once per session',
value: 'session'
}, {
info: 'tx',
text: 'On each transaction',
value: 'tx'
}];
const LOCKING = [
{
info: 'session',
text: 'Once per session',
value: 'session'
},
{
info: 'tx',
text: 'On each transaction',
value: 'tx'
}
];
exports.LOCKING = LOCKING;
const METADATA_UP_DEFAULT = 'off';
exports.METADATA_UP_DEFAULT = METADATA_UP_DEFAULT;
const METADATA_UP = [{
info: 'off',
text: 'Do not auto-update extension metadata',
value: 'off'
}, {
info: 'on',
text: 'Auto-update extension metadata',
value: 'on'
}];
const METADATA_UP = [
{
info: 'off',
text: 'Do not auto-update extension metadata',
value: 'off'
},
{
info: 'on',
text: 'Auto-update extension metadata',
value: 'on'
}
];
exports.METADATA_UP = METADATA_UP;
const STORAGE_DEFAULT = 'off';
exports.STORAGE_DEFAULT = STORAGE_DEFAULT;
const STORAGE = [{
info: 'on',
text: 'Allow local in-browser account storage',
value: 'on'
}, {
info: 'off',
text: 'Do not allow local in-browser account storage',
value: 'off'
}];
const STORAGE = [
{
info: 'on',
text: 'Allow local in-browser account storage',
value: 'on'
},
{
info: 'off',
text: 'Do not allow local in-browser account storage',
value: 'off'
}
];
exports.STORAGE = STORAGE;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.LEDGER_CONN_DEFAULT = exports.LEDGER_CONN = void 0;
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
const LEDGER_CONN_DEFAULT = 'none';
exports.LEDGER_CONN_DEFAULT = LEDGER_CONN_DEFAULT;
const LEDGER_CONN = [{
info: 'none',
text: 'Do not attach Ledger devices',
value: 'none'
},
// Deprecated
// {
// info: 'u2f',
// text: 'Attach Ledger via U2F',
// value: 'u2f'
// },
{
info: 'webusb',
text: 'Attach Ledger via WebUSB (Chrome, recommended)',
value: 'webusb'
}, {
info: 'hid',
text: 'Attach Ledger via WebHID (Chrome, experimental)',
value: 'hid'
}];
exports.LEDGER_CONN = LEDGER_CONN;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LEDGER_CONN = exports.LEDGER_CONN_DEFAULT = void 0;
exports.LEDGER_CONN_DEFAULT = 'none';
exports.LEDGER_CONN = [
{
info: 'none',
text: 'Do not attach Ledger devices',
value: 'none'
},
// Deprecated
// {
// info: 'u2f',
// text: 'Attach Ledger via U2F',
// value: 'u2f'
// },
{
info: 'webusb',
text: 'Attach Ledger via WebUSB (Chrome, recommended)',
value: 'webusb'
},
{
info: 'hid',
text: 'Attach Ledger via WebHID (Chrome, experimental)',
value: 'hid'
}
];
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PREFIX_DEFAULT = exports.PREFIXES = void 0;
var _networks = require("@polkadot/networks");
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
const PREFIX_DEFAULT = -1;
exports.PREFIX_DEFAULT = PREFIX_DEFAULT;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PREFIXES = exports.PREFIX_DEFAULT = void 0;
const networks_1 = require("@polkadot/networks");
exports.PREFIX_DEFAULT = -1;
const defaultNetwork = {
info: 'default',
text: 'Default for the connected node',
value: -1
info: 'default',
text: 'Default for the connected node',
value: -1
};
const networks = _networks.availableNetworks.map(_ref => {
let {
displayName,
network,
prefix
} = _ref;
return {
const networks = networks_1.availableNetworks.map(({ displayName, network, prefix }) => ({
info: network,
text: displayName,
value: prefix
};
});
const PREFIXES = [defaultNetwork, ...networks];
exports.PREFIXES = PREFIXES;
}));
exports.PREFIXES = [defaultNetwork, ...networks];
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPolkadot = void 0;
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
// matches https://polkadot.js.org & https://*.polkadot.io
const isPolkadot = typeof window !== 'undefined' && window.location.host.includes('polkadot');
exports.isPolkadot = isPolkadot;
exports.isPolkadot = typeof window !== 'undefined' && window.location.host.includes('polkadot');
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.UITHEME_DEFAULT = exports.UITHEMES = exports.UIMODE_DEFAULT = exports.UIMODES = exports.NOTIFICATION_DEFAULT = exports.LANGUAGE_DEFAULT = exports.ICON_DEFAULT_HOST = exports.ICON_DEFAULT = exports.ICONS = void 0;
var _type = require("./type");
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.UITHEMES = exports.UITHEME_DEFAULT = exports.UIMODES = exports.UIMODE_DEFAULT = exports.NOTIFICATION_DEFAULT = exports.LANGUAGE_DEFAULT = exports.ICONS = exports.ICON_DEFAULT_HOST = exports.ICON_DEFAULT = void 0;
const type_1 = require("./type");
const LANGUAGE_DEFAULT = 'default';
exports.LANGUAGE_DEFAULT = LANGUAGE_DEFAULT;
const UIMODE_DEFAULT = !_type.isPolkadot && typeof window !== 'undefined' && window.location.host.includes('ui-light') ? 'light' : 'full';
const UIMODE_DEFAULT = !type_1.isPolkadot && typeof window !== 'undefined' && window.location.host.includes('ui-light')
? 'light'
: 'full';
exports.UIMODE_DEFAULT = UIMODE_DEFAULT;
const UIMODES = [{
info: 'full',
text: 'Fully featured',
value: 'full'
}, {
info: 'light',
text: 'Basic features only',
value: 'light'
}];
const UIMODES = [
{
info: 'full',
text: 'Fully featured',
value: 'full'
},
{
info: 'light',
text: 'Basic features only',
value: 'light'
}
];
exports.UIMODES = UIMODES;
const UITHEME_DEFAULT = _type.isPolkadot ? 'polkadot' : 'substrate';
const UITHEME_DEFAULT = type_1.isPolkadot
? 'polkadot'
: 'substrate';
exports.UITHEME_DEFAULT = UITHEME_DEFAULT;
const UITHEMES = [{
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
}, {
info: 'substrate',
text: 'Substrate',
value: 'substrate'
}];
const UITHEMES = [
{
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
},
{
info: 'substrate',
text: 'Substrate',
value: 'substrate'
}
];
exports.UITHEMES = UITHEMES;
const ICON_DEFAULT = 'default';
exports.ICON_DEFAULT = ICON_DEFAULT;
const ICON_DEFAULT_HOST = _type.isPolkadot ? 'polkadot' : 'substrate';
const ICON_DEFAULT_HOST = type_1.isPolkadot
? 'polkadot'
: 'substrate';
exports.ICON_DEFAULT_HOST = ICON_DEFAULT_HOST;
const ICONS = [{
info: 'default',
text: 'Default for the connected node',
value: 'default'
}, {
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
}, {
info: 'substrate',
text: 'Substrate',
value: 'substrate'
}, {
info: 'beachball',
text: 'Beachball',
value: 'beachball'
}];
const ICONS = [
{
info: 'default',
text: 'Default for the connected node',
value: 'default'
},
{
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
},
{
info: 'substrate',
text: 'Substrate',
value: 'substrate'
},
{
info: 'beachball',
text: 'Beachball',
value: 'beachball'
}
];
exports.ICONS = ICONS;
const NOTIFICATION_DEFAULT = 'popup';
exports.NOTIFICATION_DEFAULT = NOTIFICATION_DEFAULT;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Empty template, auto-generated by @polkadot/dev
var _default = [];
exports.default = _default;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = [];
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _util = require("@polkadot/util");
var _detectOther = _interopRequireDefault(require("./detectOther"));
var _packageInfo = require("./packageInfo");
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
(0, _util.detectPackage)(_packageInfo.packageInfo, null, _detectOther.default);
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const util_1 = require("@polkadot/util");
const detectOther_1 = tslib_1.__importDefault(require("./detectOther"));
const packageInfo_1 = require("./packageInfo");
(0, util_1.detectPackage)(packageInfo_1.packageInfo, null, detectOther_1.default);
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {};
exports.default = void 0;
var _bundle = require("./bundle");
Object.keys(_bundle).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _bundle[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _bundle[key];
}
});
});
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
var _default = _bundle.settings;
exports.default = _default;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const bundle_1 = require("./bundle");
tslib_1.__exportStar(require("./bundle"), exports);
exports.default = bundle_1.settings;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
exports.packageInfo = void 0;
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
const packageInfo = {
name: '@polkadot/ui-settings',
path: typeof __dirname === 'string' ? __dirname : 'auto',
type: 'cjs',
version: '2.12.1'
};
exports.packageInfo = packageInfo;
exports.packageInfo = { name: '@polkadot/ui-settings', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '3.0.1' };
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Settings_emitter, _Settings_apiType, _Settings_apiUrl, _Settings_camera, _Settings_i18nLang, _Settings_icon, _Settings_ledgerConn, _Settings_locking, _Settings_metadataUp, _Settings_prefix, _Settings_storage, _Settings_uiMode, _Settings_uiTheme, _Settings_notification;
Object.defineProperty(exports, "__esModule", { value: true });
exports.settings = exports.Settings = void 0;
var _eventemitter = _interopRequireDefault(require("eventemitter3"));
var _store = _interopRequireDefault(require("store"));
var _util = require("@polkadot/util");
var _defaults = require("./defaults");
// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
const tslib_1 = require("tslib");
const eventemitter3_1 = tslib_1.__importDefault(require("eventemitter3"));
const store_1 = tslib_1.__importDefault(require("store"));
const util_1 = require("@polkadot/util");
const defaults_1 = require("./defaults");
function withDefault(options, option, fallback) {
const _option = option || fallback;
return options.some(_ref => {
let {
value
} = _ref;
return value === _option;
}) ? _option : fallback;
const _option = option || fallback;
return options.some(({ value }) => value === _option)
? _option
: fallback;
}
class Settings {
#emitter;
#apiType;
// will become deprecated for supporting substrate connect light clients. apiType structure should be used instead
#apiUrl;
#camera;
#i18nLang;
#icon;
#ledgerConn;
#locking;
#metadataUp;
#prefix;
#storage;
#uiMode;
#uiTheme;
#notification;
constructor() {
const settings = _store.default.get('settings') || {};
this.#emitter = new _eventemitter.default();
// will become deprecated for supporting substrate connect light clients. apiType structure should be used instead
this.#apiUrl = typeof settings.apiUrl === 'string' && settings.apiUrl || _util.hasProcess && process.env && process.env.WS_URL || _defaults.ENDPOINT_DEFAULT.value;
this.#apiType = {
param: this.#apiUrl,
type: 'json-rpc'
};
this.#camera = withDefault(_defaults.CAMERA, settings.camera, _defaults.CAMERA_DEFAULT);
this.#ledgerConn = withDefault(_defaults.LEDGER_CONN, settings.ledgerConn, _defaults.LEDGER_CONN_DEFAULT);
this.#i18nLang = settings.i18nLang || _defaults.LANGUAGE_DEFAULT;
this.#icon = settings.icon || _defaults.ICON_DEFAULT;
this.#locking = settings.locking || _defaults.LOCKING_DEFAULT;
this.#metadataUp = withDefault(_defaults.METADATA_UP, settings.storage, _defaults.METADATA_UP_DEFAULT);
this.#notification = settings.notification || _defaults.NOTIFICATION_DEFAULT;
this.#prefix = (0, _util.isUndefined)(settings.prefix) ? _defaults.PREFIX_DEFAULT : settings.prefix;
this.#storage = withDefault(_defaults.STORAGE, settings.storage, _defaults.STORAGE_DEFAULT);
this.#uiMode = settings.uiMode || _defaults.UIMODE_DEFAULT;
this.#uiTheme = settings.uiTheme || _defaults.UITHEME_DEFAULT;
}
get camera() {
return this.#camera;
}
get apiType() {
return this.#apiType;
}
get apiUrl() {
return this.#apiUrl;
}
get i18nLang() {
return this.#i18nLang;
}
get icon() {
return this.#icon;
}
get notification() {
return this.#notification;
}
get ledgerConn() {
return this.#ledgerConn;
}
get locking() {
return this.#locking;
}
get metadataUp() {
return this.#metadataUp;
}
get prefix() {
return this.#prefix;
}
get storage() {
return this.#storage;
}
get uiMode() {
return this.#uiMode;
}
get uiTheme() {
return this.#uiTheme;
}
get availableCamera() {
return _defaults.CAMERA;
}
get availableCryptos() {
return _defaults.CRYPTOS;
}
get availableCryptosEth() {
return _defaults.CRYPTOS_ETH;
}
get availableCryptosLedger() {
return _defaults.CRYPTOS_LEDGER;
}
get availableIcons() {
return _defaults.ICONS;
}
get availableLedgerConn() {
return _defaults.LEDGER_CONN;
}
get availableLocking() {
return _defaults.LOCKING;
}
get availableMetadataUp() {
return _defaults.METADATA_UP;
}
get availableNodes() {
return _defaults.ENDPOINTS;
}
get availablePrefixes() {
return _defaults.PREFIXES;
}
get availableStorage() {
return _defaults.STORAGE;
}
get availableUIModes() {
return _defaults.UIMODES;
}
get availableUIThemes() {
return _defaults.UITHEMES;
}
get() {
return {
apiType: this.#apiType,
apiUrl: this.#apiUrl,
camera: this.#camera,
i18nLang: this.#i18nLang,
icon: this.#icon,
ledgerConn: this.#ledgerConn,
locking: this.#locking,
metadataUp: this.#metadataUp,
notification: this.#notification,
prefix: this.#prefix,
storage: this.#storage,
uiMode: this.#uiMode,
uiTheme: this.#uiTheme
};
}
set(settings) {
this.#apiType = settings.apiType || this.#apiType;
this.#apiUrl = settings.apiUrl || this.#apiUrl;
this.#camera = settings.camera || this.#camera;
this.#ledgerConn = settings.ledgerConn || this.#ledgerConn;
this.#i18nLang = settings.i18nLang || this.#i18nLang;
this.#icon = settings.icon || this.#icon;
this.#locking = settings.locking || this.#locking;
this.#metadataUp = settings.metadataUp || this.#metadataUp;
this.#notification = settings.notification || this.#notification;
this.#prefix = (0, _util.isUndefined)(settings.prefix) ? this.#prefix : settings.prefix;
this.#storage = settings.storage || this.#storage;
this.#uiMode = settings.uiMode || this.#uiMode;
this.#uiTheme = settings.uiTheme || this.#uiTheme;
const newValues = this.get();
_store.default.set('settings', newValues);
this.#emitter.emit('change', newValues);
}
on(type, cb) {
this.#emitter.on(type, cb);
}
constructor() {
_Settings_emitter.set(this, void 0);
_Settings_apiType.set(this, void 0);
// will become deprecated for supporting substrate connect light clients. apiType structure should be used instead
_Settings_apiUrl.set(this, void 0);
_Settings_camera.set(this, void 0);
_Settings_i18nLang.set(this, void 0);
_Settings_icon.set(this, void 0);
_Settings_ledgerConn.set(this, void 0);
_Settings_locking.set(this, void 0);
_Settings_metadataUp.set(this, void 0);
_Settings_prefix.set(this, void 0);
_Settings_storage.set(this, void 0);
_Settings_uiMode.set(this, void 0);
_Settings_uiTheme.set(this, void 0);
_Settings_notification.set(this, void 0);
const settings = store_1.default.get('settings') || {};
tslib_1.__classPrivateFieldSet(this, _Settings_emitter, new eventemitter3_1.default(), "f");
// will become deprecated for supporting substrate connect light clients. apiType structure should be used instead
tslib_1.__classPrivateFieldSet(this, _Settings_apiUrl, (typeof settings.apiUrl === 'string' && settings.apiUrl) || (util_1.hasProcess && process.env && process.env.WS_URL) || defaults_1.ENDPOINT_DEFAULT.value, "f");
tslib_1.__classPrivateFieldSet(this, _Settings_apiType, { param: tslib_1.__classPrivateFieldGet(this, _Settings_apiUrl, "f"), type: 'json-rpc' }, "f");
tslib_1.__classPrivateFieldSet(this, _Settings_camera, withDefault(defaults_1.CAMERA, settings.camera, defaults_1.CAMERA_DEFAULT), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_ledgerConn, withDefault(defaults_1.LEDGER_CONN, settings.ledgerConn, defaults_1.LEDGER_CONN_DEFAULT), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_i18nLang, settings.i18nLang || defaults_1.LANGUAGE_DEFAULT, "f");
tslib_1.__classPrivateFieldSet(this, _Settings_icon, settings.icon || defaults_1.ICON_DEFAULT, "f");
tslib_1.__classPrivateFieldSet(this, _Settings_locking, settings.locking || defaults_1.LOCKING_DEFAULT, "f");
tslib_1.__classPrivateFieldSet(this, _Settings_metadataUp, withDefault(defaults_1.METADATA_UP, settings.storage, defaults_1.METADATA_UP_DEFAULT), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_notification, settings.notification || defaults_1.NOTIFICATION_DEFAULT, "f");
tslib_1.__classPrivateFieldSet(this, _Settings_prefix, (0, util_1.isUndefined)(settings.prefix) ? defaults_1.PREFIX_DEFAULT : settings.prefix, "f");
tslib_1.__classPrivateFieldSet(this, _Settings_storage, withDefault(defaults_1.STORAGE, settings.storage, defaults_1.STORAGE_DEFAULT), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_uiMode, settings.uiMode || defaults_1.UIMODE_DEFAULT, "f");
tslib_1.__classPrivateFieldSet(this, _Settings_uiTheme, settings.uiTheme || defaults_1.UITHEME_DEFAULT, "f");
}
get camera() {
return tslib_1.__classPrivateFieldGet(this, _Settings_camera, "f");
}
get apiType() {
return tslib_1.__classPrivateFieldGet(this, _Settings_apiType, "f");
}
get apiUrl() {
return tslib_1.__classPrivateFieldGet(this, _Settings_apiUrl, "f");
}
get i18nLang() {
return tslib_1.__classPrivateFieldGet(this, _Settings_i18nLang, "f");
}
get icon() {
return tslib_1.__classPrivateFieldGet(this, _Settings_icon, "f");
}
get notification() {
return tslib_1.__classPrivateFieldGet(this, _Settings_notification, "f");
}
get ledgerConn() {
return tslib_1.__classPrivateFieldGet(this, _Settings_ledgerConn, "f");
}
get locking() {
return tslib_1.__classPrivateFieldGet(this, _Settings_locking, "f");
}
get metadataUp() {
return tslib_1.__classPrivateFieldGet(this, _Settings_metadataUp, "f");
}
get prefix() {
return tslib_1.__classPrivateFieldGet(this, _Settings_prefix, "f");
}
get storage() {
return tslib_1.__classPrivateFieldGet(this, _Settings_storage, "f");
}
get uiMode() {
return tslib_1.__classPrivateFieldGet(this, _Settings_uiMode, "f");
}
get uiTheme() {
return tslib_1.__classPrivateFieldGet(this, _Settings_uiTheme, "f");
}
get availableCamera() {
return defaults_1.CAMERA;
}
get availableCryptos() {
return defaults_1.CRYPTOS;
}
get availableCryptosEth() {
return defaults_1.CRYPTOS_ETH;
}
get availableCryptosLedger() {
return defaults_1.CRYPTOS_LEDGER;
}
get availableIcons() {
return defaults_1.ICONS;
}
get availableLedgerConn() {
return defaults_1.LEDGER_CONN;
}
get availableLocking() {
return defaults_1.LOCKING;
}
get availableMetadataUp() {
return defaults_1.METADATA_UP;
}
get availableNodes() {
return defaults_1.ENDPOINTS;
}
get availablePrefixes() {
return defaults_1.PREFIXES;
}
get availableStorage() {
return defaults_1.STORAGE;
}
get availableUIModes() {
return defaults_1.UIMODES;
}
get availableUIThemes() {
return defaults_1.UITHEMES;
}
get() {
return {
apiType: tslib_1.__classPrivateFieldGet(this, _Settings_apiType, "f"),
apiUrl: tslib_1.__classPrivateFieldGet(this, _Settings_apiUrl, "f"),
camera: tslib_1.__classPrivateFieldGet(this, _Settings_camera, "f"),
i18nLang: tslib_1.__classPrivateFieldGet(this, _Settings_i18nLang, "f"),
icon: tslib_1.__classPrivateFieldGet(this, _Settings_icon, "f"),
ledgerConn: tslib_1.__classPrivateFieldGet(this, _Settings_ledgerConn, "f"),
locking: tslib_1.__classPrivateFieldGet(this, _Settings_locking, "f"),
metadataUp: tslib_1.__classPrivateFieldGet(this, _Settings_metadataUp, "f"),
notification: tslib_1.__classPrivateFieldGet(this, _Settings_notification, "f"),
prefix: tslib_1.__classPrivateFieldGet(this, _Settings_prefix, "f"),
storage: tslib_1.__classPrivateFieldGet(this, _Settings_storage, "f"),
uiMode: tslib_1.__classPrivateFieldGet(this, _Settings_uiMode, "f"),
uiTheme: tslib_1.__classPrivateFieldGet(this, _Settings_uiTheme, "f")
};
}
set(settings) {
tslib_1.__classPrivateFieldSet(this, _Settings_apiType, settings.apiType || tslib_1.__classPrivateFieldGet(this, _Settings_apiType, "f"), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_apiUrl, settings.apiUrl || tslib_1.__classPrivateFieldGet(this, _Settings_apiUrl, "f"), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_camera, settings.camera || tslib_1.__classPrivateFieldGet(this, _Settings_camera, "f"), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_ledgerConn, settings.ledgerConn || tslib_1.__classPrivateFieldGet(this, _Settings_ledgerConn, "f"), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_i18nLang, settings.i18nLang || tslib_1.__classPrivateFieldGet(this, _Settings_i18nLang, "f"), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_icon, settings.icon || tslib_1.__classPrivateFieldGet(this, _Settings_icon, "f"), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_locking, settings.locking || tslib_1.__classPrivateFieldGet(this, _Settings_locking, "f"), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_metadataUp, settings.metadataUp || tslib_1.__classPrivateFieldGet(this, _Settings_metadataUp, "f"), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_notification, settings.notification || tslib_1.__classPrivateFieldGet(this, _Settings_notification, "f"), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_prefix, (0, util_1.isUndefined)(settings.prefix) ? tslib_1.__classPrivateFieldGet(this, _Settings_prefix, "f") : settings.prefix, "f");
tslib_1.__classPrivateFieldSet(this, _Settings_storage, settings.storage || tslib_1.__classPrivateFieldGet(this, _Settings_storage, "f"), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_uiMode, settings.uiMode || tslib_1.__classPrivateFieldGet(this, _Settings_uiMode, "f"), "f");
tslib_1.__classPrivateFieldSet(this, _Settings_uiTheme, settings.uiTheme || tslib_1.__classPrivateFieldGet(this, _Settings_uiTheme, "f"), "f");
const newValues = this.get();
store_1.default.set('settings', newValues);
tslib_1.__classPrivateFieldGet(this, _Settings_emitter, "f").emit('change', newValues);
}
on(type, cb) {
tslib_1.__classPrivateFieldGet(this, _Settings_emitter, "f").on(type, cb);
}
}
exports.Settings = Settings;
const settings = new Settings();
exports.settings = settings;
_Settings_emitter = new WeakMap(), _Settings_apiType = new WeakMap(), _Settings_apiUrl = new WeakMap(), _Settings_camera = new WeakMap(), _Settings_i18nLang = new WeakMap(), _Settings_icon = new WeakMap(), _Settings_ledgerConn = new WeakMap(), _Settings_locking = new WeakMap(), _Settings_metadataUp = new WeakMap(), _Settings_prefix = new WeakMap(), _Settings_storage = new WeakMap(), _Settings_uiMode = new WeakMap(), _Settings_uiTheme = new WeakMap(), _Settings_notification = new WeakMap();
exports.settings = new Settings();

@@ -1,1 +0,2 @@

"use strict";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,12 +0,6 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { selectableNetworks } from '@polkadot/networks';
import { objectSpread } from '@polkadot/util';
const chains = selectableNetworks.filter(n => n.genesisHash.length).reduce((chains, {
genesisHash,
network
}) => objectSpread(chains, {
[network]: genesisHash
}), {});
const chains = selectableNetworks
.filter((n) => n.genesisHash.length)
.reduce((chains, { genesisHash, network }) => objectSpread(chains, { [network]: genesisHash }), {});
export { chains };

@@ -1,26 +0,32 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const CRYPTOS = [{
info: 'sr25519',
text: 'Schnorrkel (sr25519, recommended)',
value: 'sr25519'
}, {
info: 'ed25519',
text: 'Edwards (ed25519, alternative)',
value: 'ed25519'
}, {
info: 'ecdsa',
text: 'ECDSA (Non BTC/ETH compatible)',
value: 'ecdsa'
}];
export const CRYPTOS_ETH = [{
info: 'ethereum',
text: 'ECDSA (ETH compatible)',
value: 'ethereum'
}];
export const CRYPTOS_LEDGER = [...CRYPTOS, {
info: 'ed25519-ledger',
text: 'Ledger (ed25519, BIP32 derivation)',
value: 'ed25519-ledger'
}];
export const CRYPTOS = [
{
info: 'sr25519',
text: 'Schnorrkel (sr25519, recommended)',
value: 'sr25519'
},
{
info: 'ed25519',
text: 'Edwards (ed25519, alternative)',
value: 'ed25519'
},
{
info: 'ecdsa',
text: 'ECDSA (Non BTC/ETH compatible)',
value: 'ecdsa'
}
];
export const CRYPTOS_ETH = [
{
info: 'ethereum',
text: 'ECDSA (ETH compatible)',
value: 'ethereum'
}
];
export const CRYPTOS_LEDGER = [
...CRYPTOS,
{
info: 'ed25519-ledger',
text: 'Ledger (ed25519, BIP32 derivation)',
value: 'ed25519-ledger'
}
];

@@ -1,9 +0,6 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const ENDPOINTS = [{
info: 'local',
text: 'Local Node (Own, 127.0.0.1:9944)',
value: 'ws://127.0.0.1:9944/'
}];
info: 'local',
text: 'Local Node (Own, 127.0.0.1:9944)',
value: 'ws://127.0.0.1:9944/'
}];
export const ENDPOINT_DEFAULT = ENDPOINTS[0];

@@ -1,50 +0,59 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { CRYPTOS, CRYPTOS_ETH, CRYPTOS_LEDGER } from "./crypto.js";
import { ENDPOINT_DEFAULT, ENDPOINTS } from "./endpoints.js";
import { LEDGER_CONN, LEDGER_CONN_DEFAULT } from "./ledger.js";
import { PREFIX_DEFAULT, PREFIXES } from "./ss58.js";
import { ICON_DEFAULT, ICON_DEFAULT_HOST, ICONS, NOTIFICATION_DEFAULT, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from "./ui.js";
import { CRYPTOS, CRYPTOS_ETH, CRYPTOS_LEDGER } from './crypto.js';
import { ENDPOINT_DEFAULT, ENDPOINTS } from './endpoints.js';
import { LEDGER_CONN, LEDGER_CONN_DEFAULT } from './ledger.js';
import { PREFIX_DEFAULT, PREFIXES } from './ss58.js';
import { ICON_DEFAULT, ICON_DEFAULT_HOST, ICONS, NOTIFICATION_DEFAULT, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './ui.js';
const CAMERA_DEFAULT = 'off';
const CAMERA = [{
info: 'on',
text: 'Allow camera access',
value: 'on'
}, {
info: 'off',
text: 'Do not allow camera access',
value: 'off'
}];
const CAMERA = [
{
info: 'on',
text: 'Allow camera access',
value: 'on'
},
{
info: 'off',
text: 'Do not allow camera access',
value: 'off'
}
];
const LANGUAGE_DEFAULT = 'default';
const LOCKING_DEFAULT = 'session';
const LOCKING = [{
info: 'session',
text: 'Once per session',
value: 'session'
}, {
info: 'tx',
text: 'On each transaction',
value: 'tx'
}];
const LOCKING = [
{
info: 'session',
text: 'Once per session',
value: 'session'
},
{
info: 'tx',
text: 'On each transaction',
value: 'tx'
}
];
const METADATA_UP_DEFAULT = 'off';
const METADATA_UP = [{
info: 'off',
text: 'Do not auto-update extension metadata',
value: 'off'
}, {
info: 'on',
text: 'Auto-update extension metadata',
value: 'on'
}];
const METADATA_UP = [
{
info: 'off',
text: 'Do not auto-update extension metadata',
value: 'off'
},
{
info: 'on',
text: 'Auto-update extension metadata',
value: 'on'
}
];
const STORAGE_DEFAULT = 'off';
const STORAGE = [{
info: 'on',
text: 'Allow local in-browser account storage',
value: 'on'
}, {
info: 'off',
text: 'Do not allow local in-browser account storage',
value: 'off'
}];
const STORAGE = [
{
info: 'on',
text: 'Allow local in-browser account storage',
value: 'on'
},
{
info: 'off',
text: 'Do not allow local in-browser account storage',
value: 'off'
}
];
export { CAMERA_DEFAULT, CAMERA, CRYPTOS, CRYPTOS_ETH, CRYPTOS_LEDGER, ENDPOINT_DEFAULT, ENDPOINTS, ICON_DEFAULT, ICON_DEFAULT_HOST, ICONS, LANGUAGE_DEFAULT, LEDGER_CONN_DEFAULT, LEDGER_CONN, LOCKING_DEFAULT, LOCKING, METADATA_UP, METADATA_UP_DEFAULT, NOTIFICATION_DEFAULT, PREFIX_DEFAULT, PREFIXES, STORAGE, STORAGE_DEFAULT, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES };

@@ -1,24 +0,24 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
export const LEDGER_CONN_DEFAULT = 'none';
export const LEDGER_CONN = [{
info: 'none',
text: 'Do not attach Ledger devices',
value: 'none'
},
// Deprecated
// {
// info: 'u2f',
// text: 'Attach Ledger via U2F',
// value: 'u2f'
// },
{
info: 'webusb',
text: 'Attach Ledger via WebUSB (Chrome, recommended)',
value: 'webusb'
}, {
info: 'hid',
text: 'Attach Ledger via WebHID (Chrome, experimental)',
value: 'hid'
}];
export const LEDGER_CONN = [
{
info: 'none',
text: 'Do not attach Ledger devices',
value: 'none'
},
// Deprecated
// {
// info: 'u2f',
// text: 'Attach Ledger via U2F',
// value: 'u2f'
// },
{
info: 'webusb',
text: 'Attach Ledger via WebUSB (Chrome, recommended)',
value: 'webusb'
},
{
info: 'hid',
text: 'Attach Ledger via WebHID (Chrome, experimental)',
value: 'hid'
}
];

@@ -1,20 +0,13 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { availableNetworks } from '@polkadot/networks';
export const PREFIX_DEFAULT = -1;
const defaultNetwork = {
info: 'default',
text: 'Default for the connected node',
value: -1
info: 'default',
text: 'Default for the connected node',
value: -1
};
const networks = availableNetworks.map(({
displayName,
network,
prefix
}) => ({
info: network,
text: displayName,
value: prefix
const networks = availableNetworks.map(({ displayName, network, prefix }) => ({
info: network,
text: displayName,
value: prefix
}));
export const PREFIXES = [defaultNetwork, ...networks];

@@ -1,5 +0,1 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
// matches https://polkadot.js.org & https://*.polkadot.io
export const isPolkadot = typeof window !== 'undefined' && window.location.host.includes('polkadot');

@@ -1,46 +0,60 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { isPolkadot } from "./type.js";
import { isPolkadot } from './type.js';
const LANGUAGE_DEFAULT = 'default';
const UIMODE_DEFAULT = !isPolkadot && typeof window !== 'undefined' && window.location.host.includes('ui-light') ? 'light' : 'full';
const UIMODES = [{
info: 'full',
text: 'Fully featured',
value: 'full'
}, {
info: 'light',
text: 'Basic features only',
value: 'light'
}];
const UITHEME_DEFAULT = isPolkadot ? 'polkadot' : 'substrate';
const UITHEMES = [{
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
}, {
info: 'substrate',
text: 'Substrate',
value: 'substrate'
}];
const UIMODE_DEFAULT = !isPolkadot && typeof window !== 'undefined' && window.location.host.includes('ui-light')
? 'light'
: 'full';
const UIMODES = [
{
info: 'full',
text: 'Fully featured',
value: 'full'
},
{
info: 'light',
text: 'Basic features only',
value: 'light'
}
];
const UITHEME_DEFAULT = isPolkadot
? 'polkadot'
: 'substrate';
const UITHEMES = [
{
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
},
{
info: 'substrate',
text: 'Substrate',
value: 'substrate'
}
];
const ICON_DEFAULT = 'default';
const ICON_DEFAULT_HOST = isPolkadot ? 'polkadot' : 'substrate';
const ICONS = [{
info: 'default',
text: 'Default for the connected node',
value: 'default'
}, {
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
}, {
info: 'substrate',
text: 'Substrate',
value: 'substrate'
}, {
info: 'beachball',
text: 'Beachball',
value: 'beachball'
}];
const ICON_DEFAULT_HOST = isPolkadot
? 'polkadot'
: 'substrate';
const ICONS = [
{
info: 'default',
text: 'Default for the connected node',
value: 'default'
},
{
info: 'polkadot',
text: 'Polkadot',
value: 'polkadot'
},
{
info: 'substrate',
text: 'Substrate',
value: 'substrate'
},
{
info: 'beachball',
text: 'Beachball',
value: 'beachball'
}
];
const NOTIFICATION_DEFAULT = 'popup';
export { ICON_DEFAULT, ICON_DEFAULT_HOST, ICONS, LANGUAGE_DEFAULT, NOTIFICATION_DEFAULT, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES };

@@ -1,6 +0,1 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Empty template, auto-generated by @polkadot/dev
export default [];

@@ -1,9 +0,4 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
import { detectPackage } from '@polkadot/util';
import others from "./detectOther.js";
import { packageInfo } from "./packageInfo.js";
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);

@@ -1,6 +0,3 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { settings } from "./bundle.js";
export * from "./bundle.js";
import { settings } from './bundle.js';
export * from './bundle.js';
export default settings;

@@ -20,3 +20,3 @@ {

"type": "module",
"version": "2.12.1",
"version": "3.0.1",
"main": "./cjs/index.js",

@@ -88,3 +88,6 @@ "module": "./index.js",

},
"./package.json": "./package.json",
"./package.json": {
"require": "./cjs/package.json",
"default": "./package.json"
},
"./packageInfo.js": {

@@ -112,7 +115,7 @@ "types": "./packageInfo.d.ts",

"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/networks": "^10.4.2",
"@polkadot/util": "^10.4.2",
"@polkadot/networks": "^11.0.1",
"@polkadot/util": "^11.0.1",
"eventemitter3": "^4.0.7",
"store": "^2.0.12"
"store": "^2.0.12",
"tslib": "^2.5.0"
},

@@ -119,0 +122,0 @@ "peerDependencies": {

@@ -1,11 +0,1 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = {
name: '@polkadot/ui-settings',
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
type: 'esm',
version: '2.12.1'
};
export const packageInfo = { name: '@polkadot/ui-settings', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '3.0.1' };

@@ -1,170 +0,162 @@

// Copyright 2017-2023 @polkadot/ui-settings authors & contributors
// SPDX-License-Identifier: Apache-2.0
import EventEmitter from 'eventemitter3';
import store from 'store';
import { hasProcess, isUndefined } from '@polkadot/util';
import { CAMERA, CAMERA_DEFAULT, CRYPTOS, CRYPTOS_ETH, CRYPTOS_LEDGER, ENDPOINT_DEFAULT, ENDPOINTS, ICON_DEFAULT, ICONS, LANGUAGE_DEFAULT, LEDGER_CONN, LEDGER_CONN_DEFAULT, LOCKING, LOCKING_DEFAULT, METADATA_UP, METADATA_UP_DEFAULT, NOTIFICATION_DEFAULT, PREFIX_DEFAULT, PREFIXES, STORAGE, STORAGE_DEFAULT, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from "./defaults/index.js";
import { CAMERA, CAMERA_DEFAULT, CRYPTOS, CRYPTOS_ETH, CRYPTOS_LEDGER, ENDPOINT_DEFAULT, ENDPOINTS, ICON_DEFAULT, ICONS, LANGUAGE_DEFAULT, LEDGER_CONN, LEDGER_CONN_DEFAULT, LOCKING, LOCKING_DEFAULT, METADATA_UP, METADATA_UP_DEFAULT, NOTIFICATION_DEFAULT, PREFIX_DEFAULT, PREFIXES, STORAGE, STORAGE_DEFAULT, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './defaults/index.js';
function withDefault(options, option, fallback) {
const _option = option || fallback;
return options.some(({
value
}) => value === _option) ? _option : fallback;
const _option = option || fallback;
return options.some(({ value }) => value === _option)
? _option
: fallback;
}
export class Settings {
#emitter;
#apiType;
// will become deprecated for supporting substrate connect light clients. apiType structure should be used instead
#apiUrl;
#camera;
#i18nLang;
#icon;
#ledgerConn;
#locking;
#metadataUp;
#prefix;
#storage;
#uiMode;
#uiTheme;
#notification;
constructor() {
const settings = store.get('settings') || {};
this.#emitter = new EventEmitter();
#emitter;
#apiType;
// will become deprecated for supporting substrate connect light clients. apiType structure should be used instead
this.#apiUrl = typeof settings.apiUrl === 'string' && settings.apiUrl || hasProcess && process.env && process.env.WS_URL || ENDPOINT_DEFAULT.value;
this.#apiType = {
param: this.#apiUrl,
type: 'json-rpc'
};
this.#camera = withDefault(CAMERA, settings.camera, CAMERA_DEFAULT);
this.#ledgerConn = withDefault(LEDGER_CONN, settings.ledgerConn, LEDGER_CONN_DEFAULT);
this.#i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
this.#icon = settings.icon || ICON_DEFAULT;
this.#locking = settings.locking || LOCKING_DEFAULT;
this.#metadataUp = withDefault(METADATA_UP, settings.storage, METADATA_UP_DEFAULT);
this.#notification = settings.notification || NOTIFICATION_DEFAULT;
this.#prefix = isUndefined(settings.prefix) ? PREFIX_DEFAULT : settings.prefix;
this.#storage = withDefault(STORAGE, settings.storage, STORAGE_DEFAULT);
this.#uiMode = settings.uiMode || UIMODE_DEFAULT;
this.#uiTheme = settings.uiTheme || UITHEME_DEFAULT;
}
get camera() {
return this.#camera;
}
get apiType() {
return this.#apiType;
}
get apiUrl() {
return this.#apiUrl;
}
get i18nLang() {
return this.#i18nLang;
}
get icon() {
return this.#icon;
}
get notification() {
return this.#notification;
}
get ledgerConn() {
return this.#ledgerConn;
}
get locking() {
return this.#locking;
}
get metadataUp() {
return this.#metadataUp;
}
get prefix() {
return this.#prefix;
}
get storage() {
return this.#storage;
}
get uiMode() {
return this.#uiMode;
}
get uiTheme() {
return this.#uiTheme;
}
get availableCamera() {
return CAMERA;
}
get availableCryptos() {
return CRYPTOS;
}
get availableCryptosEth() {
return CRYPTOS_ETH;
}
get availableCryptosLedger() {
return CRYPTOS_LEDGER;
}
get availableIcons() {
return ICONS;
}
get availableLedgerConn() {
return LEDGER_CONN;
}
get availableLocking() {
return LOCKING;
}
get availableMetadataUp() {
return METADATA_UP;
}
get availableNodes() {
return ENDPOINTS;
}
get availablePrefixes() {
return PREFIXES;
}
get availableStorage() {
return STORAGE;
}
get availableUIModes() {
return UIMODES;
}
get availableUIThemes() {
return UITHEMES;
}
get() {
return {
apiType: this.#apiType,
apiUrl: this.#apiUrl,
camera: this.#camera,
i18nLang: this.#i18nLang,
icon: this.#icon,
ledgerConn: this.#ledgerConn,
locking: this.#locking,
metadataUp: this.#metadataUp,
notification: this.#notification,
prefix: this.#prefix,
storage: this.#storage,
uiMode: this.#uiMode,
uiTheme: this.#uiTheme
};
}
set(settings) {
this.#apiType = settings.apiType || this.#apiType;
this.#apiUrl = settings.apiUrl || this.#apiUrl;
this.#camera = settings.camera || this.#camera;
this.#ledgerConn = settings.ledgerConn || this.#ledgerConn;
this.#i18nLang = settings.i18nLang || this.#i18nLang;
this.#icon = settings.icon || this.#icon;
this.#locking = settings.locking || this.#locking;
this.#metadataUp = settings.metadataUp || this.#metadataUp;
this.#notification = settings.notification || this.#notification;
this.#prefix = isUndefined(settings.prefix) ? this.#prefix : settings.prefix;
this.#storage = settings.storage || this.#storage;
this.#uiMode = settings.uiMode || this.#uiMode;
this.#uiTheme = settings.uiTheme || this.#uiTheme;
const newValues = this.get();
store.set('settings', newValues);
this.#emitter.emit('change', newValues);
}
on(type, cb) {
this.#emitter.on(type, cb);
}
#apiUrl;
#camera;
#i18nLang;
#icon;
#ledgerConn;
#locking;
#metadataUp;
#prefix;
#storage;
#uiMode;
#uiTheme;
#notification;
constructor() {
const settings = store.get('settings') || {};
this.#emitter = new EventEmitter();
// will become deprecated for supporting substrate connect light clients. apiType structure should be used instead
this.#apiUrl = (typeof settings.apiUrl === 'string' && settings.apiUrl) || (hasProcess && process.env && process.env.WS_URL) || ENDPOINT_DEFAULT.value;
this.#apiType = { param: this.#apiUrl, type: 'json-rpc' };
this.#camera = withDefault(CAMERA, settings.camera, CAMERA_DEFAULT);
this.#ledgerConn = withDefault(LEDGER_CONN, settings.ledgerConn, LEDGER_CONN_DEFAULT);
this.#i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
this.#icon = settings.icon || ICON_DEFAULT;
this.#locking = settings.locking || LOCKING_DEFAULT;
this.#metadataUp = withDefault(METADATA_UP, settings.storage, METADATA_UP_DEFAULT);
this.#notification = settings.notification || NOTIFICATION_DEFAULT;
this.#prefix = isUndefined(settings.prefix) ? PREFIX_DEFAULT : settings.prefix;
this.#storage = withDefault(STORAGE, settings.storage, STORAGE_DEFAULT);
this.#uiMode = settings.uiMode || UIMODE_DEFAULT;
this.#uiTheme = settings.uiTheme || UITHEME_DEFAULT;
}
get camera() {
return this.#camera;
}
get apiType() {
return this.#apiType;
}
get apiUrl() {
return this.#apiUrl;
}
get i18nLang() {
return this.#i18nLang;
}
get icon() {
return this.#icon;
}
get notification() {
return this.#notification;
}
get ledgerConn() {
return this.#ledgerConn;
}
get locking() {
return this.#locking;
}
get metadataUp() {
return this.#metadataUp;
}
get prefix() {
return this.#prefix;
}
get storage() {
return this.#storage;
}
get uiMode() {
return this.#uiMode;
}
get uiTheme() {
return this.#uiTheme;
}
get availableCamera() {
return CAMERA;
}
get availableCryptos() {
return CRYPTOS;
}
get availableCryptosEth() {
return CRYPTOS_ETH;
}
get availableCryptosLedger() {
return CRYPTOS_LEDGER;
}
get availableIcons() {
return ICONS;
}
get availableLedgerConn() {
return LEDGER_CONN;
}
get availableLocking() {
return LOCKING;
}
get availableMetadataUp() {
return METADATA_UP;
}
get availableNodes() {
return ENDPOINTS;
}
get availablePrefixes() {
return PREFIXES;
}
get availableStorage() {
return STORAGE;
}
get availableUIModes() {
return UIMODES;
}
get availableUIThemes() {
return UITHEMES;
}
get() {
return {
apiType: this.#apiType,
apiUrl: this.#apiUrl,
camera: this.#camera,
i18nLang: this.#i18nLang,
icon: this.#icon,
ledgerConn: this.#ledgerConn,
locking: this.#locking,
metadataUp: this.#metadataUp,
notification: this.#notification,
prefix: this.#prefix,
storage: this.#storage,
uiMode: this.#uiMode,
uiTheme: this.#uiTheme
};
}
set(settings) {
this.#apiType = settings.apiType || this.#apiType;
this.#apiUrl = settings.apiUrl || this.#apiUrl;
this.#camera = settings.camera || this.#camera;
this.#ledgerConn = settings.ledgerConn || this.#ledgerConn;
this.#i18nLang = settings.i18nLang || this.#i18nLang;
this.#icon = settings.icon || this.#icon;
this.#locking = settings.locking || this.#locking;
this.#metadataUp = settings.metadataUp || this.#metadataUp;
this.#notification = settings.notification || this.#notification;
this.#prefix = isUndefined(settings.prefix) ? this.#prefix : settings.prefix;
this.#storage = settings.storage || this.#storage;
this.#uiMode = settings.uiMode || this.#uiMode;
this.#uiTheme = settings.uiTheme || this.#uiTheme;
const newValues = this.get();
store.set('settings', newValues);
this.#emitter.emit('change', newValues);
}
on(type, cb) {
this.#emitter.on(type, cb);
}
}
export const settings = new Settings();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc