@lido-nestjs/registry 1.0.1 → 1.1.2
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.js +6 -1
- 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.storage.d.ts +4 -0
- package/dist/storage/key.storage.js +10 -1
- package/dist/storage/operator.storage.js +1 -1
- package/package.json +6 -4
|
@@ -85,7 +85,11 @@ exports.AbstractRegistryService = class AbstractRegistryService {
|
|
|
85
85
|
}
|
|
86
86
|
if (isSameContractState) {
|
|
87
87
|
(_c = (_b = this.logger).debug) === null || _c === void 0 ? void 0 : _c.call(_b, 'Same state, no data update required', { currMeta });
|
|
88
|
-
await this.
|
|
88
|
+
await this.entityManager.transactional(async (entityManager) => {
|
|
89
|
+
entityManager.nativeDelete(meta_entity.RegistryMeta, {});
|
|
90
|
+
const meta = new meta_entity.RegistryMeta(currMeta);
|
|
91
|
+
entityManager.persist(meta);
|
|
92
|
+
});
|
|
89
93
|
(_e = (_d = this.logger).debug) === null || _e === void 0 ? void 0 : _e.call(_d, 'Updated metadata in the DB', { currMeta });
|
|
90
94
|
return;
|
|
91
95
|
}
|
|
@@ -110,6 +114,7 @@ exports.AbstractRegistryService = class AbstractRegistryService {
|
|
|
110
114
|
const instance = new operator_entity.RegistryOperator(operator);
|
|
111
115
|
entityManager.persist(instance);
|
|
112
116
|
});
|
|
117
|
+
entityManager.nativeDelete(meta_entity.RegistryMeta, {});
|
|
113
118
|
const meta = new meta_entity.RegistryMeta(currMeta);
|
|
114
119
|
entityManager.persist(meta);
|
|
115
120
|
});
|
|
@@ -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);
|
|
@@ -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
|
};
|
|
@@ -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.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,11 +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
35
|
"cron": "^2.0.0"
|
|
38
36
|
},
|
|
39
37
|
"peerDependencies": {
|
|
38
|
+
"@mikro-orm/core": "^5.2.0",
|
|
39
|
+
"@mikro-orm/nestjs": "^5.0.2",
|
|
40
40
|
"@nestjs/common": "^8.2.5",
|
|
41
41
|
"@nestjs/core": "^8.2.5",
|
|
42
42
|
"reflect-metadata": "^0.1.13",
|
|
@@ -45,7 +45,9 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@lido-nestjs/execution": "1.7.0",
|
|
48
|
-
"@mikro-orm/
|
|
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",
|