Skip to content

Commit

Permalink
Registry update for Namada mainnet (#1369)
Browse files Browse the repository at this point in the history
* feat: update for mainnet

* fix: reverting override on package.json, pulling from main now

* fix: map registry features properly

* fix: remove commit hash from package.json

* fix: use mainnet assets in utils
  • Loading branch information
jurevans authored Dec 3, 2024
1 parent 551b75e commit 9f21f31
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
28 changes: 13 additions & 15 deletions apps/namadillo/src/atoms/integrations/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,28 @@ import {
import { toBaseAmount, toDisplayAmount } from "utils";
import { getSdkInstance } from "utils/sdk";

import dryrunAssets from "namada-chain-registry/namadadryrun/assetlist.json";
import dryrunChain from "namada-chain-registry/namadadryrun/chain.json";
import housefireAssets from "namada-chain-registry/namadahousefire/assetlist.json";
import housefireChain from "namada-chain-registry/namadahousefire/chain.json";
import internalDevnetAssets from "namada-chain-registry/namadainternaldevnet/assetlist.json";
import internalDevnetChain from "namada-chain-registry/namadainternaldevnet/chain.json";

import dryrunOsmosis from "namada-chain-registry/_IBC/namadadryrun-osmosis.json";
import housefireCosmosTestnetIbc from "namada-chain-registry/_IBC/namadahousefire-cosmoshubtestnet.json";
import housefireOsmosisTestnetIbc from "namada-chain-registry/_IBC/namadahousefire-osmosistestnet.json";
import internalDevnetCosmosTestnetIbc from "namada-chain-registry/_IBC/namadainternaldevnet-cosmoshubtestnet.json";
import housefireAssets from "namada-chain-registry/_testnets/namadahousefire/assetlist.json";
import housefireChain from "namada-chain-registry/_testnets/namadahousefire/chain.json";
import internalDevnetAssets from "namada-chain-registry/_testnets/namadainternaldevnet/assetlist.json";
import internalDevnetChain from "namada-chain-registry/_testnets/namadainternaldevnet/chain.json";
import namadaAssets from "namada-chain-registry/namada/assetlist.json";
import namadaChain from "namada-chain-registry/namada/chain.json";

import housefireCosmosTestnetIbc from "namada-chain-registry/_testnets/_IBC/namadahousefire-cosmoshubtestnet.json";
import housefireOsmosisTestnetIbc from "namada-chain-registry/_testnets/_IBC/namadahousefire-osmosistestnet.json";
import internalDevnetCosmosTestnetIbc from "namada-chain-registry/_testnets/_IBC/namadainternaldevnet-cosmoshubtestnet.json";

// TODO: this causes a big increase on bundle size. See #1224.
import cosmosRegistry from "chain-registry";

cosmosRegistry.chains.push(internalDevnetChain, housefireChain, dryrunChain);
cosmosRegistry.chains.push(internalDevnetChain, housefireChain, namadaChain);

cosmosRegistry.assets.push(internalDevnetAssets, housefireAssets, dryrunAssets);
cosmosRegistry.assets.push(internalDevnetAssets, housefireAssets, namadaAssets);

cosmosRegistry.ibc.push(
internalDevnetCosmosTestnetIbc,
housefireCosmosTestnetIbc,
housefireOsmosisTestnetIbc,
dryrunOsmosis
housefireOsmosisTestnetIbc
);

const mainnetChains: ChainRegistryEntry[] = [
Expand Down
6 changes: 3 additions & 3 deletions apps/namadillo/src/hooks/useRegistryFeatures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const namadaChainRegistryUrl =
: "https://raw.githubusercontent.com/anoma/namada-chain-registry/refs/heads/main";

const namadaChainRegistryMap = new Map<string, string>([
["namada-dryrun.abaaeaf7b78cb3ac", "namadadryrun"],
["housefire-equal.130b1076e3250f", "namadahousefire"],
["internal-devnet-44a.1bd3e6ca62", "namadainternaldevnet"],
["namada.5f5de2dd1b88cba30586420", "namada"],
["housefire-creek.76ed2d08793c14", "_testnets/namadahousefire"],
["internal-devnet-45a.1881abcfec", "_testnets/namadainternaldevnet"],
]);

type Feature =
Expand Down
5 changes: 2 additions & 3 deletions apps/namadillo/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import BigNumber from "bignumber.js";
import * as fns from "date-fns";
import { getDefaultStore } from "jotai";
import { DateTime } from "luxon";
import internalDevnetAssets from "namada-chain-registry/namadainternaldevnet/assetlist.json";
import namadaAssets from "namada-chain-registry/namada/assetlist.json";
import { useEffect } from "react";

export const proposalStatusToString = (status: ProposalStatus): string => {
Expand Down Expand Up @@ -123,14 +123,13 @@ const findDisplayUnit = (asset: Asset): AssetDenomUnit | undefined => {
return denom_units.find((unit) => unit.denom === display);
};

// TODO update to mainnet asset
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const namadaAsset = () => {
const store = getDefaultStore();
const config = store.get(localnetConfigAtom);

const configTokenAddress = config.data?.tokenAddress;
const registryAsset = internalDevnetAssets.assets[0];
const registryAsset = namadaAssets.assets[0];
const asset =
configTokenAddress ?
{
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15839,8 +15839,8 @@ __metadata:

"namada-chain-registry@https://github.com/anoma/namada-chain-registry":
version: 0.0.1
resolution: "namada-chain-registry@https://github.com/anoma/namada-chain-registry.git#commit=aa3e4a524d4a8eed71c124272711de63bcded849"
checksum: 28855dec819a03d1d7411ccf0e878c4ce246abefa18caf768e4e1205f1f31aa89bc0daf2949e167055cea31afa09cf7b6f2f8a5340356d16339afcccbf81d8c5
resolution: "namada-chain-registry@https://github.com/anoma/namada-chain-registry.git#commit=bbcc8535461ae2e939629740628ae455feca8225"
checksum: a4b2ab0789cb20dbb2299572fa3749e2c737eedd26823c1bfb9e4484dda701a1cb0a255d1f8944bd4bff1b6315f9cb494ec63482c3dcdd1c05d85deb59f9afeb
languageName: node
linkType: hard

Expand Down

1 comment on commit 9f21f31

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.