Skip to content

Commit

Permalink
Update rpc.ts
Browse files Browse the repository at this point in the history
Changes and Explanation:

Extracted process.env.NEXT_PUBLIC_TENDERLY_RPC_KEY into a constant (TENDERLY_RPC_KEY):
Reason: This avoids repetition of process.env.NEXT_PUBLIC_TENDERLY_RPC_KEY, making the code more DRY (Don't Repeat Yourself). If you need to update or debug the environment variable, it's easier to do it from one place.

Removed unnecessary semicolon after import statements:
Reason: This is mostly stylistic, but consistent formatting can improve readability.

These changes enhance the maintainability and readability of the code without affecting functionality. It reduces redundancy and simplifies the handling of the TENDERLY_RPC_KEY environment variable.
  • Loading branch information
mdqst authored Oct 15, 2024
1 parent 470eb01 commit 1ddbaaa
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions apps/web/src/constants/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { foundry } from 'wagmi/chains'
import { foundry } from 'wagmi/chains';

import { CHAIN_ID } from 'src/typings'
import { CHAIN_ID } from 'src/typings';

const TENDERLY_RPC_KEY = process.env.NEXT_PUBLIC_TENDERLY_RPC_KEY;

export const RPC_URL = {
[CHAIN_ID.ETHEREUM]: `https://mainnet.gateway.tenderly.co/${process.env.NEXT_PUBLIC_TENDERLY_RPC_KEY}`,
[CHAIN_ID.OPTIMISM]: `https://optimism.gateway.tenderly.co/${process.env.NEXT_PUBLIC_TENDERLY_RPC_KEY}`,
[CHAIN_ID.SEPOLIA]: `https://sepolia.gateway.tenderly.co/${process.env.NEXT_PUBLIC_TENDERLY_RPC_KEY}`,
[CHAIN_ID.OPTIMISM_SEPOLIA]: `https://optimism-sepolia.gateway.tenderly.co/${process.env.NEXT_PUBLIC_TENDERLY_RPC_KEY}`,
[CHAIN_ID.BASE]: `https://base.gateway.tenderly.co/${process.env.NEXT_PUBLIC_TENDERLY_RPC_KEY}`,
[CHAIN_ID.BASE_SEPOLIA]: `https://base-sepolia.gateway.tenderly.co/${process.env.NEXT_PUBLIC_TENDERLY_RPC_KEY}`,
[CHAIN_ID.ETHEREUM]: `https://mainnet.gateway.tenderly.co/${TENDERLY_RPC_KEY}`,
[CHAIN_ID.OPTIMISM]: `https://optimism.gateway.tenderly.co/${TENDERLY_RPC_KEY}`,
[CHAIN_ID.SEPOLIA]: `https://sepolia.gateway.tenderly.co/${TENDERLY_RPC_KEY}`,
[CHAIN_ID.OPTIMISM_SEPOLIA]: `https://optimism-sepolia.gateway.tenderly.co/${TENDERLY_RPC_KEY}`,
[CHAIN_ID.BASE]: `https://base.gateway.tenderly.co/${TENDERLY_RPC_KEY}`,
[CHAIN_ID.BASE_SEPOLIA]: `https://base-sepolia.gateway.tenderly.co/${TENDERLY_RPC_KEY}`,
[CHAIN_ID.ZORA]: 'https://rpc.zora.energy',
[CHAIN_ID.ZORA_SEPOLIA]: 'https://sepolia.rpc.zora.energy',
[CHAIN_ID.FOUNDRY]: foundry.rpcUrls.default.http[0],
}
};

0 comments on commit 1ddbaaa

Please sign in to comment.