Merge pull request #1320 from chaotixkilla/fix-remove-coin-specific-unit-fields

Remove coin-specific cryptounits from config
This commit is contained in:
Rafael Taranto 2022-08-01 09:55:06 +01:00 committed by GitHub
commit 1d0f3cd27c
4 changed files with 37 additions and 13 deletions

View file

@ -0,0 +1,22 @@
const { removeFromConfig, loadLatest } = require('../lib/new-settings-loader')
const { getCryptosFromWalletNamespace } = require('../lib/new-config-manager.js')
const _ = require('lodash/fp')
exports.up = function (next) {
loadLatest()
.then(settings => {
const configuredCryptos = getCryptosFromWalletNamespace(settings.config)
if (!configuredCryptos.length) return Promise.resolve()
return removeFromConfig(_.map(it => `wallets_${it}_cryptoUnits`, configuredCryptos))
})
.then(() => next())
.catch(err => {
console.log(err.message)
return next(err)
})
}
exports.down = function (next) {
next()
}