Skip to content

Commit

Permalink
more ts client update
Browse files Browse the repository at this point in the history
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
  • Loading branch information
microwavedcola1 committed May 16, 2024
1 parent 5372e04 commit e6b85c9
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions ts/client/src/accounts/healthCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,39 +157,39 @@ export class HealthCache {
);
});

// const obv2Infos = mangoAccount.openbookV2Active().map((obv2) => {
// const oo = mangoAccount.getOpenbookV2OoAccount(obv2.marketIndex);

// // find the TokenInfos for the market's base and quote tokens
// const baseInfoIndex = tokenInfos.findIndex(
// (tokenInfo) => tokenInfo.tokenIndex === obv2.baseTokenIndex,
// );
// const baseInfo = tokenInfos[baseInfoIndex];
// if (!baseInfo) {
// throw new Error(
// `BaseInfo not found for market with marketIndex ${obv2.marketIndex}!`,
// );
// }
// const quoteInfoIndex = tokenInfos.findIndex(
// (tokenInfo) => tokenInfo.tokenIndex === obv2.quoteTokenIndex,
// );
// const quoteInfo = tokenInfos[quoteInfoIndex];
// if (!quoteInfo) {
// throw new Error(
// `QuoteInfo not found for market with marketIndex ${obv2.marketIndex}!`,
// );
// }

// return SpotInfo.fromObv2OoModifyingTokenInfos(
// obv2,
// baseInfoIndex,
// baseInfo,
// quoteInfoIndex,
// quoteInfo,
// obv2.marketIndex,
// oo,
// );
// });
const obv2Infos = mangoAccount.openbookV2Active().map((obv2) => {
const oo = mangoAccount.getOpenbookV2OoAccount(obv2.marketIndex);

// find the TokenInfos for the market's base and quote tokens
const baseInfoIndex = tokenInfos.findIndex(
(tokenInfo) => tokenInfo.tokenIndex === obv2.baseTokenIndex,
);
const baseInfo = tokenInfos[baseInfoIndex];
if (!baseInfo) {
throw new Error(
`BaseInfo not found for market with marketIndex ${obv2.marketIndex}!`,
);
}
const quoteInfoIndex = tokenInfos.findIndex(
(tokenInfo) => tokenInfo.tokenIndex === obv2.quoteTokenIndex,
);
const quoteInfo = tokenInfos[quoteInfoIndex];
if (!quoteInfo) {
throw new Error(
`QuoteInfo not found for market with marketIndex ${obv2.marketIndex}!`,
);
}

return SpotInfo.fromObv2OoModifyingTokenInfos(
obv2,
baseInfoIndex,
baseInfo,
quoteInfoIndex,
quoteInfo,
obv2.marketIndex,
oo,
);
});

// health contribution from perp accounts
const perpInfos = mangoAccount.perpActive().map((perpPosition) => {
Expand All @@ -201,7 +201,7 @@ export class HealthCache {

return new HealthCache(
tokenInfos,
[...serum3Infos], //, ...obv2Infos],
[...serum3Infos, ...obv2Infos],
perpInfos,
);
}
Expand Down

0 comments on commit e6b85c9

Please sign in to comment.