From 9128d48a9aff5750dd6806c6df43c929f005f433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Darley=20Ara=C3=BAjo=20Silva?= Date: Fri, 22 Sep 2023 00:10:34 -0300 Subject: [PATCH] Converting while loop to do-while in the "getOrders" method. --- src/connectors/kujira/kujira.ts | 35 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/connectors/kujira/kujira.ts b/src/connectors/kujira/kujira.ts index cc1774a99a..861ee5c672 100644 --- a/src/connectors/kujira/kujira.ts +++ b/src/connectors/kujira/kujira.ts @@ -1304,29 +1304,28 @@ export class Kujira { const response: JsonObject = { orders: [] }; let partialResponse: JsonObject; - while ( - partialResponse && - partialResponse.orders.length >= - KujiraConfig.config.orders.open.paginationLimit && - response.orders.length <= KujiraConfig.config.orders.open.limit - ) { + do { partialResponse = await this.kujiraQueryClientWasmQueryContractSmart( - market.connectorMarket.address, - { - orders_by_user: { - address: ownerAddress, - limit: KujiraConfig.config.orders.open.limit, - start_after: partialResponse - ? partialResponse.orders[ + market.connectorMarket.address, + { + orders_by_user: { + address: ownerAddress, + limit: KujiraConfig.config.orders.open.limit, + start_after: partialResponse + ? partialResponse.orders[ partialResponse.orders.length - 1 - ].idx.toString() - : null, - }, - } + ].idx.toString() + : null, + }, + } ); response.orders = [...response.orders, ...partialResponse.orders]; - } + } while (( + partialResponse.orders.length >= KujiraConfig.config.orders.open.paginationLimit + ) && ( + response.orders.length <= KujiraConfig.config.orders.open.limit + )); const bundles = IMap().asMutable();