Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: constants #2929

Merged
merged 4 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading