Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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 litClient variable is declared without initialization but used in conditional checks. This will cause a TypeScript error since LitClientType doesn't include undefined. Consider initializing as let litClient: LitClientType | null = null; to match the previous pattern.

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: 1000000000000000000n,
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 debugging code that should be removed before merging to keep the codebase clean.

Suggested change
// userMaxPrice: 1000000000000000000n,

Copilot uses AI. Check for mistakes.
});

// Validate the result using Zod schema
Expand Down
8 changes: 7 additions & 1 deletion e2e/src/helper/NetworkManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@ export const getViemPublicClient = async ({
networkModule: any;
}) => {
const viemChainConfig = networkModule.getChainConfig();

const customRpcUrl = process.env['LIT_YELLOWSTONE_PRIVATE_RPC_URL'];
if (customRpcUrl) {
console.log(`🔧 Using custom E2E RPC URL: ${customRpcUrl}`);
}

const publicClient = createPublicClient({
chain: viemChainConfig,
transport: http(),
transport: customRpcUrl ? http(customRpcUrl) : http(),
});

return publicClient;
Expand Down
9 changes: 7 additions & 2 deletions e2e/src/helper/fundAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,15 @@ export const fundAccount = async (
thenFundWith?: string;
}
) => {
const customRpcUrl = process.env['LIT_YELLOWSTONE_PRIVATE_RPC_URL'];
if (customRpcUrl) {
console.log(`🔧 Using custom E2E RPC URL: ${customRpcUrl}`);
}

// check account balance
const publicClient = createPublicClient({
chain: networkModule.getChainConfig(),
transport: http(networkModule.getChainConfig().rpcUrls.default.http[0]),
transport: http(customRpcUrl || networkModule.getChainConfig().rpcUrls.default.http[0]),
});

const balance = await publicClient.getBalance({
Expand All @@ -94,7 +99,7 @@ export const fundAccount = async (

const walletClient = createWalletClient({
account: sponsorAccount,
transport: http(networkModule.getChainConfig().rpcUrls.default.http[0]),
transport: http(customRpcUrl || networkModule.getChainConfig().rpcUrls.default.http[0]),
});

// Get the next managed nonce for this sponsor account
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