@dynamic-labs/ethereum-aa 4.0.0-alpha.5 → 4.0.0-alpha.7

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,43 @@
1
1
 
2
+ ## [4.0.0-alpha.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.6...v4.0.0-alpha.7) (2024-10-03)
3
+
4
+
5
+ ### Features
6
+
7
+ * add account abstraction module to client ([#7002](https://github.com/dynamic-labs/dynamic-auth/issues/7002)) ([2f06975](https://github.com/dynamic-labs/dynamic-auth/commit/2f06975083dfa9d40537ef4a99b414eda1a68e01))
8
+ * add support for wallet events in rn ([#7061](https://github.com/dynamic-labs/dynamic-auth/issues/7061)) ([c7c4ce5](https://github.com/dynamic-labs/dynamic-auth/commit/c7c4ce51f27a2b84a1710c120d7006a00920c1e7))
9
+ * add zerodev extension for react native ([#7028](https://github.com/dynamic-labs/dynamic-auth/issues/7028)) ([858b8a8](https://github.com/dynamic-labs/dynamic-auth/commit/858b8a851cfa0cddc8e4559541b03992cf5ccdfc))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * do not modify sol tx blockhash as tx could have been signed already ([#7050](https://github.com/dynamic-labs/dynamic-auth/issues/7050)) ([770edb4](https://github.com/dynamic-labs/dynamic-auth/commit/770edb49ddc231b75fb45a9f6d563f22e5185df2))
15
+ * ensure the correct auth mode is used on social redirect ([#7047](https://github.com/dynamic-labs/dynamic-auth/issues/7047)) ([7c27172](https://github.com/dynamic-labs/dynamic-auth/commit/7c271721d5ddf19e3fd1bf56ddb1d49e0e2bca07))
16
+ * prevent react native message timeout before sdk is ready ([#7051](https://github.com/dynamic-labs/dynamic-auth/issues/7051)) ([6421237](https://github.com/dynamic-labs/dynamic-auth/commit/6421237d677d788b824d53432c1a75b9d571aa78))
17
+ * update version error text ([#7054](https://github.com/dynamic-labs/dynamic-auth/issues/7054)) ([713dacb](https://github.com/dynamic-labs/dynamic-auth/commit/713dacb79c2513323c2e6840d7418716011c2dcd))
18
+ * use project settings sdk network for send flow ([#7011](https://github.com/dynamic-labs/dynamic-auth/issues/7011)) ([983e796](https://github.com/dynamic-labs/dynamic-auth/commit/983e79632762f71ee0502c92057a32ea985ae19c))
19
+
20
+ ## [4.0.0-alpha.6](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.5...v4.0.0-alpha.6) (2024-10-01)
21
+
22
+
23
+ ### ⚠ BREAKING CHANGES
24
+
25
+ * remove support to magic ([#7033](https://github.com/dynamic-labs/dynamic-auth/issues/7033)) ([0fdc41f](https://github.com/dynamic-labs/dynamic-auth/commit/0fdc41f05f87b32f56b73db068f984f18bdf69a0))
26
+
27
+ ### Features
28
+
29
+ * global connectivity disconnect ([#7008](https://github.com/dynamic-labs/dynamic-auth/issues/7008)) ([80d705b](https://github.com/dynamic-labs/dynamic-auth/commit/80d705ba252aa3b01cbf4861507fed00e460215f))
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * add popper context to send balance ([#7016](https://github.com/dynamic-labs/dynamic-auth/issues/7016)) ([73aa6f1](https://github.com/dynamic-labs/dynamic-auth/commit/73aa6f122afe0db660ebb654f3e018ae7bf445c5))
35
+ * add retry to useConnectWithOtp ([#7012](https://github.com/dynamic-labs/dynamic-auth/issues/7012)) ([d551d72](https://github.com/dynamic-labs/dynamic-auth/commit/d551d72a463f8a03964858b30ec174d41985a7b1))
36
+ * don't re-fetch wallet address on network change ([#7019](https://github.com/dynamic-labs/dynamic-auth/issues/7019)) ([4e7900c](https://github.com/dynamic-labs/dynamic-auth/commit/4e7900cc24b3abda736bc81466eda7512cf7fc61))
37
+ * fix sign message with solana wallet standard provider ([#7014](https://github.com/dynamic-labs/dynamic-auth/issues/7014)) ([ffaf972](https://github.com/dynamic-labs/dynamic-auth/commit/ffaf972e8b190b0b8cd0103e0ef67bfdee6c8f7c))
38
+ * update wallet reference when user switches wallet in connect-only ([#7030](https://github.com/dynamic-labs/dynamic-auth/issues/7030)) ([75d9aa6](https://github.com/dynamic-labs/dynamic-auth/commit/75d9aa66f63fc5536caeff12d8b860c0ba86106f))
39
+
40
+
2
41
  ## [4.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.4...v4.0.0-alpha.5) (2024-09-25)
3
42
 
4
43
 
package/package.cjs ADDED
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var version = "4.0.0-alpha.7";
7
+
8
+ exports.version = version;
package/package.js ADDED
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ var version = "4.0.0-alpha.7";
3
+
4
+ export { version };
package/package.json CHANGED
@@ -1,16 +1,7 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum-aa",
3
- "version": "4.0.0-alpha.5",
4
- "repository": {
5
- "type": "git",
6
- "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
7
- "directory": "packages/ethereum-aa"
8
- },
3
+ "version": "4.0.0-alpha.7",
9
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
10
- "bugs": {
11
- "url": "https://github.com/dynamic-labs/DynamicAuth/issues"
12
- },
13
- "homepage": "https://github.com/dynamic-labs/DynamicAuth#readme",
14
5
  "author": "Dynamic Labs, Inc.",
15
6
  "license": "MIT",
16
7
  "main": "./src/index.cjs",
@@ -25,18 +16,20 @@
25
16
  },
26
17
  "./package.json": "./package.json"
27
18
  },
19
+ "homepage": "https://www.dynamic.xyz/",
28
20
  "dependencies": {
29
21
  "@dynamic-labs/sdk-api-core": "0.0.535",
30
22
  "@zerodev/ecdsa-validator": "5.3.1",
31
23
  "@zerodev/multi-chain-validator": "5.3.3",
32
24
  "@zerodev/sdk": "5.3.4",
33
25
  "permissionless": "^0.1.20",
34
- "@dynamic-labs/ethereum-core": "4.0.0-alpha.5",
35
- "@dynamic-labs/logger": "4.0.0-alpha.5",
36
- "@dynamic-labs/types": "4.0.0-alpha.5",
37
- "@dynamic-labs/utils": "4.0.0-alpha.5",
38
- "@dynamic-labs/wallet-book": "4.0.0-alpha.5",
39
- "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.5"
26
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.7",
27
+ "@dynamic-labs/ethereum-core": "4.0.0-alpha.7",
28
+ "@dynamic-labs/logger": "4.0.0-alpha.7",
29
+ "@dynamic-labs/types": "4.0.0-alpha.7",
30
+ "@dynamic-labs/utils": "4.0.0-alpha.7",
31
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.7",
32
+ "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.7"
40
33
  },
41
34
  "peerDependencies": {
42
35
  "viem": "^2.7.6"
@@ -4,18 +4,17 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../_virtual/_tslib.cjs');
7
- var multiChainValidator = require('@zerodev/multi-chain-validator');
8
7
  var viem = require('viem');
9
8
  var utils$1 = require('permissionless/utils');
10
- var constants = require('@zerodev/sdk/constants');
11
- var ecdsaValidator = require('@zerodev/ecdsa-validator');
12
- var sdkApiCore = require('@dynamic-labs/sdk-api-core');
13
9
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
14
10
  var ethereumCore = require('@dynamic-labs/ethereum-core');
15
11
  var utils = require('@dynamic-labs/utils');
16
- var fetchChain = require('./utils/fetchChain.cjs');
12
+ var fetchZeroDevChain = require('./utils/fetchZeroDevChain.cjs');
17
13
  var logger = require('./utils/logger.cjs');
18
14
  var createEcsdaKernelAccountClient = require('./utils/createEcsdaKernelAccountClient.cjs');
15
+ var getEcdsaValidator = require('./utils/getEcdsaValidator.cjs');
16
+ var getEntryPoint = require('./utils/getEntryPoint.cjs');
17
+ var getKernelVersion = require('./utils/getKernelVersion.cjs');
19
18
 
20
19
  class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
21
20
  constructor(opts) {
@@ -42,53 +41,10 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
42
41
  this.projectId = zeroDevProjectId;
43
42
  this._walletUiUtils = opts.walletUiUtils;
44
43
  this.evmNetworks = utils.parseEvmNetworks(opts.evmNetworks);
45
- this.entryPoint = this.getEntryPoint((_b = opts.apiProviders.zerodev) === null || _b === void 0 ? void 0 : _b.entryPointVersion);
46
- this.kernelVersion = this.getKernelVersion((_c = opts.apiProviders.zerodev) === null || _c === void 0 ? void 0 : _c.kernelVersion);
44
+ this.entryPoint = getEntryPoint.getEntryPoint((_b = opts.apiProviders.zerodev) === null || _b === void 0 ? void 0 : _b.entryPointVersion);
45
+ this.kernelVersion = getKernelVersion.getKernelVersion((_c = opts.apiProviders.zerodev) === null || _c === void 0 ? void 0 : _c.kernelVersion, this.entryPoint);
47
46
  this.ecdsaProviderType = (_d = opts.apiProviders.zerodev) === null || _d === void 0 ? void 0 : _d.ecdsaProviderType;
48
47
  }
49
- getEntryPoint(entryPoint) {
50
- if (entryPoint === undefined ||
51
- entryPoint === sdkApiCore.ProviderEntryPointVersionEnum.V7) {
52
- return utils$1.ENTRYPOINT_ADDRESS_V07;
53
- }
54
- else if (entryPoint === sdkApiCore.ProviderEntryPointVersionEnum.V6) {
55
- return utils$1.ENTRYPOINT_ADDRESS_V06;
56
- }
57
- else {
58
- logger.logger.error('Invalid entry point version', entryPoint);
59
- return utils$1.ENTRYPOINT_ADDRESS_V07;
60
- }
61
- }
62
- getKernelVersion(kernelVersion) {
63
- if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V31 ||
64
- (kernelVersion === undefined &&
65
- this.entryPoint === utils$1.ENTRYPOINT_ADDRESS_V07)) {
66
- return constants.KERNEL_V3_1;
67
- }
68
- else if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V30) {
69
- return constants.KERNEL_V3_0;
70
- }
71
- else if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V24 ||
72
- this.entryPoint === utils$1.ENTRYPOINT_ADDRESS_V06 // v0.6 only supports v2.4
73
- ) {
74
- return constants.KERNEL_V2_4;
75
- }
76
- else {
77
- logger.logger.error('Invalid kernel version', kernelVersion);
78
- return constants.KERNEL_V3_1;
79
- }
80
- }
81
- getEcdsaValidator(ecdsaProviderType) {
82
- if (ecdsaProviderType === 'zerodev_signer_to_ecdsa') {
83
- return ecdsaValidator.signerToEcdsaValidator;
84
- }
85
- else if (ecdsaProviderType === 'zerodev_multi_chain') {
86
- return multiChainValidator.toMultiChainECDSAValidator;
87
- }
88
- else {
89
- return ecdsaValidator.signerToEcdsaValidator;
90
- }
91
- }
92
48
  /**
93
49
  * @deprecated You should get the EOA connector by passing the SCW to getEOAConnector,
94
50
  * from the useSmartWallet hook
@@ -104,7 +60,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
104
60
  }
105
61
  endSession() {
106
62
  return _tslib.__awaiter(this, void 0, void 0, function* () {
107
- localStorage.removeItem(fetchChain.cachedChainIdKey);
63
+ localStorage.removeItem(fetchZeroDevChain.cachedChainIdKey);
108
64
  });
109
65
  }
110
66
  setEoaConnector(connector) {
@@ -126,8 +82,8 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
126
82
  }
127
83
  const kernelClient = yield createEcsdaKernelAccountClient.createEcdsaKernelAccountClient({
128
84
  bundlerRpc: ZeroDevConnector.bundlerRpc,
129
- chain: yield fetchChain.fetchChain(this.projectId),
130
- ecdsaValidator: this.getEcdsaValidator(this.ecdsaProviderType),
85
+ chain: yield fetchZeroDevChain.fetchZeroDevChain(this.projectId),
86
+ ecdsaValidator: getEcdsaValidator.getEcdsaValidator(this.ecdsaProviderType),
131
87
  entryPointAddress: this.entryPoint,
132
88
  kernelVersion: this.kernelVersion,
133
89
  paymaster: 'NONE',
@@ -170,8 +126,8 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
170
126
  const signer = yield eoaConnector.getSigner();
171
127
  this.kernelClientWithSponsorship = yield createEcsdaKernelAccountClient.createEcdsaKernelAccountClient({
172
128
  bundlerRpc: ZeroDevConnector.bundlerRpc,
173
- chain: yield fetchChain.fetchChain(this.projectId),
174
- ecdsaValidator: this.getEcdsaValidator(this.ecdsaProviderType),
129
+ chain: yield fetchZeroDevChain.fetchZeroDevChain(this.projectId),
130
+ ecdsaValidator: getEcdsaValidator.getEcdsaValidator(this.ecdsaProviderType),
175
131
  entryPointAddress: this.entryPoint,
176
132
  kernelVersion: this.kernelVersion,
177
133
  paymaster: 'SPONSOR',
@@ -1,11 +1,9 @@
1
1
  import { KernelAccountClient } from '@zerodev/sdk/clients';
2
2
  import { KernelSmartAccount } from '@zerodev/sdk/accounts';
3
- import { toMultiChainECDSAValidator } from '@zerodev/multi-chain-validator';
4
3
  import { Account, PublicClient, Transport, WalletClient } from 'viem';
5
4
  import { type Chain as ViemChain } from 'viem/chains';
6
5
  import { EntryPoint } from 'permissionless/types';
7
6
  import { KERNEL_VERSION_TYPE } from '@zerodev/sdk/types';
8
- import { signerToEcdsaValidator } from '@zerodev/ecdsa-validator';
9
7
  import { Provider, ProviderEnum } from '@dynamic-labs/sdk-api-core';
10
8
  import { Chain, IAccountAbstractionWalletConnector, ISendBalanceWalletConnector, InternalWalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
11
9
  import { EthereumWallet } from '@dynamic-labs/ethereum-core';
@@ -56,9 +54,6 @@ export declare class ZeroDevConnector extends WalletConnectorBase<typeof Ethereu
56
54
  };
57
55
  private _walletUiUtils;
58
56
  constructor(opts: ZeroDevConnectorProps);
59
- getEntryPoint(entryPoint: string | undefined): "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789" | "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
60
- getKernelVersion(kernelVersion: string | undefined): KERNEL_VERSION_TYPE;
61
- getEcdsaValidator(ecdsaProviderType: string | undefined): typeof signerToEcdsaValidator | typeof toMultiChainECDSAValidator;
62
57
  /**
63
58
  * @deprecated You should get the EOA connector by passing the SCW to getEOAConnector,
64
59
  * from the useSmartWallet hook
@@ -1,17 +1,16 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../_virtual/_tslib.js';
3
- import { toMultiChainECDSAValidator } from '@zerodev/multi-chain-validator';
4
3
  import { publicActions, custom, createWalletClient, isHex, fromHex, formatEther } from 'viem';
5
- import { ENTRYPOINT_ADDRESS_V07, ENTRYPOINT_ADDRESS_V06, walletClientToSmartAccountSigner } from 'permissionless/utils';
6
- import { KERNEL_V3_1, KERNEL_V3_0, KERNEL_V2_4 } from '@zerodev/sdk/constants';
7
- import { signerToEcdsaValidator } from '@zerodev/ecdsa-validator';
8
- import { ProviderEntryPointVersionEnum, ProviderKernelVersionEnum } from '@dynamic-labs/sdk-api-core';
4
+ import { walletClientToSmartAccountSigner } from 'permissionless/utils';
9
5
  import { WalletConnectorBase, isTurnkeyWalletConnector } from '@dynamic-labs/wallet-connector-core';
10
- import { EthereumWallet, confirmationTransport, chainsMap, isEthWalletConnector, unFormatTransaction, createViemUiTransaction } from '@dynamic-labs/ethereum-core';
11
- import { parseEvmNetworks, DynamicError, DeferredPromise, wrapMethodWithCallback, TransactionGasCannotBeSponsoredError, InsufficientFundsError } from '@dynamic-labs/utils';
12
- import { cachedChainIdKey, fetchChain } from './utils/fetchChain.js';
6
+ import { EthereumWallet, isEthWalletConnector, confirmationTransport, unFormatTransaction, chainsMap, createViemUiTransaction } from '@dynamic-labs/ethereum-core';
7
+ import { parseEvmNetworks, DeferredPromise, wrapMethodWithCallback, DynamicError, TransactionGasCannotBeSponsoredError, InsufficientFundsError } from '@dynamic-labs/utils';
8
+ import { cachedChainIdKey, fetchZeroDevChain } from './utils/fetchZeroDevChain.js';
13
9
  import { logger } from './utils/logger.js';
14
10
  import { createEcdsaKernelAccountClient } from './utils/createEcsdaKernelAccountClient.js';
11
+ import { getEcdsaValidator } from './utils/getEcdsaValidator.js';
12
+ import { getEntryPoint } from './utils/getEntryPoint.js';
13
+ import { getKernelVersion } from './utils/getKernelVersion.js';
15
14
 
16
15
  class ZeroDevConnector extends WalletConnectorBase {
17
16
  constructor(opts) {
@@ -38,53 +37,10 @@ class ZeroDevConnector extends WalletConnectorBase {
38
37
  this.projectId = zeroDevProjectId;
39
38
  this._walletUiUtils = opts.walletUiUtils;
40
39
  this.evmNetworks = parseEvmNetworks(opts.evmNetworks);
41
- this.entryPoint = this.getEntryPoint((_b = opts.apiProviders.zerodev) === null || _b === void 0 ? void 0 : _b.entryPointVersion);
42
- this.kernelVersion = this.getKernelVersion((_c = opts.apiProviders.zerodev) === null || _c === void 0 ? void 0 : _c.kernelVersion);
40
+ this.entryPoint = getEntryPoint((_b = opts.apiProviders.zerodev) === null || _b === void 0 ? void 0 : _b.entryPointVersion);
41
+ this.kernelVersion = getKernelVersion((_c = opts.apiProviders.zerodev) === null || _c === void 0 ? void 0 : _c.kernelVersion, this.entryPoint);
43
42
  this.ecdsaProviderType = (_d = opts.apiProviders.zerodev) === null || _d === void 0 ? void 0 : _d.ecdsaProviderType;
44
43
  }
45
- getEntryPoint(entryPoint) {
46
- if (entryPoint === undefined ||
47
- entryPoint === ProviderEntryPointVersionEnum.V7) {
48
- return ENTRYPOINT_ADDRESS_V07;
49
- }
50
- else if (entryPoint === ProviderEntryPointVersionEnum.V6) {
51
- return ENTRYPOINT_ADDRESS_V06;
52
- }
53
- else {
54
- logger.error('Invalid entry point version', entryPoint);
55
- return ENTRYPOINT_ADDRESS_V07;
56
- }
57
- }
58
- getKernelVersion(kernelVersion) {
59
- if (kernelVersion === ProviderKernelVersionEnum.V31 ||
60
- (kernelVersion === undefined &&
61
- this.entryPoint === ENTRYPOINT_ADDRESS_V07)) {
62
- return KERNEL_V3_1;
63
- }
64
- else if (kernelVersion === ProviderKernelVersionEnum.V30) {
65
- return KERNEL_V3_0;
66
- }
67
- else if (kernelVersion === ProviderKernelVersionEnum.V24 ||
68
- this.entryPoint === ENTRYPOINT_ADDRESS_V06 // v0.6 only supports v2.4
69
- ) {
70
- return KERNEL_V2_4;
71
- }
72
- else {
73
- logger.error('Invalid kernel version', kernelVersion);
74
- return KERNEL_V3_1;
75
- }
76
- }
77
- getEcdsaValidator(ecdsaProviderType) {
78
- if (ecdsaProviderType === 'zerodev_signer_to_ecdsa') {
79
- return signerToEcdsaValidator;
80
- }
81
- else if (ecdsaProviderType === 'zerodev_multi_chain') {
82
- return toMultiChainECDSAValidator;
83
- }
84
- else {
85
- return signerToEcdsaValidator;
86
- }
87
- }
88
44
  /**
89
45
  * @deprecated You should get the EOA connector by passing the SCW to getEOAConnector,
90
46
  * from the useSmartWallet hook
@@ -122,8 +78,8 @@ class ZeroDevConnector extends WalletConnectorBase {
122
78
  }
123
79
  const kernelClient = yield createEcdsaKernelAccountClient({
124
80
  bundlerRpc: ZeroDevConnector.bundlerRpc,
125
- chain: yield fetchChain(this.projectId),
126
- ecdsaValidator: this.getEcdsaValidator(this.ecdsaProviderType),
81
+ chain: yield fetchZeroDevChain(this.projectId),
82
+ ecdsaValidator: getEcdsaValidator(this.ecdsaProviderType),
127
83
  entryPointAddress: this.entryPoint,
128
84
  kernelVersion: this.kernelVersion,
129
85
  paymaster: 'NONE',
@@ -166,8 +122,8 @@ class ZeroDevConnector extends WalletConnectorBase {
166
122
  const signer = yield eoaConnector.getSigner();
167
123
  this.kernelClientWithSponsorship = yield createEcdsaKernelAccountClient({
168
124
  bundlerRpc: ZeroDevConnector.bundlerRpc,
169
- chain: yield fetchChain(this.projectId),
170
- ecdsaValidator: this.getEcdsaValidator(this.ecdsaProviderType),
125
+ chain: yield fetchZeroDevChain(this.projectId),
126
+ ecdsaValidator: getEcdsaValidator(this.ecdsaProviderType),
171
127
  entryPointAddress: this.entryPoint,
172
128
  kernelVersion: this.kernelVersion,
173
129
  paymaster: 'SPONSOR',
package/src/index.cjs CHANGED
@@ -3,10 +3,18 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
+ var assertPackageVersion = require('@dynamic-labs/assert-package-version');
7
+ var _package = require('../package.cjs');
6
8
  var ZeroDevConnector = require('./ZeroDevConnector.cjs');
9
+ var createEcsdaKernelAccountClient = require('./utils/createEcsdaKernelAccountClient.cjs');
10
+ var fetchZeroDevChain = require('./utils/fetchZeroDevChain.cjs');
11
+ var getEcdsaValidator = require('./utils/getEcdsaValidator.cjs');
12
+ var getEntryPoint = require('./utils/getEntryPoint.cjs');
13
+ var getKernelVersion = require('./utils/getKernelVersion.cjs');
7
14
  var ethereumAa = require('./ethereum-aa.cjs');
8
15
  var isZeroDevConnector = require('./utils/isZeroDevConnector.cjs');
9
16
 
17
+ assertPackageVersion.assertPackageVersion('@dynamic-labs/ethereum-aa', _package.version);
10
18
  const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, bundlerRpc, paymasterRpc, } = {}) => {
11
19
  ZeroDevConnector.ZeroDevConnector.bundlerProvider = bundlerProvider;
12
20
  ZeroDevConnector.ZeroDevConnector.bundlerRpc = bundlerRpc;
@@ -21,6 +29,11 @@ const ZeroDevSmartWalletConnectors = (props) => {
21
29
  return [];
22
30
  };
23
31
 
32
+ exports.createEcdsaKernelAccountClient = createEcsdaKernelAccountClient.createEcdsaKernelAccountClient;
33
+ exports.fetchZeroDevChain = fetchZeroDevChain.fetchZeroDevChain;
34
+ exports.getEcdsaValidator = getEcdsaValidator.getEcdsaValidator;
35
+ exports.getEntryPoint = getEntryPoint.getEntryPoint;
36
+ exports.getKernelVersion = getKernelVersion.getKernelVersion;
24
37
  exports.EthereumAaConnector = ethereumAa.EthereumAaConnector;
25
38
  exports.isZeroDevConnector = isZeroDevConnector.isZeroDevConnector;
26
39
  exports.ZeroDevSmartWalletConnectors = ZeroDevSmartWalletConnectors;
package/src/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
2
2
  import { BundlerProvider } from './utils';
3
+ export { createEcdsaKernelAccountClient, type BundlerProvider, type PaymasterType, } from './utils/createEcsdaKernelAccountClient';
4
+ export { fetchZeroDevChain } from './utils/fetchZeroDevChain';
5
+ export { getEcdsaValidator } from './utils/getEcdsaValidator';
6
+ export { getEntryPoint } from './utils/getEntryPoint';
7
+ export { getKernelVersion } from './utils/getKernelVersion';
3
8
  export * from './ethereum-aa';
4
9
  export { isZeroDevConnector } from './utils/isZeroDevConnector';
5
10
  export declare const ZeroDevSmartWalletConnectorsWithConfig: ({ bundlerProvider, bundlerRpc, paymasterRpc, }?: {
package/src/index.js CHANGED
@@ -1,8 +1,16 @@
1
1
  'use client'
2
+ import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
3
+ import { version } from '../package.js';
2
4
  import { ZeroDevConnector } from './ZeroDevConnector.js';
5
+ export { createEcdsaKernelAccountClient } from './utils/createEcsdaKernelAccountClient.js';
6
+ export { fetchZeroDevChain } from './utils/fetchZeroDevChain.js';
7
+ export { getEcdsaValidator } from './utils/getEcdsaValidator.js';
8
+ export { getEntryPoint } from './utils/getEntryPoint.js';
9
+ export { getKernelVersion } from './utils/getKernelVersion.js';
3
10
  export { EthereumAaConnector } from './ethereum-aa.js';
4
11
  export { isZeroDevConnector } from './utils/isZeroDevConnector.js';
5
12
 
13
+ assertPackageVersion('@dynamic-labs/ethereum-aa', version);
6
14
  const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, bundlerRpc, paymasterRpc, } = {}) => {
7
15
  ZeroDevConnector.bundlerProvider = bundlerProvider;
8
16
  ZeroDevConnector.bundlerRpc = bundlerRpc;
@@ -8,7 +8,7 @@ var ethereumCore = require('@dynamic-labs/ethereum-core');
8
8
  var logger = require('./logger.cjs');
9
9
 
10
10
  const cachedChainIdKey = 'dynamic_zd_chain_id';
11
- const fetchChain = (projectId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
11
+ const fetchZeroDevChain = (projectId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
12
12
  try {
13
13
  const cachedChainId = localStorage.getItem(cachedChainIdKey);
14
14
  if (cachedChainId) {
@@ -26,4 +26,4 @@ const fetchChain = (projectId) => _tslib.__awaiter(void 0, void 0, void 0, funct
26
26
  });
27
27
 
28
28
  exports.cachedChainIdKey = cachedChainIdKey;
29
- exports.fetchChain = fetchChain;
29
+ exports.fetchZeroDevChain = fetchZeroDevChain;
@@ -1,3 +1,3 @@
1
1
  import { type Chain } from 'viem/chains';
2
2
  export declare const cachedChainIdKey = "dynamic_zd_chain_id";
3
- export declare const fetchChain: (projectId: string) => Promise<Chain>;
3
+ export declare const fetchZeroDevChain: (projectId: string) => Promise<Chain>;
@@ -4,7 +4,7 @@ import { chainsMap } from '@dynamic-labs/ethereum-core';
4
4
  import { logger } from './logger.js';
5
5
 
6
6
  const cachedChainIdKey = 'dynamic_zd_chain_id';
7
- const fetchChain = (projectId) => __awaiter(void 0, void 0, void 0, function* () {
7
+ const fetchZeroDevChain = (projectId) => __awaiter(void 0, void 0, void 0, function* () {
8
8
  try {
9
9
  const cachedChainId = localStorage.getItem(cachedChainIdKey);
10
10
  if (cachedChainId) {
@@ -21,4 +21,4 @@ const fetchChain = (projectId) => __awaiter(void 0, void 0, void 0, function* ()
21
21
  }
22
22
  });
23
23
 
24
- export { cachedChainIdKey, fetchChain };
24
+ export { cachedChainIdKey, fetchZeroDevChain };
@@ -0,0 +1,21 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var ecdsaValidator = require('@zerodev/ecdsa-validator');
7
+ var multiChainValidator = require('@zerodev/multi-chain-validator');
8
+
9
+ const getEcdsaValidator = (ecdsaProviderType) => {
10
+ if (ecdsaProviderType === 'zerodev_signer_to_ecdsa') {
11
+ return ecdsaValidator.signerToEcdsaValidator;
12
+ }
13
+ else if (ecdsaProviderType === 'zerodev_multi_chain') {
14
+ return multiChainValidator.toMultiChainECDSAValidator;
15
+ }
16
+ else {
17
+ return ecdsaValidator.signerToEcdsaValidator;
18
+ }
19
+ };
20
+
21
+ exports.getEcdsaValidator = getEcdsaValidator;
@@ -0,0 +1,3 @@
1
+ import { signerToEcdsaValidator } from '@zerodev/ecdsa-validator';
2
+ import { toMultiChainECDSAValidator } from '@zerodev/multi-chain-validator';
3
+ export declare const getEcdsaValidator: (ecdsaProviderType: string | undefined) => typeof signerToEcdsaValidator | typeof toMultiChainECDSAValidator;
@@ -0,0 +1,17 @@
1
+ 'use client'
2
+ import { signerToEcdsaValidator } from '@zerodev/ecdsa-validator';
3
+ import { toMultiChainECDSAValidator } from '@zerodev/multi-chain-validator';
4
+
5
+ const getEcdsaValidator = (ecdsaProviderType) => {
6
+ if (ecdsaProviderType === 'zerodev_signer_to_ecdsa') {
7
+ return signerToEcdsaValidator;
8
+ }
9
+ else if (ecdsaProviderType === 'zerodev_multi_chain') {
10
+ return toMultiChainECDSAValidator;
11
+ }
12
+ else {
13
+ return signerToEcdsaValidator;
14
+ }
15
+ };
16
+
17
+ export { getEcdsaValidator };
@@ -0,0 +1,24 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var permissionless = require('permissionless');
7
+ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
8
+ var logger = require('./logger.cjs');
9
+
10
+ const getEntryPoint = (entryPoint) => {
11
+ if (entryPoint === undefined ||
12
+ entryPoint === sdkApiCore.ProviderEntryPointVersionEnum.V7) {
13
+ return permissionless.ENTRYPOINT_ADDRESS_V07;
14
+ }
15
+ else if (entryPoint === sdkApiCore.ProviderEntryPointVersionEnum.V6) {
16
+ return permissionless.ENTRYPOINT_ADDRESS_V06;
17
+ }
18
+ else {
19
+ logger.logger.error('Invalid entry point version', entryPoint);
20
+ return permissionless.ENTRYPOINT_ADDRESS_V07;
21
+ }
22
+ };
23
+
24
+ exports.getEntryPoint = getEntryPoint;
@@ -0,0 +1 @@
1
+ export declare const getEntryPoint: (entryPoint: string | undefined) => "0x0000000071727De22E5E9d8BAf0edAc6f37da032" | "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
@@ -0,0 +1,20 @@
1
+ 'use client'
2
+ import { ENTRYPOINT_ADDRESS_V07, ENTRYPOINT_ADDRESS_V06 } from 'permissionless';
3
+ import { ProviderEntryPointVersionEnum } from '@dynamic-labs/sdk-api-core';
4
+ import { logger } from './logger.js';
5
+
6
+ const getEntryPoint = (entryPoint) => {
7
+ if (entryPoint === undefined ||
8
+ entryPoint === ProviderEntryPointVersionEnum.V7) {
9
+ return ENTRYPOINT_ADDRESS_V07;
10
+ }
11
+ else if (entryPoint === ProviderEntryPointVersionEnum.V6) {
12
+ return ENTRYPOINT_ADDRESS_V06;
13
+ }
14
+ else {
15
+ logger.error('Invalid entry point version', entryPoint);
16
+ return ENTRYPOINT_ADDRESS_V07;
17
+ }
18
+ };
19
+
20
+ export { getEntryPoint };
@@ -0,0 +1,31 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var permissionless = require('permissionless');
7
+ var constants = require('@zerodev/sdk/constants');
8
+ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
9
+ var logger = require('./logger.cjs');
10
+
11
+ const getKernelVersion = (kernelVersion, entryPointAddress) => {
12
+ if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V31 ||
13
+ (kernelVersion === undefined &&
14
+ entryPointAddress === permissionless.ENTRYPOINT_ADDRESS_V07)) {
15
+ return constants.KERNEL_V3_1;
16
+ }
17
+ else if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V30) {
18
+ return constants.KERNEL_V3_0;
19
+ }
20
+ else if (kernelVersion === sdkApiCore.ProviderKernelVersionEnum.V24 ||
21
+ entryPointAddress === permissionless.ENTRYPOINT_ADDRESS_V06 // v0.6 only supports v2.4
22
+ ) {
23
+ return constants.KERNEL_V2_4;
24
+ }
25
+ else {
26
+ logger.logger.error('Invalid kernel version', kernelVersion);
27
+ return constants.KERNEL_V3_1;
28
+ }
29
+ };
30
+
31
+ exports.getKernelVersion = getKernelVersion;
@@ -0,0 +1,4 @@
1
+ import { KERNEL_VERSION_TYPE } from '@zerodev/sdk/types';
2
+ import { ProviderKernelVersionEnum } from '@dynamic-labs/sdk-api-core';
3
+ import { getEntryPoint } from './getEntryPoint';
4
+ export declare const getKernelVersion: (kernelVersion: ProviderKernelVersionEnum | undefined, entryPointAddress: ReturnType<typeof getEntryPoint>) => KERNEL_VERSION_TYPE;
@@ -0,0 +1,27 @@
1
+ 'use client'
2
+ import { ENTRYPOINT_ADDRESS_V07, ENTRYPOINT_ADDRESS_V06 } from 'permissionless';
3
+ import { KERNEL_V3_1, KERNEL_V3_0, KERNEL_V2_4 } from '@zerodev/sdk/constants';
4
+ import { ProviderKernelVersionEnum } from '@dynamic-labs/sdk-api-core';
5
+ import { logger } from './logger.js';
6
+
7
+ const getKernelVersion = (kernelVersion, entryPointAddress) => {
8
+ if (kernelVersion === ProviderKernelVersionEnum.V31 ||
9
+ (kernelVersion === undefined &&
10
+ entryPointAddress === ENTRYPOINT_ADDRESS_V07)) {
11
+ return KERNEL_V3_1;
12
+ }
13
+ else if (kernelVersion === ProviderKernelVersionEnum.V30) {
14
+ return KERNEL_V3_0;
15
+ }
16
+ else if (kernelVersion === ProviderKernelVersionEnum.V24 ||
17
+ entryPointAddress === ENTRYPOINT_ADDRESS_V06 // v0.6 only supports v2.4
18
+ ) {
19
+ return KERNEL_V2_4;
20
+ }
21
+ else {
22
+ logger.error('Invalid kernel version', kernelVersion);
23
+ return KERNEL_V3_1;
24
+ }
25
+ };
26
+
27
+ export { getKernelVersion };
@@ -1,4 +1,7 @@
1
- export * from './fetchChain';
1
+ export * from './fetchZeroDevChain';
2
2
  export * from './logger';
3
3
  export * from './isZeroDevConnector';
4
4
  export * from './createEcsdaKernelAccountClient';
5
+ export * from './getEcdsaValidator';
6
+ export * from './getEntryPoint';
7
+ export * from './getKernelVersion';