From f8b3b5fc17b0dd66eeeff0649587c2a42a952461 Mon Sep 17 00:00:00 2001 From: Amin Latifi Date: Mon, 11 Dec 2023 17:07:51 +0330 Subject: [PATCH 1/3] Save non-evm user wallet address capitalization --- src/repositories/userRepository.ts | 8 ++++++-- src/services/authorizationServices.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/repositories/userRepository.ts b/src/repositories/userRepository.ts index 7e074598e..93c553b36 100644 --- a/src/repositories/userRepository.ts +++ b/src/repositories/userRepository.ts @@ -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, @@ -69,10 +70,13 @@ export const findAllUsers = async (params: { }; export const createUserWithPublicAddress = async ( - walletAddress: string, + _walletAddress: string, ): Promise => { + const walletAddress = ethers.utils.isAddress(_walletAddress) + ? _walletAddress.toLocaleLowerCase() + : _walletAddress; const user = await User.create({ - walletAddress: walletAddress.toLowerCase(), + walletAddress, loginType: 'wallet', segmentIdentified: true, }).save(); diff --git a/src/services/authorizationServices.ts b/src/services/authorizationServices.ts index 1f765ae82..49fac286d 100644 --- a/src/services/authorizationServices.ts +++ b/src/services/authorizationServices.ts @@ -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) { From b047833b304c2a63508508113856500163bf6f29 Mon Sep 17 00:00:00 2001 From: Amin Latifi Date: Mon, 11 Dec 2023 19:17:15 +0330 Subject: [PATCH 2/3] Updated the authentication service related address in test.env --- config/test.env | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/test.env b/config/test.env index 75a9454ea..d1c6a5540 100644 --- a/config/test.env +++ b/config/test.env @@ -83,9 +83,9 @@ TRACE_FILE_UPLOADER_PASSWORD=hello_trace API_GIV_PASSWORD=123 API_GIV_USERNAME=testApiGive -AUTH_MICROSERVICE_AUTHENTICATION_URL=https://serve.giveth.io/siweauthmicroservice/v1/authentication -AUTH_MICROSERVICE_AUTHORIZATION_URL=https://serve.giveth.io/siweauthmicroservice/v1/authorization -AUTH_MICROSERVICE_NONCE_URL=https://serve.giveth.io/siweauthmicroservice/v1/nonce +AUTH_MICROSERVICE_AUTHENTICATION_URL=https://mainnet.serve.giveth.io/siweauthmicroservice/v1/authentication +AUTH_MICROSERVICE_AUTHORIZATION_URL=https://mainnet.serve.giveth.io/siweauthmicroservice/v1/authorization +AUTH_MICROSERVICE_NONCE_URL=https://mainnet.serve.giveth.io/siweauthmicroservice/v1/nonce PRIVATE_ETHERS_TEST_KEY=8ab0e165c2ea461b01cdd49aec882d179dccdbdb5c85c3f9c94c448aa65c5ace PUBLIC_ETHERS_TEST_KEY=0x53bFf74b9Af2E3853f758A8D2Bd61CD115d27782 From 8e5a6189ff086524ca444349a07984fc5f50c1ca Mon Sep 17 00:00:00 2001 From: Amin Latifi Date: Mon, 11 Dec 2023 21:37:14 +0330 Subject: [PATCH 3/3] updated auth server in test env --- config/test.env | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/test.env b/config/test.env index d1c6a5540..e310c783c 100644 --- a/config/test.env +++ b/config/test.env @@ -83,9 +83,9 @@ TRACE_FILE_UPLOADER_PASSWORD=hello_trace API_GIV_PASSWORD=123 API_GIV_USERNAME=testApiGive -AUTH_MICROSERVICE_AUTHENTICATION_URL=https://mainnet.serve.giveth.io/siweauthmicroservice/v1/authentication -AUTH_MICROSERVICE_AUTHORIZATION_URL=https://mainnet.serve.giveth.io/siweauthmicroservice/v1/authorization -AUTH_MICROSERVICE_NONCE_URL=https://mainnet.serve.giveth.io/siweauthmicroservice/v1/nonce +AUTH_MICROSERVICE_AUTHENTICATION_URL=https://auth.serve.giveth.io/v1/authentication +AUTH_MICROSERVICE_AUTHORIZATION_URL=https://auth.serve.giveth.io/v1/authorization +AUTH_MICROSERVICE_NONCE_URL=https://auth.serve.giveth.io/v1/nonce PRIVATE_ETHERS_TEST_KEY=8ab0e165c2ea461b01cdd49aec882d179dccdbdb5c85c3f9c94c448aa65c5ace PUBLIC_ETHERS_TEST_KEY=0x53bFf74b9Af2E3853f758A8D2Bd61CD115d27782