Skip to content

Commit

Permalink
feat: separates minting steps
Browse files Browse the repository at this point in the history
  • Loading branch information
Polybius93 committed Jan 11, 2024
1 parent 9ede1aa commit f5250ef
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 43 deletions.
4 changes: 3 additions & 1 deletion src/app/components/mint-unmint/components/mint/mint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export function Mint(): React.JSX.Element {
<Walkthrough flow={'mint'} currentStep={mintStep[0]} />
{[0].includes(mintStep[0]) && <TransactionForm />}
{[1].includes(mintStep[0]) && <LockScreen currentStep={mintStep} />}
{[2].includes(mintStep[0]) && <Text color={'white'}>Wait 24 hours</Text>}
{[2].includes(mintStep[0]) && (
<TransactionSummary currentStep={mintStep} flow={'mint'} blockchain={'ethereum'} />
)}
{[3].includes(mintStep[0]) && (
<TransactionSummary currentStep={mintStep} flow={'mint'} blockchain={'ethereum'} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function ProgressTimeline({
isFirstStep
/>
<StepText currentStep={currentStep} stepIndex={1} title="Lock BTC" width={'37%'} />
<StepText currentStep={currentStep} stepIndex={2} title="Wait 24 hours" width={'29%'} />
<StepText currentStep={currentStep} stepIndex={2} title="Validation" width={'29%'} />
<StepText
currentStep={currentStep}
stepIndex={3}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { VaultCard } from '@components/vault/vault-card';
import { useVaults } from '@hooks/use-vaults';
import { mintUnmintActions } from '@store/slices/mintunmint/mintunmint.actions';

import { TransactionSummaryPreviewCard } from './components/transaction-summary-preview-card';

interface FlowPropertyMap {
[key: string]: {
[key: number]: {
Expand All @@ -19,9 +17,8 @@ interface FlowPropertyMap {

const flowPropertyMap: FlowPropertyMap = {
mint: {
2: { title: 'a) Locking BTC in progress', subtitle: 'Minting dlcBTC' },
3: { title: 'Wait....' },
4: { title: 'Minted dlcBTC' },
2: { title: 'Locking BTC in progress'},
3: { title: 'Minted dlcBTC' },
},
unmint: {
1: {
Expand All @@ -43,7 +40,6 @@ interface TransactionSummaryProps {
export function TransactionSummary({
currentStep,
flow,
blockchain,
handleClose,
}: TransactionSummaryProps): React.JSX.Element {
const navigate = useNavigate();
Expand All @@ -52,7 +48,7 @@ export function TransactionSummary({
const currentVault = allVaults.find(vault => vault.uuid === currentStep[1]);

const showProcessing =
(flow === 'mint' && currentStep[0] === 3) || (flow === 'unmint' && currentStep[0] === 2);
(flow === 'mint' && currentStep[0] === 2) || (flow === 'unmint' && currentStep[0] === 2);

return (
<VStack alignItems={'start'} w={'300px'} spacing={'15px'}>
Expand All @@ -61,17 +57,6 @@ export function TransactionSummary({
<Text color={'accent.cyan.01'}>{flowPropertyMap[flow][currentStep[0]].title}:</Text>
</HStack>
<VaultCard vault={currentVault} />
{showProcessing && (
<>
<Text pt={'25px'} color={'white.01'}>
b) {flowPropertyMap[flow][currentStep[0]].subtitle}:
</Text>
<TransactionSummaryPreviewCard
blockchain={blockchain}
assetAmount={currentVault?.collateral}
/>
</>
)}
<Stack p={'5px'} w={'100%'}>
<Text color={'white.01'} fontSize={'sm'}>
View vault statuses in the My Vaults tab.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,20 @@ export function Walkthrough({ flow, currentStep }: WalkthroughProps): React.JSX.
<WalkthroughLayout>
<WalkthroughHeader
currentStep={currentStep}
title={'Waiting'}
blockchain={'bitcoin'}
title={'Validation'}
blockchain={'ethereum'}
/>
<Text color={'white.01'} fontSize={'md'}>
Waiting.......
<Text color={'white.01'} fontSize={'sm'}>
Wait until Bitcoin is locked on-chain and all other validation checks have been
processed{' '}
<Link
color={'accent.cyan.01'}
href="https://ethereum.org/"
isExternal
textDecoration={'underline'}
>
(~1 hour)
</Link>
</Text>
</WalkthroughLayout>
);
Expand All @@ -85,20 +94,12 @@ export function Walkthrough({ flow, currentStep }: WalkthroughProps): React.JSX.
<WalkthroughLayout>
<WalkthroughHeader
currentStep={currentStep}
title={'Mint dlcBTC'}
title={'Minted dlcBTC'}
blockchain={'ethereum'}
/>
<Text color={'white.01'} fontSize={'sm'}>
Wait for Bitcoin to get locked on chain{' '}
<Link
color={'accent.cyan.01'}
href="https://ethereum.org/"
isExternal
textDecoration={'underline'}
>
(~1 hour)
</Link>
. After 6 confirmations, dlcBTC tokens will appear in your Ethereum Wallet.
Your request is validated and you have successfully minted a{' '}
<span style={{ fontWeight: 800 }}>dlcBTC token.</span>
</Text>
<Text color={'white.01'} fontSize={'sm'}>
To ensure your <span style={{ fontWeight: 800 }}>dlcBTC tokens </span>
Expand Down
8 changes: 7 additions & 1 deletion src/app/components/my-vaults/my-vaults-large.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ export function MyVaultsLarge(): React.JSX.Element {
/>
<HStack spacing={'35px'} w={'100%'}>
{address ? (
<VaultsList title={'In Process'} height={'475px'} isScrollable={!!address}>
<VaultsList
title={'In Process'}
height={'475px'}
isScrollable={
!!address && [...readyVaults, ...fundingVaults, ...closingVaults].length > 0
}
>
<VaultsListGroupContainer label="Lock BTC" vaults={readyVaults} />
<VaultsListGroupContainer label="Locking BTC in Progress" vaults={fundingVaults} />
<VaultsListGroupContainer label="Unlocking BTC in Progress" vaults={closingVaults} />
Expand Down
8 changes: 1 addition & 7 deletions src/app/hooks/use-observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,7 @@ export function useObserver(ethereum: UseEthereumReturnType): void {
console.log(`Vault ${vaultUUID} is minted`);

await getVault(vaultUUID, VaultState.FUNDED).then(() => {
dispatch(mintUnmintActions.setMintStep([0, vaultUUID]));
dispatch(
modalActions.toggleSuccessfulFlowModalVisibility({
flow: 'mint',
vaultUUID,
})
);
dispatch(mintUnmintActions.setMintStep([3, vaultUUID]));
});
});

Expand Down

0 comments on commit f5250ef

Please sign in to comment.