Skip to content

Commit

Permalink
feat(explorer): rhodolite support (#3256)
Browse files Browse the repository at this point in the history
Co-authored-by: alvrs <[email protected]>
  • Loading branch information
karooolis and alvrs authored Oct 13, 2024
1 parent c85a0c5 commit a088d16
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function fetchWorlds(chainName: string): Promise<Address[]> {
const baseUrl = `${protocol}://${host}`;
worldsApiUrl = `${baseUrl}/api/sqlite-indexer/worlds`;
} else {
const blockExplorerUrl = chain.blockExplorers?.default.url;
const blockExplorerUrl = "blockExplorers" in chain && chain.blockExplorers?.default.url;
if (blockExplorerUrl) {
worldsApiUrl = `${blockExplorerUrl}/api/v2/mud/worlds`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function blockExplorerTransactionUrl({

const chainName = chainIdToName[chainId];
const chain = supportedChains[chainName];
const explorerUrl = chain.blockExplorers?.default.url;
const explorerUrl = "blockExplorers" in chain && chain.blockExplorers?.default.url;
if (!explorerUrl) return undefined;
return `${explorerUrl}/tx/${hash}`;
}
17 changes: 17 additions & 0 deletions packages/explorer/src/chains/rhodolite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { MUDChain } from "@latticexyz/common/chains";

export const rhodolite = {
id: 17420,
name: "Rhodolite",
nativeCurrency: {
decimals: 18,
name: "Ether",
symbol: "ETH",
},
rpcUrls: {
default: {
http: ["https://rpc.rhodolitechain.com"],
},
},
indexerUrl: "https://indexer.mud.rhodolitechain.com",
} satisfies MUDChain;
3 changes: 2 additions & 1 deletion packages/explorer/src/common.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { anvil } from "viem/chains";
import { garnet, redstone } from "@latticexyz/common/chains";
import { rhodolite } from "./chains/rhodolite";

export const internalNamespaces = ["world", "store", "metadata", "puppet", "erc20-puppet", "erc721-puppet"];

export const supportedChains = { anvil, garnet, redstone } as const;
export const supportedChains = { anvil, garnet, redstone, rhodolite } as const;
export type supportedChains = typeof supportedChains;

export type supportedChainName = keyof supportedChains;
Expand Down

0 comments on commit a088d16

Please sign in to comment.