Skip to content

Conversation

@Ansonhkg
Copy link
Collaborator

@Ansonhkg Ansonhkg commented Aug 8, 2025

WHAT

  • Added 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.
  • Exposed the above via litClient.getContext().getFreshPriceFeedInfo() in createLitClient.ts.
  • No behavioural change to existing calls: SDK still uses cached latestConnectionInfo by default; cheapest‑N selection remains unchanged. This new method enables callers (e.g. Artillery) to fetch fresh prices just before requests when needed.

- 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.
Copy link
Contributor

Copilot AI left a 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 LitClientType in 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;
Copy link

Copilot AI Aug 8, 2025

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;

Suggested change
let litClient: LitClientType;
let litClient: LitClientType | null = null;

Copilot uses AI. Check for mistakes.
authContext: authContext,
pubKey: state.masterAccount.pkp.publicKey,
toSign: `Hello from Artillery! ${Date.now()}`, // Unique message per request
// userMaxPrice: await litClient
Copy link

Copilot AI Aug 8, 2025

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.

Suggested change
// userMaxPrice: await litClient

Copilot uses AI. Check for mistakes.
@Ansonhkg Ansonhkg merged commit 54b0bdc into feat/naga-dev-29-05-2025-v2 Aug 11, 2025
1 of 4 checks passed
@Ansonhkg Ansonhkg deleted the feature/jss-28-feature-expose-a-helper-function-to-get-latest-pricing branch August 11, 2025 17:31
@MaximusHaximus
Copy link
Contributor

MaximusHaximus commented Aug 13, 2025

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 😕

@Ansonhkg
Copy link
Collaborator Author

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 naga branch though as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants