fix: generelise deprecation

This commit is contained in:
José Oliveira 2021-02-23 19:07:11 +00:00 committed by Josh Harvey
parent db13106a2f
commit a4c0bab814
4 changed files with 6 additions and 3 deletions

View file

@ -22,7 +22,7 @@ const ALL_ACCOUNTS = [
{ code: 'bitcoind', display: 'bitcoind', class: WALLET, cryptos: [BTC] },
{ code: 'no-layer2', display: 'No Layer 2', class: LAYER_2, cryptos: ALL_CRYPTOS },
{ code: 'infura', display: 'Infura', class: WALLET, cryptos: [ETH] },
{ code: 'geth', display: 'geth', class: WALLET, cryptos: [ETH] },
{ code: 'geth', display: 'geth (DEPRECATED)', class: WALLET, cryptos: [ETH], deprecated: true },
{ code: 'zcashd', display: 'zcashd', class: WALLET, cryptos: [ZEC] },
{ code: 'litecoind', display: 'litecoind', class: WALLET, cryptos: [LTC] },
{ code: 'dashd', display: 'dashd', class: WALLET, cryptos: [DASH] },

View file

@ -135,6 +135,7 @@ const typeDefs = gql`
display: String!
class: String!
cryptos: [String]
deprecated: Boolean
}
type MachineLog {

View file

@ -35,6 +35,7 @@ const GET_INFO = gql`
display
class
cryptos
deprecated
}
cryptoCurrencies {
code

View file

@ -15,10 +15,11 @@ const contains = crypto => R.compose(R.contains(crypto), R.prop('cryptos'))
const sameClass = type => R.propEq('class', type)
const filterConfig = (crypto, type) =>
R.filter(it => sameClass(type)(it) && contains(crypto)(it))
const removeGethOption = R.filter(config => config.code !== 'geth')
const removeDeprecated = R.filter(({ deprecated }) => !deprecated)
const getItems = (accountsConfig, accounts, type, crypto) => {
const fConfig = removeGethOption(filterConfig(crypto, type)(accountsConfig))
const fConfig = removeDeprecated(filterConfig(crypto, type)(accountsConfig))
const find = code => accounts && accounts[code]
const [filled, unfilled] = R.partition(({ code }) => {