const _ = require('lodash/fp')
const settingsLoader = require('../lib/new-settings-loader')
const configManager = require('../lib/new-config-manager')

exports.up = async function (next) {
  const { config } = await settingsLoader.loadLatest()
  const cryptoCodes = configManager.getCryptosFromWalletNamespace(config)
  _.forEach(cryptoCode => {
    const key = `wallets_${cryptoCode}_zeroConf`
    const zeroConfSetting = _.get(key, config)
    if (cryptoCode === 'BTC' && zeroConfSetting === 'blockcypher') return
    if (!_.isNil(zeroConfSetting) && zeroConfSetting !== 'none') {
      config[key] = 'none'
    }
  }, cryptoCodes)
  return settingsLoader.saveConfig(config).then(() => next()).catch(err => next(err))
}

exports.down = function (next) {
  next()
}

@@ -673,51 +673,8 @@
 fig)
-.then(() =%3E next()).catch(err =%3E next(err))
 %0A%7D%0A%0A

remove unnecessary then and catch