Skip to content

Commit

Permalink
improve BookSide decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
mschneider committed Jun 17, 2024
1 parent 02d43b9 commit a4777b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ts/client/src/accounts/openOrdersIndexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ export class OpenOrdersIndexer {
marketPks,
);
const bookSidePks = markets.flatMap((m) => [m!.bids, m!.asks]);
const bookSides = await this.client.program.account.bookSide.fetchMultiple(
const bookSideAis = await this.client.connection.getMultipleAccountsInfo(
bookSidePks,
);
return oos.map((oo, i) => {
const mkt = new Market(this.client, marketPks[i], markets[i]!);
mkt.bids = new BookSide(
mkt,
bookSidePks[2 * i],
bookSides[2 * i]!,
BookSide.decodeAccountfromBuffer(bookSideAis[2 * i]!.data),
SideUtils.Bid,
);
mkt.asks = new BookSide(
mkt,
bookSidePks[2 * i + 1],
bookSides[2 * i + 1]!,
BookSide.decodeAccountfromBuffer(bookSideAis[2 * i + 1]!.data),
SideUtils.Ask,
);
return new OpenOrders(ooPks[i], oo!, mkt);
Expand Down

0 comments on commit a4777b4

Please sign in to comment.