Refactor registry service imports.
This commit is contained in:
parent
405199cfe3
commit
8ae6436460
@ -25,8 +25,8 @@ export class BlockSyncService {
|
||||
const settings: Settings = new Settings(this.scan);
|
||||
const readyStateElements: { network: number } = { network: 2 };
|
||||
settings.w3.provider = environment.web3Provider;
|
||||
settings.w3.engine = this.registryService.getWeb3();
|
||||
settings.registry = this.registryService.getRegistry();
|
||||
settings.w3.engine = this.registryService.web3;
|
||||
settings.registry = this.registryService.registry;
|
||||
settings.txHelper = new TransactionHelper(settings.w3.engine, settings.registry);
|
||||
|
||||
settings.txHelper.ontransfer = async (transaction: any): Promise<void> => {
|
||||
@ -35,12 +35,10 @@ export class BlockSyncService {
|
||||
settings.txHelper.onconversion = async (transaction: any): Promise<any> => {
|
||||
window.dispatchEvent(this.newConversionEvent(transaction));
|
||||
};
|
||||
settings.registry.onload = (addressReturned: number): void => {
|
||||
settings.registry.onload = (addressReturned: string): void => {
|
||||
this.loggingService.sendInfoLevelMessage(`Loaded network contracts ${addressReturned}`);
|
||||
this.readyStateProcessor(settings, readyStateElements.network, address, offset, limit);
|
||||
};
|
||||
|
||||
settings.registry.load();
|
||||
}
|
||||
|
||||
readyStateProcessor(
|
||||
|
@ -22,12 +22,4 @@ export class RegistryService {
|
||||
this.registry.declaratorHelper.addTrust(environment.trustedDeclaratorAddress);
|
||||
this.registry.load();
|
||||
}
|
||||
|
||||
getRegistry(): any {
|
||||
return this.registry;
|
||||
}
|
||||
|
||||
getWeb3(): any {
|
||||
return this.web3;
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,7 @@ export class TokenService {
|
||||
LoadEvent: EventEmitter<number> = new EventEmitter<number>();
|
||||
|
||||
constructor(private httpClient: HttpClient, private registryService: RegistryService) {
|
||||
this.registry = registryService.getRegistry();
|
||||
this.registry.load();
|
||||
this.registry = registryService.registry;
|
||||
this.registry.onload = async (address: string): Promise<void> => {
|
||||
this.tokenRegistry = new TokenRegistry(
|
||||
await this.registry.getContractAddressByName('TokenRegistry')
|
||||
|
@ -37,9 +37,8 @@ export class TransactionService {
|
||||
private loggingService: LoggingService,
|
||||
private registryService: RegistryService
|
||||
) {
|
||||
this.web3 = this.registryService.getWeb3();
|
||||
this.registry = registryService.getRegistry();
|
||||
this.registry.load();
|
||||
this.web3 = this.registryService.web3;
|
||||
this.registry = registryService.registry;
|
||||
}
|
||||
|
||||
getAllTransactions(offset: number, limit: number): Observable<any> {
|
||||
@ -133,6 +132,7 @@ export class TransactionService {
|
||||
recipientAddress: string,
|
||||
value: number
|
||||
): Promise<any> {
|
||||
this.registry.onload = async (addressReturned: string): Promise<void> => {
|
||||
const transferAuthAddress = await this.registry.getContractAddressByName(
|
||||
'TransferAuthorization'
|
||||
);
|
||||
@ -169,5 +169,6 @@ export class TransactionService {
|
||||
this.loggingService.sendInfoLevelMessage(`Result: ${result}`);
|
||||
const transaction = await this.web3.eth.getTransaction(result.transactionHash);
|
||||
this.loggingService.sendInfoLevelMessage(`Transaction: ${transaction}`);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -46,8 +46,7 @@ export class UserService {
|
||||
this.keystore = authService.mutableKeyStore;
|
||||
this.signer = new PGPSigner(this.keystore);
|
||||
});
|
||||
this.registry = registryService.getRegistry();
|
||||
this.registry.load();
|
||||
this.registry = registryService.registry;
|
||||
}
|
||||
|
||||
resetPin(phone: string): Observable<any> {
|
||||
@ -179,6 +178,7 @@ export class UserService {
|
||||
|
||||
async loadAccounts(limit: number = 100, offset: number = 0): Promise<void> {
|
||||
this.resetAccountsList();
|
||||
this.registry.onload = async (addressReturned: string): Promise<void> => {
|
||||
const accountIndexAddress: string = await this.registry.getContractAddressByName(
|
||||
'AccountRegistry'
|
||||
);
|
||||
@ -186,10 +186,12 @@ export class UserService {
|
||||
const accountAddresses: Array<string> = await accountIndexQuery.last(
|
||||
await accountIndexQuery.totalAccounts()
|
||||
);
|
||||
console.log(accountAddresses);
|
||||
this.loggingService.sendInfoLevelMessage(accountAddresses);
|
||||
for (const accountAddress of accountAddresses.slice(offset, offset + limit)) {
|
||||
await this.getAccountByAddress(accountAddress, limit);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async getAccountByAddress(
|
||||
|
Loading…
Reference in New Issue
Block a user