|
1 | 1 | import { Chain } from "@chain-registry/types"; |
2 | | -import namadaChain from "@namada/chain-registry/namada/chain.json"; |
3 | 2 | import { Modal, Stack } from "@namada/components"; |
4 | 3 | import { ModalTransition } from "App/Common/ModalTransition"; |
5 | 4 | import { Search } from "App/Common/Search"; |
6 | 5 | import { |
7 | 6 | connectedWalletsAtom, |
8 | 7 | getAvailableChains, |
9 | 8 | getChainRegistryByChainName, |
| 9 | + getNamadaChainRegistry, |
10 | 10 | namadaRegistryChainAssetsMapAtom, |
11 | 11 | } from "atoms/integrations"; |
12 | 12 | import { tokenPricesFamily } from "atoms/prices/atoms"; |
13 | 13 | import clsx from "clsx"; |
14 | 14 | import { useWalletManager } from "hooks/useWalletManager"; |
15 | 15 | import { KeplrWalletManager } from "integrations/Keplr"; |
16 | | -import { getChainFromAsset, getChainImageUrl } from "integrations/utils"; |
| 16 | +import { getChainFromAsset } from "integrations/utils"; |
17 | 17 | import { useAtom, useAtomValue } from "jotai"; |
18 | 18 | import { useMemo, useState } from "react"; |
19 | 19 | import { IoClose } from "react-icons/io5"; |
20 | 20 | import { AssetWithAmount } from "types"; |
21 | 21 | import { AddressDropdown } from "./AddressDropdown"; |
| 22 | +import { ChainBadge } from "./ChainBadge"; |
22 | 23 | import { isNamadaAddress } from "./common"; |
23 | 24 |
|
24 | 25 | type SelectTokenProps = { |
@@ -51,7 +52,8 @@ export const SelectToken = ({ |
51 | 52 | const chainAssets = useAtomValue(namadaRegistryChainAssetsMapAtom); |
52 | 53 | const chainAssetsMap = Object.values(chainAssets.data ?? {}); |
53 | 54 | const ibcChains = useMemo(getAvailableChains, []); |
54 | | - const allChains = [...ibcChains, namadaChain as unknown as Chain]; |
| 55 | + |
| 56 | + const allChains = [...ibcChains, getNamadaChainRegistry(false).chain]; |
55 | 57 |
|
56 | 58 | // Create KeplrWalletManager instance and use with useWalletManager hook |
57 | 59 | const keplrWallet = keplrWalletManager ?? new KeplrWalletManager(); |
@@ -174,17 +176,13 @@ export const SelectToken = ({ |
174 | 176 |
|
175 | 177 | const getOverlayChainLogo = (token: AssetWithAmount): JSX.Element | null => { |
176 | 178 | const chain = getChainFromAsset(token); |
177 | | - const chainImageUrl = getChainImageUrl(chain); |
178 | 179 | const isNamada = token.asset.symbol === "NAM"; |
179 | 180 | if (isNamada) return null; |
180 | 181 | return ( |
181 | | - <div className="absolute -bottom-0.5 -right-0.5 w-5 h-5 rounded-full bg-black border-2 border-neutral-600 flex items-center justify-center overflow-hidden z-10"> |
182 | | - <img |
183 | | - src={chainImageUrl} |
184 | | - alt={chain?.chain_name || "chain"} |
185 | | - className="w-4 h-4 object-cover rounded-full" |
186 | | - /> |
187 | | - </div> |
| 182 | + <ChainBadge |
| 183 | + chain={chain} |
| 184 | + className="absolute -bottom-0.5 -right-0.5 w-5 h-5 border border-neutral-600" |
| 185 | + /> |
188 | 186 | ); |
189 | 187 | }; |
190 | 188 |
|
@@ -237,19 +235,7 @@ export const SelectToken = ({ |
237 | 235 | : "hover:bg-neutral-800" |
238 | 236 | }`} |
239 | 237 | > |
240 | | - <div className="w-7 h-7 rounded-sm flex items-center justify-center overflow-hidden"> |
241 | | - {network.logo_URIs?.svg ? |
242 | | - <img |
243 | | - src={network.logo_URIs?.svg} |
244 | | - alt={network.chain_name} |
245 | | - className="w-full h-full object-contain !rounded-none" |
246 | | - draggable={false} |
247 | | - /> |
248 | | - : <span className="text-white"> |
249 | | - {network.chain_name?.charAt(0)} |
250 | | - </span> |
251 | | - } |
252 | | - </div> |
| 238 | + <ChainBadge chain={network} /> |
253 | 239 | <span |
254 | 240 | className={clsx("capitalize font-normal text-white")} |
255 | 241 | > |
|
0 commit comments