diff --git a/.env.example b/.env.example index f453ea99..9de2745f 100644 --- a/.env.example +++ b/.env.example @@ -70,7 +70,7 @@ SMART_WALLETS_PORT=5007 SMART_WALLETS_TCP_PORT=8882 SMART_WALLETS_MONGO_URI=mongodb://mongo:27017/charge-smart-wallets SMART_WALLETS_JWT_SECRET=smart_wallets_jwt_secret -INCOMING_TOKEN_TRANSFERS_WEBHOOK_ID=put_incoming_token_transfers_webhook_id_here +INCOMING_TOKEN_TRANSFERS_WEBHOOK_ID= FUSE_WALLET_BACKEND_JWT=fuse_wallet_backend_jwt CENTRIFUGO_URI=ws://centrifugo:8000/connection/websocket CENTRIFUGO_JWT= diff --git a/apps/charge-apps-service/src/charge-api/charge-api.module.ts b/apps/charge-apps-service/src/charge-api/charge-api.module.ts index 8a802a46..6a8d3fab 100644 --- a/apps/charge-apps-service/src/charge-api/charge-api.module.ts +++ b/apps/charge-apps-service/src/charge-api/charge-api.module.ts @@ -14,7 +14,7 @@ import configuration from '@app/apps-service/common/config/configuration' useFactory: async (configService: ConfigService) => ({ headers: { 'Content-Type': 'application/json', - 'API-SECRET': `${configService.get('CHARGE_SECRET_KEY')}` + 'API-SECRET': `${configService.getOrThrow('CHARGE_SECRET_KEY')}` } }), inject: [ConfigService] diff --git a/apps/charge-apps-service/src/charge-api/charge-api.service.ts b/apps/charge-apps-service/src/charge-api/charge-api.service.ts index 73f66652..64947772 100644 --- a/apps/charge-apps-service/src/charge-api/charge-api.service.ts +++ b/apps/charge-apps-service/src/charge-api/charge-api.service.ts @@ -26,7 +26,7 @@ export class ChargeApiService { } get chargeBaseUrl () { - return this.configService.get('CHARGE_BASE_URL') + return this.configService.getOrThrow('CHARGE_BASE_URL') } get unmarshalBaseUrl () { @@ -38,7 +38,7 @@ export class ChargeApiService { } get chargePublicKey () { - return this.configService.get('CHARGE_PUBLIC_KEY') + return this.configService.getOrThrow('CHARGE_PUBLIC_KEY') } get chargeWebhookId () { @@ -163,6 +163,7 @@ export class ChargeApiService { } async addWebhookAddress (params: { walletAddress: string, webhookId: string }) { + console.log('Adding address to the webhook...') const url = `${this.chargeBaseUrl}/api/v0/notifications/webhook/add-addresses?apiKey=${this.chargePublicKey}` const requestBody = { webhookId: params.webhookId, diff --git a/apps/charge-smart-wallets-service/src/smart-wallets/services/smart-wallets-aa.service.ts b/apps/charge-smart-wallets-service/src/smart-wallets/services/smart-wallets-aa.service.ts index e0dae556..35a49fb8 100644 --- a/apps/charge-smart-wallets-service/src/smart-wallets/services/smart-wallets-aa.service.ts +++ b/apps/charge-smart-wallets-service/src/smart-wallets/services/smart-wallets-aa.service.ts @@ -3,11 +3,8 @@ import { HttpException, HttpStatus, Injectable, Logger } from '@nestjs/common' import { JwtService } from '@nestjs/jwt' import { arrayify, computeAddress, hashMessage, recoverPublicKey } from 'nestjs-ethers' import { SmartWalletService } from '@app/smart-wallets-service/smart-wallets/interfaces/smart-wallets.interface' -import { NotificationsService } from '@app/api-service/notifications/notifications.service' import { ConfigService } from '@nestjs/config' import { ChargeApiService } from '@app/apps-service/charge-api/charge-api.service' -// import { ISmartWalletUser } from '@app/common/interfaces/smart-wallet.interface' -// import CentrifugoAPIService from '@app/common/services/centrifugo.service' @Injectable() export class SmartWalletsAAService implements SmartWalletService { @@ -15,10 +12,8 @@ export class SmartWalletsAAService implements SmartWalletService { constructor ( private readonly jwtService: JwtService, - private readonly notificationsService: NotificationsService, private configService: ConfigService, private chargeApiService: ChargeApiService - // private readonly centrifugoAPIService: CentrifugoAPIService, ) { } async auth (smartWalletsAuthDto: SmartWalletsAuthDto) { @@ -51,8 +46,10 @@ export class SmartWalletsAAService implements SmartWalletService { } private async subscribeWalletToNotifications (walletAddress: string) { + console.log('Subscribing wallets to notifications...') + const webhookId = - this.configService.get('INCOMING_TOKEN_TRANSFERS_WEBHOOK_ID') + this.configService.getOrThrow('INCOMING_TOKEN_TRANSFERS_WEBHOOK_ID') return this.chargeApiService.addWebhookAddress({ walletAddress, webhookId }) }