refactor: moves getAllChainNamespaces
into util helpers
This commit is contained in:
parent
0d3d25d521
commit
004717fce1
@ -40,6 +40,7 @@ import {
|
|||||||
ChainNamespaces,
|
ChainNamespaces,
|
||||||
setInitialStateTestnet,
|
setInitialStateTestnet,
|
||||||
getInitialStateTestnet,
|
getInitialStateTestnet,
|
||||||
|
getAllChainNamespaces,
|
||||||
} from "./helpers";
|
} from "./helpers";
|
||||||
import { fonts } from "./styles";
|
import { fonts } from "./styles";
|
||||||
import Toggle from "./components/Toggle";
|
import Toggle from "./components/Toggle";
|
||||||
@ -354,19 +355,8 @@ export default function App() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAllNamespaces = () => {
|
|
||||||
const namespaces: string[] = [];
|
|
||||||
DEFAULT_CHAINS.forEach(chainId => {
|
|
||||||
const [namespace] = chainId.split(":");
|
|
||||||
if (!namespaces.includes(namespace)) {
|
|
||||||
namespaces.push(namespace);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return namespaces;
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadChainData = async () => {
|
const loadChainData = async () => {
|
||||||
const namespaces = getAllNamespaces();
|
const namespaces = getAllChainNamespaces();
|
||||||
const chainData: ChainNamespaces = {};
|
const chainData: ChainNamespaces = {};
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
namespaces.map(async namespace => {
|
namespaces.map(async namespace => {
|
||||||
@ -840,7 +830,6 @@ export default function App() {
|
|||||||
address={address}
|
address={address}
|
||||||
chainId={chainId}
|
chainId={chainId}
|
||||||
balances={balances}
|
balances={balances}
|
||||||
// TODO:
|
|
||||||
actions={getBlockchainActions(chainId)}
|
actions={getBlockchainActions(chainId)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -4,6 +4,7 @@ import { TypedDataUtils } from "eth-sig-util";
|
|||||||
import * as ethUtil from "ethereumjs-util";
|
import * as ethUtil from "ethereumjs-util";
|
||||||
|
|
||||||
import { eip1271 } from "./eip1271";
|
import { eip1271 } from "./eip1271";
|
||||||
|
import { DEFAULT_CHAINS } from "../constants";
|
||||||
|
|
||||||
export function capitalize(string: string): string {
|
export function capitalize(string: string): string {
|
||||||
return string
|
return string
|
||||||
@ -198,3 +199,14 @@ export function getInitialStateTestnet(): boolean {
|
|||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getAllChainNamespaces = () => {
|
||||||
|
const namespaces: string[] = [];
|
||||||
|
DEFAULT_CHAINS.forEach(chainId => {
|
||||||
|
const [namespace] = chainId.split(":");
|
||||||
|
if (!namespaces.includes(namespace)) {
|
||||||
|
namespaces.push(namespace);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return namespaces;
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user