From 5d8268517a90deab5de2e3c309406938fe923916 Mon Sep 17 00:00:00 2001 From: Jack Hamer <47187316+JackHamer09@users.noreply.github.com> Date: Fri, 19 Jan 2024 22:27:39 +0200 Subject: [PATCH] feat: proper withdrawals finalization (#155) --- app.vue | 3 + components/animations/TransactionProgress.vue | 32 ++- components/common/Badge.vue | 11 + components/common/Spinner.vue | 27 ++- components/header/Header.vue | 18 +- components/header/MobileMainNavigation.vue | 11 + .../transaction/EthereumTransactionFooter.vue | 8 +- .../transaction/TransactionHashButton.vue | 11 +- .../transaction/TransactionProgress.vue | 17 +- components/transaction/TransferLineItem.vue | 7 + .../TransferWithdrawalLineItem.vue | 153 ++++++++++++ .../WithdrawalFinalizationAlert.vue | 73 ------ .../WithdrawalsAvailableForClaimAlert.vue | 21 ++ .../lineItem/TransactionLineItem.vue | 6 +- .../zksync/useWithdrawalFinalization.ts | 24 +- data/networks.ts | 5 + pages/assets.vue | 1 + pages/transaction/[hash].vue | 10 +- pages/transfers.vue | 59 ++++- store/zksync/transactionStatus.ts | 46 +++- store/zksync/transfersHistory.ts | 2 +- store/zksync/withdrawals.ts | 113 +++++++++ types/index.d.ts | 36 +++ views/transactions/Deposit.vue | 1 + views/transactions/Transfer.vue | 19 +- views/transactions/TransferSubmitted.vue | 62 ++--- views/transactions/WithdrawalSubmitted.vue | 229 ++++++++++++++++++ 27 files changed, 818 insertions(+), 187 deletions(-) create mode 100644 components/common/Badge.vue create mode 100644 components/transaction/TransferWithdrawalLineItem.vue delete mode 100644 components/transaction/WithdrawalFinalizationAlert.vue create mode 100644 components/transaction/WithdrawalsAvailableForClaimAlert.vue create mode 100644 store/zksync/withdrawals.ts create mode 100644 views/transactions/WithdrawalSubmitted.vue diff --git a/app.vue b/app.vue index 3768b4615..0951623b7 100644 --- a/app.vue +++ b/app.vue @@ -8,8 +8,11 @@ import { watch } from "vue"; import { useRoute } from "vue-router"; +import { useZkSyncWithdrawalsStore } from "@/store/zksync/withdrawals"; import { trackPage } from "@/utils/analytics"; +useZkSyncWithdrawalsStore().updateWithdrawalsIfPossible(); // init store to update withdrawals + const route = useRoute(); watch( () => route.path, diff --git a/components/animations/TransactionProgress.vue b/components/animations/TransactionProgress.vue index c3c5f44d3..6271dff35 100644 --- a/components/animations/TransactionProgress.vue +++ b/components/animations/TransactionProgress.vue @@ -1,5 +1,8 @@ + @@ -106,6 +114,7 @@ import type { ZkSyncNetwork } from "@/data/networks"; import { useRoute } from "#imports"; import { useNetworkStore } from "@/store/network"; +import { useZkSyncWithdrawalsStore } from "@/store/zksync/withdrawals"; import { getNetworkUrl } from "@/utils/helpers"; import { TransitionSlideOutToLeft, TransitionSlideOutToRight } from "@/utils/transitions"; @@ -122,6 +131,8 @@ const emit = defineEmits<{ const route = useRoute(); +const { withdrawalsAvailableForClaiming } = storeToRefs(useZkSyncWithdrawalsStore()); + const TabsTransition = computed(() => openedTab.value === "main" ? TransitionSlideOutToRight : TransitionSlideOutToLeft ); diff --git a/components/transaction/EthereumTransactionFooter.vue b/components/transaction/EthereumTransactionFooter.vue index d588fe74f..02af335f2 100644 --- a/components/transaction/EthereumTransactionFooter.vue +++ b/components/transaction/EthereumTransactionFooter.vue @@ -27,10 +27,14 @@ class="w-full" @click="onboardStore.setCorrectNetwork" > - Change wallet network to {{ l1Network.name }} + + Change wallet network to {{ l1Network.name }} + - Change network manually to {{ l1Network.name }} in your {{ walletName }} wallet + + Change network manually to {{ l1Network.name }} in your {{ walletName }} wallet +