@dynamic-labs/ethereum-aa-zksync 4.19.5 → 4.19.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,31 @@
1
1
 
2
+ ### [4.19.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.6...v4.19.7) (2025-06-06)
3
+
4
+
5
+ ### Features
6
+
7
+ * add util to find waas wallets ([#8871](https://github.com/dynamic-labs/dynamic-auth/issues/8871)) ([2d7114e](https://github.com/dynamic-labs/dynamic-auth/commit/2d7114e51f5badf1d04600597f1fd9433fabf3d0))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * make sure smart account is deployed before creating sessions ([#8894](https://github.com/dynamic-labs/dynamic-auth/issues/8894)) ([5ba3d23](https://github.com/dynamic-labs/dynamic-auth/commit/5ba3d23bb8ef7c7438809128c8ef74c390ba1d48))
13
+ * only deploy zksync smart account if not deployed ([#8840](https://github.com/dynamic-labs/dynamic-auth/issues/8840)) ([66a306a](https://github.com/dynamic-labs/dynamic-auth/commit/66a306aaee25c58f685fa050a5d6aea79b196fce))
14
+ * primary wallet loading time when using React 19 ([#8896](https://github.com/dynamic-labs/dynamic-auth/issues/8896)) ([f5690f3](https://github.com/dynamic-labs/dynamic-auth/commit/f5690f31012e8fc6a5650423d4ece6c04f7c1811))
15
+
16
+ ### [4.19.6](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.5...v4.19.6) (2025-06-04)
17
+
18
+
19
+ ### Features
20
+
21
+ * backup unsuccessful popup when create wallet fails ([#8872](https://github.com/dynamic-labs/dynamic-auth/issues/8872)) ([c8f88f2](https://github.com/dynamic-labs/dynamic-auth/commit/c8f88f2cafdb7856764305764a230e159f09dadf))
22
+ * **global-wallet:** new native api method to return the eoa wallet for a connected smart wallet ([#8864](https://github.com/dynamic-labs/dynamic-auth/issues/8864)) ([5d0e200](https://github.com/dynamic-labs/dynamic-auth/commit/5d0e2002caefb658f6120b102abe145d6caafaf4))
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * dont call select endpoint when signing in with 7702 wallet ([#8854](https://github.com/dynamic-labs/dynamic-auth/issues/8854)) ([9828a8f](https://github.com/dynamic-labs/dynamic-auth/commit/9828a8fb758b07dd4dc51cb9eadee483b884defe))
28
+
2
29
  ### [4.19.5](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.4...v4.19.5) (2025-06-02)
3
30
 
4
31
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.19.5";
6
+ var version = "4.19.7";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.19.5";
2
+ var version = "4.19.7";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum-aa-zksync",
3
- "version": "4.19.5",
3
+ "version": "4.19.7",
4
4
  "description": "Core package for Ethereum Account Abstraction utilities and types",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs/sdk-api-core": "0.0.672",
21
+ "@dynamic-labs/sdk-api-core": "0.0.681",
22
22
  "zksync-sso": "0.2.0",
23
- "@dynamic-labs/assert-package-version": "4.19.5",
24
- "@dynamic-labs/ethereum-aa-core": "4.19.5",
25
- "@dynamic-labs/ethereum-core": "4.19.5",
26
- "@dynamic-labs/types": "4.19.5",
27
- "@dynamic-labs/utils": "4.19.5",
28
- "@dynamic-labs/wallet-book": "4.19.5",
29
- "@dynamic-labs/wallet-connector-core": "4.19.5"
23
+ "@dynamic-labs/assert-package-version": "4.19.7",
24
+ "@dynamic-labs/ethereum-aa-core": "4.19.7",
25
+ "@dynamic-labs/ethereum-core": "4.19.7",
26
+ "@dynamic-labs/types": "4.19.7",
27
+ "@dynamic-labs/utils": "4.19.7",
28
+ "@dynamic-labs/wallet-book": "4.19.7",
29
+ "@dynamic-labs/wallet-connector-core": "4.19.7"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "viem": "^2.28.4"
@@ -348,6 +348,9 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
348
348
  deploySmartAccount(_a) {
349
349
  return _tslib.__awaiter(this, arguments, void 0, function* ({ withPaymaster, }) {
350
350
  var _b, _c;
351
+ if (this._isSmartAccountDeployed) {
352
+ return;
353
+ }
351
354
  if (!this.chainId) {
352
355
  throw new Error('Chain ID is not initialized');
353
356
  }
@@ -584,10 +587,14 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
584
587
  return -1;
585
588
  return 0;
586
589
  });
587
- return activeSessions.map((session) => {
590
+ return activeSessions
591
+ .map((session) => {
588
592
  var _a;
589
593
  return (Object.assign(Object.assign({}, session), { origin: (_a = this.getSessionFromStorage(session.sessionId)) === null || _a === void 0 ? void 0 : _a.origin }));
590
- });
594
+ })
595
+ .filter((session) => !session.session.expiresAt ||
596
+ new Date(Number(session.session.expiresAt) * 1000).getTime() >
597
+ Date.now());
591
598
  }
592
599
  catch (error) {
593
600
  walletConnectorCore.logger.error('[ZKsyncConnector] Error listing sessions: ', error);
@@ -630,12 +637,20 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
630
637
  if (!this.smartAccount) {
631
638
  throw new Error('Smart account is not initialized');
632
639
  }
640
+ if (!this._isSmartAccountDeployed) {
641
+ yield this.deploySmartAccount({
642
+ withPaymaster: true,
643
+ });
644
+ }
633
645
  const safeSessionConfig = session.enforceSessionConfigRestrictions(sessionConfig);
634
646
  const privateKey = accounts.generatePrivateKey();
635
647
  const signer = accounts.privateKeyToAccount(privateKey);
636
648
  const params = {
637
649
  sessionConfig: Object.assign(Object.assign({}, safeSessionConfig), { signer: signer.address }),
638
650
  };
651
+ const originURI = origin
652
+ ? new URL(origin).hostname
653
+ : utils.PlatformService.getHostname();
639
654
  if (this.paymasterAddress) {
640
655
  params.paymaster = {
641
656
  address: this.paymasterAddress,
@@ -644,6 +659,15 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
644
659
  }),
645
660
  };
646
661
  }
662
+ const isApproved = yield this._walletUiUtils.zkSyncCreateSession({
663
+ session: {
664
+ origin: originURI,
665
+ session: params.sessionConfig,
666
+ },
667
+ });
668
+ if (!isApproved) {
669
+ throw new Error('User rejected session creation');
670
+ }
647
671
  const publicClient = yield this.getPublicClient();
648
672
  if (!(yield module$1.isModuleInstalled({
649
673
  moduleAddress: this.sessionKeyAddress,
@@ -666,9 +690,6 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
666
690
  yield this.smartAccount.createSession(params);
667
691
  const sessionHash = session.getSessionHash(params.sessionConfig);
668
692
  const serializedSessionConfig = session.stringifySessionConfig(params.sessionConfig);
669
- const originURI = origin
670
- ? new URL(origin).hostname
671
- : utils.PlatformService.getHostname();
672
693
  this.setSession(sessionHash, {
673
694
  origin: originURI,
674
695
  sessionConfig: serializedSessionConfig,
@@ -344,6 +344,9 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
344
344
  deploySmartAccount(_a) {
345
345
  return __awaiter(this, arguments, void 0, function* ({ withPaymaster, }) {
346
346
  var _b, _c;
347
+ if (this._isSmartAccountDeployed) {
348
+ return;
349
+ }
347
350
  if (!this.chainId) {
348
351
  throw new Error('Chain ID is not initialized');
349
352
  }
@@ -580,10 +583,14 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
580
583
  return -1;
581
584
  return 0;
582
585
  });
583
- return activeSessions.map((session) => {
586
+ return activeSessions
587
+ .map((session) => {
584
588
  var _a;
585
589
  return (Object.assign(Object.assign({}, session), { origin: (_a = this.getSessionFromStorage(session.sessionId)) === null || _a === void 0 ? void 0 : _a.origin }));
586
- });
590
+ })
591
+ .filter((session) => !session.session.expiresAt ||
592
+ new Date(Number(session.session.expiresAt) * 1000).getTime() >
593
+ Date.now());
587
594
  }
588
595
  catch (error) {
589
596
  logger.error('[ZKsyncConnector] Error listing sessions: ', error);
@@ -626,12 +633,20 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
626
633
  if (!this.smartAccount) {
627
634
  throw new Error('Smart account is not initialized');
628
635
  }
636
+ if (!this._isSmartAccountDeployed) {
637
+ yield this.deploySmartAccount({
638
+ withPaymaster: true,
639
+ });
640
+ }
629
641
  const safeSessionConfig = enforceSessionConfigRestrictions(sessionConfig);
630
642
  const privateKey = generatePrivateKey();
631
643
  const signer = privateKeyToAccount(privateKey);
632
644
  const params = {
633
645
  sessionConfig: Object.assign(Object.assign({}, safeSessionConfig), { signer: signer.address }),
634
646
  };
647
+ const originURI = origin
648
+ ? new URL(origin).hostname
649
+ : PlatformService.getHostname();
635
650
  if (this.paymasterAddress) {
636
651
  params.paymaster = {
637
652
  address: this.paymasterAddress,
@@ -640,6 +655,15 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
640
655
  }),
641
656
  };
642
657
  }
658
+ const isApproved = yield this._walletUiUtils.zkSyncCreateSession({
659
+ session: {
660
+ origin: originURI,
661
+ session: params.sessionConfig,
662
+ },
663
+ });
664
+ if (!isApproved) {
665
+ throw new Error('User rejected session creation');
666
+ }
643
667
  const publicClient = yield this.getPublicClient();
644
668
  if (!(yield isModuleInstalled({
645
669
  moduleAddress: this.sessionKeyAddress,
@@ -662,9 +686,6 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
662
686
  yield this.smartAccount.createSession(params);
663
687
  const sessionHash = getSessionHash(params.sessionConfig);
664
688
  const serializedSessionConfig = stringifySessionConfig(params.sessionConfig);
665
- const originURI = origin
666
- ? new URL(origin).hostname
667
- : PlatformService.getHostname();
668
689
  this.setSession(sessionHash, {
669
690
  origin: originURI,
670
691
  sessionConfig: serializedSessionConfig,