Skip to content

Commit

Permalink
use proxy prod
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanmino committed Sep 3, 2024
1 parent f0e2584 commit ba56b4d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
13 changes: 3 additions & 10 deletions src/env.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import ReactNative from 'react-native';
import {
ENABLE_DEV_MODE,
IS_TESTING,
RPC_PROXY_BASE_URL_PROD,
RPC_PROXY_BASE_URL_DEV,
RPC_PROXY_API_KEY_PROD,
RPC_PROXY_API_KEY_DEV,
} from 'react-native-dotenv';
import { ENABLE_DEV_MODE, IS_TESTING, RPC_PROXY_BASE_URL_PROD, RPC_PROXY_API_KEY_PROD } from 'react-native-dotenv';

/**
* @deprecated use IS_ANDROID
Expand All @@ -28,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 = IS_PROD ? RPC_PROXY_BASE_URL_PROD : RPC_PROXY_BASE_URL_DEV;
export const RPC_PROXY_API_KEY = IS_PROD ? RPC_PROXY_API_KEY_PROD : RPC_PROXY_API_KEY_DEV;
export const RPC_PROXY_BASE_URL = RPC_PROXY_BASE_URL_PROD;
export const RPC_PROXY_API_KEY = RPC_PROXY_API_KEY_PROD;
1 change: 0 additions & 1 deletion src/handlers/web3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ export const getProvider = ({ chainId = ChainId.mainnet }: { chainId?: number })
if (cachedProvider && cachedProvider?.connection.url === providerUrl) {
return cachedProvider;
}

const provider = new StaticJsonRpcProvider(providerUrl, chainId);
chainsProviders.set(chainId, provider);

Expand Down
3 changes: 2 additions & 1 deletion src/networks/utils/backendNetworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { Chain } from 'viem';
import { mainnet } from 'viem/chains';

import { BackendNetwork } from '../types/chains';
import { RPC_PROXY_API_KEY } from '@/env';

const proxyBackendNetworkRpcEndpoint = (endpoint: string) => {
return `${endpoint}${process.env.RPC_PROXY_API_KEY}`;
return `${endpoint}${RPC_PROXY_API_KEY}`;
};

export function transformBackendNetworkToChain(network: BackendNetwork): Chain {
Expand Down

0 comments on commit ba56b4d

Please sign in to comment.