Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions apps/api-reference/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@heroicons/react": "catalog:",
"@next/third-parties": "catalog:",
"@pythnetwork/client": "catalog:",
"@pythnetwork/contract-manager": "workspace:*",
"@pythnetwork/pyth-sdk-solidity": "workspace:*",
"@solana/web3.js": "catalog:",
"@tanstack/react-query": "catalog:",
Expand Down
8 changes: 5 additions & 3 deletions apps/api-reference/src/components/EvmProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ const CHAINS = NETWORK_IDS.map((id) =>

const TRANSPORTS = Object.fromEntries(
CHAINS.map((chain) => {
const url = getRpcUrl(chain.id);
if (url) {
return [chain.id, http(url)];
const rpcUrl = getRpcUrl(chain.id);
if (rpcUrl) {
return [chain.id, http(rpcUrl)];
} else if (chain.rpcUrls.default.http[0]) {
return [chain.id, http(chain.rpcUrls.default.http[0])];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic should live in getRpcUrl -- it doesn't make sense that we have a function that should get the rpc URL which only sometimes returns the RPC url and other times there is still a valid URL but the consumer needs to know about different logic to retrieve it.

} else {
throw new Error(`No rpc url found for ${chain.name}`);
}
Expand Down
Loading
Loading