Skip to content

Commit f7b6ea5

Browse files
committed
Merge branch 'feature/jss-93-refactor-bun-pnpm' of github.com:LIT-Protocol/js-sdk into feature/jss-107-refactor-move-e2e-and-artillery-into-packages
2 parents dfe87bc + f59121d commit f7b6ea5

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

packages/networks/src/networks/vNaga/shared/factories/BaseChainManagerFactory.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
} from '../interfaces/NetworkContext';
1010
import type { PKPStorageProvider } from '../../../../storage/types';
1111
import { DEV_PRIVATE_KEY } from '@lit-protocol/constants';
12+
import { AuthData, StrictAuthData } from '@lit-protocol/schemas';
1213

1314
export type CreateChainManagerReturn = {
1415
api: {
@@ -26,11 +27,7 @@ export type CreateChainManagerReturn = {
2627
) => InstanceType<typeof api.PKPPermissionsManager>;
2728
paymentManager: () => InstanceType<typeof api.PaymentManager>;
2829
getPKPsByAuthData: (
29-
authData: {
30-
authMethodType: number | bigint;
31-
authMethodId: string;
32-
accessToken?: string;
33-
},
30+
authData: StrictAuthData | AuthData,
3431
pagination?: { limit?: number; offset?: number },
3532
storageProvider?: PKPStorageProvider
3633
) => ReturnType<typeof api.PKPPermissionsManager.getPKPsByAuthData>;
@@ -78,6 +75,15 @@ export const createChainManagerFactory = <T, M>(
7875
fn(req, _networkConfig, accountOrWalletClient);
7976
};
8077

78+
const bindAccount = <ReqArgType, RetType>(
79+
fn: (
80+
req: ReqArgType,
81+
accountOrWalletClient: ExpectedAccountOrWalletClient
82+
) => RetType
83+
) => {
84+
return (req: ReqArgType): RetType => fn(req, accountOrWalletClient);
85+
};
86+
8187
return {
8288
api: {
8389
mintWithEoa: bindContext(api.mintWithEoa),
@@ -135,8 +141,8 @@ export const createChainManagerFactory = <T, M>(
135141
);
136142
},
137143
pricing: {
138-
getPriceFeedInfo: bindContext(api.pricing.getPriceFeedInfo),
139-
getNodePrices: bindContext(api.pricing.getNodePrices),
144+
getPriceFeedInfo: bindAccount(api.pricing.getPriceFeedInfo),
145+
getNodePrices: bindAccount(api.pricing.getNodePrices),
140146
},
141147
connection: {
142148
getConnectionInfo: (args?: {

packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ export async function getConnectionInfo({
7373
realmId: networkCtx.networkSpecificConfigs.realmId,
7474
networkCtx: networkCtx,
7575
},
76-
{
77-
accountOrWalletClient,
78-
}
76+
accountOrWalletClient
7977
);
8078

8179
const epochState = {

packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { logger } from '../../../../../../../../shared/logger';
99
import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext';
1010
import {
1111
createContractsManager,
12+
createReadOnlyContractsManager,
1213
ExpectedAccountOrWalletClient,
1314
} from '../../../../../contract-manager/createContractsManager';
1415
import { pubkeyToTokenId } from './pubkeyToTokenId';
@@ -110,10 +111,11 @@ export async function resolvePkpTokenId(
110111
throw new Error('Network context required for address resolution');
111112
}
112113

113-
const { pubkeyRouterContract } = createContractsManager(
114-
networkCtx,
115-
accountOrWalletClient
116-
);
114+
// never pass undefined; fall back to read-only
115+
const { pubkeyRouterContract } = accountOrWalletClient
116+
? createContractsManager(networkCtx, accountOrWalletClient)
117+
: createReadOnlyContractsManager(networkCtx);
118+
117119
const pkpTokenId = await pubkeyRouterContract.read.ethAddressToPkpId([
118120
validatedInput.address as `0x${string}`,
119121
]);

0 commit comments

Comments
 (0)