Skip to content

Commit 351376e

Browse files
authored
fix: use circle version of neutron chain (#2021)
1 parent bf4d5e1 commit 351376e

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

apps/namadillo/src/App/Transfer/ChainCard.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { Chain } from "@chain-registry/types";
22
import clsx from "clsx";
3-
import genericAsset from "./assets/generic-asset.svg";
3+
import { getChainImageUrl } from "integrations/utils";
44

55
type ChainCardProps = {
66
chain: Chain;
77
};
88

99
export const ChainCard = ({ chain }: ChainCardProps): JSX.Element => {
10-
const image =
11-
chain.logo_URIs?.svg || chain.logo_URIs?.png || genericAsset || "";
10+
const image = getChainImageUrl(chain);
1211
return (
1312
<span
1413
className={clsx(

apps/namadillo/src/App/Transfer/SelectedChain.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { Chain } from "@chain-registry/types";
22
import clsx from "clsx";
3+
import { getChainImageUrl } from "integrations/utils";
34
import { GoChevronDown } from "react-icons/go";
45
import { WalletProvider } from "types";
5-
import genericAsset from "./assets/generic-asset.svg";
6-
76
import { EmptyResourceIcon } from "./EmptyResourceIcon";
87

98
type SelectedChainProps = {
@@ -25,8 +24,7 @@ export const SelectedChain = ({
2524
);
2625

2726
const isDisabled = !wallet;
28-
const logoUrl =
29-
chain ? chain.logo_URIs?.svg || chain.logo_URIs?.png || genericAsset : "";
27+
const logoUrl = getChainImageUrl(chain);
3028

3129
return (
3230
<button

apps/namadillo/src/App/Transfer/assets/generic-asset.svg

Lines changed: 0 additions & 15 deletions
This file was deleted.

apps/namadillo/src/integrations/utils.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,26 @@ export const findAssetByDenom = (denom: string): Asset | undefined => {
4343
return undefined;
4444
};
4545

46+
const getSvgOrPng = (image?: {
47+
svg?: string;
48+
png?: string;
49+
}): string | undefined => {
50+
return image?.svg || image?.png;
51+
};
52+
53+
export const getChainImageUrl = (chain?: Chain): string => {
54+
if (!chain) return tokenImage;
55+
return (
56+
getSvgOrPng(chain.images?.find((i) => i.theme?.circle)) ||
57+
getSvgOrPng(chain.images?.[0]) ||
58+
getSvgOrPng(chain.logo_URIs) ||
59+
tokenImage
60+
);
61+
};
62+
4663
export const getAssetImageUrl = (asset?: Asset): string => {
4764
if (!asset) return tokenImage;
48-
return asset.logo_URIs?.svg || asset.logo_URIs?.png || tokenImage;
65+
return getSvgOrPng(asset.logo_URIs) || tokenImage;
4966
};
5067

5168
export const getIbcGasConfig = (

0 commit comments

Comments
 (0)