mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-15 15:21:03 +00:00
Bump util (#439)
This commit is contained in:
@@ -1,19 +1,12 @@
|
||||
// Copyright 2017-2021 @polkadot/ui-settings authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Network } from '@polkadot/networks/types';
|
||||
|
||||
import known from '@polkadot/networks';
|
||||
|
||||
type ChainDef = string[];
|
||||
|
||||
// NOTE This should be fixed by networks 5.7 (also in ss58)
|
||||
interface NetworkNamed extends Network {
|
||||
network: string;
|
||||
}
|
||||
|
||||
const chains: Record <string, ChainDef> = known
|
||||
.filter((n): n is NetworkNamed => n.genesisHash.length > 0 && !!n.network)
|
||||
.filter((n) => n.genesisHash.length)
|
||||
.reduce((chains, { genesisHash, network }) => ({ ...chains, [network]: genesisHash }), {});
|
||||
|
||||
export { chains };
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/ui-settings authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Network } from '@polkadot/networks/types';
|
||||
import type { Option } from '../types';
|
||||
|
||||
import { available } from '@polkadot/networks';
|
||||
|
||||
// NOTE This should be fixed by networks 5.7 (also in chains)
|
||||
interface NetworkNamed extends Network {
|
||||
network: string;
|
||||
}
|
||||
|
||||
export const PREFIX_DEFAULT = -1;
|
||||
|
||||
const defaultNetwork: Option = {
|
||||
@@ -19,8 +13,10 @@ const defaultNetwork: Option = {
|
||||
value: -1
|
||||
};
|
||||
|
||||
const networks = available
|
||||
.filter((n): n is NetworkNamed => !!n.network)
|
||||
.map(({ displayName, network, prefix }) => ({ info: network, text: displayName, value: prefix }));
|
||||
const networks = available.map(({ displayName, network, prefix }) => ({
|
||||
info: network,
|
||||
text: displayName,
|
||||
value: prefix
|
||||
}));
|
||||
|
||||
export const PREFIXES: Option[] = [defaultNetwork, ...networks];
|
||||
|
||||
Reference in New Issue
Block a user