-
Notifications
You must be signed in to change notification settings - Fork 88
feat(networks): add fresh price feed fetcher to network modules #853
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
feat(networks): add fresh price feed fetcher to network modules #853
Conversation
- Introduced `getFreshPriceFeedInfo` method to fetch price feed data independently of state refresh across various network environments (naga-dev, naga-local, naga-staging, naga-test). - Updated multi-endpoint processor to utilize the new `LitClientType` for better type safety. - Enhanced the `createLitClient` function to include a fresh price feed info fetcher.
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.
Pull Request Overview
This PR adds fresh price feed fetching functionality to all vNaga network modules (staging, dev, test, local) and exposes it through the Lit client API. The new feature allows fetching latest node prices directly from the PriceFeed contract via RPC without requiring state reinitialization or handshake.
- Added
getFreshPriceFeedInfo()method to all four vNaga network modules - Exposed the functionality through
litClient.getContext().getFreshPriceFeedInfo() - Added type import for
LitClientTypein Artillery test processor
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| naga-test.module.ts | Adds getFreshPriceFeedInfo method with contract manager and API integration |
| naga-staging.module.ts | Adds getFreshPriceFeedInfo method with contract manager and API integration |
| naga-local.module.ts | Adds getFreshPriceFeedInfo method with contract manager and API integration |
| naga-dev.module.ts | Adds getFreshPriceFeedInfo method with contract manager and API integration |
| createLitClient.ts | Exposes getFreshPriceFeedInfo through the Lit client context |
| multi-endpoints.ts | Updates type imports and variable declarations for Artillery test processor |
|
|
||
| // Global variables to cache expensive operations | ||
| let litClient: any = null; | ||
| let litClient: LitClientType; |
Copilot
AI
Aug 8, 2025
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.
The variable litClient is declared without initialization but the original code had null as the initial value. This could cause TypeScript errors or runtime issues when the variable is accessed before being assigned. Consider initializing it as let litClient: LitClientType | null = null;
| let litClient: LitClientType; | |
| let litClient: LitClientType | null = null; |
| authContext: authContext, | ||
| pubKey: state.masterAccount.pkp.publicKey, | ||
| toSign: `Hello from Artillery! ${Date.now()}`, // Unique message per request | ||
| // userMaxPrice: await litClient |
Copilot
AI
Aug 8, 2025
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.
This commented-out code appears to be incomplete and should either be removed or completed. Leaving incomplete commented code can confuse future developers about the intended functionality.
| // userMaxPrice: await litClient |
|
Not sure what happened here, it looks like this was 1 commit to add some code, then a follow-up commit that reverted the first commit, which should make this a zero-change-PR that wouldn't even make sense to merge -- but then what was merged appears to actually still have the changed code in it 😕 |
Hmm not sure what happened but this PR was supposed to be "Closed" not "merged". The changes did not make it into the |
WHAT
getFreshPriceFeedInfo()to vNaga modules (naga-staging,naga-dev,naga-test,naga-local) to fetch the latest sorted node prices directly from the PriceFeed contract (RPC), without reinitialising state/handshake.litClient.getContext().getFreshPriceFeedInfo()increateLitClient.ts.latestConnectionInfoby default; cheapest‑N selection remains unchanged. This new method enables callers (e.g. Artillery) to fetch fresh prices just before requests when needed.