Merge pull request #1418 from ubavic/release-cryptounits

fix: coin-specific cryptounits in Wizard and default value
This commit is contained in:
Rafael Taranto 2022-10-20 20:27:39 +01:00 committed by GitHub
commit e242ce1987
2 changed files with 5 additions and 10 deletions

View file

@ -145,13 +145,13 @@ const getTriggersAutomation = (customInfoRequests, config) => {
const splitGetFirst = _.compose(_.head, _.split('_')) const splitGetFirst = _.compose(_.head, _.split('_'))
const getCryptosFromWalletNamespace = config => { const getCryptosFromWalletNamespace =
return _.uniq(_.map(splitGetFirst, _.keys(fromNamespace('wallets', config)))) _.compose(_.without(['advanced']), _.uniq, _.map(splitGetFirst), _.keys, fromNamespace('wallets'))
}
const getCashInSettings = config => fromNamespace(namespaces.CASH_IN)(config) const getCashInSettings = config => fromNamespace(namespaces.CASH_IN)(config)
const getCryptoUnits = (crypto, config) => getWalletSettings(crypto, config).cryptoUnits const getCryptoUnits = (crypto, config) =>
getWalletSettings(crypto, config).cryptoUnits ?? 'full'
const setTermsConditions = toNamespace(namespaces.TERMS_CONDITIONS) const setTermsConditions = toNamespace(namespaces.TERMS_CONDITIONS)

View file

@ -1,5 +1,4 @@
import { useQuery, useMutation } from '@apollo/react-hooks' import { useQuery, useMutation } from '@apollo/react-hooks'
import { utils as coinUtils } from '@lamassu/coins'
import { makeStyles } from '@material-ui/core' import { makeStyles } from '@material-ui/core'
import gql from 'graphql-tag' import gql from 'graphql-tag'
import * as R from 'ramda' import * as R from 'ramda'
@ -54,13 +53,9 @@ const AllSet = ({ data: currentData, doContinue }) => {
const cryptoCurrencies = data?.cryptoCurrencies ?? [] const cryptoCurrencies = data?.cryptoCurrencies ?? []
const save = () => { const save = () => {
const defaultCryptoUnit = R.head(
R.keys(coinUtils.getCryptoCurrency(coin).units)
)
const adjustedData = { const adjustedData = {
zeroConfLimit: 0, zeroConfLimit: 0,
...currentData, ...currentData
cryptoUnits: defaultCryptoUnit
} }
if (!WalletSchema.isValidSync(adjustedData)) return setError(true) if (!WalletSchema.isValidSync(adjustedData)) return setError(true)