Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/hooks/useWallet.js
Show First 20 Lines • Show All 1,117 Lines • ▼ Show 20 Lines | |||||
// Update wallet every 10s | // Update wallet every 10s | ||||
useAsyncTimeout(async () => { | useAsyncTimeout(async () => { | ||||
const wallet = await getWallet(); | const wallet = await getWallet(); | ||||
update({ | update({ | ||||
wallet, | wallet, | ||||
}).finally(() => { | }).finally(() => { | ||||
setLoading(false); | setLoading(false); | ||||
}); | }); | ||||
}, 10000); | }, 1000); | ||||
const fetchBchPrice = async ( | const fetchBchPrice = async ( | ||||
fiatCode = cashtabSettings ? cashtabSettings.fiatCurrency : 'usd', | fiatCode = cashtabSettings ? cashtabSettings.fiatCurrency : 'usd', | ||||
) => { | ) => { | ||||
// Split this variable out in case coingecko changes | // Split this variable out in case coingecko changes | ||||
const cryptoId = currency.coingeckoId; | const cryptoId = currency.coingeckoId; | ||||
// Keep this in the code, because different URLs will have different outputs require different parsing | // Keep this in the code, because different URLs will have different outputs require different parsing | ||||
const priceApiUrl = `https://api.coingecko.com/api/v3/simple/price?ids=${cryptoId}&vs_currencies=${fiatCode}&include_last_updated_at=true`; | const priceApiUrl = `https://api.coingecko.com/api/v3/simple/price?ids=${cryptoId}&vs_currencies=${fiatCode}&include_last_updated_at=true`; | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |