Add promises to get registry.
This commit is contained in:
parent
bdc8f98d6b
commit
f091808714
@ -15,18 +15,21 @@ export class RegistryService {
|
|||||||
private static accountRegistry: AccountIndex;
|
private static accountRegistry: AccountIndex;
|
||||||
|
|
||||||
public static async getRegistry(): Promise<CICRegistry> {
|
public static async getRegistry(): Promise<CICRegistry> {
|
||||||
if (!RegistryService.registry) {
|
return new Promise(async (resolve, reject) => {
|
||||||
RegistryService.registry = new CICRegistry(
|
if (!RegistryService.registry) {
|
||||||
Web3Service.getInstance(),
|
RegistryService.registry = new CICRegistry(
|
||||||
environment.registryAddress,
|
Web3Service.getInstance(),
|
||||||
'Registry',
|
environment.registryAddress,
|
||||||
RegistryService.fileGetter,
|
'Registry',
|
||||||
['../../assets/js/block-sync/data']
|
RegistryService.fileGetter,
|
||||||
);
|
['../../assets/js/block-sync/data']
|
||||||
RegistryService.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress);
|
);
|
||||||
await RegistryService.registry.load();
|
RegistryService.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress);
|
||||||
}
|
await RegistryService.registry.load();
|
||||||
return RegistryService.registry;
|
return resolve(RegistryService.registry);
|
||||||
|
}
|
||||||
|
return resolve(RegistryService.registry);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async getTokenRegistry(): Promise<TokenRegistry> {
|
public static async getTokenRegistry(): Promise<TokenRegistry> {
|
||||||
|
Loading…
Reference in New Issue
Block a user