Skip to content

Commit

Permalink
fix: transaction success popup should never close automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
JackHamer09 committed Jun 2, 2023
1 parent e69b398 commit 24e4602
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 19 deletions.
14 changes: 12 additions & 2 deletions components/transaction/zksync/era/ConfirmTransactionModal.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<template>
<CommonModal
v-if="status !== 'done'"
v-bind="$attrs"
:opened="opened"
:close-on-background-click="status === 'not-started'"
class="confirm-transaction-modal"
title="Confirm transaction"
@close="closeModal"
>
<div class="flex h-full flex-col overflow-auto">
<template v-if="transaction">
Expand Down Expand Up @@ -86,12 +87,13 @@

<EraTransferSuccessfulModal
v-else-if="transaction?.type === 'transfer'"
v-bind="$attrs"
opened
:transaction="transactionLineItem"
:in-progress="!transactionCommitted"
/>
<EraWithdrawalSuccessfulModal
v-else-if="transaction?.type === 'withdrawal'"
opened
v-bind="$attrs"
:transaction="transactionLineItem"
/>
Expand Down Expand Up @@ -135,6 +137,9 @@ export type ConfirmationModalTransaction = {
};
const props = defineProps({
opened: {
type: Boolean,
},
transaction: {
type: Object as PropType<ConfirmationModalTransaction>,
},
Expand All @@ -161,6 +166,11 @@ const props = defineProps({
},
});
const emit = defineEmits<{
(eventName: "update:opened", value: boolean): void;
}>();
const closeModal = () => emit("update:opened", false);

const eraTransactionsHistoryStore = useEraTransactionsHistoryStore();
const walletEraStore = useEraWalletStore();
const eraProviderStore = useEraProviderStore();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<template>
<CommonModal
v-if="status !== 'done'"
v-bind="$attrs"
:opened="opened"
:close-on-background-click="status === 'not-started'"
class="confirm-deposit-transaction-modal"
:title="`Confirm transaction`"
title="Confirm transaction"
@close="closeModal"
>
<div class="flex h-full flex-col overflow-auto">
<template v-if="transaction">
Expand Down Expand Up @@ -74,7 +75,7 @@
</div>
</CommonModal>

<CommonModal v-else v-bind="$attrs" :closable="false" class="deposit-transaction-successful-modal" title="">
<CommonModal v-else opened :closable="false" class="deposit-transaction-successful-modal" title="">
<template #animation>
<AnimationsProgressPlane class="w-72" />
</template>
Expand Down Expand Up @@ -169,6 +170,9 @@ export type ConfirmationModalTransaction = {
};
const props = defineProps({
opened: {
type: Boolean,
},
transaction: {
type: Object as PropType<ConfirmationModalTransaction>,
},
Expand All @@ -191,6 +195,11 @@ const props = defineProps({
},
});
const emit = defineEmits<{
(eventName: "update:opened", value: boolean): void;
}>();
const closeModal = () => emit("update:opened", false);
const eraTransactionsHistoryStore = useEraTransactionsHistoryStore();
const walletEraStore = useEraWalletStore();
const eraEthereumBalanceStore = useEraEthereumBalanceStore();
Expand Down
23 changes: 14 additions & 9 deletions components/transaction/zksync/lite/ConfirmTransactionModal.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<template>
<CommonModal
v-if="status !== 'done'"
v-bind="$attrs"
:opened="opened"
:close-on-background-click="status === 'not-started'"
class="confirm-transaction-modal"
:title="`Confirm transaction`"
title="Confirm transaction"
@close="closeModal"
>
<div class="flex h-full flex-col overflow-auto">
<template v-if="accountActivation">
Expand Down Expand Up @@ -84,7 +85,7 @@
<transition v-bind="TransitionPrimaryButtonText" mode="out-in">
<span v-if="status === 'processing'">Processing...</span>
<span v-else-if="status === 'waiting-for-signature'">Waiting for confirmation</span>
<span v-else-if="status === 'committing'">Sending...</span>
<span v-else-if="status === 'sending'">Sending...</span>
<span v-else>Send to {{ destination.label }}</span>
</transition>
</CommonButton>
Expand All @@ -100,15 +101,11 @@

<TransferSuccessfulModal
v-else-if="destination.key === 'zkSyncLite'"
v-bind="$attrs"
opened
:transaction-hashes="transactionHashes"
:in-progress="!transactionCommitted"
/>
<WithdrawSuccessfulModal
v-else-if="destination.key === 'ethereum'"
v-bind="$attrs"
:transaction-hashes="transactionHashes"
/>
<WithdrawSuccessfulModal v-else-if="destination.key === 'ethereum'" opened :transaction-hashes="transactionHashes" />
</template>

<script lang="ts" setup>
Expand Down Expand Up @@ -146,6 +143,9 @@ export type ConfirmationModalTransaction = {
};
const props = defineProps({
opened: {
type: Boolean,
},
transactions: {
type: Array as PropType<ConfirmationModalTransaction[]>,
},
Expand Down Expand Up @@ -173,6 +173,11 @@ const props = defineProps({
},
});
const emit = defineEmits<{
(eventName: "update:opened", value: boolean): void;
}>();
const closeModal = () => emit("update:opened", false);
const liteTransactionsHistoryStore = useLiteTransactionsHistoryStore();
const liteAccountActivationStore = useLiteAccountActivationStore();
const walletLiteStore = useLiteWalletStore();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<template>
<CommonModal
v-if="status !== 'done'"
v-bind="$attrs"
:opened="opened"
:close-on-background-click="status === 'not-started'"
class="confirm-deposit-transaction-modal"
:title="`Confirm transaction`"
title="Confirm transaction"
@close="closeModal"
>
<div class="flex h-full flex-col overflow-auto">
<template v-if="transaction">
Expand Down Expand Up @@ -74,7 +75,7 @@
</div>
</CommonModal>

<CommonModal v-else v-bind="$attrs" :closable="false" class="deposit-transaction-successful-modal" title="">
<CommonModal v-else opened :closable="false" class="deposit-transaction-successful-modal" title="">
<template #animation>
<AnimationsProgressPlane class="w-72" />
</template>
Expand Down Expand Up @@ -169,6 +170,9 @@ export type ConfirmationModalTransaction = {
};
const props = defineProps({
opened: {
type: Boolean,
},
transaction: {
type: Object as PropType<ConfirmationModalTransaction>,
},
Expand All @@ -191,6 +195,11 @@ const props = defineProps({
},
});
const emit = defineEmits<{
(eventName: "update:opened", value: boolean): void;
}>();
const closeModal = () => emit("update:opened", false);
const liteTransactionsHistoryStore = useLiteTransactionsHistoryStore();
const walletLiteStore = useLiteWalletStore();
const liteEthereumBalanceStore = useLiteEthereumBalanceStore();
Expand Down
4 changes: 2 additions & 2 deletions composables/zksync/lite/useTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type TransactionParams = {
};

export default (getWalletInstance: () => Promise<Wallet | undefined>) => {
const status = ref<"not-started" | "processing" | "waiting-for-signature" | "committing" | "done">("not-started");
const status = ref<"not-started" | "processing" | "waiting-for-signature" | "sending" | "done">("not-started");
const error = ref<Error | undefined>();
const transactionHashes = ref<string[]>([]);

Expand Down Expand Up @@ -64,7 +64,7 @@ export default (getWalletInstance: () => Promise<Wallet | undefined>) => {
status.value = "waiting-for-signature";
const batchTransactionData = await batchBuilder.build();

status.value = "committing";
status.value = "sending";
const submittedTransactions = await submitSignedTransactionsBatch(
wallet.provider,
batchTransactionData.txs,
Expand Down

0 comments on commit 24e4602

Please sign in to comment.