diff --git a/src/api/hls/getHLSVaults.ts b/src/api/hls/getHLSVaults.ts new file mode 100644 index 00000000..2b09a9b3 --- /dev/null +++ b/src/api/hls/getHLSVaults.ts @@ -0,0 +1,34 @@ +import { getCreditManagerQueryClient } from 'api/cosmwasm-client' +import getAssetParams from 'api/params/getAssetParams' +import { getVaultConfigs } from 'api/vaults/getVaultConfigs' +import { BN } from 'utils/helpers' +import { resolveHLSStrategies } from 'utils/resolvers' + +export default async function getHLSVaults() { + const assetParams = await getAssetParams() + const client = await getCreditManagerQueryClient() + const vaultConfigs = await getVaultConfigs() + const HLSAssets = assetParams.filter((asset) => asset.credit_manager.hls) + const strategies = resolveHLSStrategies('vault', HLSAssets) + + const vaultUtilizations$ = strategies.map((strategy) => + client.vaultUtilization({ vault: { address: strategy.denoms.deposit } }), + ) + + return Promise.all(vaultUtilizations$).then((vaultUtilizations) => + vaultUtilizations.map( + (utilization, index) => + ({ + ...strategies[index], + depositCap: { + denom: utilization.vault.address, + used: BN(utilization.utilization.amount), + max: BN( + vaultConfigs.find((config) => config.addr === utilization.vault.address)?.deposit_cap + .amount || 0, + ), + }, + }) as HLSStrategy, + ), + ) +} diff --git a/src/components/Account/AccountDetails/index.tsx b/src/components/Account/AccountDetails/index.tsx index 550e5d78..8ef7122a 100644 --- a/src/components/Account/AccountDetails/index.tsx +++ b/src/components/Account/AccountDetails/index.tsx @@ -112,8 +112,8 @@ function AccountDetails(props: Props) {
@@ -173,7 +173,7 @@ function AccountDetails(props: Props) { {glowElement(!reduceMotion)}
- }> + }> Balances {typeof props.title === 'string' ? ( - + {props.title} ) : typeof props.title === 'object' ? ( diff --git a/src/components/Earn/Farm/Vaults.tsx b/src/components/Earn/Farm/Vaults.tsx index ab6b8507..ac51534d 100644 --- a/src/components/Earn/Farm/Vaults.tsx +++ b/src/components/Earn/Farm/Vaults.tsx @@ -52,10 +52,12 @@ function Content() { return ( <> - {deposited.length && ( + {deposited.length > 0 && ( )} - {available.length && } + {available.length > 0 && ( + + )} ) } diff --git a/src/components/HLS/Farm/Table/Columns/Name.tsx b/src/components/HLS/Farm/Table/Columns/Name.tsx new file mode 100644 index 00000000..45aec3b4 --- /dev/null +++ b/src/components/HLS/Farm/Table/Columns/Name.tsx @@ -0,0 +1,19 @@ +import React from 'react' + +import TitleAndSubCell from 'components/TitleAndSubCell' + +interface Props { + strategy: HLSStrategy +} + +export default function Name(props: Props) { + return ( +
+ +
+ ) +} diff --git a/src/components/Trade/TradeModule/AssetSelector/AssetOverlay.tsx b/src/components/Trade/TradeModule/AssetSelector/AssetOverlay.tsx index 7b19f656..30dbaeed 100644 --- a/src/components/Trade/TradeModule/AssetSelector/AssetOverlay.tsx +++ b/src/components/Trade/TradeModule/AssetSelector/AssetOverlay.tsx @@ -48,7 +48,11 @@ export default function AssetOverlay(props: Props) { } return ( - +
Select asset diff --git a/src/constants/assets.ts b/src/constants/assets.ts index 6cbc1b2d..e022dc15 100644 --- a/src/constants/assets.ts +++ b/src/constants/assets.ts @@ -137,7 +137,7 @@ export const ASSETS: Asset[] = [ }, { symbol: 'USDC', - name: 'USDC', + name: 'Noble', id: 'USDC', denom: ENV.NETWORK === NETWORK.TESTNET diff --git a/src/hooks/useHLSVaults.ts b/src/hooks/useHLSVaults.ts new file mode 100644 index 00000000..42106fc6 --- /dev/null +++ b/src/hooks/useHLSVaults.ts @@ -0,0 +1,10 @@ +import useSWR from 'swr' + +import getHLSVaults from 'api/hls/getHLSVaults' + +export default function useHLSVaults() { + return useSWR('hls-vaults', getHLSVaults, { + fallbackData: [], + revalidateOnFocus: false, + }) +} diff --git a/src/pages/_layout.tsx b/src/pages/_layout.tsx index 5a18c984..63ab7c5e 100644 --- a/src/pages/_layout.tsx +++ b/src/pages/_layout.tsx @@ -59,9 +59,9 @@ export default function Layout({ children }: { children: React.ReactNode }) { className={classNames( 'lg:min-h-[calc(100vh-73px)]', 'lg:mt-[73px]', - 'min-h-screen gap-6 px-4 py-6 w-full relative', 'flex', - isFullWidth && accountId && (accountDetailsExpanded ? 'pr-110.5' : 'pr-24'), + 'min-h-screen gap-6 px-4 py-6 w-full relative', + isFullWidth && accountId && (accountDetailsExpanded ? 'pr-118' : 'pr-24'), !reduceMotion && isFullWidth && 'transition-all duration-300', 'justify-center', focusComponent && 'items-center', diff --git a/tailwind.config.js b/tailwind.config.js index 040baba6..05d985f4 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -231,7 +231,8 @@ module.exports = { 24: '96px', 35: '140px', 80: '320px', - 110.5: '442px', + 90: '360px', + 118: '472px', }, transitionDuration: { 3000: '3000ms', @@ -255,6 +256,7 @@ module.exports = { 90: '360px', 92.5: '370px', 100: '400px', + 110: '440px', 120: '480px', 140: '560px', },