From 109c586e2d15912bf2c86219c6669436c26d1585 Mon Sep 17 00:00:00 2001 From: Nelson Taveras <4562733+nvtaveras@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:39:44 +0200 Subject: [PATCH] refactor: assert event types when parsing receipts (#14) --- src/parse-transaction-receipts.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/parse-transaction-receipts.ts b/src/parse-transaction-receipts.ts index 42c7151..d869a2b 100644 --- a/src/parse-transaction-receipts.ts +++ b/src/parse-transaction-receipts.ts @@ -68,12 +68,12 @@ export default function parseTransactionReceipts( ], }); - if (isProposalCreatedEvent(event)) { - result.push({ - event, - txHash: log.transactionHash, - }); - } + assert(isProposalCreatedEvent(event)); + + result.push({ + event, + txHash: log.transactionHash, + }); break; } case EventType.MedianUpdated: { @@ -86,13 +86,13 @@ export default function parseTransactionReceipts( ], }); - if (isHealthCheckEvent(event)) { - result.push({ - block: Number(receipt.blockNumber), - event, - txHash: log.transactionHash, - }); - } + assert(isHealthCheckEvent(event)); + + result.push({ + block: Number(receipt.blockNumber), + event, + txHash: log.transactionHash, + }); break; } default: