Skip to content

Commit 3e2fc90

Browse files
authored
fix: show nam from mainnet instead of housefire (#2187)
1 parent 829ecc7 commit 3e2fc90

File tree

3 files changed

+19
-104
lines changed

3 files changed

+19
-104
lines changed

apps/namadillo/src/atoms/integrations/atoms.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ import {
3535
queryAssetBalances,
3636
} from "./services";
3737

38+
export const mainnetNamDenomOnOsmosis =
39+
"ibc/C7110DEC66869DAE9BE9C3C60F4B5313B16A2204AE020C3B0527DD6B322386A3";
40+
41+
export const housefireNamDenomOnOsmosis =
42+
"ibc/48473B990DD70EC30F270727C4FEBA5D49C7D74949498CDE99113B13F9EA5522";
43+
3844
type IBCTransferAtomParams = {
3945
client: SigningStargateClient;
4046
tx: TxRaw;
@@ -84,8 +90,20 @@ export const assetBalanceAtomFamily = atomFamily(
8490
...queryDependentFn(async () => {
8591
return await queryAndStoreRpc(chain!, async (rpc: string) => {
8692
const assetsBalances = await queryAssetBalances(walletAddress!, rpc);
93+
94+
// Housefire NAM is still appearing because the function `ibcAddressToDenomTrace`
95+
// calls stargate to get the denom based on the `ibc/...` address, and this is
96+
// returning the NAM, so we can't filter it without a major assets refactoring.
97+
// For now, let's filter it individually while we don't have a good solution
98+
// Some solutions:
99+
// - Check only the registry and ignore dynamic values from stargate
100+
// - Create an allow/blocklist to filter it with more control
101+
const allowedBalances = assetsBalances.filter(
102+
(i) => i.denom !== housefireNamDenomOnOsmosis
103+
);
104+
87105
return await mapCoinsToAssets(
88-
assetsBalances,
106+
allowedBalances,
89107
chain!.chain_id,
90108
ibcAddressToDenomTrace(rpc)
91109
);

apps/namadillo/src/atoms/integrations/functions.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import internalDevnetCosmosTestnetIbc from "@namada/chain-registry/_testnets/_IB
4242
// TODO: this causes a big increase on bundle size. See #1224.
4343
import registry from "chain-registry";
4444
import { searchNamadaTestnetByChainId } from "lib/chain";
45-
import { mainnetNamAssetOnOsmosis } from "./temp-assets";
4645

4746
export const namadaTestnetChainList = [
4847
internalDevnetChain,
@@ -78,15 +77,6 @@ const testnetChains: ChainRegistryEntry[] = [
7877

7978
const mainnetAndTestnetChains = [...mainnetChains, ...testnetChains];
8079

81-
// Terrible hack to inject nam asset in osmosis so we can show them as a token for ibc.
82-
// We should update the chain-registry and later remove this hack!
83-
// Please note that this is only a fix for mainnet nam, not housefire
84-
registry.assets
85-
.find((chain) => chain.chain_name === "osmosis")
86-
?.assets.push(mainnetNamAssetOnOsmosis);
87-
osmosis.assets.assets.push(mainnetNamAssetOnOsmosis);
88-
// End of the hack
89-
9080
export const getKnownChains = (
9181
includeTestnets?: boolean
9282
): ChainRegistryEntry[] => {

apps/namadillo/src/atoms/integrations/temp-assets.ts

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

0 commit comments

Comments
 (0)