From 5795b921a121706465927e1bc878144b14d7a2db Mon Sep 17 00:00:00 2001 From: MickWang <1244134672@qq.com> Date: Mon, 22 Apr 2024 18:54:41 +0800 Subject: [PATCH] fix withdrawal chain display issue --- store/zksync/withdrawals.ts | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/store/zksync/withdrawals.ts b/store/zksync/withdrawals.ts index e2cd29d25..4b898b685 100644 --- a/store/zksync/withdrawals.ts +++ b/store/zksync/withdrawals.ts @@ -33,7 +33,7 @@ export const useZkSyncWithdrawalsStore = defineStore("zkSyncWithdrawals", () => return new Promise((resolve) => setTimeout(resolve, ms)); } const setStatus = async (obj: { transactionHash: ethers.utils.BytesLike; status: string; gateway: string }) => { - const { primaryNetwork, zkSyncNetworks,getNetworkInfo } = useNetworks(); + const { primaryNetwork, zkSyncNetworks, getNetworkInfo } = useNetworks(); const { selectedNetwork } = storeToRefs(useNetworkStore()); let provider: Provider | undefined; @@ -82,10 +82,30 @@ export const useZkSyncWithdrawalsStore = defineStore("zkSyncWithdrawals", () => ); const withdrawals = transfers.items.filter((e) => e.type === "withdrawal" && e.token && e.amount); for (const withdrawal of withdrawals) { - const { primaryNetwork, zkSyncNetworks,getNetworkInfo } = useNetworks(); + const { primaryNetwork, zkSyncNetworks, getNetworkInfo } = useNetworks(); const transactionFromStorage = transactionStatusStore.getTransaction(withdrawal.transactionHash); if (transactionFromStorage) { + // check if tx.to.destination is matching with tx.token.networkKey for erc20 + if ( + transactionFromStorage.to.destination.key !== transactionFromStorage.token.networkKey && + transactionFromStorage.token.symbol !== "ETH" + ) { + const { selectedNetwork } = storeToRefs(useNetworkStore()); + const eraNetworks = getNetworkInfo(withdrawal) || selectedNetwork.value; + const obj = { + iconUrl: eraNetworks.logoUrl!, + key: "nova", + label: eraNetworks?.l1Network?.name ?? "", + }; + transactionStatusStore.updateTransactionData(withdrawal.transactionHash, { + ...transactionFromStorage, + to: { + ...transactionFromStorage.to, + destination: obj, + }, + }); + } if (!transactionFromStorage.info.completed) { await setStatus(withdrawal); await sleep(200);