@dynamic-labs/ethereum-aa 4.9.11 → 4.9.13-preview.0

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.
@@ -0,0 +1,426 @@
1
+ 'use client'
2
+ import { __awaiter } from '../_virtual/_tslib.js';
3
+ import { createPublicClient, http, publicActions, walletActions, toBytes, keccak256, toHex } from 'viem';
4
+ import { zksyncSepoliaTestnet, getGeneralPaymasterInput, eip712WalletActions } from 'viem/zksync';
5
+ import { deployAccount } from 'zksync-sso/client';
6
+ import { createZksyncPasskeyClient, registerNewPasskey } from 'zksync-sso/client/passkey';
7
+ import { EthereumWallet, createViemUiTransaction } from '@dynamic-labs/ethereum-core';
8
+ import { parseEvmNetworks, StorageService, DynamicError } from '@dynamic-labs/utils';
9
+ import { AccountAbstractionConnector } from './AccountAbstractionConnector.js';
10
+ import { AAFactoryABI } from './utils/abi.js';
11
+ import { zksyncSsoEcdsaWalletActions } from './ZKsync/walletActions.js';
12
+ import { createZksyncEcdsaClient } from './ZKsync/client.js';
13
+
14
+ class ZKsyncConnector extends AccountAbstractionConnector {
15
+ constructor(props) {
16
+ var _a, _b, _c, _d, _e;
17
+ super(props);
18
+ // Core wallet properties
19
+ this.ChainWallet = EthereumWallet;
20
+ this.name = 'ZKsync';
21
+ this.overrideKey = 'zksync';
22
+ // Chain configuration
23
+ this.connectedChain = 'EVM';
24
+ this.evmNetworks = [];
25
+ this.supportedChains = ['ETH', 'EVM'];
26
+ this.enableEIP7702Mode = false;
27
+ this.walletFallback = {
28
+ brand: {
29
+ alt: 'Smart Wallet',
30
+ spriteId: 'smartwallet',
31
+ },
32
+ name: 'ZKsync',
33
+ };
34
+ this._walletUiUtils = props.walletUiUtils;
35
+ this.chainId = (_a = props.apiProviders.zksync) === null || _a === void 0 ? void 0 : _a.defaultChainId;
36
+ this.evmNetworks = parseEvmNetworks(props.evmNetworks).filter((network) => network.chainId === this.chainId);
37
+ this.factoryAddress = ((_c = (_b = props.apiProviders.zksync) === null || _b === void 0 ? void 0 : _b.factoryAddress) !== null && _c !== void 0 ? _c : '0x2e620D52467CfA4C664F92005Ab0f0181d3d1E79'); // Fallback if not provided
38
+ this.paymasterAddress = ((_e = (_d = props.apiProviders.zksync) === null || _d === void 0 ? void 0 : _d.paymasterAddress) !== null && _e !== void 0 ? _e : '0xA78CAC56c9D491Ece2FF303aEcc627Bf71C6dc1c'); // Fallback if not provided
39
+ }
40
+ getEnabledNetworks() {
41
+ return this.evmNetworks;
42
+ }
43
+ getConnectedAccounts() {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ if (!this.smartAccountAddress) {
46
+ throw new Error('Smart account address is not initialized');
47
+ }
48
+ return [this.smartAccountAddress];
49
+ });
50
+ }
51
+ getNetwork() {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ if (!this.smartAccountAddress) {
54
+ throw new Error('Smart account address is not initialized');
55
+ }
56
+ return this.chainId;
57
+ });
58
+ }
59
+ getPublicClient() {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ return createPublicClient({
62
+ chain: zksyncSepoliaTestnet,
63
+ transport: http(),
64
+ });
65
+ });
66
+ }
67
+ canSponsorTransactionGas() {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ return false;
70
+ });
71
+ }
72
+ getAccountAbstractionProvider() {
73
+ return this.smartAccount;
74
+ }
75
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
76
+ getWalletClient() {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ var _a;
79
+ const eoaSigner = yield ((_a = this.eoaConnector) === null || _a === void 0 ? void 0 : _a.getSigner());
80
+ if (!eoaSigner) {
81
+ throw new Error('EOA wallet client not found');
82
+ }
83
+ const walletClient = yield createZksyncEcdsaClient({
84
+ address: this.smartAccountAddress,
85
+ chain: zksyncSepoliaTestnet,
86
+ contracts: {
87
+ accountFactory: this.factoryAddress,
88
+ session: '0x5Da0ba1366F05a14603FC6aC906B99CdC6BA851A',
89
+ },
90
+ owner: eoaSigner,
91
+ transport: http(),
92
+ });
93
+ return walletClient;
94
+ });
95
+ }
96
+ getSigner() {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ return this.getWalletClient();
99
+ });
100
+ }
101
+ /**
102
+ * Implementation of the interface method required by IAccountAbstractionWalletConnector
103
+ * @param eoaConnector - The EOA connector to use for signing transactions
104
+ * @param smartAccountAddress - The address of the smart account
105
+ */
106
+ initializeZksyncConnector(_a) {
107
+ return __awaiter(this, arguments, void 0, function* ({ eoaConnector, smartAccountAddress, }) {
108
+ this.eoaConnector = eoaConnector;
109
+ this.eoaAddress = yield eoaConnector.getAddress();
110
+ this.smartAccountAddress = smartAccountAddress;
111
+ this.smartAccount = (yield this.getWalletClient());
112
+ // Check if account needs deployment
113
+ const shouldDeploy = yield this.shouldDeployAccount(smartAccountAddress);
114
+ if (!shouldDeploy) {
115
+ return;
116
+ }
117
+ });
118
+ }
119
+ createPasskeyClient() {
120
+ return __awaiter(this, void 0, void 0, function* () {
121
+ const storedCredentialPublicKey = StorageService.getItem('credentialPublicKey');
122
+ const credentialPublicKey = storedCredentialPublicKey
123
+ ? new Uint8Array(Object.values(storedCredentialPublicKey))
124
+ : null;
125
+ if (!credentialPublicKey) {
126
+ throw new Error('Credential public key not found');
127
+ }
128
+ const publicClient = yield this.getTypedPublicClient();
129
+ const { chain } = publicClient;
130
+ if (!chain) {
131
+ throw new Error('Chain not found');
132
+ }
133
+ const passkeyClient = createZksyncPasskeyClient({
134
+ address: '0xf2484bEA13038C2d110dCf0DfCF3b251B8d6A7Ea',
135
+ chain,
136
+ contracts: {
137
+ accountFactory: this.factoryAddress,
138
+ passkey: '0xF69e92B224f527365F4434B729134aE69C60B963',
139
+ session: '0x5Da0ba1366F05a14603FC6aC906B99CdC6BA851A',
140
+ },
141
+ credentialPublicKey,
142
+ transport: http(),
143
+ userDisplayName: 'Vinicius',
144
+ userName: 'vinicius.macelai@gmail.com',
145
+ });
146
+ this.passkeyClient = passkeyClient;
147
+ });
148
+ }
149
+ // Create your account client
150
+ createSmartAccountClient() {
151
+ return __awaiter(this, void 0, void 0, function* () {
152
+ return this.smartAccount;
153
+ });
154
+ }
155
+ deploySmartAccountWithZksyncSso() {
156
+ return __awaiter(this, void 0, void 0, function* () {
157
+ var _a, _b;
158
+ const walletClient = yield this.getWalletClient();
159
+ if (!walletClient) {
160
+ throw new Error('Wallet client not found');
161
+ }
162
+ const deploymentParams = yield this.getDeploymentParameters();
163
+ if (!this.smartAccountAddress) {
164
+ throw new Error('Smart account address is not initialized');
165
+ }
166
+ const shouldDeploy = yield this.shouldDeployAccount(this.smartAccountAddress);
167
+ if (!shouldDeploy) {
168
+ throw new Error('Smart account already deployed');
169
+ }
170
+ const paymasterInput = getGeneralPaymasterInput({
171
+ innerInput: new Uint8Array(),
172
+ });
173
+ const storedCredentialPublicKey = StorageService.getItem('credentialPublicKey');
174
+ let credentialPublicKey = storedCredentialPublicKey
175
+ ? new Uint8Array(Object.values(storedCredentialPublicKey))
176
+ : null;
177
+ if (!credentialPublicKey) {
178
+ const { credentialPublicKey: newCredentialPublicKey } = yield registerNewPasskey({
179
+ attestationType: 'none',
180
+ authenticatorSelection: {
181
+ authenticatorAttachment: 'platform',
182
+ requireResidentKey: false,
183
+ userVerification: 'required',
184
+ },
185
+ userDisplayName: this.smartAccountAddress,
186
+ userName: this.smartAccountAddress,
187
+ });
188
+ StorageService.setItem('credentialPublicKey', newCredentialPublicKey);
189
+ credentialPublicKey = new Uint8Array(newCredentialPublicKey);
190
+ }
191
+ if (!((_a = walletClient.account) === null || _a === void 0 ? void 0 : _a.address)) {
192
+ throw new Error('Wallet client not found');
193
+ }
194
+ yield deployAccount(walletClient, {
195
+ contracts: {
196
+ accountFactory: this.factoryAddress,
197
+ passkey: '0xa9ab0dE9d83cc4827261EaccF536859f4A562b72',
198
+ session: '0x5Da0ba1366F05a14603FC6aC906B99CdC6BA851A',
199
+ },
200
+ credentialId: (_b = walletClient.account) === null || _b === void 0 ? void 0 : _b.address,
201
+ credentialPublicKey,
202
+ paymasterAddress: '0xa20D5f00A693e4Eb260AAdc7458fe415981c8051',
203
+ paymasterInput: paymasterInput,
204
+ uniqueAccountId: deploymentParams.salt,
205
+ });
206
+ });
207
+ }
208
+ deploySmartAccountWithPaymaster() {
209
+ return __awaiter(this, void 0, void 0, function* () {
210
+ const paymaster = this.paymasterAddress;
211
+ const publicClient = yield this.getTypedPublicClient();
212
+ const walletClient = yield this.getTypedWalletClient();
213
+ const deploymentParams = yield this.getDeploymentParameters();
214
+ const { request } = yield this.simulateAccountDeployment(publicClient, walletClient, deploymentParams, false);
215
+ const paymasterInput = getGeneralPaymasterInput({
216
+ innerInput: new Uint8Array(),
217
+ });
218
+ const requestWithPaymaster = Object.assign(Object.assign({}, request), { paymaster,
219
+ paymasterInput });
220
+ yield this.executeAccountDeployment(walletClient, requestWithPaymaster);
221
+ });
222
+ }
223
+ signMessage(message) {
224
+ return __awaiter(this, void 0, void 0, function* () {
225
+ const walletClient = yield this.getWalletClient();
226
+ if (!walletClient) {
227
+ throw new Error('Wallet client not found');
228
+ }
229
+ return yield walletClient.signMessage({
230
+ account: walletClient.account,
231
+ message,
232
+ });
233
+ });
234
+ }
235
+ /**
236
+ * Deploys a new smart account contract
237
+ * @throws {ZkSyncConnectorError} If deployment fails
238
+ * @testable This method can be mocked in tests
239
+ */
240
+ deploySmartAccount() {
241
+ return __awaiter(this, void 0, void 0, function* () {
242
+ if (!this.eoaConnector) {
243
+ throw new Error('EOA connector is not initialized');
244
+ }
245
+ const walletClient = yield this.getTypedWalletClient();
246
+ const publicClient = yield this.getTypedPublicClient();
247
+ const deploymentParams = yield this.getDeploymentParameters();
248
+ // Simulate the contract deployment first
249
+ const { request } = yield this.simulateAccountDeployment(publicClient, walletClient, deploymentParams, false);
250
+ // Execute the deployment transaction
251
+ yield this.executeAccountDeployment(walletClient, request);
252
+ });
253
+ }
254
+ /**
255
+ * Gets typed public client from EOA connector
256
+ * @throws {ZkSyncConnectorError} If public client cannot be obtained
257
+ * @testable This method can be mocked in tests
258
+ */
259
+ getTypedPublicClient() {
260
+ return __awaiter(this, void 0, void 0, function* () {
261
+ if (!this.eoaConnector) {
262
+ throw new Error('EOA connector is not initialized');
263
+ }
264
+ const publicClient = yield this.eoaConnector.getPublicClient();
265
+ if (!publicClient) {
266
+ throw new Error('Failed to get public client from EOA connector');
267
+ }
268
+ return publicClient;
269
+ });
270
+ }
271
+ /**
272
+ * Gets typed wallet client from EOA connector
273
+ * @throws {ZkSyncConnectorError} If wallet client cannot be obtained
274
+ * @testable This method can be mocked in tests
275
+ */
276
+ getTypedWalletClient() {
277
+ return __awaiter(this, void 0, void 0, function* () {
278
+ if (!this.eoaConnector) {
279
+ throw new Error('EOA connector is not initialized');
280
+ }
281
+ const walletClient = yield this.eoaConnector.getWalletClient();
282
+ if (!walletClient) {
283
+ throw new Error('Failed to get wallet client from EOA connector');
284
+ }
285
+ return walletClient
286
+ .extend(publicActions)
287
+ .extend(walletActions)
288
+ .extend(eip712WalletActions())
289
+ .extend(zksyncSsoEcdsaWalletActions);
290
+ });
291
+ }
292
+ /**
293
+ * Returns the parameters needed for deploying the smart account
294
+ * @returns Deployment parameters object
295
+ * @testable This method can be overridden in tests
296
+ */
297
+ getDeploymentParameters() {
298
+ return __awaiter(this, void 0, void 0, function* () {
299
+ const salt = `0x${Buffer.from(toBytes('DynamicLabs', { size: 32 })).toString('hex')}`;
300
+ const initialValidators = [];
301
+ const initialK1Owners = [this.eoaAddress];
302
+ return {
303
+ initialK1Owners,
304
+ initialValidators,
305
+ salt,
306
+ };
307
+ });
308
+ }
309
+ /**
310
+ * Simulates the smart account deployment
311
+ * @param publicClient - The public client to use for simulation
312
+ * @param walletClient - The wallet client to use for account information
313
+ * @param params - The deployment parameters
314
+ * @returns The simulation result
315
+ * @throws {ZkSyncConnectorError} If simulation fails
316
+ * @testable This method can be mocked in tests
317
+ */
318
+ simulateAccountDeployment(publicClient_1, walletClient_1, params_1) {
319
+ return __awaiter(this, arguments, void 0, function* (publicClient, walletClient, params, checkBalance = true) {
320
+ var _a, _b, _c;
321
+ // this is to keep the same salt as calculated on zksync sso package
322
+ const salt = keccak256(toHex(params.salt));
323
+ const gasEstimate = yield publicClient.estimateContractGas({
324
+ abi: AAFactoryABI,
325
+ account: (_a = walletClient.account) === null || _a === void 0 ? void 0 : _a.address,
326
+ address: this.factoryAddress,
327
+ args: [salt, params.initialValidators, params.initialK1Owners],
328
+ functionName: 'deployProxySsoAccount',
329
+ });
330
+ if (checkBalance) {
331
+ const balance = yield publicClient.getBalance({
332
+ address: (_b = walletClient.account) === null || _b === void 0 ? void 0 : _b.address,
333
+ });
334
+ if (balance < gasEstimate) {
335
+ throw new Error('Insufficient balance to deploy account');
336
+ }
337
+ }
338
+ // Simulate the contract call
339
+ return yield publicClient.simulateContract({
340
+ abi: AAFactoryABI,
341
+ account: (_c = walletClient.account) === null || _c === void 0 ? void 0 : _c.address,
342
+ address: this.factoryAddress,
343
+ args: [salt, params.initialValidators, params.initialK1Owners],
344
+ functionName: 'deployProxySsoAccount',
345
+ });
346
+ });
347
+ }
348
+ /**
349
+ * Executes the smart account deployment transaction
350
+ * @param walletClient - The wallet client to use for transaction execution
351
+ * @param request - The request to execute
352
+ * @throws {ZkSyncConnectorError} If transaction execution fails
353
+ * @testable This method can be mocked in tests
354
+ */
355
+ executeAccountDeployment(walletClient, request) {
356
+ return __awaiter(this, void 0, void 0, function* () {
357
+ if (!this.smartAccountAddress) {
358
+ throw new Error('Smart account address is not initialized');
359
+ }
360
+ const shouldDeploy = yield this.shouldDeployAccount(this.smartAccountAddress);
361
+ if (!shouldDeploy) {
362
+ throw new Error('Smart account already deployed');
363
+ }
364
+ yield walletClient.writeContract(request);
365
+ });
366
+ }
367
+ /**
368
+ * Checks if a smart account needs to be deployed
369
+ * @param smartAccountAddress - The address of the smart account
370
+ * @returns True if the account needs to be deployed, false otherwise
371
+ * @throws {ZkSyncConnectorError} If the check fails
372
+ * @testable This method can be mocked in tests
373
+ */
374
+ shouldDeployAccount(smartAccountAddress) {
375
+ return __awaiter(this, void 0, void 0, function* () {
376
+ var _a;
377
+ const client = yield ((_a = this.eoaConnector) === null || _a === void 0 ? void 0 : _a.getPublicClient());
378
+ if (!client) {
379
+ throw new Error('Failed to get public client from EOA connector');
380
+ }
381
+ const code = yield client.getCode({
382
+ address: smartAccountAddress,
383
+ });
384
+ return !code || code === '0x';
385
+ });
386
+ }
387
+ getAddress() {
388
+ return __awaiter(this, void 0, void 0, function* () {
389
+ if (!this.smartAccount) {
390
+ throw new Error('Smart account is not initialized');
391
+ }
392
+ return this.smartAccountAddress;
393
+ });
394
+ }
395
+ validateActiveWallet(expectedAddress) {
396
+ return __awaiter(this, void 0, void 0, function* () {
397
+ const currentAddress = yield this.getAddress();
398
+ if (currentAddress !== expectedAddress) {
399
+ throw new DynamicError('Invalid active wallet');
400
+ }
401
+ return;
402
+ });
403
+ }
404
+ createUiTransaction(from) {
405
+ return __awaiter(this, void 0, void 0, function* () {
406
+ yield this.validateActiveWallet(from);
407
+ const walletClient = this.getWalletClient();
408
+ const publicClient = yield this.getPublicClient();
409
+ if (!publicClient || !walletClient) {
410
+ throw new DynamicError('No public client available');
411
+ }
412
+ return createViemUiTransaction({
413
+ from: from,
414
+ publicClient: publicClient,
415
+ walletClient: walletClient,
416
+ });
417
+ });
418
+ }
419
+ registerEoa(_a) {
420
+ return __awaiter(this, arguments, void 0, function* ({ smartWalletAddress, eoaAddress, eoaConnector, shouldSetEoaConnector, }) {
421
+ throw new Error('Not implemented');
422
+ });
423
+ }
424
+ }
425
+
426
+ export { ZKsyncConnector };
@@ -16,8 +16,9 @@ var createEcsdaKernelAccountClient = require('./utils/createEcsdaKernelAccountCl
16
16
  var getEcdsaValidator = require('./utils/getEcdsaValidator.cjs');
17
17
  var getEntryPoint = require('./utils/getEntryPoint.cjs');
18
18
  var getKernelVersion = require('./utils/getKernelVersion.cjs');
19
+ var AccountAbstractionConnector = require('./AccountAbstractionConnector.cjs');
19
20
 
20
- class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
21
+ class ZeroDevConnector extends AccountAbstractionConnector.AccountAbstractionConnector {
21
22
  constructor(opts) {
22
23
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
23
24
  super(opts);
@@ -28,7 +29,6 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
28
29
  this.ChainWallet = ethereumCore.EthereumWallet;
29
30
  this.connectedChain = 'EVM';
30
31
  this.supportedChains = ['ETH', 'EVM'];
31
- this.isGasSponsorshipDisabled = false;
32
32
  this.isEmbeddedWallet = true;
33
33
  this.providersFromApi = [];
34
34
  this.name = 'ZeroDev';
@@ -60,6 +60,9 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
60
60
  this.defaultChainId = defaultProvider === null || defaultProvider === void 0 ? void 0 : defaultProvider.chain;
61
61
  this.ecdsaProviderType = (_j = opts.apiProviders.zerodev) === null || _j === void 0 ? void 0 : _j.ecdsaProviderType;
62
62
  }
63
+ confirmTransactionStatus() {
64
+ throw new Error('confirmTransactionStatus not implemented in ZeroDevConnector');
65
+ }
63
66
  get currentNetworkProvider() {
64
67
  // check if the last used chain id is in the provider map
65
68
  if (this.providerMap[this.lastUsedChainId]) {
@@ -104,13 +107,6 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
104
107
  handleChainChange(chainId);
105
108
  });
106
109
  }
107
- /**
108
- * @deprecated You should get the EOA connector by passing the SCW to getEOAConnector,
109
- * from the useSmartWallet hook
110
- */
111
- getEOAConnector() {
112
- return this.eoaConnector;
113
- }
114
110
  getAccountAbstractionProvider({ withSponsorship, } = {}) {
115
111
  if (withSponsorship && this.kernelClientWithSponsorship) {
116
112
  return this.kernelClientWithSponsorship;
@@ -122,6 +118,14 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
122
118
  utils.StorageService.removeItem(constants.ZERO_DEV_LAST_USED_CHAIN_ID_KEY);
123
119
  });
124
120
  }
121
+ initialize(_a) {
122
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ smartWalletAddress, eoaAddress, eoaConnector, properties, shouldSetEoaConnector, }) {
123
+ yield this.registerEoa(Object.assign({ eoaAddress,
124
+ eoaConnector,
125
+ shouldSetEoaConnector,
126
+ smartWalletAddress }, properties));
127
+ });
128
+ }
125
129
  registerEoa(_a) {
126
130
  return _tslib.__awaiter(this, void 0, void 0, function* () {
127
131
  var { smartWalletAddress, eoaAddress, eoaConnector, shouldSetEoaConnector = false } = _a, properties = _tslib.__rest(_a, ["smartWalletAddress", "eoaAddress", "eoaConnector", "shouldSetEoaConnector"]);
@@ -368,7 +372,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
368
372
  onSendTransaction: (_b) => _tslib.__awaiter(this, [_b], void 0, function* ({ transaction }) {
369
373
  try {
370
374
  this._walletUiUtils.disabledConfirmationOnce();
371
- const effectiveProvider = this.isGasSponsorshipDisabled
375
+ const effectiveProvider = this.isGasSponsorshipDisabled()
372
376
  ? provider
373
377
  : this.kernelClientWithSponsorship;
374
378
  if (!effectiveProvider) {
@@ -539,9 +543,6 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
539
543
  return sponsored;
540
544
  });
541
545
  }
542
- disableGasSponsorshipOnce() {
543
- this.isGasSponsorshipDisabled = true;
544
- }
545
546
  getBalance(address) {
546
547
  return _tslib.__awaiter(this, void 0, void 0, function* () {
547
548
  var _a;
@@ -603,6 +604,9 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
603
604
  getEnabledNetworks() {
604
605
  return this.evmNetworks;
605
606
  }
607
+ initializeZksyncConnector() {
608
+ throw new Error('Not implemented');
609
+ }
606
610
  }
607
611
 
608
612
  exports.ZeroDevConnector = ZeroDevConnector;
@@ -6,11 +6,12 @@ import { type Chain as ViemChain } from 'viem/chains';
6
6
  import { EntryPointType, KERNEL_VERSION_TYPE } from '@zerodev/sdk/types';
7
7
  import { EthereumWallet, RegisterEvmProvidersConfig } from '@dynamic-labs/ethereum-core';
8
8
  import { EcdsaValidatorOptions, Provider, ProviderEntryPointVersionEnum, ProviderEnum, ProviderKernelVersionEnum, ProviderMultichainAccountAbstractionProviders } from '@dynamic-labs/sdk-api-core';
9
- import { Chain, IZeroDevConnector, InternalWalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
9
+ import { Chain, InternalWalletConnector, IZeroDevConnector } from '@dynamic-labs/wallet-connector-core';
10
10
  import { WalletBookSchema } from '@dynamic-labs/wallet-book';
11
- import { EvmNetwork, GenericNetwork, IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
11
+ import { GenericNetwork, IUITransaction, TransactionReceipt, WalletUiUtils } from '@dynamic-labs/types';
12
12
  import { BundlerProvider } from './utils';
13
- type ZeroDevConnectorProps = {
13
+ import { AccountAbstractionConnector, AccountAbstractionConnectorProps } from './AccountAbstractionConnector';
14
+ type ZeroDevConnectorProps = AccountAbstractionConnectorProps & {
14
15
  apiProviders: {
15
16
  [key in ProviderEnum]?: Provider;
16
17
  };
@@ -23,7 +24,7 @@ type ZeroDevConnectorProps = {
23
24
  providersConfig?: RegisterEvmProvidersConfig;
24
25
  };
25
26
  type KernelClient = KernelAccountClient<Transport, ViemChain, SmartAccount, Client, RpcSchema>;
26
- export declare class ZeroDevConnector extends WalletConnectorBase<typeof EthereumWallet> implements IZeroDevConnector {
27
+ export declare class ZeroDevConnector extends AccountAbstractionConnector implements IZeroDevConnector {
27
28
  clientId: string;
28
29
  eoaConnector: InternalWalletConnector | undefined;
29
30
  eoaAddress: string | undefined;
@@ -32,9 +33,7 @@ export declare class ZeroDevConnector extends WalletConnectorBase<typeof Ethereu
32
33
  ChainWallet: typeof EthereumWallet;
33
34
  connectedChain: Chain;
34
35
  supportedChains: Chain[];
35
- evmNetworks: EvmNetwork[];
36
36
  providersConfig: RegisterEvmProvidersConfig;
37
- private isGasSponsorshipDisabled;
38
37
  isEmbeddedWallet: boolean;
39
38
  entryPoint: EntryPointType<EntryPointVersion>;
40
39
  kernelVersion: KERNEL_VERSION_TYPE;
@@ -62,9 +61,9 @@ export declare class ZeroDevConnector extends WalletConnectorBase<typeof Ethereu
62
61
  name: string;
63
62
  };
64
63
  enableEIP7702Mode: boolean;
65
- private _walletUiUtils;
66
64
  private authorization?;
67
65
  constructor(opts: ZeroDevConnectorProps);
66
+ confirmTransactionStatus(): Promise<TransactionReceipt>;
68
67
  get currentNetworkProvider(): {
69
68
  kernelClient: KernelClient;
70
69
  kernelClientWithSponsorship: KernelClient;
@@ -76,15 +75,22 @@ export declare class ZeroDevConnector extends WalletConnectorBase<typeof Ethereu
76
75
  switchNetwork({ networkChainId, }: {
77
76
  networkChainId?: number | string;
78
77
  }): Promise<void>;
79
- /**
80
- * @deprecated You should get the EOA connector by passing the SCW to getEOAConnector,
81
- * from the useSmartWallet hook
82
- */
83
- getEOAConnector(): InternalWalletConnector | undefined;
84
- getAccountAbstractionProvider({ withSponsorship, }?: {
78
+ getAccountAbstractionProvider<T = KernelClient | undefined>({ withSponsorship, }?: {
85
79
  withSponsorship?: boolean;
86
- }): KernelClient | undefined;
80
+ }): T;
87
81
  endSession(): Promise<void>;
82
+ initialize({ smartWalletAddress, eoaAddress, eoaConnector, properties, shouldSetEoaConnector, }: {
83
+ smartWalletAddress: string;
84
+ eoaAddress: string;
85
+ eoaConnector: InternalWalletConnector;
86
+ shouldSetEoaConnector: boolean;
87
+ properties?: {
88
+ ecdsaProviderType?: EcdsaValidatorOptions;
89
+ kernelVersion?: ProviderKernelVersionEnum;
90
+ entryPointVersion?: ProviderEntryPointVersionEnum;
91
+ enableKernelV3Migration?: boolean;
92
+ };
93
+ }): Promise<void>;
88
94
  registerEoa({ smartWalletAddress, eoaAddress, eoaConnector, shouldSetEoaConnector, ...properties }: {
89
95
  smartWalletAddress: string;
90
96
  eoaAddress: string;
@@ -7812,12 +7818,12 @@ export declare class ZeroDevConnector extends WalletConnectorBase<typeof Ethereu
7812
7818
  value?: bigint;
7813
7819
  data?: string;
7814
7820
  }): Promise<boolean>;
7815
- disableGasSponsorshipOnce(): void;
7816
7821
  getBalance(address: string): Promise<string | undefined>;
7817
7822
  signMessage(messageToSign: string): Promise<string | undefined>;
7818
7823
  createUiTransaction(from: string): Promise<IUITransaction>;
7819
7824
  validateActiveWallet(expectedAddress: string): Promise<void>;
7820
7825
  getBlockExplorerUrlsForCurrentNetwork(): Promise<string[]>;
7821
7826
  getEnabledNetworks(): GenericNetwork[];
7827
+ initializeZksyncConnector(): Promise<void>;
7822
7828
  }
7823
7829
  export {};