diff --git a/lib/backend/src/auth/auth.ts b/lib/backend/src/auth/auth.ts index 314682253..010e59f40 100644 --- a/lib/backend/src/auth/auth.ts +++ b/lib/backend/src/auth/auth.ts @@ -2,8 +2,7 @@ import { baseAuthConfig } from '@echo/backend/auth/auth-config' import { fetchDiscordAccessToken } from '@echo/backend/auth/discord/fetch-discord-access-token' import { fetchDiscordProfile } from '@echo/backend/auth/discord/fetch-discord-profile' import { revokeDiscordAccessToken } from '@echo/backend/auth/discord/revoke-discord-access-token' -import { isUserWhitelisted } from '@echo/backend/helpers/is-user-whitelisted' -import { error, info } from '@echo/backend/helpers/logger' +import { error } from '@echo/backend/helpers/logger' import { credentialsSchema } from '@echo/backend/validators/credentials-schema' import { userDocumentToModel } from '@echo/firestore/converters/user-document-to-model' import { addUser } from '@echo/firestore/crud/user/add-user' @@ -40,11 +39,6 @@ const { return null } const wallet = addressSchema.parse(address) - const isWhitelisted = await isUserWhitelisted(wallet) - if (!isWhitelisted) { - info({ wallet }, 'user is not whitelisted') - return null - } if (isNil(code)) { await initializeFirestore() const user = await getUserByWallet(wallet) diff --git a/lib/backend/src/constants/wl-contracts.ts b/lib/backend/src/constants/wl-contracts.ts deleted file mode 100644 index 6e3545997..000000000 --- a/lib/backend/src/constants/wl-contracts.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Address } from '@echo/model/types/address' - -export const wlContracts: Address[] = [ - '0xc29edb70e8ba8a317b8e47894a541f6045098d6e', - '0x025776f8aec3f445a64fea642cd7776302157815', - '0xe2a4b63ee2bbd0cab0b9ed3d63827ef5e7df6629', - '0x992bb733cfe979de656b84b6e024f0fd463b6418', - '0x15a3becf516d9dcf4b9859ae3ac07d0fc400fc53' -] diff --git a/lib/backend/src/helpers/is-user-whitelisted.ts b/lib/backend/src/helpers/is-user-whitelisted.ts deleted file mode 100644 index 2a81edc08..000000000 --- a/lib/backend/src/helpers/is-user-whitelisted.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { wlContracts } from '@echo/backend/constants/wl-contracts' -import type { Address } from '@echo/model/types/address' -import type { Collection } from '@echo/model/types/collection' -import { getCollectionsByWallet } from '@echo/nft-scan/services/get-collections-by-wallet' -import type { FetchCollectionResponse } from '@echo/nft-scan/types/response/fetch-collection-response' -import { Environment, environment } from '@echo/utils/constants/environment' -import { isIn } from '@echo/utils/helpers/is-in' -import type { Nullable } from '@echo/utils/types/nullable' -import { always, andThen, filter, isNil, isNotEmpty, map, otherwise, pipe, prop, reject } from 'ramda' - -export async function isUserWhitelisted(address: Address): Promise { - if (environment() === Environment.Development) { - return true - } - const collections = await pipe( - getCollectionsByWallet, - andThen( - pipe<[FetchCollectionResponse[]], Nullable[], Collection[]>( - map>(prop('collection')), - reject(isNil) - ) - ), - otherwise(always([] as Collection[])) - )(address) - - return pipe<[Collection[]], Address[], Address[], boolean>( - map(prop('contract')), - filter(isIn(wlContracts)), - isNotEmpty - )(collections) -}