From 3aa90e951402b8c0d7bea15a21f221ceb03ca22e Mon Sep 17 00:00:00 2001 From: Danylo Kanievskyi Date: Mon, 30 Dec 2024 12:00:15 +0200 Subject: [PATCH] feat: add local caching for swaap-v2 --- src/dex/swaap-v2/swaap-v2.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dex/swaap-v2/swaap-v2.ts b/src/dex/swaap-v2/swaap-v2.ts index 8140cbbdd..4d41da3fb 100644 --- a/src/dex/swaap-v2/swaap-v2.ts +++ b/src/dex/swaap-v2/swaap-v2.ts @@ -278,10 +278,11 @@ export class SwaapV2 extends SimpleExchange implements IDex { } async getCachedTokens(): Promise { - const cachedTokens = await this.dexHelper.cache.get( + const cachedTokens = await this.dexHelper.cache.getAndCacheLocally( this.dexKey, this.network, SWAAP_TOKENS_CACHE_KEY, + SWAAP_RFQ_API_TOKENS_POLLING_INTERVAL_MS / 1000, ); if (cachedTokens) { @@ -292,10 +293,11 @@ export class SwaapV2 extends SimpleExchange implements IDex { } async getCachedLevels(): Promise | null> { - const cachedLevels = await this.dexHelper.cache.get( + const cachedLevels = await this.dexHelper.cache.getAndCacheLocally( this.dexKey, this.network, SWAAP_PRICES_CACHE_KEY, + SWAAP_RFQ_API_PRICES_POLLING_INTERVAL_MS / 1000, ); if (cachedLevels) {