Skip to content

Conversation

Riateche
Copy link
Contributor

@Riateche Riateche commented Sep 9, 2025

Summary

  • rename PythLazerClient to PythLazerStreamClient
  • add history client for fetching symbols

I wasn't sure what would be the most convenient API for fetching symbol updates, so I added a few different methods:

  • all_symbols_metadata - fetches only once.
  • all_symbols_metadata_handle - returns an ArcSwap that will be continuously updated in background. Convenient for migrating old code, but there is no way to get a notification when something changed.
  • all_symbols_metadata_fault_tolerant_handle - same as above, but returns an empty value if the initial fetch failed. Useful for relayer: while it needs symbols for some things, it can still work without them.
  • all_symbols_metadata_stream - the most flexible option: get a receiver that receives new symbols.

There is also a caching feature: to avoid hard dependency on history service, we can store last known symbols locally and fetch them on startup.

Rationale

To remove symbols.toml and use symbols for the state-aware history service.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Tested in tilt.

@Riateche Riateche requested a review from darunrs as a code owner September 9, 2025 14:19
Copy link

vercel bot commented Sep 9, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
api-reference Ready Ready Preview Comment Sep 10, 2025 10:02am
component-library Ready Ready Preview Comment Sep 10, 2025 10:02am
developer-hub Ready Ready Preview Comment Sep 10, 2025 10:02am
entropy-explorer Ready Ready Preview Comment Sep 10, 2025 10:02am
insights Ready Ready Preview Comment Sep 10, 2025 10:02am
proposals Ready Ready Preview Comment Sep 10, 2025 10:02am
staking Ready Ready Preview Comment Sep 10, 2025 10:02am

@Riateche Riateche changed the title Add lazer api client feat(lazer): add history api client Sep 9, 2025
@Riateche Riateche changed the title feat(lazer): add history api client feat(lazer): add history api client for symbols Sep 9, 2025
/// immediately from the returned receiver.
/// You should continuously poll the receiver to receive updates.
///
/// Panics if the buffer capacity is 0.
Copy link
Contributor

Choose a reason for hiding this comment

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

since we are returning a Result let's return Err instead of panicing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

println!("feeds len: {}", feeds.symbols().len());
println!("feed 1: {:?}", feeds.symbols().get(&PriceFeedId(1)));
sleep(Duration::from_secs(15)).await;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

would be nice to have an example for stream too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants