Changeset View
Changeset View
Standalone View
Standalone View
cashtab/src/hooks/useWallet.js
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | const useWallet = chronik => { | ||||
const [hasUpdated, setHasUpdated] = useState(false); | const [hasUpdated, setHasUpdated] = useState(false); | ||||
const [loading, setLoading] = useState(true); | const [loading, setLoading] = useState(true); | ||||
const [aliases, setAliases] = useState({ | const [aliases, setAliases] = useState({ | ||||
registered: [], | registered: [], | ||||
pending: [], | pending: [], | ||||
}); | }); | ||||
const [aliasPrices, setAliasPrices] = useState(null); | const [aliasPrices, setAliasPrices] = useState(null); | ||||
const [aliasServerError, setAliasServerError] = useState(false); | const [aliasServerError, setAliasServerError] = useState(false); | ||||
const [aliasPriceError, setAliasPriceError] = useState(false); | |||||
const [aliasIntervalId, setAliasIntervalId] = useState(null); | const [aliasIntervalId, setAliasIntervalId] = useState(null); | ||||
const [chaintipBlockheight, setChaintipBlockheight] = useState(0); | const [chaintipBlockheight, setChaintipBlockheight] = useState(0); | ||||
const { balances, tokens } = isValidStoredWallet(wallet) | const { balances, tokens } = isValidStoredWallet(wallet) | ||||
? wallet.state | ? wallet.state | ||||
: { | : { | ||||
balances: {}, | balances: {}, | ||||
tokens: [], | tokens: [], | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 1,460 Lines • ▼ Show 20 Lines | return { | ||||
loadCashtabSettings, | loadCashtabSettings, | ||||
cashtabCache, | cashtabCache, | ||||
changeCashtabSettings, | changeCashtabSettings, | ||||
refreshAliases, | refreshAliases, | ||||
aliases, | aliases, | ||||
setAliases, | setAliases, | ||||
aliasServerError, | aliasServerError, | ||||
setAliasServerError, | setAliasServerError, | ||||
aliasPriceError, | |||||
setAliasPriceError, | |||||
aliasPrices, | aliasPrices, | ||||
setAliasPrices, | setAliasPrices, | ||||
getActiveWalletFromLocalForage, | getActiveWalletFromLocalForage, | ||||
getWallet, | getWallet, | ||||
getWalletDetails, | getWalletDetails, | ||||
getSavedWallets, | getSavedWallets, | ||||
migrateLegacyWallet, | migrateLegacyWallet, | ||||
updateCashtabState, | updateCashtabState, | ||||
Show All 32 Lines |