Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(explorer): various fixes #3298

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { store as worldStore } from "../store";

export function TransactionsWatcher() {
const { id: chainId } = useChain();
const { worldAddress } = useParams();
const { worldAddress } = useParams<{ worldAddress: string }>();
const wagmiConfig = useConfig();
const { data: worldAbiData } = useWorldAbiQuery();
const abi = worldAbiData?.abi;
Expand Down Expand Up @@ -98,7 +98,7 @@ export function TransactionsWatcher() {
useEffect(() => {
for (const write of Object.values(observerWrites)) {
const hash = write.hash;
if (hash && write.address === worldAddress) {
if (hash && write.address.toLowerCase() === worldAddress.toLowerCase()) {
const transaction = transactions.find((transaction) => transaction.hash === hash);
if (!transaction) {
handleTransaction(hash, BigInt(write.time) / 1000n);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export type ObservedTransaction = {
};

export function useObservedTransactions() {
const { worldAddress } = useParams();
const { worldAddress } = useParams<{ worldAddress: string }>();
const transactions = useStore(worldStore, (state) => state.transactions);
const observerWrites = useStore(observerStore, (state) => state.writes);

const mergedTransactions = useMemo((): ObservedTransaction[] => {
const mergedMap = new Map<string | undefined, ObservedTransaction>();

for (const write of Object.values(observerWrites)) {
if (write.address !== worldAddress) continue;
if (write.address.toLowerCase() !== worldAddress.toLowerCase()) continue;

const parsedAbiItem = parseAbiItem(`function ${write.functionSignature}`) as AbiFunction;
const writeResult = write.events.find((event): event is Message<"write:result"> => event.type === "write:result");
Expand Down
17 changes: 0 additions & 17 deletions packages/explorer/src/chains/rhodolite.ts

This file was deleted.

5 changes: 2 additions & 3 deletions packages/explorer/src/common.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { anvil } from "viem/chains";
import { garnet, redstone } from "@latticexyz/common/chains";
import { rhodolite } from "./chains/rhodolite";
import { garnet, redstone, rhodolite } from "@latticexyz/common/chains";

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

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

export type supportedChainName = keyof supportedChains;
Expand Down
3 changes: 2 additions & 1 deletion packages/explorer/src/observer/relay.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"use client";

import debug from "debug";
import { isBridgeEnvelope } from "./bridge";
import { relayChannelName } from "./common";
import { debug } from "./debug";

export function createRelay(): () => void {
debug("creating relay");
const channel = new BroadcastChannel(relayChannelName);
function relay(event: MessageEvent) {
if (isBridgeEnvelope(event.data)) {
Expand Down
Loading