diff --git a/migrations/1617742522808-zeroConfLimit-migrate.js b/migrations/1617742522808-zeroConfLimit-migrate.js
index 56d42f9b..6e5a4789 100644
--- a/migrations/1617742522808-zeroConfLimit-migrate.js
+++ b/migrations/1617742522808-zeroConfLimit-migrate.js
@@ -3,13 +3,27 @@ var db = require('../lib/db')
const settingsLoader = require('../lib/new-settings-loader')
const configManager = require('../lib/new-config-manager')
+const stripl = _.curry((q, str) => _.startsWith(q, str) ? str.slice(q.length) : str)
+const filter = namespace => _.pickBy((value, key) => _.startsWith(`${namespace}_`)(key))
+const strip = key => _.mapKeys(stripl(`${key}_`))
+
+const fromNamespace = _.curry((key, config) => _.compose(strip(key), filter(key))(config))
+
+const split = _.curry(_.split)
+const composed = _.compose(_.head, split('_'))
+
+const getCryptoCodes = (config) => {
+ const walletKeys = _.keys(fromNamespace('wallets', config))
+ return _.uniq(_.map(composed, walletKeys))
+}
+
exports.up = function (next) {
db.tx(async t => {
let min = Infinity
const sp = settingsLoader.loadLatest()
const mp = t.any('SELECT device_id FROM devices')
const [{ config }, machines] = await Promise.all([sp, mp])
- const cryptoCurrencies = config.locale_cryptoCurrencies
+ const cryptoCodes = getCryptoCodes(config)
_.forEach(o => {
const machineId = o.device_id
@@ -29,10 +43,10 @@ exports.up = function (next) {
if (!zeroConfLimit) {
config[key] = Number(min)
}
- }, cryptoCurrencies)
+ }, cryptoCodes)
const regexp = /^cashOut_[0-9a-z]+_zeroConfLimit$/
- const keysToErase = Object.keys(config).filter(key => key.match(regexp))
+ const keysToErase = _.keys(config).filter(key => key.match(regexp))
_.forEach(key => {
config[key] = null
diff --git a/new-lamassu-admin/src/pages/Locales/Locales.js b/new-lamassu-admin/src/pages/Locales/Locales.js
index faf88974..a22a6ded 100644
--- a/new-lamassu-admin/src/pages/Locales/Locales.js
+++ b/new-lamassu-admin/src/pages/Locales/Locales.js
@@ -149,6 +149,7 @@ const Locales = ({ name: SCREEN_KEY }) => {
if (!coin) return setValue(curr)
const namespaced = fromNamespace(coin)(wallets)
+ console.log(namespaced)
if (!WalletSchema.isValidSync(namespaced)) {
setOnChangeFunction(() => () => setValue(curr))
setWizard(coin)
diff --git a/new-lamassu-admin/src/pages/Wallet/Wizard.js b/new-lamassu-admin/src/pages/Wallet/Wizard.js
index 4e3e24ac..2af2b618 100644
--- a/new-lamassu-admin/src/pages/Wallet/Wizard.js
+++ b/new-lamassu-admin/src/pages/Wallet/Wizard.js
@@ -8,7 +8,7 @@ import { toNamespace } from 'src/utils/config'
import WizardSplash from './WizardSplash'
import WizardStep from './WizardStep'
-const LAST_STEP = 5
+const LAST_STEP = 4
const MODAL_WIDTH = 554
const contains = crypto => R.compose(R.contains(crypto), R.prop('cryptos'))
@@ -65,6 +65,7 @@ const Wizard = ({
: accountsToSave
if (isLastStep) {
+ newConfig.zeroConfLimit = 0
return save(toNamespace(coin.code, newConfig), newAccounts)
}
@@ -85,8 +86,6 @@ const Wizard = ({
return { type: 'exchange', ...exchanges }
case 4:
return { type: 'zeroConf', name: 'zero conf', ...zeroConfs }
- case 5:
- return { type: 'zeroConfLimit' }
default:
return null
}
diff --git a/new-lamassu-admin/src/pages/Wallet/WizardStep.js b/new-lamassu-admin/src/pages/Wallet/WizardStep.js
index 475b40b8..1699115a 100644
--- a/new-lamassu-admin/src/pages/Wallet/WizardStep.js
+++ b/new-lamassu-admin/src/pages/Wallet/WizardStep.js
@@ -2,13 +2,11 @@ import { makeStyles } from '@material-ui/core'
import classnames from 'classnames'
import * as R from 'ramda'
import React, { useReducer, useEffect } from 'react'
-import * as Yup from 'yup'
import ErrorMessage from 'src/components/ErrorMessage'
import Stepper from 'src/components/Stepper'
import { Button } from 'src/components/buttons'
import { RadioGroup, Autocomplete } from 'src/components/inputs'
-import { NumberInput } from 'src/components/inputs/formik'
import { H4, Info2 } from 'src/components/typography'
import FormRenderer from 'src/pages/Services/FormRenderer'
import schema from 'src/pages/Services/schemas'
@@ -84,13 +82,6 @@ const WizardStep = ({
onContinue(config, account)
}
- const zeroConfLimitSchema = Yup.object().shape({
- zeroConfLimit: Yup.number()
- .integer()
- .required()
- .min(0)
- .max(999999999)
- })
const label = lastStep ? 'Finish' : 'Next'
const displayName = name ?? type
const subtitleClass = {
@@ -100,83 +91,54 @@ const WizardStep = ({
return (
<>