fallback openbook market if there is only one

This commit is contained in:
Adrian Brzeziński 2024-07-02 12:44:24 +02:00
parent 74bffa9b4f
commit 5078b6b1ef
1 changed files with 10 additions and 0 deletions

View File

@ -232,6 +232,16 @@ export const getBestMarket = async ({
if (!markets.length) {
return undefined
}
if (markets.length === 1) {
notify({
title: 'Only one openbook market exists check it carefully',
description: ``,
type: 'error',
})
return markets[0].publicKey
}
const marketsDataJsons = await Promise.all([
...markets.map((x) =>
fetch(`/openSerumApi/market/${x.publicKey.toBase58()}`),