@dynamic-labs/ethereum-aa 5.0.0-rc.0 → 5.0.0-rc.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 +74 -1
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/ZeroDevConnector.cjs +54 -24
- package/src/ZeroDevConnector.d.ts +9 -0
- package/src/ZeroDevConnector.js +54 -24
- package/src/index.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
|
|
2
|
-
## [5.0.0-rc.
|
|
2
|
+
## [5.0.0-rc.2](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.1...v5.0.0-rc.2) (2026-07-17)
|
|
3
|
+
|
|
4
|
+
## [5.0.0-rc.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.0...v5.0.0-rc.1) (2026-07-17)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### ⚠ BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
* move legacy embedded wallet to waas upgrade flow to new legacy-embedded-wallet-migration package (#11841)
|
|
10
|
+
* drop default injection of legacy embedded wallet connectors (#11833)
|
|
11
|
+
* remove legacy embedded wallet support (#11979)
|
|
12
|
+
* throw when legacy embedded wallet is detected without migration provider (#11855)
|
|
13
|
+
* remove deprecated eclipse package (#11831)
|
|
14
|
+
* remove deprecated functions and props (#11832)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### [4.92.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.92.3...v4.92.4) (2026-07-16)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **bitcoin:** per-network address switching and dust-limit send validation [v4] ([#11970](https://github.com/dynamic-labs/dynamic-auth/issues/11970)) ([76a4a9a](https://github.com/dynamic-labs/dynamic-auth/commit/76a4a9a5025d78798ebd1beffe6c0af59d2d029a)), closes [#11896](https://github.com/dynamic-labs/dynamic-auth/issues/11896) [#11800](https://github.com/dynamic-labs/dynamic-auth/issues/11800)
|
|
23
|
+
* **midnight:** per-network addresses in deposit and wallet info views [v4] ([#11949](https://github.com/dynamic-labs/dynamic-auth/issues/11949)) ([978446a](https://github.com/dynamic-labs/dynamic-auth/commit/978446aca8546eb038ba9ed3be0503d10594ee15))
|
|
24
|
+
* **midnight:** resolve wallet address per selected network [v4] ([#11948](https://github.com/dynamic-labs/dynamic-auth/issues/11948)) ([d6f858c](https://github.com/dynamic-labs/dynamic-auth/commit/d6f858c5e35defda7ed73cf97b3fdbe5ed9d131d))
|
|
25
|
+
* set useMetamaskSdk to true by default ([#11926](https://github.com/dynamic-labs/dynamic-auth/issues/11926)) ([75b5a4a](https://github.com/dynamic-labs/dynamic-auth/commit/75b5a4a0fe8b1a375afce145c0b8bdc3ce761117))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **midnight:** align per-network code with the final main iteration [v4] ([#11971](https://github.com/dynamic-labs/dynamic-auth/issues/11971)) ([3ef3ba8](https://github.com/dynamic-labs/dynamic-auth/commit/3ef3ba8c090dfd9e4286b4e51bf350ea5e6feac7))
|
|
31
|
+
* settle social sign-in when captcha is backed out or oauth popup never responds (v4) ([#11956](https://github.com/dynamic-labs/dynamic-auth/issues/11956)) ([ad49477](https://github.com/dynamic-labs/dynamic-auth/commit/ad49477f2acf61a154bb79cbe26b24f803cdb0e2))
|
|
32
|
+
* validate that private key is not empty before upgrading to WaaS ([#11952](https://github.com/dynamic-labs/dynamic-auth/issues/11952)) ([21dfb83](https://github.com/dynamic-labs/dynamic-auth/commit/21dfb83cb29e42b335bc94a0cdd2062cf14a262a))
|
|
33
|
+
|
|
34
|
+
### [4.92.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.92.2...v4.92.3) (2026-07-10)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* **sdk-react-core:** fix deterministic 'Wallet not found' crash in embedded wallet export (v4) ([#11906](https://github.com/dynamic-labs/dynamic-auth/issues/11906)) ([913ef23](https://github.com/dynamic-labs/dynamic-auth/commit/913ef236b26245488e1cd5db7e874601b65ff0a2)), closes [#11905](https://github.com/dynamic-labs/dynamic-auth/issues/11905) [#11729](https://github.com/dynamic-labs/dynamic-auth/issues/11729)
|
|
40
|
+
|
|
41
|
+
### [4.92.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.92.1...v4.92.2) (2026-07-09)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
* engage captcha during step-up OTP re-auth ([#11879](https://github.com/dynamic-labs/dynamic-auth/issues/11879)) ([585460a](https://github.com/dynamic-labs/dynamic-auth/commit/585460a8976803a8ed0aad16a4a00047bd6c115a))
|
|
47
|
+
* **waas:** gate v1 wallet upgrade on recovery for email-only wallets ([#11897](https://github.com/dynamic-labs/dynamic-auth/issues/11897)) ([5a6f0c6](https://github.com/dynamic-labs/dynamic-auth/commit/5a6f0c6bf3120e59cf502004d09fae56f193e977))
|
|
48
|
+
|
|
49
|
+
### [4.92.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.92.0...v4.92.1) (2026-07-09)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Bug Fixes
|
|
53
|
+
|
|
54
|
+
* **ethereum:** fire in-app-browser redirect on sign for injected EVM wallets that use in-app-browser experience ([#11888](https://github.com/dynamic-labs/dynamic-auth/issues/11888)) ([5116d91](https://github.com/dynamic-labs/dynamic-auth/commit/5116d91ab2c71000a490d72c5d278549d4d8ae9a))
|
|
55
|
+
* **sdk-react-core:** show clear message for Phantom redirect signing failures (v4 backport) ([#11886](https://github.com/dynamic-labs/dynamic-auth/issues/11886)) ([60ac897](https://github.com/dynamic-labs/dynamic-auth/commit/60ac897ba81f7758ccd7a05f97b619785e1f50a7))
|
|
56
|
+
* **social:** use redirect strategy for step-up OAuth on mobile [V4 backport] ([#11881](https://github.com/dynamic-labs/dynamic-auth/issues/11881)) ([42a202e](https://github.com/dynamic-labs/dynamic-auth/commit/42a202e6255de8db73df02eff37c0b10b24fef1a))
|
|
57
|
+
* **solana:** fire in-app-browser redirect on sign and wallet switch ([#11871](https://github.com/dynamic-labs/dynamic-auth/issues/11871)) ([4e2d6b7](https://github.com/dynamic-labs/dynamic-auth/commit/4e2d6b7ac8fdef5bf7c62b8a726ecaef1c6210ec))
|
|
58
|
+
* **solana:** resolve Phantom/Backpack provider collision and Backpack >=0.10.x connect hangs ([#11856](https://github.com/dynamic-labs/dynamic-auth/issues/11856)) ([#11882](https://github.com/dynamic-labs/dynamic-auth/issues/11882)) ([5784aff](https://github.com/dynamic-labs/dynamic-auth/commit/5784aff9641bbc85445fb466f3ab1d6a14331e73))
|
|
59
|
+
|
|
60
|
+
## [4.92.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.6...v4.92.0) (2026-07-08)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Features
|
|
64
|
+
|
|
65
|
+
* **captcha:** add Cloudflare Turnstile provider support alongside hCaptcha (v4) ([#11798](https://github.com/dynamic-labs/dynamic-auth/issues/11798)) ([114c770](https://github.com/dynamic-labs/dynamic-auth/commit/114c7702e900d8dedeebe7be867de35d11a93f31))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Bug Fixes
|
|
69
|
+
|
|
70
|
+
* **ethereum-aa:** resolve kernel client config per wallet (v4) ([#11870](https://github.com/dynamic-labs/dynamic-auth/issues/11870)) ([1b66d79](https://github.com/dynamic-labs/dynamic-auth/commit/1b66d79b4a32b4b6de433b7536bc46e6719224c6))
|
|
71
|
+
* **iframe-setup:** block dangerous URL schemes and verify sender in OPEN_URL ([#11819](https://github.com/dynamic-labs/dynamic-auth/issues/11819)) ([329b27e](https://github.com/dynamic-labs/dynamic-auth/commit/329b27e9fac825916ab227ec8cf93dc343898923))
|
|
72
|
+
* improve social OAuth error messages ([#11837](https://github.com/dynamic-labs/dynamic-auth/issues/11837)) ([8e57c06](https://github.com/dynamic-labs/dynamic-auth/commit/8e57c067c5a89111a32a12fb82e190cf6c46ad67))
|
|
73
|
+
* **react-native-extension:** reject path traversal in downloadFile fileName ([#11816](https://github.com/dynamic-labs/dynamic-auth/issues/11816)) ([9367a56](https://github.com/dynamic-labs/dynamic-auth/commit/9367a56b6daa853d7f7e7f5534261bc68825b239))
|
|
74
|
+
* **sdk-react-core:** display exactly the bytes signed in personal_sign preview ([#11818](https://github.com/dynamic-labs/dynamic-auth/issues/11818)) ([30b9382](https://github.com/dynamic-labs/dynamic-auth/commit/30b93829122f00060cb484aef09a03294c03f651))
|
|
75
|
+
|
|
3
76
|
|
|
4
77
|
### [4.91.6](https://github.com/dynamic-labs/dynamic-auth/compare/v4.91.5...v4.91.6) (2026-07-03)
|
|
5
78
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum-aa",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.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",
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.0.1082",
|
|
22
22
|
"@zerodev/ecdsa-validator": "5.4.9",
|
|
23
23
|
"@zerodev/multi-chain-ecdsa-validator": "5.4.5",
|
|
24
24
|
"@zerodev/sdk": "5.5.7",
|
|
25
|
-
"@dynamic-labs/assert-package-version": "5.0.0-rc.
|
|
26
|
-
"@dynamic-labs/ethereum-aa-core": "5.0.0-rc.
|
|
27
|
-
"@dynamic-labs/ethereum-core": "5.0.0-rc.
|
|
28
|
-
"@dynamic-labs/logger": "5.0.0-rc.
|
|
29
|
-
"@dynamic-labs/types": "5.0.0-rc.
|
|
30
|
-
"@dynamic-labs/utils": "5.0.0-rc.
|
|
31
|
-
"@dynamic-labs/wallet-book": "5.0.0-rc.
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "5.0.0-rc.
|
|
25
|
+
"@dynamic-labs/assert-package-version": "5.0.0-rc.2",
|
|
26
|
+
"@dynamic-labs/ethereum-aa-core": "5.0.0-rc.2",
|
|
27
|
+
"@dynamic-labs/ethereum-core": "5.0.0-rc.2",
|
|
28
|
+
"@dynamic-labs/logger": "5.0.0-rc.2",
|
|
29
|
+
"@dynamic-labs/types": "5.0.0-rc.2",
|
|
30
|
+
"@dynamic-labs/utils": "5.0.0-rc.2",
|
|
31
|
+
"@dynamic-labs/wallet-book": "5.0.0-rc.2",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "5.0.0-rc.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"viem": "^2.45.3"
|
package/src/ZeroDevConnector.cjs
CHANGED
|
@@ -190,8 +190,16 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
190
190
|
}
|
|
191
191
|
// Determine per-wallet 7702 mode: address equality is the defining property of EIP-7702
|
|
192
192
|
// (the EOA itself IS the smart wallet). A 4337 wallet always has a different counterfactual address.
|
|
193
|
-
const
|
|
194
|
-
|
|
193
|
+
const isAddressEqual = smartWalletAddress.toLowerCase() === eoaAddress.toLowerCase();
|
|
194
|
+
const is7702 = this.is7702EnabledOnDashboard && isAddressEqual;
|
|
195
|
+
// An address-equal smart wallet is only meaningful under EIP-7702. When 7702
|
|
196
|
+
// is disabled on the dashboard this shape reaches the SDK only because the
|
|
197
|
+
// EOA row was stamped during a since-reverted 7702 window; registering it
|
|
198
|
+
// would surface a broken 4337 wallet at the EOA address, so skip it.
|
|
199
|
+
if (!this.is7702EnabledOnDashboard && isAddressEqual) {
|
|
200
|
+
logger.logger.warn(`Skipping registration of smart wallet ${smartWalletAddress}: it shares the EOA address but EIP-7702 is disabled on the dashboard.`);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
195
203
|
// Register the EOA connector mapping
|
|
196
204
|
this.eoaConnectorMap[smartWalletAddress] = {
|
|
197
205
|
eoaAddress,
|
|
@@ -274,8 +282,7 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
274
282
|
});
|
|
275
283
|
}
|
|
276
284
|
setEoaConnector(_a) {
|
|
277
|
-
return _tslib.__awaiter(this, arguments, void 0, function* ({ eoaAddress, connector, is7702 = false,
|
|
278
|
-
var _b, _c;
|
|
285
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ eoaAddress, connector, is7702 = false, smartWalletAddress, isPrimary = true, }) {
|
|
279
286
|
if (!connector) {
|
|
280
287
|
logger.logger.error('No EOA connector provided');
|
|
281
288
|
return;
|
|
@@ -289,18 +296,6 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
289
296
|
this.eoaAddress = eoaAddress;
|
|
290
297
|
this.activeWalletAddress = smartWalletAddress;
|
|
291
298
|
}
|
|
292
|
-
if (properties) {
|
|
293
|
-
this.ecdsaProviderType =
|
|
294
|
-
(_b = properties.ecdsaProviderType) !== null && _b !== void 0 ? _b : this.ecdsaProviderType;
|
|
295
|
-
this.entryPoint = properties.entryPointVersion
|
|
296
|
-
? getEntryPoint.getEntryPoint(properties.entryPointVersion)
|
|
297
|
-
: this.entryPoint;
|
|
298
|
-
this.kernelVersion = properties.entryPointVersion
|
|
299
|
-
? getKernelVersion.getKernelVersion(properties.kernelVersion, this.entryPoint)
|
|
300
|
-
: this.kernelVersion;
|
|
301
|
-
this.enableKernelV3Migration =
|
|
302
|
-
(_c = properties.enableKernelV3Migration) !== null && _c !== void 0 ? _c : this.enableKernelV3Migration;
|
|
303
|
-
}
|
|
304
299
|
// Ensure the correct EOA account is active before getting the signer
|
|
305
300
|
if (walletConnectorCore.isDynamicWaasConnector(connector)) {
|
|
306
301
|
yield connector.validateActiveWallet(eoaAddress);
|
|
@@ -379,20 +374,49 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
379
374
|
this.providerMap[walletAddress] = uniqueChainProviderMap;
|
|
380
375
|
});
|
|
381
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* Resolves the EntryPoint / kernel configuration for a single smart wallet
|
|
379
|
+
* from that wallet's own persisted version properties, falling back to the
|
|
380
|
+
* dashboard-level defaults. Resolving per wallet — rather than reading shared
|
|
381
|
+
* instance state — is what lets a user's pre-existing 4337 wallet keep its
|
|
382
|
+
* original EntryPoint while a newer EIP-7702 wallet on the same signer uses a
|
|
383
|
+
* different one.
|
|
384
|
+
*/
|
|
385
|
+
resolveKernelConfig(walletAddress) {
|
|
386
|
+
var _a, _b, _c;
|
|
387
|
+
const properties = walletAddress
|
|
388
|
+
? (_a = this.eoaConnectorMap[walletAddress]) === null || _a === void 0 ? void 0 : _a.properties
|
|
389
|
+
: undefined;
|
|
390
|
+
// A wallet record without entryPointVersion predates per-wallet AA columns;
|
|
391
|
+
// the dashboard-level config is the only signal for which kernel it was
|
|
392
|
+
// created with, so fall back to it rather than assuming a version.
|
|
393
|
+
const entryPoint = (properties === null || properties === void 0 ? void 0 : properties.entryPointVersion)
|
|
394
|
+
? getEntryPoint.getEntryPoint(properties.entryPointVersion)
|
|
395
|
+
: this.entryPoint;
|
|
396
|
+
return {
|
|
397
|
+
ecdsaProviderType: (_b = properties === null || properties === void 0 ? void 0 : properties.ecdsaProviderType) !== null && _b !== void 0 ? _b : this.ecdsaProviderType,
|
|
398
|
+
enableKernelV3Migration: (_c = properties === null || properties === void 0 ? void 0 : properties.enableKernelV3Migration) !== null && _c !== void 0 ? _c : this.enableKernelV3Migration,
|
|
399
|
+
entryPoint,
|
|
400
|
+
kernelVersion: (properties === null || properties === void 0 ? void 0 : properties.entryPointVersion)
|
|
401
|
+
? getKernelVersion.getKernelVersion(properties.kernelVersion, entryPoint)
|
|
402
|
+
: this.kernelVersion,
|
|
403
|
+
};
|
|
404
|
+
}
|
|
382
405
|
createKernelClient(_a) {
|
|
383
|
-
return _tslib.__awaiter(this, arguments, void 0, function* ({ chainId, eip7702Auth, is7702 = false, projectId, signer, paymaster, paymasterRpcOverride, bundlerRpcOverride, }) {
|
|
406
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ chainId, eip7702Auth, is7702 = false, projectId, signer, paymaster, paymasterRpcOverride, bundlerRpcOverride, walletAddress, }) {
|
|
384
407
|
if (!signer)
|
|
385
408
|
throw new utils.DynamicError('No signer provided', 'no_signer_provided');
|
|
386
409
|
const chain = ethereumCore.chainsMap[chainId];
|
|
410
|
+
const { ecdsaProviderType, enableKernelV3Migration, entryPoint, kernelVersion, } = this.resolveKernelConfig(walletAddress);
|
|
387
411
|
let kernelClient;
|
|
388
412
|
const params = {
|
|
389
413
|
apiKernelVersion: this.apiKernelVersion,
|
|
390
414
|
bundlerRpc: bundlerRpcOverride !== null && bundlerRpcOverride !== void 0 ? bundlerRpcOverride : this.bundlerRpc,
|
|
391
415
|
chain,
|
|
392
416
|
chainId: utils.parseChainId(chainId),
|
|
393
|
-
enableKernelV3Migration
|
|
394
|
-
entryPoint
|
|
395
|
-
kernelVersion
|
|
417
|
+
enableKernelV3Migration,
|
|
418
|
+
entryPoint,
|
|
419
|
+
kernelVersion,
|
|
396
420
|
paymaster,
|
|
397
421
|
paymasterRpc: paymasterRpcOverride !== null && paymasterRpcOverride !== void 0 ? paymasterRpcOverride : this.paymasterRpc,
|
|
398
422
|
projectId,
|
|
@@ -405,7 +429,7 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
405
429
|
kernelClient = yield createEcdsaKernelAccountClient.createEcdsaKernelAccountClientWith7702(Object.assign(Object.assign({}, params), { eip7702Auth, kernelVersion: constants$1.KERNEL_V3_3 }));
|
|
406
430
|
}
|
|
407
431
|
else {
|
|
408
|
-
kernelClient = yield createEcdsaKernelAccountClient.createEcdsaKernelAccountClient(Object.assign(Object.assign({}, params), { ecdsaValidator: getEcdsaValidator.getEcdsaValidator(
|
|
432
|
+
kernelClient = yield createEcdsaKernelAccountClient.createEcdsaKernelAccountClient(Object.assign(Object.assign({}, params), { ecdsaValidator: getEcdsaValidator.getEcdsaValidator(ecdsaProviderType) }));
|
|
409
433
|
}
|
|
410
434
|
utils.wrapMethodWithCallback(kernelClient, 'sendUserOperation', (original, ...args) => {
|
|
411
435
|
if (!this.isInOnSendTransactionFlow) {
|
|
@@ -433,6 +457,7 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
433
457
|
paymaster,
|
|
434
458
|
projectId,
|
|
435
459
|
signer,
|
|
460
|
+
walletAddress,
|
|
436
461
|
});
|
|
437
462
|
});
|
|
438
463
|
}
|
|
@@ -504,6 +529,7 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
504
529
|
paymasterRpcOverride: paymasterUrl,
|
|
505
530
|
projectId: clientId,
|
|
506
531
|
signer,
|
|
532
|
+
walletAddress: this.activeWalletAddress,
|
|
507
533
|
});
|
|
508
534
|
if (!client) {
|
|
509
535
|
throw new utils.DynamicError('No kernel client', 'no_kernel_client');
|
|
@@ -699,10 +725,14 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
699
725
|
throw new utils.DynamicError('Failed to prepare user operation for transaction', 'prepare_user_operation_for_transaction');
|
|
700
726
|
}
|
|
701
727
|
const chainId = Number(this.lastUsedChainId);
|
|
728
|
+
// The userOp hash and WaaS signing context must match the EntryPoint of the
|
|
729
|
+
// client that prepared this operation — not shared instance state, which can
|
|
730
|
+
// reflect a different wallet (e.g. a 7702 wallet registered afterwards).
|
|
731
|
+
const { entryPoint } = provider.account;
|
|
702
732
|
const hash = accountAbstraction.getUserOperationHash({
|
|
703
733
|
chainId: chainId,
|
|
704
|
-
entryPointAddress:
|
|
705
|
-
entryPointVersion:
|
|
734
|
+
entryPointAddress: entryPoint.address,
|
|
735
|
+
entryPointVersion: entryPoint.version,
|
|
706
736
|
userOperation,
|
|
707
737
|
});
|
|
708
738
|
// At this point we know eoaConnector is a WAAS connector
|
|
@@ -710,7 +740,7 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
710
740
|
context: {
|
|
711
741
|
evmUserOperation: {
|
|
712
742
|
chainId,
|
|
713
|
-
entryPoint:
|
|
743
|
+
entryPoint: entryPoint.address,
|
|
714
744
|
operation: userOperation,
|
|
715
745
|
},
|
|
716
746
|
},
|
|
@@ -121,6 +121,15 @@ export declare class ZeroDevConnector extends AccountAbstractionBaseConnector im
|
|
|
121
121
|
* @param walletAddress - The smart wallet address to store the providers under
|
|
122
122
|
*/
|
|
123
123
|
private generateProviderMap;
|
|
124
|
+
/**
|
|
125
|
+
* Resolves the EntryPoint / kernel configuration for a single smart wallet
|
|
126
|
+
* from that wallet's own persisted version properties, falling back to the
|
|
127
|
+
* dashboard-level defaults. Resolving per wallet — rather than reading shared
|
|
128
|
+
* instance state — is what lets a user's pre-existing 4337 wallet keep its
|
|
129
|
+
* original EntryPoint while a newer EIP-7702 wallet on the same signer uses a
|
|
130
|
+
* different one.
|
|
131
|
+
*/
|
|
132
|
+
private resolveKernelConfig;
|
|
124
133
|
private createKernelClient;
|
|
125
134
|
private getOrCreateKernelClient;
|
|
126
135
|
getAddress(): Promise<string | undefined>;
|
package/src/ZeroDevConnector.js
CHANGED
|
@@ -186,8 +186,16 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
186
186
|
}
|
|
187
187
|
// Determine per-wallet 7702 mode: address equality is the defining property of EIP-7702
|
|
188
188
|
// (the EOA itself IS the smart wallet). A 4337 wallet always has a different counterfactual address.
|
|
189
|
-
const
|
|
190
|
-
|
|
189
|
+
const isAddressEqual = smartWalletAddress.toLowerCase() === eoaAddress.toLowerCase();
|
|
190
|
+
const is7702 = this.is7702EnabledOnDashboard && isAddressEqual;
|
|
191
|
+
// An address-equal smart wallet is only meaningful under EIP-7702. When 7702
|
|
192
|
+
// is disabled on the dashboard this shape reaches the SDK only because the
|
|
193
|
+
// EOA row was stamped during a since-reverted 7702 window; registering it
|
|
194
|
+
// would surface a broken 4337 wallet at the EOA address, so skip it.
|
|
195
|
+
if (!this.is7702EnabledOnDashboard && isAddressEqual) {
|
|
196
|
+
logger.warn(`Skipping registration of smart wallet ${smartWalletAddress}: it shares the EOA address but EIP-7702 is disabled on the dashboard.`);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
191
199
|
// Register the EOA connector mapping
|
|
192
200
|
this.eoaConnectorMap[smartWalletAddress] = {
|
|
193
201
|
eoaAddress,
|
|
@@ -270,8 +278,7 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
270
278
|
});
|
|
271
279
|
}
|
|
272
280
|
setEoaConnector(_a) {
|
|
273
|
-
return __awaiter(this, arguments, void 0, function* ({ eoaAddress, connector, is7702 = false,
|
|
274
|
-
var _b, _c;
|
|
281
|
+
return __awaiter(this, arguments, void 0, function* ({ eoaAddress, connector, is7702 = false, smartWalletAddress, isPrimary = true, }) {
|
|
275
282
|
if (!connector) {
|
|
276
283
|
logger.error('No EOA connector provided');
|
|
277
284
|
return;
|
|
@@ -285,18 +292,6 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
285
292
|
this.eoaAddress = eoaAddress;
|
|
286
293
|
this.activeWalletAddress = smartWalletAddress;
|
|
287
294
|
}
|
|
288
|
-
if (properties) {
|
|
289
|
-
this.ecdsaProviderType =
|
|
290
|
-
(_b = properties.ecdsaProviderType) !== null && _b !== void 0 ? _b : this.ecdsaProviderType;
|
|
291
|
-
this.entryPoint = properties.entryPointVersion
|
|
292
|
-
? getEntryPoint(properties.entryPointVersion)
|
|
293
|
-
: this.entryPoint;
|
|
294
|
-
this.kernelVersion = properties.entryPointVersion
|
|
295
|
-
? getKernelVersion(properties.kernelVersion, this.entryPoint)
|
|
296
|
-
: this.kernelVersion;
|
|
297
|
-
this.enableKernelV3Migration =
|
|
298
|
-
(_c = properties.enableKernelV3Migration) !== null && _c !== void 0 ? _c : this.enableKernelV3Migration;
|
|
299
|
-
}
|
|
300
295
|
// Ensure the correct EOA account is active before getting the signer
|
|
301
296
|
if (isDynamicWaasConnector(connector)) {
|
|
302
297
|
yield connector.validateActiveWallet(eoaAddress);
|
|
@@ -375,20 +370,49 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
375
370
|
this.providerMap[walletAddress] = uniqueChainProviderMap;
|
|
376
371
|
});
|
|
377
372
|
}
|
|
373
|
+
/**
|
|
374
|
+
* Resolves the EntryPoint / kernel configuration for a single smart wallet
|
|
375
|
+
* from that wallet's own persisted version properties, falling back to the
|
|
376
|
+
* dashboard-level defaults. Resolving per wallet — rather than reading shared
|
|
377
|
+
* instance state — is what lets a user's pre-existing 4337 wallet keep its
|
|
378
|
+
* original EntryPoint while a newer EIP-7702 wallet on the same signer uses a
|
|
379
|
+
* different one.
|
|
380
|
+
*/
|
|
381
|
+
resolveKernelConfig(walletAddress) {
|
|
382
|
+
var _a, _b, _c;
|
|
383
|
+
const properties = walletAddress
|
|
384
|
+
? (_a = this.eoaConnectorMap[walletAddress]) === null || _a === void 0 ? void 0 : _a.properties
|
|
385
|
+
: undefined;
|
|
386
|
+
// A wallet record without entryPointVersion predates per-wallet AA columns;
|
|
387
|
+
// the dashboard-level config is the only signal for which kernel it was
|
|
388
|
+
// created with, so fall back to it rather than assuming a version.
|
|
389
|
+
const entryPoint = (properties === null || properties === void 0 ? void 0 : properties.entryPointVersion)
|
|
390
|
+
? getEntryPoint(properties.entryPointVersion)
|
|
391
|
+
: this.entryPoint;
|
|
392
|
+
return {
|
|
393
|
+
ecdsaProviderType: (_b = properties === null || properties === void 0 ? void 0 : properties.ecdsaProviderType) !== null && _b !== void 0 ? _b : this.ecdsaProviderType,
|
|
394
|
+
enableKernelV3Migration: (_c = properties === null || properties === void 0 ? void 0 : properties.enableKernelV3Migration) !== null && _c !== void 0 ? _c : this.enableKernelV3Migration,
|
|
395
|
+
entryPoint,
|
|
396
|
+
kernelVersion: (properties === null || properties === void 0 ? void 0 : properties.entryPointVersion)
|
|
397
|
+
? getKernelVersion(properties.kernelVersion, entryPoint)
|
|
398
|
+
: this.kernelVersion,
|
|
399
|
+
};
|
|
400
|
+
}
|
|
378
401
|
createKernelClient(_a) {
|
|
379
|
-
return __awaiter(this, arguments, void 0, function* ({ chainId, eip7702Auth, is7702 = false, projectId, signer, paymaster, paymasterRpcOverride, bundlerRpcOverride, }) {
|
|
402
|
+
return __awaiter(this, arguments, void 0, function* ({ chainId, eip7702Auth, is7702 = false, projectId, signer, paymaster, paymasterRpcOverride, bundlerRpcOverride, walletAddress, }) {
|
|
380
403
|
if (!signer)
|
|
381
404
|
throw new DynamicError('No signer provided', 'no_signer_provided');
|
|
382
405
|
const chain = chainsMap[chainId];
|
|
406
|
+
const { ecdsaProviderType, enableKernelV3Migration, entryPoint, kernelVersion, } = this.resolveKernelConfig(walletAddress);
|
|
383
407
|
let kernelClient;
|
|
384
408
|
const params = {
|
|
385
409
|
apiKernelVersion: this.apiKernelVersion,
|
|
386
410
|
bundlerRpc: bundlerRpcOverride !== null && bundlerRpcOverride !== void 0 ? bundlerRpcOverride : this.bundlerRpc,
|
|
387
411
|
chain,
|
|
388
412
|
chainId: parseChainId(chainId),
|
|
389
|
-
enableKernelV3Migration
|
|
390
|
-
entryPoint
|
|
391
|
-
kernelVersion
|
|
413
|
+
enableKernelV3Migration,
|
|
414
|
+
entryPoint,
|
|
415
|
+
kernelVersion,
|
|
392
416
|
paymaster,
|
|
393
417
|
paymasterRpc: paymasterRpcOverride !== null && paymasterRpcOverride !== void 0 ? paymasterRpcOverride : this.paymasterRpc,
|
|
394
418
|
projectId,
|
|
@@ -401,7 +425,7 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
401
425
|
kernelClient = yield createEcdsaKernelAccountClientWith7702(Object.assign(Object.assign({}, params), { eip7702Auth, kernelVersion: KERNEL_V3_3 }));
|
|
402
426
|
}
|
|
403
427
|
else {
|
|
404
|
-
kernelClient = yield createEcdsaKernelAccountClient(Object.assign(Object.assign({}, params), { ecdsaValidator: getEcdsaValidator(
|
|
428
|
+
kernelClient = yield createEcdsaKernelAccountClient(Object.assign(Object.assign({}, params), { ecdsaValidator: getEcdsaValidator(ecdsaProviderType) }));
|
|
405
429
|
}
|
|
406
430
|
wrapMethodWithCallback(kernelClient, 'sendUserOperation', (original, ...args) => {
|
|
407
431
|
if (!this.isInOnSendTransactionFlow) {
|
|
@@ -429,6 +453,7 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
429
453
|
paymaster,
|
|
430
454
|
projectId,
|
|
431
455
|
signer,
|
|
456
|
+
walletAddress,
|
|
432
457
|
});
|
|
433
458
|
});
|
|
434
459
|
}
|
|
@@ -500,6 +525,7 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
500
525
|
paymasterRpcOverride: paymasterUrl,
|
|
501
526
|
projectId: clientId,
|
|
502
527
|
signer,
|
|
528
|
+
walletAddress: this.activeWalletAddress,
|
|
503
529
|
});
|
|
504
530
|
if (!client) {
|
|
505
531
|
throw new DynamicError('No kernel client', 'no_kernel_client');
|
|
@@ -695,10 +721,14 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
695
721
|
throw new DynamicError('Failed to prepare user operation for transaction', 'prepare_user_operation_for_transaction');
|
|
696
722
|
}
|
|
697
723
|
const chainId = Number(this.lastUsedChainId);
|
|
724
|
+
// The userOp hash and WaaS signing context must match the EntryPoint of the
|
|
725
|
+
// client that prepared this operation — not shared instance state, which can
|
|
726
|
+
// reflect a different wallet (e.g. a 7702 wallet registered afterwards).
|
|
727
|
+
const { entryPoint } = provider.account;
|
|
698
728
|
const hash = getUserOperationHash({
|
|
699
729
|
chainId: chainId,
|
|
700
|
-
entryPointAddress:
|
|
701
|
-
entryPointVersion:
|
|
730
|
+
entryPointAddress: entryPoint.address,
|
|
731
|
+
entryPointVersion: entryPoint.version,
|
|
702
732
|
userOperation,
|
|
703
733
|
});
|
|
704
734
|
// At this point we know eoaConnector is a WAAS connector
|
|
@@ -706,7 +736,7 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
706
736
|
context: {
|
|
707
737
|
evmUserOperation: {
|
|
708
738
|
chainId,
|
|
709
|
-
entryPoint:
|
|
739
|
+
entryPoint: entryPoint.address,
|
|
710
740
|
operation: userOperation,
|
|
711
741
|
},
|
|
712
742
|
},
|
package/src/index.d.ts
CHANGED
|
@@ -8,9 +8,6 @@ export { getKernelVersion } from './utils/getKernelVersion';
|
|
|
8
8
|
export { signEip7702Authorization, type SignEip7702AuthorizationParams, } from './utils/signEip7702Authorization';
|
|
9
9
|
export { isZeroDevConnector } from './utils/isZeroDevConnector';
|
|
10
10
|
export type { SignAuthorizationReturnType as Eip7702Authorization } from 'viem/accounts';
|
|
11
|
-
export type {
|
|
12
|
-
/** @deprecated Use ZerodevBundlerProvider from \@dynamic-labs/sdk-api-core instead */
|
|
13
|
-
ZerodevBundlerProvider as BundlerProvider, } from '@dynamic-labs/sdk-api-core';
|
|
14
11
|
/**
|
|
15
12
|
* Allows defining default values for zerodev configs.
|
|
16
13
|
* Values configured in the dashboard will take precedence over these values.
|