Skip to content

Commit 02384d4

Browse files
committed
fix(solana token provider): await cached data
1 parent ed16b0c commit 02384d4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/plugin-solana/src/providers/simulationSellingService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export class SimulationSellingService {
4040
this.trustScoreDb = trustScoreDb;
4141

4242
this.connection = new Connection(runtime.getSetting("RPC_URL"));
43-
this.initializeWalletProvider();
4443
this.baseMint = new PublicKey(
4544
runtime.getSetting("BASE_MINT") ||
4645
"So11111111111111111111111111111111111111112"
@@ -51,6 +50,7 @@ export class SimulationSellingService {
5150
this.sonarBe = runtime.getSetting("SONAR_BE");
5251
this.sonarBeToken = runtime.getSetting("SONAR_BE_TOKEN");
5352
this.runtime = runtime;
53+
this.initializeWalletProvider();
5454
}
5555
/**
5656
* Initializes the RabbitMQ connection and starts consuming messages.

packages/plugin-solana/src/providers/token.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export class TokenProvider {
162162
async fetchTokenCodex(): Promise<TokenCodex> {
163163
try {
164164
const cacheKey = `token_${this.tokenAddress}`;
165-
const cachedData = this.getCachedData<TokenCodex>(cacheKey);
165+
const cachedData = await this.getCachedData<TokenCodex>(cacheKey);
166166
if (cachedData) {
167167
console.log(
168168
`Returning cached token data for ${this.tokenAddress}.`
@@ -243,7 +243,7 @@ export class TokenProvider {
243243
async fetchPrices(): Promise<Prices> {
244244
try {
245245
const cacheKey = "prices";
246-
const cachedData = this.getCachedData<Prices>(cacheKey);
246+
const cachedData = await this.getCachedData<Prices>(cacheKey);
247247
if (cachedData) {
248248
console.log("Returning cached prices.");
249249
return cachedData;
@@ -340,7 +340,7 @@ export class TokenProvider {
340340

341341
async fetchTokenSecurity(): Promise<TokenSecurityData> {
342342
const cacheKey = `tokenSecurity_${this.tokenAddress}`;
343-
const cachedData = this.getCachedData<TokenSecurityData>(cacheKey);
343+
const cachedData = await this.getCachedData<TokenSecurityData>(cacheKey);
344344
if (cachedData) {
345345
console.log(
346346
`Returning cached token security data for ${this.tokenAddress}.`
@@ -370,7 +370,7 @@ export class TokenProvider {
370370

371371
async fetchTokenTradeData(): Promise<TokenTradeData> {
372372
const cacheKey = `tokenTradeData_${this.tokenAddress}`;
373-
const cachedData = this.getCachedData<TokenTradeData>(cacheKey);
373+
const cachedData = await this.getCachedData<TokenTradeData>(cacheKey);
374374
if (cachedData) {
375375
console.log(
376376
`Returning cached token trade data for ${this.tokenAddress}.`
@@ -605,7 +605,7 @@ export class TokenProvider {
605605

606606
async fetchDexScreenerData(): Promise<DexScreenerData> {
607607
const cacheKey = `dexScreenerData_${this.tokenAddress}`;
608-
const cachedData = this.getCachedData<DexScreenerData>(cacheKey);
608+
const cachedData = await this.getCachedData<DexScreenerData>(cacheKey);
609609
if (cachedData) {
610610
console.log("Returning cached DexScreener data.");
611611
return cachedData;
@@ -746,7 +746,7 @@ export class TokenProvider {
746746

747747
async fetchHolderList(): Promise<HolderData[]> {
748748
const cacheKey = `holderList_${this.tokenAddress}`;
749-
const cachedData = this.getCachedData<HolderData[]>(cacheKey);
749+
const cachedData = await this.getCachedData<HolderData[]>(cacheKey);
750750
if (cachedData) {
751751
console.log("Returning cached holder list.");
752752
return cachedData;

0 commit comments

Comments
 (0)