Skip to content

Commit dcdae8e

Browse files
committed
fix: init type and viem
1 parent 51f6098 commit dcdae8e

File tree

6 files changed

+89
-13
lines changed

6 files changed

+89
-13
lines changed

e2e/bun.lock

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"lockfileVersion": 1,
3+
"workspaces": {
4+
"": {
5+
"name": "@lit-protocol/e2e",
6+
"dependencies": {
7+
"viem": "2.29.4",
8+
"zod": "^3.22.0",
9+
},
10+
"devDependencies": {
11+
"@types/node": "^20.0.0",
12+
"typescript": "^5.0.0",
13+
},
14+
"peerDependencies": {
15+
"@lit-protocol/auth": "*",
16+
"@lit-protocol/lit-client": "*",
17+
"@lit-protocol/networks": "*",
18+
},
19+
},
20+
},
21+
"packages": {
22+
"@adraffy/ens-normalize": ["@adraffy/[email protected]", "", {}, "sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg=="],
23+
24+
"@noble/curves": ["@noble/[email protected]", "", { "dependencies": { "@noble/hashes": "1.7.2" } }, "sha512-vnI7V6lFNe0tLAuJMu+2sX+FcL14TaCWy1qiczg1VwRmPrpQCdq5ESXQMqUc2tluRNf6irBXrWbl1mGN8uaU/g=="],
25+
26+
"@noble/hashes": ["@noble/[email protected]", "", {}, "sha512-biZ0NUSxyjLLqo6KxEJ1b+C2NAx0wtDoFvCaXHGgUkeHzf3Xc1xKumFKREuT7f7DARNZ/slvYUwFG6B0f2b6hQ=="],
27+
28+
"@scure/base": ["@scure/[email protected]", "", {}, "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg=="],
29+
30+
"@scure/bip32": ["@scure/[email protected]", "", { "dependencies": { "@noble/curves": "~1.8.1", "@noble/hashes": "~1.7.1", "@scure/base": "~1.2.2" } }, "sha512-t96EPDMbtGgtb7onKKqxRLfE5g05k7uHnHRM2xdE6BP/ZmxaLtPek4J4KfVn/90IQNrU1IOAqMgiDtUdtbe3nw=="],
31+
32+
"@scure/bip39": ["@scure/[email protected]", "", { "dependencies": { "@noble/hashes": "~1.7.1", "@scure/base": "~1.2.4" } }, "sha512-TFM4ni0vKvCfBpohoh+/lY05i9gRbSwXWngAsF4CABQxoaOHijxuaZ2R6cStDQ5CHtHO9aGJTr4ksVJASRRyMA=="],
33+
34+
"@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-hfrc+1tud1xcdVTABC2JiomZJEklMcXYNTVtZLAeqTVWD+qL5jkHKT+1lOtqDdGxt+mB53DTtiz673vfjU8D1Q=="],
35+
36+
"abitype": ["[email protected]", "", { "peerDependencies": { "typescript": ">=5.0.4", "zod": "^3 >=3.22.0" }, "optionalPeers": ["typescript", "zod"] }, "sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg=="],
37+
38+
"eventemitter3": ["[email protected]", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="],
39+
40+
"isows": ["[email protected]", "", { "peerDependencies": { "ws": "*" } }, "sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg=="],
41+
42+
"ox": ["[email protected]", "", { "dependencies": { "@adraffy/ens-normalize": "^1.10.1", "@noble/curves": "^1.6.0", "@noble/hashes": "^1.5.0", "@scure/bip32": "^1.5.0", "@scure/bip39": "^1.4.0", "abitype": "^1.0.6", "eventemitter3": "5.0.1" }, "peerDependencies": { "typescript": ">=5.4.0" }, "optionalPeers": ["typescript"] }, "sha512-wi5ShvzE4eOcTwQVsIPdFr+8ycyX+5le/96iAJutaZAvCes1J0+RvpEPg5QDPDiaR0XQQAvZVl7AwqQcINuUug=="],
43+
44+
"typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
45+
46+
"undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
47+
48+
"viem": ["[email protected]", "", { "dependencies": { "@noble/curves": "1.8.2", "@noble/hashes": "1.7.2", "@scure/bip32": "1.6.2", "@scure/bip39": "1.5.4", "abitype": "1.0.8", "isows": "1.0.7", "ox": "0.6.9", "ws": "8.18.1" }, "peerDependencies": { "typescript": ">=5.0.4" }, "optionalPeers": ["typescript"] }, "sha512-Dhyae+w1LKKpYVXypGjBnZ3WU5EHl/Uip5RtVwVRYSVxD5VvHzqKzIfbFU1KP4vnnh3++ZNgLjBY/kVT/tPrrg=="],
49+
50+
"ws": ["[email protected]", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w=="],
51+
52+
"zod": ["[email protected]", "", {}, "sha512-6tgzLuwVST5oLUxXTmBqoinKMd3JeesgbgseXeFasKKj8Q1FCZrHnbqJOyiEvr4cVAlbug+CgIsmJ8cl/pU5FA=="],
53+
}
54+
}

e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"author": "Lit Protocol",
3636
"license": "MIT",
3737
"dependencies": {
38-
"viem": "^2.0.0",
38+
"viem": "2.29.4",
3939
"zod": "^3.22.0"
4040
},
4141
"devDependencies": {

e2e/src/init.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@ import {
44
ViemAccountAuthenticator,
55
} from '@lit-protocol/auth';
66
import { createLitClient } from '@lit-protocol/lit-client';
7+
import { Account, PrivateKeyAccount } from 'viem';
78
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
89
import { z } from 'zod';
910
import { fundAccount } from './helper/fundAccount';
1011

11-
const SupportedNetworkSchema = z.enum(['naga-dev', 'naga-local', 'naga-staging']);
12+
const SupportedNetworkSchema = z.enum([
13+
'naga-dev',
14+
'naga-local',
15+
'naga-staging',
16+
]);
1217
type SupportedNetwork = z.infer<typeof SupportedNetworkSchema>;
1318

1419
const LogLevelSchema = z.enum(['silent', 'info', 'debug']);
1520
type LogLevel = z.infer<typeof LogLevelSchema>;
1621

17-
export const init = async (network?: SupportedNetwork, logLevel?: LogLevel): Promise<{
22+
export const init = async (
23+
network?: SupportedNetwork,
24+
logLevel?: LogLevel
25+
): Promise<{
1826
litClient: any;
1927
authManager: any;
2028
localMasterAccount: any;

packages/auth/src/lib/AuthManager/authContexts/getEoaAuthContext.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from '@lit-protocol/schemas';
77
import { AuthSig } from '@lit-protocol/types';
88
import { GetWalletClientReturnType } from '@wagmi/core';
9-
import { Account, WalletClient } from 'viem';
9+
import { Account, PrivateKeyAccount, WalletClient } from 'viem';
1010
import { z } from 'zod';
1111
import { ViemAccountAuthenticator } from '../../authenticators/ViemAccountAuthenticator';
1212
import { WalletClientAuthenticator } from '../../authenticators/WalletClientAuthenticator';
@@ -16,7 +16,8 @@ import { AuthConfigSchema } from '@lit-protocol/schemas';
1616
export type ExpectedAccountOrWalletClient =
1717
| Account
1818
| WalletClient
19-
| GetWalletClientReturnType;
19+
| GetWalletClientReturnType
20+
| PrivateKeyAccount;
2021

2122
interface GetEoaAuthContextParams {
2223
authentication: {

packages/auth/src/lib/authenticators/ViemAccountAuthenticator.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ import {
1010
import { getChildLogger } from '@lit-protocol/logger';
1111
import { AuthData } from '@lit-protocol/schemas';
1212
import { AuthMethod, AuthSig, EthBlockhashInfo } from '@lit-protocol/types';
13-
import { Account, getAddress, Hex, keccak256, stringToBytes } from 'viem';
13+
import {
14+
Account,
15+
getAddress,
16+
Hex,
17+
keccak256,
18+
PrivateKeyAccount,
19+
stringToBytes,
20+
} from 'viem';
1421

1522
const _logger = getChildLogger({
1623
module: 'ViemAccountAuthenticator',
@@ -67,7 +74,7 @@ export class ViemAccountAuthenticator {
6774
}
6875

6976
static async authenticate(
70-
account: Account,
77+
account: Account | PrivateKeyAccount,
7178
messageToSign?: string
7279
): Promise<AuthData> {
7380
let _toSign = messageToSign;

packages/lit-client/src/lib/LitClient/types/NagaLitClient.type.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ import {
1111
import { z } from 'zod';
1212
import { MintWithCustomAuthRequest } from '../schemas/MintWithCustomAuthSchema';
1313
import { BaseLitClient } from './BaseClient.type';
14-
import { AuthContextSchema2, HexPrefixedSchema } from '@lit-protocol/schemas';
14+
import {
15+
AuthContextSchema2,
16+
AuthDataSchema,
17+
HexPrefixedSchema,
18+
} from '@lit-protocol/schemas';
1519
import { Chain, Hex } from 'viem';
1620
import type { PKPStorageProvider } from '@lit-protocol/networks';
1721

@@ -189,11 +193,13 @@ export interface NagaLitClient extends BaseLitClient<any> {
189193
* ```
190194
*/
191195
viewPKPsByAuthData: (params: {
192-
authData: {
193-
authMethodType: number | bigint;
194-
authMethodId: string;
195-
accessToken?: string;
196-
};
196+
authData:
197+
| {
198+
authMethodType: number | bigint;
199+
authMethodId: string;
200+
accessToken?: string;
201+
}
202+
| z.infer<typeof AuthDataSchema>;
197203
pagination?: { limit?: number; offset?: number };
198204
storageProvider?: PKPStorageProvider;
199205
}) => Promise<any>;

0 commit comments

Comments
 (0)