Skip to content

chore(api-reference) Add Contract Manager Support #2785

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
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])];
Comment on lines +25 to +26
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