diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..9c4268f --- /dev/null +++ b/.env.example @@ -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= \ No newline at end of file diff --git a/src/config/index.ts b/src/config/index.ts index ec0fa9d..64a60a9 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -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; diff --git a/src/router/watcher.router.ts b/src/router/watcher.router.ts index 03b2692..92a0ed4 100644 --- a/src/router/watcher.router.ts +++ b/src/router/watcher.router.ts @@ -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); diff --git a/src/watcher/watcher.service.ts b/src/watcher/watcher.service.ts index 5f7227d..7e8e315 100644 --- a/src/watcher/watcher.service.ts +++ b/src/watcher/watcher.service.ts @@ -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"; @@ -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;