Format files using linter.
This commit is contained in:
parent
1edf3e50ae
commit
472d9b2cd1
@ -38,9 +38,9 @@ export class AccountIndex {
|
|||||||
// if signer address is not passed (for example in user service) then
|
// if signer address is not passed (for example in user service) then
|
||||||
// this fallsback to a web3 wallet that is not even connected???
|
// this fallsback to a web3 wallet that is not even connected???
|
||||||
if (signerAddress) {
|
if (signerAddress) {
|
||||||
this.signerAddress = signerAddress;
|
this.signerAddress = signerAddress;
|
||||||
} else {
|
} else {
|
||||||
this.signerAddress = web3.eth.accounts[0];
|
this.signerAddress = web3.eth.accounts[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,15 +82,14 @@ export class AuthService {
|
|||||||
return fetch(environment.cicMetaUrl, options);
|
return fetch(environment.cicMetaUrl, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getChallenge(): Promise<any> {
|
getChallenge(): Promise<any> {
|
||||||
return fetch(environment.cicMetaUrl)
|
return fetch(environment.cicMetaUrl).then((response) => {
|
||||||
.then(response => {
|
if (response.status === 401) {
|
||||||
if (response.status === 401) {
|
const authHeader: string = response.headers.get('WWW-Authenticate');
|
||||||
const authHeader: string = response.headers.get('WWW-Authenticate');
|
return hobaParseChallengeHeader(authHeader);
|
||||||
return hobaParseChallengeHeader(authHeader);
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async login(): Promise<boolean> {
|
async login(): Promise<boolean> {
|
||||||
if (this.getSessionToken()) {
|
if (this.getSessionToken()) {
|
||||||
|
@ -9,58 +9,58 @@ import { Web3Service } from '@app/_services/web3.service';
|
|||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class RegistryService {
|
export class RegistryService {
|
||||||
static fileGetter: FileGetter = new HttpGetter();
|
static fileGetter: FileGetter = new HttpGetter();
|
||||||
private static registry: CICRegistry;
|
private static registry: CICRegistry;
|
||||||
private static tokenRegistry: TokenRegistry;
|
private static tokenRegistry: TokenRegistry;
|
||||||
private static accountRegistry: AccountIndex;
|
private static accountRegistry: AccountIndex;
|
||||||
|
|
||||||
public static async getRegistry(): Promise<CICRegistry> {
|
public static async getRegistry(): Promise<CICRegistry> {
|
||||||
if (!RegistryService.registry) {
|
if (!RegistryService.registry) {
|
||||||
RegistryService.registry = new CICRegistry(
|
RegistryService.registry = new CICRegistry(
|
||||||
Web3Service.getInstance(),
|
Web3Service.getInstance(),
|
||||||
environment.registryAddress,
|
environment.registryAddress,
|
||||||
'Registry',
|
'Registry',
|
||||||
RegistryService.fileGetter,
|
RegistryService.fileGetter,
|
||||||
['../../assets/js/block-sync/data']
|
['../../assets/js/block-sync/data']
|
||||||
);
|
);
|
||||||
RegistryService.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress);
|
RegistryService.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress);
|
||||||
await RegistryService.registry.load()
|
await RegistryService.registry.load();
|
||||||
|
}
|
||||||
|
return RegistryService.registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async getTokenRegistry(): Promise<TokenRegistry> {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
if (!RegistryService.tokenRegistry) {
|
||||||
|
const registry = await RegistryService.getRegistry();
|
||||||
|
const tokenRegistryAddress = await RegistryService.registry.getContractAddressByName(
|
||||||
|
'TokenRegistry'
|
||||||
|
);
|
||||||
|
if (!tokenRegistryAddress) {
|
||||||
|
return reject('Unable to initialize Token Registry');
|
||||||
}
|
}
|
||||||
return RegistryService.registry;
|
RegistryService.tokenRegistry = new TokenRegistry(tokenRegistryAddress);
|
||||||
}
|
return resolve(RegistryService.tokenRegistry);
|
||||||
|
}
|
||||||
|
return resolve(RegistryService.tokenRegistry);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public static async getTokenRegistry(): Promise<TokenRegistry> {
|
public static async getAccountRegistry(): Promise<AccountIndex> {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
if (!RegistryService.tokenRegistry) {
|
if (!RegistryService.accountRegistry) {
|
||||||
const registry = await RegistryService.getRegistry()
|
const registry = await RegistryService.getRegistry();
|
||||||
const tokenRegistryAddress = await RegistryService.registry.getContractAddressByName('TokenRegistry')
|
const accountRegistryAddress = await RegistryService.registry.getContractAddressByName(
|
||||||
if (!tokenRegistryAddress) {
|
'AccountRegistry'
|
||||||
return reject("Unable to initialize Token Registry")
|
);
|
||||||
}
|
|
||||||
RegistryService.tokenRegistry = new TokenRegistry(tokenRegistryAddress);
|
|
||||||
return resolve(RegistryService.tokenRegistry)
|
|
||||||
}
|
|
||||||
return resolve(RegistryService.tokenRegistry);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async getAccountRegistry(): Promise<AccountIndex> {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
if (!RegistryService.accountRegistry) {
|
|
||||||
const registry = await RegistryService.getRegistry()
|
|
||||||
const accountRegistryAddress = await RegistryService
|
|
||||||
.registry
|
|
||||||
.getContractAddressByName('AccountRegistry')
|
|
||||||
|
|
||||||
if (!accountRegistryAddress) {
|
|
||||||
return reject("Unable to initialize Account Registry")
|
|
||||||
}
|
|
||||||
RegistryService.accountRegistry = new AccountIndex(accountRegistryAddress);
|
|
||||||
return resolve(RegistryService.accountRegistry)
|
|
||||||
}
|
|
||||||
return resolve(RegistryService.accountRegistry);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!accountRegistryAddress) {
|
||||||
|
return reject('Unable to initialize Account Registry');
|
||||||
|
}
|
||||||
|
RegistryService.accountRegistry = new AccountIndex(accountRegistryAddress);
|
||||||
|
return resolve(RegistryService.accountRegistry);
|
||||||
|
}
|
||||||
|
return resolve(RegistryService.accountRegistry);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,21 +179,21 @@ export class UserService {
|
|||||||
|
|
||||||
async loadAccounts(limit: number = 100, offset: number = 0): Promise<void> {
|
async loadAccounts(limit: number = 100, offset: number = 0): Promise<void> {
|
||||||
this.resetAccountsList();
|
this.resetAccountsList();
|
||||||
//const accountIndexAddress: string = await this.registry.getContractAddressByName(
|
// const accountIndexAddress: string = await this.registry.getContractAddressByName(
|
||||||
// 'AccountRegistry'
|
// 'AccountRegistry'
|
||||||
//);
|
// );
|
||||||
//const accountIndexQuery = new AccountIndex(accountIndexAddress);
|
// const accountIndexQuery = new AccountIndex(accountIndexAddress);
|
||||||
//const accountAddresses: Array<string> = await accountIndexQuery.last(limit);
|
// const accountAddresses: Array<string> = await accountIndexQuery.last(limit);
|
||||||
try{
|
try {
|
||||||
const accountRegistry = await RegistryService.getAccountRegistry();
|
const accountRegistry = await RegistryService.getAccountRegistry();
|
||||||
const accountAddresses: Array<string> = await accountRegistry.last(limit);
|
const accountAddresses: Array<string> = await accountRegistry.last(limit);
|
||||||
this.loggingService.sendInfoLevelMessage(accountAddresses);
|
this.loggingService.sendInfoLevelMessage(accountAddresses);
|
||||||
for (const accountAddress of accountAddresses.slice(offset, offset + limit)) {
|
for (const accountAddress of accountAddresses.slice(offset, offset + limit)) {
|
||||||
await this.getAccountByAddress(accountAddress, limit);
|
await this.getAccountByAddress(accountAddress, limit);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.loggingService.sendErrorLevelMessage("Unable to load accounts.", "user.service", error)
|
this.loggingService.sendErrorLevelMessage('Unable to load accounts.', 'user.service', error);
|
||||||
throw error
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user