* update assets config and chains
* make clients dynamic
* feat: formatted ChainSelect
* fix infinite rerender on trade page
* feat: added NTRN icon
* fix: fixed ChainInfoID
* fix: fixed autoLendEnabled for NTRN
* fix: fixed the navigation and dependencies
* fix: fixed the pricefeed id
* fix: fixed the header menu
* fix: fixed the trading charts
* fix: fixed the healthbars
* fix: fixed naming of pion-1
* feast: updated xdefi image
* env: updated contracts
* make localStorage chain agnostic
* fix: made the selected chain persistant
* fix: fixed the wallet providers
* fix: updated auto connect
* fix: fixed auto connecting
* fix: added ChainSelect to focusMode
* store raw strings in localstorage
* 🔥 remnove tests
* update caching keys + disconnect wallet on change chain
* fix: fixed the chain select
* env: bumped version
---------
Co-authored-by: Bob van der Helm <34470358+bobthebuidlr@users.noreply.github.com>
26 lines
990 B
TypeScript
26 lines
990 B
TypeScript
import { cacheFn, vaultUtilizationCache } from 'api/cache'
|
|
import { getCreditManagerQueryClient } from 'api/cosmwasm-client'
|
|
import { VaultUtilizationResponse } from 'types/generated/mars-credit-manager/MarsCreditManager.types'
|
|
import { VaultConfigBaseForString } from 'types/generated/mars-params/MarsParams.types'
|
|
|
|
export const getVaultUtilizations = async (
|
|
chainConfig: ChainConfig,
|
|
vaultConfigs: VaultConfigBaseForString[],
|
|
): Promise<VaultUtilizationResponse[]> => {
|
|
const creditManagerQueryClient = await getCreditManagerQueryClient(chainConfig)
|
|
try {
|
|
const vaultUtilizations$ = vaultConfigs.map((vaultConfig) => {
|
|
return cacheFn(
|
|
() => creditManagerQueryClient.vaultUtilization({ vault: { address: vaultConfig.addr } }),
|
|
vaultUtilizationCache,
|
|
`vaultUtilization/${vaultConfig.addr}`,
|
|
60,
|
|
)
|
|
})
|
|
|
|
return await Promise.all(vaultUtilizations$).then((vaultUtilizations) => vaultUtilizations)
|
|
} catch {
|
|
return []
|
|
}
|
|
}
|