feat: lending page and tables (#248)
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import { BN } from 'utils/helpers'
|
||||
import getPrices from 'api/prices/getPrices'
|
||||
import getMarkets from 'api/markets/getMarkets'
|
||||
import getMarketLiquidity from 'api/markets/getMarketLiquidity'
|
||||
import { getEnabledMarketAssets } from 'utils/assets'
|
||||
import getMarketLiquidities from 'api/markets/getMarketLiquidities'
|
||||
|
||||
export default async function getMarketBorrowings(): Promise<BorrowAsset[]> {
|
||||
const liquidity = await getMarketLiquidity()
|
||||
const liquidities = await getMarketLiquidities()
|
||||
const enabledAssets = getEnabledMarketAssets()
|
||||
const borrowEnabledMarkets = (await getMarkets()).filter((market: Market) => market.borrowEnabled)
|
||||
const prices = await getPrices()
|
||||
|
||||
const borrow: BorrowAsset[] = borrowEnabledMarkets.map((market) => {
|
||||
const price = prices.find((coin) => coin.denom === market.denom)?.amount ?? '1'
|
||||
const amount = liquidity.find((coin) => coin.denom === market.denom)?.amount ?? '0'
|
||||
const amount = liquidities.find((coin) => coin.denom === market.denom)?.amount ?? '0'
|
||||
const asset = enabledAssets.find((asset) => asset.denom === market.denom)!
|
||||
|
||||
return {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { BN } from 'utils/helpers'
|
||||
import getMarketDeposits from 'api/markets/getMarketDeposits'
|
||||
import getMarketDebts from 'api/markets/getMarketDebts'
|
||||
|
||||
export default async function getMarketLiquidity(): Promise<Coin[]> {
|
||||
export default async function getMarketLiquidities(): Promise<Coin[]> {
|
||||
const deposits = await getMarketDeposits()
|
||||
const debts = await getMarketDebts()
|
||||
|
||||
Reference in New Issue
Block a user