refactor: moves getAllChainNamespaces
into util helpers
This commit is contained in:
parent
0d3d25d521
commit
004717fce1
@ -40,6 +40,7 @@ import {
|
||||
ChainNamespaces,
|
||||
setInitialStateTestnet,
|
||||
getInitialStateTestnet,
|
||||
getAllChainNamespaces,
|
||||
} from "./helpers";
|
||||
import { fonts } from "./styles";
|
||||
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 namespaces = getAllNamespaces();
|
||||
const namespaces = getAllChainNamespaces();
|
||||
const chainData: ChainNamespaces = {};
|
||||
await Promise.all(
|
||||
namespaces.map(async namespace => {
|
||||
@ -840,7 +830,6 @@ export default function App() {
|
||||
address={address}
|
||||
chainId={chainId}
|
||||
balances={balances}
|
||||
// TODO:
|
||||
actions={getBlockchainActions(chainId)}
|
||||
/>
|
||||
);
|
||||
|
@ -4,6 +4,7 @@ import { TypedDataUtils } from "eth-sig-util";
|
||||
import * as ethUtil from "ethereumjs-util";
|
||||
|
||||
import { eip1271 } from "./eip1271";
|
||||
import { DEFAULT_CHAINS } from "../constants";
|
||||
|
||||
export function capitalize(string: string): string {
|
||||
return string
|
||||
@ -198,3 +199,14 @@ export function getInitialStateTestnet(): boolean {
|
||||
}
|
||||
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