@dynamic-labs/ethereum-aa 4.13.0 → 4.15.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 +30 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/ZeroDevConnector.cjs +9 -9
- package/src/ZeroDevConnector.d.ts +2 -2
- package/src/ZeroDevConnector.js +10 -10
- package/src/index.cjs +0 -13
- package/src/index.d.ts +0 -3
- package/src/index.js +1 -11
- package/src/utils/index.d.ts +1 -1
- package/src/utils/isEVMAuthorizationCapable.cjs +8 -0
- package/src/utils/isEVMAuthorizationCapable.d.ts +6 -0
- package/src/utils/isEVMAuthorizationCapable.js +4 -0
- package/src/AccountAbstractionConnector.cjs +0 -104
- package/src/AccountAbstractionConnector.d.ts +0 -69
- package/src/AccountAbstractionConnector.js +0 -100
- package/src/ZKsyncConnector.cjs +0 -527
- package/src/ZKsyncConnector.d.ts +0 -17415
- package/src/ZKsyncConnector.js +0 -523
- package/src/ethereum-aa.cjs +0 -9
- package/src/ethereum-aa.d.ts +0 -2
- package/src/ethereum-aa.js +0 -5
- package/src/utils/abi.cjs +0 -88
- package/src/utils/abi.d.ts +0 -102
- package/src/utils/abi.js +0 -84
- package/src/utils/isZKsyncConnector.cjs +0 -8
- package/src/utils/isZKsyncConnector.d.ts +0 -3
- package/src/utils/isZKsyncConnector.js +0 -4
- package/src/utils/zksync/deployment.cjs +0 -97
- package/src/utils/zksync/deployment.d.ts +0 -37
- package/src/utils/zksync/deployment.js +0 -91
- package/src/utils/zksync/getSalt.cjs +0 -10
- package/src/utils/zksync/getSalt.d.ts +0 -1
- package/src/utils/zksync/getSalt.js +0 -6
- package/src/utils/zksync/index.d.ts +0 -4
- package/src/utils/zksync/network.cjs +0 -17
- package/src/utils/zksync/network.d.ts +0 -2
- package/src/utils/zksync/network.js +0 -13
- package/src/utils/zksync/passkeys.cjs +0 -41
- package/src/utils/zksync/passkeys.d.ts +0 -9
- package/src/utils/zksync/passkeys.js +0 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.15.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.14.0...v4.15.0) (2025-04-30)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add end session override for waas sui connector ([#8602](https://github.com/dynamic-labs/dynamic-auth/issues/8602)) ([6c9e6fd](https://github.com/dynamic-labs/dynamic-auth/commit/6c9e6fda4581a4e3b9e1544f22d6e5f03723d928))
|
|
8
|
+
* add presets and demo fixes ([#8609](https://github.com/dynamic-labs/dynamic-auth/issues/8609)) ([2201914](https://github.com/dynamic-labs/dynamic-auth/commit/2201914d2029ff0b67dfc2c6e696f728f32f57b3))
|
|
9
|
+
* add ShareConfig component with modal and styling ([74aff97](https://github.com/dynamic-labs/dynamic-auth/commit/74aff97689c9e7c9abc892c1deac4d748b498909))
|
|
10
|
+
* add wallet actions section and update UI components ([#8598](https://github.com/dynamic-labs/dynamic-auth/issues/8598)) ([d6170b7](https://github.com/dynamic-labs/dynamic-auth/commit/d6170b7f6abd963e6a081541e2c674b7141f1c15))
|
|
11
|
+
* dynamic waas to sign 7702 authorization ([#8603](https://github.com/dynamic-labs/dynamic-auth/issues/8603)) ([74e1722](https://github.com/dynamic-labs/dynamic-auth/commit/74e1722f417aab621f4062093e109dc45cf542ea))
|
|
12
|
+
* add signMessage feature to global wallet client ([#8563](https://github.com/dynamic-labs/dynamic-auth/issues/8563)) ([c3f9734](https://github.com/dynamic-labs/dynamic-auth/commit/c3f9734c097f5c9b88c35e0f642632f261e40fe7))
|
|
13
|
+
* allow displaying custom links in the global wallet profile dropdown menu ([#8617](https://github.com/dynamic-labs/dynamic-auth/issues/8617)) ([5fb956c](https://github.com/dynamic-labs/dynamic-auth/commit/5fb956c0c2b681fece56104b330a0e90fc8fb936))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* add default base api url for dynamic waas config on connector initialization ([#8604](https://github.com/dynamic-labs/dynamic-auth/issues/8604)) ([6218a7e](https://github.com/dynamic-labs/dynamic-auth/commit/6218a7edda4feb9028be548acfe8eff64578f0a0))
|
|
19
|
+
* enables caching for sprite.svg ([#8610](https://github.com/dynamic-labs/dynamic-auth/issues/8610)) ([decdb69](https://github.com/dynamic-labs/dynamic-auth/commit/decdb69b4df8bc2d97ee579fa423e9682ab1720b))
|
|
20
|
+
* change mobile experience to redirect ([#8003](https://github.com/dynamic-labs/dynamic-auth/issues/8003)) ([2e8a1d8](https://github.com/dynamic-labs/dynamic-auth/commit/2e8a1d8b54f54386e1abc9f4e6e5e9acf859e5fa))
|
|
21
|
+
* optimize wallet finder when performing eth and sol operations in global wallet popup ([#8564](https://github.com/dynamic-labs/dynamic-auth/issues/8564)) ([2eaf424](https://github.com/dynamic-labs/dynamic-auth/commit/2eaf4244d4aa1b1cc5c6e32574db10ab34f8ed80))
|
|
22
|
+
* loading state for v3 connect-only embedded wallet generation ([#8600](https://github.com/dynamic-labs/dynamic-auth/issues/8600)) ([af34d16](https://github.com/dynamic-labs/dynamic-auth/commit/af34d168a765aa82867116541e73c59672ab2341))
|
|
23
|
+
|
|
24
|
+
## [4.14.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.13.0...v4.14.0) (2025-04-25)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* if you are using zksync, note that the ZKsyncSmartWalletConnectors moved to @dynamic-labs/ethereum-aa-zksync and you will need to install the package and import from there ([#8585](https://github.com/dynamic-labs/dynamic-auth/issues/8585)) ([2bd8c49](https://github.com/dynamic-labs/dynamic-auth/commit/2bd8c4959081ab798da5c411825bf60bb58c1605))
|
|
30
|
+
* edit view top padding ([#8582](https://github.com/dynamic-labs/dynamic-auth/issues/8582)) ([18df9fa](https://github.com/dynamic-labs/dynamic-auth/commit/18df9fa294b299b260b71b5f2faab7f98b6e4492))
|
|
31
|
+
|
|
2
32
|
## [4.13.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.12.4...v4.13.0) (2025-04-24)
|
|
3
33
|
|
|
4
34
|
|
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.15.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.660",
|
|
22
22
|
"@zerodev/ecdsa-validator": "5.4.4",
|
|
23
23
|
"@zerodev/multi-chain-ecdsa-validator": "5.4.3",
|
|
24
24
|
"@zerodev/sdk": "5.4.26",
|
|
25
|
-
"
|
|
26
|
-
"@dynamic-labs/
|
|
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.15.0",
|
|
26
|
+
"@dynamic-labs/ethereum-aa-core": "4.15.0",
|
|
27
|
+
"@dynamic-labs/ethereum-core": "4.15.0",
|
|
28
|
+
"@dynamic-labs/logger": "4.15.0",
|
|
29
|
+
"@dynamic-labs/types": "4.15.0",
|
|
30
|
+
"@dynamic-labs/utils": "4.15.0",
|
|
31
|
+
"@dynamic-labs/wallet-book": "4.15.0",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "4.15.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"viem": "^2.21.60"
|
package/src/ZeroDevConnector.cjs
CHANGED
|
@@ -10,16 +10,16 @@ var constants$1 = require('@zerodev/sdk/constants');
|
|
|
10
10
|
var ethereumCore = require('@dynamic-labs/ethereum-core');
|
|
11
11
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
12
12
|
var utils = require('@dynamic-labs/utils');
|
|
13
|
+
var ethereumAaCore = require('@dynamic-labs/ethereum-aa-core');
|
|
13
14
|
var constants = require('./constants.cjs');
|
|
14
15
|
var logger = require('./utils/logger.cjs');
|
|
15
16
|
var createEcdsaKernelAccountClient = require('./utils/createEcdsaKernelAccountClient.cjs');
|
|
16
17
|
var getEcdsaValidator = require('./utils/getEcdsaValidator.cjs');
|
|
17
18
|
var getEntryPoint = require('./utils/getEntryPoint.cjs');
|
|
18
19
|
var getKernelVersion = require('./utils/getKernelVersion.cjs');
|
|
19
|
-
require('
|
|
20
|
-
var AccountAbstractionConnector = require('./AccountAbstractionConnector.cjs');
|
|
20
|
+
var isEVMAuthorizationCapable = require('./utils/isEVMAuthorizationCapable.cjs');
|
|
21
21
|
|
|
22
|
-
class ZeroDevConnector extends
|
|
22
|
+
class ZeroDevConnector extends ethereumAaCore.AccountAbstractionBaseConnector {
|
|
23
23
|
constructor(opts) {
|
|
24
24
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
25
25
|
super(opts);
|
|
@@ -160,11 +160,11 @@ class ZeroDevConnector extends AccountAbstractionConnector.AccountAbstractionCon
|
|
|
160
160
|
}
|
|
161
161
|
getOrCreateAuthorization() {
|
|
162
162
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
163
|
-
var _a
|
|
163
|
+
var _a;
|
|
164
164
|
if (!this.eoaConnector)
|
|
165
165
|
throw new utils.DynamicError('No EOA connector');
|
|
166
|
-
if (!
|
|
167
|
-
throw new utils.DynamicError('
|
|
166
|
+
if (!isEVMAuthorizationCapable.isEVMAuthorizationCapable(this.eoaConnector)) {
|
|
167
|
+
throw new utils.DynamicError('Connector does not support EVM authorization');
|
|
168
168
|
}
|
|
169
169
|
const ZERODEV_AUTHORIZATION = 'zerodev_authorization';
|
|
170
170
|
try {
|
|
@@ -173,10 +173,10 @@ class ZeroDevConnector extends AccountAbstractionConnector.AccountAbstractionCon
|
|
|
173
173
|
return storedAuthorization;
|
|
174
174
|
}
|
|
175
175
|
const kernelVersion = constants$1.KERNEL_V3_3_BETA;
|
|
176
|
-
const authorization = yield
|
|
177
|
-
contractAddress: (
|
|
176
|
+
const authorization = yield this.eoaConnector.experimental_signAuthorization({
|
|
177
|
+
contractAddress: (_a = ZeroDevConnector.kernelDelegationAddress) !== null && _a !== void 0 ? _a : constants$1.KernelVersionToAddressesMap[kernelVersion]
|
|
178
178
|
.accountImplementationAddress,
|
|
179
|
-
})
|
|
179
|
+
});
|
|
180
180
|
if (authorization) {
|
|
181
181
|
const serializedAuth = Object.entries(authorization).reduce((acc, [key, value]) => {
|
|
182
182
|
acc[key] = typeof value === 'bigint' ? value.toString() : value;
|
|
@@ -9,8 +9,8 @@ import { EcdsaValidatorOptions, Provider, ProviderEntryPointVersionEnum, Provide
|
|
|
9
9
|
import { Chain, InternalWalletConnector, IZeroDevConnector } from '@dynamic-labs/wallet-connector-core';
|
|
10
10
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
11
11
|
import { GenericNetwork, TransactionReceipt, WalletUiUtils } from '@dynamic-labs/types';
|
|
12
|
+
import { AccountAbstractionBaseConnector, AccountAbstractionConnectorProps } from '@dynamic-labs/ethereum-aa-core';
|
|
12
13
|
import { BundlerProvider } from './utils';
|
|
13
|
-
import { AccountAbstractionConnector, AccountAbstractionConnectorProps } from './AccountAbstractionConnector';
|
|
14
14
|
type ZeroDevConnectorProps = AccountAbstractionConnectorProps & {
|
|
15
15
|
apiProviders: {
|
|
16
16
|
[key in ProviderEnum]?: Provider;
|
|
@@ -24,7 +24,7 @@ type ZeroDevConnectorProps = AccountAbstractionConnectorProps & {
|
|
|
24
24
|
providersConfig?: RegisterEvmProvidersConfig;
|
|
25
25
|
};
|
|
26
26
|
type KernelClient = KernelAccountClient<Transport, ViemChain, SmartAccount, Client, RpcSchema>;
|
|
27
|
-
export declare class ZeroDevConnector extends
|
|
27
|
+
export declare class ZeroDevConnector extends AccountAbstractionBaseConnector implements IZeroDevConnector {
|
|
28
28
|
clientId: string;
|
|
29
29
|
eoaConnector: InternalWalletConnector | undefined;
|
|
30
30
|
eoaAddress: string | undefined;
|
package/src/ZeroDevConnector.js
CHANGED
|
@@ -4,18 +4,18 @@ import { publicActions, custom, createWalletClient, toHex, formatEther } from 'v
|
|
|
4
4
|
import { toAccount } from 'viem/accounts';
|
|
5
5
|
import { KERNEL_V3_3_BETA, KernelVersionToAddressesMap, getEntryPoint as getEntryPoint$1 } from '@zerodev/sdk/constants';
|
|
6
6
|
import { EthereumWallet, isEthWalletConnector, chainsMap, confirmationTransport, unFormatTransaction } from '@dynamic-labs/ethereum-core';
|
|
7
|
-
import { eventListenerHandlers
|
|
7
|
+
import { eventListenerHandlers } from '@dynamic-labs/wallet-connector-core';
|
|
8
8
|
import { parseEvmNetworks, StorageService, DynamicError, DeferredPromise, parseChainId, wrapMethodWithCallback, TransactionGasCannotBeSponsoredError, InsufficientFundsError } from '@dynamic-labs/utils';
|
|
9
|
+
import { AccountAbstractionBaseConnector } from '@dynamic-labs/ethereum-aa-core';
|
|
9
10
|
import { ZERO_DEV_LAST_USED_CHAIN_ID_KEY } from './constants.js';
|
|
10
11
|
import { logger } from './utils/logger.js';
|
|
11
12
|
import { createEcdsaKernelAccountClientWith7702, createEcdsaKernelAccountClient } from './utils/createEcdsaKernelAccountClient.js';
|
|
12
13
|
import { getEcdsaValidator } from './utils/getEcdsaValidator.js';
|
|
13
14
|
import { getEntryPoint } from './utils/getEntryPoint.js';
|
|
14
15
|
import { getKernelVersion } from './utils/getKernelVersion.js';
|
|
15
|
-
import '
|
|
16
|
-
import { AccountAbstractionConnector } from './AccountAbstractionConnector.js';
|
|
16
|
+
import { isEVMAuthorizationCapable } from './utils/isEVMAuthorizationCapable.js';
|
|
17
17
|
|
|
18
|
-
class ZeroDevConnector extends
|
|
18
|
+
class ZeroDevConnector extends AccountAbstractionBaseConnector {
|
|
19
19
|
constructor(opts) {
|
|
20
20
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
21
21
|
super(opts);
|
|
@@ -156,11 +156,11 @@ class ZeroDevConnector extends AccountAbstractionConnector {
|
|
|
156
156
|
}
|
|
157
157
|
getOrCreateAuthorization() {
|
|
158
158
|
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
-
var _a
|
|
159
|
+
var _a;
|
|
160
160
|
if (!this.eoaConnector)
|
|
161
161
|
throw new DynamicError('No EOA connector');
|
|
162
|
-
if (!
|
|
163
|
-
throw new DynamicError('
|
|
162
|
+
if (!isEVMAuthorizationCapable(this.eoaConnector)) {
|
|
163
|
+
throw new DynamicError('Connector does not support EVM authorization');
|
|
164
164
|
}
|
|
165
165
|
const ZERODEV_AUTHORIZATION = 'zerodev_authorization';
|
|
166
166
|
try {
|
|
@@ -169,10 +169,10 @@ class ZeroDevConnector extends AccountAbstractionConnector {
|
|
|
169
169
|
return storedAuthorization;
|
|
170
170
|
}
|
|
171
171
|
const kernelVersion = KERNEL_V3_3_BETA;
|
|
172
|
-
const authorization = yield
|
|
173
|
-
contractAddress: (
|
|
172
|
+
const authorization = yield this.eoaConnector.experimental_signAuthorization({
|
|
173
|
+
contractAddress: (_a = ZeroDevConnector.kernelDelegationAddress) !== null && _a !== void 0 ? _a : KernelVersionToAddressesMap[kernelVersion]
|
|
174
174
|
.accountImplementationAddress,
|
|
175
|
-
})
|
|
175
|
+
});
|
|
176
176
|
if (authorization) {
|
|
177
177
|
const serializedAuth = Object.entries(authorization).reduce((acc, [key, value]) => {
|
|
178
178
|
acc[key] = typeof value === 'bigint' ? value.toString() : value;
|
package/src/index.cjs
CHANGED
|
@@ -6,15 +6,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var assertPackageVersion = require('@dynamic-labs/assert-package-version');
|
|
7
7
|
var _package = require('../package.cjs');
|
|
8
8
|
var ZeroDevConnector = require('./ZeroDevConnector.cjs');
|
|
9
|
-
var ZKsyncConnector = require('./ZKsyncConnector.cjs');
|
|
10
9
|
var createEcdsaKernelAccountClient = require('./utils/createEcdsaKernelAccountClient.cjs');
|
|
11
10
|
var fetchZeroDevChain = require('./utils/fetchZeroDevChain.cjs');
|
|
12
11
|
var getEcdsaValidator = require('./utils/getEcdsaValidator.cjs');
|
|
13
12
|
var getEntryPoint = require('./utils/getEntryPoint.cjs');
|
|
14
13
|
var getKernelVersion = require('./utils/getKernelVersion.cjs');
|
|
15
|
-
var ethereumAa = require('./ethereum-aa.cjs');
|
|
16
14
|
var isZeroDevConnector = require('./utils/isZeroDevConnector.cjs');
|
|
17
|
-
var isZKsyncConnector = require('./utils/isZKsyncConnector.cjs');
|
|
18
15
|
|
|
19
16
|
assertPackageVersion.assertPackageVersion('@dynamic-labs/ethereum-aa', _package.version);
|
|
20
17
|
const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, } = {}) => {
|
|
@@ -31,22 +28,12 @@ const ZeroDevSmartWalletConnectors = (props) => {
|
|
|
31
28
|
}
|
|
32
29
|
return [];
|
|
33
30
|
};
|
|
34
|
-
const ZKsyncSmartWalletConnectors = (props) => {
|
|
35
|
-
var _a;
|
|
36
|
-
if ((_a = props.apiProviders) === null || _a === void 0 ? void 0 : _a.zksync) {
|
|
37
|
-
return [ZKsyncConnector.ZKsyncConnector];
|
|
38
|
-
}
|
|
39
|
-
return [];
|
|
40
|
-
};
|
|
41
31
|
|
|
42
32
|
exports.createEcdsaKernelAccountClient = createEcdsaKernelAccountClient.createEcdsaKernelAccountClient;
|
|
43
33
|
exports.fetchZeroDevChain = fetchZeroDevChain.fetchZeroDevChain;
|
|
44
34
|
exports.getEcdsaValidator = getEcdsaValidator.getEcdsaValidator;
|
|
45
35
|
exports.getEntryPoint = getEntryPoint.getEntryPoint;
|
|
46
36
|
exports.getKernelVersion = getKernelVersion.getKernelVersion;
|
|
47
|
-
exports.EthereumAaConnector = ethereumAa.EthereumAaConnector;
|
|
48
37
|
exports.isZeroDevConnector = isZeroDevConnector.isZeroDevConnector;
|
|
49
|
-
exports.isZKsyncConnector = isZKsyncConnector.isZKsyncConnector;
|
|
50
|
-
exports.ZKsyncSmartWalletConnectors = ZKsyncSmartWalletConnectors;
|
|
51
38
|
exports.ZeroDevSmartWalletConnectors = ZeroDevSmartWalletConnectors;
|
|
52
39
|
exports.ZeroDevSmartWalletConnectorsWithConfig = ZeroDevSmartWalletConnectorsWithConfig;
|
package/src/index.d.ts
CHANGED
|
@@ -5,9 +5,7 @@ export { fetchZeroDevChain } from './utils/fetchZeroDevChain';
|
|
|
5
5
|
export { getEcdsaValidator } from './utils/getEcdsaValidator';
|
|
6
6
|
export { getEntryPoint } from './utils/getEntryPoint';
|
|
7
7
|
export { getKernelVersion } from './utils/getKernelVersion';
|
|
8
|
-
export * from './ethereum-aa';
|
|
9
8
|
export { isZeroDevConnector } from './utils/isZeroDevConnector';
|
|
10
|
-
export { isZKsyncConnector } from './utils/isZKsyncConnector';
|
|
11
9
|
export declare const ZeroDevSmartWalletConnectorsWithConfig: ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, }?: {
|
|
12
10
|
bundlerProvider?: BundlerProvider;
|
|
13
11
|
bundlerRpc?: string;
|
|
@@ -15,4 +13,3 @@ export declare const ZeroDevSmartWalletConnectorsWithConfig: ({ bundlerProvider,
|
|
|
15
13
|
kernelDelegationAddress?: `0x${string}`;
|
|
16
14
|
}) => (props: any) => WalletConnectorConstructor[];
|
|
17
15
|
export declare const ZeroDevSmartWalletConnectors: (props: any) => WalletConnectorConstructor[];
|
|
18
|
-
export declare const ZKsyncSmartWalletConnectors: (props: any) => WalletConnectorConstructor[];
|
package/src/index.js
CHANGED
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
|
|
3
3
|
import { version } from '../package.js';
|
|
4
4
|
import { ZeroDevConnector } from './ZeroDevConnector.js';
|
|
5
|
-
import { ZKsyncConnector } from './ZKsyncConnector.js';
|
|
6
5
|
export { createEcdsaKernelAccountClient } from './utils/createEcdsaKernelAccountClient.js';
|
|
7
6
|
export { fetchZeroDevChain } from './utils/fetchZeroDevChain.js';
|
|
8
7
|
export { getEcdsaValidator } from './utils/getEcdsaValidator.js';
|
|
9
8
|
export { getEntryPoint } from './utils/getEntryPoint.js';
|
|
10
9
|
export { getKernelVersion } from './utils/getKernelVersion.js';
|
|
11
|
-
export { EthereumAaConnector } from './ethereum-aa.js';
|
|
12
10
|
export { isZeroDevConnector } from './utils/isZeroDevConnector.js';
|
|
13
|
-
export { isZKsyncConnector } from './utils/isZKsyncConnector.js';
|
|
14
11
|
|
|
15
12
|
assertPackageVersion('@dynamic-labs/ethereum-aa', version);
|
|
16
13
|
const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, } = {}) => {
|
|
@@ -27,12 +24,5 @@ const ZeroDevSmartWalletConnectors = (props) => {
|
|
|
27
24
|
}
|
|
28
25
|
return [];
|
|
29
26
|
};
|
|
30
|
-
const ZKsyncSmartWalletConnectors = (props) => {
|
|
31
|
-
var _a;
|
|
32
|
-
if ((_a = props.apiProviders) === null || _a === void 0 ? void 0 : _a.zksync) {
|
|
33
|
-
return [ZKsyncConnector];
|
|
34
|
-
}
|
|
35
|
-
return [];
|
|
36
|
-
};
|
|
37
27
|
|
|
38
|
-
export {
|
|
28
|
+
export { ZeroDevSmartWalletConnectors, ZeroDevSmartWalletConnectorsWithConfig };
|
package/src/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InternalWalletConnector, EVMAuthorizationParameters, EVMAuthorizationResult } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
type EVMAuthorizationCapableConnector = InternalWalletConnector & {
|
|
3
|
+
experimental_signAuthorization: (params: EVMAuthorizationParameters) => Promise<EVMAuthorizationResult>;
|
|
4
|
+
};
|
|
5
|
+
export declare const isEVMAuthorizationCapable: (connector: InternalWalletConnector) => connector is EVMAuthorizationCapableConnector;
|
|
6
|
+
export {};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var _tslib = require('../_virtual/_tslib.cjs');
|
|
7
|
-
var viem = require('viem');
|
|
8
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
|
-
var utils = require('@dynamic-labs/utils');
|
|
10
|
-
var ethereumCore = require('@dynamic-labs/ethereum-core');
|
|
11
|
-
|
|
12
|
-
class AccountAbstractionConnector extends walletConnectorCore.WalletConnectorBase {
|
|
13
|
-
constructor(opts) {
|
|
14
|
-
super({ walletBook: opts.walletBook });
|
|
15
|
-
this._isGasSponsorshipDisabled = false;
|
|
16
|
-
this.evmNetworks = [];
|
|
17
|
-
this.ChainWallet = ethereumCore.EthereumWallet;
|
|
18
|
-
this.isEmbeddedWallet = true;
|
|
19
|
-
this.connectedChain = 'EVM';
|
|
20
|
-
this.supportedChains = ['ETH', 'EVM'];
|
|
21
|
-
this._walletUiUtils = opts.walletUiUtils;
|
|
22
|
-
this.evmNetworks = opts.evmNetworks;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Gets the EOA connector associated with this account abstraction wallet
|
|
26
|
-
* @deprecated Use getEOAConnector with a specific smart contract wallet address instead
|
|
27
|
-
*/
|
|
28
|
-
getEOAConnector() {
|
|
29
|
-
return this.eoaConnector;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Disables gas sponsorship for the next transaction
|
|
33
|
-
*/
|
|
34
|
-
disableGasSponsorshipOnce() {
|
|
35
|
-
this._isGasSponsorshipDisabled = true;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Protected method to check if gas sponsorship is disabled
|
|
39
|
-
*/
|
|
40
|
-
isGasSponsorshipDisabled() {
|
|
41
|
-
return this._isGasSponsorshipDisabled;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Gets the enabled networks
|
|
45
|
-
*/
|
|
46
|
-
getEnabledNetworks() {
|
|
47
|
-
return this.evmNetworks;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Gets the signer for the current wallet
|
|
51
|
-
*/
|
|
52
|
-
getSigner() {
|
|
53
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
return this.getWalletClient();
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Gets the balance for an address
|
|
59
|
-
*/
|
|
60
|
-
getBalance(address) {
|
|
61
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
const publicClient = yield this.getPublicClient();
|
|
63
|
-
if (!publicClient) {
|
|
64
|
-
throw new utils.DynamicError('No public client available');
|
|
65
|
-
}
|
|
66
|
-
const balance = yield publicClient.getBalance({ address });
|
|
67
|
-
return viem.formatEther(balance);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Validates that the expected wallet is active
|
|
72
|
-
*/
|
|
73
|
-
validateActiveWallet(expectedAddress) {
|
|
74
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const currentAddress = yield this.getAddress();
|
|
76
|
-
if ((currentAddress === null || currentAddress === void 0 ? void 0 : currentAddress.toLowerCase()) !== expectedAddress.toLowerCase()) {
|
|
77
|
-
throw new utils.DynamicError('Invalid active wallet');
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
createUiTransaction(from) {
|
|
82
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
yield this.validateActiveWallet(from);
|
|
84
|
-
const walletClient = this.getWalletClient();
|
|
85
|
-
const publicClient = yield this.getPublicClient();
|
|
86
|
-
if (!publicClient || !walletClient) {
|
|
87
|
-
throw new utils.DynamicError('No public client available');
|
|
88
|
-
}
|
|
89
|
-
return ethereumCore.createViemUiTransaction({
|
|
90
|
-
from,
|
|
91
|
-
publicClient: publicClient,
|
|
92
|
-
walletClient: walletClient,
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
getBlockExplorerUrlsForCurrentNetwork() {
|
|
97
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
var _a, _b;
|
|
99
|
-
return (_b = (_a = this.eoaConnector) === null || _a === void 0 ? void 0 : _a.getBlockExplorerUrlsForCurrentNetwork()) !== null && _b !== void 0 ? _b : [];
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
exports.AccountAbstractionConnector = AccountAbstractionConnector;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { Chain, InternalWalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
-
import { EthereumWallet } from '@dynamic-labs/ethereum-core';
|
|
3
|
-
import { IUITransaction, WalletUiUtils, GenericNetwork } from '@dynamic-labs/types';
|
|
4
|
-
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
5
|
-
import { SmartWalletProperties } from '@dynamic-labs/sdk-api-core';
|
|
6
|
-
export type AccountAbstractionConnectorProps = {
|
|
7
|
-
walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
8
|
-
walletBook: WalletBookSchema;
|
|
9
|
-
evmNetworks: GenericNetwork[];
|
|
10
|
-
};
|
|
11
|
-
export declare abstract class AccountAbstractionConnector extends WalletConnectorBase<typeof EthereumWallet> {
|
|
12
|
-
abstract eoaConnector: InternalWalletConnector | undefined;
|
|
13
|
-
abstract eoaAddress: string | undefined;
|
|
14
|
-
protected _walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
15
|
-
private _isGasSponsorshipDisabled;
|
|
16
|
-
protected evmNetworks: GenericNetwork[];
|
|
17
|
-
ChainWallet: typeof EthereumWallet;
|
|
18
|
-
isEmbeddedWallet: boolean;
|
|
19
|
-
connectedChain: Chain;
|
|
20
|
-
supportedChains: Chain[];
|
|
21
|
-
constructor(opts: AccountAbstractionConnectorProps);
|
|
22
|
-
/**
|
|
23
|
-
* Gets the EOA connector associated with this account abstraction wallet
|
|
24
|
-
* @deprecated Use getEOAConnector with a specific smart contract wallet address instead
|
|
25
|
-
*/
|
|
26
|
-
getEOAConnector(): InternalWalletConnector | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Disables gas sponsorship for the next transaction
|
|
29
|
-
*/
|
|
30
|
-
disableGasSponsorshipOnce(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Protected method to check if gas sponsorship is disabled
|
|
33
|
-
*/
|
|
34
|
-
protected isGasSponsorshipDisabled(): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Gets the enabled networks
|
|
37
|
-
*/
|
|
38
|
-
getEnabledNetworks(): GenericNetwork[];
|
|
39
|
-
/**
|
|
40
|
-
* Gets the signer for the current wallet
|
|
41
|
-
*/
|
|
42
|
-
getSigner(): Promise<unknown>;
|
|
43
|
-
/**
|
|
44
|
-
* Gets the balance for an address
|
|
45
|
-
*/
|
|
46
|
-
getBalance(address: string): Promise<string | undefined>;
|
|
47
|
-
/**
|
|
48
|
-
* Validates that the expected wallet is active
|
|
49
|
-
*/
|
|
50
|
-
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
51
|
-
abstract canSponsorTransactionGas(transaction: {
|
|
52
|
-
from: string;
|
|
53
|
-
to?: string;
|
|
54
|
-
value?: bigint;
|
|
55
|
-
data?: string;
|
|
56
|
-
}): Promise<boolean>;
|
|
57
|
-
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
58
|
-
getBlockExplorerUrlsForCurrentNetwork(): Promise<string[]>;
|
|
59
|
-
abstract getAccountAbstractionProvider<T>({ withSponsorship, }: {
|
|
60
|
-
withSponsorship: boolean;
|
|
61
|
-
}): Promise<T>;
|
|
62
|
-
abstract initialize(params: {
|
|
63
|
-
smartWalletAddress: string;
|
|
64
|
-
eoaAddress: string;
|
|
65
|
-
eoaConnector: InternalWalletConnector;
|
|
66
|
-
properties?: SmartWalletProperties;
|
|
67
|
-
shouldSetEoaConnector?: boolean;
|
|
68
|
-
}): Promise<void>;
|
|
69
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { __awaiter } from '../_virtual/_tslib.js';
|
|
3
|
-
import { formatEther } from 'viem';
|
|
4
|
-
import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
|
-
import { EthereumWallet, createViemUiTransaction } from '@dynamic-labs/ethereum-core';
|
|
7
|
-
|
|
8
|
-
class AccountAbstractionConnector extends WalletConnectorBase {
|
|
9
|
-
constructor(opts) {
|
|
10
|
-
super({ walletBook: opts.walletBook });
|
|
11
|
-
this._isGasSponsorshipDisabled = false;
|
|
12
|
-
this.evmNetworks = [];
|
|
13
|
-
this.ChainWallet = EthereumWallet;
|
|
14
|
-
this.isEmbeddedWallet = true;
|
|
15
|
-
this.connectedChain = 'EVM';
|
|
16
|
-
this.supportedChains = ['ETH', 'EVM'];
|
|
17
|
-
this._walletUiUtils = opts.walletUiUtils;
|
|
18
|
-
this.evmNetworks = opts.evmNetworks;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Gets the EOA connector associated with this account abstraction wallet
|
|
22
|
-
* @deprecated Use getEOAConnector with a specific smart contract wallet address instead
|
|
23
|
-
*/
|
|
24
|
-
getEOAConnector() {
|
|
25
|
-
return this.eoaConnector;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Disables gas sponsorship for the next transaction
|
|
29
|
-
*/
|
|
30
|
-
disableGasSponsorshipOnce() {
|
|
31
|
-
this._isGasSponsorshipDisabled = true;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Protected method to check if gas sponsorship is disabled
|
|
35
|
-
*/
|
|
36
|
-
isGasSponsorshipDisabled() {
|
|
37
|
-
return this._isGasSponsorshipDisabled;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Gets the enabled networks
|
|
41
|
-
*/
|
|
42
|
-
getEnabledNetworks() {
|
|
43
|
-
return this.evmNetworks;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Gets the signer for the current wallet
|
|
47
|
-
*/
|
|
48
|
-
getSigner() {
|
|
49
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
return this.getWalletClient();
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Gets the balance for an address
|
|
55
|
-
*/
|
|
56
|
-
getBalance(address) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const publicClient = yield this.getPublicClient();
|
|
59
|
-
if (!publicClient) {
|
|
60
|
-
throw new DynamicError('No public client available');
|
|
61
|
-
}
|
|
62
|
-
const balance = yield publicClient.getBalance({ address });
|
|
63
|
-
return formatEther(balance);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Validates that the expected wallet is active
|
|
68
|
-
*/
|
|
69
|
-
validateActiveWallet(expectedAddress) {
|
|
70
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const currentAddress = yield this.getAddress();
|
|
72
|
-
if ((currentAddress === null || currentAddress === void 0 ? void 0 : currentAddress.toLowerCase()) !== expectedAddress.toLowerCase()) {
|
|
73
|
-
throw new DynamicError('Invalid active wallet');
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
createUiTransaction(from) {
|
|
78
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
yield this.validateActiveWallet(from);
|
|
80
|
-
const walletClient = this.getWalletClient();
|
|
81
|
-
const publicClient = yield this.getPublicClient();
|
|
82
|
-
if (!publicClient || !walletClient) {
|
|
83
|
-
throw new DynamicError('No public client available');
|
|
84
|
-
}
|
|
85
|
-
return createViemUiTransaction({
|
|
86
|
-
from,
|
|
87
|
-
publicClient: publicClient,
|
|
88
|
-
walletClient: walletClient,
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
getBlockExplorerUrlsForCurrentNetwork() {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
var _a, _b;
|
|
95
|
-
return (_b = (_a = this.eoaConnector) === null || _a === void 0 ? void 0 : _a.getBlockExplorerUrlsForCurrentNetwork()) !== null && _b !== void 0 ? _b : [];
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export { AccountAbstractionConnector };
|