Skip to content

Commit 35debe5

Browse files
authored
Integrate last sdk nestjs (#1516)
* update to latest sdk version * fixes for latest sdk version * add package-lock * fix unit tests
1 parent d3776fc commit 35debe5

10 files changed

Lines changed: 2168 additions & 631 deletions

File tree

package-lock.json

Lines changed: 2147 additions & 610 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@
8989
"@multiversx/sdk-core": "^13.2.2",
9090
"@multiversx/sdk-data-api-client": "^0.7.0",
9191
"@multiversx/sdk-exchange": "^0.2.21",
92-
"@multiversx/sdk-nestjs-auth": "5.0.0",
93-
"@multiversx/sdk-nestjs-cache": "5.0.0",
94-
"@multiversx/sdk-nestjs-common": "5.0.0",
95-
"@multiversx/sdk-nestjs-elastic": "5.0.0",
96-
"@multiversx/sdk-nestjs-http": "5.0.0",
97-
"@multiversx/sdk-nestjs-monitoring": "5.0.0",
98-
"@multiversx/sdk-nestjs-rabbitmq": "5.0.0",
99-
"@multiversx/sdk-nestjs-redis": "5.0.0",
92+
"@multiversx/sdk-nestjs-auth": "6.0.0",
93+
"@multiversx/sdk-nestjs-cache": "6.0.0",
94+
"@multiversx/sdk-nestjs-common": "6.0.0",
95+
"@multiversx/sdk-nestjs-elastic": "6.0.0",
96+
"@multiversx/sdk-nestjs-http": "6.0.0",
97+
"@multiversx/sdk-nestjs-monitoring": "6.0.0",
98+
"@multiversx/sdk-nestjs-rabbitmq": "6.0.0",
99+
"@multiversx/sdk-nestjs-redis": "6.0.0",
100100
"@multiversx/sdk-transaction-processor": "^0.1.35",
101101
"@nestjs/apollo": "12.0.11",
102102
"@nestjs/common": "10.2.0",

src/common/pubsub/pub.sub.listener.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ export class PubSubListenerController {
1212
) { }
1313

1414
@EventPattern('deleteCacheKeys')
15-
async deleteCacheKey(keys: string[]) {
15+
deleteCacheKey(keys: string[]) {
1616
for (const key of keys) {
1717
this.logger.log(`Deleting local cache key ${key}`);
18-
await this.cachingService.deleteLocal(key);
18+
this.cachingService.deleteLocal(key);
1919
}
2020
}
2121

src/common/rabbitmq/rabbitmq.nft.handler.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class RabbitMqNftHandlerService {
2525
) { }
2626

2727
private async getCollectionType(collectionIdentifier: string): Promise<NftType | null> {
28-
const type = await this.cachingService.getLocal<NftType>(CacheInfo.CollectionType(collectionIdentifier).key) ??
28+
const type = this.cachingService.getLocal<NftType>(CacheInfo.CollectionType(collectionIdentifier).key) ??
2929
await this.getCollectionTypeRaw(collectionIdentifier);
3030

3131
if (!type) {

src/endpoints/caching/local.cache.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class LocalCacheController {
5050
status: 404,
5151
description: 'Key not found',
5252
})
53-
async delCache(@Param('key') key: string) {
54-
await this.cachingService.deleteLocal(key);
53+
delCache(@Param('key') key: string) {
54+
this.cachingService.deleteLocal(key);
5555
}
5656
}

src/endpoints/esdt/esdt.address.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ export class EsdtAddressService {
373373
return result;
374374
}
375375

376-
const cachedValue = await this.cachingService.getLocal<{ [key: string]: any }>(`address:${address}:esdts`);
376+
const cachedValue = this.cachingService.getLocal<{ [key: string]: any }>(`address:${address}:esdts`);
377377

378378
if (cachedValue) {
379379
this.metricsService.incrementCachedApiHit('Gateway.AccountEsdts');

src/endpoints/mex/mex.settings.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class MexSettingsService {
6262
}
6363

6464
async getMexContracts(): Promise<Set<string>> {
65-
let contracts = await this.cachingService.getLocal<Set<string>>(CacheInfo.MexContracts.key);
65+
let contracts = this.cachingService.getLocal<Set<string>>(CacheInfo.MexContracts.key);
6666
if (!contracts) {
6767
contracts = await this.getMexContractsRaw();
6868
this.cachingService.setLocal(CacheInfo.MexContracts.key, contracts, Constants.oneMinute() * 10);

src/endpoints/transactions/transaction-action/recognizers/staking/transaction.action.stake.recognizer.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class StakeActionRecognizerService implements TransactionActionRecognizer
2020
) { }
2121

2222
private async getProviders(): Promise<{ [key: string]: { providerName: string, providerAvatar: string } }> {
23-
let providersDetails = await this.cachingService.getLocal<{ [key: string]: { providerName: string, providerAvatar: string } }>('plugins:staking:providerAddresses');
23+
let providersDetails = this.cachingService.getLocal<{ [key: string]: { providerName: string, providerAvatar: string } }>('plugins:staking:providerAddresses');
2424
if (!providersDetails) {
2525
const providers = await this.providerService.getAllProviders();
2626
const identities = await this.identitiesService.getAllIdentities();

src/test/unit/services/blocks.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ describe('Block Service', () => {
230230

231231
const blses = ['bls_key_0', 'bls_key_1', 'bls_key_2'];
232232

233-
jest.spyOn(cacheService, 'getLocal').mockImplementation(() => Promise.resolve(blses));
233+
jest.spyOn(cacheService, 'getLocal').mockImplementation(() => blses);
234234
jest.spyOn(blsService, 'getPublicKeys').mockImplementation(() => Promise.resolve(blses));
235235

236236
const result = await blockService.computeProposerAndValidators(inputItem);
@@ -253,8 +253,8 @@ describe('Block Service', () => {
253253

254254
const blses = ['bls_key_0', 'bls_key_1', 'bls_key_2'];
255255

256-
jest.spyOn(cacheService, 'getLocal').mockImplementationOnce(() => Promise.resolve(null));
257-
jest.spyOn(cacheService, 'setLocal').mockImplementation(() => Promise.resolve());
256+
jest.spyOn(cacheService, 'getLocal').mockImplementationOnce(() => null);
257+
jest.spyOn(cacheService, 'setLocal').mockImplementation();
258258
jest.spyOn(blsService, 'getPublicKeys').mockImplementation(() => Promise.resolve(blses));
259259

260260
await blockService.computeProposerAndValidators(inputItem);

src/test/unit/services/esdt.address.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ describe('EsdtAddressService', () => {
211211
},
212212
};
213213

214-
jest.spyOn(cacheService, 'getLocal').mockResolvedValue(cachedEsdts);
214+
jest.spyOn(cacheService, 'getLocal').mockReturnValue(cachedEsdts);
215215
jest.spyOn(metricsService, 'incrementCachedApiHit');
216216

217217
const result = await service.getAllEsdtsForAddressFromGateway(address);
@@ -224,7 +224,7 @@ describe('EsdtAddressService', () => {
224224
const address = 'some-address';
225225
const ttl = 1000;
226226

227-
jest.spyOn(cacheService, 'getLocal').mockResolvedValueOnce(null);
227+
jest.spyOn(cacheService, 'getLocal').mockReturnValueOnce(null);
228228
jest.spyOn(cacheService, 'setLocal');
229229
jest.spyOn(protocolService, 'getSecondsRemainingUntilNextRound').mockResolvedValue(ttl);
230230

0 commit comments

Comments
 (0)