diff --git a/apps/maestro/src/features/SendInterchainToken/hooks/useInterchainTransferMutation.ts b/apps/maestro/src/features/SendInterchainToken/hooks/useInterchainTransferMutation.ts index 4061a70b4..57452fe8f 100644 --- a/apps/maestro/src/features/SendInterchainToken/hooks/useInterchainTransferMutation.ts +++ b/apps/maestro/src/features/SendInterchainToken/hooks/useInterchainTransferMutation.ts @@ -69,7 +69,7 @@ export function useInterchainTransferMutation( const mutation = useMutation({ mutationFn: async ({ amount, tokenId, destinationAddress, decimals }) => { - if (!(decimals && address && config.gas)) { + if (!(decimals && address && config.gas && tokenId && destinationAddress)) { return; } @@ -81,7 +81,6 @@ export function useInterchainTransferMutation( let txHash: any; if (config.sourceChainName === "sui") { const coinObjectId = await getCoinType(config.tokenAddress); - console.log("coinObjectId", coinObjectId); const sendTokenTxJSON = await getSendTokenTx({ sender: address, tokenId: tokenId, diff --git a/apps/maestro/src/server/routers/axelarjsSDK/getChainInfo.ts b/apps/maestro/src/server/routers/axelarjsSDK/getChainInfo.ts index 3e92dc891..a538c6272 100644 --- a/apps/maestro/src/server/routers/axelarjsSDK/getChainInfo.ts +++ b/apps/maestro/src/server/routers/axelarjsSDK/getChainInfo.ts @@ -51,6 +51,16 @@ export const getChainInfo = publicProcedure return output; } catch (error) { + + // Remove this once we have sui supported in the urlMap from the axelarjs-sdk + if(input.axelarChainId === "sui"){ + return { + id: "sui", + chainName: "sui", + blockConfirmations: 1, + estimatedWaitTimeInMinutes: 1, + } + } // If we get a TRPC error, we throw it if (error instanceof TRPCError) { throw error; diff --git a/apps/maestro/src/server/routers/sui/index.ts b/apps/maestro/src/server/routers/sui/index.ts index 09c2527b5..5b7590ccc 100644 --- a/apps/maestro/src/server/routers/sui/index.ts +++ b/apps/maestro/src/server/routers/sui/index.ts @@ -269,7 +269,7 @@ export const suiRouter = router({ "0x", CLOCK_PACKAGE_ID, ], - typeArguments: [input.tokenType], + typeArguments: [input.coinObjectId], }); const tx2 = await buildTx(input.sender, txBuilder); diff --git a/apps/maestro/src/ui/compounds/GMPTxStatusMonitor/GMPTxStatusMonitor.tsx b/apps/maestro/src/ui/compounds/GMPTxStatusMonitor/GMPTxStatusMonitor.tsx index 542fc0b27..65642edc6 100644 --- a/apps/maestro/src/ui/compounds/GMPTxStatusMonitor/GMPTxStatusMonitor.tsx +++ b/apps/maestro/src/ui/compounds/GMPTxStatusMonitor/GMPTxStatusMonitor.tsx @@ -43,37 +43,54 @@ const STATUS_COLORS: Partial< pending: "neutral", }; -export function useGMPTxProgress(txHash: `0x${string}`, chainId: number) { +export function useGMPTxProgress(txHash: string, chainId: number) { const { combinedComputed } = useAllChainConfigsQuery(); - const { data: txInfo } = useTransaction({ - hash: txHash, - chainId, - }); - const { data: chainInfo } = useChainInfoQuery({ axelarChainId: combinedComputed.indexedByChainId[chainId]?.id, }); + const isNonEvm = chainInfo?.id === "sui"; + + // Make sure this supports sui as well + const { data: txInfo } = useTransaction({ + hash: txHash as `0x${string}`, + chainId, + query: { + enabled: !isNonEvm, + } + }); + const { data: currentBlockNumber } = useBlockNumber({ chainId, watch: true, query: { - enabled: Boolean(chainInfo?.blockConfirmations && txInfo?.blockNumber), + enabled: !isNonEvm && Boolean(chainInfo?.blockConfirmations && txInfo?.blockNumber), }, }); const elapsedBlocks = useMemo( - () => - currentBlockNumber && txInfo?.blockNumber + () => { + return isNonEvm ? 1 : currentBlockNumber && txInfo?.blockNumber ? Number(currentBlockNumber - txInfo.blockNumber) - : 0, - [currentBlockNumber, txInfo?.blockNumber] + : 0 + }, + [currentBlockNumber, isNonEvm, txInfo?.blockNumber] ); - const expectedConfirmations = Number(chainInfo?.blockConfirmations ?? 1); + const expectedConfirmations = useMemo(() => { + return isNonEvm ? 1 : Number(chainInfo?.blockConfirmations ?? 1); + }, [isNonEvm, chainInfo?.blockConfirmations]); + const { progress, progressRatio } = useMemo(() => { + if (isNonEvm) { + return { + progress: '100%', + progressRatio: 100, + }; + } + const ratio = elapsedBlocks / expectedConfirmations; const clampedRatio = clamp(0, 1, ratio); @@ -84,7 +101,7 @@ export function useGMPTxProgress(txHash: `0x${string}`, chainId: number) { progress, progressRatio: clampedRatio * 100, }; - }, [elapsedBlocks, expectedConfirmations]); + }, [elapsedBlocks, isNonEvm, expectedConfirmations]); return { progress,