Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Local env fix on chains order #1040

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/connect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"dev:usdc-bridge": "vite --config ./vite.usdc-bridge.config.ts",
"dev:usdc-bridge:mainnet": "cross-env VITE_APP_CLUSTER=mainnet npm run dev:usdc-bridge",
"dev:usdc-bridge:testnet": "cross-env VITE_APP_CLUSTER=testnet npm run dev:usdc-bridge",
"build:usdc-bridge": "cross-env VITE_APP_CLUSTER=mainnet tsc && vite build --config ./vite.usdc-bridge.config.ts",
"build:usdc-bridge": "cross-env VITE_APP_CLUSTER=mainnet tsc && cross-env VITE_APP_CLUSTER=mainnet vite build --config ./vite.usdc-bridge.config.ts",
"dev:token-bridge": "vite --config ./vite.token-bridge.config.ts",
"dev:token-bridge:mainnet": "cross-env VITE_APP_CLUSTER=mainnet npm run dev:token-bridge",
"dev:token-bridge:testnet": "cross-env VITE_APP_CLUSTER=testnet npm run dev:token-bridge",
"build:token-bridge": "cross-env VITE_APP_CLUSTER=mainnet tsc && vite build --config ./vite.token-bridge.config.ts",
"build:token-bridge": "cross-env VITE_APP_CLUSTER=mainnet tsc && cross-env VITE_APP_CLUSTER=mainnet vite build --config ./vite.token-bridge.config.ts",
"dev": "npm run dev:token-bridge:testnet",
"start": "npm run dev",
"build": "tsc && vite build",
Expand Down
2 changes: 1 addition & 1 deletion apps/connect/src/hooks/useConnectConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const useConnectConfig = () => {
getSortedChains(
ENV.wormholeConnectConfig.networks as ChainName[],
controller.signal
).then((chains) => setNetworks(chains));
).then((chains) => !!chains && setNetworks(chains));
return () => controller.abort();
}, []);

Expand Down
6 changes: 3 additions & 3 deletions apps/connect/src/utils/getSortedChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface TopSymbolsByVolume {
export const getSortedChains = async (
chains: ChainName[],
signal?: AbortSignal
): Promise<ChainName[]> => {
): Promise<ChainName[] | undefined> => {
try {
const response: TopSymbolsByVolume = await fetch(
"https://api.wormholescan.io/api/v1/top-symbols-by-volume?timeSpan=30d",
Expand All @@ -36,7 +36,7 @@ export const getSortedChains = async (
volumePerChain[CHAINS[chainName]] || 0;

return [...chains].sort((a, b) => getChainScore(b) - getChainScore(a));
} catch {
return chains;
} catch (error) {
if ((error as Error).name !== "AbortError") return chains;
}
};
Loading