cic-staff-client/src/app/_services/registry.service.ts

26 lines
702 B
TypeScript
Raw Normal View History

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 {
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,
2021-05-13 11:57:36 +02:00
'Registry',
2021-05-10 18:15:25 +02:00
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();
}
}