Skip to content

Commit

Permalink
Add support for Alchemy RPC (#663)
Browse files Browse the repository at this point in the history
Resolves #653

### What

Add Alchemy RPC as a main RPC for the dapp if API key is available.
When there is no key we fallback to the public RPC endpoint.

Netlify setup - Alchemy will be supported on:
- production
- stage-live
  • Loading branch information
xpaczka authored Nov 9, 2023
2 parents d790696 + d83cb37 commit 04bd989
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ UNS_API_KEY="4a77c949-511b-4c16-9862-6edfb6ae6012"
FILE_DIRECTORY_IPFS_HASH="QmYwYkRdYMBCtMqbimgaXjf7UL4RUb5zBQu4TDE67oZbq5"
PART_GLOSSARY_IPFS_HASH="bafybeibytsozn7qsvqgecogv5urg5en34r7v3zxo326vacumi56ckah5b4"
# RPC URLs
ARBITRUM_SEPOLIA_ALCHEMY_KEY=""
ARBITRUM_RPC_URL="https://sepolia-rollup.arbitrum.io/rpc"
ARBITRUM_RPC_FALLBACK_URL="https://arbitrum-sepolia.blockpi.network/v1/rpc/public"
TENDERLY_RPC_URL="https://rpc.tenderly.co/fork/2fc2cf12-5c58-439f-9b5e-967bfd02191a"
Expand Down
3 changes: 3 additions & 0 deletions src/shared/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export const getArbitrumRpcUrl = () => {
}

if (process.env.USE_ARBITRUM_SEPOLIA === "true") {
if (process.env.ARBITRUM_SEPOLIA_ALCHEMY_KEY) {
return `https://arb-sepolia.g.alchemy.com/v2/${process.env.ARBITRUM_SEPOLIA_ALCHEMY_KEY}`
}
return process.env.ARBITRUM_RPC_URL
}

Expand Down

0 comments on commit 04bd989

Please sign in to comment.