Skip to content

Commit

Permalink
refactor: constants (#2929)
Browse files Browse the repository at this point in the history
* chore: remove SIMPLEANALYTICS_API_ENDPOINT constant

* chore: remove SIMPLEANALYTICS_API constant

* chore: rename STS_GENERATOR_WORKER_URL constant

* chore: default getEnvConfig to mainnet
  • Loading branch information
bigint committed May 22, 2023
1 parent 0bd1762 commit af6d53f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
2 changes: 0 additions & 2 deletions apps/web/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ export const POLYGON_MUMBAI = {
rpcUrls: { default: 'https://rpc-mumbai.maticvigil.com' }
};
export const CHAIN_ID = IS_MAINNET ? POLYGON_MAINNET.id : POLYGON_MUMBAI.id;
export const SIMPLEANALYTICS_API_ENDPOINT =
'https://simpleanalytics.com/lenster.xyz.json';
4 changes: 2 additions & 2 deletions apps/web/src/lib/uploadToIPFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { S3 } from '@aws-sdk/client-s3';
import { ThirdwebStorage } from '@thirdweb-dev/storage';
import axios from 'axios';
import { KillSwitch } from 'data';
import { EVER_API, S3_BUCKET, STS_TOKEN_URL } from 'data/constants';
import { EVER_API, S3_BUCKET, STS_GENERATOR_WORKER_URL } from 'data/constants';
import type { MediaSet } from 'lens';
import { v4 as uuid } from 'uuid';

Expand All @@ -16,7 +16,7 @@ const FALLBACK_TYPE = 'image/jpeg';
* @returns S3 client instance.
*/
const getS3Client = async (): Promise<S3> => {
const token = await axios.get(STS_TOKEN_URL);
const token = await axios.get(STS_GENERATOR_WORKER_URL);
const client = new S3({
endpoint: EVER_API,
credentials: {
Expand Down
8 changes: 3 additions & 5 deletions packages/data/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import getEnvConfig from './utils/getEnvConfig';

// Environments
export const IS_PRODUCTION = process.env.NEXT_PUBLIC_IS_PRODUCTION === 'true';
export const IS_PREVIEW = process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview';

// Lens Network
export const LENS_NETWORK = process.env.NEXT_PUBLIC_LENS_NETWORK ?? 'mainnet';
Expand Down Expand Up @@ -44,6 +43,7 @@ export const GIT_COMMIT_SHA =
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
export const LENSPROTOCOL_HANDLE = 'lensprotocol';
export const HANDLE_SUFFIX = IS_MAINNET ? '.lens' : '.test';
// TODO: Remove this once everyone has migrated to the new Lens relayer
export const OLD_LENS_RELAYER_ADDRESS =
'0xD1FecCF6881970105dfb2b654054174007f0e07E';

Expand All @@ -63,14 +63,12 @@ export const RARIBLE_URL = IS_MAINNET
export const IPFS_GATEWAY = 'https://gateway.ipfscdn.io/ipfs/';
export const ARWEAVE_GATEWAY = 'https://arweave.net/';
export const EVER_API = 'https://endpoint.4everland.co';
export const SIMPLEANALYTICS_API =
'https://simpleanalytics.com/lenster.xyz.json';
export const DEFAULT_OG = `${STATIC_IMAGES_URL}/og/logo.jpeg`;
export const IFRAMELY_URL = 'https://iframely.lenster.xyz/iframely';

// Workers
export const USER_CONTENT_URL = 'https://user-content.lenster.xyz';
export const STS_TOKEN_URL = IS_PRODUCTION
export const STS_GENERATOR_WORKER_URL = IS_PRODUCTION
? 'https://sts.lenster.xyz'
: 'http://localhost:8082';
export const METADATA_WORKER_URL = IS_PRODUCTION
Expand Down Expand Up @@ -141,7 +139,7 @@ export const ALLOWED_MEDIA_TYPES = [
export const MESSAGE_PAGE_LIMIT = 15;
export const MIN_WIDTH_DESKTOP = 1024;

// Named transforms
// Named transforms for ImageKit
export const AVATAR = '300x300';
export const COVER = '1500x500';
export const ATTACHMENT = '1000,fit';
Expand Down
8 changes: 0 additions & 8 deletions packages/data/utils/getEnvConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ const getEnvConfig = (): {
litProtocolEnvironment: string;
} => {
switch (LENS_NETWORK) {
case 'mainnet':
return {
apiEndpoint: LensEndpoint.Mainnet,
lensHubProxyAddress: MainnetContracts.LensHubProxy,
lensPeripheryAddress: MainnetContracts.LensPeriphery,
defaultCollectToken: MainnetContracts.DefaultToken,
litProtocolEnvironment: 'polygon'
};
case 'testnet':
return {
apiEndpoint: LensEndpoint.Testnet,
Expand Down
4 changes: 2 additions & 2 deletions tests/packages/lib/imageProxy.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from '@playwright/test';
import { AVATAR, STATIC_ASSETS_URL, USER_CONTENT_URL } from 'data/constants';
import { AVATAR, STATIC_IMAGES_URL, USER_CONTENT_URL } from 'data/constants';
import imageProxy from 'lib/imageProxy';

test.describe('imageProxy', () => {
Expand All @@ -9,7 +9,7 @@ test.describe('imageProxy', () => {
});

test('should return the same url if it includes static-assets.lenster.xyz', () => {
const url = `${STATIC_ASSETS_URL}/images/placeholder.webp`;
const url = `${STATIC_IMAGES_URL}/placeholder.webp`;
const result = imageProxy(url);
expect(result).toEqual(url);
});
Expand Down

2 comments on commit af6d53f

@vercel
Copy link

@vercel vercel bot commented on af6d53f May 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

prerender – ./apps/prerender

prerender-git-main-lenster.vercel.app
prerender.lenster.xyz
prerender-lenster.vercel.app

@vercel
Copy link

@vercel vercel bot commented on af6d53f May 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web – ./apps/web

lenster.vercel.app
web-git-main-lenster.vercel.app
web-lenster.vercel.app
lenster.xyz

Please sign in to comment.