Skip to content

Commit

Permalink
fix: upgrade the generated ITS contracts to v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
npty committed Dec 24, 2024
1 parent b554785 commit c92cd23
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,17 @@ export function useDeployAndRegisterRemoteInterchainTokenMutation(
},
});

const { originalChainName, destinationChainNames } = useMemo(() => {
const { destinationChainNames } = useMemo(() => {
const index = computed.indexedById;
const originalChainName =
index[input?.sourceChainId ?? chainId]?.chain_name ?? "Unknown";

return {
originalChainName,
destinationChainNames:
input?.destinationChainIds.map(
(destinationChainId) =>
index[destinationChainId]?.chain_name ?? "Unknown"
) ?? [],
};
}, [
chainId,
computed.indexedById,
input?.destinationChainIds,
input?.sourceChainId,
]);
}, [computed.indexedById, input?.destinationChainIds]);

const multicallArgs = useMemo(() => {
if (!input || !tokenId) {
Expand Down Expand Up @@ -125,14 +117,14 @@ export function useDeployAndRegisterRemoteInterchainTokenMutation(
const registerTxData = destinationChainNames.map((destinationChain, i) =>
INTERCHAIN_TOKEN_FACTORY_ENCODERS.deployRemoteInterchainToken.data({
...commonArgs,
originalChainName,
originalChainName: "",
destinationChain,
gasValue: input.remoteDeploymentGasFees?.gasFees?.[i].fee ?? 0n,
})
);

return [deployTxData, ...registerTxData];
}, [input, tokenId, destinationChainNames, originalChainName]);
}, [input, tokenId, destinationChainNames]);

const totalGasFee = input?.remoteDeploymentGasFees?.totalGasFee ?? 0n;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,13 @@ export default function useRegisterRemoteInterchainTokens(
return destinationChainIds.map((chainId, i) =>
INTERCHAIN_TOKEN_FACTORY_ENCODERS.deployRemoteInterchainToken.data({
salt: tokenDeployment.salt,
originalChainName: sourceChain?.chain_name ?? "",
originalChainName: "",
minter: tokenDeployment.originalMinterAddress ?? zeroAddress,
destinationChain: chainId,
gasValue: gasFeesData.gasFees[i].fee,
})
);
}, [
destinationChainIds,
gasFeesData,
sourceChain?.chain_name,
tokenDeployment,
]);
}, [destinationChainIds, gasFeesData, tokenDeployment]);

const totalGasFee = gasFeesData?.totalGasFee ?? 0n;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* DO NOT EDIT MANUALLY
*/

import { encodeFunctionData, Hex } from "viem";
import { encodeFunctionData } from "viem";

import type { PublicContractClient } from "../../PublicContractClient";
import ABI_FILE from "./InterchainTokenFactory.abi";
Expand Down Expand Up @@ -548,7 +548,7 @@ export function createInterchainTokenFactoryReadClient(
return {
canonicalInterchainTokenDeploySalt(
canonicalInterchainTokenDeploySaltArgs: InterchainTokenFactoryCanonicalInterchainTokenDeploySaltArgs
): Promise {
) {
const encoder =
INTERCHAIN_TOKEN_FACTORY_ENCODERS["canonicalInterchainTokenDeploySalt"];
const encodedArgs = encoder.args(canonicalInterchainTokenDeploySaltArgs);
Expand All @@ -560,7 +560,7 @@ export function createInterchainTokenFactoryReadClient(

canonicalInterchainTokenId(
canonicalInterchainTokenIdArgs: InterchainTokenFactoryCanonicalInterchainTokenIdArgs
): Promise {
) {
const encoder =
INTERCHAIN_TOKEN_FACTORY_ENCODERS["canonicalInterchainTokenId"];
const encodedArgs = encoder.args(canonicalInterchainTokenIdArgs);
Expand Down

0 comments on commit c92cd23

Please sign in to comment.