Skip to content

Commit

Permalink
feat: update watcher notification logic|2
Browse files Browse the repository at this point in the history
  • Loading branch information
serezhaolshan committed Sep 9, 2024
1 parent 154748f commit 8ea1f25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/explorer/explorer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface TransactionData {
data: {
value: {
wei: string,
ether: string,
ether: number,
symbol?: string
};
token?: {
Expand Down
8 changes: 4 additions & 4 deletions src/watcher/watcher.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class WatcherService {
const { data: { data: [txData] } } = txDataResponse;
const { from, to, value, timestamp, token, type } = txData;

if (!(await this.isNotificationNeeded(type, from, token!, value))) return;
if (!(await this.isNotificationNeeded(type, from, token, value))) return;

const cutAddress = (addr: string) => addr ? `${addr.slice(0, 5)}...${addr.slice(-5)}` : "";

Expand Down Expand Up @@ -309,8 +309,8 @@ export class WatcherService {
private async isNotificationNeeded(
type: string,
from: string,
token: { address: string },
value: { wei: string }
token: { address: string } | undefined,
value: { ether: number }
) {
if (!SUPPORTED_TX_TYPES.includes(type)) return false;

Expand All @@ -323,7 +323,7 @@ export class WatcherService {
return false;
}

if (value.wei === "0") return false;
if (value.ether === 0) return false;

return true;
}
Expand Down

0 comments on commit 8ea1f25

Please sign in to comment.