feat: address prompt feature toggle on ui
This commit is contained in:
parent
e6ffcacb78
commit
a4bdbd1416
3 changed files with 33 additions and 1 deletions
|
|
@ -36,6 +36,7 @@ const AdvancedWalletSchema = Yup.object().shape({
|
|||
cryptoUnits: Yup.string().required(),
|
||||
feeMultiplier: Yup.string().required(),
|
||||
allowTransactionBatching: Yup.boolean(),
|
||||
enableLastUsedAddress: Yup.boolean(),
|
||||
})
|
||||
|
||||
const OverridesSchema = Yup.object().shape({
|
||||
|
|
@ -127,6 +128,17 @@ const getAdvancedWalletElements = () => {
|
|||
labelProp: 'display',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'enableLastUsedAddress',
|
||||
header: `Allow last used address prompt `,
|
||||
size: 'sm',
|
||||
stripe: true,
|
||||
width: 260,
|
||||
view: (_, ite) => {
|
||||
return ite.enableLastUsedAddress ? 'Yes' : `No`
|
||||
},
|
||||
input: Checkbox,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -353,7 +353,11 @@ function addOrUpdateCustomer(
|
|||
.then(discount => ({ ...customer, discount }))
|
||||
})
|
||||
.then(customer => {
|
||||
if (!cryptoCode) return customer
|
||||
const enableLastUsedAddress = !!configManager.getWalletSettings(
|
||||
cryptoCode,
|
||||
config,
|
||||
).enableLastUsedAddress
|
||||
if (!cryptoCode || !enableLastUsedAddress) return customer
|
||||
return customers
|
||||
.getLastUsedAddress(customer.id, cryptoCode)
|
||||
.then(lastUsedAddress => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
const { saveConfig } = require('../lib/new-settings-loader')
|
||||
|
||||
exports.up = function (next) {
|
||||
const newConfig = {
|
||||
wallets_advanced_enableLastUsedAddress: false,
|
||||
}
|
||||
return saveConfig(newConfig)
|
||||
.then(next)
|
||||
.catch(err => {
|
||||
return next(err)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports.down = function (next) {
|
||||
next()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue