From 02384d486e0e8bac1aa5e1059ff281bdabfcf891 Mon Sep 17 00:00:00 2001 From: Ben Tatum Date: Sat, 4 Jan 2025 15:52:20 -0500 Subject: [PATCH] fix(solana token provider): await cached data --- .../src/providers/simulationSellingService.ts | 2 +- packages/plugin-solana/src/providers/token.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/plugin-solana/src/providers/simulationSellingService.ts b/packages/plugin-solana/src/providers/simulationSellingService.ts index 670eeb74f3..a8398254fd 100644 --- a/packages/plugin-solana/src/providers/simulationSellingService.ts +++ b/packages/plugin-solana/src/providers/simulationSellingService.ts @@ -40,7 +40,6 @@ export class SimulationSellingService { this.trustScoreDb = trustScoreDb; this.connection = new Connection(runtime.getSetting("RPC_URL")); - this.initializeWalletProvider(); this.baseMint = new PublicKey( runtime.getSetting("BASE_MINT") || "So11111111111111111111111111111111111111112" @@ -51,6 +50,7 @@ export class SimulationSellingService { this.sonarBe = runtime.getSetting("SONAR_BE"); this.sonarBeToken = runtime.getSetting("SONAR_BE_TOKEN"); this.runtime = runtime; + this.initializeWalletProvider(); } /** * Initializes the RabbitMQ connection and starts consuming messages. diff --git a/packages/plugin-solana/src/providers/token.ts b/packages/plugin-solana/src/providers/token.ts index d8e885915a..b5fcc918a3 100644 --- a/packages/plugin-solana/src/providers/token.ts +++ b/packages/plugin-solana/src/providers/token.ts @@ -162,7 +162,7 @@ export class TokenProvider { async fetchTokenCodex(): Promise { try { const cacheKey = `token_${this.tokenAddress}`; - const cachedData = this.getCachedData(cacheKey); + const cachedData = await this.getCachedData(cacheKey); if (cachedData) { console.log( `Returning cached token data for ${this.tokenAddress}.` @@ -243,7 +243,7 @@ export class TokenProvider { async fetchPrices(): Promise { try { const cacheKey = "prices"; - const cachedData = this.getCachedData(cacheKey); + const cachedData = await this.getCachedData(cacheKey); if (cachedData) { console.log("Returning cached prices."); return cachedData; @@ -340,7 +340,7 @@ export class TokenProvider { async fetchTokenSecurity(): Promise { const cacheKey = `tokenSecurity_${this.tokenAddress}`; - const cachedData = this.getCachedData(cacheKey); + const cachedData = await this.getCachedData(cacheKey); if (cachedData) { console.log( `Returning cached token security data for ${this.tokenAddress}.` @@ -370,7 +370,7 @@ export class TokenProvider { async fetchTokenTradeData(): Promise { const cacheKey = `tokenTradeData_${this.tokenAddress}`; - const cachedData = this.getCachedData(cacheKey); + const cachedData = await this.getCachedData(cacheKey); if (cachedData) { console.log( `Returning cached token trade data for ${this.tokenAddress}.` @@ -605,7 +605,7 @@ export class TokenProvider { async fetchDexScreenerData(): Promise { const cacheKey = `dexScreenerData_${this.tokenAddress}`; - const cachedData = this.getCachedData(cacheKey); + const cachedData = await this.getCachedData(cacheKey); if (cachedData) { console.log("Returning cached DexScreener data."); return cachedData; @@ -746,7 +746,7 @@ export class TokenProvider { async fetchHolderList(): Promise { const cacheKey = `holderList_${this.tokenAddress}`; - const cachedData = this.getCachedData(cacheKey); + const cachedData = await this.getCachedData(cacheKey); if (cachedData) { console.log("Returning cached holder list."); return cachedData;