Skip to content

Commit dba7110

Browse files
committed
fix: unblock build (except auth-services)
- raise all workspace TS configs (including wasm) to ES2022 to match emitted code - add missing noble/ethers dependencies and tighten e2e peer/dev requirements so pnpm resolves - re-export PKP managers/types from networks and cast chainApi mint functions for strong typing - switch PKP storage provider interface to PKPData and drop the unused ethers provider - reuse existing Alice/Eve contexts in e2e helpers/specs to satisfy the new typings
1 parent 838bd2f commit dba7110

File tree

14 files changed

+186
-104
lines changed

14 files changed

+186
-104
lines changed

packages/access-control-conditions/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"typings": "./src/index.d.ts",
2727
"dependencies": {
2828
"ethers": "^5.7.1",
29-
"zod": "3.24.3"
29+
"zod": "3.24.3",
30+
"@ethersproject/providers": "5.7.0"
3031
}
3132
}

packages/auth-helpers/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"siwe": "^2.3.2",
3535
"siwe-recap": "0.0.2-alpha.0",
3636
"viem": "2.29.4",
37-
"zod": "3.24.3"
37+
"zod": "3.24.3",
38+
"@ethersproject/transactions": "5.7.0"
3839
}
3940
}

packages/auth/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"universal"
2323
],
2424
"dependencies": {
25-
"@noble/curves": "^1.8.1",
25+
"@noble/hashes": "1.8.0",
26+
"@noble/curves": "1.8.1",
2627
"@simplewebauthn/browser": "^7.2.0",
2728
"@simplewebauthn/typescript-types": "^7.0.0",
2829
"@wagmi/core": "^2.17.1",

packages/e2e/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@
3030
"author": "Lit Protocol",
3131
"license": "MIT",
3232
"dependencies": {
33-
"viem": "2.29.4",
34-
"zod": "^3.22.0"
33+
"zod": "3.24.3"
3534
},
3635
"devDependencies": {
37-
"@types/node": "^20.0.0",
38-
"typescript": "^5.0.0"
36+
"@types/node": "20.0.0",
37+
"typescript": "5.8.3"
3938
},
4039
"peerDependencies": {
4140
"@lit-protocol/access-control-conditions": "workspace:*",
4241
"@lit-protocol/auth": "workspace:*",
4342
"@lit-protocol/lit-client": "workspace:*",
4443
"@lit-protocol/networks": "workspace:*",
45-
"@lit-protocol/schemas": "workspace:*"
44+
"@lit-protocol/schemas": "workspace:*",
45+
"viem": "2.29.4"
4646
},
4747
"engines": {
4848
"node": ">=18.0.0"

packages/e2e/src/e2e.spec.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,13 @@ describe('all', () => {
144144
ctx.eveViemAccountPkp.pubkey
145145
)());
146146
it('viewPKPsByAddress', () =>
147-
createViewPKPsByAddressTest(
148-
ctx,
149-
() => eveCustomAuthContext,
150-
ctx.eveViemAccountPkp.pubkey
151-
)());
147+
createViewPKPsByAddressTest(ctx, () => ctx.aliceEoaAuthContext)());
152148
it('viewPKPsByAuthData', () =>
153149
createViewPKPsByAuthDataTest(ctx, () => eveCustomAuthContext)());
154150
it('pkpEncryptDecrypt', () =>
155-
createPkpEncryptDecryptTest(
156-
ctx,
157-
() => eveCustomAuthContext,
158-
ctx.eveViemAccountPkp.ethAddress
159-
)());
151+
createPkpEncryptDecryptTest(ctx, () => ctx.aliceEoaAuthContext)());
160152
it('encryptDecryptFlow', () =>
161-
createEncryptDecryptFlowTest(
162-
ctx,
163-
() => eveCustomAuthContext,
164-
ctx.eveViemAccountPkp.pubkey
165-
)());
153+
createEncryptDecryptFlowTest(ctx, () => ctx.aliceEoaAuthContext)());
166154

167155
// Disable for now because it requires a different flow
168156
// it('pkpPermissionsManagerFlow', () =>

packages/e2e/src/helper/auth-contexts.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import { init } from '../init';
55
*/
66
export const createPkpAuthContext: (
77
ctx: Awaited<ReturnType<typeof init>>
8-
) => Promise<any> = async (
9-
ctx: Awaited<ReturnType<typeof init>>
10-
) => {
8+
) => Promise<any> = async (ctx: Awaited<ReturnType<typeof init>>) => {
119
console.log('🔁 Creating PKP Auth Context');
1210
try {
1311
const pkpAuthContext = await ctx.authManager.createPkpAuthContext({
@@ -37,22 +35,14 @@ export const createPkpAuthContext: (
3735
*/
3836
export const createCustomAuthContext: (
3937
ctx: Awaited<ReturnType<typeof init>>
40-
) => Promise<any> = async (
41-
ctx: Awaited<ReturnType<typeof init>>
42-
) => {
38+
) => Promise<any> = async (ctx: Awaited<ReturnType<typeof init>>) => {
4339
console.log('🔁 Creating Custom Auth Context');
40+
4441
try {
4542
// Set up custom auth method type and validation IPFS CID (from custom-auth-flow example)
46-
const uniqueDappName = 'e2e-test-dapp';
47-
const uniqueAuthMethodType = hexToBigInt(
48-
keccak256(toBytes(uniqueDappName))
49-
);
50-
const uniqueUserId = `${uniqueDappName}-alice`;
51-
const authMethodId = keccak256(toBytes(uniqueUserId));
52-
const validationIpfsCid = 'QmYLeVmwJPVs7Uebk85YdVPivMyrvoeKR6X37kyVRZUXW4';
5343

5444
const customAuthContext = await ctx.authManager.createCustomAuthContext({
55-
pkpPublicKey: ctx.aliceViemAccountPkp.publicKey,
45+
pkpPublicKey: ctx.eveViemAccountPkp.pubkey,
5646
authConfig: {
5747
resources: [
5848
['pkp-signing', '*'],
@@ -63,17 +53,17 @@ export const createCustomAuthContext: (
6353
},
6454
litClient: ctx.litClient,
6555
customAuthParams: {
66-
litActionIpfsId: validationIpfsCid,
56+
litActionIpfsId: ctx.eveValidationIpfsCid,
6757
jsParams: {
68-
pkpPublicKey: ctx.aliceViemAccountPkp.publicKey,
69-
username: 'alice',
58+
pkpPublicKey: ctx.eveViemAccountPkp.pubkey,
59+
username: 'eve',
7060
password: 'lit',
71-
authMethodId: authMethodId,
61+
authMethodId: ctx.eveCustomAuthData.authMethodId,
7262
},
7363
},
7464
});
7565

76-
console.log('✅ Custom Auth Context created');
66+
console.log('✅ Custom Auth Context created', customAuthContext);
7767
return customAuthContext;
7868
} catch (e) {
7969
console.error('❌ Error creating Custom Auth Context', e);

packages/lit-client/src/lib/LitClient/createLitClient.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ import {
1010
} from '@lit-protocol/access-control-conditions';
1111
import { encrypt as blsEncrypt } from '@lit-protocol/crypto';
1212
import { getChildLogger } from '@lit-protocol/logger';
13-
import type {
14-
LitNetworkModule,
15-
PKPStorageProvider,
13+
import {
14+
type LitNetworkModule,
15+
type PKPStorageProvider,
16+
type ExpectedAccountOrWalletClient,
17+
type GenericTxRes,
18+
type LitTxRes,
19+
type PKPData,
20+
type AuthMethod,
21+
PKPPermissionsManager,
22+
PaymentManager,
1623
} from '@lit-protocol/networks';
24+
1725
import {
1826
AuthContextSchema2,
1927
AuthData,
@@ -735,8 +743,14 @@ export const _createNagaLitClient = async (
735743
loginUrl: networkModule.getDefaultLoginBaseUrl(),
736744
},
737745
disconnect: _stateManager.stop,
738-
mintWithEoa: networkModule.chainApi.mintWithEoa,
739-
mintWithAuth: networkModule.chainApi.mintWithAuth,
746+
mintWithEoa: networkModule.chainApi.mintWithEoa as (params: {
747+
account: ExpectedAccountOrWalletClient;
748+
}) => Promise<GenericTxRes<LitTxRes<PKPData>, PKPData>>,
749+
mintWithAuth: networkModule.chainApi.mintWithAuth as (params: {
750+
account: ExpectedAccountOrWalletClient;
751+
authData: any;
752+
scopes: string[];
753+
}) => Promise<GenericTxRes<LitTxRes<PKPData>, PKPData>>,
740754
mintWithCustomAuth: async (params: MintWithCustomAuthRequest) => {
741755
const validatedParams = MintWithCustomAuthSchema.parse(params);
742756

packages/networks/src/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,18 @@ export type { PKPStorageProvider } from './storage/types';
3939

4040
// Schema types
4141
export type { MintRequestRaw } from './networks/vNaga/shared/managers/LitChainClient/schemas/MintRequestSchema';
42+
43+
// ----- re-exports for SDK consumers
44+
export type { ExpectedAccountOrWalletClient } from './networks/vNaga/shared/managers/contract-manager/createContractsManager';
45+
export { PKPPermissionsManager } from './networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager';
46+
export { PaymentManager } from './networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager';
47+
export type {
48+
GenericTxRes,
49+
LitTxRes,
50+
} from './networks/vNaga/shared/managers/LitChainClient/apis/types';
51+
export type { PKPData } from './networks/vNaga/shared/managers/LitChainClient/schemas/shared/PKPDataSchema';
52+
export type { AuthMethod } from './networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext';
53+
export type { PkpIdentifierRaw } from './networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId';
54+
export { getMaxPricesForNodeProduct } from './networks/vNaga/shared/managers/pricing-manager/getMaxPricesForNodeProduct';
55+
export { getUserMaxPrice } from './networks/vNaga/shared/managers/pricing-manager/getUserMaxPrice';
56+
export { PRODUCT_IDS } from './networks/vNaga/shared/managers/pricing-manager/constants';

packages/networks/src/storage/types.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { PKPInfo } from '@lit-protocol/types';
2-
1+
import { PKPData } from '@lit-protocol/schemas';
32
export interface PKPStorageProvider {
43
readPKPTokens?(params: {
54
authMethodType: number | bigint;
@@ -37,11 +36,11 @@ export interface PKPStorageProvider {
3736
readPKPs?(params: {
3837
authMethodType: number | bigint;
3938
authMethodId: string;
40-
}): Promise<PKPInfo[] | null>;
39+
}): Promise<PKPData[] | null>;
4140

4241
writePKPs?(params: {
4342
authMethodType: number | bigint;
4443
authMethodId: string;
45-
pkps: PKPInfo[];
44+
pkps: PKPData[];
4645
}): Promise<void>;
4746
}

packages/types/src/lib/interfaces.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Provider } from '@ethersproject/abstract-provider';
21
import { z } from 'zod';
32

43
import { MultipleAccessControlConditionsSchema } from '@lit-protocol/access-control-conditions-schemas';

0 commit comments

Comments
 (0)