Skip to content

Commit

Permalink
fix(solana token provider): await cached data
Browse files Browse the repository at this point in the history
  • Loading branch information
bentatum committed Jan 4, 2025
1 parent 1cebf4d commit 0628d3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions packages/plugin-solana/src/providers/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class TokenProvider {
async fetchTokenCodex(): Promise<TokenCodex> {
try {
const cacheKey = `token_${this.tokenAddress}`;
const cachedData = this.getCachedData<TokenCodex>(cacheKey);
const cachedData = await this.getCachedData<TokenCodex>(cacheKey);
if (cachedData) {
console.log(
`Returning cached token data for ${this.tokenAddress}.`
Expand Down Expand Up @@ -243,7 +243,7 @@ export class TokenProvider {
async fetchPrices(): Promise<Prices> {
try {
const cacheKey = "prices";
const cachedData = this.getCachedData<Prices>(cacheKey);
const cachedData = await this.getCachedData<Prices>(cacheKey);
if (cachedData) {
console.log("Returning cached prices.");
return cachedData;
Expand Down Expand Up @@ -340,7 +340,7 @@ export class TokenProvider {

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

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

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

async fetchHolderList(): Promise<HolderData[]> {
const cacheKey = `holderList_${this.tokenAddress}`;
const cachedData = this.getCachedData<HolderData[]>(cacheKey);
const cachedData = await this.getCachedData<HolderData[]>(cacheKey);
if (cachedData) {
console.log("Returning cached holder list.");
return cachedData;
Expand Down

0 comments on commit 0628d3a

Please sign in to comment.