Skip to content

Commit

Permalink
Save non-evm user wallet address capitalization
Browse files Browse the repository at this point in the history
  • Loading branch information
aminlatifi committed Dec 11, 2023
1 parent 140ce66 commit f8b3b5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/repositories/userRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { SegmentAnalyticsSingleton } from '../services/segment/segmentAnalyticsS
import { Donation } from '../entities/donation';
import { Reaction } from '../entities/reaction';
import { PowerBoosting } from '../entities/powerBoosting';
import { ethers } from 'ethers';

export const findAdminUserByEmail = async (
email: string,
Expand Down Expand Up @@ -69,10 +70,13 @@ export const findAllUsers = async (params: {
};

export const createUserWithPublicAddress = async (
walletAddress: string,
_walletAddress: string,
): Promise<User> => {
const walletAddress = ethers.utils.isAddress(_walletAddress)
? _walletAddress.toLocaleLowerCase()
: _walletAddress;
const user = await User.create({
walletAddress: walletAddress.toLowerCase(),
walletAddress,
loginType: 'wallet',
segmentIdentified: true,
}).save();
Expand Down
2 changes: 1 addition & 1 deletion src/services/authorizationServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const validateAuthMicroserviceJwt = async (
},
);

const userAddress = result.data.publicAddress.toLowerCase();
const userAddress = result.data.publicAddress;
user = await findUserByWalletAddress(userAddress);

if (!user) {
Expand Down

0 comments on commit f8b3b5f

Please sign in to comment.