File

src/app/_services/registry.service.ts

Index

Properties
Methods

Constructor

constructor()

Methods

Static Async getRegistry
getRegistry()
Returns : Promise<CICRegistry>

Properties

Static fileGetter
Type : FileGetter
Default value : new HttpGetter()
Private Static registry
Type : CICRegistry
import { Injectable } from '@angular/core';
import { environment } from '@src/environments/environment';
import { CICRegistry, FileGetter } from '@cicnet/cic-client';
import { HttpGetter } from '@app/_helpers';
import { Web3Service } from '@app/_services/web3.service';

@Injectable({
  providedIn: 'root',
})
export class RegistryService {
  static fileGetter: FileGetter = new HttpGetter();
  private static registry: CICRegistry;

  constructor() {}

  public static async getRegistry(): Promise<CICRegistry> {
    if (!RegistryService.registry) {
      RegistryService.registry = new CICRegistry(
        Web3Service.getInstance(),
        environment.registryAddress,
        'Registry',
        RegistryService.fileGetter,
        ['../../assets/js/block-sync/data']
      );
      RegistryService.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress);
      await RegistryService.registry.load();
    }
    return RegistryService.registry;
  }
}

result-matching ""

    No results matching ""