@dynamic-labs/ethereum-aa 4.11.0 → 4.11.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,23 @@
1
1
 
2
+ ### [4.11.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.11.1...v4.11.2) (2025-04-11)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * correctly expire nonce ([#8518](https://github.com/dynamic-labs/dynamic-auth/issues/8518)) ([14c4eb1](https://github.com/dynamic-labs/dynamic-auth/commit/14c4eb143b8a6debc91fb0cb6aafe8336b370927))
8
+ * profile aspect ratio ([#8510](https://github.com/dynamic-labs/dynamic-auth/issues/8510)) ([869615d](https://github.com/dynamic-labs/dynamic-auth/commit/869615d00144d2df5c61eaa5ab39700114739732))
9
+ * **react-native:** ensure secure storage items are saved sequentially ([#8512](https://github.com/dynamic-labs/dynamic-auth/issues/8512)) ([53e2f7f](https://github.com/dynamic-labs/dynamic-auth/commit/53e2f7f47ce3ae79c781fcd3b9a446a0edbf4246))
10
+ * **react-native:** reload react-native webview when it is unmounted by OS ([#8477](https://github.com/dynamic-labs/dynamic-auth/issues/8477)) ([09e20a4](https://github.com/dynamic-labs/dynamic-auth/commit/09e20a418afd592fa31dffd7645729e0e77a8b3d))
11
+ * **react-native:** sync state with client when SDK fully loaded ([#8476](https://github.com/dynamic-labs/dynamic-auth/issues/8476)) ([bae8814](https://github.com/dynamic-labs/dynamic-auth/commit/bae88141e7d74e1ff453ee33ee16316c18e803d1))
12
+ * wallet standard wallets not sending SOL ([#8515](https://github.com/dynamic-labs/dynamic-auth/issues/8515)) ([0db973a](https://github.com/dynamic-labs/dynamic-auth/commit/0db973aceb5dc05cda142ceffcc925f9523a452d))
13
+
14
+ ### [4.11.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.11.0...v4.11.1) (2025-04-09)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * fix gw api base url default ([#8503](https://github.com/dynamic-labs/dynamic-auth/issues/8503)) ([85ec8e4](https://github.com/dynamic-labs/dynamic-auth/commit/85ec8e465be34d201398114be5e45b8f84ef68cb))
20
+
2
21
  ## [4.11.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.10.4...v4.11.0) (2025-04-08)
3
22
 
4
23
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.11.0";
6
+ var version = "4.11.2";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.11.0";
2
+ var version = "4.11.2";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum-aa",
3
- "version": "4.11.0",
3
+ "version": "4.11.2",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -22,13 +22,13 @@
22
22
  "@zerodev/ecdsa-validator": "5.4.4",
23
23
  "@zerodev/multi-chain-ecdsa-validator": "5.4.3",
24
24
  "@zerodev/sdk": "5.4.26",
25
- "@dynamic-labs/assert-package-version": "4.11.0",
26
- "@dynamic-labs/ethereum-core": "4.11.0",
27
- "@dynamic-labs/logger": "4.11.0",
28
- "@dynamic-labs/types": "4.11.0",
29
- "@dynamic-labs/utils": "4.11.0",
30
- "@dynamic-labs/wallet-book": "4.11.0",
31
- "@dynamic-labs/wallet-connector-core": "4.11.0"
25
+ "@dynamic-labs/assert-package-version": "4.11.2",
26
+ "@dynamic-labs/ethereum-core": "4.11.2",
27
+ "@dynamic-labs/logger": "4.11.2",
28
+ "@dynamic-labs/types": "4.11.2",
29
+ "@dynamic-labs/utils": "4.11.2",
30
+ "@dynamic-labs/wallet-book": "4.11.2",
31
+ "@dynamic-labs/wallet-connector-core": "4.11.2"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "viem": "^2.21.55"
@@ -0,0 +1,75 @@
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 walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
+ var utils = require('@dynamic-labs/utils');
10
+ var ethereumCore = require('@dynamic-labs/ethereum-core');
11
+
12
+ class AccountAbstractionConnector extends walletConnectorCore.WalletConnectorBase {
13
+ constructor(opts) {
14
+ super({ walletBook: opts.walletBook });
15
+ this._isGasSponsorshipDisabled = false;
16
+ this.evmNetworks = [];
17
+ this.ChainWallet = ethereumCore.EthereumWallet;
18
+ this.isEmbeddedWallet = true;
19
+ this.connectedChain = 'EVM';
20
+ this.supportedChains = ['ETH', 'EVM'];
21
+ this._walletUiUtils = opts.walletUiUtils;
22
+ this.evmNetworks = opts.evmNetworks;
23
+ }
24
+ /**
25
+ * Gets the EOA connector associated with this account abstraction wallet
26
+ * @deprecated Use getEOAConnector with a specific smart contract wallet address instead
27
+ */
28
+ getEOAConnector() {
29
+ return this.eoaConnector;
30
+ }
31
+ /**
32
+ * Disables gas sponsorship for the next transaction
33
+ */
34
+ disableGasSponsorshipOnce() {
35
+ this._isGasSponsorshipDisabled = true;
36
+ }
37
+ /**
38
+ * Protected method to check if gas sponsorship is disabled
39
+ */
40
+ isGasSponsorshipDisabled() {
41
+ return this._isGasSponsorshipDisabled;
42
+ }
43
+ /**
44
+ * Gets the enabled networks
45
+ */
46
+ getEnabledNetworks() {
47
+ return this.evmNetworks;
48
+ }
49
+ /**
50
+ * Gets the balance for an address
51
+ */
52
+ getBalance(address) {
53
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
54
+ const publicClient = yield this.getPublicClient();
55
+ if (!publicClient) {
56
+ throw new utils.DynamicError('No public client available');
57
+ }
58
+ const balance = yield publicClient.getBalance({ address });
59
+ return viem.formatEther(balance);
60
+ });
61
+ }
62
+ /**
63
+ * Validates that the expected wallet is active
64
+ */
65
+ validateActiveWallet(expectedAddress) {
66
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
67
+ const currentAddress = yield this.getAddress();
68
+ if ((currentAddress === null || currentAddress === void 0 ? void 0 : currentAddress.toLowerCase()) !== expectedAddress.toLowerCase()) {
69
+ throw new utils.DynamicError('Invalid active wallet');
70
+ }
71
+ });
72
+ }
73
+ }
74
+
75
+ exports.AccountAbstractionConnector = AccountAbstractionConnector;
@@ -0,0 +1,65 @@
1
+ import { Chain, InternalWalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
2
+ import { EthereumWallet } from '@dynamic-labs/ethereum-core';
3
+ import { IUITransaction, WalletUiUtils, GenericNetwork } from '@dynamic-labs/types';
4
+ import { WalletBookSchema } from '@dynamic-labs/wallet-book';
5
+ import { SmartWalletProperties } from '@dynamic-labs/sdk-api-core';
6
+ export type AccountAbstractionConnectorProps = {
7
+ walletUiUtils: WalletUiUtils<InternalWalletConnector>;
8
+ walletBook: WalletBookSchema;
9
+ evmNetworks: GenericNetwork[];
10
+ };
11
+ export declare abstract class AccountAbstractionConnector extends WalletConnectorBase<typeof EthereumWallet> {
12
+ abstract clientId: string;
13
+ abstract eoaConnector: InternalWalletConnector | undefined;
14
+ abstract eoaAddress: string | undefined;
15
+ protected _walletUiUtils: WalletUiUtils<InternalWalletConnector>;
16
+ private _isGasSponsorshipDisabled;
17
+ protected evmNetworks: GenericNetwork[];
18
+ ChainWallet: typeof EthereumWallet;
19
+ isEmbeddedWallet: boolean;
20
+ connectedChain: Chain;
21
+ supportedChains: Chain[];
22
+ constructor(opts: AccountAbstractionConnectorProps);
23
+ /**
24
+ * Gets the EOA connector associated with this account abstraction wallet
25
+ * @deprecated Use getEOAConnector with a specific smart contract wallet address instead
26
+ */
27
+ getEOAConnector(): InternalWalletConnector | undefined;
28
+ /**
29
+ * Disables gas sponsorship for the next transaction
30
+ */
31
+ disableGasSponsorshipOnce(): void;
32
+ /**
33
+ * Protected method to check if gas sponsorship is disabled
34
+ */
35
+ protected isGasSponsorshipDisabled(): boolean;
36
+ /**
37
+ * Gets the enabled networks
38
+ */
39
+ getEnabledNetworks(): GenericNetwork[];
40
+ /**
41
+ * Gets the balance for an address
42
+ */
43
+ getBalance(address: string): Promise<string | undefined>;
44
+ /**
45
+ * Validates that the expected wallet is active
46
+ */
47
+ validateActiveWallet(expectedAddress: string): Promise<void>;
48
+ abstract canSponsorTransactionGas(transaction: {
49
+ from: string;
50
+ to?: string;
51
+ value?: bigint;
52
+ data?: string;
53
+ }): Promise<boolean>;
54
+ abstract createUiTransaction(from: string): Promise<IUITransaction>;
55
+ abstract getAccountAbstractionProvider<T>({ withSponsorship, }: {
56
+ withSponsorship: boolean;
57
+ }): Promise<T>;
58
+ abstract initialize(params: {
59
+ smartWalletAddress: string;
60
+ eoaAddress: string;
61
+ eoaConnector: InternalWalletConnector;
62
+ properties?: SmartWalletProperties;
63
+ shouldSetEoaConnector?: boolean;
64
+ }): Promise<void>;
65
+ }
@@ -0,0 +1,71 @@
1
+ 'use client'
2
+ import { __awaiter } from '../_virtual/_tslib.js';
3
+ import { formatEther } from 'viem';
4
+ import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
5
+ import { DynamicError } from '@dynamic-labs/utils';
6
+ import { EthereumWallet } from '@dynamic-labs/ethereum-core';
7
+
8
+ class AccountAbstractionConnector extends WalletConnectorBase {
9
+ constructor(opts) {
10
+ super({ walletBook: opts.walletBook });
11
+ this._isGasSponsorshipDisabled = false;
12
+ this.evmNetworks = [];
13
+ this.ChainWallet = EthereumWallet;
14
+ this.isEmbeddedWallet = true;
15
+ this.connectedChain = 'EVM';
16
+ this.supportedChains = ['ETH', 'EVM'];
17
+ this._walletUiUtils = opts.walletUiUtils;
18
+ this.evmNetworks = opts.evmNetworks;
19
+ }
20
+ /**
21
+ * Gets the EOA connector associated with this account abstraction wallet
22
+ * @deprecated Use getEOAConnector with a specific smart contract wallet address instead
23
+ */
24
+ getEOAConnector() {
25
+ return this.eoaConnector;
26
+ }
27
+ /**
28
+ * Disables gas sponsorship for the next transaction
29
+ */
30
+ disableGasSponsorshipOnce() {
31
+ this._isGasSponsorshipDisabled = true;
32
+ }
33
+ /**
34
+ * Protected method to check if gas sponsorship is disabled
35
+ */
36
+ isGasSponsorshipDisabled() {
37
+ return this._isGasSponsorshipDisabled;
38
+ }
39
+ /**
40
+ * Gets the enabled networks
41
+ */
42
+ getEnabledNetworks() {
43
+ return this.evmNetworks;
44
+ }
45
+ /**
46
+ * Gets the balance for an address
47
+ */
48
+ getBalance(address) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const publicClient = yield this.getPublicClient();
51
+ if (!publicClient) {
52
+ throw new DynamicError('No public client available');
53
+ }
54
+ const balance = yield publicClient.getBalance({ address });
55
+ return formatEther(balance);
56
+ });
57
+ }
58
+ /**
59
+ * Validates that the expected wallet is active
60
+ */
61
+ validateActiveWallet(expectedAddress) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ const currentAddress = yield this.getAddress();
64
+ if ((currentAddress === null || currentAddress === void 0 ? void 0 : currentAddress.toLowerCase()) !== expectedAddress.toLowerCase()) {
65
+ throw new DynamicError('Invalid active wallet');
66
+ }
67
+ });
68
+ }
69
+ }
70
+
71
+ export { AccountAbstractionConnector };
@@ -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"]);
@@ -369,7 +373,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
369
373
  onSendTransaction: (_b) => _tslib.__awaiter(this, [_b], void 0, function* ({ transaction }) {
370
374
  try {
371
375
  this._walletUiUtils.disabledConfirmationOnce();
372
- const effectiveProvider = this.isGasSponsorshipDisabled
376
+ const effectiveProvider = this.isGasSponsorshipDisabled()
373
377
  ? provider
374
378
  : this.kernelClientWithSponsorship;
375
379
  if (!effectiveProvider) {
@@ -540,9 +544,6 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
540
544
  return sponsored;
541
545
  });
542
546
  }
543
- disableGasSponsorshipOnce() {
544
- this.isGasSponsorshipDisabled = true;
545
- }
546
547
  getBalance(address) {
547
548
  return _tslib.__awaiter(this, void 0, void 0, function* () {
548
549
  var _a;
@@ -5,12 +5,13 @@ import { SignAuthorizationReturnType } from 'viem/accounts';
5
5
  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
- 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';
8
+ import { EcdsaValidatorOptions, Provider, ProviderEntryPointVersionEnum, ProviderEnum, ProviderKernelVersionEnum, ProviderMultichainAccountAbstractionProviders, SmartWalletProperties } from '@dynamic-labs/sdk-api-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,17 @@ 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?: SmartWalletProperties;
88
+ }): Promise<void>;
88
89
  registerEoa({ smartWalletAddress, eoaAddress, eoaConnector, shouldSetEoaConnector, ...properties }: {
89
90
  smartWalletAddress: string;
90
91
  eoaAddress: string;
@@ -7812,7 +7813,6 @@ export declare class ZeroDevConnector extends WalletConnectorBase<typeof Ethereu
7812
7813
  value?: bigint;
7813
7814
  data?: string;
7814
7815
  }): Promise<boolean>;
7815
- disableGasSponsorshipOnce(): void;
7816
7816
  getBalance(address: string): Promise<string | undefined>;
7817
7817
  signMessage(messageToSign: string): Promise<string | undefined>;
7818
7818
  createUiTransaction(from: string): Promise<IUITransaction>;
@@ -4,7 +4,7 @@ import { publicActions, custom, createWalletClient, toHex, formatEther } from 'v
4
4
  import { toAccount } from 'viem/accounts';
5
5
  import { KERNEL_V3_3_BETA, KernelVersionToAddressesMap, getEntryPoint as getEntryPoint$1 } from '@zerodev/sdk/constants';
6
6
  import { EthereumWallet, isEthWalletConnector, chainsMap, confirmationTransport, unFormatTransaction, createViemUiTransaction } from '@dynamic-labs/ethereum-core';
7
- import { WalletConnectorBase, eventListenerHandlers, isTurnkeyWalletConnector } from '@dynamic-labs/wallet-connector-core';
7
+ import { eventListenerHandlers, isTurnkeyWalletConnector } from '@dynamic-labs/wallet-connector-core';
8
8
  import { parseEvmNetworks, StorageService, DynamicError, DeferredPromise, parseChainId, wrapMethodWithCallback, TransactionGasCannotBeSponsoredError, InsufficientFundsError } from '@dynamic-labs/utils';
9
9
  import { ZERO_DEV_LAST_USED_CHAIN_ID_KEY } from './constants.js';
10
10
  import { logger } from './utils/logger.js';
@@ -12,8 +12,9 @@ import { createEcdsaKernelAccountClientWith7702, createEcdsaKernelAccountClient
12
12
  import { getEcdsaValidator } from './utils/getEcdsaValidator.js';
13
13
  import { getEntryPoint } from './utils/getEntryPoint.js';
14
14
  import { getKernelVersion } from './utils/getKernelVersion.js';
15
+ import { AccountAbstractionConnector } from './AccountAbstractionConnector.js';
15
16
 
16
- class ZeroDevConnector extends WalletConnectorBase {
17
+ class ZeroDevConnector extends AccountAbstractionConnector {
17
18
  constructor(opts) {
18
19
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
19
20
  super(opts);
@@ -24,7 +25,6 @@ class ZeroDevConnector extends WalletConnectorBase {
24
25
  this.ChainWallet = EthereumWallet;
25
26
  this.connectedChain = 'EVM';
26
27
  this.supportedChains = ['ETH', 'EVM'];
27
- this.isGasSponsorshipDisabled = false;
28
28
  this.isEmbeddedWallet = true;
29
29
  this.providersFromApi = [];
30
30
  this.name = 'ZeroDev';
@@ -56,6 +56,9 @@ class ZeroDevConnector extends WalletConnectorBase {
56
56
  this.defaultChainId = defaultProvider === null || defaultProvider === void 0 ? void 0 : defaultProvider.chain;
57
57
  this.ecdsaProviderType = (_j = opts.apiProviders.zerodev) === null || _j === void 0 ? void 0 : _j.ecdsaProviderType;
58
58
  }
59
+ confirmTransactionStatus() {
60
+ throw new Error('confirmTransactionStatus not implemented in ZeroDevConnector');
61
+ }
59
62
  get currentNetworkProvider() {
60
63
  // check if the last used chain id is in the provider map
61
64
  if (this.providerMap[this.lastUsedChainId]) {
@@ -100,13 +103,6 @@ class ZeroDevConnector extends WalletConnectorBase {
100
103
  handleChainChange(chainId);
101
104
  });
102
105
  }
103
- /**
104
- * @deprecated You should get the EOA connector by passing the SCW to getEOAConnector,
105
- * from the useSmartWallet hook
106
- */
107
- getEOAConnector() {
108
- return this.eoaConnector;
109
- }
110
106
  getAccountAbstractionProvider({ withSponsorship, } = {}) {
111
107
  if (withSponsorship && this.kernelClientWithSponsorship) {
112
108
  return this.kernelClientWithSponsorship;
@@ -118,6 +114,14 @@ class ZeroDevConnector extends WalletConnectorBase {
118
114
  StorageService.removeItem(ZERO_DEV_LAST_USED_CHAIN_ID_KEY);
119
115
  });
120
116
  }
117
+ initialize(_a) {
118
+ return __awaiter(this, arguments, void 0, function* ({ smartWalletAddress, eoaAddress, eoaConnector, properties, shouldSetEoaConnector, }) {
119
+ yield this.registerEoa(Object.assign({ eoaAddress,
120
+ eoaConnector,
121
+ shouldSetEoaConnector,
122
+ smartWalletAddress }, properties));
123
+ });
124
+ }
121
125
  registerEoa(_a) {
122
126
  return __awaiter(this, void 0, void 0, function* () {
123
127
  var { smartWalletAddress, eoaAddress, eoaConnector, shouldSetEoaConnector = false } = _a, properties = __rest(_a, ["smartWalletAddress", "eoaAddress", "eoaConnector", "shouldSetEoaConnector"]);
@@ -365,7 +369,7 @@ class ZeroDevConnector extends WalletConnectorBase {
365
369
  onSendTransaction: (_b) => __awaiter(this, [_b], void 0, function* ({ transaction }) {
366
370
  try {
367
371
  this._walletUiUtils.disabledConfirmationOnce();
368
- const effectiveProvider = this.isGasSponsorshipDisabled
372
+ const effectiveProvider = this.isGasSponsorshipDisabled()
369
373
  ? provider
370
374
  : this.kernelClientWithSponsorship;
371
375
  if (!effectiveProvider) {
@@ -536,9 +540,6 @@ class ZeroDevConnector extends WalletConnectorBase {
536
540
  return sponsored;
537
541
  });
538
542
  }
539
- disableGasSponsorshipOnce() {
540
- this.isGasSponsorshipDisabled = true;
541
- }
542
543
  getBalance(address) {
543
544
  return __awaiter(this, void 0, void 0, function* () {
544
545
  var _a;