Merge pull request #1418 from ubavic/release-cryptounits
fix: coin-specific cryptounits in Wizard and default value
This commit is contained in:
commit
e242ce1987
2 changed files with 5 additions and 10 deletions
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue