Skip to content

Commit

Permalink
Merge pull request #55 from ambrosus/rewrite
Browse files Browse the repository at this point in the history
Apollo notifications fix
  • Loading branch information
serezhaolshan authored Sep 9, 2024
2 parents 01eb624 + 9806793 commit 6032945
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HOSTNAME=
PORT=
APP_ENV=
MONGO_DB_NAME=
MONGO_DB_URL=
MONGO_DB_PORT=
FIREBASE_CRED_PATH=
ANDROID_CHANNEL_NAME=
TOKEN_PRICE_URL=
EXPLORER_API=
REDIS_URL=
EXPLORER_TOKEN=
CALLBACK_URL=
RPC_URL=
REWARDS_BANK_ADDRESS=
1 change: 1 addition & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const callbackUrl = env.CALLBACK_URL as string;
export const appPort = Number(env.PORT) || 5001;
export const appEnv = env.APP_ENV as AppEnv || "dev";
export const rpcUrl = env.RPC_URL as string;
export const rewardsBankAddress = env.REWARDS_BANK_ADDRESS as string;

export const androidChannel = env.ANDROID_CHANNEL_NAME as string;

Expand Down
1 change: 0 additions & 1 deletion src/router/watcher.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { DependencyContainer } from "tsyringe";
import { Application } from "express";
import { WatcherNetwork } from "../watcher";


const routes = (app: Application, container: DependencyContainer) => {

const watcherNetwork = container.resolve(WatcherNetwork);
Expand Down
6 changes: 5 additions & 1 deletion src/watcher/watcher.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { singleton } from "tsyringe";

import { Watcher } from "./watcher.model";
import { ExplorerService } from "../explorer";
import { appEnv, explorerToken, notificationsTitleConfig, ONE_DAY_IN_MS } from "../config";
import { appEnv, explorerToken, notificationsTitleConfig, ONE_DAY_IN_MS, rewardsBankAddress } from "../config";
import { WatcherRepository } from "./watcher.repository";
import { NotificationService } from "../notification-sender";
import { WatcherAddressesService } from "../watcher-addresses";
Expand Down Expand Up @@ -249,6 +249,10 @@ export class WatcherService {

if (!SUPPORTED_TX_TYPES.includes(type)) return;

// @dev To avoid sending notifications for node rewards transactions
// @dev To lower case for case-insensitive comparison
if (from.toLowerCase() === rewardsBankAddress.toLowerCase()) return;

// @dev Did it for hiding ERC-1155 and ERC-721 transfers for users
if (token && !(await isERC20Standard(token.address))) {
return;
Expand Down

0 comments on commit 6032945

Please sign in to comment.