adjust netborrows with settings lib
This commit is contained in:
parent
53de7de9fa
commit
23bfea953f
|
@ -130,7 +130,8 @@ const DashboardSuggestedValues = ({
|
|||
const preset = getPresetWithAdjustedDepositLimit(
|
||||
getPresetWithAdjustedNetBorrows(
|
||||
PRESETS[tokenTier],
|
||||
bank.nativeDeposits().mul(bank.price).toNumber(),
|
||||
bank.uiDeposits(),
|
||||
bank.uiPrice,
|
||||
),
|
||||
bank.uiPrice,
|
||||
bank.mintDecimals,
|
||||
|
@ -327,7 +328,8 @@ const DashboardSuggestedValues = ({
|
|||
const suggestedValues = getPresetWithAdjustedDepositLimit(
|
||||
getPresetWithAdjustedNetBorrows(
|
||||
PRESETS[proposedTier as LISTING_PRESETS_KEY] as LISTING_PRESET,
|
||||
bank.nativeDeposits().mul(bank.price).toNumber(),
|
||||
bank.uiDeposits(),
|
||||
bank.uiPrice,
|
||||
),
|
||||
bank.uiPrice,
|
||||
bank.mintDecimals,
|
||||
|
|
|
@ -128,14 +128,14 @@ const Orderbook = () => {
|
|||
if (!market) return ''
|
||||
const bidsPk =
|
||||
market instanceof Market ? market['_decoded'].bids : market.bids
|
||||
return bidsPk.toString()
|
||||
return bidsPk?.toString() || ''
|
||||
}, [market])
|
||||
|
||||
const askAccountAddress = useMemo(() => {
|
||||
if (!market) return ''
|
||||
const asksPk =
|
||||
market instanceof Market ? market['_decoded'].asks : market.asks
|
||||
return asksPk.toString()
|
||||
return asksPk?.toString() || ''
|
||||
}, [market])
|
||||
|
||||
useEffect(
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
"@blockworks-foundation/mango-feeds": "0.1.7",
|
||||
"@blockworks-foundation/mango-mints-redemption": "^0.0.10",
|
||||
"@blockworks-foundation/mango-v4": "0.21.22",
|
||||
"@blockworks-foundation/mango-v4-settings": "0.4.7",
|
||||
"@blockworks-foundation/mango-v4-settings": "0.4.8",
|
||||
"@blockworks-foundation/mangolana": "0.0.13",
|
||||
"@headlessui/react": "1.6.6",
|
||||
"@heroicons/react": "2.0.18",
|
||||
|
|
|
@ -240,10 +240,12 @@ export const getBestMarket = async ({
|
|||
const marketsData = await Promise.all([
|
||||
...marketsDataJsons.map((x) => x.json()),
|
||||
])
|
||||
let sortedMarkets = marketsData.sort((a, b) => b.volume24h - a.volume24h)
|
||||
let firstBestMarket = sortedMarkets[0]
|
||||
let sortedMarkets = marketsData
|
||||
.filter((x) => Object.keys(x).length)
|
||||
.sort((a, b) => b.volume24h - a.volume24h)
|
||||
|
||||
if (firstBestMarket.volume24h === 0) {
|
||||
let firstBestMarket = sortedMarkets.length ? sortedMarkets[0] : undefined
|
||||
if (firstBestMarket?.volume24h === 0 || !sortedMarkets.length) {
|
||||
notify({
|
||||
title: 'Openbook market had 0 volume in last 24h check it carefully',
|
||||
description: ``,
|
||||
|
@ -253,9 +255,12 @@ export const getBestMarket = async ({
|
|||
sortedMarkets = sortedMarkets.sort(
|
||||
(a, b) => b.quoteDepositsTotal - a.quoteDepositsTotal,
|
||||
)
|
||||
firstBestMarket = sortedMarkets[0]
|
||||
|
||||
return sortedMarkets.length ? new PublicKey(firstBestMarket.id) : undefined
|
||||
firstBestMarket = sortedMarkets.length ? sortedMarkets[0] : undefined
|
||||
|
||||
return sortedMarkets.length && firstBestMarket?.id
|
||||
? new PublicKey(firstBestMarket.id)
|
||||
: markets[0].publicKey
|
||||
} catch (e) {
|
||||
notify({
|
||||
title: 'Openbook market not found',
|
||||
|
|
|
@ -342,10 +342,10 @@
|
|||
keccak256 "^1.0.6"
|
||||
merkletreejs "^0.3.11"
|
||||
|
||||
"@blockworks-foundation/mango-v4-settings@0.4.7":
|
||||
version "0.4.7"
|
||||
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4-settings/-/mango-v4-settings-0.4.7.tgz#f71f87c7ff05cd80620c640fdc340aff842579ec"
|
||||
integrity sha512-+R0kIsqfbFw2F0aHcuq1Ux/WXHKs7h2UmyE1Ew7oA/yA1JtS7G1T7RsckxOW1XZJ8+xnhnn8hcICZkhoagZUBA==
|
||||
"@blockworks-foundation/mango-v4-settings@0.4.8":
|
||||
version "0.4.8"
|
||||
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-v4-settings/-/mango-v4-settings-0.4.8.tgz#a46e4ac50081d2dbf11072c4f006197f8250cd17"
|
||||
integrity sha512-HIDGNiYHvEYvL8t+jy4ylTuB1ar8iNtXgld4wZ5tyTQSJPKpTITgOqNh/EQby5lbzV4xugQx2DJdfmEmTwhJGQ==
|
||||
dependencies:
|
||||
bn.js "^5.2.1"
|
||||
eslint-config-prettier "^9.0.0"
|
||||
|
|
Loading…
Reference in New Issue