-
Notifications
You must be signed in to change notification settings - Fork 90
refactor: replace with_indexer with photon_url in LightClientConfig
#1814
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
Changes from all commits
293b4af
69c1204
34b60b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,21 +110,8 @@ impl LightClient { | |
| let client = RpcClient::new_with_commitment(config.url.to_string(), commitment_config); | ||
| let retry_config = retry_config.unwrap_or_default(); | ||
|
|
||
| let indexer = if config.with_indexer { | ||
| if config.url == RpcUrl::Localnet.to_string() { | ||
| Some(PhotonIndexer::new( | ||
| "http://127.0.0.1:8784".to_string(), | ||
| None, | ||
| )) | ||
| } else { | ||
| Some(PhotonIndexer::new( | ||
| config.url.to_string(), | ||
| None, // TODO: test that this is not required | ||
| )) | ||
| } | ||
| } else { | ||
| None | ||
| }; | ||
| let indexer = config.photon_url.map(|path| PhotonIndexer::new(path, None)); | ||
|
|
||
| let mut new = Self { | ||
|
Comment on lines
111
to
115
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Photon API key silently dropped
- let indexer = config.photon_url.map(|path| PhotonIndexer::new(path, None));
+ // Propagate the optional API key once LightClientConfig is extended
+ let indexer = config
+ .photon_url
+ .as_ref()
+ .map(|path| PhotonIndexer::new(path.clone(), config.photon_api_key.clone()));This will need:
🤖 Prompt for AI Agents |
||
| client, | ||
| payer, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Use configured
photon_urland avoid panic on LightClient buildThe
ForesterConfigalready carriesexternal_services.photon_url; passingNonedisables the indexer even when the user enabled it in the config. At the same time,unwrap()will abort the status command on any RPC hiccup.This preserves the new configuration surface and improves robustness.
📝 Committable suggestion
🤖 Prompt for AI Agents