@dynamic-labs/ethereum-aa-zksync 4.20.1 → 4.20.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,14 @@
1
1
 
2
+ ### [4.20.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.1...v4.20.2) (2025-06-11)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * auto-creation for only missing v3 wallets ([#8928](https://github.com/dynamic-labs/dynamic-auth/issues/8928)) ([845a01b](https://github.com/dynamic-labs/dynamic-auth/commit/845a01b1c7661d4858913006b2dd303ded19b462))
8
+ * don't logout when unlinking last wallet ([#8932](https://github.com/dynamic-labs/dynamic-auth/issues/8932)) ([ae91d68](https://github.com/dynamic-labs/dynamic-auth/commit/ae91d682ac69a267be3b1f9ae4cf2bb46cae8c6b))
9
+ * fetch nonce before attempting zksync account upgrade to avoid nonce collision ([#8924](https://github.com/dynamic-labs/dynamic-auth/issues/8924)) ([12aa982](https://github.com/dynamic-labs/dynamic-auth/commit/12aa98224c30ded0f7b83f3eabc6fa9a923b72cd))
10
+ * remove max session expiration restraint for zksync sessions ([#8922](https://github.com/dynamic-labs/dynamic-auth/issues/8922)) ([abb92e0](https://github.com/dynamic-labs/dynamic-auth/commit/abb92e009ff9c5485e4856a39d03c4035b7a6ee2))
11
+
2
12
  ### [4.20.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.0...v4.20.1) (2025-06-09)
3
13
 
4
14
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.20.1";
6
+ var version = "4.20.2";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.20.1";
2
+ var version = "4.20.2";
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.20.1",
3
+ "version": "4.20.2",
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.20.1",
24
- "@dynamic-labs/ethereum-aa-core": "4.20.1",
25
- "@dynamic-labs/ethereum-core": "4.20.1",
26
- "@dynamic-labs/types": "4.20.1",
27
- "@dynamic-labs/utils": "4.20.1",
28
- "@dynamic-labs/wallet-book": "4.20.1",
29
- "@dynamic-labs/wallet-connector-core": "4.20.1"
23
+ "@dynamic-labs/assert-package-version": "4.20.2",
24
+ "@dynamic-labs/ethereum-aa-core": "4.20.2",
25
+ "@dynamic-labs/ethereum-core": "4.20.2",
26
+ "@dynamic-labs/types": "4.20.2",
27
+ "@dynamic-labs/utils": "4.20.2",
28
+ "@dynamic-labs/wallet-book": "4.20.2",
29
+ "@dynamic-labs/wallet-connector-core": "4.20.2"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "viem": "^2.28.4"
@@ -630,7 +630,13 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
630
630
  };
631
631
  }
632
632
  this._walletUiUtils.disabledConfirmationOnce();
633
- yield this.smartAccount.revokeSession(params);
633
+ try {
634
+ yield this.smartAccount.revokeSession(params);
635
+ }
636
+ catch (error) {
637
+ walletConnectorCore.logger.error('[ZKsyncConnector] Error revoking session: ', error);
638
+ throw new Error('Failed to revoke session');
639
+ }
634
640
  this.deleteSession(sessionId);
635
641
  });
636
642
  }
@@ -626,7 +626,13 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
626
626
  };
627
627
  }
628
628
  this._walletUiUtils.disabledConfirmationOnce();
629
- yield this.smartAccount.revokeSession(params);
629
+ try {
630
+ yield this.smartAccount.revokeSession(params);
631
+ }
632
+ catch (error) {
633
+ logger.error('[ZKsyncConnector] Error revoking session: ', error);
634
+ throw new Error('Failed to revoke session');
635
+ }
630
636
  this.deleteSession(sessionId);
631
637
  });
632
638
  }
@@ -21,7 +21,7 @@ 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
+ var _c, _d;
25
25
  const { address: moduleAddress, initData } = module;
26
26
  if (!paymaster) {
27
27
  const gasEstimate = yield publicClient.estimateContractGas({
@@ -40,12 +40,18 @@ const installModule = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* (
40
40
  throw new Error(`Insufficient balance to upgrade smart account, balance: ${balance} required: ${requiredBalance}`);
41
41
  }
42
42
  }
43
+ // In certain circumstances, the nonce is not updated before this call is made
44
+ const nonce = yield publicClient.getTransactionCount({
45
+ address: (_d = ecdsaClient.account) === null || _d === void 0 ? void 0 : _d.address,
46
+ blockTag: 'pending',
47
+ });
43
48
  const simulatedSessionModuleAddition = yield publicClient.simulateContract({
44
49
  abi: abi.SsoAccountAbi,
45
50
  account: ecdsaClient.account,
46
51
  address: smartAddress,
47
52
  args: [moduleAddress, initData],
48
53
  functionName: 'addModuleValidator',
54
+ nonce,
49
55
  });
50
56
  let request = Object.assign({}, simulatedSessionModuleAddition.request);
51
57
  if (paymaster) {
@@ -17,7 +17,7 @@ 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
+ var _c, _d;
21
21
  const { address: moduleAddress, initData } = module;
22
22
  if (!paymaster) {
23
23
  const gasEstimate = yield publicClient.estimateContractGas({
@@ -36,12 +36,18 @@ const installModule = (_b) => __awaiter(void 0, [_b], void 0, function* ({ modul
36
36
  throw new Error(`Insufficient balance to upgrade smart account, balance: ${balance} required: ${requiredBalance}`);
37
37
  }
38
38
  }
39
+ // In certain circumstances, the nonce is not updated before this call is made
40
+ const nonce = yield publicClient.getTransactionCount({
41
+ address: (_d = ecdsaClient.account) === null || _d === void 0 ? void 0 : _d.address,
42
+ blockTag: 'pending',
43
+ });
39
44
  const simulatedSessionModuleAddition = yield publicClient.simulateContract({
40
45
  abi: SsoAccountAbi,
41
46
  account: ecdsaClient.account,
42
47
  address: smartAddress,
43
48
  args: [moduleAddress, initData],
44
49
  functionName: 'addModuleValidator',
50
+ nonce,
45
51
  });
46
52
  let request = Object.assign({}, simulatedSessionModuleAddition.request);
47
53
  if (paymaster) {
@@ -10,8 +10,7 @@ const DEFAULT_EXPIRATION_TIME = 86400; // 1 day
10
10
  const enforceSessionConfigRestrictions = (sessionConfig) => {
11
11
  const now = Math.floor(Date.now() / 1000);
12
12
  const maxExpirationTime = now + DEFAULT_EXPIRATION_TIME;
13
- if (!sessionConfig.expiresAt ||
14
- Number(sessionConfig.expiresAt) > maxExpirationTime) {
13
+ if (!sessionConfig.expiresAt) {
15
14
  sessionConfig.expiresAt = BigInt(maxExpirationTime);
16
15
  }
17
16
  return sessionConfig;
@@ -6,8 +6,7 @@ const DEFAULT_EXPIRATION_TIME = 86400; // 1 day
6
6
  const enforceSessionConfigRestrictions = (sessionConfig) => {
7
7
  const now = Math.floor(Date.now() / 1000);
8
8
  const maxExpirationTime = now + DEFAULT_EXPIRATION_TIME;
9
- if (!sessionConfig.expiresAt ||
10
- Number(sessionConfig.expiresAt) > maxExpirationTime) {
9
+ if (!sessionConfig.expiresAt) {
11
10
  sessionConfig.expiresAt = BigInt(maxExpirationTime);
12
11
  }
13
12
  return sessionConfig;