From 247a8369c4321b5d2ddb6d706e3d516085be074d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20Stu=CC=88ber?= <15174476+TorstenStueber@users.noreply.github.com> Date: Tue, 20 Aug 2024 16:59:09 -0300 Subject: [PATCH 1/4] Indicate current phase --- src/pages/progress/index.tsx | 41 +++++++++++++++++++++++++++++++++++- src/pages/swap/index.tsx | 2 +- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/pages/progress/index.tsx b/src/pages/progress/index.tsx index cb720cb3..ad3b9f74 100644 --- a/src/pages/progress/index.tsx +++ b/src/pages/progress/index.tsx @@ -10,9 +10,10 @@ const handleTabClose = (event: Event) => { interface ProgressPageProps { setOfframpingPhase: StateUpdater; + offrampingPhase: OfframpingPhase | FinalOfframpingPhase | undefined; } -export const ProgressPage: FC = ({ setOfframpingPhase }) => { +export const ProgressPage: FC = ({ setOfframpingPhase, offrampingPhase }) => { // After 15 minutes of waiting, we want to redirect user to the failure page. useEffect(() => { const timer = setTimeout(() => { @@ -27,6 +28,43 @@ export const ProgressPage: FC = ({ setOfframpingPhase }) => { }; }, [setOfframpingPhase]); + let phaseMessage: string | undefined; + switch (offrampingPhase) { + case 'prepareTransactions': + phaseMessage = '1/11: Prepare transactions'; + break; + case 'squidRouter': + phaseMessage = '2/11: Axelar bridge'; + break; + case 'pendulumFundEphemeral': + phaseMessage = '3/11: Create Pendulum ephemeral account'; + break; + //case 'subsidizePreSwap': + // phaseMessage = '4/11: Compensate swap risk'; + // break; + case 'nablaApprove': + phaseMessage = '5/11: Forex AMM approval'; + break; + case 'nablaSwap': + phaseMessage = '6/11: Forex AMM swap'; + break; + //case 'subsidizePostSwap': + // phaseMessage = '7/11: Compensate swap risk'; + // break; + case 'executeSpacewalkRedeem': + phaseMessage = '8/11: Spacewalk bridge'; + break; + case 'pendulumCleanup': + phaseMessage = '9/11: Cleanup Pendulum ephemeral account'; + break; + case 'stellarOfframp': + phaseMessage = '10/11: Stellar Offramp'; + break; + case 'stellarCleanup': + phaseMessage = '11/11: Cleanup Stellar ephemeral account'; + break; + } + const main = (
@@ -34,6 +72,7 @@ export const ProgressPage: FC = ({ setOfframpingPhase }) => {

DO NOT CLOSE THIS TAB!

Your transaction is in progress.

+ {phaseMessage &&

{phaseMessage}

}

Closing this tab can result in the transaction not being processed.

diff --git a/src/pages/swap/index.tsx b/src/pages/swap/index.tsx index 7b706306..5ea8fab1 100644 --- a/src/pages/swap/index.tsx +++ b/src/pages/swap/index.tsx @@ -226,7 +226,7 @@ export const SwapPage = () => { const showMainScreenAnyway = offrampingPhase === undefined || ['prepareTransactions', 'squidRouter'].includes(offrampingPhase); if (!showMainScreenAnyway) { - return ; + return ; } } From a7b9ccae45622017e4abd478de2092cc6812285c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20Stu=CC=88ber?= <15174476+TorstenStueber@users.noreply.github.com> Date: Tue, 27 Aug 2024 06:20:58 -0300 Subject: [PATCH 2/4] Add the subsidization phases --- src/pages/progress/index.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/progress/index.tsx b/src/pages/progress/index.tsx index ad3b9f74..15339baa 100644 --- a/src/pages/progress/index.tsx +++ b/src/pages/progress/index.tsx @@ -39,18 +39,18 @@ export const ProgressPage: FC = ({ setOfframpingPhase, offram case 'pendulumFundEphemeral': phaseMessage = '3/11: Create Pendulum ephemeral account'; break; - //case 'subsidizePreSwap': - // phaseMessage = '4/11: Compensate swap risk'; - // break; + case 'subsidizePreSwap': + phaseMessage = '4/11: Compensate swap risk'; + break; case 'nablaApprove': phaseMessage = '5/11: Forex AMM approval'; break; case 'nablaSwap': phaseMessage = '6/11: Forex AMM swap'; break; - //case 'subsidizePostSwap': - // phaseMessage = '7/11: Compensate swap risk'; - // break; + case 'subsidizePostSwap': + phaseMessage = '7/11: Compensate swap risk'; + break; case 'executeSpacewalkRedeem': phaseMessage = '8/11: Spacewalk bridge'; break; From 897c8d9c67cab85ac280a4a0f2915ba0440662de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20Stu=CC=88ber?= <15174476+TorstenStueber@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:14:27 -0300 Subject: [PATCH 3/4] Update wording for phases --- src/pages/progress/index.tsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/pages/progress/index.tsx b/src/pages/progress/index.tsx index 15339baa..36561b93 100644 --- a/src/pages/progress/index.tsx +++ b/src/pages/progress/index.tsx @@ -31,37 +31,37 @@ export const ProgressPage: FC = ({ setOfframpingPhase, offram let phaseMessage: string | undefined; switch (offrampingPhase) { case 'prepareTransactions': - phaseMessage = '1/11: Prepare transactions'; + phaseMessage = '1/11: Preparing transactions'; break; case 'squidRouter': - phaseMessage = '2/11: Axelar bridge'; + phaseMessage = '2/11: Bridging assets via Axelar'; break; case 'pendulumFundEphemeral': - phaseMessage = '3/11: Create Pendulum ephemeral account'; + phaseMessage = '3/11: Creating Pendulum ephemeral account'; break; case 'subsidizePreSwap': - phaseMessage = '4/11: Compensate swap risk'; + phaseMessage = '4/11: Compensating swap risk'; break; case 'nablaApprove': - phaseMessage = '5/11: Forex AMM approval'; + phaseMessage = '5/11: Approving Forex AMM'; break; case 'nablaSwap': - phaseMessage = '6/11: Forex AMM swap'; + phaseMessage = '6/11: Swapping on Forex AMM'; break; case 'subsidizePostSwap': - phaseMessage = '7/11: Compensate swap risk'; + phaseMessage = '7/11: Compensating swap risk'; break; case 'executeSpacewalkRedeem': - phaseMessage = '8/11: Spacewalk bridge'; + phaseMessage = '8/11: Bridging assets via Spacewalk'; break; case 'pendulumCleanup': - phaseMessage = '9/11: Cleanup Pendulum ephemeral account'; + phaseMessage = '9/11: Cleaning up Pendulum ephemeral account'; break; case 'stellarOfframp': - phaseMessage = '10/11: Stellar Offramp'; + phaseMessage = '10/11: Offramping on Stellar'; break; case 'stellarCleanup': - phaseMessage = '11/11: Cleanup Stellar ephemeral account'; + phaseMessage = '11/11: Cleaning up Stellar ephemeral account'; break; } From 7318f3b4a4efb76e4fed10a0dc86bbff02f4861e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20Stu=CC=88ber?= <15174476+TorstenStueber@users.noreply.github.com> Date: Tue, 27 Aug 2024 13:58:22 -0300 Subject: [PATCH 4/4] Change switch statement to struct --- src/pages/progress/index.tsx | 54 ++++++++++++------------------------ 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/src/pages/progress/index.tsx b/src/pages/progress/index.tsx index 36561b93..06c23048 100644 --- a/src/pages/progress/index.tsx +++ b/src/pages/progress/index.tsx @@ -4,6 +4,20 @@ import { FinalOfframpingPhase, OfframpingPhase } from '../../services/offramping import { Box } from '../../components/Box'; import { BaseLayout } from '../../layouts'; +const OFFRAMPING_PHASE_MESSAGES: Record = { + prepareTransactions: '1/11: Preparing transactions', + squidRouter: '2/11: Bridging assets via Axelar', + pendulumFundEphemeral: '3/11: Creating Pendulum ephemeral account', + subsidizePreSwap: '4/11: Compensating swap risk', + nablaApprove: '5/11: Approving Forex AMM', + nablaSwap: '6/11: Swapping on Forex AMM', + subsidizePostSwap: '7/11: Compensating swap risk', + executeSpacewalkRedeem: '8/11: Bridging assets via Spacewalk', + pendulumCleanup: '9/11: Cleaning up Pendulum ephemeral account', + stellarOfframp: '10/11: Offramping on Stellar', + stellarCleanup: '11/11: Cleaning up Stellar ephemeral account', +}; + const handleTabClose = (event: Event) => { event.preventDefault(); }; @@ -28,42 +42,10 @@ export const ProgressPage: FC = ({ setOfframpingPhase, offram }; }, [setOfframpingPhase]); - let phaseMessage: string | undefined; - switch (offrampingPhase) { - case 'prepareTransactions': - phaseMessage = '1/11: Preparing transactions'; - break; - case 'squidRouter': - phaseMessage = '2/11: Bridging assets via Axelar'; - break; - case 'pendulumFundEphemeral': - phaseMessage = '3/11: Creating Pendulum ephemeral account'; - break; - case 'subsidizePreSwap': - phaseMessage = '4/11: Compensating swap risk'; - break; - case 'nablaApprove': - phaseMessage = '5/11: Approving Forex AMM'; - break; - case 'nablaSwap': - phaseMessage = '6/11: Swapping on Forex AMM'; - break; - case 'subsidizePostSwap': - phaseMessage = '7/11: Compensating swap risk'; - break; - case 'executeSpacewalkRedeem': - phaseMessage = '8/11: Bridging assets via Spacewalk'; - break; - case 'pendulumCleanup': - phaseMessage = '9/11: Cleaning up Pendulum ephemeral account'; - break; - case 'stellarOfframp': - phaseMessage = '10/11: Offramping on Stellar'; - break; - case 'stellarCleanup': - phaseMessage = '11/11: Cleaning up Stellar ephemeral account'; - break; - } + const phaseMessage = + offrampingPhase === undefined || offrampingPhase === 'failure' || offrampingPhase === 'success' + ? undefined + : OFFRAMPING_PHASE_MESSAGES[offrampingPhase]; const main = (