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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate env prod vs dev keys usage #6255

Closed
wants to merge 6 commits into from
Closed
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
3 changes: 3 additions & 0 deletions .github/workflows/macstadium-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
run: |
source ~/.zshrc
git clone [email protected]:rainbow-me/rainbow-env.git
cd rainbow-env
git checkout @jin/prod-dev-env
cd ..
mv rainbow-env/dotenv .env && rm -rf rainbow-env
eval $CI_SCRIPTS

Expand Down
12 changes: 3 additions & 9 deletions globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ declare module 'react-native-dotenv' {
export const PINATA_API_SECRET: string;
export const PINATA_API_URL: string;
export const PINATA_GATEWAY_URL: string;
export const APP_CENTER_READ_ONLY_TOKEN_ANDROID: string;
export const APP_CENTER_READ_ONLY_TOKEN_IOS: string;
export const CODE_PUSH_DEPLOYMENT_KEY_ANDROID: string;
export const CODE_PUSH_DEPLOYMENT_KEY_IOS: string;
export const NFT_API_KEY: string;
export const NFT_API_URL: string;
Expand All @@ -63,12 +60,9 @@ declare module 'react-native-dotenv' {
export const ARC_GRAPHQL_API_KEY: string;
export const METADATA_GRAPHQL_API_KEY: string;
export const GRAPH_ENS_API_KEY: string;
export const RESERVOIR_API_KEY_PROD: string;
export const RESERVOIR_API_KEY_DEV: string;
export const RPC_PROXY_BASE_URL_PROD: string;
export const RPC_PROXY_BASE_URL_DEV: string;
export const RPC_PROXY_API_KEY_PROD: string;
export const RPC_PROXY_API_KEY_DEV: string;
export const RESERVOIR_API_KEY: string;
export const RPC_PROXY_BASE_URL: string;
export const RPC_PROXY_API_KEY: string;
export const REACT_NATIVE_RUDDERSTACK_WRITE_KEY: string;
export const RUDDERSTACK_DATA_PLANE_URL: string;
export const SILENCE_EMOJI_WARNINGS: boolean;
Expand Down
6 changes: 3 additions & 3 deletions src/env.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ReactNative from 'react-native';
import { ENABLE_DEV_MODE, IS_TESTING, RPC_PROXY_BASE_URL_PROD, RPC_PROXY_API_KEY_PROD } from 'react-native-dotenv';
import { ENABLE_DEV_MODE, IS_TESTING, RPC_PROXY_BASE_URL as rpcBaseUrl, RPC_PROXY_API_KEY as rpcProxyKey } from 'react-native-dotenv';

/**
* @deprecated use IS_ANDROID
Expand All @@ -21,5 +21,5 @@ export const IS_DEV = (typeof __DEV__ === 'boolean' && __DEV__) || !!Number(ENAB
export const IS_TEST = IS_TESTING === 'true';
export const IS_PROD = !IS_DEV && !IS_TEST;

export const RPC_PROXY_BASE_URL = RPC_PROXY_BASE_URL_PROD;
export const RPC_PROXY_API_KEY = RPC_PROXY_API_KEY_PROD;
export const RPC_PROXY_BASE_URL = rpcBaseUrl;
export const RPC_PROXY_API_KEY = rpcProxyKey;
5 changes: 2 additions & 3 deletions src/resources/nfts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { gretch } from 'gretchen';
import { paths } from '@reservoir0x/reservoir-sdk';
import { RainbowError, logger } from '@/logger';
import { handleSignificantDecimals } from '@/helpers/utilities';
import { IS_PROD } from '@/env';
import { RESERVOIR_API_KEY_DEV, RESERVOIR_API_KEY_PROD } from 'react-native-dotenv';
import { RESERVOIR_API_KEY } from 'react-native-dotenv';
import { Network } from '@/chains/types';

const SUPPORTED_NETWORKS = [Network.mainnet, Network.polygon, Network.bsc, Network.arbitrum, Network.optimism, Network.base, Network.zora];
Expand All @@ -27,7 +26,7 @@ export async function fetchReservoirNFTFloorPrice(nft: UniqueAsset): Promise<str
{
method: 'GET',
headers: {
'x-api-key': IS_PROD ? RESERVOIR_API_KEY_PROD : RESERVOIR_API_KEY_DEV,
'x-api-key': RESERVOIR_API_KEY,
},
}
).json();
Expand Down
4 changes: 1 addition & 3 deletions src/resources/reservoir/client.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { createClient } from '@reservoir0x/reservoir-sdk';
import { IS_PROD } from '@/env';
import { RESERVOIR_API_KEY_PROD, RESERVOIR_API_KEY_DEV } from 'react-native-dotenv';
import { RESERVOIR_API_KEY } from 'react-native-dotenv';
import { ChainId, Network } from '@/chains/types';

const RESERVOIR_API_KEY = IS_PROD ? RESERVOIR_API_KEY_PROD : RESERVOIR_API_KEY_DEV;

export function initializeReservoirClient() {
createClient({
chains: [
Expand Down
7 changes: 0 additions & 7 deletions src/utils/checkTokenIsScam.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export { default as abbreviations } from './abbreviations';
export { default as addressUtils } from './address';
export { default as AllowancesCache } from './allowancesCache';
export { default as TokensListenedCache } from './tokensListenedCache';
export { default as checkTokenIsScam } from './checkTokenIsScam';
export { default as contenthash } from './contenthash';
export { default as deviceUtils } from './deviceUtils';
export { default as profileUtils } from './profileUtils';
Expand Down
Loading