diff --git a/src/app/_services/block-sync.service.ts b/src/app/_services/block-sync.service.ts index e532113..cf63667 100644 --- a/src/app/_services/block-sync.service.ts +++ b/src/app/_services/block-sync.service.ts @@ -30,10 +30,10 @@ export class BlockSyncService { settings.txHelper = new TransactionHelper(settings.w3.engine, settings.registry); settings.txHelper.ontransfer = async (transaction: any): Promise => { - window.dispatchEvent(this.newTransferEvent(transaction)); + window.dispatchEvent(this.newEvent(transaction, 'cic_transfer')); }; settings.txHelper.onconversion = async (transaction: any): Promise => { - window.dispatchEvent(this.newConversionEvent(transaction)); + window.dispatchEvent(this.newEvent(transaction, 'cic_convert')); }; settings.registry.onload = (addressReturned: string): void => { this.loggingService.sendInfoLevelMessage(`Loaded network contracts ${addressReturned}`); @@ -76,16 +76,8 @@ export class BlockSyncService { } } - newTransferEvent(tx: any): any { - return new CustomEvent('cic_transfer', { - detail: { - tx, - }, - }); - } - - newConversionEvent(tx: any): any { - return new CustomEvent('cic_convert', { + newEvent(tx: any, eventType: string): any { + return new CustomEvent(eventType, { detail: { tx, },