Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/hooks/useWallet.js
/* eslint-disable react-hooks/exhaustive-deps */ | /* eslint-disable react-hooks/exhaustive-deps */ | ||||
import { useState, useEffect } from 'react'; | import { useState, useEffect } from 'react'; | ||||
import useAsyncTimeout from '@hooks/useAsyncTimeout'; | import useAsyncTimeout from 'hooks/useAsyncTimeout'; | ||||
import usePrevious from '@hooks/usePrevious'; | import usePrevious from 'hooks/usePrevious'; | ||||
import useBCH from '@hooks/useBCH'; | import useBCH from 'hooks/useBCH'; | ||||
import BigNumber from 'bignumber.js'; | import BigNumber from 'bignumber.js'; | ||||
import { | import { | ||||
fromSmallestDenomination, | fromSmallestDenomination, | ||||
loadStoredWallet, | loadStoredWallet, | ||||
isValidStoredWallet, | isValidStoredWallet, | ||||
isLegacyMigrationRequired, | isLegacyMigrationRequired, | ||||
} from '@utils/cashMethods'; | } from 'utils/cashMethods'; | ||||
import { isValidCashtabSettings } from '@utils/validation'; | import { isValidCashtabSettings } from 'utils/validation'; | ||||
import localforage from 'localforage'; | import localforage from 'localforage'; | ||||
import { currency } from '@components/Common/Ticker'; | import { currency } from 'components/Common/Ticker'; | ||||
import isEmpty from 'lodash.isempty'; | import isEmpty from 'lodash.isempty'; | ||||
import isEqual from 'lodash.isequal'; | import isEqual from 'lodash.isequal'; | ||||
import { | import { | ||||
xecReceivedNotification, | xecReceivedNotification, | ||||
eTokenReceivedNotification, | eTokenReceivedNotification, | ||||
} from '@components/Common/Notifications'; | } from 'components/Common/Notifications'; | ||||
const useWallet = () => { | const useWallet = () => { | ||||
const [wallet, setWallet] = useState(false); | const [wallet, setWallet] = useState(false); | ||||
const [cashtabSettings, setCashtabSettings] = useState(false); | const [cashtabSettings, setCashtabSettings] = useState(false); | ||||
const [fiatPrice, setFiatPrice] = useState(null); | const [fiatPrice, setFiatPrice] = useState(null); | ||||
const [apiError, setApiError] = useState(false); | const [apiError, setApiError] = useState(false); | ||||
const [checkFiatInterval, setCheckFiatInterval] = useState(null); | const [checkFiatInterval, setCheckFiatInterval] = useState(null); | ||||
const { | const { | ||||
getBCH, | getBCH, | ||||
▲ Show 20 Lines • Show All 1,112 Lines • Show Last 20 Lines |