@dynamic-labs/waas-evm 4.17.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,16 @@
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
+
2
14
  ## [4.17.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.16.0...v4.17.0) (2025-05-06)
3
15
 
4
16
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.17.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.17.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/waas-evm",
3
- "version": "4.17.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",
@@ -20,13 +20,13 @@
20
20
  "dependencies": {
21
21
  "@dynamic-labs-wallet/evm": "0.0.65",
22
22
  "@dynamic-labs/sdk-api-core": "0.0.660",
23
- "viem": "^2.24.2",
24
- "@dynamic-labs/assert-package-version": "4.17.0",
25
- "@dynamic-labs/ethereum-core": "4.17.0",
26
- "@dynamic-labs/logger": "4.17.0",
27
- "@dynamic-labs/types": "4.17.0",
28
- "@dynamic-labs/utils": "4.17.0",
29
- "@dynamic-labs/wallet-connector-core": "4.17.0"
23
+ "viem": "^2.28.4",
24
+ "@dynamic-labs/assert-package-version": "4.18.0",
25
+ "@dynamic-labs/ethereum-core": "4.18.0",
26
+ "@dynamic-labs/logger": "4.18.0",
27
+ "@dynamic-labs/types": "4.18.0",
28
+ "@dynamic-labs/utils": "4.18.0",
29
+ "@dynamic-labs/wallet-connector-core": "4.18.0"
30
30
  },
31
31
  "peerDependencies": {}
32
32
  }
@@ -176,8 +176,9 @@ class DynamicWaasEVMConnector extends ethereumCore.EthereumWalletConnector {
176
176
  }
177
177
  getViemAccount({ accountAddress }) {
178
178
  const client = this.getWaasWalletClient();
179
- const customViemAccount = accounts.toAccount({
179
+ return accounts.toAccount({
180
180
  address: accountAddress,
181
+ signAuthorization: (parameters) => _tslib.__awaiter(this, void 0, void 0, function* () { return this.signAuthorization(parameters); }),
181
182
  signMessage: ({ message }) => client.signMessage({ accountAddress, message: message }),
182
183
  signTransaction: (transaction) => client
183
184
  .signTransaction({
@@ -190,7 +191,6 @@ class DynamicWaasEVMConnector extends ethereumCore.EthereumWalletConnector {
190
191
  message: typedData,
191
192
  }),
192
193
  });
193
- return customViemAccount;
194
194
  }
195
195
  getWalletClient(chainId) {
196
196
  var _a;
@@ -347,12 +347,11 @@ class DynamicWaasEVMConnector extends ethereumCore.EthereumWalletConnector {
347
347
  return activeAccount.address;
348
348
  });
349
349
  }
350
- experimental_signAuthorization(parameters) {
350
+ signAuthorization(parameters) {
351
351
  return _tslib.__awaiter(this, void 0, void 0, function* () {
352
- const { contractAddress } = parameters;
353
- const chainId = this.currentChainId();
354
- if (!chainId || typeof chainId !== 'number') {
355
- throw new Error('Chain id not found');
352
+ const { address: contractAddress, nonce, chainId } = parameters;
353
+ if (!contractAddress) {
354
+ throw new Error('Contract address not found');
356
355
  }
357
356
  const [signer, publicClient] = yield Promise.all([
358
357
  this.getSigner(),
@@ -362,17 +361,20 @@ class DynamicWaasEVMConnector extends ethereumCore.EthereumWalletConnector {
362
361
  throw new Error('Required clients not found');
363
362
  }
364
363
  const { address } = signer.account;
365
- const nonce = yield publicClient.getTransactionCount({ address });
366
364
  const walletClient = this.getWaasWalletClient();
367
365
  const signature = yield walletClient.sign({
368
366
  accountAddress: address,
369
367
  chainName: 'EVM',
370
368
  isFormatted: true,
371
- message: utils$1.hashAuthorization({ chainId, contractAddress, nonce }).slice(2),
369
+ message: utils$1.hashAuthorization({
370
+ address: contractAddress,
371
+ chainId,
372
+ nonce,
373
+ }).slice(2),
372
374
  });
373
375
  return {
376
+ address: contractAddress,
374
377
  chainId,
375
- contractAddress,
376
378
  nonce,
377
379
  r: `0x${Buffer.from(signature.r).toString('hex')}`,
378
380
  s: `0x${Buffer.from(signature.s).toString('hex')}`,
@@ -381,6 +383,22 @@ class DynamicWaasEVMConnector extends ethereumCore.EthereumWalletConnector {
381
383
  };
382
384
  });
383
385
  }
386
+ isAtomicSupported(chainId) {
387
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
388
+ logger.debug('[DynamicWaasEVMConnector] isAtomicSupported - not supported', {
389
+ chainId,
390
+ });
391
+ return false;
392
+ });
393
+ }
394
+ isPaymasterServiceSupported(chainId) {
395
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
396
+ logger.debug('[DynamicWaasEVMConnector] isPaymasterServiceSupported - not supported', {
397
+ chainId,
398
+ });
399
+ return false;
400
+ });
401
+ }
384
402
  }
385
403
  DynamicWaasEVMConnector.lastUsedChainIdStorageKey = 'dynamic-waas-evm-last-used-chain-id';
386
404
 
@@ -1,7 +1,7 @@
1
1
  import { Account, Hex, Transport, WalletClient, Chain as ViemChain } from 'viem';
2
- import { LocalAccount } from 'viem/accounts';
2
+ import { LocalAccount, SignAuthorizationParameters, SignAuthorizationReturnType } from 'viem/accounts';
3
3
  import { DynamicEvmWalletClient } from '@dynamic-labs-wallet/evm';
4
- import { EVMAuthorizationParameters, EVMAuthorizationResult, IDynamicWaasConnector } from '@dynamic-labs/wallet-connector-core';
4
+ import { IDynamicWaasConnector } from '@dynamic-labs/wallet-connector-core';
5
5
  import { EthereumWalletConnector, SwitchNetworkOps, EthereumWalletConnectorOpts } from '@dynamic-labs/ethereum-core';
6
6
  import { IUITransaction } from '@dynamic-labs/types';
7
7
  import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
@@ -9,6 +9,7 @@ interface JwtVerifiedCredentialWithSmartWalletRef extends JwtVerifiedCredential
9
9
  smartWalletRefId?: string;
10
10
  smartWalletRefAddress?: string;
11
11
  }
12
+ type SignAuthorizationParametersWithoutPrivateKey = Omit<SignAuthorizationParameters, 'privateKey'>;
12
13
  export declare class DynamicWaasEVMConnector extends EthereumWalletConnector implements IDynamicWaasConnector {
13
14
  name: string;
14
15
  overrideKey: string;
@@ -81,6 +82,8 @@ export declare class DynamicWaasEVMConnector extends EthereumWalletConnector imp
81
82
  createUiTransaction(from: string): Promise<IUITransaction>;
82
83
  getConnectedAccounts(): Promise<string[]>;
83
84
  getAddress(): Promise<string>;
84
- experimental_signAuthorization(parameters: EVMAuthorizationParameters): Promise<EVMAuthorizationResult>;
85
+ signAuthorization(parameters: SignAuthorizationParametersWithoutPrivateKey): Promise<SignAuthorizationReturnType>;
86
+ isAtomicSupported(chainId?: number): Promise<boolean>;
87
+ isPaymasterServiceSupported(chainId?: number): Promise<boolean>;
85
88
  }
86
89
  export {};
@@ -172,8 +172,9 @@ class DynamicWaasEVMConnector extends EthereumWalletConnector {
172
172
  }
173
173
  getViemAccount({ accountAddress }) {
174
174
  const client = this.getWaasWalletClient();
175
- const customViemAccount = toAccount({
175
+ return toAccount({
176
176
  address: accountAddress,
177
+ signAuthorization: (parameters) => __awaiter(this, void 0, void 0, function* () { return this.signAuthorization(parameters); }),
177
178
  signMessage: ({ message }) => client.signMessage({ accountAddress, message: message }),
178
179
  signTransaction: (transaction) => client
179
180
  .signTransaction({
@@ -186,7 +187,6 @@ class DynamicWaasEVMConnector extends EthereumWalletConnector {
186
187
  message: typedData,
187
188
  }),
188
189
  });
189
- return customViemAccount;
190
190
  }
191
191
  getWalletClient(chainId) {
192
192
  var _a;
@@ -343,12 +343,11 @@ class DynamicWaasEVMConnector extends EthereumWalletConnector {
343
343
  return activeAccount.address;
344
344
  });
345
345
  }
346
- experimental_signAuthorization(parameters) {
346
+ signAuthorization(parameters) {
347
347
  return __awaiter(this, void 0, void 0, function* () {
348
- const { contractAddress } = parameters;
349
- const chainId = this.currentChainId();
350
- if (!chainId || typeof chainId !== 'number') {
351
- throw new Error('Chain id not found');
348
+ const { address: contractAddress, nonce, chainId } = parameters;
349
+ if (!contractAddress) {
350
+ throw new Error('Contract address not found');
352
351
  }
353
352
  const [signer, publicClient] = yield Promise.all([
354
353
  this.getSigner(),
@@ -358,17 +357,20 @@ class DynamicWaasEVMConnector extends EthereumWalletConnector {
358
357
  throw new Error('Required clients not found');
359
358
  }
360
359
  const { address } = signer.account;
361
- const nonce = yield publicClient.getTransactionCount({ address });
362
360
  const walletClient = this.getWaasWalletClient();
363
361
  const signature = yield walletClient.sign({
364
362
  accountAddress: address,
365
363
  chainName: 'EVM',
366
364
  isFormatted: true,
367
- message: hashAuthorization({ chainId, contractAddress, nonce }).slice(2),
365
+ message: hashAuthorization({
366
+ address: contractAddress,
367
+ chainId,
368
+ nonce,
369
+ }).slice(2),
368
370
  });
369
371
  return {
372
+ address: contractAddress,
370
373
  chainId,
371
- contractAddress,
372
374
  nonce,
373
375
  r: `0x${Buffer.from(signature.r).toString('hex')}`,
374
376
  s: `0x${Buffer.from(signature.s).toString('hex')}`,
@@ -377,6 +379,22 @@ class DynamicWaasEVMConnector extends EthereumWalletConnector {
377
379
  };
378
380
  });
379
381
  }
382
+ isAtomicSupported(chainId) {
383
+ return __awaiter(this, void 0, void 0, function* () {
384
+ logger.debug('[DynamicWaasEVMConnector] isAtomicSupported - not supported', {
385
+ chainId,
386
+ });
387
+ return false;
388
+ });
389
+ }
390
+ isPaymasterServiceSupported(chainId) {
391
+ return __awaiter(this, void 0, void 0, function* () {
392
+ logger.debug('[DynamicWaasEVMConnector] isPaymasterServiceSupported - not supported', {
393
+ chainId,
394
+ });
395
+ return false;
396
+ });
397
+ }
380
398
  }
381
399
  DynamicWaasEVMConnector.lastUsedChainIdStorageKey = 'dynamic-waas-evm-last-used-chain-id';
382
400