diff --git a/package-lock.json b/package-lock.json index d4a646e44..cd39a3b2c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "@multiversx/sdk-core": "11.2.0", "@multiversx/sdk-native-auth-server": "^0.2.5", <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD "@multiversx/sdk-nestjs": "0.3.7", >>>>>>> 24e17812 (Fix asset likes repository integration) @@ -28,6 +29,9 @@ ======= "@multiversx/sdk-nestjs": "0.3.8", >>>>>>> f8ddf2f1 (remove cache info config) +======= + "@multiversx/sdk-nestjs": "0.3.9", +>>>>>>> 7499ed02 (Remove cache info) "@multiversx/sdk-network-providers": "^1.2.1", "@nestjs/apollo": "^10.1.7", "@nestjs/common": "9.1.4", @@ -3279,9 +3283,9 @@ } }, "node_modules/@multiversx/sdk-nestjs": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-nestjs/-/sdk-nestjs-0.3.8.tgz", - "integrity": "sha512-3VzUpK0x4zxyWoaU4ApQ/adIN5spONO6KZZqgXqErf7Bhh4+V2LxwKIs1232wpMW1rET9o6TXaY2l/0kk8p1pg==", + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-nestjs/-/sdk-nestjs-0.3.9.tgz", + "integrity": "sha512-Cb8zKMYE4F7YQz0kwCqTYDykC4lDZiVAiCpa4/UVUZg0SNPNtKv9gG2SfOWN1g/mQr5gb7u81NAKt6So7X63Og==", "dependencies": { "@golevelup/nestjs-rabbitmq": "^3.0.0", "@multiversx/sdk-native-auth-client": "^0.1.8", diff --git a/package.json b/package.json index 716c8a1d3..ab0ce2235 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@golevelup/nestjs-rabbitmq": "3.4.0", "@multiversx/sdk-core": "11.2.0", "@multiversx/sdk-native-auth-server": "1.0.5", - "@multiversx/sdk-nestjs": "0.3.8", + "@multiversx/sdk-nestjs": "0.3.9", "@multiversx/sdk-network-providers": "^1.2.1", "@nestjs/apollo": "^10.1.7", "@nestjs/common": "9.1.4", diff --git a/src/common/models/index.ts b/src/common/models/index.ts deleted file mode 100644 index dfcf4fb2f..000000000 --- a/src/common/models/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './caching-config'; diff --git a/src/config/index.ts b/src/config/index.ts index 9f5766b80..e1d36694e 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,7 +1,6 @@ import { envload } from './env_load'; envload(); import * as config from 'config'; -import { CachingConfig } from '../common/models'; /** * Wallet object configuration. @@ -12,7 +11,6 @@ export const mxConfig = config.get('multiversX'); * Caching time config. * The values are in seconds */ -export const cacheConfig: CachingConfig = config.get('caching'); export const fileStorage = config.get('fileStorage'); export const gas = config.get('gas'); diff --git a/src/crons/cache.warmer/auctions.warmer.service.ts b/src/crons/cache.warmer/auctions.warmer.service.ts index 017d3a4fc..8d261f8f7 100644 --- a/src/crons/cache.warmer/auctions.warmer.service.ts +++ b/src/crons/cache.warmer/auctions.warmer.service.ts @@ -1,7 +1,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { Cron, CronExpression } from '@nestjs/schedule'; import { CacheInfo } from 'src/common/services/caching/entities/cache.info'; -import { cacheConfig } from 'src/config'; import { ClientProxy } from '@nestjs/microservices'; import { CachingService, Constants, Locker } from '@multiversx/sdk-nestjs'; @@ -130,7 +129,6 @@ export class AuctionsWarmerService { await this.clientProxy.emit('refreshCacheKey', { key, ttl, - redisClientName: cacheConfig.auctionsRedisClientName, }); } } diff --git a/src/crons/cache.warmer/collections.warmer.service.ts b/src/crons/cache.warmer/collections.warmer.service.ts index 55ac33ee5..e0b995cbd 100644 --- a/src/crons/cache.warmer/collections.warmer.service.ts +++ b/src/crons/cache.warmer/collections.warmer.service.ts @@ -3,8 +3,7 @@ import { Cron, CronExpression } from '@nestjs/schedule'; import * as Redis from 'ioredis'; import { CacheInfo } from 'src/common/services/caching/entities/cache.info'; import { ClientProxy } from '@nestjs/microservices'; -import { cacheConfig } from 'src/config'; -import { CachingService, Constants, Locker } from '@multiversx/sdk-nestjs'; +import { CachingService, Locker } from '@multiversx/sdk-nestjs'; import { CollectionsGetterService } from 'src/modules/nftCollections/collections-getter.service'; @@ -114,7 +113,6 @@ export class CollectionsWarmerService { key: string; ttl: number; }>('refreshCacheKey', { - redisClientName: cacheConfig.collectionsRedisClientName, key, ttl, }); diff --git a/src/crons/cache.warmer/likes.warmer.service.ts b/src/crons/cache.warmer/likes.warmer.service.ts index 296d38762..784861bab 100644 --- a/src/crons/cache.warmer/likes.warmer.service.ts +++ b/src/crons/cache.warmer/likes.warmer.service.ts @@ -3,7 +3,6 @@ import { Cron, CronExpression } from '@nestjs/schedule'; import * as Redis from 'ioredis'; import { CacheInfo } from 'src/common/services/caching/entities/cache.info'; import { ClientProxy } from '@nestjs/microservices'; -import { cacheConfig } from 'src/config'; import { CachingService, Locker } from '@multiversx/sdk-nestjs'; import { AssetsLikesService } from 'src/modules/assets'; @@ -42,7 +41,6 @@ export class LikesWarmerService { key: string; ttl: number; }>('refreshCacheKey', { - redisClientName: cacheConfig.persistentRedisClientName, key, ttl, }); diff --git a/src/crons/cache.warmer/tokens.warmer.service.ts b/src/crons/cache.warmer/tokens.warmer.service.ts index f4752fd79..fa27d782f 100644 --- a/src/crons/cache.warmer/tokens.warmer.service.ts +++ b/src/crons/cache.warmer/tokens.warmer.service.ts @@ -2,7 +2,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { Cron, CronExpression } from '@nestjs/schedule'; import { CacheInfo } from 'src/common/services/caching/entities/cache.info'; import { ClientProxy } from '@nestjs/microservices'; -import { cacheConfig } from 'src/config'; import { MxApiService } from 'src/common'; import { CachingService, Locker } from '@multiversx/sdk-nestjs'; @@ -72,7 +71,6 @@ export class TokensWarmerService { key: string; ttl: number; }>('refreshCacheKey', { - redisClientName: cacheConfig.persistentRedisClientName, key, ttl, }); diff --git a/src/crons/cache.warmer/trendingCollections.warmer.service.ts b/src/crons/cache.warmer/trendingCollections.warmer.service.ts index d01efab9c..ca30f777b 100644 --- a/src/crons/cache.warmer/trendingCollections.warmer.service.ts +++ b/src/crons/cache.warmer/trendingCollections.warmer.service.ts @@ -2,7 +2,6 @@ import { Inject, Injectable } from '@nestjs/common'; import { Cron, CronExpression } from '@nestjs/schedule'; import { CacheInfo } from 'src/common/services/caching/entities/cache.info'; import { ClientProxy } from '@nestjs/microservices'; -import { cacheConfig } from 'src/config'; import { AnalyticsService } from 'src/modules/analytics/analytics.service'; import { CachingService, Locker } from '@multiversx/sdk-nestjs'; @@ -43,7 +42,6 @@ export class TrendingCollectionsWarmerService { key: string; ttl: number; }>('refreshCacheKey', { - redisClientName: cacheConfig.collectionsRedisClientName, key, ttl, }); diff --git a/src/crons/elastic.updater/rarity.updater.service.ts b/src/crons/elastic.updater/rarity.updater.service.ts index 9d63dac9b..7a1733d0f 100644 --- a/src/crons/elastic.updater/rarity.updater.service.ts +++ b/src/crons/elastic.updater/rarity.updater.service.ts @@ -1,7 +1,6 @@ import { Injectable, Logger } from '@nestjs/common'; import { MxElasticService } from 'src/common'; import { NftRarityService } from 'src/modules/nft-rarity/nft-rarity.service'; -import { cacheConfig } from 'src/config'; import { generateCacheKeyFromParams } from 'src/utils/generate-cache-key'; import { NftRarityElasticService } from 'src/modules/nft-rarity/nft-rarity.elastic.service'; import { Locker, RedisCacheService } from '@multiversx/sdk-nestjs'; @@ -141,6 +140,6 @@ export class RarityUpdaterService { } private getRarityQueueCacheKey() { - return generateCacheKeyFromParams(cacheConfig.rarityQueueClientName); + return generateCacheKeyFromParams('rarityQueue'); } } diff --git a/src/crons/elastic.updater/traits.updater.service.ts b/src/crons/elastic.updater/traits.updater.service.ts index 9732375ae..bd47c237e 100644 --- a/src/crons/elastic.updater/traits.updater.service.ts +++ b/src/crons/elastic.updater/traits.updater.service.ts @@ -1,6 +1,5 @@ import { Injectable, Logger } from '@nestjs/common'; import { MxElasticService } from 'src/common'; -import { cacheConfig } from 'src/config'; import { generateCacheKeyFromParams } from 'src/utils/generate-cache-key'; import { NftTraitsService } from 'src/modules/nft-traits/nft-traits.service'; @@ -15,7 +14,6 @@ import { getCollectionsWhereTraitsFlagNotSetFromElasticQuery, getCollectionsWithTraitSummaryFromElasticQuery, } from 'src/modules/nft-traits/nft-traits.elastic.queries'; -import { NftTraitsElasticService } from 'src/modules/nft-traits/nft-traits.elastic.service'; @Injectable() export class TraitsUpdaterService { @@ -23,7 +21,6 @@ export class TraitsUpdaterService { private readonly nftTraitsService: NftTraitsService, private readonly redisCacheService: RedisCacheService, private readonly elasticService: MxElasticService, - private readonly nftTraitsElasticService: NftTraitsElasticService, private readonly logger: Logger, ) {} @@ -214,7 +211,7 @@ export class TraitsUpdaterService { } private getTraitsQueueCacheKey() { - return generateCacheKeyFromParams(cacheConfig.traitsQueueClientName); + return generateCacheKeyFromParams('traitsQueue'); } private getTraitsValidatorCounterCacheKey() { diff --git a/src/modules/analytics/analytics.service.ts b/src/modules/analytics/analytics.service.ts index 483e00d50..0c8721e1a 100644 --- a/src/modules/analytics/analytics.service.ts +++ b/src/modules/analytics/analytics.service.ts @@ -8,8 +8,6 @@ import BigNumber from 'bignumber.js'; import { BuyEventParser } from './buy-event.parser'; import { UsdPriceService } from '../usdPrice/usd-price.service'; import { computeUsd } from 'src/utils/helpers'; -import * as Redis from 'ioredis'; -import { cacheConfig } from 'src/config'; import { CacheInfo } from 'src/common/services/caching/entities/cache.info'; import { AcceptOfferEventParser } from './acceptOffer-event.parser'; import { CollectionVolumeLast24 } from './collection-volume'; @@ -19,7 +17,6 @@ import { CachingService } from '@multiversx/sdk-nestjs'; export class AnalyticsService { private filterAddresses: string[]; private data: any[] = []; - private redisClient: Redis.Redis; constructor( private readonly indexerService: ElasticAnalyticsService, @@ -115,7 +112,7 @@ export class AnalyticsService { tokens: collection.tokens, }); } - return trending.sortedDescending([(x) => parseFloat(x.volume)]); + return trending.sortedDescending((x) => parseFloat(x.volume)); } private async getParsedEvents( @@ -175,8 +172,8 @@ export class AnalyticsService { .groupBy((g: { paymentToken: any }) => g.paymentToken, true) .map((group: { key: any; values: any[] }) => ({ paymentToken: group.key, - sum: group.values.sumBigInt( - (x: { value:BigInt }) => BigInt(x.value.toString()), + sum: group.values.sumBigInt((x: { value: BigInt }) => + BigInt(x.value.toString()), ), })), })); diff --git a/src/modules/assets/assets-transaction.service.ts b/src/modules/assets/assets-transaction.service.ts index 633ff7892..39859b491 100644 --- a/src/modules/assets/assets-transaction.service.ts +++ b/src/modules/assets/assets-transaction.service.ts @@ -8,7 +8,7 @@ import { } from '@multiversx/sdk-core'; import { Injectable, Logger, NotFoundException } from '@nestjs/common'; import { MxApiService, getSmartContract } from 'src/common'; -import { cacheConfig, mxConfig, gas } from 'src/config'; +import { mxConfig, gas } from 'src/config'; import { getCollectionAndNonceFromIdentifier, timestampToEpochAndRound, diff --git a/src/modules/auctions/auctions-getter.service.ts b/src/modules/auctions/auctions-getter.service.ts index 7f126acf1..1aef77ffb 100644 --- a/src/modules/auctions/auctions-getter.service.ts +++ b/src/modules/auctions/auctions-getter.service.ts @@ -10,7 +10,7 @@ import { CachingService } from '@multiversx/sdk-nestjs'; import { PriceRange } from 'src/db/auctions/price-range'; import { AuctionsCachingService } from './caching/auctions-caching.service'; import { Constants } from '@multiversx/sdk-nestjs'; -import { cacheConfig, mxConfig } from 'src/config'; +import { mxConfig } from 'src/config'; import { AuctionCustomEnum } from '../common/filters/AuctionCustomFilters'; import { PersistenceService } from 'src/common/persistence/persistence.service'; import { Token } from 'src/common/services/mx-communication/models/Token.model'; @@ -335,12 +335,14 @@ export class AuctionsGetterService { if (sort) { if (sort.direction === Sort.ASC) { if (sort.field === 'endDate') { - allAuctions = allAuctions.sorted([(x) => x[sort.field]], true); + allAuctions = allAuctions.sorted((x) => + x[sort.field] === 0 ? Number.MAX_SAFE_INTEGER : x[sort.field], + ); } else { - allAuctions = allAuctions.sorted([(x) => x[sort.field]]); + allAuctions = allAuctions.sorted((x) => x[sort.field]); } } else { - allAuctions = allAuctions.sortedDescending([(x) => x[sort.field]]); + allAuctions = allAuctions.sortedDescending((x) => x[sort.field]); } } @@ -419,12 +421,14 @@ export class AuctionsGetterService { if (sort) { if (sort.direction === Sort.ASC) { if (sort.field === 'endDate') { - allAuctions = allAuctions.sorted([(x) => x[sort.field]], true); + allAuctions = allAuctions.sorted((x) => + x[sort.field] === 0 ? Number.MAX_SAFE_INTEGER : x[sort.field], + ); } else { - allAuctions = allAuctions.sorted([(x) => x[sort.field]]); + allAuctions = allAuctions.sorted((x) => x[sort.field]); } } else { - allAuctions = allAuctions.sortedDescending([(x) => x[sort.field]]); + allAuctions = allAuctions.sortedDescending((x) => x[sort.field]); } } @@ -470,9 +474,9 @@ export class AuctionsGetterService { } if (currentPriceSort) { if (currentPriceSort.direction === Sort.ASC) { - allAuctions = allAuctions.sorted([(x) => x['startBid']]); + allAuctions = allAuctions.sorted((x) => x['startBid']); } else { - allAuctions = allAuctions.sortedDescending([(x) => x['startBid']]); + allAuctions = allAuctions.sortedDescending((x) => x['startBid']); } } } @@ -494,12 +498,12 @@ export class AuctionsGetterService { if (sort) { if (sort.direction === Sort.ASC) { if (sort.field === 'endDate') { - allAuctions = allAuctions.sorted([(x) => x[sort.field]]); + allAuctions = allAuctions.sorted((x) => x[sort.field]); } else { - allAuctions = allAuctions.sorted([(x) => x[sort.field]]); + allAuctions = allAuctions.sorted((x) => x[sort.field]); } } else { - allAuctions = allAuctions.sortedDescending([(x) => x[sort.field]]); + allAuctions = allAuctions.sortedDescending((x) => x[sort.field]); } } @@ -527,12 +531,14 @@ export class AuctionsGetterService { if (sort) { if (sort.direction === Sort.ASC) { if (sort.field === 'endDate') { - allAuctions = allAuctions.sorted([(x) => x[sort.field]], true); + allAuctions = allAuctions.sorted((x) => + x[sort.field] === 0 ? Number.MAX_SAFE_INTEGER : x[sort.field], + ); } else { - allAuctions = allAuctions.sorted([(x) => x[sort.field]]); + allAuctions = allAuctions.sorted((x) => x[sort.field]); } } else { - allAuctions = allAuctions.sortedDescending([(x) => x[sort.field]]); + allAuctions = allAuctions.sortedDescending((x) => x[sort.field]); } } diff --git a/src/modules/campaigns/campaigns.service.ts b/src/modules/campaigns/campaigns.service.ts index 353154272..69b1a0469 100644 --- a/src/modules/campaigns/campaigns.service.ts +++ b/src/modules/campaigns/campaigns.service.ts @@ -5,7 +5,6 @@ import { CampaignEntity } from 'src/db/campaigns'; import { NftMinterAbiService } from './nft-minter.abi.service'; import { CampaignsFilter } from '../common/filters/filtersTypes'; import { CollectionType } from '../assets/models/Collection.type'; -import { cacheConfig } from 'src/config'; import { CachingService, Constants } from '@multiversx/sdk-nestjs'; import { CacheInfo } from 'src/common/services/caching/entities/cache.info'; import { ClientProxy } from '@nestjs/microservices'; @@ -132,7 +131,6 @@ export class CampaignsService { this.clientProxy.emit('refreshCacheKey', { key, ttl, - redisClientName: cacheConfig.persistentRedisClientName, }); } diff --git a/src/modules/explore-stats/explore-stats.service.ts b/src/modules/explore-stats/explore-stats.service.ts index 2d4890278..3917840c1 100644 --- a/src/modules/explore-stats/explore-stats.service.ts +++ b/src/modules/explore-stats/explore-stats.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@nestjs/common'; import { MxApiService } from 'src/common'; -import { cacheConfig } from 'src/config'; import { CollectionsGetterService } from '../nftCollections/collections-getter.service'; import { ExploreCollectionsStats, diff --git a/src/modules/rabbitmq/elastic-updates/elastic-updates-events.service.ts b/src/modules/rabbitmq/elastic-updates/elastic-updates-events.service.ts index 6a237a51f..8cc435235 100644 --- a/src/modules/rabbitmq/elastic-updates/elastic-updates-events.service.ts +++ b/src/modules/rabbitmq/elastic-updates/elastic-updates-events.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@nestjs/common'; import { MxApiService } from 'src/common'; -import { cacheConfig } from 'src/config'; import { FlagNftService } from 'src/modules/admins/flag-nft.service'; import { AssetByIdentifierService } from 'src/modules/assets'; import { Asset, NftEventEnum, NftTypeEnum } from 'src/modules/assets/models'; @@ -204,7 +203,7 @@ export class ElasticUpdatesEventsService { } private getRarityQueueCacheKey() { - return generateCacheKeyFromParams(cacheConfig.rarityQueueClientName); + return generateCacheKeyFromParams('rarityQueue'); } async addNftsToTraitsQueue(collectionTickers: string[]): Promise { @@ -217,7 +216,7 @@ export class ElasticUpdatesEventsService { } private getTraitsQueueCacheKey() { - return generateCacheKeyFromParams(cacheConfig.traitsQueueClientName); + return generateCacheKeyFromParams('traitsQueue'); } private convertToMatchingEventType(