@dynamic-labs/global-wallet-client 4.20.0 → 4.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,26 @@
1
1
 
2
+ ### [4.20.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.1...v4.20.2) (2025-06-11)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * auto-creation for only missing v3 wallets ([#8928](https://github.com/dynamic-labs/dynamic-auth/issues/8928)) ([845a01b](https://github.com/dynamic-labs/dynamic-auth/commit/845a01b1c7661d4858913006b2dd303ded19b462))
8
+ * don't logout when unlinking last wallet ([#8932](https://github.com/dynamic-labs/dynamic-auth/issues/8932)) ([ae91d68](https://github.com/dynamic-labs/dynamic-auth/commit/ae91d682ac69a267be3b1f9ae4cf2bb46cae8c6b))
9
+ * fetch nonce before attempting zksync account upgrade to avoid nonce collision ([#8924](https://github.com/dynamic-labs/dynamic-auth/issues/8924)) ([12aa982](https://github.com/dynamic-labs/dynamic-auth/commit/12aa98224c30ded0f7b83f3eabc6fa9a923b72cd))
10
+ * remove max session expiration restraint for zksync sessions ([#8922](https://github.com/dynamic-labs/dynamic-auth/issues/8922)) ([abb92e0](https://github.com/dynamic-labs/dynamic-auth/commit/abb92e009ff9c5485e4856a39d03c4035b7a6ee2))
11
+
12
+ ### [4.20.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.0...v4.20.1) (2025-06-09)
13
+
14
+
15
+ ### Features
16
+
17
+ * **global-wallet:** new createKernelClient method to native api ([#8883](https://github.com/dynamic-labs/dynamic-auth/issues/8883)) ([005b34c](https://github.com/dynamic-labs/dynamic-auth/commit/005b34c230ceb5e945547e129231c108a6cec444))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * default embedded wallet chain enum ([#8917](https://github.com/dynamic-labs/dynamic-auth/issues/8917)) ([e9fd715](https://github.com/dynamic-labs/dynamic-auth/commit/e9fd715506598bfabbc71454421885d05a06a3ec))
23
+
2
24
  ## [4.20.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.7...v4.20.0) (2025-06-09)
3
25
 
4
26
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.20.0";
6
+ var version = "4.20.2";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.20.0";
2
+ var version = "4.20.2";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/global-wallet-client",
3
- "version": "4.20.0",
3
+ "version": "4.20.2",
4
4
  "description": "Core package for building Dynamic's Global Wallet",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -22,6 +22,9 @@
22
22
  ],
23
23
  "zksync": [
24
24
  "./src/zksync.d.ts"
25
+ ],
26
+ "zerodev": [
27
+ "./src/zerodev.d.ts"
25
28
  ]
26
29
  }
27
30
  },
@@ -51,16 +54,21 @@
51
54
  "import": "./src/zksync.js",
52
55
  "default": "./src/zksync.cjs"
53
56
  },
57
+ "./zerodev": {
58
+ "types": "./src/zerodev.d.ts",
59
+ "import": "./src/zerodev.js",
60
+ "default": "./src/zerodev.cjs"
61
+ },
54
62
  "./package.json": "./package.json"
55
63
  },
56
64
  "homepage": "https://www.dynamic.xyz/",
57
65
  "dependencies": {
58
- "@dynamic-labs/assert-package-version": "4.20.0",
59
- "@dynamic-labs/logger": "4.20.0",
60
- "@dynamic-labs/message-transport": "4.20.0",
61
- "@dynamic-labs/store": "4.20.0",
62
- "@dynamic-labs/types": "4.20.0",
63
- "@dynamic-labs/utils": "4.20.0",
66
+ "@dynamic-labs/assert-package-version": "4.20.2",
67
+ "@dynamic-labs/logger": "4.20.2",
68
+ "@dynamic-labs/message-transport": "4.20.2",
69
+ "@dynamic-labs/store": "4.20.2",
70
+ "@dynamic-labs/types": "4.20.2",
71
+ "@dynamic-labs/utils": "4.20.2",
64
72
  "eventemitter3": "5.0.1"
65
73
  },
66
74
  "peerDependencies": {
@@ -70,7 +78,9 @@
70
78
  "@wallet-standard/features": "^1.0.3",
71
79
  "@wallet-standard/base": "^1.0.1",
72
80
  "zksync-sso": "0.2.0",
73
- "@wallet-standard/wallet": "^1.1.0"
81
+ "@wallet-standard/wallet": "^1.1.0",
82
+ "@zerodev/sdk": "5.4.36",
83
+ "@dynamic-labs/ethereum-aa": "4.20.2"
74
84
  },
75
85
  "peerDependenciesMeta": {
76
86
  "viem": {
@@ -93,6 +103,12 @@
93
103
  },
94
104
  "@wallet-standard/wallet": {
95
105
  "optional": true
106
+ },
107
+ "@zerodev/sdk": {
108
+ "optional": true
109
+ },
110
+ "@dynamic-labs/ethereum-aa": {
111
+ "optional": true
96
112
  }
97
113
  }
98
114
  }
@@ -0,0 +1,99 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../../_virtual/_tslib.cjs');
7
+ var viem = require('viem');
8
+ var chains = require('viem/chains');
9
+ var constants = require('@zerodev/sdk/constants');
10
+ var ethereumAa = require('@dynamic-labs/ethereum-aa');
11
+ var getEoaWalletForSmartWallet = require('../getEoaWalletForSmartWallet/getEoaWalletForSmartWallet.cjs');
12
+ var logger = require('../../constants/logger.cjs');
13
+ var createEIP1193Provider = require('../../ethereum/functions/eip1193Provider/createEIP1193Provider.cjs');
14
+ require('eventemitter3');
15
+ require('@dynamic-labs/logger');
16
+ require('@dynamic-labs/store');
17
+ require('../../errors/DisconnectError.cjs');
18
+ require('@dynamic-labs/utils');
19
+ var getClient = require('../../client/getClient/getClient.cjs');
20
+ var getKernelAccountSettings = require('../getKernelAccountSettings/getKernelAccountSettings.cjs');
21
+ var getCurrentEthereumNetworkId = require('../getCurrentEthereumNetworkId/getCurrentEthereumNetworkId.cjs');
22
+
23
+ function _interopNamespace(e) {
24
+ if (e && e.__esModule) return e;
25
+ var n = Object.create(null);
26
+ if (e) {
27
+ Object.keys(e).forEach(function (k) {
28
+ if (k !== 'default') {
29
+ var d = Object.getOwnPropertyDescriptor(e, k);
30
+ Object.defineProperty(n, k, d.get ? d : {
31
+ enumerable: true,
32
+ get: function () { return e[k]; }
33
+ });
34
+ }
35
+ });
36
+ }
37
+ n["default"] = e;
38
+ return Object.freeze(n);
39
+ }
40
+
41
+ var chains__namespace = /*#__PURE__*/_interopNamespace(chains);
42
+
43
+ const getChainById = (chainId) => {
44
+ if (!chainId) {
45
+ throw new Error('Chain with id undefined not found');
46
+ }
47
+ const idNumber = typeof chainId === 'string' ? parseInt(chainId) : chainId;
48
+ const chain = Object.values(chains__namespace).find((chain) => chain.id === idNumber);
49
+ if (!chain) {
50
+ throw new Error(`Chain with id ${chainId} not found`);
51
+ }
52
+ return chain;
53
+ };
54
+ const createKernelClient = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ wallet, chainId, bundlerProvider, bundlerRpc, paymasterRpc, paymaster, }) {
55
+ var _b;
56
+ try {
57
+ const eoaWallet = getEoaWalletForSmartWallet.getEoaWalletForSmartWallet({
58
+ smartWallet: wallet,
59
+ });
60
+ if (!eoaWallet) {
61
+ throw new Error('EOA wallet not found');
62
+ }
63
+ const client = getClient.getClient(wallet);
64
+ const chain = chainId !== null && chainId !== void 0 ? chainId : getCurrentEthereumNetworkId.getCurrentEthereumNetworkId(client);
65
+ if (!chain) {
66
+ throw new Error('No chain specified');
67
+ }
68
+ const provider = createEIP1193Provider.createEIP1193Provider(client);
69
+ const walletClient = yield viem.createWalletClient({
70
+ account: eoaWallet.address,
71
+ chain: getChainById(chain),
72
+ transport: viem.custom(provider),
73
+ });
74
+ const accountSettings = yield getKernelAccountSettings.getKernelAccountSettings({ chainId, wallet });
75
+ const params = {
76
+ apiKernelVersion: accountSettings.kernelVersion,
77
+ bundlerRpc,
78
+ chain: getChainById(accountSettings.chainId),
79
+ enableKernelV3Migration: false,
80
+ entryPoint: accountSettings.entryPoint,
81
+ kernelVersion: accountSettings.kernelVersion,
82
+ paymaster: paymaster !== null && paymaster !== void 0 ? paymaster : ethereumAa.PaymasterTypeEnum.NONE,
83
+ paymasterRpc,
84
+ projectId: accountSettings.projectId,
85
+ provider: bundlerProvider,
86
+ signer: walletClient,
87
+ };
88
+ if (accountSettings.enableEIP7702) {
89
+ return ethereumAa.createEcdsaKernelAccountClientWith7702(Object.assign(Object.assign({}, params), { kernelVersion: constants.KERNEL_V3_3 }));
90
+ }
91
+ return ethereumAa.createEcdsaKernelAccountClient(Object.assign(Object.assign({}, params), { ecdsaValidator: ethereumAa.getEcdsaValidator((_b = accountSettings.ecdsaProviderType) !== null && _b !== void 0 ? _b : undefined) }));
92
+ }
93
+ catch (error) {
94
+ logger.logger.error(error);
95
+ throw error;
96
+ }
97
+ });
98
+
99
+ exports.createKernelClient = createKernelClient;
@@ -0,0 +1,15 @@
1
+ import { KernelAccountClient } from '@zerodev/sdk';
2
+ import { type Chain as ViemChain, Client, RpcSchema, Transport } from 'viem';
3
+ import { SmartAccount } from 'viem/account-abstraction';
4
+ import { BaseWallet, ZerodevBundlerProvider } from '@dynamic-labs/types';
5
+ import { PaymasterType } from '@dynamic-labs/ethereum-aa';
6
+ type CreateKernelAccountClientArgs = {
7
+ wallet: BaseWallet;
8
+ chainId?: number;
9
+ bundlerProvider?: ZerodevBundlerProvider;
10
+ bundlerRpc?: string;
11
+ paymasterRpc?: string;
12
+ paymaster?: PaymasterType;
13
+ };
14
+ export declare const createKernelClient: ({ wallet, chainId, bundlerProvider, bundlerRpc, paymasterRpc, paymaster, }: CreateKernelAccountClientArgs) => Promise<KernelAccountClient<Transport, ViemChain, SmartAccount, Client, RpcSchema>>;
15
+ export {};
@@ -0,0 +1,75 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../_virtual/_tslib.js';
3
+ import { createWalletClient, custom } from 'viem';
4
+ import * as chains from 'viem/chains';
5
+ import { KERNEL_V3_3 } from '@zerodev/sdk/constants';
6
+ import { PaymasterTypeEnum, createEcdsaKernelAccountClientWith7702, createEcdsaKernelAccountClient, getEcdsaValidator } from '@dynamic-labs/ethereum-aa';
7
+ import { getEoaWalletForSmartWallet } from '../getEoaWalletForSmartWallet/getEoaWalletForSmartWallet.js';
8
+ import { logger } from '../../constants/logger.js';
9
+ import { createEIP1193Provider } from '../../ethereum/functions/eip1193Provider/createEIP1193Provider.js';
10
+ import 'eventemitter3';
11
+ import '@dynamic-labs/logger';
12
+ import '@dynamic-labs/store';
13
+ import '../../errors/DisconnectError.js';
14
+ import '@dynamic-labs/utils';
15
+ import { getClient } from '../../client/getClient/getClient.js';
16
+ import { getKernelAccountSettings } from '../getKernelAccountSettings/getKernelAccountSettings.js';
17
+ import { getCurrentEthereumNetworkId } from '../getCurrentEthereumNetworkId/getCurrentEthereumNetworkId.js';
18
+
19
+ const getChainById = (chainId) => {
20
+ if (!chainId) {
21
+ throw new Error('Chain with id undefined not found');
22
+ }
23
+ const idNumber = typeof chainId === 'string' ? parseInt(chainId) : chainId;
24
+ const chain = Object.values(chains).find((chain) => chain.id === idNumber);
25
+ if (!chain) {
26
+ throw new Error(`Chain with id ${chainId} not found`);
27
+ }
28
+ return chain;
29
+ };
30
+ const createKernelClient = (_a) => __awaiter(void 0, [_a], void 0, function* ({ wallet, chainId, bundlerProvider, bundlerRpc, paymasterRpc, paymaster, }) {
31
+ var _b;
32
+ try {
33
+ const eoaWallet = getEoaWalletForSmartWallet({
34
+ smartWallet: wallet,
35
+ });
36
+ if (!eoaWallet) {
37
+ throw new Error('EOA wallet not found');
38
+ }
39
+ const client = getClient(wallet);
40
+ const chain = chainId !== null && chainId !== void 0 ? chainId : getCurrentEthereumNetworkId(client);
41
+ if (!chain) {
42
+ throw new Error('No chain specified');
43
+ }
44
+ const provider = createEIP1193Provider(client);
45
+ const walletClient = yield createWalletClient({
46
+ account: eoaWallet.address,
47
+ chain: getChainById(chain),
48
+ transport: custom(provider),
49
+ });
50
+ const accountSettings = yield getKernelAccountSettings({ chainId, wallet });
51
+ const params = {
52
+ apiKernelVersion: accountSettings.kernelVersion,
53
+ bundlerRpc,
54
+ chain: getChainById(accountSettings.chainId),
55
+ enableKernelV3Migration: false,
56
+ entryPoint: accountSettings.entryPoint,
57
+ kernelVersion: accountSettings.kernelVersion,
58
+ paymaster: paymaster !== null && paymaster !== void 0 ? paymaster : PaymasterTypeEnum.NONE,
59
+ paymasterRpc,
60
+ projectId: accountSettings.projectId,
61
+ provider: bundlerProvider,
62
+ signer: walletClient,
63
+ };
64
+ if (accountSettings.enableEIP7702) {
65
+ return createEcdsaKernelAccountClientWith7702(Object.assign(Object.assign({}, params), { kernelVersion: KERNEL_V3_3 }));
66
+ }
67
+ return createEcdsaKernelAccountClient(Object.assign(Object.assign({}, params), { ecdsaValidator: getEcdsaValidator((_b = accountSettings.ecdsaProviderType) !== null && _b !== void 0 ? _b : undefined) }));
68
+ }
69
+ catch (error) {
70
+ logger.error(error);
71
+ throw error;
72
+ }
73
+ });
74
+
75
+ export { createKernelClient };
@@ -0,0 +1 @@
1
+ export { createKernelClient } from './createKernelClient';
@@ -31,7 +31,7 @@ var getCurrentEthereumNetworkId = require('../getCurrentEthereumNetworkId/getCur
31
31
  * const { sessionId, expiresAt } = await createZksyncSession(Wallet, { sessionConfig });
32
32
  * ```
33
33
  */
34
- const createZksyncSession = (wallet_1, _a) => _tslib.__awaiter(void 0, [wallet_1, _a], void 0, function* (wallet, { sessionConfig }) {
34
+ const createZksyncSession = (wallet_1, _a) => _tslib.__awaiter(void 0, [wallet_1, _a], void 0, function* (wallet, { sessionConfig, addModuleWithPaymaster }) {
35
35
  if (!isEthereumWallet.isEthereumWallet(wallet)) {
36
36
  throw new Error('Wallet is not an Ethereum wallet');
37
37
  }
@@ -40,11 +40,15 @@ const createZksyncSession = (wallet_1, _a) => _tslib.__awaiter(void 0, [wallet_1
40
40
  if (!chainId) {
41
41
  throw new Error('No chain id found');
42
42
  }
43
+ const params = [wallet.address, { sessionConfig }];
44
+ if (addModuleWithPaymaster) {
45
+ params[1].addModuleWithPaymaster = addModuleWithPaymaster;
46
+ }
43
47
  const { data } = yield getCore.getCore(client).request({
44
48
  args: {
45
49
  chainId,
46
50
  method: 'zksync_createSession',
47
- params: [wallet.address, sessionConfig],
51
+ params,
48
52
  },
49
53
  connection: getActiveConnection.getActiveConnection(client),
50
54
  name: 'zksync-request',
@@ -1,7 +1,9 @@
1
1
  import { SessionConfig } from 'zksync-sso/utils';
2
2
  import { BaseWallet, ConvertBigIntToString } from '@dynamic-labs/types';
3
+ type SessionConfigAsString = Omit<ConvertBigIntToString<SessionConfig>, 'signer'>;
3
4
  type createZksyncSessionParams = {
4
- sessionConfig: Omit<ConvertBigIntToString<SessionConfig>, 'signer'>;
5
+ addModuleWithPaymaster?: boolean;
6
+ sessionConfig: SessionConfigAsString;
5
7
  };
6
8
  /**
7
9
  * Creates a session with the wallet.
@@ -18,7 +20,7 @@ type createZksyncSessionParams = {
18
20
  * const { sessionId, expiresAt } = await createZksyncSession(Wallet, { sessionConfig });
19
21
  * ```
20
22
  */
21
- export declare const createZksyncSession: (wallet: BaseWallet, { sessionConfig }: createZksyncSessionParams) => Promise<{
23
+ export declare const createZksyncSession: (wallet: BaseWallet, { sessionConfig, addModuleWithPaymaster }: createZksyncSessionParams) => Promise<{
22
24
  sessionId: string;
23
25
  expiresAt: string;
24
26
  }>;
@@ -27,7 +27,7 @@ import { getCurrentEthereumNetworkId } from '../getCurrentEthereumNetworkId/getC
27
27
  * const { sessionId, expiresAt } = await createZksyncSession(Wallet, { sessionConfig });
28
28
  * ```
29
29
  */
30
- const createZksyncSession = (wallet_1, _a) => __awaiter(void 0, [wallet_1, _a], void 0, function* (wallet, { sessionConfig }) {
30
+ const createZksyncSession = (wallet_1, _a) => __awaiter(void 0, [wallet_1, _a], void 0, function* (wallet, { sessionConfig, addModuleWithPaymaster }) {
31
31
  if (!isEthereumWallet(wallet)) {
32
32
  throw new Error('Wallet is not an Ethereum wallet');
33
33
  }
@@ -36,11 +36,15 @@ const createZksyncSession = (wallet_1, _a) => __awaiter(void 0, [wallet_1, _a],
36
36
  if (!chainId) {
37
37
  throw new Error('No chain id found');
38
38
  }
39
+ const params = [wallet.address, { sessionConfig }];
40
+ if (addModuleWithPaymaster) {
41
+ params[1].addModuleWithPaymaster = addModuleWithPaymaster;
42
+ }
39
43
  const { data } = yield getCore(client).request({
40
44
  args: {
41
45
  chainId,
42
46
  method: 'zksync_createSession',
43
- params: [wallet.address, sessionConfig],
47
+ params,
44
48
  },
45
49
  connection: getActiveConnection(client),
46
50
  name: 'zksync-request',
@@ -0,0 +1,61 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../../_virtual/_tslib.cjs');
7
+ var ethereumAa = require('@dynamic-labs/ethereum-aa');
8
+ require('eventemitter3');
9
+ require('@dynamic-labs/logger');
10
+ require('@dynamic-labs/store');
11
+ require('../../errors/DisconnectError.cjs');
12
+ require('@dynamic-labs/utils');
13
+ require('../../constants/logger.cjs');
14
+ var getCore = require('../../client/getCore/getCore.cjs');
15
+ var getClient = require('../../client/getClient/getClient.cjs');
16
+ var getCurrentEthereumNetworkId = require('../getCurrentEthereumNetworkId/getCurrentEthereumNetworkId.cjs');
17
+
18
+ const getZeroDevClientId = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ wallet, zeroDevSettings, chainId, }) {
19
+ var _b;
20
+ const network = chainId || getCurrentEthereumNetworkId.getCurrentEthereumNetworkId(getClient.getClient(wallet));
21
+ if (!network) {
22
+ throw new Error('Network not found');
23
+ }
24
+ const chainConfig = (_b = zeroDevSettings.multichainAccountAbstractionProviders) === null || _b === void 0 ? void 0 : _b.find((chainConfig) => chainConfig.chain === network.toString());
25
+ if (!chainConfig) {
26
+ throw new Error('Chain config not found');
27
+ }
28
+ return chainConfig.clientId;
29
+ });
30
+ const getKernelAccountSettings = (args) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
31
+ if (!args) {
32
+ throw new Error('No arguments provided');
33
+ }
34
+ const client = getClient.getClient(args.wallet);
35
+ const core = getCore.getCore(client);
36
+ const { zeroDevSettings } = core.store.getState().settings;
37
+ if (!zeroDevSettings) {
38
+ throw new Error('ZeroDev provider is not enabled');
39
+ }
40
+ const clientId = yield getZeroDevClientId({
41
+ chainId: args === null || args === void 0 ? void 0 : args.chainId,
42
+ wallet: args === null || args === void 0 ? void 0 : args.wallet,
43
+ zeroDevSettings,
44
+ });
45
+ const { kernelVersion, ecdsaProviderType, entryPointVersion, enableEIP7702 } = zeroDevSettings;
46
+ if (!clientId) {
47
+ throw new Error('ZeroDev clientId is not set');
48
+ }
49
+ const chain = yield ethereumAa.fetchZeroDevChain(clientId);
50
+ const entryPoint = ethereumAa.getEntryPoint(entryPointVersion);
51
+ return {
52
+ chainId: chain.id,
53
+ ecdsaProviderType: ecdsaProviderType !== null && ecdsaProviderType !== void 0 ? ecdsaProviderType : null,
54
+ enableEIP7702,
55
+ entryPoint,
56
+ kernelVersion: ethereumAa.getKernelVersion(kernelVersion, entryPoint),
57
+ projectId: clientId,
58
+ };
59
+ });
60
+
61
+ exports.getKernelAccountSettings = getKernelAccountSettings;
@@ -0,0 +1,5 @@
1
+ import { BaseWallet, KernelAccountSettings } from '@dynamic-labs/types';
2
+ export declare const getKernelAccountSettings: (args: {
3
+ chainId?: number;
4
+ wallet: BaseWallet;
5
+ } | void) => Promise<KernelAccountSettings>;
@@ -0,0 +1,57 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../_virtual/_tslib.js';
3
+ import { fetchZeroDevChain, getEntryPoint, getKernelVersion } from '@dynamic-labs/ethereum-aa';
4
+ import 'eventemitter3';
5
+ import '@dynamic-labs/logger';
6
+ import '@dynamic-labs/store';
7
+ import '../../errors/DisconnectError.js';
8
+ import '@dynamic-labs/utils';
9
+ import '../../constants/logger.js';
10
+ import { getCore } from '../../client/getCore/getCore.js';
11
+ import { getClient } from '../../client/getClient/getClient.js';
12
+ import { getCurrentEthereumNetworkId } from '../getCurrentEthereumNetworkId/getCurrentEthereumNetworkId.js';
13
+
14
+ const getZeroDevClientId = (_a) => __awaiter(void 0, [_a], void 0, function* ({ wallet, zeroDevSettings, chainId, }) {
15
+ var _b;
16
+ const network = chainId || getCurrentEthereumNetworkId(getClient(wallet));
17
+ if (!network) {
18
+ throw new Error('Network not found');
19
+ }
20
+ const chainConfig = (_b = zeroDevSettings.multichainAccountAbstractionProviders) === null || _b === void 0 ? void 0 : _b.find((chainConfig) => chainConfig.chain === network.toString());
21
+ if (!chainConfig) {
22
+ throw new Error('Chain config not found');
23
+ }
24
+ return chainConfig.clientId;
25
+ });
26
+ const getKernelAccountSettings = (args) => __awaiter(void 0, void 0, void 0, function* () {
27
+ if (!args) {
28
+ throw new Error('No arguments provided');
29
+ }
30
+ const client = getClient(args.wallet);
31
+ const core = getCore(client);
32
+ const { zeroDevSettings } = core.store.getState().settings;
33
+ if (!zeroDevSettings) {
34
+ throw new Error('ZeroDev provider is not enabled');
35
+ }
36
+ const clientId = yield getZeroDevClientId({
37
+ chainId: args === null || args === void 0 ? void 0 : args.chainId,
38
+ wallet: args === null || args === void 0 ? void 0 : args.wallet,
39
+ zeroDevSettings,
40
+ });
41
+ const { kernelVersion, ecdsaProviderType, entryPointVersion, enableEIP7702 } = zeroDevSettings;
42
+ if (!clientId) {
43
+ throw new Error('ZeroDev clientId is not set');
44
+ }
45
+ const chain = yield fetchZeroDevChain(clientId);
46
+ const entryPoint = getEntryPoint(entryPointVersion);
47
+ return {
48
+ chainId: chain.id,
49
+ ecdsaProviderType: ecdsaProviderType !== null && ecdsaProviderType !== void 0 ? ecdsaProviderType : null,
50
+ enableEIP7702,
51
+ entryPoint,
52
+ kernelVersion: getKernelVersion(kernelVersion, entryPoint),
53
+ projectId: clientId,
54
+ };
55
+ });
56
+
57
+ export { getKernelAccountSettings };
@@ -0,0 +1 @@
1
+ export { getKernelAccountSettings } from './getKernelAccountSettings';
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var createKernelClient = require('./lib/functions/createKernelClient/createKernelClient.cjs');
7
+
8
+
9
+
10
+ exports.createKernelClient = createKernelClient.createKernelClient;
@@ -0,0 +1 @@
1
+ export { createKernelClient } from './lib/functions/createKernelClient';
package/src/zerodev.js ADDED
@@ -0,0 +1,2 @@
1
+ 'use client'
2
+ export { createKernelClient } from './lib/functions/createKernelClient/createKernelClient.js';