Skip to content

Commit

Permalink
chore: aing mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
CalicoNino committed Nov 10, 2023
1 parent d3ad95d commit 7aec5d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 41 deletions.
52 changes: 12 additions & 40 deletions src/nibiru/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,17 @@ import type { LocalConfig } from '@/stores';
const PLAYGROUND_NETWORKS = 'https://networks.play.nibiru.fi/ping-pub';
const DEV_NETWORKS = 'https://networks.testnet.nibiru.fi/ping-pub';
const ITN_NETWORKS = 'https://networks.itn.nibiru.fi/ping-pub';
const MAIN_NETWORK = 'https://networks.nibiru.fi/ping-pub';

export const getItn = async (): Promise<LocalConfig[] | undefined> => {
export const getNetwork = async (
url: string
): Promise<LocalConfig[] | undefined> => {
try {
const testnets = await fetch(ITN_NETWORKS).then((response) =>
response.json()
);
testnets.forEach((_: any, i: string | number) => {
testnets[i].visible = true;
const net = await fetch(url).then((response) => response.json());
net.forEach((_: any, i: string | number) => {
net[i].visible = true;
});
return testnets;
} catch (error) {
console.log(error);
return;
}
};

export const getDevnets = async (): Promise<LocalConfig[] | undefined> => {
try {
const devnets = await fetch(DEV_NETWORKS).then((response) =>
response.json()
);
devnets.forEach((_: any, i: string | number) => {
devnets[i].visible = false;
});
return devnets;
} catch (error) {
console.log(error);
return;
}
};

export const getPlaynets = async (): Promise<LocalConfig[] | undefined> => {
try {
const playnets = await fetch(PLAYGROUND_NETWORKS).then((response) =>
response.json()
);
playnets.forEach((_: any, i: string | number) => {
playnets[i].visible = false;
});
return playnets;
return net;
} catch (error) {
console.log(error);
return;
Expand All @@ -52,12 +23,13 @@ export const getPlaynets = async (): Promise<LocalConfig[] | undefined> => {
export const getNibiruChains = async (): Promise<{
[key: string]: LocalConfig;
}> => {
const [playnets, devnets, itn] = await Promise.all([
const [playnets, devnets, itn, main] = await Promise.all([
undefined, //getPlaynets(),
undefined, //getDevnets(),
getItn(),
getNetwork(ITN_NETWORKS),
getNetwork(MAIN_NETWORK),
]);
const chains = (itn ?? []).concat(playnets ?? [], devnets ?? []);
const chains = (main ?? []).concat(itn ?? [], playnets ?? [], devnets ?? []);
const chainsObj: { [key: string]: LocalConfig } = {};
chains.forEach((chain) => {
chainsObj[chain.chain_name] = chain;
Expand Down
2 changes: 1 addition & 1 deletion src/stores/useDashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export const useDashboard = defineStore('dashboard', {
state: () => {
const favMap = JSON.parse(
localStorage.getItem('favoriteMap') ??
'{"cosmos":true, "osmosis":true, "nibiru":true, "nibiru-itn-3":true}'
'{"cosmos":true,"osmosis":true,"nibiru":true,"nibiru-itn-3":true,"cataclysm-1":true,"nibiru-testnet-1":true}'
);
return {
status: LoadingStatus.Empty,
Expand Down

0 comments on commit 7aec5d7

Please sign in to comment.