@dynamic-labs/ethereum-aa 4.25.10 → 4.26.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 +19 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/ZeroDevConnector.cjs +36 -12
- package/src/ZeroDevConnector.d.ts +3 -3
- package/src/ZeroDevConnector.js +37 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.26.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.10...v4.26.0) (2025-08-14)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add forceRefresh to useTokenBalances ([#9320](https://github.com/dynamic-labs/dynamic-auth/issues/9320)) ([22c4035](https://github.com/dynamic-labs/dynamic-auth/commit/22c403546496ffb6b1ed846510a079efc65c5d57))
|
|
8
|
+
* add signMessageWithContext to support user operations with WaaS ([#9287](https://github.com/dynamic-labs/dynamic-auth/issues/9287)) ([744c158](https://github.com/dynamic-labs/dynamic-auth/commit/744c158a890346c624a101ba8b20911eefbdd1ef))
|
|
9
|
+
* add sui support to react native ([#9236](https://github.com/dynamic-labs/dynamic-auth/issues/9236)) ([301d821](https://github.com/dynamic-labs/dynamic-auth/commit/301d821b16eb1bc112609882ed0ae5e9f2477ace))
|
|
10
|
+
* add whitelistedContracts to token balance hooks ([#9324](https://github.com/dynamic-labs/dynamic-auth/issues/9324)) ([86596dd](https://github.com/dynamic-labs/dynamic-auth/commit/86596dd692152f82a2553b9824ce21781024dac1))
|
|
11
|
+
* pass policy context to sign authorization ([#9327](https://github.com/dynamic-labs/dynamic-auth/issues/9327)) ([3e6d009](https://github.com/dynamic-labs/dynamic-auth/commit/3e6d009ca3d50e01a665550fa803d07bd3038eb1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* don't prompt passkeys twice when component renders ([#9340](https://github.com/dynamic-labs/dynamic-auth/issues/9340)) ([8fbdd28](https://github.com/dynamic-labs/dynamic-auth/commit/8fbdd287d1dd67fee4720f16a3d506f75d9dafe7))
|
|
17
|
+
* onAuthSuccess with primaryWallet null when signing up with embedded wallets v3 ([#9345](https://github.com/dynamic-labs/dynamic-auth/issues/9345)) ([14e54a0](https://github.com/dynamic-labs/dynamic-auth/commit/14e54a093395a46cb32282aebc172b26c243d42f))
|
|
18
|
+
* rename passkey not automatically updating UI ([#9339](https://github.com/dynamic-labs/dynamic-auth/issues/9339)) ([b9ef253](https://github.com/dynamic-labs/dynamic-auth/commit/b9ef2532152a228feebb1fb9811937d7a14d81b1))
|
|
19
|
+
* wallet kit being initiated internally multiple times ([#9344](https://github.com/dynamic-labs/dynamic-auth/issues/9344)) ([49a3664](https://github.com/dynamic-labs/dynamic-auth/commit/49a3664c5995b0104693ec87b41b8540dd19bdca))
|
|
20
|
+
|
|
2
21
|
### [4.25.10](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.9...v4.25.10) (2025-08-07)
|
|
3
22
|
|
|
4
23
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum-aa",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.26.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",
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.0.749",
|
|
22
22
|
"@zerodev/ecdsa-validator": "5.4.9",
|
|
23
23
|
"@zerodev/multi-chain-ecdsa-validator": "5.4.5",
|
|
24
24
|
"@zerodev/sdk": "5.4.36",
|
|
25
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
26
|
-
"@dynamic-labs/ethereum-aa-core": "4.
|
|
27
|
-
"@dynamic-labs/ethereum-core": "4.
|
|
28
|
-
"@dynamic-labs/logger": "4.
|
|
29
|
-
"@dynamic-labs/types": "4.
|
|
30
|
-
"@dynamic-labs/utils": "4.
|
|
31
|
-
"@dynamic-labs/wallet-book": "4.
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
25
|
+
"@dynamic-labs/assert-package-version": "4.26.0",
|
|
26
|
+
"@dynamic-labs/ethereum-aa-core": "4.26.0",
|
|
27
|
+
"@dynamic-labs/ethereum-core": "4.26.0",
|
|
28
|
+
"@dynamic-labs/logger": "4.26.0",
|
|
29
|
+
"@dynamic-labs/types": "4.26.0",
|
|
30
|
+
"@dynamic-labs/utils": "4.26.0",
|
|
31
|
+
"@dynamic-labs/wallet-book": "4.26.0",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "4.26.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"viem": "^2.28.4"
|
package/src/ZeroDevConnector.cjs
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var _tslib = require('../_virtual/_tslib.cjs');
|
|
7
7
|
var constants$1 = require('@zerodev/sdk/constants');
|
|
8
8
|
var viem = require('viem');
|
|
9
|
+
var accountAbstraction = require('viem/account-abstraction');
|
|
9
10
|
var accounts = require('viem/accounts');
|
|
10
11
|
var ethereumAaCore = require('@dynamic-labs/ethereum-aa-core');
|
|
11
12
|
var ethereumCore = require('@dynamic-labs/ethereum-core');
|
|
@@ -425,6 +426,13 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
425
426
|
const unformattedTransaction = ethereumCore.unFormatTransaction(transaction);
|
|
426
427
|
const key = `${unformattedTransaction.from}-${unformattedTransaction.to}-${unformattedTransaction.data}`;
|
|
427
428
|
const cachedTransaction = this.userOperationCache[key];
|
|
429
|
+
const isWaasEOAConnector = this.eoaConnector && walletConnectorCore.isDynamicWaasConnector(this.eoaConnector);
|
|
430
|
+
if (isWaasEOAConnector) {
|
|
431
|
+
const userOperation = (cachedTransaction === null || cachedTransaction === void 0 ? void 0 : cachedTransaction.userOperation) ||
|
|
432
|
+
(yield this.getCurrentUserOperation(unformattedTransaction))
|
|
433
|
+
.userOperation;
|
|
434
|
+
return this.signAndSendUserOperationWithWaas(effectiveProvider, userOperation);
|
|
435
|
+
}
|
|
428
436
|
if (cachedTransaction) {
|
|
429
437
|
const signedTransaction = yield effectiveProvider.signUserOperation(cachedTransaction.userOperation);
|
|
430
438
|
return effectiveProvider.sendUserOperation(signedTransaction);
|
|
@@ -490,7 +498,7 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
490
498
|
return provider;
|
|
491
499
|
});
|
|
492
500
|
}
|
|
493
|
-
formatUserOperation(params) {
|
|
501
|
+
formatUserOperation(params, withAuthorization) {
|
|
494
502
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
495
503
|
var _a;
|
|
496
504
|
const kernelAccount = (_a = this.getAccountAbstractionProvider()) === null || _a === void 0 ? void 0 : _a.account;
|
|
@@ -534,17 +542,33 @@ class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
|
534
542
|
viem.toHex(params.paymasterPostOpGasLimit).slice(2).padStart(32, '0') + // Make sure it's 32 chars
|
|
535
543
|
params.paymasterData.slice(2) // Include full paymaster data
|
|
536
544
|
: '0x';
|
|
537
|
-
return {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
545
|
+
return Object.assign({ accountGasLimits: accountGasLimits, callData: params.callData, gasFees: gasFees, initCode, nonce: viem.toHex(params.nonce), paymasterAndData: paymasterAndData.toLowerCase(), preVerificationGas: preVerificationGas, sender: params.sender, signature: '0x' }, (withAuthorization && {
|
|
546
|
+
eip7702Auth: params.authorization,
|
|
547
|
+
}));
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
signAndSendUserOperationWithWaas(provider, userOperation) {
|
|
551
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
552
|
+
const chainId = Number(this.lastUsedChainId);
|
|
553
|
+
const hash = accountAbstraction.getUserOperationHash({
|
|
554
|
+
chainId: chainId,
|
|
555
|
+
entryPointAddress: this.entryPoint.address,
|
|
556
|
+
entryPointVersion: this.entryPoint.version,
|
|
557
|
+
userOperation: userOperation,
|
|
558
|
+
});
|
|
559
|
+
const formattedUserOperation = yield this.formatUserOperation(userOperation, true);
|
|
560
|
+
// At this point we know eoaConnector is a WAAS connector
|
|
561
|
+
const signature = yield this.eoaConnector.signMessageWithContext({
|
|
562
|
+
context: {
|
|
563
|
+
evmUserOperation: {
|
|
564
|
+
chainId,
|
|
565
|
+
entryPoint: this.entryPoint.address,
|
|
566
|
+
operation: formattedUserOperation,
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
message: { raw: hash },
|
|
570
|
+
});
|
|
571
|
+
return provider.sendUserOperation(Object.assign(Object.assign({}, userOperation), { signature: signature }));
|
|
548
572
|
});
|
|
549
573
|
}
|
|
550
574
|
getCurrentUserOperation(transaction) {
|
|
@@ -130,7 +130,7 @@ export declare class ZeroDevConnector extends AccountAbstractionBaseConnector im
|
|
|
130
130
|
private getTransport;
|
|
131
131
|
getWalletClient(chainId?: string): WalletClient<Transport, ViemChain, Account> | undefined;
|
|
132
132
|
getPublicClient(): Promise<void | PublicClient<Transport, ViemChain> | undefined>;
|
|
133
|
-
formatUserOperation(params: any): Promise<{
|
|
133
|
+
formatUserOperation(params: any, withAuthorization?: boolean): Promise<{
|
|
134
134
|
callData: any;
|
|
135
135
|
callGasLimit: `0x${string}`;
|
|
136
136
|
initCode: string;
|
|
@@ -142,9 +142,8 @@ export declare class ZeroDevConnector extends AccountAbstractionBaseConnector im
|
|
|
142
142
|
sender: any;
|
|
143
143
|
signature: string;
|
|
144
144
|
verificationGasLimit: `0x${string}`;
|
|
145
|
-
accountGasLimits?: undefined;
|
|
146
|
-
gasFees?: undefined;
|
|
147
145
|
} | {
|
|
146
|
+
eip7702Auth?: any;
|
|
148
147
|
accountGasLimits: string;
|
|
149
148
|
callData: any;
|
|
150
149
|
gasFees: string;
|
|
@@ -159,6 +158,7 @@ export declare class ZeroDevConnector extends AccountAbstractionBaseConnector im
|
|
|
159
158
|
maxPriorityFeePerGas?: undefined;
|
|
160
159
|
verificationGasLimit?: undefined;
|
|
161
160
|
}>;
|
|
161
|
+
private signAndSendUserOperationWithWaas;
|
|
162
162
|
getCurrentUserOperation(transaction: {
|
|
163
163
|
from: string;
|
|
164
164
|
to?: string;
|
package/src/ZeroDevConnector.js
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
import { __awaiter, __rest } from '../_virtual/_tslib.js';
|
|
3
3
|
import { KERNEL_V3_3, getEntryPoint as getEntryPoint$1 } from '@zerodev/sdk/constants';
|
|
4
4
|
import { publicActions, custom, createWalletClient, toHex, formatEther } from 'viem';
|
|
5
|
+
import { getUserOperationHash } from 'viem/account-abstraction';
|
|
5
6
|
import { toAccount } from 'viem/accounts';
|
|
6
7
|
import { AccountAbstractionBaseConnector } from '@dynamic-labs/ethereum-aa-core';
|
|
7
8
|
import { EthereumWallet, isEthWalletConnector, chainsMap, confirmationTransport, unFormatTransaction, interceptTransport } from '@dynamic-labs/ethereum-core';
|
|
8
9
|
import { ZerodevBundlerProvider, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
9
10
|
import { parseEvmNetworks, StorageService, DynamicError, DeferredPromise, parseChainId, wrapMethodWithCallback, TransactionGasCannotBeSponsoredError, InsufficientFundsError } from '@dynamic-labs/utils';
|
|
10
|
-
import { eventListenerHandlers, getWalletProvider } from '@dynamic-labs/wallet-connector-core';
|
|
11
|
+
import { eventListenerHandlers, getWalletProvider, isDynamicWaasConnector } from '@dynamic-labs/wallet-connector-core';
|
|
11
12
|
import { ZERO_DEV_LAST_USED_CHAIN_ID_KEY } from './constants.js';
|
|
12
13
|
import { logger } from './utils/logger.js';
|
|
13
14
|
import { PaymasterTypeEnum, createEcdsaKernelAccountClientWith7702, createEcdsaKernelAccountClient } from './utils/createEcdsaKernelAccountClient.js';
|
|
@@ -421,6 +422,13 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
421
422
|
const unformattedTransaction = unFormatTransaction(transaction);
|
|
422
423
|
const key = `${unformattedTransaction.from}-${unformattedTransaction.to}-${unformattedTransaction.data}`;
|
|
423
424
|
const cachedTransaction = this.userOperationCache[key];
|
|
425
|
+
const isWaasEOAConnector = this.eoaConnector && isDynamicWaasConnector(this.eoaConnector);
|
|
426
|
+
if (isWaasEOAConnector) {
|
|
427
|
+
const userOperation = (cachedTransaction === null || cachedTransaction === void 0 ? void 0 : cachedTransaction.userOperation) ||
|
|
428
|
+
(yield this.getCurrentUserOperation(unformattedTransaction))
|
|
429
|
+
.userOperation;
|
|
430
|
+
return this.signAndSendUserOperationWithWaas(effectiveProvider, userOperation);
|
|
431
|
+
}
|
|
424
432
|
if (cachedTransaction) {
|
|
425
433
|
const signedTransaction = yield effectiveProvider.signUserOperation(cachedTransaction.userOperation);
|
|
426
434
|
return effectiveProvider.sendUserOperation(signedTransaction);
|
|
@@ -486,7 +494,7 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
486
494
|
return provider;
|
|
487
495
|
});
|
|
488
496
|
}
|
|
489
|
-
formatUserOperation(params) {
|
|
497
|
+
formatUserOperation(params, withAuthorization) {
|
|
490
498
|
return __awaiter(this, void 0, void 0, function* () {
|
|
491
499
|
var _a;
|
|
492
500
|
const kernelAccount = (_a = this.getAccountAbstractionProvider()) === null || _a === void 0 ? void 0 : _a.account;
|
|
@@ -530,17 +538,33 @@ class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
|
530
538
|
toHex(params.paymasterPostOpGasLimit).slice(2).padStart(32, '0') + // Make sure it's 32 chars
|
|
531
539
|
params.paymasterData.slice(2) // Include full paymaster data
|
|
532
540
|
: '0x';
|
|
533
|
-
return {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
541
|
+
return Object.assign({ accountGasLimits: accountGasLimits, callData: params.callData, gasFees: gasFees, initCode, nonce: toHex(params.nonce), paymasterAndData: paymasterAndData.toLowerCase(), preVerificationGas: preVerificationGas, sender: params.sender, signature: '0x' }, (withAuthorization && {
|
|
542
|
+
eip7702Auth: params.authorization,
|
|
543
|
+
}));
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
signAndSendUserOperationWithWaas(provider, userOperation) {
|
|
547
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
548
|
+
const chainId = Number(this.lastUsedChainId);
|
|
549
|
+
const hash = getUserOperationHash({
|
|
550
|
+
chainId: chainId,
|
|
551
|
+
entryPointAddress: this.entryPoint.address,
|
|
552
|
+
entryPointVersion: this.entryPoint.version,
|
|
553
|
+
userOperation: userOperation,
|
|
554
|
+
});
|
|
555
|
+
const formattedUserOperation = yield this.formatUserOperation(userOperation, true);
|
|
556
|
+
// At this point we know eoaConnector is a WAAS connector
|
|
557
|
+
const signature = yield this.eoaConnector.signMessageWithContext({
|
|
558
|
+
context: {
|
|
559
|
+
evmUserOperation: {
|
|
560
|
+
chainId,
|
|
561
|
+
entryPoint: this.entryPoint.address,
|
|
562
|
+
operation: formattedUserOperation,
|
|
563
|
+
},
|
|
564
|
+
},
|
|
565
|
+
message: { raw: hash },
|
|
566
|
+
});
|
|
567
|
+
return provider.sendUserOperation(Object.assign(Object.assign({}, userOperation), { signature: signature }));
|
|
544
568
|
});
|
|
545
569
|
}
|
|
546
570
|
getCurrentUserOperation(transaction) {
|