@lido-nestjs/registry 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/abstract-registry.d.ts +2 -2
- package/dist/main/abstract-registry.js +3 -3
- package/dist/main/key-registry/key-registry.module.js +3 -1
- package/dist/main/validator-registry/validator-registry.module.js +3 -1
- package/dist/storage/key.repository.d.ts +1 -1
- package/dist/storage/key.repository.js +2 -2
- package/dist/storage/key.storage.d.ts +4 -0
- package/dist/storage/key.storage.js +10 -1
- package/dist/storage/meta.repository.d.ts +1 -1
- package/dist/storage/meta.repository.js +2 -2
- package/dist/storage/operator.repository.d.ts +1 -1
- package/dist/storage/operator.repository.js +2 -2
- package/dist/storage/operator.storage.js +1 -1
- package/package.json +6 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { LoggerService } from '@nestjs/common';
|
|
3
3
|
import { Registry } from '@lido-nestjs/contracts';
|
|
4
|
-
import { EntityManager } from '@mikro-orm/
|
|
4
|
+
import { EntityManager } from '@mikro-orm/core';
|
|
5
5
|
import EventEmitter from 'events';
|
|
6
6
|
import { CronJob } from 'cron';
|
|
7
7
|
import { RegistryMetaFetchService } from '../fetch/meta.fetch';
|
|
@@ -32,7 +32,7 @@ export declare abstract class AbstractRegistryService {
|
|
|
32
32
|
protected collectListenerCount(): number;
|
|
33
33
|
subscribe(cb: (error: null | Error, payload: RegistryKey[]) => void): () => void;
|
|
34
34
|
/** collects changed data from the contract and store it to the db */
|
|
35
|
-
update(blockHashOrBlockTag: string | number): Promise<
|
|
35
|
+
update(blockHashOrBlockTag: string | number): Promise<RegistryMeta | undefined>;
|
|
36
36
|
/** contract */
|
|
37
37
|
/** returns the meta data from the contract */
|
|
38
38
|
getMetaDataFromContract(blockHashOrBlockTag: string | number): Promise<RegistryMeta>;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var common = require('@nestjs/common');
|
|
7
7
|
var contracts = require('@lido-nestjs/contracts');
|
|
8
|
-
var
|
|
8
|
+
var core = require('@mikro-orm/core');
|
|
9
9
|
var logger = require('@lido-nestjs/logger');
|
|
10
10
|
var decorators = require('@lido-nestjs/decorators');
|
|
11
11
|
var EventEmitter = require('events');
|
|
@@ -118,7 +118,7 @@ exports.AbstractRegistryService = class AbstractRegistryService {
|
|
|
118
118
|
updatedKeys: updatedKeys.length,
|
|
119
119
|
currMeta,
|
|
120
120
|
});
|
|
121
|
-
return
|
|
121
|
+
return currMeta;
|
|
122
122
|
}
|
|
123
123
|
/** contract */
|
|
124
124
|
/** returns the meta data from the contract */
|
|
@@ -207,5 +207,5 @@ exports.AbstractRegistryService = tslib.__decorate([
|
|
|
207
207
|
key_storage.RegistryKeyStorageService,
|
|
208
208
|
operator_fetch.RegistryOperatorFetchService,
|
|
209
209
|
operator_storage.RegistryOperatorStorageService,
|
|
210
|
-
|
|
210
|
+
core.EntityManager, Object])
|
|
211
211
|
], exports.AbstractRegistryService);
|
|
@@ -30,6 +30,7 @@ exports.KeyRegistryModule = KeyRegistryModule_1 = class KeyRegistryModule {
|
|
|
30
30
|
useValue: options,
|
|
31
31
|
},
|
|
32
32
|
],
|
|
33
|
+
exports: [registryFetch_module.RegistryFetchModule],
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
static forFeatureAsync(options) {
|
|
@@ -45,6 +46,7 @@ exports.KeyRegistryModule = KeyRegistryModule_1 = class KeyRegistryModule {
|
|
|
45
46
|
useFactory: options.useFactory,
|
|
46
47
|
},
|
|
47
48
|
],
|
|
49
|
+
exports: [registryFetch_module.RegistryFetchModule],
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
};
|
|
@@ -52,6 +54,6 @@ exports.KeyRegistryModule = KeyRegistryModule_1 = tslib.__decorate([
|
|
|
52
54
|
common.Module({
|
|
53
55
|
imports: [registryStorage_module.RegistryStorageModule],
|
|
54
56
|
providers: [keyRegistry_service.KeyRegistryService],
|
|
55
|
-
exports: [keyRegistry_service.KeyRegistryService],
|
|
57
|
+
exports: [keyRegistry_service.KeyRegistryService, registryStorage_module.RegistryStorageModule],
|
|
56
58
|
})
|
|
57
59
|
], exports.KeyRegistryModule);
|
|
@@ -30,6 +30,7 @@ exports.ValidatorRegistryModule = ValidatorRegistryModule_1 = class ValidatorReg
|
|
|
30
30
|
useValue: options,
|
|
31
31
|
},
|
|
32
32
|
],
|
|
33
|
+
exports: [registryFetch_module.RegistryFetchModule],
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
static forFeatureAsync(options) {
|
|
@@ -45,6 +46,7 @@ exports.ValidatorRegistryModule = ValidatorRegistryModule_1 = class ValidatorReg
|
|
|
45
46
|
useFactory: options.useFactory,
|
|
46
47
|
},
|
|
47
48
|
],
|
|
49
|
+
exports: [registryFetch_module.RegistryFetchModule],
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
};
|
|
@@ -52,6 +54,6 @@ exports.ValidatorRegistryModule = ValidatorRegistryModule_1 = tslib.__decorate([
|
|
|
52
54
|
common.Module({
|
|
53
55
|
imports: [registryStorage_module.RegistryStorageModule],
|
|
54
56
|
providers: [validatorRegistry_service.ValidatorRegistryService],
|
|
55
|
-
exports: [validatorRegistry_service.ValidatorRegistryService],
|
|
57
|
+
exports: [validatorRegistry_service.ValidatorRegistryService, registryStorage_module.RegistryStorageModule],
|
|
56
58
|
})
|
|
57
59
|
], exports.ValidatorRegistryModule);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var core = require('@mikro-orm/core');
|
|
6
6
|
|
|
7
|
-
class RegistryKeyRepository extends
|
|
7
|
+
class RegistryKeyRepository extends core.EntityRepository {
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
exports.RegistryKeyRepository = RegistryKeyRepository;
|
|
@@ -9,6 +9,10 @@ export declare class RegistryKeyStorageService {
|
|
|
9
9
|
findUsed(): Promise<RegistryKey[]>;
|
|
10
10
|
/** find all keys by operator */
|
|
11
11
|
findByOperatorIndex(operatorIndex: number): Promise<RegistryKey[]>;
|
|
12
|
+
/** find key by pubkey */
|
|
13
|
+
findByPubkey(key: string): Promise<RegistryKey[]>;
|
|
14
|
+
/** find key by signature */
|
|
15
|
+
findBySignature(depositSignature: string): Promise<RegistryKey[]>;
|
|
12
16
|
/** find key by index */
|
|
13
17
|
findOneByIndex(operatorIndex: number, keyIndex: number): Promise<RegistryKey | null>;
|
|
14
18
|
/** removes key by index */
|
|
@@ -23,6 +23,15 @@ exports.RegistryKeyStorageService = class RegistryKeyStorageService {
|
|
|
23
23
|
async findByOperatorIndex(operatorIndex) {
|
|
24
24
|
return await this.repository.find({ operatorIndex });
|
|
25
25
|
}
|
|
26
|
+
/** find key by pubkey */
|
|
27
|
+
async findByPubkey(key) {
|
|
28
|
+
return await this.repository.find({ key: key.toLocaleLowerCase() });
|
|
29
|
+
}
|
|
30
|
+
/** find key by signature */
|
|
31
|
+
async findBySignature(depositSignature) {
|
|
32
|
+
depositSignature = depositSignature.toLocaleLowerCase();
|
|
33
|
+
return await this.repository.find({ depositSignature });
|
|
34
|
+
}
|
|
26
35
|
/** find key by index */
|
|
27
36
|
async findOneByIndex(operatorIndex, keyIndex) {
|
|
28
37
|
return await this.repository.findOne({ operatorIndex, index: keyIndex });
|
|
@@ -49,7 +58,7 @@ exports.RegistryKeyStorageService = class RegistryKeyStorageService {
|
|
|
49
58
|
const instance = new key_entity.RegistryKey(operatorKey);
|
|
50
59
|
return await this.repository.persist(instance);
|
|
51
60
|
}));
|
|
52
|
-
this.repository.flush();
|
|
61
|
+
await this.repository.flush();
|
|
53
62
|
return result;
|
|
54
63
|
}
|
|
55
64
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var core = require('@mikro-orm/core');
|
|
6
6
|
|
|
7
|
-
class RegistryMetaRepository extends
|
|
7
|
+
class RegistryMetaRepository extends core.EntityRepository {
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
exports.RegistryMetaRepository = RegistryMetaRepository;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var core = require('@mikro-orm/core');
|
|
6
6
|
|
|
7
|
-
class RegistryOperatorRepository extends
|
|
7
|
+
class RegistryOperatorRepository extends core.EntityRepository {
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
exports.RegistryOperatorRepository = RegistryOperatorRepository;
|
|
@@ -38,7 +38,7 @@ exports.RegistryOperatorStorageService = class RegistryOperatorStorageService {
|
|
|
38
38
|
const instance = new operator_entity.RegistryOperator(operator);
|
|
39
39
|
return await this.repository.persist(instance);
|
|
40
40
|
}));
|
|
41
|
-
this.repository.flush();
|
|
41
|
+
await this.repository.flush();
|
|
42
42
|
return result;
|
|
43
43
|
}
|
|
44
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lido-nestjs/registry",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,12 +32,11 @@
|
|
|
32
32
|
"@lido-nestjs/decorators": "1.0.0",
|
|
33
33
|
"@lido-nestjs/logger": "1.1.0",
|
|
34
34
|
"@lido-nestjs/utils": "1.1.0",
|
|
35
|
-
"@mikro-orm/core": "^5.0.1",
|
|
36
|
-
"@mikro-orm/nestjs": "^4.3.1",
|
|
37
|
-
"@mikro-orm/sqlite": "^5.0.3",
|
|
38
35
|
"cron": "^2.0.0"
|
|
39
36
|
},
|
|
40
37
|
"peerDependencies": {
|
|
38
|
+
"@mikro-orm/core": "^5.2.0",
|
|
39
|
+
"@mikro-orm/nestjs": "^5.0.2",
|
|
41
40
|
"@nestjs/common": "^8.2.5",
|
|
42
41
|
"@nestjs/core": "^8.2.5",
|
|
43
42
|
"reflect-metadata": "^0.1.13",
|
|
@@ -46,6 +45,9 @@
|
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
47
|
"@lido-nestjs/execution": "1.7.0",
|
|
48
|
+
"@mikro-orm/core": "^5.2.0",
|
|
49
|
+
"@mikro-orm/nestjs": "^5.0.2",
|
|
50
|
+
"@mikro-orm/sqlite": "^5.2.0",
|
|
49
51
|
"@nestjs/common": "^8.2.5",
|
|
50
52
|
"@nestjs/core": "^8.2.5",
|
|
51
53
|
"@nestjs/testing": "^8.2.5",
|