From 2f4987f49165bdece9e5db16d2c2c348fe230a4c Mon Sep 17 00:00:00 2001 From: dan13ram Date: Fri, 12 Mar 2021 21:33:50 +0530 Subject: [PATCH] Revert ethereum address lowercase (#407) * Revert "add if not null check to ethereum address (#406)" This reverts commit c6364bd4f6a9f3037a19b62b721dd0d451989ace. * Revert "make ethereum_address lowercase in backend (#405)" This reverts commit 3cee60e30de8e88f63a411825b5eb80986fbfd4b. --- .../1615534737144_lowercase_player_ethereum_address/up.sql | 1 - .../down.sql | 1 - .../up.sql | 1 - .../src/handlers/actions/migrateSourceCredAccounts/handler.ts | 2 +- packages/backend/src/handlers/auth-webhook/users.ts | 3 +-- 5 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 hasura/migrations/1615534737144_lowercase_player_ethereum_address/up.sql delete mode 100644 hasura/migrations/1615534770163_alter_table_public_player_add_check_constraint_ethereum_address_is_valid/down.sql delete mode 100644 hasura/migrations/1615534770163_alter_table_public_player_add_check_constraint_ethereum_address_is_valid/up.sql diff --git a/hasura/migrations/1615534737144_lowercase_player_ethereum_address/up.sql b/hasura/migrations/1615534737144_lowercase_player_ethereum_address/up.sql deleted file mode 100644 index c4927652..00000000 --- a/hasura/migrations/1615534737144_lowercase_player_ethereum_address/up.sql +++ /dev/null @@ -1 +0,0 @@ -UPDATE player SET ethereum_address=lower(ethereum_address) WHERE ethereum_address IS NOT NULL; diff --git a/hasura/migrations/1615534770163_alter_table_public_player_add_check_constraint_ethereum_address_is_valid/down.sql b/hasura/migrations/1615534770163_alter_table_public_player_add_check_constraint_ethereum_address_is_valid/down.sql deleted file mode 100644 index 1cfb1c26..00000000 --- a/hasura/migrations/1615534770163_alter_table_public_player_add_check_constraint_ethereum_address_is_valid/down.sql +++ /dev/null @@ -1 +0,0 @@ -alter table "public"."player" drop constraint "ethereum_address_is_valid"; diff --git a/hasura/migrations/1615534770163_alter_table_public_player_add_check_constraint_ethereum_address_is_valid/up.sql b/hasura/migrations/1615534770163_alter_table_public_player_add_check_constraint_ethereum_address_is_valid/up.sql deleted file mode 100644 index 05881be4..00000000 --- a/hasura/migrations/1615534770163_alter_table_public_player_add_check_constraint_ethereum_address_is_valid/up.sql +++ /dev/null @@ -1 +0,0 @@ -alter table "public"."player" add constraint "ethereum_address_is_valid" check (ethereum_address ~* '^0x([a-z0-9-]{40})$'::text); diff --git a/packages/backend/src/handlers/actions/migrateSourceCredAccounts/handler.ts b/packages/backend/src/handlers/actions/migrateSourceCredAccounts/handler.ts index 894fd41d..2754e8f5 100644 --- a/packages/backend/src/handlers/actions/migrateSourceCredAccounts/handler.ts +++ b/packages/backend/src/handlers/actions/migrateSourceCredAccounts/handler.ts @@ -108,7 +108,7 @@ export const migrateSourceCredAccounts = async ( const rank = computeRank(index); return { - ethereum_address: addressEntry && addressEntry.address.toLowerCase(), + ethereum_address: addressEntry && addressEntry.address, scIdentityId: a.account.identity.id, username: a.account.identity.name.toLowerCase(), totalXp: a.totalCred, diff --git a/packages/backend/src/handlers/auth-webhook/users.ts b/packages/backend/src/handlers/auth-webhook/users.ts index b35a72fd..4eefa189 100644 --- a/packages/backend/src/handlers/auth-webhook/users.ts +++ b/packages/backend/src/handlers/auth-webhook/users.ts @@ -11,8 +11,7 @@ async function createPlayer(ethAddress: string) { return resProfile.insert_player.returning[0]; } -export async function getOrCreatePlayer(ethereumAddress: string) { - const ethAddress = ethereumAddress.toLowerCase(); +export async function getOrCreatePlayer(ethAddress: string) { const res = await client.GetPlayerFromETH({ ethereum_address: ethAddress, });