fix: add crypto unit config when setting up a new wallet

This commit is contained in:
José Oliveira 2021-07-28 00:39:54 +01:00
parent bcbae6f19a
commit ce0c7efe52
3 changed files with 35 additions and 12 deletions

View file

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