Skip to content

Commit 07d3c5b

Browse files
authored
Fix: xrpl remote deployment (2) (#711)
1 parent f323dc9 commit 07d3c5b

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

apps/maestro/src/features/CanonicalTokenDeployment/steps/deploy-and-register/DeployAndRegister.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { RegisterCanonicalTokenResult } from "~/features/suiHooks/useRegisterCan
2525
import { useTransactionsContainer } from "~/features/Transactions";
2626
import { useBalance, useChainId } from "~/lib/hooks";
2727
import { handleTransactionResult } from "~/lib/transactions/handlers";
28-
import { filterEligibleChains } from "~/lib/utils/chains";
28+
import { filterEligibleChainsForRemoteDeployment } from "~/lib/utils/chains";
2929
import { getNativeToken } from "~/lib/utils/getNativeToken";
3030
import ChainPicker from "~/ui/compounds/ChainPicker";
3131
import { NextButton, TokenNameAlert } from "~/ui/compounds/MultiStepForm";
@@ -258,7 +258,7 @@ export const Step3: FC = () => {
258258
]
259259
);
260260

261-
const eligibleChains = filterEligibleChains(state.chains, chainId);
261+
const eligibleChains = filterEligibleChainsForRemoteDeployment(state.chains, chainId);
262262

263263
const formSubmitRef = useRef<ComponentRef<"button">>(null);
264264

apps/maestro/src/features/InterchainTokenDeployment/steps/deploy-and-register/DeployAndRegister.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ComponentRef, useMemo, useRef, type FC } from "react";
44
import { parseUnits } from "viem";
55

66
import { useBalance, useChainId } from "~/lib/hooks";
7-
import { filterEligibleChains } from "~/lib/utils/chains";
7+
import { filterEligibleChainsForRemoteDeployment } from "~/lib/utils/chains";
88
import { getNativeToken } from "~/lib/utils/getNativeToken";
99
import ChainPicker from "~/ui/compounds/ChainPicker";
1010
import { NextButton } from "~/ui/compounds/MultiStepForm";
@@ -31,7 +31,7 @@ export const Step2: FC = () => {
3131

3232
const { handleSubmit, isReady } = useHandleSubmit();
3333

34-
const eligibleChains = filterEligibleChains(state.chains, chainId);
34+
const eligibleChains = filterEligibleChainsForRemoteDeployment(state.chains, chainId);
3535

3636
const formSubmitRef = useRef<ComponentRef<"button">>(null);
3737

apps/maestro/src/lib/utils/chains.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { CHAINS_WITHOUT_DEPLOYMENT } from "~/config/chains";
12
import { NEXT_PUBLIC_WHITELISTED_DEST_CHAINS_FOR_VM } from "~/config/env";
23
import { ITSChainConfig } from "~/server/chainConfig";
34

@@ -8,8 +9,9 @@ type ChainConfigIndex = {
89
};
910

1011
/**
11-
* Filters out destination chains that are not eligible for the current chain vm chain.
12+
* Filters out destination chains that are not eligible for the current chain vm chain for ITS transfers.
1213
* Currently, only VM chains are eligible for the current chain type.
14+
* Use filterEligibleChainsForRemoteDeployment instead to get the chains that support remote deployments
1315
* @param destinationChains - The list of chains to filter.
1416
* @param currentChainId - The ID of the current chain.
1517
* @returns A filtered list of chains.
@@ -52,6 +54,16 @@ export const filterEligibleChains = (
5254
});
5355
};
5456

57+
export const filterEligibleChainsForRemoteDeployment = (
58+
destinationChains: ITSChainConfig[],
59+
currentChainId: number
60+
): ITSChainConfig[] => {
61+
const eligibleDestinationChains = filterEligibleChains(destinationChains, currentChainId);
62+
return eligibleDestinationChains.filter((chain) => (
63+
!CHAINS_WITHOUT_DEPLOYMENT.includes(chain.chain_id)
64+
));
65+
};
66+
5567
/**
5668
* Retrieves the chain configuration based on the provided Axelar chain ID.
5769
* Handles the special case where the axelarChainId is "axelar".

apps/maestro/src/ui/pages/InterchainTokenDetailsPage/ConnectedInterchainTokensPage.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,7 @@ const ConnectedInterchainTokensPage: FC<ConnectedInterchainTokensPageProps> = (
404404
tokenAddress: props.tokenAddress,
405405
});
406406

407-
// eslint-disable-next-line prefer-const
408-
let [registered, unregistered] = Maybe.of(interchainToken?.matchingTokens)
407+
const [registered, unregisteredUnfiltered] = Maybe.of(interchainToken?.matchingTokens)
409408
.map(
410409
map(
411410
(token) =>
@@ -424,7 +423,7 @@ const ConnectedInterchainTokensPage: FC<ConnectedInterchainTokensPageProps> = (
424423

425424
// There are some chains where we cannot remote deploy to
426425
// Thus, we need to remove these chains from the `unregistered` object.
427-
unregistered = unregistered.filter((token) => !(CHAINS_WITHOUT_DEPLOYMENT.includes(token.chainId)));
426+
const unregistered = unregisteredUnfiltered.filter((token) => !CHAINS_WITHOUT_DEPLOYMENT.includes(token.chainId));
428427

429428
const destinationChainIds = useMemo(
430429
() =>

0 commit comments

Comments
 (0)