@dynamic-labs/ethereum-aa-zksync 4.19.6 → 4.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,30 @@
1
1
 
2
+ ## [4.20.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.7...v4.20.0) (2025-06-09)
3
+
4
+
5
+ ### Features
6
+
7
+ * encapsulate waas connectors within main connectors ([#8878](https://github.com/dynamic-labs/dynamic-auth/issues/8878)) ([fd1b6ab](https://github.com/dynamic-labs/dynamic-auth/commit/fd1b6ab037ff7ce5c66b30d9611689e8cc03b97b))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * hide duplicate social connection logo on global wallets ([#8903](https://github.com/dynamic-labs/dynamic-auth/issues/8903)) ([c2f86e7](https://github.com/dynamic-labs/dynamic-auth/commit/c2f86e7aae91764b174abaa18439ffbdf7287475))
13
+
14
+ ### [4.19.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.6...v4.19.7) (2025-06-06)
15
+
16
+
17
+ ### Features
18
+
19
+ * 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))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * 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))
25
+ * 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))
26
+ * 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))
27
+
2
28
  ### [4.19.6](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.5...v4.19.6) (2025-06-04)
3
29
 
4
30
 
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.6";
6
+ var version = "4.20.0";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.19.6";
2
+ var version = "4.20.0";
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.6",
3
+ "version": "4.20.0",
4
4
  "description": "Core package for Ethereum Account Abstraction utilities and types",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -20,13 +20,13 @@
20
20
  "dependencies": {
21
21
  "@dynamic-labs/sdk-api-core": "0.0.681",
22
22
  "zksync-sso": "0.2.0",
23
- "@dynamic-labs/assert-package-version": "4.19.6",
24
- "@dynamic-labs/ethereum-aa-core": "4.19.6",
25
- "@dynamic-labs/ethereum-core": "4.19.6",
26
- "@dynamic-labs/types": "4.19.6",
27
- "@dynamic-labs/utils": "4.19.6",
28
- "@dynamic-labs/wallet-book": "4.19.6",
29
- "@dynamic-labs/wallet-connector-core": "4.19.6"
23
+ "@dynamic-labs/assert-package-version": "4.20.0",
24
+ "@dynamic-labs/ethereum-aa-core": "4.20.0",
25
+ "@dynamic-labs/ethereum-core": "4.20.0",
26
+ "@dynamic-labs/types": "4.20.0",
27
+ "@dynamic-labs/utils": "4.20.0",
28
+ "@dynamic-labs/wallet-book": "4.20.0",
29
+ "@dynamic-labs/wallet-connector-core": "4.20.0"
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);
@@ -621,6 +628,7 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
621
628
  }),
622
629
  };
623
630
  }
631
+ this._walletUiUtils.disabledConfirmationOnce();
624
632
  yield this.smartAccount.revokeSession(params);
625
633
  this.deleteSession(sessionId);
626
634
  });
@@ -630,6 +638,11 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
630
638
  if (!this.smartAccount) {
631
639
  throw new Error('Smart account is not initialized');
632
640
  }
641
+ if (!this._isSmartAccountDeployed) {
642
+ yield this.deploySmartAccount({
643
+ withPaymaster: true,
644
+ });
645
+ }
633
646
  const safeSessionConfig = session.enforceSessionConfigRestrictions(sessionConfig);
634
647
  const privateKey = accounts.generatePrivateKey();
635
648
  const signer = accounts.privateKeyToAccount(privateKey);
@@ -662,6 +675,7 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
662
675
  publicClient,
663
676
  smartAddress: this.smartAccountAddress,
664
677
  }))) {
678
+ this._walletUiUtils.disabledConfirmationOnce();
665
679
  yield module$1.installModule({
666
680
  ecdsaClient: this.getAccountAbstractionProvider(),
667
681
  module: {
@@ -675,6 +689,7 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
675
689
  smartAddress: this.smartAccountAddress,
676
690
  });
677
691
  }
692
+ this._walletUiUtils.disabledConfirmationOnce();
678
693
  yield this.smartAccount.createSession(params);
679
694
  const sessionHash = session.getSessionHash(params.sessionConfig);
680
695
  const serializedSessionConfig = session.stringifySessionConfig(params.sessionConfig);
@@ -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);
@@ -617,6 +624,7 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
617
624
  }),
618
625
  };
619
626
  }
627
+ this._walletUiUtils.disabledConfirmationOnce();
620
628
  yield this.smartAccount.revokeSession(params);
621
629
  this.deleteSession(sessionId);
622
630
  });
@@ -626,6 +634,11 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
626
634
  if (!this.smartAccount) {
627
635
  throw new Error('Smart account is not initialized');
628
636
  }
637
+ if (!this._isSmartAccountDeployed) {
638
+ yield this.deploySmartAccount({
639
+ withPaymaster: true,
640
+ });
641
+ }
629
642
  const safeSessionConfig = enforceSessionConfigRestrictions(sessionConfig);
630
643
  const privateKey = generatePrivateKey();
631
644
  const signer = privateKeyToAccount(privateKey);
@@ -658,6 +671,7 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
658
671
  publicClient,
659
672
  smartAddress: this.smartAccountAddress,
660
673
  }))) {
674
+ this._walletUiUtils.disabledConfirmationOnce();
661
675
  yield installModule({
662
676
  ecdsaClient: this.getAccountAbstractionProvider(),
663
677
  module: {
@@ -671,6 +685,7 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
671
685
  smartAddress: this.smartAccountAddress,
672
686
  });
673
687
  }
688
+ this._walletUiUtils.disabledConfirmationOnce();
674
689
  yield this.smartAccount.createSession(params);
675
690
  const sessionHash = getSessionHash(params.sessionConfig);
676
691
  const serializedSessionConfig = stringifySessionConfig(params.sessionConfig);
@@ -21,7 +21,25 @@ const isModuleInstalled = (_a) => _tslib.__awaiter(void 0, [_a], void 0, functio
21
21
  return sessionValidatorInstalled;
22
22
  });
23
23
  const installModule = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ module, smartAddress, publicClient, ecdsaClient, paymaster, }) {
24
+ var _c;
24
25
  const { address: moduleAddress, initData } = module;
26
+ if (!paymaster) {
27
+ const gasEstimate = yield publicClient.estimateContractGas({
28
+ abi: abi.SsoAccountAbi,
29
+ account: ecdsaClient.account,
30
+ address: smartAddress,
31
+ args: [moduleAddress, initData],
32
+ functionName: 'addModuleValidator',
33
+ });
34
+ const balance = yield publicClient.getBalance({
35
+ address: (_c = ecdsaClient.account) === null || _c === void 0 ? void 0 : _c.address,
36
+ });
37
+ const gasPrice = yield publicClient.getGasPrice();
38
+ const requiredBalance = gasEstimate * gasPrice;
39
+ if (balance < requiredBalance) {
40
+ throw new Error(`Insufficient balance to upgrade smart account, balance: ${balance} required: ${requiredBalance}`);
41
+ }
42
+ }
25
43
  const simulatedSessionModuleAddition = yield publicClient.simulateContract({
26
44
  abi: abi.SsoAccountAbi,
27
45
  account: ecdsaClient.account,
@@ -17,7 +17,25 @@ const isModuleInstalled = (_a) => __awaiter(void 0, [_a], void 0, function* ({ m
17
17
  return sessionValidatorInstalled;
18
18
  });
19
19
  const installModule = (_b) => __awaiter(void 0, [_b], void 0, function* ({ module, smartAddress, publicClient, ecdsaClient, paymaster, }) {
20
+ var _c;
20
21
  const { address: moduleAddress, initData } = module;
22
+ if (!paymaster) {
23
+ const gasEstimate = yield publicClient.estimateContractGas({
24
+ abi: SsoAccountAbi,
25
+ account: ecdsaClient.account,
26
+ address: smartAddress,
27
+ args: [moduleAddress, initData],
28
+ functionName: 'addModuleValidator',
29
+ });
30
+ const balance = yield publicClient.getBalance({
31
+ address: (_c = ecdsaClient.account) === null || _c === void 0 ? void 0 : _c.address,
32
+ });
33
+ const gasPrice = yield publicClient.getGasPrice();
34
+ const requiredBalance = gasEstimate * gasPrice;
35
+ if (balance < requiredBalance) {
36
+ throw new Error(`Insufficient balance to upgrade smart account, balance: ${balance} required: ${requiredBalance}`);
37
+ }
38
+ }
21
39
  const simulatedSessionModuleAddition = yield publicClient.simulateContract({
22
40
  abi: SsoAccountAbi,
23
41
  account: ecdsaClient.account,