Skip to content
Merged
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
20 changes: 14 additions & 6 deletions apps/namadillo/src/atoms/integrations/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const cosmosisForHousefire = {
// ---- Housefire Chain Registry Section End ----

// Whitelist of supported chains
const SUPPORTED_CHAINS_MAP = new Map<string, ChainRegistryEntry>(
const SUPPORTED_IBC_CHAINS_MAP = new Map<string, ChainRegistryEntry>(
Object.entries({
osmosis: osmosis,
"osmosis-housefire": cosmosisForHousefire,
Expand All @@ -105,6 +105,13 @@ const SUPPORTED_CHAINS_MAP = new Map<string, ChainRegistryEntry>(
})
);

const SUPPORTED_NAM_CHAINS_MAP = new Map<string, ChainRegistryEntry>(
Object.entries({
namada: namada,
"namada-housefire": housefire,
})
);

export const SUPPORTED_ASSETS_MAP = new Map<string, string[]>(
Object.entries({
osmosis: ["NAM", "OSMO"],
Expand Down Expand Up @@ -166,19 +173,20 @@ export const getChannelFromIbcInfo = (
export const getChainRegistryByChainId = (
chainId: string
): ChainRegistryEntry | undefined => {
return SUPPORTED_CHAINS_MAP.values().find(
(registry) => registry.chain.chain_id === chainId
);
return [
...SUPPORTED_IBC_CHAINS_MAP.values(),
...SUPPORTED_NAM_CHAINS_MAP.values(),
].find((registry) => registry.chain.chain_id === chainId);
};

export const getChainRegistryByChainName = (
chainName: string
): ChainRegistryEntry | undefined => {
return SUPPORTED_CHAINS_MAP.get(chainName);
return SUPPORTED_IBC_CHAINS_MAP.get(chainName);
};

export const getAvailableChains = (): Chain[] => {
return SUPPORTED_CHAINS_MAP.entries()
return SUPPORTED_IBC_CHAINS_MAP.entries()
.filter(([key]) => !key.includes("housefire"))
.map(([_, entry]) => entry.chain)
.toArray();
Expand Down
Loading