Skip to content

Commit

Permalink
feat: add local caching for swaap-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
KanievskyiDanylo committed Dec 30, 2024
1 parent 934879e commit 3aa90e9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dex/swaap-v2/swaap-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,11 @@ export class SwaapV2 extends SimpleExchange implements IDex<SwaapV2Data> {
}

async getCachedTokens(): Promise<TokensMap | null> {
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) {
Expand All @@ -292,10 +293,11 @@ export class SwaapV2 extends SimpleExchange implements IDex<SwaapV2Data> {
}

async getCachedLevels(): Promise<Record<string, SwaapV2PriceLevels> | 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) {
Expand Down

0 comments on commit 3aa90e9

Please sign in to comment.