diff --git a/new-lamassu-admin/src/pages/Wallet/Wizard.js b/new-lamassu-admin/src/pages/Wallet/Wizard.js
index 4787f8db..42f11940 100644
--- a/new-lamassu-admin/src/pages/Wallet/Wizard.js
+++ b/new-lamassu-admin/src/pages/Wallet/Wizard.js
@@ -10,7 +10,7 @@ import { toNamespace } from 'src/utils/config'
import WizardSplash from './WizardSplash'
import WizardStep from './WizardStep'
-const LAST_STEP = 5
+const MAX_STEPS = 5
const MODAL_WIDTH = 554
const contains = crypto => R.compose(R.contains(crypto), R.prop('cryptos'))
@@ -51,7 +51,6 @@ const Wizard = ({
})
const title = `Enable ${coin.display}`
- const isLastStep = step === LAST_STEP
const tickers = { filled: filterConfig(coin.code, 'ticker')(accountsConfig) }
const wallets = getItems(accountsConfig, accounts, 'wallet', coin.code)
@@ -60,6 +59,34 @@ const Wizard = ({
const getValue = code => R.find(R.propEq('code', code))(accounts)
+ const commonWizardSteps = [
+ { type: 'ticker', ...tickers },
+ { type: 'wallet', ...wallets },
+ { type: 'exchange', ...exchanges }
+ ]
+
+ const hasZeroConfs =
+ !R.isEmpty(zeroConfs.filled) ||
+ (!R.isNil(zeroConfs.unfilled) && !R.isEmpty(zeroConfs.unfilled))
+
+ const wizardSteps = hasZeroConfs
+ ? R.concat(commonWizardSteps, [
+ {
+ type: 'zeroConf',
+ name: 'confidence checking',
+ schema: Yup.object().shape({
+ zeroConfLimit: Yup.number().required()
+ }),
+ ...zeroConfs
+ },
+ { type: 'zeroConfLimit', name: '0-conf limit', ...zeroConfs }
+ ])
+ : commonWizardSteps
+
+ const lastStep = wizardSteps.length
+ const isLastStep = step === lastStep
+ const stepData = step > 0 ? wizardSteps[step - 1] : null
+
const onContinue = async (stepConfig, stepAccount) => {
const newConfig = R.merge(config, stepConfig)
const newAccounts = stepAccount
@@ -84,30 +111,6 @@ const Wizard = ({
})
}
- const getStepData = () => {
- switch (step) {
- case 1:
- return { type: 'ticker', ...tickers }
- case 2:
- return { type: 'wallet', ...wallets }
- case 3:
- return { type: 'exchange', ...exchanges }
- case 4:
- return {
- type: 'zeroConf',
- name: 'confidence checking',
- schema: Yup.object().shape({
- zeroConfLimit: Yup.number().required()
- }),
- ...zeroConfs
- }
- case 5:
- return { type: 'zeroConfLimit', name: '0-conf limit', ...zeroConfs }
- default:
- return null
- }
- }
-
return (