@dynamic-labs/embedded-wallet-evm 4.16.0 → 4.18.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,31 @@
1
1
 
2
+ ## [4.18.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.17.0...v4.18.0) (2025-05-07)
3
+
4
+
5
+ ### Features
6
+
7
+ * 7702 authorization now happens on the first transaction and could use sponsored user operation if paymaster provided (IMPORTANT: viem need to be upgraded to at least 2.28.4)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * inline email submit button color when active ([#8663](https://github.com/dynamic-labs/dynamic-auth/issues/8663)) ([ea556e9](https://github.com/dynamic-labs/dynamic-auth/commit/ea556e9116e876fb2180870e74b6c8c6a13faecb))
13
+
14
+ ## [4.17.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.16.0...v4.17.0) (2025-05-06)
15
+
16
+
17
+ ### Features
18
+
19
+ * add chain id option to create kernel client in react-native ([#8650](https://github.com/dynamic-labs/dynamic-auth/issues/8650)) ([1450bea](https://github.com/dynamic-labs/dynamic-auth/commit/1450bea6f979a82ed4880700aff14fa1ead9dc60))
20
+ * add sendCalls method to EthereumWallet ([#8634](https://github.com/dynamic-labs/dynamic-auth/issues/8634)) ([7c9aef9](https://github.com/dynamic-labs/dynamic-auth/commit/7c9aef95382b4823a40279bebfb084de32c25610))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * 7702 do not override existing old aa ([#8630](https://github.com/dynamic-labs/dynamic-auth/issues/8630)) ([a731d9e](https://github.com/dynamic-labs/dynamic-auth/commit/a731d9e77ecd9e1dec3a7704a63989b5f2741a57))
26
+ * improve error message when email login fails ([#8649](https://github.com/dynamic-labs/dynamic-auth/issues/8649)) ([e1c03ac](https://github.com/dynamic-labs/dynamic-auth/commit/e1c03ac6dc83386c63d63db59d31355bc4fe2959))
27
+ * improve react-native stability on android ([#8652](https://github.com/dynamic-labs/dynamic-auth/issues/8652)) ([1617546](https://github.com/dynamic-labs/dynamic-auth/commit/1617546e6053c2ab32f7d385336c47df185d077f))
28
+
2
29
  ## [4.16.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.15.0...v4.16.0) (2025-05-03)
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.16.0";
6
+ var version = "4.18.0";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.16.0";
2
+ var version = "4.18.0";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/embedded-wallet-evm",
3
- "version": "4.16.0",
3
+ "version": "4.18.0",
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",
@@ -23,14 +23,14 @@
23
23
  "@turnkey/iframe-stamper": "2.0.0",
24
24
  "@turnkey/viem": "0.6.2",
25
25
  "@turnkey/webauthn-stamper": "0.5.0",
26
- "@dynamic-labs/assert-package-version": "4.16.0",
27
- "@dynamic-labs/embedded-wallet": "4.16.0",
28
- "@dynamic-labs/ethereum-core": "4.16.0",
29
- "@dynamic-labs/types": "4.16.0",
30
- "@dynamic-labs/utils": "4.16.0",
31
- "@dynamic-labs/wallet-book": "4.16.0",
32
- "@dynamic-labs/wallet-connector-core": "4.16.0",
33
- "@dynamic-labs/webauthn": "4.16.0"
26
+ "@dynamic-labs/assert-package-version": "4.18.0",
27
+ "@dynamic-labs/embedded-wallet": "4.18.0",
28
+ "@dynamic-labs/ethereum-core": "4.18.0",
29
+ "@dynamic-labs/types": "4.18.0",
30
+ "@dynamic-labs/utils": "4.18.0",
31
+ "@dynamic-labs/wallet-book": "4.18.0",
32
+ "@dynamic-labs/wallet-connector-core": "4.18.0",
33
+ "@dynamic-labs/webauthn": "4.18.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "viem": "^2.21.60"
@@ -10,7 +10,7 @@ var viem$1 = require('@turnkey/viem');
10
10
  var webauthnStamper = require('@turnkey/webauthn-stamper');
11
11
  var viem = require('viem');
12
12
  var accounts = require('viem/accounts');
13
- var experimental = require('viem/experimental');
13
+ var utils$1 = require('viem/utils');
14
14
  var utils = require('@dynamic-labs/utils');
15
15
  var ethereumCore = require('@dynamic-labs/ethereum-core');
16
16
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
@@ -112,14 +112,13 @@ class TurnkeyEVMWalletConnector extends embeddedWallet.TurnkeyWalletConnectorBas
112
112
  }
113
113
  });
114
114
  }
115
- experimental_signAuthorization(parameters) {
115
+ signAuthorization(parameters) {
116
116
  return _tslib.__awaiter(this, void 0, void 0, function* () {
117
117
  var _a;
118
- const { contractAddress } = parameters;
119
- const chainId = this.currentChainId;
118
+ const { address: contractAddress, nonce, chainId } = parameters;
120
119
  yield this.createOrRestoreSession();
121
- if (!chainId) {
122
- throw new Error('Chain id not found');
120
+ if (!contractAddress) {
121
+ throw new Error('Contract address not found');
123
122
  }
124
123
  const [signer, publicClient] = yield Promise.all([
125
124
  this.getSigner(),
@@ -133,15 +132,18 @@ class TurnkeyEVMWalletConnector extends embeddedWallet.TurnkeyWalletConnectorBas
133
132
  throw new Error('Turnkey sub organization id not found');
134
133
  }
135
134
  const { address } = signer.account;
136
- const nonce = yield publicClient.getTransactionCount({ address });
137
135
  const signature = yield this.internalSign({
138
136
  address,
139
- hash: experimental.hashAuthorization({ chainId, contractAddress, nonce }),
137
+ hash: utils$1.hashAuthorization({
138
+ address: contractAddress,
139
+ chainId,
140
+ nonce,
141
+ }),
140
142
  turnkeySubOrganizationId,
141
143
  });
142
144
  return {
145
+ address: contractAddress,
143
146
  chainId,
144
- contractAddress,
145
147
  nonce,
146
148
  r: signature.r,
147
149
  s: signature.s,
@@ -403,6 +405,7 @@ class TurnkeyEVMWalletConnector extends embeddedWallet.TurnkeyWalletConnectorBas
403
405
  }
404
406
  this._turnkeyAccount = accounts.toAccount({
405
407
  address: address,
408
+ signAuthorization: (...args) => _tslib.__awaiter(this, void 0, void 0, function* () { return this.signAuthorization(...args); }),
406
409
  signMessage: (_c) => _tslib.__awaiter(this, [_c], void 0, function* ({ message, }) {
407
410
  return this.internalSignMessage({
408
411
  address: address,
@@ -451,36 +454,6 @@ class TurnkeyEVMWalletConnector extends embeddedWallet.TurnkeyWalletConnectorBas
451
454
  getEnabledNetworks() {
452
455
  return this.evmNetworks;
453
456
  }
454
- isAtomicSupported(chainId) {
455
- return _tslib.__awaiter(this, void 0, void 0, function* () {
456
- const walletClient = yield this.getWalletClient();
457
- if (!walletClient) {
458
- return false;
459
- }
460
- const capabilities = yield ethereumCore.getWalletCapabilities(walletClient);
461
- const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
462
- embeddedWallet.logger.debug('[TurnkeyEVMWalletConnector] isAtomicSupported', {
463
- capabilities,
464
- chainId: chainIdToCheck,
465
- });
466
- return ethereumCore.hasAtomicStatusCapability(capabilities, chainIdToCheck);
467
- });
468
- }
469
- isPaymasterServiceSupported(chainId) {
470
- return _tslib.__awaiter(this, void 0, void 0, function* () {
471
- const walletClient = yield this.getWalletClient();
472
- if (!walletClient) {
473
- return false;
474
- }
475
- const capabilities = yield ethereumCore.getWalletCapabilities(walletClient);
476
- const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
477
- embeddedWallet.logger.debug('[TurnkeyEVMWalletConnector] isPaymasterServiceSupported', {
478
- capabilities,
479
- chainId: chainIdToCheck,
480
- });
481
- return ethereumCore.hasPaymasterServiceCapability(capabilities, chainIdToCheck);
482
- });
483
- }
484
457
  }
485
458
  TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey = 'turnkey-last-used-chain-id';
486
459
 
@@ -1,9 +1,10 @@
1
1
  import { Account, LocalAccount, PublicClient, Transport, Chain as ViemChain, WalletClient } from 'viem';
2
+ import { SignAuthorizationParameters, SignAuthorizationReturnType } from 'viem/accounts';
2
3
  import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
3
4
  import { EvmNetwork, GenericNetwork, IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
4
5
  import { IChainRpcProviders, EthereumWallet, RegisterEvmProvidersConfig } from '@dynamic-labs/ethereum-core';
5
6
  import { WalletBookSchema } from '@dynamic-labs/wallet-book';
6
- import type { Chain, EVMAuthorizationParameters, EVMAuthorizationResult, ISendBalanceWalletConnector, InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
7
+ import type { Chain, ISendBalanceWalletConnector, InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
7
8
  import { TurnkeyWalletConnectorNameAndKey, TurnkeyWalletConnectorBase } from '@dynamic-labs/embedded-wallet';
8
9
  export type TurnkeyEVMConnectorProps = {
9
10
  walletUiUtils: WalletUiUtils<InternalWalletConnector>;
@@ -13,6 +14,7 @@ export type TurnkeyEVMConnectorProps = {
13
14
  chainRpcProviders: IChainRpcProviders;
14
15
  providersConfig?: RegisterEvmProvidersConfig;
15
16
  };
17
+ type SignAuthorizationParametersWithoutPrivateKey = Omit<SignAuthorizationParameters, 'privateKey'>;
16
18
  export declare class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase implements ISendBalanceWalletConnector {
17
19
  walletFallback: {
18
20
  brand: {
@@ -40,7 +42,7 @@ export declare class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBas
40
42
  }): Promise<void>;
41
43
  setVerifiedCredentials(verifiedCredentials: JwtVerifiedCredential[]): void;
42
44
  validateActiveWallet(expectedAddress: string): Promise<void>;
43
- experimental_signAuthorization(parameters: EVMAuthorizationParameters): Promise<EVMAuthorizationResult>;
45
+ signAuthorization(parameters: SignAuthorizationParametersWithoutPrivateKey): Promise<SignAuthorizationReturnType>;
44
46
  getBalance(address: string): Promise<string | undefined>;
45
47
  signMessage(messageToSign: string): Promise<string | undefined>;
46
48
  getPublicClient(): Promise<void | PublicClient<Transport, ViemChain> | undefined>;
@@ -63,6 +65,5 @@ export declare class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBas
63
65
  createUiTransaction(from: string): Promise<IUITransaction>;
64
66
  getBlockExplorerUrlsForCurrentNetwork(): Promise<string[]>;
65
67
  getEnabledNetworks(): GenericNetwork[];
66
- isAtomicSupported(chainId?: number): Promise<boolean>;
67
- isPaymasterServiceSupported(chainId?: number): Promise<boolean>;
68
68
  }
69
+ export {};
@@ -6,9 +6,9 @@ import { createAccount } from '@turnkey/viem';
6
6
  import { WebauthnStamper } from '@turnkey/webauthn-stamper';
7
7
  import { http, formatEther } from 'viem';
8
8
  import { toAccount } from 'viem/accounts';
9
- import { hashAuthorization } from 'viem/experimental';
9
+ import { hashAuthorization } from 'viem/utils';
10
10
  import { parseEvmNetworks, DynamicError } from '@dynamic-labs/utils';
11
- import { EthereumWallet, createWalletClientWithUiConfirmation, getOrMapViemChain, createViemUiTransaction, getWalletCapabilities, hasAtomicStatusCapability, hasPaymasterServiceCapability } from '@dynamic-labs/ethereum-core';
11
+ import { EthereumWallet, createWalletClientWithUiConfirmation, getOrMapViemChain, createViemUiTransaction } from '@dynamic-labs/ethereum-core';
12
12
  import { getRpcUrlForChain, isSameAddress } from '@dynamic-labs/wallet-connector-core';
13
13
  import { TurnkeyWalletConnectorBase, logger, findTurnkeyVerifiedCredentialsWithSmartWalletRef, TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS } from '@dynamic-labs/embedded-wallet';
14
14
 
@@ -108,14 +108,13 @@ class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase {
108
108
  }
109
109
  });
110
110
  }
111
- experimental_signAuthorization(parameters) {
111
+ signAuthorization(parameters) {
112
112
  return __awaiter(this, void 0, void 0, function* () {
113
113
  var _a;
114
- const { contractAddress } = parameters;
115
- const chainId = this.currentChainId;
114
+ const { address: contractAddress, nonce, chainId } = parameters;
116
115
  yield this.createOrRestoreSession();
117
- if (!chainId) {
118
- throw new Error('Chain id not found');
116
+ if (!contractAddress) {
117
+ throw new Error('Contract address not found');
119
118
  }
120
119
  const [signer, publicClient] = yield Promise.all([
121
120
  this.getSigner(),
@@ -129,15 +128,18 @@ class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase {
129
128
  throw new Error('Turnkey sub organization id not found');
130
129
  }
131
130
  const { address } = signer.account;
132
- const nonce = yield publicClient.getTransactionCount({ address });
133
131
  const signature = yield this.internalSign({
134
132
  address,
135
- hash: hashAuthorization({ chainId, contractAddress, nonce }),
133
+ hash: hashAuthorization({
134
+ address: contractAddress,
135
+ chainId,
136
+ nonce,
137
+ }),
136
138
  turnkeySubOrganizationId,
137
139
  });
138
140
  return {
141
+ address: contractAddress,
139
142
  chainId,
140
- contractAddress,
141
143
  nonce,
142
144
  r: signature.r,
143
145
  s: signature.s,
@@ -399,6 +401,7 @@ class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase {
399
401
  }
400
402
  this._turnkeyAccount = toAccount({
401
403
  address: address,
404
+ signAuthorization: (...args) => __awaiter(this, void 0, void 0, function* () { return this.signAuthorization(...args); }),
402
405
  signMessage: (_c) => __awaiter(this, [_c], void 0, function* ({ message, }) {
403
406
  return this.internalSignMessage({
404
407
  address: address,
@@ -447,36 +450,6 @@ class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase {
447
450
  getEnabledNetworks() {
448
451
  return this.evmNetworks;
449
452
  }
450
- isAtomicSupported(chainId) {
451
- return __awaiter(this, void 0, void 0, function* () {
452
- const walletClient = yield this.getWalletClient();
453
- if (!walletClient) {
454
- return false;
455
- }
456
- const capabilities = yield getWalletCapabilities(walletClient);
457
- const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
458
- logger.debug('[TurnkeyEVMWalletConnector] isAtomicSupported', {
459
- capabilities,
460
- chainId: chainIdToCheck,
461
- });
462
- return hasAtomicStatusCapability(capabilities, chainIdToCheck);
463
- });
464
- }
465
- isPaymasterServiceSupported(chainId) {
466
- return __awaiter(this, void 0, void 0, function* () {
467
- const walletClient = yield this.getWalletClient();
468
- if (!walletClient) {
469
- return false;
470
- }
471
- const capabilities = yield getWalletCapabilities(walletClient);
472
- const chainIdToCheck = chainId !== null && chainId !== void 0 ? chainId : (yield walletClient.getChainId());
473
- logger.debug('[TurnkeyEVMWalletConnector] isPaymasterServiceSupported', {
474
- capabilities,
475
- chainId: chainIdToCheck,
476
- });
477
- return hasPaymasterServiceCapability(capabilities, chainIdToCheck);
478
- });
479
- }
480
453
  }
481
454
  TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey = 'turnkey-last-used-chain-id';
482
455