From 36a084fe3d020d560a5155aeb795bccd86c5beee Mon Sep 17 00:00:00 2001 From: Maxime Cyr <2829180+Redm4x@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:27:54 -0500 Subject: [PATCH] Treat missing denom as balance of 0 for Monitored Values (#574) fix(analytics): treat missing denom as balance of 0 --- apps/indexer/src/monitors/addressBalanceMonitor.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/indexer/src/monitors/addressBalanceMonitor.ts b/apps/indexer/src/monitors/addressBalanceMonitor.ts index f0fa9c599..09bbef70f 100644 --- a/apps/indexer/src/monitors/addressBalanceMonitor.ts +++ b/apps/indexer/src/monitors/addressBalanceMonitor.ts @@ -19,10 +19,6 @@ export class AddressBalanceMonitor { const [targetAddress, targetToken] = monitoredValue.target.split("|"); const balance = await this.getBalance(targetAddress, targetToken); - if (balance === null) { - throw new Error("Unable to get balance for " + monitoredValue.target); - } - monitoredValue.value = balance.toString(); monitoredValue.lastUpdateDate = new Date(); await monitoredValue.save(); @@ -36,7 +32,7 @@ export class AddressBalanceMonitor { const balance = response.data.balances.find(x => x.denom === (denom || activeChain.udenom)); if (!balance) { - return null; + return 0; } return parseInt(balance.amount);