Skip to content

Commit

Permalink
fix withdrawal chain display issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MickWang committed Apr 22, 2024
1 parent 187b22b commit 5795b92
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions store/zksync/withdrawals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5795b92

Please sign in to comment.