Skip to content

Commit

Permalink
Fixing usage of the getOrders method and avoiding long loop when coll…
Browse files Browse the repository at this point in the history
…ecting orders.
  • Loading branch information
danilo-silva-funttastic committed Aug 27, 2024
1 parent 4cbd9ed commit aa57504
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/connectors/kujira/kujira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,10 @@ export class Kujira {
...options,
ids: [options.id],
ownerAddresses: [options.ownerAddress],
marketId: options.marketId,
marketName: options.marketName,
marketIds: options.marketIds,
marketNames: options.marketNames,
})) as IMap<OrderId, Order>
).first();
}
Expand Down Expand Up @@ -1424,7 +1428,7 @@ export class Kujira {
return false;
});
} while (
(partialResponse?.orders || []).length > 0 &&
(partialResponse?.orders || []).length >= KujiraConfig.config.orders.open.paginationLimit &&
(response?.orders || []).length < KujiraConfig.config.orders.open.limit
);

Expand Down Expand Up @@ -1915,6 +1919,8 @@ export class Kujira {
(await this.getOrders({
ownerAddresses: [ownerAddress],
status: OrderStatus.FILLED,
marketId: options.marketId,
marketName: options.marketName,
})) as IMap<OrderId, Order> // Cast because we have only one ownerAddress
)
.valueSeq()
Expand Down

0 comments on commit aa57504

Please sign in to comment.