Skip to content
Merged
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
5 changes: 3 additions & 2 deletions e2e/artillery/src/processors/multi-endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createAuthManager, storagePlugins } from "@lit-protocol/auth";
import { createLitClient } from "@lit-protocol/lit-client";
import { createLitClient, LitClientType } from "@lit-protocol/lit-client";
import { z } from "zod";
import * as StateManager from "../StateManager";
import * as NetworkManager from "../../../src/helper/NetworkManager";
Expand All @@ -16,7 +16,7 @@ const PkpSignResultSchema = z.object({
});

// 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.
let authManager: any = null;
let masterAccountAuthContext: any = null;
let networkModule: any = null;
Expand Down Expand Up @@ -113,6 +113,7 @@ export async function runPkpSignTest() {
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.
});

// Validate the result using Zod schema
Expand Down
3 changes: 3 additions & 0 deletions packages/lit-client/src/lib/LitClient/createLitClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,9 @@ export const _createNagaLitClient = async (
handshakeResult: _stateManager.getCallbackResult(),
getMaxPricesForNodeProduct: networkModule.getMaxPricesForNodeProduct,
getUserMaxPrice: networkModule.getUserMaxPrice,
getFreshPriceFeedInfo: async () => {
return await networkModule.getFreshPriceFeedInfo();
},
signSessionKey: _signSessionKey,
signCustomSessionKey: _signCustomSessionKey,
executeJs: _executeJs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ import {
} from './chain-manager/createChainManager';
import { getMaxPricesForNodeProduct } from './pricing-manager/getMaxPricesForNodeProduct';
import { getUserMaxPrice } from './pricing-manager/getUserMaxPrice';
import { getPriceFeedInfo } from '../../LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi';
import { createReadOnlyContractsManager } from '../../LitChainClient/contract-manager/createContractsManager';

const MODULE_NAME = 'naga-dev';

Expand Down Expand Up @@ -323,6 +325,19 @@ const networkModuleObject = {
});
},

// Expose a fresh price feed fetcher (chain read; independent of state refresh)
getFreshPriceFeedInfo: async () => {
const { walletClient } = createReadOnlyContractsManager(networkConfig);
const realmId = Number(networkConfig.networkSpecificConfigs?.realmId ?? 1);
return await getPriceFeedInfo(
{
realmId,
networkCtx: networkConfig as any,
},
walletClient
);
},

getMaxPricesForNodeProduct: getMaxPricesForNodeProduct,
getUserMaxPrice: getUserMaxPrice,
getVerifyReleaseId: () => verifyReleaseId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ import {
} from './chain-manager/createChainManager';
import { getMaxPricesForNodeProduct } from './pricing-manager/getMaxPricesForNodeProduct';
import { getUserMaxPrice } from './pricing-manager/getUserMaxPrice';
import { getPriceFeedInfo } from '../../LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi';
import { createReadOnlyContractsManager } from '../../LitChainClient/contract-manager/createContractsManager';

const MODULE_NAME = 'naga-local';

Expand Down Expand Up @@ -323,6 +325,19 @@ const networkModuleObject = {
});
},

// Expose a fresh price feed fetcher (chain read; independent of state refresh)
getFreshPriceFeedInfo: async () => {
const { walletClient } = createReadOnlyContractsManager(networkConfig);
const realmId = Number(networkConfig.networkSpecificConfigs?.realmId ?? 1);
return await getPriceFeedInfo(
{
realmId,
networkCtx: networkConfig as any,
},
walletClient
);
},

getMaxPricesForNodeProduct: getMaxPricesForNodeProduct,
getUserMaxPrice: getUserMaxPrice,
getVerifyReleaseId: () => verifyReleaseId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ import {
} from './chain-manager/createChainManager';
import { getMaxPricesForNodeProduct } from './pricing-manager/getMaxPricesForNodeProduct';
import { getUserMaxPrice } from './pricing-manager/getUserMaxPrice';
import { getPriceFeedInfo } from '../../LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi';
import { createReadOnlyContractsManager } from '../../LitChainClient/contract-manager/createContractsManager';

const MODULE_NAME = 'naga-staging';

Expand Down Expand Up @@ -323,6 +325,19 @@ const networkModuleObject = {
});
},

// Expose a fresh price feed fetcher (chain read; independent of state refresh)
getFreshPriceFeedInfo: async () => {
const { walletClient } = createReadOnlyContractsManager(networkConfig);
const realmId = Number(networkConfig.networkSpecificConfigs?.realmId ?? 1);
return await getPriceFeedInfo(
{
realmId,
networkCtx: networkConfig as any,
},
walletClient
);
},

getMaxPricesForNodeProduct: getMaxPricesForNodeProduct,
getUserMaxPrice: getUserMaxPrice,
getVerifyReleaseId: () => verifyReleaseId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ import {
} from './chain-manager/createChainManager';
import { getMaxPricesForNodeProduct } from './pricing-manager/getMaxPricesForNodeProduct';
import { getUserMaxPrice } from './pricing-manager/getUserMaxPrice';
import { getPriceFeedInfo } from '../../LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi';
import { createReadOnlyContractsManager } from '../../LitChainClient/contract-manager/createContractsManager';

const MODULE_NAME = 'naga-test';

Expand Down Expand Up @@ -323,6 +325,19 @@ const networkModuleObject = {
});
},

// Expose a fresh price feed fetcher (chain read; independent of state refresh)
getFreshPriceFeedInfo: async () => {
const { walletClient } = createReadOnlyContractsManager(networkConfig);
const realmId = Number(networkConfig.networkSpecificConfigs?.realmId ?? 1);
return await getPriceFeedInfo(
{
realmId,
networkCtx: networkConfig as any,
},
walletClient
);
},

getMaxPricesForNodeProduct: getMaxPricesForNodeProduct,
getUserMaxPrice: getUserMaxPrice,
getVerifyReleaseId: () => verifyReleaseId,
Expand Down
Loading