@dynamic-labs/ethereum-aa-zksync 4.19.7 → 4.20.1

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,28 @@
1
1
 
2
+ ### [4.20.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.0...v4.20.1) (2025-06-09)
3
+
4
+
5
+ ### Features
6
+
7
+ * **global-wallet:** new createKernelClient method to native api ([#8883](https://github.com/dynamic-labs/dynamic-auth/issues/8883)) ([005b34c](https://github.com/dynamic-labs/dynamic-auth/commit/005b34c230ceb5e945547e129231c108a6cec444))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * default embedded wallet chain enum ([#8917](https://github.com/dynamic-labs/dynamic-auth/issues/8917)) ([e9fd715](https://github.com/dynamic-labs/dynamic-auth/commit/e9fd715506598bfabbc71454421885d05a06a3ec))
13
+
14
+ ## [4.20.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.7...v4.20.0) (2025-06-09)
15
+
16
+
17
+ ### Features
18
+
19
+ * 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))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * 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))
25
+
2
26
  ### [4.19.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.19.6...v4.19.7) (2025-06-06)
3
27
 
4
28
 
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.7";
6
+ var version = "4.20.1";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.19.7";
2
+ var version = "4.20.1";
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.7",
3
+ "version": "4.20.1",
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.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"
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"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "viem": "^2.28.4"
@@ -103,11 +103,12 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
103
103
  deleteSession(sessionId) {
104
104
  return storage.deleteSessionFromStorage(sessionId);
105
105
  }
106
- getAccountAbstractionProvider({ sessionId } = {}) {
106
+ getAccountAbstractionProvider({ sessionId, origin, } = {}) {
107
+ var _a;
107
108
  if (sessionId && this.sessionKeyAddress) {
108
109
  const session = this.getSessionFromStorage(sessionId);
109
- const isSessionRequestValid = session &&
110
- (!session.origin || utils.PlatformService.getHostname() === session.origin);
110
+ const originURI = (_a = utils.PlatformService.getTLD(origin)) !== null && _a !== void 0 ? _a : utils.PlatformService.getHostname();
111
+ const isSessionRequestValid = session && (!session.origin || originURI === session.origin);
111
112
  if (isSessionRequestValid) {
112
113
  return client.createZksyncSessionClient({
113
114
  address: this.smartAccountAddress,
@@ -628,12 +629,14 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
628
629
  }),
629
630
  };
630
631
  }
632
+ this._walletUiUtils.disabledConfirmationOnce();
631
633
  yield this.smartAccount.revokeSession(params);
632
634
  this.deleteSession(sessionId);
633
635
  });
634
636
  }
635
637
  createSession(_a) {
636
638
  return _tslib.__awaiter(this, arguments, void 0, function* ({ sessionConfig, origin, addModuleWithPaymaster = false, }) {
639
+ var _b;
637
640
  if (!this.smartAccount) {
638
641
  throw new Error('Smart account is not initialized');
639
642
  }
@@ -648,9 +651,7 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
648
651
  const params = {
649
652
  sessionConfig: Object.assign(Object.assign({}, safeSessionConfig), { signer: signer.address }),
650
653
  };
651
- const originURI = origin
652
- ? new URL(origin).hostname
653
- : utils.PlatformService.getHostname();
654
+ const originURI = (_b = utils.PlatformService.getTLD(origin)) !== null && _b !== void 0 ? _b : utils.PlatformService.getHostname();
654
655
  if (this.paymasterAddress) {
655
656
  params.paymaster = {
656
657
  address: this.paymasterAddress,
@@ -674,6 +675,7 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
674
675
  publicClient,
675
676
  smartAddress: this.smartAccountAddress,
676
677
  }))) {
678
+ this._walletUiUtils.disabledConfirmationOnce();
677
679
  yield module$1.installModule({
678
680
  ecdsaClient: this.getAccountAbstractionProvider(),
679
681
  module: {
@@ -687,6 +689,7 @@ class ZKsyncConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
687
689
  smartAddress: this.smartAccountAddress,
688
690
  });
689
691
  }
692
+ this._walletUiUtils.disabledConfirmationOnce();
690
693
  yield this.smartAccount.createSession(params);
691
694
  const sessionHash = session.getSessionHash(params.sessionConfig);
692
695
  const serializedSessionConfig = session.stringifySessionConfig(params.sessionConfig);
@@ -68,8 +68,9 @@ export declare class ZKsyncConnector extends AccountAbstractionBaseConnector imp
68
68
  private getSessionFromStorage;
69
69
  private setSession;
70
70
  private deleteSession;
71
- getAccountAbstractionProvider<T = ZksyncSsoEcdsaClient<Transport, ViemChain, RpcSchema> | ZksyncSsoSessionClient<Transport, ViemChain, RpcSchema>>({ sessionId }?: {
71
+ getAccountAbstractionProvider<T = ZksyncSsoEcdsaClient<Transport, ViemChain, RpcSchema> | ZksyncSsoSessionClient<Transport, ViemChain, RpcSchema>>({ sessionId, origin, }?: {
72
72
  sessionId?: string;
73
+ origin?: string;
73
74
  withSponsorship?: boolean;
74
75
  }): T;
75
76
  getWalletClient(chainId?: string): WalletClient<Transport, ViemChain, Account> | undefined;
@@ -99,11 +99,12 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
99
99
  deleteSession(sessionId) {
100
100
  return deleteSessionFromStorage(sessionId);
101
101
  }
102
- getAccountAbstractionProvider({ sessionId } = {}) {
102
+ getAccountAbstractionProvider({ sessionId, origin, } = {}) {
103
+ var _a;
103
104
  if (sessionId && this.sessionKeyAddress) {
104
105
  const session = this.getSessionFromStorage(sessionId);
105
- const isSessionRequestValid = session &&
106
- (!session.origin || PlatformService.getHostname() === session.origin);
106
+ const originURI = (_a = PlatformService.getTLD(origin)) !== null && _a !== void 0 ? _a : PlatformService.getHostname();
107
+ const isSessionRequestValid = session && (!session.origin || originURI === session.origin);
107
108
  if (isSessionRequestValid) {
108
109
  return createZksyncSessionClient({
109
110
  address: this.smartAccountAddress,
@@ -624,12 +625,14 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
624
625
  }),
625
626
  };
626
627
  }
628
+ this._walletUiUtils.disabledConfirmationOnce();
627
629
  yield this.smartAccount.revokeSession(params);
628
630
  this.deleteSession(sessionId);
629
631
  });
630
632
  }
631
633
  createSession(_a) {
632
634
  return __awaiter(this, arguments, void 0, function* ({ sessionConfig, origin, addModuleWithPaymaster = false, }) {
635
+ var _b;
633
636
  if (!this.smartAccount) {
634
637
  throw new Error('Smart account is not initialized');
635
638
  }
@@ -644,9 +647,7 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
644
647
  const params = {
645
648
  sessionConfig: Object.assign(Object.assign({}, safeSessionConfig), { signer: signer.address }),
646
649
  };
647
- const originURI = origin
648
- ? new URL(origin).hostname
649
- : PlatformService.getHostname();
650
+ const originURI = (_b = PlatformService.getTLD(origin)) !== null && _b !== void 0 ? _b : PlatformService.getHostname();
650
651
  if (this.paymasterAddress) {
651
652
  params.paymaster = {
652
653
  address: this.paymasterAddress,
@@ -670,6 +671,7 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
670
671
  publicClient,
671
672
  smartAddress: this.smartAccountAddress,
672
673
  }))) {
674
+ this._walletUiUtils.disabledConfirmationOnce();
673
675
  yield installModule({
674
676
  ecdsaClient: this.getAccountAbstractionProvider(),
675
677
  module: {
@@ -683,6 +685,7 @@ class ZKsyncConnector extends AccountAbstractionBaseConnector {
683
685
  smartAddress: this.smartAccountAddress,
684
686
  });
685
687
  }
688
+ this._walletUiUtils.disabledConfirmationOnce();
686
689
  yield this.smartAccount.createSession(params);
687
690
  const sessionHash = getSessionHash(params.sessionConfig);
688
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,