2021-04-20 10:28:40 +02:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import Web3 from 'web3';
|
2021-05-10 18:15:25 +02:00
|
|
|
import { environment } from '@src/environments/environment';
|
|
|
|
import { CICRegistry, FileGetter } from 'cic-client';
|
|
|
|
import { HttpGetter } from '@app/_helpers';
|
2021-04-20 10:28:40 +02:00
|
|
|
|
|
|
|
@Injectable({
|
2021-05-10 18:15:25 +02:00
|
|
|
providedIn: 'root',
|
2021-04-20 10:28:40 +02:00
|
|
|
})
|
|
|
|
export class RegistryService {
|
2021-04-29 19:10:39 +02:00
|
|
|
web3: Web3 = new Web3(environment.web3Provider);
|
|
|
|
fileGetter: FileGetter = new HttpGetter();
|
2021-05-10 18:15:25 +02:00
|
|
|
registry: CICRegistry = new CICRegistry(
|
|
|
|
this.web3,
|
|
|
|
environment.registryAddress,
|
|
|
|
'CICRegistry',
|
|
|
|
this.fileGetter,
|
|
|
|
['../../assets/js/block-sync/data']
|
|
|
|
);
|
2021-04-20 10:28:40 +02:00
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress);
|
|
|
|
this.registry.load();
|
|
|
|
}
|
|
|
|
|
|
|
|
getRegistry(): any {
|
|
|
|
return this.registry;
|
|
|
|
}
|
|
|
|
|
|
|
|
getWeb3(): any {
|
|
|
|
return this.web3;
|
|
|
|
}
|
|
|
|
}
|