From a0d41ec76b934f3c4a3d26fc6408ebb7ac9f7b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harrison=20Mendon=C3=A7a?= Date: Fri, 20 Jun 2025 19:16:05 -0300 Subject: [PATCH] fix: show nam from mainnet instead of housefire --- .../namadillo/src/atoms/integrations/atoms.ts | 20 +++- .../src/atoms/integrations/functions.ts | 10 -- .../src/atoms/integrations/temp-assets.ts | 93 ------------------- 3 files changed, 19 insertions(+), 104 deletions(-) delete mode 100644 apps/namadillo/src/atoms/integrations/temp-assets.ts diff --git a/apps/namadillo/src/atoms/integrations/atoms.ts b/apps/namadillo/src/atoms/integrations/atoms.ts index 3576c12272..d738f5ac5d 100644 --- a/apps/namadillo/src/atoms/integrations/atoms.ts +++ b/apps/namadillo/src/atoms/integrations/atoms.ts @@ -35,6 +35,12 @@ import { queryAssetBalances, } from "./services"; +export const mainnetNamDenomOnOsmosis = + "ibc/C7110DEC66869DAE9BE9C3C60F4B5313B16A2204AE020C3B0527DD6B322386A3"; + +export const housefireNamDenomOnOsmosis = + "ibc/48473B990DD70EC30F270727C4FEBA5D49C7D74949498CDE99113B13F9EA5522"; + type IBCTransferAtomParams = { client: SigningStargateClient; tx: TxRaw; @@ -84,8 +90,20 @@ export const assetBalanceAtomFamily = atomFamily( ...queryDependentFn(async () => { return await queryAndStoreRpc(chain!, async (rpc: string) => { const assetsBalances = await queryAssetBalances(walletAddress!, rpc); + + // Housefire NAM is still appearing because the function `ibcAddressToDenomTrace` + // calls stargate to get the denom based on the `ibc/...` address, and this is + // returning the NAM, so we can't filter it without a major assets refactoring. + // For now, let's filter it individually while we don't have a good solution + // Some solutions: + // - Check only the registry and ignore dynamic values from stargate + // - Create an allow/blocklist to filter it with more control + const allowedBalances = assetsBalances.filter( + (i) => i.denom !== housefireNamDenomOnOsmosis + ); + return await mapCoinsToAssets( - assetsBalances, + allowedBalances, chain!.chain_id, ibcAddressToDenomTrace(rpc) ); diff --git a/apps/namadillo/src/atoms/integrations/functions.ts b/apps/namadillo/src/atoms/integrations/functions.ts index 79e7296f83..33be9efac5 100644 --- a/apps/namadillo/src/atoms/integrations/functions.ts +++ b/apps/namadillo/src/atoms/integrations/functions.ts @@ -42,7 +42,6 @@ import internalDevnetCosmosTestnetIbc from "@namada/chain-registry/_testnets/_IB // TODO: this causes a big increase on bundle size. See #1224. import registry from "chain-registry"; import { searchNamadaTestnetByChainId } from "lib/chain"; -import { mainnetNamAssetOnOsmosis } from "./temp-assets"; export const namadaTestnetChainList = [ internalDevnetChain, @@ -78,15 +77,6 @@ const testnetChains: ChainRegistryEntry[] = [ const mainnetAndTestnetChains = [...mainnetChains, ...testnetChains]; -// Terrible hack to inject nam asset in osmosis so we can show them as a token for ibc. -// We should update the chain-registry and later remove this hack! -// Please note that this is only a fix for mainnet nam, not housefire -registry.assets - .find((chain) => chain.chain_name === "osmosis") - ?.assets.push(mainnetNamAssetOnOsmosis); -osmosis.assets.assets.push(mainnetNamAssetOnOsmosis); -// End of the hack - export const getKnownChains = ( includeTestnets?: boolean ): ChainRegistryEntry[] => { diff --git a/apps/namadillo/src/atoms/integrations/temp-assets.ts b/apps/namadillo/src/atoms/integrations/temp-assets.ts deleted file mode 100644 index 76dacf152e..0000000000 --- a/apps/namadillo/src/atoms/integrations/temp-assets.ts +++ /dev/null @@ -1,93 +0,0 @@ -export const mainnetNamAssetOnOsmosis = { - description: "The native token of Namada.", - denom_units: [ - { - denom: - "ibc/C7110DEC66869DAE9BE9C3C60F4B5313B16A2204AE020C3B0527DD6B322386A3", - exponent: 0, - aliases: ["unam"], - }, - { - denom: "nam", - exponent: 6, - }, - ], - type_asset: "ics20", - base: "ibc/C7110DEC66869DAE9BE9C3C60F4B5313B16A2204AE020C3B0527DD6B322386A3", - name: "Namada", - display: "nam", - symbol: "NAM", - traces: [ - { - type: "ibc", - counterparty: { - chain_name: "namada", - base_denom: "unam", - channel_id: "channel-1", - }, - chain: { - channel_id: "channel-98451", - path: "transfer/channel-98451/unam", - }, - }, - ], - logo_URIs: { - svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/namada/images/namada.svg", - }, - images: [ - { - image_sync: { - chain_name: "namada", - base_denom: "unam", - }, - svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/namada/images/namada.svg", - }, - ], -}; - -export const housefireNamAssetOnOsmosis = { - description: "The native token of Namada.", - denom_units: [ - { - denom: - "ibc/48473B990DD70EC30F270727C4FEBA5D49C7D74949498CDE99113B13F9EA5522", - exponent: 0, - aliases: ["unam"], - }, - { - denom: "nam", - exponent: 6, - }, - ], - type_asset: "ics20", - base: "ibc/48473B990DD70EC30F270727C4FEBA5D49C7D74949498CDE99113B13F9EA5522", - name: "Namada", - display: "nam", - symbol: "NAM", - traces: [ - { - type: "ibc", - counterparty: { - chain_name: "namada", - base_denom: "unam", - channel_id: "channel-1", - }, - chain: { - channel_id: "channel-98451", - path: "transfer/channel-98451/unam", - }, - }, - ], - logo_URIs: { - svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/namada/images/namada.svg", - }, - images: [ - { - image_sync: { - chain_name: "namada", - base_denom: "unam", - }, - svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/namada/images/namada.svg", - }, - ], -};