1- import {
2- forwardRef ,
3- Inject ,
4- Injectable ,
5- UnauthorizedException ,
6- } from '@nestjs/common' ;
1+ import { Inject , Injectable , UnauthorizedException } from '@nestjs/common' ;
72import { JwtService } from '@nestjs/jwt' ;
83import { ConfigType } from '@nestjs/config' ;
94import { UsersService } from '../../users/providers/users.service' ;
@@ -14,6 +9,7 @@ import * as crypto from 'crypto';
149import { StellarWalletLoginDto } from '../dtos/walletLogin.dto' ;
1510import { ChallengeLevel } from '../../users/enums/challengeLevel.enum' ;
1611import { AgeGroup } from '../../users/enums/ageGroup.enum' ;
12+ import { User } from 'src/users/user.entity' ;
1713
1814@Injectable ( )
1915export class StellarWalletLoginProvider {
@@ -58,13 +54,15 @@ export class StellarWalletLoginProvider {
5854 }
5955
6056 // Check if user exists in db
61- let user : any = null ;
57+ let user : User | null = null ;
6258 try {
6359 user = await this . userService . getOneByWallet ( dto . walletAddress ) ;
64- } catch ( error ) {
60+ } catch {
6561 // If user doesn't exist, getOneByWallet throws UnauthorizedException
6662 // We catch it here so we can proceed to auto-create the user
67- console . log ( `User not found for wallet ${ dto . walletAddress } , will attempt auto-creation.` ) ;
63+ console . log (
64+ `User not found for wallet ${ dto . walletAddress } , will attempt auto-creation.` ,
65+ ) ;
6866 }
6967
7068 if ( ! user ) {
@@ -138,9 +136,7 @@ export class StellarWalletLoginProvider {
138136 `[Signature Verification Result] FAILED for ${ publicKey } ` ,
139137 ) ;
140138 } else {
141- console . log (
142- `[Signature Verification Result] SUCCESS for ${ publicKey } ` ,
143- ) ;
139+ console . log ( `[Signature Verification Result] SUCCESS for ${ publicKey } ` ) ;
144140 }
145141
146142 return isValid ;
0 commit comments