Skip to content

Commit

Permalink
chore: support vm chain in connected interchain token page
Browse files Browse the repository at this point in the history
  • Loading branch information
npty committed Jan 13, 2025
1 parent c3483b6 commit 68b2eda
Showing 1 changed file with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import { logger } from "~/lib/logger";
import { trpc } from "~/lib/trpc";
import { getNativeToken } from "~/lib/utils/getNativeToken";
import { useEstimateGasFeeMultipleChainsQuery } from "~/services/axelarjsSDK/hooks";
import { useEVMChainConfigsQuery } from "~/services/axelarscan/hooks";
import {
useEVMChainConfigsQuery,
useVMChainConfigsQuery,
} from "~/services/axelarscan/hooks";
import {
useGetTransactionsStatusesOnDestinationChainsQuery,
useInterchainTokensQuery,
Expand Down Expand Up @@ -158,7 +161,23 @@ const ConnectedInterchainTokensPage: FC<ConnectedInterchainTokensPageProps> = (
txHashes: sessionState.deployTokensTxHashes,
});

const { computed } = useEVMChainConfigsQuery();
const { computed: evmComputed } = useEVMChainConfigsQuery();
const { computed: vmComputed } = useVMChainConfigsQuery();

const combinedComputed = useMemo(
() => ({
indexedById: {
...evmComputed.indexedById,
...vmComputed.indexedById,
},
indexedByChainId: {
...evmComputed.indexedByChainId,
...vmComputed.indexedByChainId,
},
}),
[evmComputed, vmComputed]
);

const { switchChainAsync } = useSwitchChain();

const statusesByChain = useMemo(() => {
Expand Down Expand Up @@ -287,16 +306,16 @@ const ConnectedInterchainTokensPage: FC<ConnectedInterchainTokensPageProps> = (
[interchainToken]
);

const runninChainIds = useMemo(
const runningChainIds = useMemo(
() =>
Object.entries(statusesByChain).map(
([axelarChainId]) => computed.indexedById[axelarChainId]?.chain_id
([axelarChainId]) => combinedComputed.indexedById[axelarChainId]?.chain_id
),
[computed.indexedById, statusesByChain]
[combinedComputed.indexedById, statusesByChain]
);

const nonRunningSelectedChainIds = sessionState.selectedChainIds.filter(
(x) => !runninChainIds.includes(x)
(x) => !runningChainIds.includes(x)
);

const isRestrictedToDeployer =
Expand Down

0 comments on commit 68b2eda

Please sign in to comment.