Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: #667, #668 #704

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions components/CreateWalletDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const CreateWalletDialog: React.FC<CreateWalletDialogProps> = ({ open, onClose,
data: { mnemonic: input },
})
setMnemonic(wallet.mnemonic)
setStage(CommonStage.SetPreferenceStage)
setStage(CommonStage.SetSecurityPasswordStage)
} catch (err) {
setError(t(err.message))
}
Expand All @@ -116,7 +116,8 @@ const CreateWalletDialog: React.FC<CreateWalletDialogProps> = ({ open, onClose,
data,
})
setMnemonic(wallet.mnemonic)
setStage(CommonStage.SetPreferenceStage)

setStage(CommonStage.SetSecurityPasswordStage)
} catch (err) {
setError(t(err.message))
}
Expand All @@ -137,7 +138,7 @@ const CreateWalletDialog: React.FC<CreateWalletDialogProps> = ({ open, onClose,

const setPreference = React.useCallback(() => {
try {
setStage(CommonStage.SetSecurityPasswordStage)
onClose()
} catch (err) {
setError(t(err.message))
}
Expand Down Expand Up @@ -169,7 +170,9 @@ const CreateWalletDialog: React.FC<CreateWalletDialogProps> = ({ open, onClose,
addresses: defaultAddresses,
})
closeAllLedgerConnections()
onClose()
// onClose()
console.log('adding wallet')
setStage(CommonStage.SetPreferenceStage)
} else {
const addresses = await Promise.all(
cryptos.map((c) =>
Expand All @@ -191,7 +194,8 @@ const CreateWalletDialog: React.FC<CreateWalletDialogProps> = ({ open, onClose,
securityPassword,
addresses,
})
onClose()

setStage(CommonStage.SetPreferenceStage)
}
},
[addWallet, mnemonic, securityPassword, onClose]
Expand All @@ -211,7 +215,7 @@ const CreateWalletDialog: React.FC<CreateWalletDialogProps> = ({ open, onClose,
case ImportStage.ConnectLedgerDeviceStage:
return {
title: '',
step: 3,
step: ledgerCryptos.length ? 3 : 2,
content: (
<ConnectLedgerDialogContent
onConnect={async (signer) => {
Expand Down Expand Up @@ -291,20 +295,20 @@ const CreateWalletDialog: React.FC<CreateWalletDialogProps> = ({ open, onClose,
case CommonStage.SetPreferenceStage:
return {
title: t('your preference'),
step: 3,
step: 5,
content: <SetPreference onConfirm={setPreference} />,
}
case CommonStage.SetSecurityPasswordStage:
return {
title: t('security password title'),
step: 4,
step: 3,
content: <SecurityPassword onConfirm={confirmSecurityPassword} />,
}
case CommonStage.ImportWalletStage:
case CommonStage.ImportLedgerWalletStage:
return {
title: t('import wallet title'),
step: 5,
step: stage === CommonStage.ImportLedgerWalletStage ? 3 : 4,
content: (
<ImportWallet
onConfirm={(name, cryptos) =>
Expand Down