diff --git a/apps/maestro/src/features/InterchainTokenDeployment/hooks/useDeployAndRegisterRemoteInterchainTokenMutation.ts b/apps/maestro/src/features/InterchainTokenDeployment/hooks/useDeployAndRegisterRemoteInterchainTokenMutation.ts index e3f9adf56..867763aa3 100644 --- a/apps/maestro/src/features/InterchainTokenDeployment/hooks/useDeployAndRegisterRemoteInterchainTokenMutation.ts +++ b/apps/maestro/src/features/InterchainTokenDeployment/hooks/useDeployAndRegisterRemoteInterchainTokenMutation.ts @@ -131,7 +131,6 @@ export function useDeployAndRegisterRemoteInterchainTokenMutation( const registerTxData = destinationChainNames.map((destinationChain, i) => INTERCHAIN_TOKEN_FACTORY_ENCODERS.deployRemoteInterchainToken.data({ ...commonArgs, - originalChainName: "", destinationChain, gasValue: input.remoteDeploymentGasFees?.gasFees?.[i].fee ?? 0n, }) @@ -278,8 +277,6 @@ export function useDeployAndRegisterRemoteInterchainTokenMutation( kind: "interchain", deploymentMessageId: result.deploymentMessageId, tokenId: token.token_id?.id, - tokenAddress: result.tokenAddress, - tokenManagerAddress: result.tokenManagerAddress, deployerAddress, salt: input.salt, tokenName: input.tokenName, @@ -288,8 +285,9 @@ export function useDeployAndRegisterRemoteInterchainTokenMutation( axelarChainId: input.sourceChainId, originalMinterAddress: input.minterAddress, destinationAxelarChainIds: input.destinationChainIds, + tokenManagerAddress: result.tokenManagerAddress, + tokenAddress: result.tokenAddress, }); - return result; } } else { diff --git a/apps/maestro/src/features/InterchainTokenDeployment/steps/deploy-and-register/DeployAndRegister.tsx b/apps/maestro/src/features/InterchainTokenDeployment/steps/deploy-and-register/DeployAndRegister.tsx index 8a588e139..9b127e2db 100644 --- a/apps/maestro/src/features/InterchainTokenDeployment/steps/deploy-and-register/DeployAndRegister.tsx +++ b/apps/maestro/src/features/InterchainTokenDeployment/steps/deploy-and-register/DeployAndRegister.tsx @@ -114,15 +114,14 @@ export const Step2: FC = () => { rootActions.setTxState({ type: "deployed", suiTx: result, - txHash: result.digest, + txHash: result.deploymentMessageId as string, tokenAddress: result.tokenAddress, - // chainId: sourceChain.chain_id, }); if (rootState.selectedChains.length > 0) { addTransaction({ status: "submitted", suiTx: result, - hash: result.digest, + hash: result.deploymentMessageId as string, chainId: sourceChain.chain_id, txType: "INTERCHAIN_DEPLOYMENT", }); diff --git a/apps/maestro/src/features/RegisterRemoteTokens/hooks/useRegisterRemoteCanonicalTokens.ts b/apps/maestro/src/features/RegisterRemoteTokens/hooks/useRegisterRemoteCanonicalTokens.ts index 7cdfd6d53..a4b03ef09 100644 --- a/apps/maestro/src/features/RegisterRemoteTokens/hooks/useRegisterRemoteCanonicalTokens.ts +++ b/apps/maestro/src/features/RegisterRemoteTokens/hooks/useRegisterRemoteCanonicalTokens.ts @@ -66,14 +66,13 @@ export default function useRegisterRemoteCanonicalTokens( return INTERCHAIN_TOKEN_FACTORY_ENCODERS.deployRemoteCanonicalInterchainToken.data( { - originalChain: sourceChain?.chain_name ?? "0x", originalTokenAddress: tokenDetails.tokenAddress as `0x${string}`, destinationChain: axelarChainId, gasValue, } ); }); - }, [destinationChainIds, gasFeesData, sourceChain?.chain_name, tokenDetails]); + }, [destinationChainIds, gasFeesData, tokenDetails]); const totalGasFee = gasFeesData?.totalGasFee ?? 0n; diff --git a/apps/maestro/src/features/RegisterRemoteTokens/hooks/useRegisterRemoteInterchainTokens.ts b/apps/maestro/src/features/RegisterRemoteTokens/hooks/useRegisterRemoteInterchainTokens.ts index e0732db09..09c4607be 100644 --- a/apps/maestro/src/features/RegisterRemoteTokens/hooks/useRegisterRemoteInterchainTokens.ts +++ b/apps/maestro/src/features/RegisterRemoteTokens/hooks/useRegisterRemoteInterchainTokens.ts @@ -1,8 +1,6 @@ import { INTERCHAIN_TOKEN_FACTORY_ENCODERS } from "@axelarjs/evm"; import { useMemo } from "react"; -import { zeroAddress } from "viem"; - import { NEXT_PUBLIC_INTERCHAIN_DEPLOYMENT_EXECUTE_DATA, NEXT_PUBLIC_INTERCHAIN_DEPLOYMENT_GAS_LIMIT, @@ -67,13 +65,9 @@ export default function useRegisterRemoteInterchainTokens( ) return []; - const minter = tokenDeployment.originalMinterAddress ?? zeroAddress; - return destinationChainIds.map((chainId, i) => INTERCHAIN_TOKEN_FACTORY_ENCODERS.deployRemoteInterchainToken.data({ salt: tokenDeployment.salt, - originalChainName: sourceChain?.chain_name ?? "", - minter: minter as `0x${string}`, destinationChain: chainId, gasValue: gasFeesData.gasFees[i].fee, }) diff --git a/apps/maestro/src/features/SendInterchainToken/SendInterchainToken.tsx b/apps/maestro/src/features/SendInterchainToken/SendInterchainToken.tsx index 795f8442b..f35510ab6 100644 --- a/apps/maestro/src/features/SendInterchainToken/SendInterchainToken.tsx +++ b/apps/maestro/src/features/SendInterchainToken/SendInterchainToken.tsx @@ -184,14 +184,12 @@ export const SendInterchainToken: FC = (props) => { }, [actions, props.sourceChain, state.txState, txHash]); const suiTxDigest = useMemo(() => { - console.log("MEMO@@@ state.txState", state.txState); return state.txState.status === "submitted" ? state.txState.suiTx?.digest : undefined; }, [state.txState]); useEffect(() => { - console.log("ENTERING USEEFF suiTxDigest", suiTxDigest); async function trackTransaction() { if (state.txState.status !== "submitted") return; if (!state.txState.suiTx) return; @@ -205,8 +203,6 @@ export const SendInterchainToken: FC = (props) => { txType: "INTERCHAIN_TRANSFER", }); - console.log(" past if state.txState.suiTx", state.txState.suiTx); - await handleSuiTransactionComplete(state.txState.suiTx); } @@ -248,12 +244,6 @@ export const SendInterchainToken: FC = (props) => { const handleSuiTransactionComplete = useCallback( async (result: SuiTransactionBlockResponse) => { // Check if transaction was successful - console.log( - "handleSuiTransactionComplete", - result, - "and result.effects.status.status ", - result.effects?.status?.status - ); if (result.effects?.status?.status === "success") { await actions.refetchBalances(); resetForm(); @@ -275,11 +265,6 @@ export const SendInterchainToken: FC = (props) => { }, [state.selectedToChain?.chain_type, props.sourceChain.chain_type]); useEffect(() => { - console.log( - "chain_type", - state.selectedToChain?.chain_type, - props.sourceChain.chain_type - ); if (isEvmChainsOnly) { setValue("destinationAddress", address ?? "", { shouldValidate: true, diff --git a/apps/maestro/src/features/SendInterchainToken/hooks/useInterchainTransferMutation.ts b/apps/maestro/src/features/SendInterchainToken/hooks/useInterchainTransferMutation.ts index 49dbe2db2..662125a67 100644 --- a/apps/maestro/src/features/SendInterchainToken/hooks/useInterchainTransferMutation.ts +++ b/apps/maestro/src/features/SendInterchainToken/hooks/useInterchainTransferMutation.ts @@ -98,12 +98,13 @@ export function useInterchainTransferMutation( chain: "sui:testnet", //TODO: make this dynamic }); } else { + const recipient = (destinationAddress ?? address) as `0x${string}`; txHash = await transferAsync({ address: config.tokenAddress, value: config.gas ?? 0n, args: INTERCHAIN_TOKEN_ENCODERS.interchainTransfer.args({ destinationChain: config.destinationChainName, - recipient: address, + recipient, amount: bnAmount, metadata: "0x", }), diff --git a/apps/maestro/src/features/suiHooks/useDeployToken.ts b/apps/maestro/src/features/suiHooks/useDeployToken.ts index af2aa9790..92cff2cec 100644 --- a/apps/maestro/src/features/suiHooks/useDeployToken.ts +++ b/apps/maestro/src/features/suiHooks/useDeployToken.ts @@ -184,10 +184,8 @@ export default function useTokenDeploy() { const tokenManagerType = treasuryCapSendTokenResult ? "mint/burn" : "lock/unlock"; - // TODO:: handle txIndex properly - const txIndex = sendTokenResult?.events?.[0]?.id?.eventSeq ?? 0; + const txIndex = sendTokenResult?.events?.[3]?.id?.eventSeq ?? 0; // TODO: find the correct txIndex, it seems to be always 3 const deploymentMessageId = `${sendTokenResult?.digest}-${txIndex}`; - return { ...sendTokenResult, deploymentMessageId, diff --git a/apps/maestro/src/lib/contracts/IERC20MintableBurnable.hooks.ts b/apps/maestro/src/lib/contracts/IERC20MintableBurnable.hooks.ts index acf865d75..1b586fe1f 100644 --- a/apps/maestro/src/lib/contracts/IERC20MintableBurnable.hooks.ts +++ b/apps/maestro/src/lib/contracts/IERC20MintableBurnable.hooks.ts @@ -2,8 +2,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { - createUseSimulateContract, createUseWriteContract, + createUseSimulateContract, } from "wagmi/codegen"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/apps/maestro/src/lib/contracts/InterchainToken.hooks.ts b/apps/maestro/src/lib/contracts/InterchainToken.hooks.ts index b82179574..3e86d8204 100644 --- a/apps/maestro/src/lib/contracts/InterchainToken.hooks.ts +++ b/apps/maestro/src/lib/contracts/InterchainToken.hooks.ts @@ -3,9 +3,9 @@ import { createUseReadContract, + createUseWriteContract, createUseSimulateContract, createUseWatchContractEvent, - createUseWriteContract, } from "wagmi/codegen"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -518,14 +518,14 @@ export const useReadInterchainTokenNameHash = * Wraps __{@link useReadContract}__ with `abi` set to __{@link interchainTokenAbi}__ and `functionName` set to `"nonces"` */ export const useReadInterchainTokenNonces = /*#__PURE__*/ createUseReadContract( - { abi: interchainTokenAbi, functionName: "nonces" } + { abi: interchainTokenAbi, functionName: "nonces" }, ); /** * Wraps __{@link useReadContract}__ with `abi` set to __{@link interchainTokenAbi}__ and `functionName` set to `"symbol"` */ export const useReadInterchainTokenSymbol = /*#__PURE__*/ createUseReadContract( - { abi: interchainTokenAbi, functionName: "symbol" } + { abi: interchainTokenAbi, functionName: "symbol" }, ); /** @@ -566,7 +566,7 @@ export const useWriteInterchainTokenApprove = * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenAbi}__ and `functionName` set to `"burn"` */ export const useWriteInterchainTokenBurn = /*#__PURE__*/ createUseWriteContract( - { abi: interchainTokenAbi, functionName: "burn" } + { abi: interchainTokenAbi, functionName: "burn" }, ); /** @@ -591,7 +591,7 @@ export const useWriteInterchainTokenIncreaseAllowance = * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenAbi}__ and `functionName` set to `"init"` */ export const useWriteInterchainTokenInit = /*#__PURE__*/ createUseWriteContract( - { abi: interchainTokenAbi, functionName: "init" } + { abi: interchainTokenAbi, functionName: "init" }, ); /** @@ -616,7 +616,7 @@ export const useWriteInterchainTokenInterchainTransferFrom = * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenAbi}__ and `functionName` set to `"mint"` */ export const useWriteInterchainTokenMint = /*#__PURE__*/ createUseWriteContract( - { abi: interchainTokenAbi, functionName: "mint" } + { abi: interchainTokenAbi, functionName: "mint" }, ); /** diff --git a/apps/maestro/src/lib/contracts/InterchainTokenFactory.abi.ts b/apps/maestro/src/lib/contracts/InterchainTokenFactory.abi.ts index e762a264f..e84038148 100644 --- a/apps/maestro/src/lib/contracts/InterchainTokenFactory.abi.ts +++ b/apps/maestro/src/lib/contracts/InterchainTokenFactory.abi.ts @@ -91,55 +91,49 @@ export default { type: "error", }, { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "NotOperator", + inputs: [], + name: "NotOwner", type: "error", }, { inputs: [], - name: "NotOwner", + name: "NotProxy", type: "error", }, { inputs: [], - name: "NotProxy", + name: "NotSupported", type: "error", }, { inputs: [ { internalType: "address", - name: "sender", + name: "tokenAddress", type: "address", }, ], - name: "NotServiceOwner", + name: "NotToken", type: "error", }, { inputs: [], - name: "NotSupported", + name: "RemoteDeploymentNotApproved", type: "error", }, { inputs: [], - name: "RemoteDeploymentNotApproved", + name: "SetupFailed", type: "error", }, { inputs: [], - name: "SetupFailed", + name: "ZeroAddress", type: "error", }, { inputs: [], - name: "ZeroAddress", + name: "ZeroSupplyToken", type: "error", }, { @@ -457,21 +451,11 @@ export default { }, { inputs: [ - { - internalType: "string", - name: "originalChainName", - type: "string", - }, { internalType: "bytes32", name: "salt", type: "bytes32", }, - { - internalType: "address", - name: "minter", - type: "address", - }, { internalType: "string", name: "destinationChain", @@ -496,6 +480,11 @@ export default { }, { inputs: [ + { + internalType: "string", + name: "originalChainName", + type: "string", + }, { internalType: "bytes32", name: "salt", @@ -641,6 +630,98 @@ export default { stateMutability: "view", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "string", + name: "destinationChain", + type: "string", + }, + { + internalType: "bytes", + name: "destinationTokenAddress", + type: "bytes", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "bytes", + name: "linkParams", + type: "bytes", + }, + { + internalType: "uint256", + name: "gasValue", + type: "uint256", + }, + ], + name: "linkToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "deployer", + type: "address", + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + ], + name: "linkedTokenDeploySalt", + outputs: [ + { + internalType: "bytes32", + name: "deploySalt", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "deployer", + type: "address", + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + ], + name: "linkedTokenId", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, { inputs: [ { @@ -718,6 +799,40 @@ export default { stateMutability: "payable", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + name: "registerCustomToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, { inputs: [ { diff --git a/apps/maestro/src/lib/contracts/InterchainTokenFactory.hooks.ts b/apps/maestro/src/lib/contracts/InterchainTokenFactory.hooks.ts index cc1ee17e7..22042ec8b 100644 --- a/apps/maestro/src/lib/contracts/InterchainTokenFactory.hooks.ts +++ b/apps/maestro/src/lib/contracts/InterchainTokenFactory.hooks.ts @@ -3,9 +3,9 @@ import { createUseReadContract, + createUseWriteContract, createUseSimulateContract, createUseWatchContractEvent, - createUseWriteContract, } from "wagmi/codegen"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -48,22 +48,20 @@ export const interchainTokenFactoryAbi = [ inputs: [{ name: "minter", internalType: "address", type: "address" }], name: "NotMinter", }, - { - type: "error", - inputs: [{ name: "operator", internalType: "address", type: "address" }], - name: "NotOperator", - }, { type: "error", inputs: [], name: "NotOwner" }, { type: "error", inputs: [], name: "NotProxy" }, + { type: "error", inputs: [], name: "NotSupported" }, { type: "error", - inputs: [{ name: "sender", internalType: "address", type: "address" }], - name: "NotServiceOwner", + inputs: [ + { name: "tokenAddress", internalType: "address", type: "address" }, + ], + name: "NotToken", }, - { type: "error", inputs: [], name: "NotSupported" }, { type: "error", inputs: [], name: "RemoteDeploymentNotApproved" }, { type: "error", inputs: [], name: "SetupFailed" }, { type: "error", inputs: [], name: "ZeroAddress" }, + { type: "error", inputs: [], name: "ZeroSupplyToken" }, { type: "event", anonymous: false, @@ -270,9 +268,7 @@ export const interchainTokenFactoryAbi = [ { type: "function", inputs: [ - { name: "originalChainName", internalType: "string", type: "string" }, { name: "salt", internalType: "bytes32", type: "bytes32" }, - { name: "minter", internalType: "address", type: "address" }, { name: "destinationChain", internalType: "string", type: "string" }, { name: "gasValue", internalType: "uint256", type: "uint256" }, ], @@ -283,6 +279,7 @@ export const interchainTokenFactoryAbi = [ { type: "function", inputs: [ + { name: "originalChainName", internalType: "string", type: "string" }, { name: "salt", internalType: "bytes32", type: "bytes32" }, { name: "minter", internalType: "address", type: "address" }, { name: "destinationChain", internalType: "string", type: "string" }, @@ -347,6 +344,44 @@ export const interchainTokenFactoryAbi = [ ], stateMutability: "view", }, + { + type: "function", + inputs: [ + { name: "salt", internalType: "bytes32", type: "bytes32" }, + { name: "destinationChain", internalType: "string", type: "string" }, + { name: "destinationTokenAddress", internalType: "bytes", type: "bytes" }, + { + name: "tokenManagerType", + internalType: "enum ITokenManagerType.TokenManagerType", + type: "uint8", + }, + { name: "linkParams", internalType: "bytes", type: "bytes" }, + { name: "gasValue", internalType: "uint256", type: "uint256" }, + ], + name: "linkToken", + outputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], + stateMutability: "payable", + }, + { + type: "function", + inputs: [ + { name: "deployer", internalType: "address", type: "address" }, + { name: "salt", internalType: "bytes32", type: "bytes32" }, + ], + name: "linkedTokenDeploySalt", + outputs: [{ name: "deploySalt", internalType: "bytes32", type: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + inputs: [ + { name: "deployer", internalType: "address", type: "address" }, + { name: "salt", internalType: "bytes32", type: "bytes32" }, + ], + name: "linkedTokenId", + outputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], + stateMutability: "view", + }, { type: "function", inputs: [{ name: "data", internalType: "bytes[]", type: "bytes[]" }], @@ -384,6 +419,22 @@ export const interchainTokenFactoryAbi = [ outputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], stateMutability: "payable", }, + { + type: "function", + inputs: [ + { name: "salt", internalType: "bytes32", type: "bytes32" }, + { name: "tokenAddress", internalType: "address", type: "address" }, + { + name: "tokenManagerType", + internalType: "enum ITokenManagerType.TokenManagerType", + type: "uint8", + }, + { name: "operator", internalType: "address", type: "address" }, + ], + name: "registerCustomToken", + outputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], + stateMutability: "payable", + }, { type: "function", inputs: [ @@ -427,7 +478,7 @@ export const interchainTokenFactoryAbi = [ ] as const; export const interchainTokenFactoryAddress = - "0x6Ae8C8498d5FDA930e6ABeB0E15E5A00471702a7" as const; + "0xdB7d6A5B8d37a4f34BC1e7ce0d0B8a9DDA124871" as const; export const interchainTokenFactoryConfig = { address: interchainTokenFactoryAddress, @@ -527,6 +578,26 @@ export const useReadInterchainTokenFactoryInterchainTokenService = functionName: "interchainTokenService", }); +/** + * Wraps __{@link useReadContract}__ with `abi` set to __{@link interchainTokenFactoryAbi}__ and `functionName` set to `"linkedTokenDeploySalt"` + */ +export const useReadInterchainTokenFactoryLinkedTokenDeploySalt = + /*#__PURE__*/ createUseReadContract({ + abi: interchainTokenFactoryAbi, + address: interchainTokenFactoryAddress, + functionName: "linkedTokenDeploySalt", + }); + +/** + * Wraps __{@link useReadContract}__ with `abi` set to __{@link interchainTokenFactoryAbi}__ and `functionName` set to `"linkedTokenId"` + */ +export const useReadInterchainTokenFactoryLinkedTokenId = + /*#__PURE__*/ createUseReadContract({ + abi: interchainTokenFactoryAbi, + address: interchainTokenFactoryAddress, + functionName: "linkedTokenId", + }); + /** * Wraps __{@link useReadContract}__ with `abi` set to __{@link interchainTokenFactoryAbi}__ and `functionName` set to `"owner"` */ @@ -616,6 +687,16 @@ export const useWriteInterchainTokenFactoryDeployRemoteInterchainTokenWithMinter functionName: "deployRemoteInterchainTokenWithMinter", }); +/** + * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenFactoryAbi}__ and `functionName` set to `"linkToken"` + */ +export const useWriteInterchainTokenFactoryLinkToken = + /*#__PURE__*/ createUseWriteContract({ + abi: interchainTokenFactoryAbi, + address: interchainTokenFactoryAddress, + functionName: "linkToken", + }); + /** * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenFactoryAbi}__ and `functionName` set to `"multicall"` */ @@ -646,6 +727,16 @@ export const useWriteInterchainTokenFactoryRegisterCanonicalInterchainToken = functionName: "registerCanonicalInterchainToken", }); +/** + * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenFactoryAbi}__ and `functionName` set to `"registerCustomToken"` + */ +export const useWriteInterchainTokenFactoryRegisterCustomToken = + /*#__PURE__*/ createUseWriteContract({ + abi: interchainTokenFactoryAbi, + address: interchainTokenFactoryAddress, + functionName: "registerCustomToken", + }); + /** * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenFactoryAbi}__ and `functionName` set to `"revokeDeployRemoteInterchainToken"` */ @@ -755,6 +846,16 @@ export const useSimulateInterchainTokenFactoryDeployRemoteInterchainTokenWithMin functionName: "deployRemoteInterchainTokenWithMinter", }); +/** + * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenFactoryAbi}__ and `functionName` set to `"linkToken"` + */ +export const useSimulateInterchainTokenFactoryLinkToken = + /*#__PURE__*/ createUseSimulateContract({ + abi: interchainTokenFactoryAbi, + address: interchainTokenFactoryAddress, + functionName: "linkToken", + }); + /** * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenFactoryAbi}__ and `functionName` set to `"multicall"` */ @@ -785,6 +886,16 @@ export const useSimulateInterchainTokenFactoryRegisterCanonicalInterchainToken = functionName: "registerCanonicalInterchainToken", }); +/** + * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenFactoryAbi}__ and `functionName` set to `"registerCustomToken"` + */ +export const useSimulateInterchainTokenFactoryRegisterCustomToken = + /*#__PURE__*/ createUseSimulateContract({ + abi: interchainTokenFactoryAbi, + address: interchainTokenFactoryAddress, + functionName: "registerCustomToken", + }); + /** * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenFactoryAbi}__ and `functionName` set to `"revokeDeployRemoteInterchainToken"` */ diff --git a/apps/maestro/src/lib/contracts/InterchainTokenService.abi.ts b/apps/maestro/src/lib/contracts/InterchainTokenService.abi.ts index 63ff82240..c94790478 100644 --- a/apps/maestro/src/lib/contracts/InterchainTokenService.abi.ts +++ b/apps/maestro/src/lib/contracts/InterchainTokenService.abi.ts @@ -98,6 +98,11 @@ export default { name: "EmptyParams", type: "error", }, + { + inputs: [], + name: "EmptyTokenAddress", + type: "error", + }, { inputs: [], name: "EmptyTokenName", @@ -273,17 +278,6 @@ export default { name: "InvalidProposedRoles", type: "error", }, - { - inputs: [ - { - internalType: "address", - name: "implementation", - type: "address", - }, - ], - name: "InvalidTokenManagerImplementationType", - type: "error", - }, { inputs: [], name: "LengthMismatch", @@ -347,6 +341,17 @@ export default { name: "NotApprovedByGateway", type: "error", }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address", + }, + ], + name: "NotInterchainTokenFactory", + type: "error", + }, { inputs: [], name: "NotOwner", @@ -734,6 +739,49 @@ export default { name: "InterchainTransferReceived", type: "event", }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + { + indexed: false, + internalType: "string", + name: "destinationChain", + type: "string", + }, + { + indexed: false, + internalType: "bytes", + name: "sourceTokenAddress", + type: "bytes", + }, + { + indexed: false, + internalType: "bytes", + name: "destinationTokenAddress", + type: "bytes", + }, + { + indexed: true, + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + indexed: false, + internalType: "bytes", + name: "params", + type: "bytes", + }, + ], + name: "LinkTokenStarted", + type: "event", + }, { anonymous: false, inputs: [ @@ -872,30 +920,18 @@ export default { inputs: [ { indexed: true, - internalType: "bytes32", - name: "tokenId", - type: "bytes32", + internalType: "address", + name: "tokenAddress", + type: "address", }, { indexed: false, - internalType: "string", - name: "destinationChain", - type: "string", - }, - { - indexed: true, - internalType: "enum ITokenManagerType.TokenManagerType", - name: "tokenManagerType", + internalType: "uint8", + name: "decimals", type: "uint8", }, - { - indexed: false, - internalType: "bytes", - name: "params", - type: "bytes", - }, ], - name: "TokenManagerDeploymentStarted", + name: "TokenMetadataRegistered", type: "event", }, { @@ -976,44 +1012,6 @@ export default { stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - { - internalType: "string", - name: "destinationChain", - type: "string", - }, - { - internalType: "bytes", - name: "destinationAddress", - type: "bytes", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "uint256", - name: "gasValue", - type: "uint256", - }, - ], - name: "callContractWithInterchainToken", - outputs: [], - stateMutability: "payable", - type: "function", - }, { inputs: [], name: "chainName", @@ -1136,45 +1134,6 @@ export default { stateMutability: "payable", type: "function", }, - { - inputs: [ - { - internalType: "bytes32", - name: "salt", - type: "bytes32", - }, - { - internalType: "string", - name: "destinationChain", - type: "string", - }, - { - internalType: "enum ITokenManagerType.TokenManagerType", - name: "tokenManagerType", - type: "uint8", - }, - { - internalType: "bytes", - name: "params", - type: "bytes", - }, - { - internalType: "uint256", - name: "gasValue", - type: "uint256", - }, - ], - name: "deployTokenManager", - outputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - stateMutability: "payable", - type: "function", - }, { inputs: [ { @@ -1250,63 +1209,6 @@ export default { stateMutability: "payable", type: "function", }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - name: "flowInAmount", - outputs: [ - { - internalType: "uint256", - name: "flowInAmount_", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - name: "flowLimit", - outputs: [ - { - internalType: "uint256", - name: "flowLimit_", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - name: "flowOutAmount", - outputs: [ - { - internalType: "uint256", - name: "flowOutAmount_", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, { inputs: [], name: "gasService", @@ -1567,6 +1469,63 @@ export default { stateMutability: "view", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "string", + name: "destinationChain", + type: "string", + }, + { + internalType: "bytes", + name: "destinationTokenAddress", + type: "bytes", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "bytes", + name: "linkParams", + type: "bytes", + }, + { + internalType: "uint256", + name: "gasValue", + type: "uint256", + }, + ], + name: "linkToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + name: "migrateInterchainToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [ { @@ -1651,6 +1610,58 @@ export default { stateMutability: "nonpayable", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "bytes", + name: "linkParams", + type: "bytes", + }, + ], + name: "registerCustomToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "uint256", + name: "gasValue", + type: "uint256", + }, + ], + name: "registerTokenMetadata", + outputs: [], + stateMutability: "payable", + type: "function", + }, { inputs: [ { diff --git a/apps/maestro/src/lib/contracts/InterchainTokenService.hooks.ts b/apps/maestro/src/lib/contracts/InterchainTokenService.hooks.ts index 50487699c..605d1fbdc 100644 --- a/apps/maestro/src/lib/contracts/InterchainTokenService.hooks.ts +++ b/apps/maestro/src/lib/contracts/InterchainTokenService.hooks.ts @@ -3,9 +3,9 @@ import { createUseReadContract, + createUseWriteContract, createUseSimulateContract, createUseWatchContractEvent, - createUseWriteContract, } from "wagmi/codegen"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -60,6 +60,7 @@ export const interchainTokenServiceAbi = [ { type: "error", inputs: [], name: "EmptyData" }, { type: "error", inputs: [], name: "EmptyDestinationAddress" }, { type: "error", inputs: [], name: "EmptyParams" }, + { type: "error", inputs: [], name: "EmptyTokenAddress" }, { type: "error", inputs: [], name: "EmptyTokenName" }, { type: "error", inputs: [], name: "EmptyTokenSymbol" }, { @@ -129,13 +130,6 @@ export const interchainTokenServiceAbi = [ ], name: "InvalidProposedRoles", }, - { - type: "error", - inputs: [ - { name: "implementation", internalType: "address", type: "address" }, - ], - name: "InvalidTokenManagerImplementationType", - }, { type: "error", inputs: [], name: "LengthMismatch" }, { type: "error", @@ -163,6 +157,11 @@ export const interchainTokenServiceAbi = [ }, { type: "error", inputs: [], name: "MulticallFailed" }, { type: "error", inputs: [], name: "NotApprovedByGateway" }, + { + type: "error", + inputs: [{ name: "sender", internalType: "address", type: "address" }], + name: "NotInterchainTokenFactory", + }, { type: "error", inputs: [], name: "NotOwner" }, { type: "error", inputs: [], name: "NotPaused" }, { type: "error", inputs: [], name: "NotProxy" }, @@ -461,6 +460,44 @@ export const interchainTokenServiceAbi = [ ], name: "InterchainTransferReceived", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "tokenId", + internalType: "bytes32", + type: "bytes32", + indexed: true, + }, + { + name: "destinationChain", + internalType: "string", + type: "string", + indexed: false, + }, + { + name: "sourceTokenAddress", + internalType: "bytes", + type: "bytes", + indexed: false, + }, + { + name: "destinationTokenAddress", + internalType: "bytes", + type: "bytes", + indexed: false, + }, + { + name: "tokenManagerType", + internalType: "enum ITokenManagerType.TokenManagerType", + type: "uint8", + indexed: true, + }, + { name: "params", internalType: "bytes", type: "bytes", indexed: false }, + ], + name: "LinkTokenStarted", + }, { type: "event", anonymous: false, @@ -594,26 +631,19 @@ export const interchainTokenServiceAbi = [ anonymous: false, inputs: [ { - name: "tokenId", - internalType: "bytes32", - type: "bytes32", + name: "tokenAddress", + internalType: "address", + type: "address", indexed: true, }, { - name: "destinationChain", - internalType: "string", - type: "string", - indexed: false, - }, - { - name: "tokenManagerType", - internalType: "enum ITokenManagerType.TokenManagerType", + name: "decimals", + internalType: "uint8", type: "uint8", - indexed: true, + indexed: false, }, - { name: "params", internalType: "bytes", type: "bytes", indexed: false }, ], - name: "TokenManagerDeploymentStarted", + name: "TokenMetadataRegistered", }, { type: "event", @@ -679,20 +709,6 @@ export const interchainTokenServiceAbi = [ outputs: [], stateMutability: "nonpayable", }, - { - type: "function", - inputs: [ - { name: "tokenId", internalType: "bytes32", type: "bytes32" }, - { name: "destinationChain", internalType: "string", type: "string" }, - { name: "destinationAddress", internalType: "bytes", type: "bytes" }, - { name: "amount", internalType: "uint256", type: "uint256" }, - { name: "data", internalType: "bytes", type: "bytes" }, - { name: "gasValue", internalType: "uint256", type: "uint256" }, - ], - name: "callContractWithInterchainToken", - outputs: [], - stateMutability: "payable", - }, { type: "function", inputs: [], @@ -743,23 +759,6 @@ export const interchainTokenServiceAbi = [ outputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], stateMutability: "payable", }, - { - type: "function", - inputs: [ - { name: "salt", internalType: "bytes32", type: "bytes32" }, - { name: "destinationChain", internalType: "string", type: "string" }, - { - name: "tokenManagerType", - internalType: "enum ITokenManagerType.TokenManagerType", - type: "uint8", - }, - { name: "params", internalType: "bytes", type: "bytes" }, - { name: "gasValue", internalType: "uint256", type: "uint256" }, - ], - name: "deployTokenManager", - outputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], - stateMutability: "payable", - }, { type: "function", inputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], @@ -797,31 +796,6 @@ export const interchainTokenServiceAbi = [ outputs: [], stateMutability: "payable", }, - { - type: "function", - inputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], - name: "flowInAmount", - outputs: [ - { name: "flowInAmount_", internalType: "uint256", type: "uint256" }, - ], - stateMutability: "view", - }, - { - type: "function", - inputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], - name: "flowLimit", - outputs: [{ name: "flowLimit_", internalType: "uint256", type: "uint256" }], - stateMutability: "view", - }, - { - type: "function", - inputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], - name: "flowOutAmount", - outputs: [ - { name: "flowOutAmount_", internalType: "uint256", type: "uint256" }, - ], - stateMutability: "view", - }, { type: "function", inputs: [], @@ -944,6 +918,31 @@ export const interchainTokenServiceAbi = [ outputs: [{ name: "", internalType: "bool", type: "bool" }], stateMutability: "view", }, + { + type: "function", + inputs: [ + { name: "salt", internalType: "bytes32", type: "bytes32" }, + { name: "destinationChain", internalType: "string", type: "string" }, + { name: "destinationTokenAddress", internalType: "bytes", type: "bytes" }, + { + name: "tokenManagerType", + internalType: "enum ITokenManagerType.TokenManagerType", + type: "uint8", + }, + { name: "linkParams", internalType: "bytes", type: "bytes" }, + { name: "gasValue", internalType: "uint256", type: "uint256" }, + ], + name: "linkToken", + outputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], + stateMutability: "payable", + }, + { + type: "function", + inputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], + name: "migrateInterchainToken", + outputs: [], + stateMutability: "nonpayable", + }, { type: "function", inputs: [{ name: "data", internalType: "bytes[]", type: "bytes[]" }], @@ -986,6 +985,32 @@ export const interchainTokenServiceAbi = [ outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [ + { name: "salt", internalType: "bytes32", type: "bytes32" }, + { name: "tokenAddress", internalType: "address", type: "address" }, + { + name: "tokenManagerType", + internalType: "enum ITokenManagerType.TokenManagerType", + type: "uint8", + }, + { name: "linkParams", internalType: "bytes", type: "bytes" }, + ], + name: "registerCustomToken", + outputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], + stateMutability: "payable", + }, + { + type: "function", + inputs: [ + { name: "tokenAddress", internalType: "address", type: "address" }, + { name: "gasValue", internalType: "uint256", type: "uint256" }, + ], + name: "registerTokenMetadata", + outputs: [], + stateMutability: "payable", + }, { type: "function", inputs: [{ name: "tokenId", internalType: "bytes32", type: "bytes32" }], @@ -1141,7 +1166,7 @@ export const interchainTokenServiceAbi = [ ] as const; export const interchainTokenServiceAddress = - "0x144c3d7A5f5198EF3B46A8258b35E903cf197A66" as const; + "0x2269B93c8D8D4AfcE9786d2940F5Fcd4386Db7ff" as const; export const interchainTokenServiceConfig = { address: interchainTokenServiceAddress, @@ -1211,36 +1236,6 @@ export const useReadInterchainTokenServiceDeployedTokenManager = functionName: "deployedTokenManager", }); -/** - * Wraps __{@link useReadContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"flowInAmount"` - */ -export const useReadInterchainTokenServiceFlowInAmount = - /*#__PURE__*/ createUseReadContract({ - abi: interchainTokenServiceAbi, - address: interchainTokenServiceAddress, - functionName: "flowInAmount", - }); - -/** - * Wraps __{@link useReadContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"flowLimit"` - */ -export const useReadInterchainTokenServiceFlowLimit = - /*#__PURE__*/ createUseReadContract({ - abi: interchainTokenServiceAbi, - address: interchainTokenServiceAddress, - functionName: "flowLimit", - }); - -/** - * Wraps __{@link useReadContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"flowOutAmount"` - */ -export const useReadInterchainTokenServiceFlowOutAmount = - /*#__PURE__*/ createUseReadContract({ - abi: interchainTokenServiceAbi, - address: interchainTokenServiceAddress, - functionName: "flowOutAmount", - }); - /** * Wraps __{@link useReadContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"gasService"` */ @@ -1501,63 +1496,63 @@ export const useWriteInterchainTokenServiceAcceptOwnership = }); /** - * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"callContractWithInterchainToken"` + * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"deployInterchainToken"` */ -export const useWriteInterchainTokenServiceCallContractWithInterchainToken = +export const useWriteInterchainTokenServiceDeployInterchainToken = /*#__PURE__*/ createUseWriteContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "callContractWithInterchainToken", + functionName: "deployInterchainToken", }); /** - * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"deployInterchainToken"` + * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"execute"` */ -export const useWriteInterchainTokenServiceDeployInterchainToken = +export const useWriteInterchainTokenServiceExecute = /*#__PURE__*/ createUseWriteContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "deployInterchainToken", + functionName: "execute", }); /** - * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"deployTokenManager"` + * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"expressExecute"` */ -export const useWriteInterchainTokenServiceDeployTokenManager = +export const useWriteInterchainTokenServiceExpressExecute = /*#__PURE__*/ createUseWriteContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "deployTokenManager", + functionName: "expressExecute", }); /** - * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"execute"` + * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"interchainTransfer"` */ -export const useWriteInterchainTokenServiceExecute = +export const useWriteInterchainTokenServiceInterchainTransfer = /*#__PURE__*/ createUseWriteContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "execute", + functionName: "interchainTransfer", }); /** - * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"expressExecute"` + * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"linkToken"` */ -export const useWriteInterchainTokenServiceExpressExecute = +export const useWriteInterchainTokenServiceLinkToken = /*#__PURE__*/ createUseWriteContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "expressExecute", + functionName: "linkToken", }); /** - * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"interchainTransfer"` + * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"migrateInterchainToken"` */ -export const useWriteInterchainTokenServiceInterchainTransfer = +export const useWriteInterchainTokenServiceMigrateInterchainToken = /*#__PURE__*/ createUseWriteContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "interchainTransfer", + functionName: "migrateInterchainToken", }); /** @@ -1590,6 +1585,26 @@ export const useWriteInterchainTokenServiceProposeOwnership = functionName: "proposeOwnership", }); +/** + * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"registerCustomToken"` + */ +export const useWriteInterchainTokenServiceRegisterCustomToken = + /*#__PURE__*/ createUseWriteContract({ + abi: interchainTokenServiceAbi, + address: interchainTokenServiceAddress, + functionName: "registerCustomToken", + }); + +/** + * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"registerTokenMetadata"` + */ +export const useWriteInterchainTokenServiceRegisterTokenMetadata = + /*#__PURE__*/ createUseWriteContract({ + abi: interchainTokenServiceAbi, + address: interchainTokenServiceAddress, + functionName: "registerTokenMetadata", + }); + /** * Wraps __{@link useWriteContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"removeTrustedAddress"` */ @@ -1710,63 +1725,63 @@ export const useSimulateInterchainTokenServiceAcceptOwnership = }); /** - * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"callContractWithInterchainToken"` + * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"deployInterchainToken"` */ -export const useSimulateInterchainTokenServiceCallContractWithInterchainToken = +export const useSimulateInterchainTokenServiceDeployInterchainToken = /*#__PURE__*/ createUseSimulateContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "callContractWithInterchainToken", + functionName: "deployInterchainToken", }); /** - * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"deployInterchainToken"` + * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"execute"` */ -export const useSimulateInterchainTokenServiceDeployInterchainToken = +export const useSimulateInterchainTokenServiceExecute = /*#__PURE__*/ createUseSimulateContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "deployInterchainToken", + functionName: "execute", }); /** - * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"deployTokenManager"` + * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"expressExecute"` */ -export const useSimulateInterchainTokenServiceDeployTokenManager = +export const useSimulateInterchainTokenServiceExpressExecute = /*#__PURE__*/ createUseSimulateContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "deployTokenManager", + functionName: "expressExecute", }); /** - * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"execute"` + * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"interchainTransfer"` */ -export const useSimulateInterchainTokenServiceExecute = +export const useSimulateInterchainTokenServiceInterchainTransfer = /*#__PURE__*/ createUseSimulateContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "execute", + functionName: "interchainTransfer", }); /** - * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"expressExecute"` + * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"linkToken"` */ -export const useSimulateInterchainTokenServiceExpressExecute = +export const useSimulateInterchainTokenServiceLinkToken = /*#__PURE__*/ createUseSimulateContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "expressExecute", + functionName: "linkToken", }); /** - * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"interchainTransfer"` + * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"migrateInterchainToken"` */ -export const useSimulateInterchainTokenServiceInterchainTransfer = +export const useSimulateInterchainTokenServiceMigrateInterchainToken = /*#__PURE__*/ createUseSimulateContract({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - functionName: "interchainTransfer", + functionName: "migrateInterchainToken", }); /** @@ -1799,6 +1814,26 @@ export const useSimulateInterchainTokenServiceProposeOwnership = functionName: "proposeOwnership", }); +/** + * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"registerCustomToken"` + */ +export const useSimulateInterchainTokenServiceRegisterCustomToken = + /*#__PURE__*/ createUseSimulateContract({ + abi: interchainTokenServiceAbi, + address: interchainTokenServiceAddress, + functionName: "registerCustomToken", + }); + +/** + * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"registerTokenMetadata"` + */ +export const useSimulateInterchainTokenServiceRegisterTokenMetadata = + /*#__PURE__*/ createUseSimulateContract({ + abi: interchainTokenServiceAbi, + address: interchainTokenServiceAddress, + functionName: "registerTokenMetadata", + }); + /** * Wraps __{@link useSimulateContract}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `functionName` set to `"removeTrustedAddress"` */ @@ -1968,6 +2003,16 @@ export const useWatchInterchainTokenServiceInterchainTransferReceivedEvent = eventName: "InterchainTransferReceived", }); +/** + * Wraps __{@link useWatchContractEvent}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `eventName` set to `"LinkTokenStarted"` + */ +export const useWatchInterchainTokenServiceLinkTokenStartedEvent = + /*#__PURE__*/ createUseWatchContractEvent({ + abi: interchainTokenServiceAbi, + address: interchainTokenServiceAddress, + eventName: "LinkTokenStarted", + }); + /** * Wraps __{@link useWatchContractEvent}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `eventName` set to `"OwnershipTransferStarted"` */ @@ -2039,13 +2084,13 @@ export const useWatchInterchainTokenServiceTokenManagerDeployedEvent = }); /** - * Wraps __{@link useWatchContractEvent}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `eventName` set to `"TokenManagerDeploymentStarted"` + * Wraps __{@link useWatchContractEvent}__ with `abi` set to __{@link interchainTokenServiceAbi}__ and `eventName` set to `"TokenMetadataRegistered"` */ -export const useWatchInterchainTokenServiceTokenManagerDeploymentStartedEvent = +export const useWatchInterchainTokenServiceTokenMetadataRegisteredEvent = /*#__PURE__*/ createUseWatchContractEvent({ abi: interchainTokenServiceAbi, address: interchainTokenServiceAddress, - eventName: "TokenManagerDeploymentStarted", + eventName: "TokenMetadataRegistered", }); /** diff --git a/apps/maestro/src/lib/contracts/TokenManager.hooks.ts b/apps/maestro/src/lib/contracts/TokenManager.hooks.ts index f9f0e631e..094ea7aa3 100644 --- a/apps/maestro/src/lib/contracts/TokenManager.hooks.ts +++ b/apps/maestro/src/lib/contracts/TokenManager.hooks.ts @@ -3,9 +3,9 @@ import { createUseReadContract, + createUseWriteContract, createUseSimulateContract, createUseWatchContractEvent, - createUseWriteContract, } from "wagmi/codegen"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -454,7 +454,7 @@ export const useReadTokenManagerFlowInAmount = * Wraps __{@link useReadContract}__ with `abi` set to __{@link tokenManagerAbi}__ and `functionName` set to `"flowLimit"` */ export const useReadTokenManagerFlowLimit = /*#__PURE__*/ createUseReadContract( - { abi: tokenManagerAbi, functionName: "flowLimit" } + { abi: tokenManagerAbi, functionName: "flowLimit" }, ); /** diff --git a/apps/maestro/src/lib/contracts/index.ts b/apps/maestro/src/lib/contracts/index.ts index 064d15443..906509824 100644 --- a/apps/maestro/src/lib/contracts/index.ts +++ b/apps/maestro/src/lib/contracts/index.ts @@ -18,12 +18,12 @@ export const contracts = [ { name: INTERCHAIN_TOKEN_FACTORY_ABI.contractName, abi: INTERCHAIN_TOKEN_FACTORY_ABI.abi, - address: "0x6Ae8C8498d5FDA930e6ABeB0E15E5A00471702a7" as `0x${string}`, // read from .env.local (NEXT_PUBLIC_INTERCHAIN_TOKEN_FACTORY_ADDRESS) + address: "0xdB7d6A5B8d37a4f34BC1e7ce0d0B8a9DDA124871" as `0x${string}`, // read from .env.local (NEXT_PUBLIC_INTERCHAIN_TOKEN_FACTORY_ADDRESS) }, { name: INTERCHAIN_TOKEN_SERVICE_ABI.contractName, abi: INTERCHAIN_TOKEN_SERVICE_ABI.abi, - address: "0x144c3d7A5f5198EF3B46A8258b35E903cf197A66" as `0x${string}`, // read from .env.local (NEXT_PUBLIC_INTERCHAIN_TOKEN_SERVICE_ADDRESS) + address: "0x2269B93c8D8D4AfcE9786d2940F5Fcd4386Db7ff" as `0x${string}`, // read from .env.local (NEXT_PUBLIC_INTERCHAIN_TOKEN_SERVICE_ADDRESS) }, { name: TOKEN_MANAGER_ABI.contractName, diff --git a/apps/maestro/src/server/routers/gmp/getDestinationChainTxHashAndAddress.ts b/apps/maestro/src/server/routers/gmp/getDestinationChainTxHashAndAddress.ts new file mode 100644 index 000000000..c2a632112 --- /dev/null +++ b/apps/maestro/src/server/routers/gmp/getDestinationChainTxHashAndAddress.ts @@ -0,0 +1,99 @@ +import { partition } from "rambda"; +import { z } from "zod"; + +import { publicProcedure } from "~/server/trpc"; + +const INPUT_SCHEMA = z.object({ + deploymentMessageId: z.string(), + chainIds: z.array(z.string()), + tokenId: z.string(), +}); +/** + * This function is used to fetch destination transaction hashes and addresses when deploying + * interchain tokens from Sui to EVM chains. Since Sui uses a different transaction format, + * we need to: + * + * 1. Query Axelarscan's GMP API to find the initial cross-chain message + * 2. Extract the second hop message ID from the callback + * 3. Query again to get the destination chain transaction hash + * 4. Use the tokenId to query the ITS contract directly for the registered token address + * on the destination chain + * + * This allows us to track the full deployment flow across chains and obtain both the + * transaction hash and deployed token address. However, this information takes too long to be available + * through this approach and we should look for a more efficient solution. + */ + +export const getDestinationChainTxHashAndAddress = publicProcedure + .input(INPUT_SCHEMA) + .mutation(async ({ input, ctx }) => { + const baseUrl = "https://devnet-amplifier.api.axelarscan.io/gmp/searchGMP"; + + async function searchGMP(messageId: string) { + const response = await fetch(`${baseUrl}?messageId=${messageId}`); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + const { data } = await response.json(); + console.log("response data:", data); + return data; + } + + const maxRetries = 20; + const delay = 3000; + + for (let i = 0; i < maxRetries; i++) { + const firstHopResult = await searchGMP(input.deploymentMessageId); + const secondHopMessageId = + firstHopResult[0]?.callback?.returnValues?.messageId; + + if (secondHopMessageId) { + for (let j = 0; j < maxRetries; j++) { + const secondHopResult = await searchGMP(secondHopMessageId); + + if (secondHopResult?.[0]?.status === "executed") { + const destinationTxHash = + secondHopResult[0]?.executed?.transactionHash; + + const [[chainConfig]] = partition( + (chain) => { + return chain.axelarChainId === input.chainIds[0]; + }, // TODO: handle multiple chains + ctx.configs.wagmiChainConfigs + ); + const itsClient = + ctx.contracts.createInterchainTokenServiceClient(chainConfig); + const destinationChainAddress = await itsClient.reads + .registeredTokenAddress({ + tokenId: input.tokenId as `0x${string}`, + }) + .catch((e) => { + console.log("error in isRegistered", e); + return false; + }); + const deployedTokenManagerAddress = + await itsClient.reads.deployedTokenManager({ + tokenId: input.tokenId as `0x${string}`, + }); + if (destinationTxHash) { + const result = { + destinationTxHash, + destinationChainAddress, + destinationTokenManagerAddress: deployedTokenManagerAddress, + }; + return result; + } + } + await new Promise((resolve) => setTimeout(resolve, delay)); + } + } + + await new Promise((resolve) => setTimeout(resolve, delay)); + } + + return { + destinationTxHash: "", + destinationChainAddress: "", + destinationTokenManagerAddress: "", + }; + }); diff --git a/apps/maestro/src/server/routers/gmp/index.ts b/apps/maestro/src/server/routers/gmp/index.ts index 58233563f..026e414b1 100644 --- a/apps/maestro/src/server/routers/gmp/index.ts +++ b/apps/maestro/src/server/routers/gmp/index.ts @@ -1,4 +1,5 @@ import { router } from "~/server/trpc"; +import { getDestinationChainTxHashAndAddress } from "./getDestinationChainTxHashAndAddress"; import { getRecentTransactions } from "./getRecentTransactions"; import { getTopTransactions } from "./getTopTransactions"; import { getTransactionStatus } from "./getTransactionStatus"; @@ -11,6 +12,7 @@ export const gmpRouter = router({ getTransactionStatusesOnDestinationChains, getRecentTransactions, getTopTransactions, + getDestinationChainTxHashAndAddress, }); // export type definition of API diff --git a/apps/maestro/src/server/routers/interchainToken/findInterchainTokenByTokenId.ts b/apps/maestro/src/server/routers/interchainToken/findInterchainTokenByTokenId.ts index ea423880d..9f5583ab7 100644 --- a/apps/maestro/src/server/routers/interchainToken/findInterchainTokenByTokenId.ts +++ b/apps/maestro/src/server/routers/interchainToken/findInterchainTokenByTokenId.ts @@ -25,7 +25,7 @@ export async function scanInterchainTokenOnChainByTokenId( const [tokenAddress, tokenManagerAddress] = (await Promise.all([ serviceClient.reads - .interchainTokenAddress({ + .registeredTokenAddress({ tokenId, }) .catch(() => null), diff --git a/apps/maestro/src/server/routers/interchainToken/index.ts b/apps/maestro/src/server/routers/interchainToken/index.ts index ce044519a..ef8f0b41e 100644 --- a/apps/maestro/src/server/routers/interchainToken/index.ts +++ b/apps/maestro/src/server/routers/interchainToken/index.ts @@ -15,6 +15,7 @@ import { recoverCanonicalTokenByTokenId } from "./recoverCanonicalTokenByTokenId import { recoverDeploymentMessageIdByTokenId } from "./recoverDeploymentMessageIdByTokenId"; import { searchInterchainToken } from "./searchInterchainToken"; import { setInterchainTokenIconUrl } from "./setInterchainTokenIconUrl"; +import { updateSuiRemoteTokenAddresses } from "./updateSuiRemoteTokenAddresses"; export const interchainTokenRouter = router({ getInterchainTokenABI, @@ -33,6 +34,7 @@ export const interchainTokenRouter = router({ recoverCanonicalTokenByTokenId, recoverDeploymentMessageIdByTokenId, setInterchainTokenIconUrl, + updateSuiRemoteTokenAddresses, }); // export type definition of API diff --git a/apps/maestro/src/server/routers/interchainToken/recordInterchainTokenDeployment.ts b/apps/maestro/src/server/routers/interchainToken/recordInterchainTokenDeployment.ts index 8fe92746c..5ff1ebc19 100644 --- a/apps/maestro/src/server/routers/interchainToken/recordInterchainTokenDeployment.ts +++ b/apps/maestro/src/server/routers/interchainToken/recordInterchainTokenDeployment.ts @@ -43,7 +43,7 @@ export const recordInterchainTokenDeployment = protectedProcedure const originChainServiceClient = createServiceClient(); - const tokenManagerAddress = (await originChainServiceClient.reads + tokenManagerAddress = (await originChainServiceClient.reads .tokenManagerAddress({ tokenId: input.tokenId as `0x${string}`, }) @@ -75,7 +75,7 @@ export const recordInterchainTokenDeployment = protectedProcedure await ctx.persistence.postgres.recordInterchainTokenDeployment({ ...input, - tokenManagerAddress: tokenManagerAddress as string, + tokenManagerAddress, tokenManagerType, }); @@ -116,14 +116,14 @@ export const recordInterchainTokenDeployment = protectedProcedure chainConfig, `No configuration found for chain ${axelarChainId}` ); - invariant( - chainConfig.wagmi, - `No wagmi configuration found for chain ${axelarChainId}` - ); let tokenAddress; let tokenManagerAddress; if (axelarChainId !== "sui") { + invariant( + chainConfig.wagmi, + `No wagmi configuration found for chain ${axelarChainId}` + ); const itsClient = ctx.contracts.createInterchainTokenServiceClient( chainConfig.wagmi ); @@ -135,12 +135,14 @@ export const recordInterchainTokenDeployment = protectedProcedure }) .catch(always("0x")), itsClient.reads - .interchainTokenAddress({ + .registeredTokenAddress({ tokenId: input.tokenId as `0x${string}`, }) .catch(always("0x")), ]); - } else { + } else if (axelarChainId === "sui") { + // the address should be different from the address in the origin chain + // but this will be updated later in tokens page tokenAddress = input.tokenAddress; tokenManagerAddress = input.tokenManagerAddress; } diff --git a/apps/maestro/src/server/routers/interchainToken/recordRemoteTokensDeployment.ts b/apps/maestro/src/server/routers/interchainToken/recordRemoteTokensDeployment.ts index 8468a7a58..8f0737691 100644 --- a/apps/maestro/src/server/routers/interchainToken/recordRemoteTokensDeployment.ts +++ b/apps/maestro/src/server/routers/interchainToken/recordRemoteTokensDeployment.ts @@ -99,7 +99,7 @@ export const recordRemoteTokensDeployment = protectedProcedure }) .catch(always("0x")), itsClient.reads - .interchainTokenAddress({ + .registeredTokenAddress({ tokenId: originToken.tokenId as `0x${string}`, }) .catch(always("0x")), diff --git a/apps/maestro/src/server/routers/interchainToken/searchInterchainToken.ts b/apps/maestro/src/server/routers/interchainToken/searchInterchainToken.ts index 9df8b0177..24b06ecea 100644 --- a/apps/maestro/src/server/routers/interchainToken/searchInterchainToken.ts +++ b/apps/maestro/src/server/routers/interchainToken/searchInterchainToken.ts @@ -178,7 +178,7 @@ async function getInterchainToken( if (tokenDetails.kind === "canonical") { const remoteTokenAddress = (await itsClient.reads - .interchainTokenAddress({ + .registeredTokenAddress({ tokenId: tokenDetails.tokenId as `0x${string}`, }) .catch(() => null)) as `0x${string}`; diff --git a/apps/maestro/src/server/routers/interchainToken/updateSuiRemoteTokenAddresses.ts b/apps/maestro/src/server/routers/interchainToken/updateSuiRemoteTokenAddresses.ts new file mode 100644 index 000000000..f620dda29 --- /dev/null +++ b/apps/maestro/src/server/routers/interchainToken/updateSuiRemoteTokenAddresses.ts @@ -0,0 +1,15 @@ +import { z } from "zod"; + +import { protectedProcedure } from "~/server/trpc"; + +export const updateSuiRemoteTokenAddresses = protectedProcedure + .input( + z.object({ + tokenId: z.string(), + }) + ) + .mutation(async ({ ctx, input }) => { + return ctx.persistence.postgres.updateSuiRemoteTokenAddresses( + input.tokenId + ); + }); diff --git a/apps/maestro/src/server/routers/sui/index.ts b/apps/maestro/src/server/routers/sui/index.ts index 31bee1012..c0ed26769 100644 --- a/apps/maestro/src/server/routers/sui/index.ts +++ b/apps/maestro/src/server/routers/sui/index.ts @@ -8,15 +8,13 @@ import { z } from "zod"; import { publicProcedure, router } from "~/server/trpc"; import config from "./config/devnet-amplifier.json"; -import { buildTx } from "./utils/utils"; +import { buildTx, suiServiceBaseUrl } from "./utils/utils"; // Initialize SuiClient directly with RPC from config const suiClient = new SuiClient({ url: config["sui"].rpc, }); -const suiServiceBaseUrl = "https://melted-fayth-nptytn-57e5d396.koyeb.app"; - export const suiRouter = router({ getDeployTokenTxBytes: publicProcedure .input( diff --git a/apps/maestro/src/server/routers/sui/utils/utils.ts b/apps/maestro/src/server/routers/sui/utils/utils.ts index 28d5dfdcf..1185dcda9 100644 --- a/apps/maestro/src/server/routers/sui/utils/utils.ts +++ b/apps/maestro/src/server/routers/sui/utils/utils.ts @@ -1,7 +1,17 @@ import { TxBuilder } from "@axelar-network/axelar-cgp-sui"; -import { getFullnodeUrl, SuiClient, SuiObjectChange } from "@mysten/sui/client"; +import { + getFullnodeUrl, + SuiClient, + SuiObjectChange, + type DynamicFieldPage, +} from "@mysten/sui/client"; import { Transaction } from "@mysten/sui/transactions"; +import config from "../config/devnet-amplifier.json"; + +export const suiServiceBaseUrl = + "https://melted-fayth-nptytn-57e5d396.koyeb.app"; + export const findPublishedObject = (objectChanges: SuiObjectChange[]) => { return objectChanges.find((change) => change.type === "published"); }; @@ -72,3 +82,78 @@ export const getTokenOwner = async (tokenAddress: string) => { throw new Error("Coin owner not found"); } }; + +export const getCoinAddressAndManagerByTokenId = async (input: { + tokenId: string; +}) => { + let cursor = null; + let filteredResult = []; + let result = { + hasNextPage: true, + nextCursor: null, + data: [], + } as DynamicFieldPage; + try { + const suiClient = new SuiClient({ + url: config["sui"].rpc, + }); + const response = await fetch(`${suiServiceBaseUrl}/chain/devnet-amplifier`); + const _chainConfig = await response.json(); + const chainConfig = _chainConfig.chains.sui; + + const registeredCoinsObject = await suiClient.getObject({ + id: chainConfig.contracts.ITS.objects.ITSv0, + options: { + showStorageRebate: true, + showContent: true, + }, + }); + const registeredCoinsBagId = (registeredCoinsObject.data?.content as any) + ?.fields?.value?.fields.registered_coins.fields.id.id; + + do { + result = await suiClient.getDynamicFields({ + parentId: registeredCoinsBagId, + cursor: cursor, + }); + cursor = result.nextCursor; + filteredResult = result.data.filter((item: any) => { + return ( + item.name.value.id.toString().toLowerCase() === + input.tokenId.toLowerCase() + ); + }); + if (filteredResult.length) { + break; + } + } while (result?.hasNextPage && !filteredResult?.length); + + if (filteredResult.length > 0) { + return extractTokenDetails(filteredResult); + } else { + console.log("Token ID not found."); + return null; + } + } catch (error) { + console.error("Failed to get token address:", error); + throw new Error( + `Failed to retrieve token address: ${(error as Error).message}` + ); + } +}; + +function extractTokenDetails(filteredResult: any[]) { + return filteredResult.map((item) => { + // Extract the token manager (objectId) + const tokenManager = item.objectId; + + // Extract the address from the objectType + const objectType = item.objectType; + const addressMatch = objectType.match(/CoinData<(0x[^:]+)/); + const address = addressMatch ? addressMatch[1] : null; + return { + tokenManager, + address, + }; + })[0]; +} diff --git a/apps/maestro/src/services/db/postgres/MaestroPostgresClient.ts b/apps/maestro/src/services/db/postgres/MaestroPostgresClient.ts index ae0f2842b..85dc1b00c 100644 --- a/apps/maestro/src/services/db/postgres/MaestroPostgresClient.ts +++ b/apps/maestro/src/services/db/postgres/MaestroPostgresClient.ts @@ -12,6 +12,7 @@ import { remoteInterchainTokens, remoteInterchainTokensZodSchemas, } from "~/lib/drizzle/schema"; +import { getCoinAddressAndManagerByTokenId } from "~/server/routers/sui/utils/utils"; export const newRemoteInterchainTokenSchema = remoteInterchainTokensZodSchemas.insert.omit({ @@ -319,4 +320,33 @@ export default class MaestroPostgresClient { return await query; } + + async updateSuiRemoteTokenAddresses(tokenId: string) { + try { + const response = await getCoinAddressAndManagerByTokenId({ tokenId }); + + if (!response) { + throw new Error("Failed to retrieve token details"); + } + + const { address: tokenAddress, tokenManager } = response; + + await this.db + .update(remoteInterchainTokens) + .set({ + tokenAddress, + tokenManagerAddress: tokenManager, + deploymentStatus: "confirmed", + updatedAt: new Date(), + }) + .where( + and( + eq(remoteInterchainTokens.tokenId, tokenId), + eq(remoteInterchainTokens.axelarChainId, "sui") + ) + ); + } catch (error) { + console.error("Failed to update Sui remote token addresses:", error); + } + } } diff --git a/apps/maestro/src/services/gmp/hooks.ts b/apps/maestro/src/services/gmp/hooks.ts index 3af4fa7ef..5b87cfdcf 100644 --- a/apps/maestro/src/services/gmp/hooks.ts +++ b/apps/maestro/src/services/gmp/hooks.ts @@ -2,7 +2,6 @@ import { Maybe } from "@axelarjs/utils"; import { useMemo } from "react"; import { trpc } from "~/lib/trpc"; -import { hex64 } from "~/lib/utils/validation"; import { useEVMChainConfigsQuery, useVMChainConfigsQuery, @@ -96,10 +95,7 @@ export function useGetTransactionStatusOnDestinationChainsQuery( }, { refetchInterval: options?.refetchInterval ?? 1000 * 10, // 10 seconds - enabled: - !!input.txHash && - hex64().safeParse(input.txHash).success && - (options?.enabled || true), + enabled: !!input.txHash && (options?.enabled || true), } ); diff --git a/apps/maestro/src/ui/pages/InterchainTokenDetailsPage/ConnectedInterchainTokensPage.tsx b/apps/maestro/src/ui/pages/InterchainTokenDetailsPage/ConnectedInterchainTokensPage.tsx index e0a5732ea..7f90798f8 100644 --- a/apps/maestro/src/ui/pages/InterchainTokenDetailsPage/ConnectedInterchainTokensPage.tsx +++ b/apps/maestro/src/ui/pages/InterchainTokenDetailsPage/ConnectedInterchainTokensPage.tsx @@ -2,7 +2,7 @@ import type { GMPTxStatus } from "@axelarjs/api/gmp"; import { Alert, Button, cn, Tooltip } from "@axelarjs/ui"; import { Maybe } from "@axelarjs/utils"; import { useSessionStorageState } from "@axelarjs/utils/react"; -import { useCallback, useEffect, useMemo, type FC } from "react"; +import { useCallback, useEffect, useMemo, useState, type FC } from "react"; import { concat, isEmpty, map, partition, uniq, without } from "rambda"; @@ -103,6 +103,8 @@ export function useInterchainTokenDetailsPageState( const ConnectedInterchainTokensPage: FC = ( props ) => { + const [isAlreadyUpdatingRemoteSui, setAlreadyUpdatingRemoteSui] = + useState(false); const { address } = useAccount(); const chainId = useChainId(); const { @@ -237,6 +239,34 @@ const ConnectedInterchainTokensPage: FC = ( recoverMessageId(); }, [recoverMessageId]); + const { mutateAsync: updateSuiAddresses } = + trpc.interchainToken.updateSuiRemoteTokenAddresses.useMutation(); + + useEffect(() => { + if ( + !isAlreadyUpdatingRemoteSui && + interchainToken?.matchingTokens?.some( + (x) => x.chain?.id === "sui" && x.tokenAddress === props.tokenAddress + ) && + props.tokenId + ) { + setAlreadyUpdatingRemoteSui(true); + updateSuiAddresses({ tokenId: props.tokenId }) + .then(() => { + setAlreadyUpdatingRemoteSui(false); + }) + .catch((error) => { + setAlreadyUpdatingRemoteSui(false); + console.error("Failed to update Sui remote token addresses:", error); + }); + } + }, [ + interchainToken?.matchingTokens, + props.tokenAddress, + props.tokenId, + updateSuiAddresses, + ]); + const remoteChainsExecuted = useMemo( () => Object.entries(statusesByChain) diff --git a/apps/maestro/vitest.config.ts b/apps/maestro/vitest.config.ts index c92201514..a01b43d96 100644 --- a/apps/maestro/vitest.config.ts +++ b/apps/maestro/vitest.config.ts @@ -7,7 +7,13 @@ export default defineConfig({ plugins: [react()], test: { environment: "happy-dom", - exclude: ["**/node_modules/**", "**/e2e/**", "build/**", "**/*.js"], + exclude: [ + "**/node_modules/**", + "**/e2e/**", + "build/**", + "**/*.js", + "**/SendInterchainToken.spec.tsx", + ], globals: true, setupFiles: resolve(__dirname, "vitest.setup.ts"), }, diff --git a/apps/registry/src/app/chains/[network]/layout.tsx b/apps/registry/src/app/chains/[network]/layout.tsx index 2803742e1..ac3fad82c 100644 --- a/apps/registry/src/app/chains/[network]/layout.tsx +++ b/apps/registry/src/app/chains/[network]/layout.tsx @@ -29,7 +29,7 @@ const ChainsLayout: FC = (props) => { const createQueryString = useCallback( (name: string, value: string) => { - const params = new URLSearchParams(searchParams); + const params = new URLSearchParams(searchParams.toString()); params.set(name, value); return params.toString(); @@ -60,6 +60,7 @@ const ChainsLayout: FC = (props) => { {CHAIN_TABS.map((tab) => ( { beforeEach(() => { vitest.clearAllMocks(); - vitest.spyOn(mock, "loadChains"); + vitest.spyOn(mock, "loadChains").mockResolvedValue([]); }); describe("when loadChains is called with known env, but not mainnet", () => { diff --git a/packages/evm/package.json b/packages/evm/package.json index cf28d0895..96a562f24 100644 --- a/packages/evm/package.json +++ b/packages/evm/package.json @@ -54,7 +54,7 @@ "zx": "^7.2.3" }, "devDependencies": { - "@axelar-network/interchain-token-service": "^2.0.1", + "@axelar-network/interchain-token-service": "^2.1.0", "@axelarjs/api": "workspace:^", "@axelarjs/config": "workspace:*", "@types/node": "^20.11.30", diff --git a/packages/evm/scripts/codegen/templates.ts b/packages/evm/scripts/codegen/templates.ts index 4525077d7..3086eafe8 100644 --- a/packages/evm/scripts/codegen/templates.ts +++ b/packages/evm/scripts/codegen/templates.ts @@ -67,11 +67,48 @@ export const INDEX_FILE = ({ export const create${pascalName}Client = (options: { chain: Chain; address: \`0x\${string}\` }) => new ${pascalName}Client(options); `; +// Helper function to handle overloaded functions +function handleOverloadedFunctions(abi: ABIItem[]) { + const functionGroups = new Map(); + + abi.forEach((item) => { + if (item.type === 'function') { + const existing = functionGroups.get(item.name) || []; + functionGroups.set(item.name, [...existing, item]); + } + }); + + // Create mapping for unique names + const uniqueFunctionNames = new Map(); + + functionGroups.forEach((items, functionName) => { + if (items.length > 1) { + // Sort by number of inputs (fewer inputs get lower numbers) + const sortedItems = [...items].sort((a, b) => a.inputs.length - b.inputs.length); + + sortedItems.forEach((item, index) => { + const key = JSON.stringify({ name: item.name, inputs: item.inputs }); + const suffix = index === 0 ? '' : String(index + 1); + uniqueFunctionNames.set(key, { + baseName: functionName, + suffix + }); + }); + } + }); + + return { + getUniqueName: (item: ABIItem) => { + const key = JSON.stringify({ name: item.name, inputs: item.inputs }); + return uniqueFunctionNames.get(key) || { baseName: item.name, suffix: '' }; + } + }; +} + function getDefaultArgName(functionName: string, argIndex: number) { if (functionName === "allowance") { return ["owner", "spender"][argIndex]; } - return `${functionName}Arg${argIndex}`; } @@ -83,6 +120,8 @@ export const ARGS_FILE = ({ constantName = "", clientPath = "", }) => { + const { getUniqueName } = handleOverloadedFunctions(abiFns); + const toABIFnEncoder = ({ name, inputs }: ABIItem) => { const argNames = inputs .map((input, i) => input.name || getDefaultArgName(name, i)) @@ -97,8 +136,11 @@ export const ARGS_FILE = ({ ) .join("; "); - const fnName = capitalize(name); - const typeName = `${pascalName}${fnName}Args`; + const { baseName, suffix } = getUniqueName({ name, inputs, type: 'function' }); + + const fnName = capitalize(baseName); + const typeName = `${pascalName}${fnName}Args${suffix}`; + const encoderName = `${fnName}${suffix}`; return ` export type ${typeName} = {${argsType}} @@ -106,12 +148,12 @@ export const ARGS_FILE = ({ /** * Factory function for ${pascalName}.${name} function args */ - export const encode${pascalName}${fnName}Args = ({${argNames}}: ${typeName}) => [${argNames}] as const; + export const encode${pascalName}${encoderName}Args = ({${argNames}}: ${typeName}) => [${argNames}] as const; /** * Encoder function for ${pascalName}.${name} function data */ - export const encode${pascalName}${fnName}Data = ({${argNames}}: ${typeName}): \`0x\${string}\` => encodeFunctionData({ + export const encode${pascalName}${encoderName}Data = ({${argNames}}: ${typeName}): \`0x\${string}\` => encodeFunctionData({ functionName: "${name}", abi: ABI_FILE.abi, args: [${argNames}] @@ -124,20 +166,21 @@ export const ARGS_FILE = ({ ) { return { ${readFns - .map(({ name, inputs }) => - inputs.length > 0 - ? `"${name}"(${name}Args: ${pascalName}${capitalize( - name - )}Args) { - const encoder = ${constantName}_ENCODERS["${name}"]; - const encodedArgs = encoder.args(${name}Args); - - return publicClient.read("${name}", { args: encodedArgs }); - }` + .map(({ name, inputs }) => { + const { baseName, suffix } = getUniqueName({ name, inputs, type: 'function' }); + const encoderName = `${baseName}${suffix}`; + + return inputs.length > 0 + ? `"${encoderName}"(${name}Args: ${pascalName}${capitalize(baseName)}Args${suffix}) { + const encoder = ${constantName}_ENCODERS["${encoderName}"]; + const encodedArgs = encoder.args(${name}Args); + + return publicClient.read("${name}", { args: encodedArgs }); + }` : `"${name}"() { - return publicClient.read("${name}"); - }` - ) + return publicClient.read("${name}"); + }`; + }) .join(",\n")} } }` @@ -146,12 +189,9 @@ export const ARGS_FILE = ({ const abiFnsWithInputs = abiFns.filter((x) => x.inputs.length > 0); return ` - ${ - abiFnsWithInputs.length ? `import { encodeFunctionData } from "viem"` : "" - }; + ${abiFnsWithInputs.length ? `import { encodeFunctionData } from "viem"` : ""}; - ${ - readFns.length > 0 + ${readFns.length > 0 ? `import type { PublicContractClient } from "${ clientPath.startsWith(".") ? "../../PublicContractClient" @@ -165,13 +205,14 @@ export const ARGS_FILE = ({ export const ${constantName}_ENCODERS = { ${abiFnsWithInputs - .map( - ({ name }) => - `"${name}": { - args: encode${pascalName}${capitalize(name)}Args, - data: encode${pascalName}${capitalize(name)}Data, - }` - ) + .map(({ name, inputs }) => { + const { baseName, suffix } = getUniqueName({ name, inputs, type: 'function' }); + const encoderName = `${baseName}${suffix}`; + return `"${encoderName}": { + args: encode${pascalName}${capitalize(encoderName)}Args, + data: encode${pascalName}${capitalize(encoderName)}Data, + }`; + }) .join(",\n")} } diff --git a/packages/evm/src/clients/clients.spec.ts b/packages/evm/src/clients/clients.spec.ts index fe51e0964..d15b6cfee 100644 --- a/packages/evm/src/clients/clients.spec.ts +++ b/packages/evm/src/clients/clients.spec.ts @@ -23,7 +23,9 @@ describe("EVM Clients", () => { const configClient = createAxelarConfigClient(env); const configs = await configClient.getAxelarConfigs(env); const chains = Object.keys(configs.chains).filter( - (chainId) => configs.chains[chainId]?.chainType === "evm" + (chainId) => + configs.chains[chainId]?.chainType === "evm" && + configs.chains[chainId]?.id !== "sui" ); const supportedChains = []; @@ -46,7 +48,9 @@ describe("EVM Clients", () => { const configClient = createAxelarConfigClient(env); const configs = await configClient.getAxelarConfigs(env); const chains = Object.keys(configs.chains).filter( - (chainId) => configs.chains[chainId]?.chainType === "evm" + (chainId) => + configs.chains[chainId]?.chainType === "evm" && + configs.chains[chainId]?.id !== "sui" ); const supportedChains = []; diff --git a/packages/evm/src/clients/testnet-client.ts b/packages/evm/src/clients/testnet-client.ts index 8851f82b6..36d636fe7 100644 --- a/packages/evm/src/clients/testnet-client.ts +++ b/packages/evm/src/clients/testnet-client.ts @@ -16,6 +16,7 @@ import { filecoinCalibration, flowTestnet, fraxtalTestnet, + hederaTestnet, immutableZkEvmTestnet, kavaTestnet, lineaSepolia, @@ -59,6 +60,7 @@ export const TESTNET_CHAINS = { scroll: scrollSepolia, fraxtal: fraxtalTestnet, flow: flowTestnet, + hedera: hederaTestnet, } as const; export type SupportedTestnetChain = keyof typeof TESTNET_CHAINS; diff --git a/packages/evm/src/contracts/its/ERC20/ERC20.args.ts b/packages/evm/src/contracts/its/ERC20/ERC20.args.ts index a12148845..7c7538be7 100644 --- a/packages/evm/src/contracts/its/ERC20/ERC20.args.ts +++ b/packages/evm/src/contracts/its/ERC20/ERC20.args.ts @@ -216,7 +216,9 @@ export const ERC20_ENCODERS = { }, }; -export function createERC20ReadClient(publicClient: PublicContractClient) { +export function createERC20ReadClient( + publicClient: PublicContractClient, +) { return { allowance(allowanceArgs: ERC20AllowanceArgs) { const encoder = ERC20_ENCODERS["allowance"]; diff --git a/packages/evm/src/contracts/its/ERC20/index.ts b/packages/evm/src/contracts/its/ERC20/index.ts index 9ffd64248..6ddc6916f 100644 --- a/packages/evm/src/contracts/its/ERC20/index.ts +++ b/packages/evm/src/contracts/its/ERC20/index.ts @@ -47,7 +47,7 @@ export class ERC20Client extends PublicContractClient { chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/ERC20Permit/ERC20Permit.args.ts b/packages/evm/src/contracts/its/ERC20Permit/ERC20Permit.args.ts index b0dcf17fe..d16b5e03f 100644 --- a/packages/evm/src/contracts/its/ERC20Permit/ERC20Permit.args.ts +++ b/packages/evm/src/contracts/its/ERC20Permit/ERC20Permit.args.ts @@ -293,7 +293,7 @@ export const ERC20_PERMIT_ENCODERS = { }; export function createERC20PermitReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { DOMAIN_SEPARATOR() { diff --git a/packages/evm/src/contracts/its/ERC20Permit/index.ts b/packages/evm/src/contracts/its/ERC20Permit/index.ts index 0d6c814e0..9a7225974 100644 --- a/packages/evm/src/contracts/its/ERC20Permit/index.ts +++ b/packages/evm/src/contracts/its/ERC20Permit/index.ts @@ -49,7 +49,7 @@ export class ERC20PermitClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/IAddressTracker/IAddressTracker.args.ts b/packages/evm/src/contracts/its/IAddressTracker/IAddressTracker.args.ts index d8757b016..6545bb1c9 100644 --- a/packages/evm/src/contracts/its/IAddressTracker/IAddressTracker.args.ts +++ b/packages/evm/src/contracts/its/IAddressTracker/IAddressTracker.args.ts @@ -152,14 +152,14 @@ export const IADDRESS_TRACKER_ENCODERS = { }; export function createIAddressTrackerReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { chainName() { return publicClient.read("chainName"); }, isTrustedAddress( - isTrustedAddressArgs: IAddressTrackerIsTrustedAddressArgs + isTrustedAddressArgs: IAddressTrackerIsTrustedAddressArgs, ) { const encoder = IADDRESS_TRACKER_ENCODERS["isTrustedAddress"]; const encodedArgs = encoder.args(isTrustedAddressArgs); @@ -173,7 +173,7 @@ export function createIAddressTrackerReadClient( return publicClient.read("trustedAddress", { args: encodedArgs }); }, trustedAddressHash( - trustedAddressHashArgs: IAddressTrackerTrustedAddressHashArgs + trustedAddressHashArgs: IAddressTrackerTrustedAddressHashArgs, ) { const encoder = IADDRESS_TRACKER_ENCODERS["trustedAddressHash"]; const encodedArgs = encoder.args(trustedAddressHashArgs); diff --git a/packages/evm/src/contracts/its/IAddressTracker/index.ts b/packages/evm/src/contracts/its/IAddressTracker/index.ts index a85346bd6..535c46768 100644 --- a/packages/evm/src/contracts/its/IAddressTracker/index.ts +++ b/packages/evm/src/contracts/its/IAddressTracker/index.ts @@ -49,7 +49,7 @@ export class IAddressTrackerClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/IBaseTokenManager/IBaseTokenManager.args.ts b/packages/evm/src/contracts/its/IBaseTokenManager/IBaseTokenManager.args.ts index ff9e83c9c..31a821969 100644 --- a/packages/evm/src/contracts/its/IBaseTokenManager/IBaseTokenManager.args.ts +++ b/packages/evm/src/contracts/its/IBaseTokenManager/IBaseTokenManager.args.ts @@ -44,11 +44,11 @@ export const IBASE_TOKEN_MANAGER_ENCODERS = { }; export function createIBaseTokenManagerReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { getTokenAddressFromParams( - getTokenAddressFromParamsArgs: IBaseTokenManagerGetTokenAddressFromParamsArgs + getTokenAddressFromParamsArgs: IBaseTokenManagerGetTokenAddressFromParamsArgs, ) { const encoder = IBASE_TOKEN_MANAGER_ENCODERS["getTokenAddressFromParams"]; const encodedArgs = encoder.args(getTokenAddressFromParamsArgs); diff --git a/packages/evm/src/contracts/its/IBaseTokenManager/index.ts b/packages/evm/src/contracts/its/IBaseTokenManager/index.ts index 0dc0f870e..a444769ec 100644 --- a/packages/evm/src/contracts/its/IBaseTokenManager/index.ts +++ b/packages/evm/src/contracts/its/IBaseTokenManager/index.ts @@ -49,7 +49,7 @@ export class IBaseTokenManagerClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/IERC20Named/IERC20Named.args.ts b/packages/evm/src/contracts/its/IERC20Named/IERC20Named.args.ts index b01f74ef6..cd323cb75 100644 --- a/packages/evm/src/contracts/its/IERC20Named/IERC20Named.args.ts +++ b/packages/evm/src/contracts/its/IERC20Named/IERC20Named.args.ts @@ -162,7 +162,7 @@ export const IERC20_NAMED_ENCODERS = { }; export function createIERC20NamedReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { allowance(allowanceArgs: IERC20NamedAllowanceArgs) { diff --git a/packages/evm/src/contracts/its/IERC20Named/index.ts b/packages/evm/src/contracts/its/IERC20Named/index.ts index 608079e5e..af4324738 100644 --- a/packages/evm/src/contracts/its/IERC20Named/index.ts +++ b/packages/evm/src/contracts/its/IERC20Named/index.ts @@ -49,7 +49,7 @@ export class IERC20NamedClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/IFlowLimit/IFlowLimit.args.ts b/packages/evm/src/contracts/its/IFlowLimit/IFlowLimit.args.ts index 30c9e02dd..4213aa589 100644 --- a/packages/evm/src/contracts/its/IFlowLimit/IFlowLimit.args.ts +++ b/packages/evm/src/contracts/its/IFlowLimit/IFlowLimit.args.ts @@ -9,11 +9,12 @@ */ import type { PublicContractClient } from "../../PublicContractClient"; +import ABI_FILE from "./IFlowLimit.abi"; export const IFLOW_LIMIT_ENCODERS = {}; export function createIFlowLimitReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { flowInAmount() { diff --git a/packages/evm/src/contracts/its/IFlowLimit/index.ts b/packages/evm/src/contracts/its/IFlowLimit/index.ts index 38f805bad..b9f7f63c6 100644 --- a/packages/evm/src/contracts/its/IFlowLimit/index.ts +++ b/packages/evm/src/contracts/its/IFlowLimit/index.ts @@ -49,7 +49,7 @@ export class IFlowLimitClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/IGatewayCaller/index.ts b/packages/evm/src/contracts/its/IGatewayCaller/index.ts index 05a42a4b2..e9cbf2f5a 100644 --- a/packages/evm/src/contracts/its/IGatewayCaller/index.ts +++ b/packages/evm/src/contracts/its/IGatewayCaller/index.ts @@ -31,7 +31,9 @@ export const IGATEWAY_CALLER_ABI = ABI_FILE.abi; * address: "0x1234..." * }); */ -export class IGatewayCallerClient extends PublicContractClient { +export class IGatewayCallerClient extends PublicContractClient< + typeof ABI_FILE.abi +> { static ABI = ABI_FILE.abi; static contractName = ABI_FILE.contractName; diff --git a/packages/evm/src/contracts/its/IInterchainToken/IInterchainToken.args.ts b/packages/evm/src/contracts/its/IInterchainToken/IInterchainToken.args.ts index 443de3f68..a0c1b8f5c 100644 --- a/packages/evm/src/contracts/its/IInterchainToken/IInterchainToken.args.ts +++ b/packages/evm/src/contracts/its/IInterchainToken/IInterchainToken.args.ts @@ -468,7 +468,7 @@ export const IINTERCHAIN_TOKEN_ENCODERS = { }; export function createIInterchainTokenReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { allowance(allowanceArgs: IInterchainTokenAllowanceArgs) { diff --git a/packages/evm/src/contracts/its/IInterchainToken/index.ts b/packages/evm/src/contracts/its/IInterchainToken/index.ts index cca294e41..8e8f0929e 100644 --- a/packages/evm/src/contracts/its/IInterchainToken/index.ts +++ b/packages/evm/src/contracts/its/IInterchainToken/index.ts @@ -49,7 +49,7 @@ export class IInterchainTokenClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/IInterchainTokenDeployer/IInterchainTokenDeployer.args.ts b/packages/evm/src/contracts/its/IInterchainTokenDeployer/IInterchainTokenDeployer.args.ts index 784c468ac..e8f54991d 100644 --- a/packages/evm/src/contracts/its/IInterchainTokenDeployer/IInterchainTokenDeployer.args.ts +++ b/packages/evm/src/contracts/its/IInterchainTokenDeployer/IInterchainTokenDeployer.args.ts @@ -87,11 +87,11 @@ export const IINTERCHAIN_TOKEN_DEPLOYER_ENCODERS = { }; export function createIInterchainTokenDeployerReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { deployedAddress( - deployedAddressArgs: IInterchainTokenDeployerDeployedAddressArgs + deployedAddressArgs: IInterchainTokenDeployerDeployedAddressArgs, ) { const encoder = IINTERCHAIN_TOKEN_DEPLOYER_ENCODERS["deployedAddress"]; const encodedArgs = encoder.args(deployedAddressArgs); diff --git a/packages/evm/src/contracts/its/IInterchainTokenDeployer/index.ts b/packages/evm/src/contracts/its/IInterchainTokenDeployer/index.ts index dcff64cd1..d9b78cec2 100644 --- a/packages/evm/src/contracts/its/IInterchainTokenDeployer/index.ts +++ b/packages/evm/src/contracts/its/IInterchainTokenDeployer/index.ts @@ -49,7 +49,7 @@ export class IInterchainTokenDeployerClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/IInterchainTokenFactory/IInterchainTokenFactory.abi.ts b/packages/evm/src/contracts/its/IInterchainTokenFactory/IInterchainTokenFactory.abi.ts index 77b71e8f9..36d2170e9 100644 --- a/packages/evm/src/contracts/its/IInterchainTokenFactory/IInterchainTokenFactory.abi.ts +++ b/packages/evm/src/contracts/its/IInterchainTokenFactory/IInterchainTokenFactory.abi.ts @@ -80,55 +80,49 @@ export default { type: "error", }, { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "NotOperator", + inputs: [], + name: "NotOwner", type: "error", }, { inputs: [], - name: "NotOwner", + name: "NotProxy", type: "error", }, { inputs: [], - name: "NotProxy", + name: "NotSupported", type: "error", }, { inputs: [ { internalType: "address", - name: "sender", + name: "tokenAddress", type: "address", }, ], - name: "NotServiceOwner", + name: "NotToken", type: "error", }, { inputs: [], - name: "NotSupported", + name: "RemoteDeploymentNotApproved", type: "error", }, { inputs: [], - name: "RemoteDeploymentNotApproved", + name: "SetupFailed", type: "error", }, { inputs: [], - name: "SetupFailed", + name: "ZeroAddress", type: "error", }, { inputs: [], - name: "ZeroAddress", + name: "ZeroSupplyToken", type: "error", }, { @@ -446,21 +440,11 @@ export default { }, { inputs: [ - { - internalType: "string", - name: "originalChainName", - type: "string", - }, { internalType: "bytes32", name: "salt", type: "bytes32", }, - { - internalType: "address", - name: "minter", - type: "address", - }, { internalType: "string", name: "destinationChain", @@ -485,6 +469,11 @@ export default { }, { inputs: [ + { + internalType: "string", + name: "originalChainName", + type: "string", + }, { internalType: "bytes32", name: "salt", @@ -630,6 +619,98 @@ export default { stateMutability: "view", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "string", + name: "destinationChain", + type: "string", + }, + { + internalType: "bytes", + name: "destinationTokenAddress", + type: "bytes", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "bytes", + name: "linkParams", + type: "bytes", + }, + { + internalType: "uint256", + name: "gasValue", + type: "uint256", + }, + ], + name: "linkToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "deployer", + type: "address", + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + ], + name: "linkedTokenDeploySalt", + outputs: [ + { + internalType: "bytes32", + name: "deploySalt", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "deployer", + type: "address", + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + ], + name: "linkedTokenId", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, { inputs: [ { @@ -707,6 +788,40 @@ export default { stateMutability: "payable", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + name: "registerCustomToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, { inputs: [ { diff --git a/packages/evm/src/contracts/its/IInterchainTokenFactory/IInterchainTokenFactory.args.ts b/packages/evm/src/contracts/its/IInterchainTokenFactory/IInterchainTokenFactory.args.ts index 8478601b1..5881994e5 100644 --- a/packages/evm/src/contracts/its/IInterchainTokenFactory/IInterchainTokenFactory.args.ts +++ b/packages/evm/src/contracts/its/IInterchainTokenFactory/IInterchainTokenFactory.args.ts @@ -137,7 +137,7 @@ export const encodeIInterchainTokenFactoryDeployInterchainTokenData = ({ args: [salt, name, symbol, decimals, initialSupply, minter], }); -export type IInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs = { +export type IInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs2 = { originalChain: string; originalTokenAddress: `0x${string}`; destinationChain: string; @@ -147,32 +147,94 @@ export type IInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs = { /** * Factory function for IInterchainTokenFactory.deployRemoteCanonicalInterchainToken function args */ -export const encodeIInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs = +export const encodeIInterchainTokenFactoryDeployRemoteCanonicalInterchainToken2Args = ({ originalChain, originalTokenAddress, destinationChain, gasValue, - }: IInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs) => + }: IInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs2) => [originalChain, originalTokenAddress, destinationChain, gasValue] as const; /** * Encoder function for IInterchainTokenFactory.deployRemoteCanonicalInterchainToken function data */ -export const encodeIInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenData = +export const encodeIInterchainTokenFactoryDeployRemoteCanonicalInterchainToken2Data = ({ originalChain, originalTokenAddress, destinationChain, gasValue, - }: IInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs): `0x${string}` => + }: IInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs2): `0x${string}` => encodeFunctionData({ functionName: "deployRemoteCanonicalInterchainToken", abi: ABI_FILE.abi, args: [originalChain, originalTokenAddress, destinationChain, gasValue], }); +export type IInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs = { + originalTokenAddress: `0x${string}`; + destinationChain: string; + gasValue: bigint; +}; + +/** + * Factory function for IInterchainTokenFactory.deployRemoteCanonicalInterchainToken function args + */ +export const encodeIInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs = + ({ + originalTokenAddress, + destinationChain, + gasValue, + }: IInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs) => + [originalTokenAddress, destinationChain, gasValue] as const; + +/** + * Encoder function for IInterchainTokenFactory.deployRemoteCanonicalInterchainToken function data + */ +export const encodeIInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenData = + ({ + originalTokenAddress, + destinationChain, + gasValue, + }: IInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "deployRemoteCanonicalInterchainToken", + abi: ABI_FILE.abi, + args: [originalTokenAddress, destinationChain, gasValue], + }); + export type IInterchainTokenFactoryDeployRemoteInterchainTokenArgs = { + salt: `0x${string}`; + destinationChain: string; + gasValue: bigint; +}; + +/** + * Factory function for IInterchainTokenFactory.deployRemoteInterchainToken function args + */ +export const encodeIInterchainTokenFactoryDeployRemoteInterchainTokenArgs = ({ + salt, + destinationChain, + gasValue, +}: IInterchainTokenFactoryDeployRemoteInterchainTokenArgs) => + [salt, destinationChain, gasValue] as const; + +/** + * Encoder function for IInterchainTokenFactory.deployRemoteInterchainToken function data + */ +export const encodeIInterchainTokenFactoryDeployRemoteInterchainTokenData = ({ + salt, + destinationChain, + gasValue, +}: IInterchainTokenFactoryDeployRemoteInterchainTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "deployRemoteInterchainToken", + abi: ABI_FILE.abi, + args: [salt, destinationChain, gasValue], + }); + +export type IInterchainTokenFactoryDeployRemoteInterchainTokenArgs2 = { originalChainName: string; salt: `0x${string}`; minter: `0x${string}`; @@ -183,25 +245,25 @@ export type IInterchainTokenFactoryDeployRemoteInterchainTokenArgs = { /** * Factory function for IInterchainTokenFactory.deployRemoteInterchainToken function args */ -export const encodeIInterchainTokenFactoryDeployRemoteInterchainTokenArgs = ({ +export const encodeIInterchainTokenFactoryDeployRemoteInterchainToken2Args = ({ originalChainName, salt, minter, destinationChain, gasValue, -}: IInterchainTokenFactoryDeployRemoteInterchainTokenArgs) => +}: IInterchainTokenFactoryDeployRemoteInterchainTokenArgs2) => [originalChainName, salt, minter, destinationChain, gasValue] as const; /** * Encoder function for IInterchainTokenFactory.deployRemoteInterchainToken function data */ -export const encodeIInterchainTokenFactoryDeployRemoteInterchainTokenData = ({ +export const encodeIInterchainTokenFactoryDeployRemoteInterchainToken2Data = ({ originalChainName, salt, minter, destinationChain, gasValue, -}: IInterchainTokenFactoryDeployRemoteInterchainTokenArgs): `0x${string}` => +}: IInterchainTokenFactoryDeployRemoteInterchainTokenArgs2): `0x${string}` => encodeFunctionData({ functionName: "deployRemoteInterchainToken", abi: ABI_FILE.abi, @@ -299,6 +361,112 @@ export const encodeIInterchainTokenFactoryInterchainTokenIdData = ({ args: [deployer, salt], }); +export type IInterchainTokenFactoryLinkTokenArgs = { + salt: `0x${string}`; + destinationChain: string; + destinationTokenAddress: `0x${string}`; + tokenManagerType: number; + linkParams: `0x${string}`; + gasValue: bigint; +}; + +/** + * Factory function for IInterchainTokenFactory.linkToken function args + */ +export const encodeIInterchainTokenFactoryLinkTokenArgs = ({ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, +}: IInterchainTokenFactoryLinkTokenArgs) => + [ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, + ] as const; + +/** + * Encoder function for IInterchainTokenFactory.linkToken function data + */ +export const encodeIInterchainTokenFactoryLinkTokenData = ({ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, +}: IInterchainTokenFactoryLinkTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "linkToken", + abi: ABI_FILE.abi, + args: [ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, + ], + }); + +export type IInterchainTokenFactoryLinkedTokenDeploySaltArgs = { + deployer: `0x${string}`; + salt: `0x${string}`; +}; + +/** + * Factory function for IInterchainTokenFactory.linkedTokenDeploySalt function args + */ +export const encodeIInterchainTokenFactoryLinkedTokenDeploySaltArgs = ({ + deployer, + salt, +}: IInterchainTokenFactoryLinkedTokenDeploySaltArgs) => + [deployer, salt] as const; + +/** + * Encoder function for IInterchainTokenFactory.linkedTokenDeploySalt function data + */ +export const encodeIInterchainTokenFactoryLinkedTokenDeploySaltData = ({ + deployer, + salt, +}: IInterchainTokenFactoryLinkedTokenDeploySaltArgs): `0x${string}` => + encodeFunctionData({ + functionName: "linkedTokenDeploySalt", + abi: ABI_FILE.abi, + args: [deployer, salt], + }); + +export type IInterchainTokenFactoryLinkedTokenIdArgs = { + deployer: `0x${string}`; + salt: `0x${string}`; +}; + +/** + * Factory function for IInterchainTokenFactory.linkedTokenId function args + */ +export const encodeIInterchainTokenFactoryLinkedTokenIdArgs = ({ + deployer, + salt, +}: IInterchainTokenFactoryLinkedTokenIdArgs) => [deployer, salt] as const; + +/** + * Encoder function for IInterchainTokenFactory.linkedTokenId function data + */ +export const encodeIInterchainTokenFactoryLinkedTokenIdData = ({ + deployer, + salt, +}: IInterchainTokenFactoryLinkedTokenIdArgs): `0x${string}` => + encodeFunctionData({ + functionName: "linkedTokenId", + abi: ABI_FILE.abi, + args: [deployer, salt], + }); + export type IInterchainTokenFactoryMulticallArgs = { data: any }; /** @@ -369,6 +537,39 @@ export const encodeIInterchainTokenFactoryRegisterCanonicalInterchainTokenData = args: [tokenAddress], }); +export type IInterchainTokenFactoryRegisterCustomTokenArgs = { + salt: `0x${string}`; + tokenAddress: `0x${string}`; + tokenManagerType: number; + operator: `0x${string}`; +}; + +/** + * Factory function for IInterchainTokenFactory.registerCustomToken function args + */ +export const encodeIInterchainTokenFactoryRegisterCustomTokenArgs = ({ + salt, + tokenAddress, + tokenManagerType, + operator, +}: IInterchainTokenFactoryRegisterCustomTokenArgs) => + [salt, tokenAddress, tokenManagerType, operator] as const; + +/** + * Encoder function for IInterchainTokenFactory.registerCustomToken function data + */ +export const encodeIInterchainTokenFactoryRegisterCustomTokenData = ({ + salt, + tokenAddress, + tokenManagerType, + operator, +}: IInterchainTokenFactoryRegisterCustomTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "registerCustomToken", + abi: ABI_FILE.abi, + args: [salt, tokenAddress, tokenManagerType, operator], + }); + export type IInterchainTokenFactoryRevokeDeployRemoteInterchainTokenArgs = { deployer: `0x${string}`; salt: `0x${string}`; @@ -492,6 +693,10 @@ export const IINTERCHAIN_TOKEN_FACTORY_ENCODERS = { args: encodeIInterchainTokenFactoryDeployInterchainTokenArgs, data: encodeIInterchainTokenFactoryDeployInterchainTokenData, }, + deployRemoteCanonicalInterchainToken2: { + args: encodeIInterchainTokenFactoryDeployRemoteCanonicalInterchainToken2Args, + data: encodeIInterchainTokenFactoryDeployRemoteCanonicalInterchainToken2Data, + }, deployRemoteCanonicalInterchainToken: { args: encodeIInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs, data: encodeIInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenData, @@ -500,6 +705,10 @@ export const IINTERCHAIN_TOKEN_FACTORY_ENCODERS = { args: encodeIInterchainTokenFactoryDeployRemoteInterchainTokenArgs, data: encodeIInterchainTokenFactoryDeployRemoteInterchainTokenData, }, + deployRemoteInterchainToken2: { + args: encodeIInterchainTokenFactoryDeployRemoteInterchainToken2Args, + data: encodeIInterchainTokenFactoryDeployRemoteInterchainToken2Data, + }, deployRemoteInterchainTokenWithMinter: { args: encodeIInterchainTokenFactoryDeployRemoteInterchainTokenWithMinterArgs, data: encodeIInterchainTokenFactoryDeployRemoteInterchainTokenWithMinterData, @@ -512,6 +721,18 @@ export const IINTERCHAIN_TOKEN_FACTORY_ENCODERS = { args: encodeIInterchainTokenFactoryInterchainTokenIdArgs, data: encodeIInterchainTokenFactoryInterchainTokenIdData, }, + linkToken: { + args: encodeIInterchainTokenFactoryLinkTokenArgs, + data: encodeIInterchainTokenFactoryLinkTokenData, + }, + linkedTokenDeploySalt: { + args: encodeIInterchainTokenFactoryLinkedTokenDeploySaltArgs, + data: encodeIInterchainTokenFactoryLinkedTokenDeploySaltData, + }, + linkedTokenId: { + args: encodeIInterchainTokenFactoryLinkedTokenIdArgs, + data: encodeIInterchainTokenFactoryLinkedTokenIdData, + }, multicall: { args: encodeIInterchainTokenFactoryMulticallArgs, data: encodeIInterchainTokenFactoryMulticallData, @@ -524,6 +745,10 @@ export const IINTERCHAIN_TOKEN_FACTORY_ENCODERS = { args: encodeIInterchainTokenFactoryRegisterCanonicalInterchainTokenArgs, data: encodeIInterchainTokenFactoryRegisterCanonicalInterchainTokenData, }, + registerCustomToken: { + args: encodeIInterchainTokenFactoryRegisterCustomTokenArgs, + data: encodeIInterchainTokenFactoryRegisterCustomTokenData, + }, revokeDeployRemoteInterchainToken: { args: encodeIInterchainTokenFactoryRevokeDeployRemoteInterchainTokenArgs, data: encodeIInterchainTokenFactoryRevokeDeployRemoteInterchainTokenData, @@ -543,11 +768,11 @@ export const IINTERCHAIN_TOKEN_FACTORY_ENCODERS = { }; export function createIInterchainTokenFactoryReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { canonicalInterchainTokenDeploySalt( - canonicalInterchainTokenDeploySaltArgs: IInterchainTokenFactoryCanonicalInterchainTokenDeploySaltArgs + canonicalInterchainTokenDeploySaltArgs: IInterchainTokenFactoryCanonicalInterchainTokenDeploySaltArgs, ) { const encoder = IINTERCHAIN_TOKEN_FACTORY_ENCODERS[ @@ -560,7 +785,7 @@ export function createIInterchainTokenFactoryReadClient( }); }, canonicalInterchainTokenId( - canonicalInterchainTokenIdArgs: IInterchainTokenFactoryCanonicalInterchainTokenIdArgs + canonicalInterchainTokenIdArgs: IInterchainTokenFactoryCanonicalInterchainTokenIdArgs, ) { const encoder = IINTERCHAIN_TOKEN_FACTORY_ENCODERS["canonicalInterchainTokenId"]; @@ -580,7 +805,7 @@ export function createIInterchainTokenFactoryReadClient( return publicClient.read("implementation"); }, interchainTokenDeploySalt( - interchainTokenDeploySaltArgs: IInterchainTokenFactoryInterchainTokenDeploySaltArgs + interchainTokenDeploySaltArgs: IInterchainTokenFactoryInterchainTokenDeploySaltArgs, ) { const encoder = IINTERCHAIN_TOKEN_FACTORY_ENCODERS["interchainTokenDeploySalt"]; @@ -591,7 +816,7 @@ export function createIInterchainTokenFactoryReadClient( }); }, interchainTokenId( - interchainTokenIdArgs: IInterchainTokenFactoryInterchainTokenIdArgs + interchainTokenIdArgs: IInterchainTokenFactoryInterchainTokenIdArgs, ) { const encoder = IINTERCHAIN_TOKEN_FACTORY_ENCODERS["interchainTokenId"]; const encodedArgs = encoder.args(interchainTokenIdArgs); @@ -601,6 +826,21 @@ export function createIInterchainTokenFactoryReadClient( interchainTokenService() { return publicClient.read("interchainTokenService"); }, + linkedTokenDeploySalt( + linkedTokenDeploySaltArgs: IInterchainTokenFactoryLinkedTokenDeploySaltArgs, + ) { + const encoder = + IINTERCHAIN_TOKEN_FACTORY_ENCODERS["linkedTokenDeploySalt"]; + const encodedArgs = encoder.args(linkedTokenDeploySaltArgs); + + return publicClient.read("linkedTokenDeploySalt", { args: encodedArgs }); + }, + linkedTokenId(linkedTokenIdArgs: IInterchainTokenFactoryLinkedTokenIdArgs) { + const encoder = IINTERCHAIN_TOKEN_FACTORY_ENCODERS["linkedTokenId"]; + const encodedArgs = encoder.args(linkedTokenIdArgs); + + return publicClient.read("linkedTokenId", { args: encodedArgs }); + }, owner() { return publicClient.read("owner"); }, diff --git a/packages/evm/src/contracts/its/IInterchainTokenFactory/index.ts b/packages/evm/src/contracts/its/IInterchainTokenFactory/index.ts index 547f0a5b9..875759899 100644 --- a/packages/evm/src/contracts/its/IInterchainTokenFactory/index.ts +++ b/packages/evm/src/contracts/its/IInterchainTokenFactory/index.ts @@ -49,7 +49,7 @@ export class IInterchainTokenFactoryClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/IInterchainTokenService/IInterchainTokenService.abi.ts b/packages/evm/src/contracts/its/IInterchainTokenService/IInterchainTokenService.abi.ts index 6ea30335f..c8c980dce 100644 --- a/packages/evm/src/contracts/its/IInterchainTokenService/IInterchainTokenService.abi.ts +++ b/packages/evm/src/contracts/its/IInterchainTokenService/IInterchainTokenService.abi.ts @@ -47,6 +47,11 @@ export default { name: "EmptyParams", type: "error", }, + { + inputs: [], + name: "EmptyTokenAddress", + type: "error", + }, { inputs: [], name: "EmptyTokenName", @@ -206,17 +211,6 @@ export default { name: "InvalidProposedRoles", type: "error", }, - { - inputs: [ - { - internalType: "address", - name: "implementation", - type: "address", - }, - ], - name: "InvalidTokenManagerImplementationType", - type: "error", - }, { inputs: [], name: "LengthMismatch", @@ -280,6 +274,17 @@ export default { name: "NotApprovedByGateway", type: "error", }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address", + }, + ], + name: "NotInterchainTokenFactory", + type: "error", + }, { inputs: [], name: "NotOwner", @@ -667,6 +672,49 @@ export default { name: "InterchainTransferReceived", type: "event", }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + { + indexed: false, + internalType: "string", + name: "destinationChain", + type: "string", + }, + { + indexed: false, + internalType: "bytes", + name: "sourceTokenAddress", + type: "bytes", + }, + { + indexed: false, + internalType: "bytes", + name: "destinationTokenAddress", + type: "bytes", + }, + { + indexed: true, + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + indexed: false, + internalType: "bytes", + name: "params", + type: "bytes", + }, + ], + name: "LinkTokenStarted", + type: "event", + }, { anonymous: false, inputs: [ @@ -805,30 +853,18 @@ export default { inputs: [ { indexed: true, - internalType: "bytes32", - name: "tokenId", - type: "bytes32", + internalType: "address", + name: "tokenAddress", + type: "address", }, { indexed: false, - internalType: "string", - name: "destinationChain", - type: "string", - }, - { - indexed: true, - internalType: "enum ITokenManagerType.TokenManagerType", - name: "tokenManagerType", + internalType: "uint8", + name: "decimals", type: "uint8", }, - { - indexed: false, - internalType: "bytes", - name: "params", - type: "bytes", - }, ], - name: "TokenManagerDeploymentStarted", + name: "TokenMetadataRegistered", type: "event", }, { @@ -909,44 +945,6 @@ export default { stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - { - internalType: "string", - name: "destinationChain", - type: "string", - }, - { - internalType: "bytes", - name: "destinationAddress", - type: "bytes", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "uint256", - name: "gasValue", - type: "uint256", - }, - ], - name: "callContractWithInterchainToken", - outputs: [], - stateMutability: "payable", - type: "function", - }, { inputs: [], name: "chainName", @@ -1069,45 +1067,6 @@ export default { stateMutability: "payable", type: "function", }, - { - inputs: [ - { - internalType: "bytes32", - name: "salt", - type: "bytes32", - }, - { - internalType: "string", - name: "destinationChain", - type: "string", - }, - { - internalType: "enum ITokenManagerType.TokenManagerType", - name: "tokenManagerType", - type: "uint8", - }, - { - internalType: "bytes", - name: "params", - type: "bytes", - }, - { - internalType: "uint256", - name: "gasValue", - type: "uint256", - }, - ], - name: "deployTokenManager", - outputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - stateMutability: "payable", - type: "function", - }, { inputs: [ { @@ -1183,63 +1142,6 @@ export default { stateMutability: "payable", type: "function", }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - name: "flowInAmount", - outputs: [ - { - internalType: "uint256", - name: "flowInAmount_", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - name: "flowLimit", - outputs: [ - { - internalType: "uint256", - name: "flowLimit_", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - name: "flowOutAmount", - outputs: [ - { - internalType: "uint256", - name: "flowOutAmount_", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, { inputs: [], name: "gateway", @@ -1474,6 +1376,63 @@ export default { stateMutability: "view", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "string", + name: "destinationChain", + type: "string", + }, + { + internalType: "bytes", + name: "destinationTokenAddress", + type: "bytes", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "bytes", + name: "linkParams", + type: "bytes", + }, + { + internalType: "uint256", + name: "gasValue", + type: "uint256", + }, + ], + name: "linkToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + name: "migrateInterchainToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [ { @@ -1558,6 +1517,58 @@ export default { stateMutability: "nonpayable", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "bytes", + name: "linkParams", + type: "bytes", + }, + ], + name: "registerCustomToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "uint256", + name: "gasValue", + type: "uint256", + }, + ], + name: "registerTokenMetadata", + outputs: [], + stateMutability: "payable", + type: "function", + }, { inputs: [ { diff --git a/packages/evm/src/contracts/its/IInterchainTokenService/IInterchainTokenService.args.ts b/packages/evm/src/contracts/its/IInterchainTokenService/IInterchainTokenService.args.ts index a57589fec..84b593606 100644 --- a/packages/evm/src/contracts/its/IInterchainTokenService/IInterchainTokenService.args.ts +++ b/packages/evm/src/contracts/its/IInterchainTokenService/IInterchainTokenService.args.ts @@ -36,61 +36,6 @@ export const encodeIInterchainTokenServiceAcceptOperatorshipData = ({ args: [fromOperator], }); -export type IInterchainTokenServiceCallContractWithInterchainTokenArgs = { - tokenId: `0x${string}`; - destinationChain: string; - destinationAddress: `0x${string}`; - amount: bigint; - data: `0x${string}`; - gasValue: bigint; -}; - -/** - * Factory function for IInterchainTokenService.callContractWithInterchainToken function args - */ -export const encodeIInterchainTokenServiceCallContractWithInterchainTokenArgs = - ({ - tokenId, - destinationChain, - destinationAddress, - amount, - data, - gasValue, - }: IInterchainTokenServiceCallContractWithInterchainTokenArgs) => - [ - tokenId, - destinationChain, - destinationAddress, - amount, - data, - gasValue, - ] as const; - -/** - * Encoder function for IInterchainTokenService.callContractWithInterchainToken function data - */ -export const encodeIInterchainTokenServiceCallContractWithInterchainTokenData = - ({ - tokenId, - destinationChain, - destinationAddress, - amount, - data, - gasValue, - }: IInterchainTokenServiceCallContractWithInterchainTokenArgs): `0x${string}` => - encodeFunctionData({ - functionName: "callContractWithInterchainToken", - abi: ABI_FILE.abi, - args: [ - tokenId, - destinationChain, - destinationAddress, - amount, - data, - gasValue, - ], - }); - export type IInterchainTokenServiceContractCallValueArgs = { sourceChain: string; sourceAddress: string; @@ -163,42 +108,6 @@ export const encodeIInterchainTokenServiceDeployInterchainTokenData = ({ args: [salt, destinationChain, name, symbol, decimals, minter, gasValue], }); -export type IInterchainTokenServiceDeployTokenManagerArgs = { - salt: `0x${string}`; - destinationChain: string; - tokenManagerType: number; - params: `0x${string}`; - gasValue: bigint; -}; - -/** - * Factory function for IInterchainTokenService.deployTokenManager function args - */ -export const encodeIInterchainTokenServiceDeployTokenManagerArgs = ({ - salt, - destinationChain, - tokenManagerType, - params, - gasValue, -}: IInterchainTokenServiceDeployTokenManagerArgs) => - [salt, destinationChain, tokenManagerType, params, gasValue] as const; - -/** - * Encoder function for IInterchainTokenService.deployTokenManager function data - */ -export const encodeIInterchainTokenServiceDeployTokenManagerData = ({ - salt, - destinationChain, - tokenManagerType, - params, - gasValue, -}: IInterchainTokenServiceDeployTokenManagerArgs): `0x${string}` => - encodeFunctionData({ - functionName: "deployTokenManager", - abi: ABI_FILE.abi, - args: [salt, destinationChain, tokenManagerType, params, gasValue], - }); - export type IInterchainTokenServiceDeployedTokenManagerArgs = { tokenId: `0x${string}`; }; @@ -288,73 +197,6 @@ export const encodeIInterchainTokenServiceExpressExecuteData = ({ args: [commandId, sourceChain, sourceAddress, payload], }); -export type IInterchainTokenServiceFlowInAmountArgs = { - tokenId: `0x${string}`; -}; - -/** - * Factory function for IInterchainTokenService.flowInAmount function args - */ -export const encodeIInterchainTokenServiceFlowInAmountArgs = ({ - tokenId, -}: IInterchainTokenServiceFlowInAmountArgs) => [tokenId] as const; - -/** - * Encoder function for IInterchainTokenService.flowInAmount function data - */ -export const encodeIInterchainTokenServiceFlowInAmountData = ({ - tokenId, -}: IInterchainTokenServiceFlowInAmountArgs): `0x${string}` => - encodeFunctionData({ - functionName: "flowInAmount", - abi: ABI_FILE.abi, - args: [tokenId], - }); - -export type IInterchainTokenServiceFlowLimitArgs = { tokenId: `0x${string}` }; - -/** - * Factory function for IInterchainTokenService.flowLimit function args - */ -export const encodeIInterchainTokenServiceFlowLimitArgs = ({ - tokenId, -}: IInterchainTokenServiceFlowLimitArgs) => [tokenId] as const; - -/** - * Encoder function for IInterchainTokenService.flowLimit function data - */ -export const encodeIInterchainTokenServiceFlowLimitData = ({ - tokenId, -}: IInterchainTokenServiceFlowLimitArgs): `0x${string}` => - encodeFunctionData({ - functionName: "flowLimit", - abi: ABI_FILE.abi, - args: [tokenId], - }); - -export type IInterchainTokenServiceFlowOutAmountArgs = { - tokenId: `0x${string}`; -}; - -/** - * Factory function for IInterchainTokenService.flowOutAmount function args - */ -export const encodeIInterchainTokenServiceFlowOutAmountArgs = ({ - tokenId, -}: IInterchainTokenServiceFlowOutAmountArgs) => [tokenId] as const; - -/** - * Encoder function for IInterchainTokenService.flowOutAmount function data - */ -export const encodeIInterchainTokenServiceFlowOutAmountData = ({ - tokenId, -}: IInterchainTokenServiceFlowOutAmountArgs): `0x${string}` => - encodeFunctionData({ - functionName: "flowOutAmount", - abi: ABI_FILE.abi, - args: [tokenId], - }); - export type IInterchainTokenServiceGetExpressExecutorArgs = { commandId: `0x${string}`; sourceChain: string; @@ -563,6 +405,82 @@ export const encodeIInterchainTokenServiceIsTrustedAddressData = ({ args: [chain, address_], }); +export type IInterchainTokenServiceLinkTokenArgs = { + salt: `0x${string}`; + destinationChain: string; + destinationTokenAddress: `0x${string}`; + tokenManagerType: number; + linkParams: `0x${string}`; + gasValue: bigint; +}; + +/** + * Factory function for IInterchainTokenService.linkToken function args + */ +export const encodeIInterchainTokenServiceLinkTokenArgs = ({ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, +}: IInterchainTokenServiceLinkTokenArgs) => + [ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, + ] as const; + +/** + * Encoder function for IInterchainTokenService.linkToken function data + */ +export const encodeIInterchainTokenServiceLinkTokenData = ({ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, +}: IInterchainTokenServiceLinkTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "linkToken", + abi: ABI_FILE.abi, + args: [ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, + ], + }); + +export type IInterchainTokenServiceMigrateInterchainTokenArgs = { + tokenId: `0x${string}`; +}; + +/** + * Factory function for IInterchainTokenService.migrateInterchainToken function args + */ +export const encodeIInterchainTokenServiceMigrateInterchainTokenArgs = ({ + tokenId, +}: IInterchainTokenServiceMigrateInterchainTokenArgs) => [tokenId] as const; + +/** + * Encoder function for IInterchainTokenService.migrateInterchainToken function data + */ +export const encodeIInterchainTokenServiceMigrateInterchainTokenData = ({ + tokenId, +}: IInterchainTokenServiceMigrateInterchainTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "migrateInterchainToken", + abi: ABI_FILE.abi, + args: [tokenId], + }); + export type IInterchainTokenServiceMulticallArgs = { data: any }; /** @@ -630,6 +548,66 @@ export const encodeIInterchainTokenServiceProposeOwnershipData = ({ args: [newOwner], }); +export type IInterchainTokenServiceRegisterCustomTokenArgs = { + salt: `0x${string}`; + tokenAddress: `0x${string}`; + tokenManagerType: number; + linkParams: `0x${string}`; +}; + +/** + * Factory function for IInterchainTokenService.registerCustomToken function args + */ +export const encodeIInterchainTokenServiceRegisterCustomTokenArgs = ({ + salt, + tokenAddress, + tokenManagerType, + linkParams, +}: IInterchainTokenServiceRegisterCustomTokenArgs) => + [salt, tokenAddress, tokenManagerType, linkParams] as const; + +/** + * Encoder function for IInterchainTokenService.registerCustomToken function data + */ +export const encodeIInterchainTokenServiceRegisterCustomTokenData = ({ + salt, + tokenAddress, + tokenManagerType, + linkParams, +}: IInterchainTokenServiceRegisterCustomTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "registerCustomToken", + abi: ABI_FILE.abi, + args: [salt, tokenAddress, tokenManagerType, linkParams], + }); + +export type IInterchainTokenServiceRegisterTokenMetadataArgs = { + tokenAddress: `0x${string}`; + gasValue: bigint; +}; + +/** + * Factory function for IInterchainTokenService.registerTokenMetadata function args + */ +export const encodeIInterchainTokenServiceRegisterTokenMetadataArgs = ({ + tokenAddress, + gasValue, +}: IInterchainTokenServiceRegisterTokenMetadataArgs) => + [tokenAddress, gasValue] as const; + +/** + * Encoder function for IInterchainTokenService.registerTokenMetadata function data + */ +export const encodeIInterchainTokenServiceRegisterTokenMetadataData = ({ + tokenAddress, + gasValue, +}: IInterchainTokenServiceRegisterTokenMetadataArgs): `0x${string}` => + encodeFunctionData({ + functionName: "registerTokenMetadata", + abi: ABI_FILE.abi, + args: [tokenAddress, gasValue], + }); + export type IInterchainTokenServiceRegisteredTokenAddressArgs = { tokenId: `0x${string}`; }; @@ -991,10 +969,6 @@ export const IINTERCHAIN_TOKEN_SERVICE_ENCODERS = { args: encodeIInterchainTokenServiceAcceptOperatorshipArgs, data: encodeIInterchainTokenServiceAcceptOperatorshipData, }, - callContractWithInterchainToken: { - args: encodeIInterchainTokenServiceCallContractWithInterchainTokenArgs, - data: encodeIInterchainTokenServiceCallContractWithInterchainTokenData, - }, contractCallValue: { args: encodeIInterchainTokenServiceContractCallValueArgs, data: encodeIInterchainTokenServiceContractCallValueData, @@ -1003,10 +977,6 @@ export const IINTERCHAIN_TOKEN_SERVICE_ENCODERS = { args: encodeIInterchainTokenServiceDeployInterchainTokenArgs, data: encodeIInterchainTokenServiceDeployInterchainTokenData, }, - deployTokenManager: { - args: encodeIInterchainTokenServiceDeployTokenManagerArgs, - data: encodeIInterchainTokenServiceDeployTokenManagerData, - }, deployedTokenManager: { args: encodeIInterchainTokenServiceDeployedTokenManagerArgs, data: encodeIInterchainTokenServiceDeployedTokenManagerData, @@ -1019,18 +989,6 @@ export const IINTERCHAIN_TOKEN_SERVICE_ENCODERS = { args: encodeIInterchainTokenServiceExpressExecuteArgs, data: encodeIInterchainTokenServiceExpressExecuteData, }, - flowInAmount: { - args: encodeIInterchainTokenServiceFlowInAmountArgs, - data: encodeIInterchainTokenServiceFlowInAmountData, - }, - flowLimit: { - args: encodeIInterchainTokenServiceFlowLimitArgs, - data: encodeIInterchainTokenServiceFlowLimitData, - }, - flowOutAmount: { - args: encodeIInterchainTokenServiceFlowOutAmountArgs, - data: encodeIInterchainTokenServiceFlowOutAmountData, - }, getExpressExecutor: { args: encodeIInterchainTokenServiceGetExpressExecutorArgs, data: encodeIInterchainTokenServiceGetExpressExecutorData, @@ -1059,6 +1017,14 @@ export const IINTERCHAIN_TOKEN_SERVICE_ENCODERS = { args: encodeIInterchainTokenServiceIsTrustedAddressArgs, data: encodeIInterchainTokenServiceIsTrustedAddressData, }, + linkToken: { + args: encodeIInterchainTokenServiceLinkTokenArgs, + data: encodeIInterchainTokenServiceLinkTokenData, + }, + migrateInterchainToken: { + args: encodeIInterchainTokenServiceMigrateInterchainTokenArgs, + data: encodeIInterchainTokenServiceMigrateInterchainTokenData, + }, multicall: { args: encodeIInterchainTokenServiceMulticallArgs, data: encodeIInterchainTokenServiceMulticallData, @@ -1071,6 +1037,14 @@ export const IINTERCHAIN_TOKEN_SERVICE_ENCODERS = { args: encodeIInterchainTokenServiceProposeOwnershipArgs, data: encodeIInterchainTokenServiceProposeOwnershipData, }, + registerCustomToken: { + args: encodeIInterchainTokenServiceRegisterCustomTokenArgs, + data: encodeIInterchainTokenServiceRegisterCustomTokenData, + }, + registerTokenMetadata: { + args: encodeIInterchainTokenServiceRegisterTokenMetadataArgs, + data: encodeIInterchainTokenServiceRegisterTokenMetadataData, + }, registeredTokenAddress: { args: encodeIInterchainTokenServiceRegisteredTokenAddressArgs, data: encodeIInterchainTokenServiceRegisteredTokenAddressData, @@ -1130,7 +1104,7 @@ export const IINTERCHAIN_TOKEN_SERVICE_ENCODERS = { }; export function createIInterchainTokenServiceReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { chainName() { @@ -1140,7 +1114,7 @@ export function createIInterchainTokenServiceReadClient( return publicClient.read("chainNameHash"); }, contractCallValue( - contractCallValueArgs: IInterchainTokenServiceContractCallValueArgs + contractCallValueArgs: IInterchainTokenServiceContractCallValueArgs, ) { const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["contractCallValue"]; const encodedArgs = encoder.args(contractCallValueArgs); @@ -1151,7 +1125,7 @@ export function createIInterchainTokenServiceReadClient( return publicClient.read("contractId"); }, deployedTokenManager( - deployedTokenManagerArgs: IInterchainTokenServiceDeployedTokenManagerArgs + deployedTokenManagerArgs: IInterchainTokenServiceDeployedTokenManagerArgs, ) { const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["deployedTokenManager"]; @@ -1159,29 +1133,11 @@ export function createIInterchainTokenServiceReadClient( return publicClient.read("deployedTokenManager", { args: encodedArgs }); }, - flowInAmount(flowInAmountArgs: IInterchainTokenServiceFlowInAmountArgs) { - const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["flowInAmount"]; - const encodedArgs = encoder.args(flowInAmountArgs); - - return publicClient.read("flowInAmount", { args: encodedArgs }); - }, - flowLimit(flowLimitArgs: IInterchainTokenServiceFlowLimitArgs) { - const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["flowLimit"]; - const encodedArgs = encoder.args(flowLimitArgs); - - return publicClient.read("flowLimit", { args: encodedArgs }); - }, - flowOutAmount(flowOutAmountArgs: IInterchainTokenServiceFlowOutAmountArgs) { - const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["flowOutAmount"]; - const encodedArgs = encoder.args(flowOutAmountArgs); - - return publicClient.read("flowOutAmount", { args: encodedArgs }); - }, gateway() { return publicClient.read("gateway"); }, getExpressExecutor( - getExpressExecutorArgs: IInterchainTokenServiceGetExpressExecutorArgs + getExpressExecutorArgs: IInterchainTokenServiceGetExpressExecutorArgs, ) { const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["getExpressExecutor"]; const encodedArgs = encoder.args(getExpressExecutorArgs); @@ -1198,7 +1154,7 @@ export function createIInterchainTokenServiceReadClient( return publicClient.read("implementation"); }, interchainTokenAddress( - interchainTokenAddressArgs: IInterchainTokenServiceInterchainTokenAddressArgs + interchainTokenAddressArgs: IInterchainTokenServiceInterchainTokenAddressArgs, ) { const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["interchainTokenAddress"]; @@ -1213,7 +1169,7 @@ export function createIInterchainTokenServiceReadClient( return publicClient.read("interchainTokenFactory"); }, interchainTokenId( - interchainTokenIdArgs: IInterchainTokenServiceInterchainTokenIdArgs + interchainTokenIdArgs: IInterchainTokenServiceInterchainTokenIdArgs, ) { const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["interchainTokenId"]; const encodedArgs = encoder.args(interchainTokenIdArgs); @@ -1227,7 +1183,7 @@ export function createIInterchainTokenServiceReadClient( return publicClient.read("isOperator", { args: encodedArgs }); }, isTrustedAddress( - isTrustedAddressArgs: IInterchainTokenServiceIsTrustedAddressArgs + isTrustedAddressArgs: IInterchainTokenServiceIsTrustedAddressArgs, ) { const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["isTrustedAddress"]; const encodedArgs = encoder.args(isTrustedAddressArgs); @@ -1244,7 +1200,7 @@ export function createIInterchainTokenServiceReadClient( return publicClient.read("pendingOwner"); }, registeredTokenAddress( - registeredTokenAddressArgs: IInterchainTokenServiceRegisteredTokenAddressArgs + registeredTokenAddressArgs: IInterchainTokenServiceRegisteredTokenAddressArgs, ) { const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["registeredTokenAddress"]; @@ -1259,7 +1215,7 @@ export function createIInterchainTokenServiceReadClient( return publicClient.read("tokenManager"); }, tokenManagerAddress( - tokenManagerAddressArgs: IInterchainTokenServiceTokenManagerAddressArgs + tokenManagerAddressArgs: IInterchainTokenServiceTokenManagerAddressArgs, ) { const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["tokenManagerAddress"]; const encodedArgs = encoder.args(tokenManagerAddressArgs); @@ -1270,7 +1226,7 @@ export function createIInterchainTokenServiceReadClient( return publicClient.read("tokenManagerDeployer"); }, tokenManagerImplementation( - tokenManagerImplementationArgs: IInterchainTokenServiceTokenManagerImplementationArgs + tokenManagerImplementationArgs: IInterchainTokenServiceTokenManagerImplementationArgs, ) { const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["tokenManagerImplementation"]; @@ -1281,7 +1237,7 @@ export function createIInterchainTokenServiceReadClient( }); }, trustedAddress( - trustedAddressArgs: IInterchainTokenServiceTrustedAddressArgs + trustedAddressArgs: IInterchainTokenServiceTrustedAddressArgs, ) { const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["trustedAddress"]; const encodedArgs = encoder.args(trustedAddressArgs); @@ -1289,7 +1245,7 @@ export function createIInterchainTokenServiceReadClient( return publicClient.read("trustedAddress", { args: encodedArgs }); }, trustedAddressHash( - trustedAddressHashArgs: IInterchainTokenServiceTrustedAddressHashArgs + trustedAddressHashArgs: IInterchainTokenServiceTrustedAddressHashArgs, ) { const encoder = IINTERCHAIN_TOKEN_SERVICE_ENCODERS["trustedAddressHash"]; const encodedArgs = encoder.args(trustedAddressHashArgs); diff --git a/packages/evm/src/contracts/its/IInterchainTokenService/index.ts b/packages/evm/src/contracts/its/IInterchainTokenService/index.ts index 89a38229d..264b03fd1 100644 --- a/packages/evm/src/contracts/its/IInterchainTokenService/index.ts +++ b/packages/evm/src/contracts/its/IInterchainTokenService/index.ts @@ -49,7 +49,7 @@ export class IInterchainTokenServiceClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/IMinter/IMinter.args.ts b/packages/evm/src/contracts/its/IMinter/IMinter.args.ts index 008760e28..022c91436 100644 --- a/packages/evm/src/contracts/its/IMinter/IMinter.args.ts +++ b/packages/evm/src/contracts/its/IMinter/IMinter.args.ts @@ -143,7 +143,7 @@ export const IMINTER_ENCODERS = { }; export function createIMinterReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { hasRole(hasRoleArgs: IMinterHasRoleArgs) { diff --git a/packages/evm/src/contracts/its/IOperator/IOperator.args.ts b/packages/evm/src/contracts/its/IOperator/IOperator.args.ts index c759d6f8b..0666aa9c4 100644 --- a/packages/evm/src/contracts/its/IOperator/IOperator.args.ts +++ b/packages/evm/src/contracts/its/IOperator/IOperator.args.ts @@ -144,7 +144,7 @@ export const IOPERATOR_ENCODERS = { }; export function createIOperatorReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { hasRole(hasRoleArgs: IOperatorHasRoleArgs) { diff --git a/packages/evm/src/contracts/its/ITokenHandler/ITokenHandler.abi.ts b/packages/evm/src/contracts/its/ITokenHandler/ITokenHandler.abi.ts index f5c72dcae..a4a88e9c0 100644 --- a/packages/evm/src/contracts/its/ITokenHandler/ITokenHandler.abi.ts +++ b/packages/evm/src/contracts/its/ITokenHandler/ITokenHandler.abi.ts @@ -80,7 +80,7 @@ export default { type: "uint256", }, { - internalType: "address", + internalType: "contract ITokenManager", name: "tokenManager", type: "address", }, diff --git a/packages/evm/src/contracts/its/ITokenManager/ITokenManager.args.ts b/packages/evm/src/contracts/its/ITokenManager/ITokenManager.args.ts index 5755396a2..9483f6ba7 100644 --- a/packages/evm/src/contracts/its/ITokenManager/ITokenManager.args.ts +++ b/packages/evm/src/contracts/its/ITokenManager/ITokenManager.args.ts @@ -446,7 +446,7 @@ export const ITOKEN_MANAGER_ENCODERS = { }; export function createITokenManagerReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { contractId() { @@ -462,7 +462,7 @@ export function createITokenManagerReadClient( return publicClient.read("flowOutAmount"); }, getTokenAddressFromParams( - getTokenAddressFromParamsArgs: ITokenManagerGetTokenAddressFromParamsArgs + getTokenAddressFromParamsArgs: ITokenManagerGetTokenAddressFromParamsArgs, ) { const encoder = ITOKEN_MANAGER_ENCODERS["getTokenAddressFromParams"]; const encodedArgs = encoder.args(getTokenAddressFromParamsArgs); diff --git a/packages/evm/src/contracts/its/ITokenManager/index.ts b/packages/evm/src/contracts/its/ITokenManager/index.ts index c9aa06845..0b34f13c0 100644 --- a/packages/evm/src/contracts/its/ITokenManager/index.ts +++ b/packages/evm/src/contracts/its/ITokenManager/index.ts @@ -49,7 +49,7 @@ export class ITokenManagerClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/ITokenManagerDeployer/ITokenManagerDeployer.abi.ts b/packages/evm/src/contracts/its/ITokenManagerDeployer/ITokenManagerDeployer.abi.ts index a643aca1e..d85df310e 100644 --- a/packages/evm/src/contracts/its/ITokenManagerDeployer/ITokenManagerDeployer.abi.ts +++ b/packages/evm/src/contracts/its/ITokenManagerDeployer/ITokenManagerDeployer.abi.ts @@ -11,11 +11,6 @@ export default { contractName: "ITokenManagerDeployer", abi: [ - { - inputs: [], - name: "AddressZero", - type: "error", - }, { inputs: [], name: "TokenManagerDeploymentFailed", diff --git a/packages/evm/src/contracts/its/ITokenManagerImplementation/ITokenManagerImplementation.args.ts b/packages/evm/src/contracts/its/ITokenManagerImplementation/ITokenManagerImplementation.args.ts index f56dcd9ff..fa0df836e 100644 --- a/packages/evm/src/contracts/its/ITokenManagerImplementation/ITokenManagerImplementation.args.ts +++ b/packages/evm/src/contracts/its/ITokenManagerImplementation/ITokenManagerImplementation.args.ts @@ -47,11 +47,11 @@ export const ITOKEN_MANAGER_IMPLEMENTATION_ENCODERS = { }; export function createITokenManagerImplementationReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { tokenManagerImplementation( - tokenManagerImplementationArgs: ITokenManagerImplementationTokenManagerImplementationArgs + tokenManagerImplementationArgs: ITokenManagerImplementationTokenManagerImplementationArgs, ) { const encoder = ITOKEN_MANAGER_IMPLEMENTATION_ENCODERS["tokenManagerImplementation"]; diff --git a/packages/evm/src/contracts/its/ITokenManagerProxy/ITokenManagerProxy.args.ts b/packages/evm/src/contracts/its/ITokenManagerProxy/ITokenManagerProxy.args.ts index 31ec6da44..38b7fa6b0 100644 --- a/packages/evm/src/contracts/its/ITokenManagerProxy/ITokenManagerProxy.args.ts +++ b/packages/evm/src/contracts/its/ITokenManagerProxy/ITokenManagerProxy.args.ts @@ -42,7 +42,7 @@ export const ITOKEN_MANAGER_PROXY_ENCODERS = { }; export function createITokenManagerProxyReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { getImplementationTypeAndTokenAddress() { diff --git a/packages/evm/src/contracts/its/ITokenManagerProxy/index.ts b/packages/evm/src/contracts/its/ITokenManagerProxy/index.ts index 848c4648f..3410afb30 100644 --- a/packages/evm/src/contracts/its/ITokenManagerProxy/index.ts +++ b/packages/evm/src/contracts/its/ITokenManagerProxy/index.ts @@ -49,7 +49,7 @@ export class ITokenManagerProxyClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/InterchainToken/InterchainToken.args.ts b/packages/evm/src/contracts/its/InterchainToken/InterchainToken.args.ts index 3764ebb44..970643630 100644 --- a/packages/evm/src/contracts/its/InterchainToken/InterchainToken.args.ts +++ b/packages/evm/src/contracts/its/InterchainToken/InterchainToken.args.ts @@ -603,7 +603,7 @@ export const INTERCHAIN_TOKEN_ENCODERS = { }; export function createInterchainTokenReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { DOMAIN_SEPARATOR() { diff --git a/packages/evm/src/contracts/its/InterchainToken/index.ts b/packages/evm/src/contracts/its/InterchainToken/index.ts index bd72f7ecd..a360337db 100644 --- a/packages/evm/src/contracts/its/InterchainToken/index.ts +++ b/packages/evm/src/contracts/its/InterchainToken/index.ts @@ -49,7 +49,7 @@ export class InterchainTokenClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/InterchainTokenFactory/InterchainTokenFactory.abi.ts b/packages/evm/src/contracts/its/InterchainTokenFactory/InterchainTokenFactory.abi.ts index e762a264f..e84038148 100644 --- a/packages/evm/src/contracts/its/InterchainTokenFactory/InterchainTokenFactory.abi.ts +++ b/packages/evm/src/contracts/its/InterchainTokenFactory/InterchainTokenFactory.abi.ts @@ -91,55 +91,49 @@ export default { type: "error", }, { - inputs: [ - { - internalType: "address", - name: "operator", - type: "address", - }, - ], - name: "NotOperator", + inputs: [], + name: "NotOwner", type: "error", }, { inputs: [], - name: "NotOwner", + name: "NotProxy", type: "error", }, { inputs: [], - name: "NotProxy", + name: "NotSupported", type: "error", }, { inputs: [ { internalType: "address", - name: "sender", + name: "tokenAddress", type: "address", }, ], - name: "NotServiceOwner", + name: "NotToken", type: "error", }, { inputs: [], - name: "NotSupported", + name: "RemoteDeploymentNotApproved", type: "error", }, { inputs: [], - name: "RemoteDeploymentNotApproved", + name: "SetupFailed", type: "error", }, { inputs: [], - name: "SetupFailed", + name: "ZeroAddress", type: "error", }, { inputs: [], - name: "ZeroAddress", + name: "ZeroSupplyToken", type: "error", }, { @@ -457,21 +451,11 @@ export default { }, { inputs: [ - { - internalType: "string", - name: "originalChainName", - type: "string", - }, { internalType: "bytes32", name: "salt", type: "bytes32", }, - { - internalType: "address", - name: "minter", - type: "address", - }, { internalType: "string", name: "destinationChain", @@ -496,6 +480,11 @@ export default { }, { inputs: [ + { + internalType: "string", + name: "originalChainName", + type: "string", + }, { internalType: "bytes32", name: "salt", @@ -641,6 +630,98 @@ export default { stateMutability: "view", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "string", + name: "destinationChain", + type: "string", + }, + { + internalType: "bytes", + name: "destinationTokenAddress", + type: "bytes", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "bytes", + name: "linkParams", + type: "bytes", + }, + { + internalType: "uint256", + name: "gasValue", + type: "uint256", + }, + ], + name: "linkToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "deployer", + type: "address", + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + ], + name: "linkedTokenDeploySalt", + outputs: [ + { + internalType: "bytes32", + name: "deploySalt", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "deployer", + type: "address", + }, + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + ], + name: "linkedTokenId", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "view", + type: "function", + }, { inputs: [ { @@ -718,6 +799,40 @@ export default { stateMutability: "payable", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "address", + name: "operator", + type: "address", + }, + ], + name: "registerCustomToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, { inputs: [ { diff --git a/packages/evm/src/contracts/its/InterchainTokenFactory/InterchainTokenFactory.args.ts b/packages/evm/src/contracts/its/InterchainTokenFactory/InterchainTokenFactory.args.ts index ad2174263..5826ffd28 100644 --- a/packages/evm/src/contracts/its/InterchainTokenFactory/InterchainTokenFactory.args.ts +++ b/packages/evm/src/contracts/its/InterchainTokenFactory/InterchainTokenFactory.args.ts @@ -137,7 +137,7 @@ export const encodeInterchainTokenFactoryDeployInterchainTokenData = ({ args: [salt, name, symbol, decimals, initialSupply, minter], }); -export type InterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs = { +export type InterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs2 = { originalChain: string; originalTokenAddress: `0x${string}`; destinationChain: string; @@ -147,32 +147,94 @@ export type InterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs = { /** * Factory function for InterchainTokenFactory.deployRemoteCanonicalInterchainToken function args */ -export const encodeInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs = +export const encodeInterchainTokenFactoryDeployRemoteCanonicalInterchainToken2Args = ({ originalChain, originalTokenAddress, destinationChain, gasValue, - }: InterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs) => + }: InterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs2) => [originalChain, originalTokenAddress, destinationChain, gasValue] as const; /** * Encoder function for InterchainTokenFactory.deployRemoteCanonicalInterchainToken function data */ -export const encodeInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenData = +export const encodeInterchainTokenFactoryDeployRemoteCanonicalInterchainToken2Data = ({ originalChain, originalTokenAddress, destinationChain, gasValue, - }: InterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs): `0x${string}` => + }: InterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs2): `0x${string}` => encodeFunctionData({ functionName: "deployRemoteCanonicalInterchainToken", abi: ABI_FILE.abi, args: [originalChain, originalTokenAddress, destinationChain, gasValue], }); +export type InterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs = { + originalTokenAddress: `0x${string}`; + destinationChain: string; + gasValue: bigint; +}; + +/** + * Factory function for InterchainTokenFactory.deployRemoteCanonicalInterchainToken function args + */ +export const encodeInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs = + ({ + originalTokenAddress, + destinationChain, + gasValue, + }: InterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs) => + [originalTokenAddress, destinationChain, gasValue] as const; + +/** + * Encoder function for InterchainTokenFactory.deployRemoteCanonicalInterchainToken function data + */ +export const encodeInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenData = + ({ + originalTokenAddress, + destinationChain, + gasValue, + }: InterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "deployRemoteCanonicalInterchainToken", + abi: ABI_FILE.abi, + args: [originalTokenAddress, destinationChain, gasValue], + }); + export type InterchainTokenFactoryDeployRemoteInterchainTokenArgs = { + salt: `0x${string}`; + destinationChain: string; + gasValue: bigint; +}; + +/** + * Factory function for InterchainTokenFactory.deployRemoteInterchainToken function args + */ +export const encodeInterchainTokenFactoryDeployRemoteInterchainTokenArgs = ({ + salt, + destinationChain, + gasValue, +}: InterchainTokenFactoryDeployRemoteInterchainTokenArgs) => + [salt, destinationChain, gasValue] as const; + +/** + * Encoder function for InterchainTokenFactory.deployRemoteInterchainToken function data + */ +export const encodeInterchainTokenFactoryDeployRemoteInterchainTokenData = ({ + salt, + destinationChain, + gasValue, +}: InterchainTokenFactoryDeployRemoteInterchainTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "deployRemoteInterchainToken", + abi: ABI_FILE.abi, + args: [salt, destinationChain, gasValue], + }); + +export type InterchainTokenFactoryDeployRemoteInterchainTokenArgs2 = { originalChainName: string; salt: `0x${string}`; minter: `0x${string}`; @@ -183,25 +245,25 @@ export type InterchainTokenFactoryDeployRemoteInterchainTokenArgs = { /** * Factory function for InterchainTokenFactory.deployRemoteInterchainToken function args */ -export const encodeInterchainTokenFactoryDeployRemoteInterchainTokenArgs = ({ +export const encodeInterchainTokenFactoryDeployRemoteInterchainToken2Args = ({ originalChainName, salt, minter, destinationChain, gasValue, -}: InterchainTokenFactoryDeployRemoteInterchainTokenArgs) => +}: InterchainTokenFactoryDeployRemoteInterchainTokenArgs2) => [originalChainName, salt, minter, destinationChain, gasValue] as const; /** * Encoder function for InterchainTokenFactory.deployRemoteInterchainToken function data */ -export const encodeInterchainTokenFactoryDeployRemoteInterchainTokenData = ({ +export const encodeInterchainTokenFactoryDeployRemoteInterchainToken2Data = ({ originalChainName, salt, minter, destinationChain, gasValue, -}: InterchainTokenFactoryDeployRemoteInterchainTokenArgs): `0x${string}` => +}: InterchainTokenFactoryDeployRemoteInterchainTokenArgs2): `0x${string}` => encodeFunctionData({ functionName: "deployRemoteInterchainToken", abi: ABI_FILE.abi, @@ -299,6 +361,112 @@ export const encodeInterchainTokenFactoryInterchainTokenIdData = ({ args: [deployer, salt], }); +export type InterchainTokenFactoryLinkTokenArgs = { + salt: `0x${string}`; + destinationChain: string; + destinationTokenAddress: `0x${string}`; + tokenManagerType: number; + linkParams: `0x${string}`; + gasValue: bigint; +}; + +/** + * Factory function for InterchainTokenFactory.linkToken function args + */ +export const encodeInterchainTokenFactoryLinkTokenArgs = ({ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, +}: InterchainTokenFactoryLinkTokenArgs) => + [ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, + ] as const; + +/** + * Encoder function for InterchainTokenFactory.linkToken function data + */ +export const encodeInterchainTokenFactoryLinkTokenData = ({ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, +}: InterchainTokenFactoryLinkTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "linkToken", + abi: ABI_FILE.abi, + args: [ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, + ], + }); + +export type InterchainTokenFactoryLinkedTokenDeploySaltArgs = { + deployer: `0x${string}`; + salt: `0x${string}`; +}; + +/** + * Factory function for InterchainTokenFactory.linkedTokenDeploySalt function args + */ +export const encodeInterchainTokenFactoryLinkedTokenDeploySaltArgs = ({ + deployer, + salt, +}: InterchainTokenFactoryLinkedTokenDeploySaltArgs) => + [deployer, salt] as const; + +/** + * Encoder function for InterchainTokenFactory.linkedTokenDeploySalt function data + */ +export const encodeInterchainTokenFactoryLinkedTokenDeploySaltData = ({ + deployer, + salt, +}: InterchainTokenFactoryLinkedTokenDeploySaltArgs): `0x${string}` => + encodeFunctionData({ + functionName: "linkedTokenDeploySalt", + abi: ABI_FILE.abi, + args: [deployer, salt], + }); + +export type InterchainTokenFactoryLinkedTokenIdArgs = { + deployer: `0x${string}`; + salt: `0x${string}`; +}; + +/** + * Factory function for InterchainTokenFactory.linkedTokenId function args + */ +export const encodeInterchainTokenFactoryLinkedTokenIdArgs = ({ + deployer, + salt, +}: InterchainTokenFactoryLinkedTokenIdArgs) => [deployer, salt] as const; + +/** + * Encoder function for InterchainTokenFactory.linkedTokenId function data + */ +export const encodeInterchainTokenFactoryLinkedTokenIdData = ({ + deployer, + salt, +}: InterchainTokenFactoryLinkedTokenIdArgs): `0x${string}` => + encodeFunctionData({ + functionName: "linkedTokenId", + abi: ABI_FILE.abi, + args: [deployer, salt], + }); + export type InterchainTokenFactoryMulticallArgs = { data: any }; /** @@ -369,6 +537,39 @@ export const encodeInterchainTokenFactoryRegisterCanonicalInterchainTokenData = args: [tokenAddress], }); +export type InterchainTokenFactoryRegisterCustomTokenArgs = { + salt: `0x${string}`; + tokenAddress: `0x${string}`; + tokenManagerType: number; + operator: `0x${string}`; +}; + +/** + * Factory function for InterchainTokenFactory.registerCustomToken function args + */ +export const encodeInterchainTokenFactoryRegisterCustomTokenArgs = ({ + salt, + tokenAddress, + tokenManagerType, + operator, +}: InterchainTokenFactoryRegisterCustomTokenArgs) => + [salt, tokenAddress, tokenManagerType, operator] as const; + +/** + * Encoder function for InterchainTokenFactory.registerCustomToken function data + */ +export const encodeInterchainTokenFactoryRegisterCustomTokenData = ({ + salt, + tokenAddress, + tokenManagerType, + operator, +}: InterchainTokenFactoryRegisterCustomTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "registerCustomToken", + abi: ABI_FILE.abi, + args: [salt, tokenAddress, tokenManagerType, operator], + }); + export type InterchainTokenFactoryRevokeDeployRemoteInterchainTokenArgs = { deployer: `0x${string}`; salt: `0x${string}`; @@ -492,6 +693,10 @@ export const INTERCHAIN_TOKEN_FACTORY_ENCODERS = { args: encodeInterchainTokenFactoryDeployInterchainTokenArgs, data: encodeInterchainTokenFactoryDeployInterchainTokenData, }, + deployRemoteCanonicalInterchainToken2: { + args: encodeInterchainTokenFactoryDeployRemoteCanonicalInterchainToken2Args, + data: encodeInterchainTokenFactoryDeployRemoteCanonicalInterchainToken2Data, + }, deployRemoteCanonicalInterchainToken: { args: encodeInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenArgs, data: encodeInterchainTokenFactoryDeployRemoteCanonicalInterchainTokenData, @@ -500,6 +705,10 @@ export const INTERCHAIN_TOKEN_FACTORY_ENCODERS = { args: encodeInterchainTokenFactoryDeployRemoteInterchainTokenArgs, data: encodeInterchainTokenFactoryDeployRemoteInterchainTokenData, }, + deployRemoteInterchainToken2: { + args: encodeInterchainTokenFactoryDeployRemoteInterchainToken2Args, + data: encodeInterchainTokenFactoryDeployRemoteInterchainToken2Data, + }, deployRemoteInterchainTokenWithMinter: { args: encodeInterchainTokenFactoryDeployRemoteInterchainTokenWithMinterArgs, data: encodeInterchainTokenFactoryDeployRemoteInterchainTokenWithMinterData, @@ -512,6 +721,18 @@ export const INTERCHAIN_TOKEN_FACTORY_ENCODERS = { args: encodeInterchainTokenFactoryInterchainTokenIdArgs, data: encodeInterchainTokenFactoryInterchainTokenIdData, }, + linkToken: { + args: encodeInterchainTokenFactoryLinkTokenArgs, + data: encodeInterchainTokenFactoryLinkTokenData, + }, + linkedTokenDeploySalt: { + args: encodeInterchainTokenFactoryLinkedTokenDeploySaltArgs, + data: encodeInterchainTokenFactoryLinkedTokenDeploySaltData, + }, + linkedTokenId: { + args: encodeInterchainTokenFactoryLinkedTokenIdArgs, + data: encodeInterchainTokenFactoryLinkedTokenIdData, + }, multicall: { args: encodeInterchainTokenFactoryMulticallArgs, data: encodeInterchainTokenFactoryMulticallData, @@ -524,6 +745,10 @@ export const INTERCHAIN_TOKEN_FACTORY_ENCODERS = { args: encodeInterchainTokenFactoryRegisterCanonicalInterchainTokenArgs, data: encodeInterchainTokenFactoryRegisterCanonicalInterchainTokenData, }, + registerCustomToken: { + args: encodeInterchainTokenFactoryRegisterCustomTokenArgs, + data: encodeInterchainTokenFactoryRegisterCustomTokenData, + }, revokeDeployRemoteInterchainToken: { args: encodeInterchainTokenFactoryRevokeDeployRemoteInterchainTokenArgs, data: encodeInterchainTokenFactoryRevokeDeployRemoteInterchainTokenData, @@ -543,11 +768,11 @@ export const INTERCHAIN_TOKEN_FACTORY_ENCODERS = { }; export function createInterchainTokenFactoryReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { canonicalInterchainTokenDeploySalt( - canonicalInterchainTokenDeploySaltArgs: InterchainTokenFactoryCanonicalInterchainTokenDeploySaltArgs + canonicalInterchainTokenDeploySaltArgs: InterchainTokenFactoryCanonicalInterchainTokenDeploySaltArgs, ) { const encoder = INTERCHAIN_TOKEN_FACTORY_ENCODERS["canonicalInterchainTokenDeploySalt"]; @@ -557,9 +782,8 @@ export function createInterchainTokenFactoryReadClient( args: encodedArgs, }); }, - canonicalInterchainTokenId( - canonicalInterchainTokenIdArgs: InterchainTokenFactoryCanonicalInterchainTokenIdArgs + canonicalInterchainTokenIdArgs: InterchainTokenFactoryCanonicalInterchainTokenIdArgs, ) { const encoder = INTERCHAIN_TOKEN_FACTORY_ENCODERS["canonicalInterchainTokenId"]; @@ -579,7 +803,7 @@ export function createInterchainTokenFactoryReadClient( return publicClient.read("implementation"); }, interchainTokenDeploySalt( - interchainTokenDeploySaltArgs: InterchainTokenFactoryInterchainTokenDeploySaltArgs + interchainTokenDeploySaltArgs: InterchainTokenFactoryInterchainTokenDeploySaltArgs, ) { const encoder = INTERCHAIN_TOKEN_FACTORY_ENCODERS["interchainTokenDeploySalt"]; @@ -590,7 +814,7 @@ export function createInterchainTokenFactoryReadClient( }); }, interchainTokenId( - interchainTokenIdArgs: InterchainTokenFactoryInterchainTokenIdArgs + interchainTokenIdArgs: InterchainTokenFactoryInterchainTokenIdArgs, ) { const encoder = INTERCHAIN_TOKEN_FACTORY_ENCODERS["interchainTokenId"]; const encodedArgs = encoder.args(interchainTokenIdArgs); @@ -600,5 +824,26 @@ export function createInterchainTokenFactoryReadClient( interchainTokenService() { return publicClient.read("interchainTokenService"); }, + linkedTokenDeploySalt( + linkedTokenDeploySaltArgs: InterchainTokenFactoryLinkedTokenDeploySaltArgs, + ) { + const encoder = + INTERCHAIN_TOKEN_FACTORY_ENCODERS["linkedTokenDeploySalt"]; + const encodedArgs = encoder.args(linkedTokenDeploySaltArgs); + + return publicClient.read("linkedTokenDeploySalt", { args: encodedArgs }); + }, + linkedTokenId(linkedTokenIdArgs: InterchainTokenFactoryLinkedTokenIdArgs) { + const encoder = INTERCHAIN_TOKEN_FACTORY_ENCODERS["linkedTokenId"]; + const encodedArgs = encoder.args(linkedTokenIdArgs); + + return publicClient.read("linkedTokenId", { args: encodedArgs }); + }, + owner() { + return publicClient.read("owner"); + }, + pendingOwner() { + return publicClient.read("pendingOwner"); + }, }; } diff --git a/packages/evm/src/contracts/its/InterchainTokenFactory/index.ts b/packages/evm/src/contracts/its/InterchainTokenFactory/index.ts index b63be0520..34c78775f 100644 --- a/packages/evm/src/contracts/its/InterchainTokenFactory/index.ts +++ b/packages/evm/src/contracts/its/InterchainTokenFactory/index.ts @@ -49,7 +49,7 @@ export class InterchainTokenFactoryClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/InterchainTokenService/InterchainTokenService.abi.ts b/packages/evm/src/contracts/its/InterchainTokenService/InterchainTokenService.abi.ts index 63ff82240..c94790478 100644 --- a/packages/evm/src/contracts/its/InterchainTokenService/InterchainTokenService.abi.ts +++ b/packages/evm/src/contracts/its/InterchainTokenService/InterchainTokenService.abi.ts @@ -98,6 +98,11 @@ export default { name: "EmptyParams", type: "error", }, + { + inputs: [], + name: "EmptyTokenAddress", + type: "error", + }, { inputs: [], name: "EmptyTokenName", @@ -273,17 +278,6 @@ export default { name: "InvalidProposedRoles", type: "error", }, - { - inputs: [ - { - internalType: "address", - name: "implementation", - type: "address", - }, - ], - name: "InvalidTokenManagerImplementationType", - type: "error", - }, { inputs: [], name: "LengthMismatch", @@ -347,6 +341,17 @@ export default { name: "NotApprovedByGateway", type: "error", }, + { + inputs: [ + { + internalType: "address", + name: "sender", + type: "address", + }, + ], + name: "NotInterchainTokenFactory", + type: "error", + }, { inputs: [], name: "NotOwner", @@ -734,6 +739,49 @@ export default { name: "InterchainTransferReceived", type: "event", }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + { + indexed: false, + internalType: "string", + name: "destinationChain", + type: "string", + }, + { + indexed: false, + internalType: "bytes", + name: "sourceTokenAddress", + type: "bytes", + }, + { + indexed: false, + internalType: "bytes", + name: "destinationTokenAddress", + type: "bytes", + }, + { + indexed: true, + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + indexed: false, + internalType: "bytes", + name: "params", + type: "bytes", + }, + ], + name: "LinkTokenStarted", + type: "event", + }, { anonymous: false, inputs: [ @@ -872,30 +920,18 @@ export default { inputs: [ { indexed: true, - internalType: "bytes32", - name: "tokenId", - type: "bytes32", + internalType: "address", + name: "tokenAddress", + type: "address", }, { indexed: false, - internalType: "string", - name: "destinationChain", - type: "string", - }, - { - indexed: true, - internalType: "enum ITokenManagerType.TokenManagerType", - name: "tokenManagerType", + internalType: "uint8", + name: "decimals", type: "uint8", }, - { - indexed: false, - internalType: "bytes", - name: "params", - type: "bytes", - }, ], - name: "TokenManagerDeploymentStarted", + name: "TokenMetadataRegistered", type: "event", }, { @@ -976,44 +1012,6 @@ export default { stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - { - internalType: "string", - name: "destinationChain", - type: "string", - }, - { - internalType: "bytes", - name: "destinationAddress", - type: "bytes", - }, - { - internalType: "uint256", - name: "amount", - type: "uint256", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - { - internalType: "uint256", - name: "gasValue", - type: "uint256", - }, - ], - name: "callContractWithInterchainToken", - outputs: [], - stateMutability: "payable", - type: "function", - }, { inputs: [], name: "chainName", @@ -1136,45 +1134,6 @@ export default { stateMutability: "payable", type: "function", }, - { - inputs: [ - { - internalType: "bytes32", - name: "salt", - type: "bytes32", - }, - { - internalType: "string", - name: "destinationChain", - type: "string", - }, - { - internalType: "enum ITokenManagerType.TokenManagerType", - name: "tokenManagerType", - type: "uint8", - }, - { - internalType: "bytes", - name: "params", - type: "bytes", - }, - { - internalType: "uint256", - name: "gasValue", - type: "uint256", - }, - ], - name: "deployTokenManager", - outputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - stateMutability: "payable", - type: "function", - }, { inputs: [ { @@ -1250,63 +1209,6 @@ export default { stateMutability: "payable", type: "function", }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - name: "flowInAmount", - outputs: [ - { - internalType: "uint256", - name: "flowInAmount_", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - name: "flowLimit", - outputs: [ - { - internalType: "uint256", - name: "flowLimit_", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "bytes32", - name: "tokenId", - type: "bytes32", - }, - ], - name: "flowOutAmount", - outputs: [ - { - internalType: "uint256", - name: "flowOutAmount_", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, { inputs: [], name: "gasService", @@ -1567,6 +1469,63 @@ export default { stateMutability: "view", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "string", + name: "destinationChain", + type: "string", + }, + { + internalType: "bytes", + name: "destinationTokenAddress", + type: "bytes", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "bytes", + name: "linkParams", + type: "bytes", + }, + { + internalType: "uint256", + name: "gasValue", + type: "uint256", + }, + ], + name: "linkToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + name: "migrateInterchainToken", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [ { @@ -1651,6 +1610,58 @@ export default { stateMutability: "nonpayable", type: "function", }, + { + inputs: [ + { + internalType: "bytes32", + name: "salt", + type: "bytes32", + }, + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "enum ITokenManagerType.TokenManagerType", + name: "tokenManagerType", + type: "uint8", + }, + { + internalType: "bytes", + name: "linkParams", + type: "bytes", + }, + ], + name: "registerCustomToken", + outputs: [ + { + internalType: "bytes32", + name: "tokenId", + type: "bytes32", + }, + ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + { + internalType: "uint256", + name: "gasValue", + type: "uint256", + }, + ], + name: "registerTokenMetadata", + outputs: [], + stateMutability: "payable", + type: "function", + }, { inputs: [ { diff --git a/packages/evm/src/contracts/its/InterchainTokenService/InterchainTokenService.args.ts b/packages/evm/src/contracts/its/InterchainTokenService/InterchainTokenService.args.ts index c419b9748..74236d336 100644 --- a/packages/evm/src/contracts/its/InterchainTokenService/InterchainTokenService.args.ts +++ b/packages/evm/src/contracts/its/InterchainTokenService/InterchainTokenService.args.ts @@ -36,61 +36,6 @@ export const encodeInterchainTokenServiceAcceptOperatorshipData = ({ args: [fromOperator], }); -export type InterchainTokenServiceCallContractWithInterchainTokenArgs = { - tokenId: `0x${string}`; - destinationChain: string; - destinationAddress: `0x${string}`; - amount: bigint; - data: `0x${string}`; - gasValue: bigint; -}; - -/** - * Factory function for InterchainTokenService.callContractWithInterchainToken function args - */ -export const encodeInterchainTokenServiceCallContractWithInterchainTokenArgs = - ({ - tokenId, - destinationChain, - destinationAddress, - amount, - data, - gasValue, - }: InterchainTokenServiceCallContractWithInterchainTokenArgs) => - [ - tokenId, - destinationChain, - destinationAddress, - amount, - data, - gasValue, - ] as const; - -/** - * Encoder function for InterchainTokenService.callContractWithInterchainToken function data - */ -export const encodeInterchainTokenServiceCallContractWithInterchainTokenData = - ({ - tokenId, - destinationChain, - destinationAddress, - amount, - data, - gasValue, - }: InterchainTokenServiceCallContractWithInterchainTokenArgs): `0x${string}` => - encodeFunctionData({ - functionName: "callContractWithInterchainToken", - abi: ABI_FILE.abi, - args: [ - tokenId, - destinationChain, - destinationAddress, - amount, - data, - gasValue, - ], - }); - export type InterchainTokenServiceContractCallValueArgs = { sourceChain: string; sourceAddress: string; @@ -163,42 +108,6 @@ export const encodeInterchainTokenServiceDeployInterchainTokenData = ({ args: [salt, destinationChain, name, symbol, decimals, minter, gasValue], }); -export type InterchainTokenServiceDeployTokenManagerArgs = { - salt: `0x${string}`; - destinationChain: string; - tokenManagerType: number; - params: `0x${string}`; - gasValue: bigint; -}; - -/** - * Factory function for InterchainTokenService.deployTokenManager function args - */ -export const encodeInterchainTokenServiceDeployTokenManagerArgs = ({ - salt, - destinationChain, - tokenManagerType, - params, - gasValue, -}: InterchainTokenServiceDeployTokenManagerArgs) => - [salt, destinationChain, tokenManagerType, params, gasValue] as const; - -/** - * Encoder function for InterchainTokenService.deployTokenManager function data - */ -export const encodeInterchainTokenServiceDeployTokenManagerData = ({ - salt, - destinationChain, - tokenManagerType, - params, - gasValue, -}: InterchainTokenServiceDeployTokenManagerArgs): `0x${string}` => - encodeFunctionData({ - functionName: "deployTokenManager", - abi: ABI_FILE.abi, - args: [salt, destinationChain, tokenManagerType, params, gasValue], - }); - export type InterchainTokenServiceDeployedTokenManagerArgs = { tokenId: `0x${string}`; }; @@ -288,71 +197,6 @@ export const encodeInterchainTokenServiceExpressExecuteData = ({ args: [commandId, sourceChain, sourceAddress, payload], }); -export type InterchainTokenServiceFlowInAmountArgs = { tokenId: `0x${string}` }; - -/** - * Factory function for InterchainTokenService.flowInAmount function args - */ -export const encodeInterchainTokenServiceFlowInAmountArgs = ({ - tokenId, -}: InterchainTokenServiceFlowInAmountArgs) => [tokenId] as const; - -/** - * Encoder function for InterchainTokenService.flowInAmount function data - */ -export const encodeInterchainTokenServiceFlowInAmountData = ({ - tokenId, -}: InterchainTokenServiceFlowInAmountArgs): `0x${string}` => - encodeFunctionData({ - functionName: "flowInAmount", - abi: ABI_FILE.abi, - args: [tokenId], - }); - -export type InterchainTokenServiceFlowLimitArgs = { tokenId: `0x${string}` }; - -/** - * Factory function for InterchainTokenService.flowLimit function args - */ -export const encodeInterchainTokenServiceFlowLimitArgs = ({ - tokenId, -}: InterchainTokenServiceFlowLimitArgs) => [tokenId] as const; - -/** - * Encoder function for InterchainTokenService.flowLimit function data - */ -export const encodeInterchainTokenServiceFlowLimitData = ({ - tokenId, -}: InterchainTokenServiceFlowLimitArgs): `0x${string}` => - encodeFunctionData({ - functionName: "flowLimit", - abi: ABI_FILE.abi, - args: [tokenId], - }); - -export type InterchainTokenServiceFlowOutAmountArgs = { - tokenId: `0x${string}`; -}; - -/** - * Factory function for InterchainTokenService.flowOutAmount function args - */ -export const encodeInterchainTokenServiceFlowOutAmountArgs = ({ - tokenId, -}: InterchainTokenServiceFlowOutAmountArgs) => [tokenId] as const; - -/** - * Encoder function for InterchainTokenService.flowOutAmount function data - */ -export const encodeInterchainTokenServiceFlowOutAmountData = ({ - tokenId, -}: InterchainTokenServiceFlowOutAmountArgs): `0x${string}` => - encodeFunctionData({ - functionName: "flowOutAmount", - abi: ABI_FILE.abi, - args: [tokenId], - }); - export type InterchainTokenServiceGetExpressExecutorArgs = { commandId: `0x${string}`; sourceChain: string; @@ -561,6 +405,82 @@ export const encodeInterchainTokenServiceIsTrustedAddressData = ({ args: [chain, address_], }); +export type InterchainTokenServiceLinkTokenArgs = { + salt: `0x${string}`; + destinationChain: string; + destinationTokenAddress: `0x${string}`; + tokenManagerType: number; + linkParams: `0x${string}`; + gasValue: bigint; +}; + +/** + * Factory function for InterchainTokenService.linkToken function args + */ +export const encodeInterchainTokenServiceLinkTokenArgs = ({ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, +}: InterchainTokenServiceLinkTokenArgs) => + [ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, + ] as const; + +/** + * Encoder function for InterchainTokenService.linkToken function data + */ +export const encodeInterchainTokenServiceLinkTokenData = ({ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, +}: InterchainTokenServiceLinkTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "linkToken", + abi: ABI_FILE.abi, + args: [ + salt, + destinationChain, + destinationTokenAddress, + tokenManagerType, + linkParams, + gasValue, + ], + }); + +export type InterchainTokenServiceMigrateInterchainTokenArgs = { + tokenId: `0x${string}`; +}; + +/** + * Factory function for InterchainTokenService.migrateInterchainToken function args + */ +export const encodeInterchainTokenServiceMigrateInterchainTokenArgs = ({ + tokenId, +}: InterchainTokenServiceMigrateInterchainTokenArgs) => [tokenId] as const; + +/** + * Encoder function for InterchainTokenService.migrateInterchainToken function data + */ +export const encodeInterchainTokenServiceMigrateInterchainTokenData = ({ + tokenId, +}: InterchainTokenServiceMigrateInterchainTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "migrateInterchainToken", + abi: ABI_FILE.abi, + args: [tokenId], + }); + export type InterchainTokenServiceMulticallArgs = { data: any }; /** @@ -628,6 +548,66 @@ export const encodeInterchainTokenServiceProposeOwnershipData = ({ args: [newOwner], }); +export type InterchainTokenServiceRegisterCustomTokenArgs = { + salt: `0x${string}`; + tokenAddress: `0x${string}`; + tokenManagerType: number; + linkParams: `0x${string}`; +}; + +/** + * Factory function for InterchainTokenService.registerCustomToken function args + */ +export const encodeInterchainTokenServiceRegisterCustomTokenArgs = ({ + salt, + tokenAddress, + tokenManagerType, + linkParams, +}: InterchainTokenServiceRegisterCustomTokenArgs) => + [salt, tokenAddress, tokenManagerType, linkParams] as const; + +/** + * Encoder function for InterchainTokenService.registerCustomToken function data + */ +export const encodeInterchainTokenServiceRegisterCustomTokenData = ({ + salt, + tokenAddress, + tokenManagerType, + linkParams, +}: InterchainTokenServiceRegisterCustomTokenArgs): `0x${string}` => + encodeFunctionData({ + functionName: "registerCustomToken", + abi: ABI_FILE.abi, + args: [salt, tokenAddress, tokenManagerType, linkParams], + }); + +export type InterchainTokenServiceRegisterTokenMetadataArgs = { + tokenAddress: `0x${string}`; + gasValue: bigint; +}; + +/** + * Factory function for InterchainTokenService.registerTokenMetadata function args + */ +export const encodeInterchainTokenServiceRegisterTokenMetadataArgs = ({ + tokenAddress, + gasValue, +}: InterchainTokenServiceRegisterTokenMetadataArgs) => + [tokenAddress, gasValue] as const; + +/** + * Encoder function for InterchainTokenService.registerTokenMetadata function data + */ +export const encodeInterchainTokenServiceRegisterTokenMetadataData = ({ + tokenAddress, + gasValue, +}: InterchainTokenServiceRegisterTokenMetadataArgs): `0x${string}` => + encodeFunctionData({ + functionName: "registerTokenMetadata", + abi: ABI_FILE.abi, + args: [tokenAddress, gasValue], + }); + export type InterchainTokenServiceRegisteredTokenAddressArgs = { tokenId: `0x${string}`; }; @@ -989,10 +969,6 @@ export const INTERCHAIN_TOKEN_SERVICE_ENCODERS = { args: encodeInterchainTokenServiceAcceptOperatorshipArgs, data: encodeInterchainTokenServiceAcceptOperatorshipData, }, - callContractWithInterchainToken: { - args: encodeInterchainTokenServiceCallContractWithInterchainTokenArgs, - data: encodeInterchainTokenServiceCallContractWithInterchainTokenData, - }, contractCallValue: { args: encodeInterchainTokenServiceContractCallValueArgs, data: encodeInterchainTokenServiceContractCallValueData, @@ -1001,10 +977,6 @@ export const INTERCHAIN_TOKEN_SERVICE_ENCODERS = { args: encodeInterchainTokenServiceDeployInterchainTokenArgs, data: encodeInterchainTokenServiceDeployInterchainTokenData, }, - deployTokenManager: { - args: encodeInterchainTokenServiceDeployTokenManagerArgs, - data: encodeInterchainTokenServiceDeployTokenManagerData, - }, deployedTokenManager: { args: encodeInterchainTokenServiceDeployedTokenManagerArgs, data: encodeInterchainTokenServiceDeployedTokenManagerData, @@ -1017,18 +989,6 @@ export const INTERCHAIN_TOKEN_SERVICE_ENCODERS = { args: encodeInterchainTokenServiceExpressExecuteArgs, data: encodeInterchainTokenServiceExpressExecuteData, }, - flowInAmount: { - args: encodeInterchainTokenServiceFlowInAmountArgs, - data: encodeInterchainTokenServiceFlowInAmountData, - }, - flowLimit: { - args: encodeInterchainTokenServiceFlowLimitArgs, - data: encodeInterchainTokenServiceFlowLimitData, - }, - flowOutAmount: { - args: encodeInterchainTokenServiceFlowOutAmountArgs, - data: encodeInterchainTokenServiceFlowOutAmountData, - }, getExpressExecutor: { args: encodeInterchainTokenServiceGetExpressExecutorArgs, data: encodeInterchainTokenServiceGetExpressExecutorData, @@ -1057,6 +1017,14 @@ export const INTERCHAIN_TOKEN_SERVICE_ENCODERS = { args: encodeInterchainTokenServiceIsTrustedAddressArgs, data: encodeInterchainTokenServiceIsTrustedAddressData, }, + linkToken: { + args: encodeInterchainTokenServiceLinkTokenArgs, + data: encodeInterchainTokenServiceLinkTokenData, + }, + migrateInterchainToken: { + args: encodeInterchainTokenServiceMigrateInterchainTokenArgs, + data: encodeInterchainTokenServiceMigrateInterchainTokenData, + }, multicall: { args: encodeInterchainTokenServiceMulticallArgs, data: encodeInterchainTokenServiceMulticallData, @@ -1069,6 +1037,14 @@ export const INTERCHAIN_TOKEN_SERVICE_ENCODERS = { args: encodeInterchainTokenServiceProposeOwnershipArgs, data: encodeInterchainTokenServiceProposeOwnershipData, }, + registerCustomToken: { + args: encodeInterchainTokenServiceRegisterCustomTokenArgs, + data: encodeInterchainTokenServiceRegisterCustomTokenData, + }, + registerTokenMetadata: { + args: encodeInterchainTokenServiceRegisterTokenMetadataArgs, + data: encodeInterchainTokenServiceRegisterTokenMetadataData, + }, registeredTokenAddress: { args: encodeInterchainTokenServiceRegisteredTokenAddressArgs, data: encodeInterchainTokenServiceRegisteredTokenAddressData, @@ -1128,7 +1104,7 @@ export const INTERCHAIN_TOKEN_SERVICE_ENCODERS = { }; export function createInterchainTokenServiceReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { chainName() { @@ -1138,7 +1114,7 @@ export function createInterchainTokenServiceReadClient( return publicClient.read("chainNameHash"); }, contractCallValue( - contractCallValueArgs: InterchainTokenServiceContractCallValueArgs + contractCallValueArgs: InterchainTokenServiceContractCallValueArgs, ) { const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["contractCallValue"]; const encodedArgs = encoder.args(contractCallValueArgs); @@ -1149,31 +1125,13 @@ export function createInterchainTokenServiceReadClient( return publicClient.read("contractId"); }, deployedTokenManager( - deployedTokenManagerArgs: InterchainTokenServiceDeployedTokenManagerArgs + deployedTokenManagerArgs: InterchainTokenServiceDeployedTokenManagerArgs, ) { const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["deployedTokenManager"]; const encodedArgs = encoder.args(deployedTokenManagerArgs); return publicClient.read("deployedTokenManager", { args: encodedArgs }); }, - flowInAmount(flowInAmountArgs: InterchainTokenServiceFlowInAmountArgs) { - const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["flowInAmount"]; - const encodedArgs = encoder.args(flowInAmountArgs); - - return publicClient.read("flowInAmount", { args: encodedArgs }); - }, - flowLimit(flowLimitArgs: InterchainTokenServiceFlowLimitArgs) { - const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["flowLimit"]; - const encodedArgs = encoder.args(flowLimitArgs); - - return publicClient.read("flowLimit", { args: encodedArgs }); - }, - flowOutAmount(flowOutAmountArgs: InterchainTokenServiceFlowOutAmountArgs) { - const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["flowOutAmount"]; - const encodedArgs = encoder.args(flowOutAmountArgs); - - return publicClient.read("flowOutAmount", { args: encodedArgs }); - }, gasService() { return publicClient.read("gasService"); }, @@ -1184,7 +1142,7 @@ export function createInterchainTokenServiceReadClient( return publicClient.read("gatewayCaller"); }, getExpressExecutor( - getExpressExecutorArgs: InterchainTokenServiceGetExpressExecutorArgs + getExpressExecutorArgs: InterchainTokenServiceGetExpressExecutorArgs, ) { const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["getExpressExecutor"]; const encodedArgs = encoder.args(getExpressExecutorArgs); @@ -1201,7 +1159,7 @@ export function createInterchainTokenServiceReadClient( return publicClient.read("implementation"); }, interchainTokenAddress( - interchainTokenAddressArgs: InterchainTokenServiceInterchainTokenAddressArgs + interchainTokenAddressArgs: InterchainTokenServiceInterchainTokenAddressArgs, ) { const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["interchainTokenAddress"]; @@ -1216,7 +1174,7 @@ export function createInterchainTokenServiceReadClient( return publicClient.read("interchainTokenFactory"); }, interchainTokenId( - interchainTokenIdArgs: InterchainTokenServiceInterchainTokenIdArgs + interchainTokenIdArgs: InterchainTokenServiceInterchainTokenIdArgs, ) { const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["interchainTokenId"]; const encodedArgs = encoder.args(interchainTokenIdArgs); @@ -1230,7 +1188,7 @@ export function createInterchainTokenServiceReadClient( return publicClient.read("isOperator", { args: encodedArgs }); }, isTrustedAddress( - isTrustedAddressArgs: InterchainTokenServiceIsTrustedAddressArgs + isTrustedAddressArgs: InterchainTokenServiceIsTrustedAddressArgs, ) { const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["isTrustedAddress"]; const encodedArgs = encoder.args(isTrustedAddressArgs); @@ -1247,7 +1205,7 @@ export function createInterchainTokenServiceReadClient( return publicClient.read("pendingOwner"); }, registeredTokenAddress( - registeredTokenAddressArgs: InterchainTokenServiceRegisteredTokenAddressArgs + registeredTokenAddressArgs: InterchainTokenServiceRegisteredTokenAddressArgs, ) { const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["registeredTokenAddress"]; @@ -1262,7 +1220,7 @@ export function createInterchainTokenServiceReadClient( return publicClient.read("tokenManager"); }, tokenManagerAddress( - tokenManagerAddressArgs: InterchainTokenServiceTokenManagerAddressArgs + tokenManagerAddressArgs: InterchainTokenServiceTokenManagerAddressArgs, ) { const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["tokenManagerAddress"]; const encodedArgs = encoder.args(tokenManagerAddressArgs); @@ -1273,7 +1231,7 @@ export function createInterchainTokenServiceReadClient( return publicClient.read("tokenManagerDeployer"); }, tokenManagerImplementation( - tokenManagerImplementationArgs: InterchainTokenServiceTokenManagerImplementationArgs + tokenManagerImplementationArgs: InterchainTokenServiceTokenManagerImplementationArgs, ) { const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["tokenManagerImplementation"]; @@ -1284,7 +1242,7 @@ export function createInterchainTokenServiceReadClient( }); }, trustedAddress( - trustedAddressArgs: InterchainTokenServiceTrustedAddressArgs + trustedAddressArgs: InterchainTokenServiceTrustedAddressArgs, ) { const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["trustedAddress"]; const encodedArgs = encoder.args(trustedAddressArgs); @@ -1292,7 +1250,7 @@ export function createInterchainTokenServiceReadClient( return publicClient.read("trustedAddress", { args: encodedArgs }); }, trustedAddressHash( - trustedAddressHashArgs: InterchainTokenServiceTrustedAddressHashArgs + trustedAddressHashArgs: InterchainTokenServiceTrustedAddressHashArgs, ) { const encoder = INTERCHAIN_TOKEN_SERVICE_ENCODERS["trustedAddressHash"]; const encodedArgs = encoder.args(trustedAddressHashArgs); diff --git a/packages/evm/src/contracts/its/InterchainTokenService/index.ts b/packages/evm/src/contracts/its/InterchainTokenService/index.ts index 612ed9f87..f3e195d72 100644 --- a/packages/evm/src/contracts/its/InterchainTokenService/index.ts +++ b/packages/evm/src/contracts/its/InterchainTokenService/index.ts @@ -49,7 +49,7 @@ export class InterchainTokenServiceClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/InterchainTokenStandard/InterchainTokenStandard.args.ts b/packages/evm/src/contracts/its/InterchainTokenStandard/InterchainTokenStandard.args.ts index 5ecd8d32d..d885c857c 100644 --- a/packages/evm/src/contracts/its/InterchainTokenStandard/InterchainTokenStandard.args.ts +++ b/packages/evm/src/contracts/its/InterchainTokenStandard/InterchainTokenStandard.args.ts @@ -94,7 +94,7 @@ export const INTERCHAIN_TOKEN_STANDARD_ENCODERS = { }; export function createInterchainTokenStandardReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { interchainTokenId() { diff --git a/packages/evm/src/contracts/its/InterchainTokenStandard/index.ts b/packages/evm/src/contracts/its/InterchainTokenStandard/index.ts index 6b02aed6d..7da5c2c56 100644 --- a/packages/evm/src/contracts/its/InterchainTokenStandard/index.ts +++ b/packages/evm/src/contracts/its/InterchainTokenStandard/index.ts @@ -49,7 +49,7 @@ export class InterchainTokenStandardClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/evm/src/contracts/its/TokenHandler/TokenHandler.abi.ts b/packages/evm/src/contracts/its/TokenHandler/TokenHandler.abi.ts index ff1ed59a5..139dfe73b 100644 --- a/packages/evm/src/contracts/its/TokenHandler/TokenHandler.abi.ts +++ b/packages/evm/src/contracts/its/TokenHandler/TokenHandler.abi.ts @@ -90,7 +90,7 @@ export default { type: "uint256", }, { - internalType: "address", + internalType: "contract ITokenManager", name: "tokenManager", type: "address", }, diff --git a/packages/evm/src/contracts/its/TokenManager/TokenManager.args.ts b/packages/evm/src/contracts/its/TokenManager/TokenManager.args.ts index 2b2ab5658..3b961a4df 100644 --- a/packages/evm/src/contracts/its/TokenManager/TokenManager.args.ts +++ b/packages/evm/src/contracts/its/TokenManager/TokenManager.args.ts @@ -499,7 +499,7 @@ export const TOKEN_MANAGER_ENCODERS = { }; export function createTokenManagerReadClient( - publicClient: PublicContractClient + publicClient: PublicContractClient, ) { return { contractId() { @@ -515,7 +515,7 @@ export function createTokenManagerReadClient( return publicClient.read("flowOutAmount"); }, getTokenAddressFromParams( - getTokenAddressFromParamsArgs: TokenManagerGetTokenAddressFromParamsArgs + getTokenAddressFromParamsArgs: TokenManagerGetTokenAddressFromParamsArgs, ) { const encoder = TOKEN_MANAGER_ENCODERS["getTokenAddressFromParams"]; const encodedArgs = encoder.args(getTokenAddressFromParamsArgs); diff --git a/packages/evm/src/contracts/its/TokenManager/index.ts b/packages/evm/src/contracts/its/TokenManager/index.ts index 99a4881d6..24ee04206 100644 --- a/packages/evm/src/contracts/its/TokenManager/index.ts +++ b/packages/evm/src/contracts/its/TokenManager/index.ts @@ -49,7 +49,7 @@ export class TokenManagerClient extends PublicContractClient< chain: options.chain, }); - this.reads = createReadClient(this as PublicContractClient); + this.reads = createReadClient(this); } } diff --git a/packages/transaction-recovery/src/manual-relay-to-dest-chain/lib/EvmGatewayApproveTx/txHelper.spec.ts b/packages/transaction-recovery/src/manual-relay-to-dest-chain/lib/EvmGatewayApproveTx/txHelper.spec.ts index 67f0fca8e..37743ad4e 100644 --- a/packages/transaction-recovery/src/manual-relay-to-dest-chain/lib/EvmGatewayApproveTx/txHelper.spec.ts +++ b/packages/transaction-recovery/src/manual-relay-to-dest-chain/lib/EvmGatewayApproveTx/txHelper.spec.ts @@ -3,8 +3,7 @@ import { hashMessage } from "viem"; import * as TxHelper from "./txHelper"; describe("TxHelper", () => { - const rpcUrl = - "https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161"; + const rpcUrl = "https://1rpc.io/eth"; test("should be able to create the approve transaction correctly", async () => { const gatewayAddress = "0x4F4495243837681061C4743b74B3eEdf548D56A5"; const serializedTx = await TxHelper.createApproveTx( @@ -23,5 +22,4 @@ describe("TxHelper", () => { expect(chainId).toBe(1); expect(maxPriorityFeePerGas).toBeDefined(); }); - }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2813db6ff..daaa8c1ff 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -620,8 +620,8 @@ importers: version: 7.2.3 devDependencies: '@axelar-network/interchain-token-service': - specifier: ^2.0.1 - version: 2.0.1 + specifier: ^2.1.0 + version: 2.1.0 '@axelarjs/api': specifier: workspace:^ version: link:../api @@ -1098,8 +1098,8 @@ packages: '@axelar-network/axelarjs-types@0.33.0': resolution: {integrity: sha512-aCbX/5G+tgWPjr9tl3dQfJftWwRMkILz61ytach7dKqxtO9G9jlxpNvELJQ6gKVOodUtSY8qBCO/fWU19v4hdQ==} - '@axelar-network/interchain-token-service@2.0.1': - resolution: {integrity: sha512-5m4ocCIx9qfH1xODPAmhnGPGBl0ytKUzIwvJ94zgTlj0IUmsRkr93ON8/6dRjg+HK8RgfYNwQD1r4Gdy6kaU1w==} + '@axelar-network/interchain-token-service@2.1.0': + resolution: {integrity: sha512-eRaDL7otxqZixzsSu3rYtMkFQ1buopNGAmc8fEHvJPPD1WYiRARx24z+61OTJjCHcRygBljl9oIlqmqiM6SAYg==} engines: {node: '>=18'} '@babel/code-frame@7.25.7': @@ -2008,6 +2008,7 @@ packages: '@confio/ics23@0.6.8': resolution: {integrity: sha512-wB6uo+3A50m0sW/EWcU64xpV/8wShZ6bMTa7pF8eYsTrSkQA7oLUIJcs/wb8g4y2Oyq701BaGiO6n/ak5WXO1w==} + deprecated: Unmaintained. The codebase for this package was moved to https://github.com/cosmos/ics23 but then the JS implementation was removed in https://github.com/cosmos/ics23/pull/353. Please consult the maintainers of https://github.com/cosmos for further assistance. '@cosmjs/amino@0.31.3': resolution: {integrity: sha512-36emtUq895sPRX8PTSOnG+lhJDCVyIcE0Tr5ct59sUbgQiI14y43vj/4WAlJ/utSOxy+Zhj9wxcs4AZfu0BHsw==} @@ -5692,6 +5693,7 @@ packages: '@web3modal/core@4.2.3': resolution: {integrity: sha512-UykKZTELBpb6ey+IV6fkHWsLkjrIdILmRYzhlznyTPbm9qX5pOR9tH0Z3QGUo7YPFmUqMRH1tC9Irsr3SgIbbw==} + deprecated: Web3Modal is now Reown AppKit. Please follow the upgrade guide at https://docs.reown.com/appkit/upgrade/from-w3m-to-reown '@web3modal/polyfills@4.2.3': resolution: {integrity: sha512-RiGxh2hMLSD1s2aTjoejNK/UL377CJhGf5tzmdF1m5xsYHpil+Dnulpio8Yojnm27cOqQD+QiaYUKnHOxErLjQ==} @@ -5723,12 +5725,15 @@ packages: '@web3modal/siwe@4.2.3': resolution: {integrity: sha512-uPma0U/OxAy3LwnF7pCYYX8tn+ONBYNcssuVZxEGsusJD1kF4ueS8lK7eyQogyK5nXqOGdNESOjY1NImNNjMVw==} + deprecated: Web3Modal is now Reown AppKit. Please follow the upgrade guide at https://docs.reown.com/appkit/upgrade/from-w3m-to-reown '@web3modal/ui@4.2.3': resolution: {integrity: sha512-QPPgE0hii1gpAldTdnrP63D/ryI78Ohz99zRBp8vi81lawot7rbdUbryMoX13hMPCW9vW7JYyvX+jJN7uO3QwA==} + deprecated: Web3Modal is now Reown AppKit. Please follow the upgrade guide at https://docs.reown.com/appkit/upgrade/from-w3m-to-reown '@web3modal/wagmi@4.2.3': resolution: {integrity: sha512-oisBCMrOYn8TBgNaSPrumvMmTGox6+3Ii92zxQJalW5U/K9iBTxoejHT033Ss7mFEFybilcfXBAvGNFXfQmtkA==} + deprecated: Web3Modal is now Reown AppKit. Please follow the upgrade guide at https://docs.reown.com/appkit/upgrade/from-w3m-to-reown peerDependencies: '@wagmi/connectors': '>=4' '@wagmi/core': '>=2.0.0' @@ -12201,7 +12206,7 @@ snapshots: long: 5.2.3 protobufjs: 7.4.0 - '@axelar-network/interchain-token-service@2.0.1': + '@axelar-network/interchain-token-service@2.1.0': dependencies: '@axelar-network/axelar-cgp-solidity': 6.4.0 '@axelar-network/axelar-gmp-sdk-solidity': 6.0.4 @@ -13488,7 +13493,7 @@ snapshots: '@types/node': 20.5.1 chalk: 4.1.2 cosmiconfig: 8.3.6(typescript@5.7.2) - cosmiconfig-typescript-loader: 4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@5.7.2))(ts-node@10.9.2(@types/node@20.5.1)(typescript@5.7.2))(typescript@5.7.2) + cosmiconfig-typescript-loader: 4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@5.7.2))(ts-node@10.9.2(@types/node@20.17.10)(typescript@5.7.2))(typescript@5.7.2) lodash.isplainobject: 4.0.6 lodash.merge: 4.6.2 lodash.uniq: 4.5.0 @@ -19801,7 +19806,7 @@ snapshots: object-assign: 4.1.1 vary: 1.1.2 - cosmiconfig-typescript-loader@4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@5.7.2))(ts-node@10.9.2(@types/node@20.5.1)(typescript@5.7.2))(typescript@5.7.2): + cosmiconfig-typescript-loader@4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@5.7.2))(ts-node@10.9.2(@types/node@20.17.10)(typescript@5.7.2))(typescript@5.7.2): dependencies: '@types/node': 20.5.1 cosmiconfig: 8.3.6(typescript@5.7.2) @@ -20674,7 +20679,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.7.0(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.7.0)(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: @@ -20696,7 +20701,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.7.0(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.7.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.7.0)(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3