@dynamic-labs/ethereum-aa 4.10.4-preview.0 → 4.10.4
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 +5 -6
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -11
- package/src/ZeroDevConnector.cjs +13 -17
- package/src/ZeroDevConnector.d.ts +15 -21
- package/src/ZeroDevConnector.js +14 -18
- package/src/index.cjs +0 -11
- package/src/index.d.ts +0 -2
- package/src/index.js +1 -10
- package/src/AccountAbstractionConnector.cjs +0 -75
- package/src/AccountAbstractionConnector.d.ts +0 -56
- package/src/AccountAbstractionConnector.js +0 -71
- package/src/ZKsync/client.cjs +0 -29
- package/src/ZKsync/client.d.ts +0 -24
- package/src/ZKsync/client.js +0 -25
- package/src/ZKsync/ecdsaAccount.cjs +0 -32
- package/src/ZKsync/ecdsaAccount.d.ts +0 -13
- package/src/ZKsync/ecdsaAccount.js +0 -28
- package/src/ZKsync/getEip712Domain.cjs +0 -62
- package/src/ZKsync/getEip712Domain.d.ts +0 -2
- package/src/ZKsync/getEip712Domain.js +0 -58
- package/src/ZKsync/types.cjs +0 -52
- package/src/ZKsync/types.d.ts +0 -9
- package/src/ZKsync/types.js +0 -48
- package/src/ZKsync/walletActions.cjs +0 -93
- package/src/ZKsync/walletActions.d.ts +0 -15
- package/src/ZKsync/walletActions.js +0 -87
- package/src/ZKsyncConnector.cjs +0 -502
- package/src/ZKsyncConnector.d.ts +0 -24918
- package/src/ZKsyncConnector.js +0 -498
- 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/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
### [4.10.4
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
### Features
|
|
6
|
-
|
|
7
|
-
* add zk sync aa connector ([9835145](https://github.com/dynamic-labs/dynamic-auth/commit/9835145987a859bf2da894bf49521afce66bf9f1))
|
|
2
|
+
### [4.10.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.10.3...v4.10.4) (2025-04-04)
|
|
8
3
|
|
|
9
4
|
### [4.10.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.10.2...v4.10.3) (2025-04-04)
|
|
10
5
|
|
|
@@ -22,6 +17,7 @@
|
|
|
22
17
|
* add walletTabSelected event ([#8430](https://github.com/dynamic-labs/dynamic-auth/issues/8430)) ([01ef815](https://github.com/dynamic-labs/dynamic-auth/commit/01ef815330e6c5433f7c135f561ed86621cc2bd9))
|
|
23
18
|
|
|
24
19
|
|
|
20
|
+
### Bug Fixes
|
|
25
21
|
|
|
26
22
|
* disconect wallets on logout ([#8399](https://github.com/dynamic-labs/dynamic-auth/issues/8399)) ([148bc0d](https://github.com/dynamic-labs/dynamic-auth/commit/148bc0dd175048fa8a9a675383e8e6d93c7d16ac))
|
|
27
23
|
* ensure primary wallet is still a valid credential when calling resfreshUser ([#8439](https://github.com/dynamic-labs/dynamic-auth/issues/8439)) ([2e567e5](https://github.com/dynamic-labs/dynamic-auth/commit/2e567e53ea7738d4a42f3d54bb40a294403a1c36))
|
|
@@ -37,6 +33,9 @@
|
|
|
37
33
|
* Sui Support for branded wallets
|
|
38
34
|
* better handling of non-multiasset balance fetching ([#8419](https://github.com/dynamic-labs/dynamic-auth/issues/8419)) ([574d4ea](https://github.com/dynamic-labs/dynamic-auth/commit/574d4eabf85e6f85325dc374b6cd84aa9fdd7ed4))
|
|
39
35
|
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
40
39
|
* do not prompt passkey with 7702 on v2 wallets ([#8391](https://github.com/dynamic-labs/dynamic-auth/issues/8391)) ([bb91396](https://github.com/dynamic-labs/dynamic-auth/commit/bb913965121e97801922f5ca828d11e4a551a3b6))
|
|
41
40
|
* ensure the global wallet app url is used ([#8404](https://github.com/dynamic-labs/dynamic-auth/issues/8404)) ([23a7d91](https://github.com/dynamic-labs/dynamic-auth/commit/23a7d91b50cc85e67de52306f91163c675e0f007))
|
|
42
41
|
* **global-wallet-client:** use global wallet env id when storing data to ls ([#8405](https://github.com/dynamic-labs/dynamic-auth/issues/8405)) ([2b3d9ce](https://github.com/dynamic-labs/dynamic-auth/commit/2b3d9ce8dd82dda487759e0621c73bfad2842aef))
|
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.10.4
|
|
3
|
+
"version": "4.10.4",
|
|
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,19 +18,17 @@
|
|
|
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.650",
|
|
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
|
-
"
|
|
27
|
-
"@dynamic-labs/
|
|
28
|
-
"@dynamic-labs/
|
|
29
|
-
"@dynamic-labs/
|
|
30
|
-
"@dynamic-labs/
|
|
31
|
-
"@dynamic-labs/
|
|
32
|
-
"@dynamic-labs/wallet-book": "4.10.4-preview.0",
|
|
33
|
-
"@dynamic-labs/wallet-connector-core": "4.10.4-preview.0"
|
|
25
|
+
"@dynamic-labs/assert-package-version": "4.10.4",
|
|
26
|
+
"@dynamic-labs/ethereum-core": "4.10.4",
|
|
27
|
+
"@dynamic-labs/logger": "4.10.4",
|
|
28
|
+
"@dynamic-labs/types": "4.10.4",
|
|
29
|
+
"@dynamic-labs/utils": "4.10.4",
|
|
30
|
+
"@dynamic-labs/wallet-book": "4.10.4",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "4.10.4"
|
|
34
32
|
},
|
|
35
33
|
"peerDependencies": {
|
|
36
34
|
"viem": "^2.21.55"
|
package/src/ZeroDevConnector.cjs
CHANGED
|
@@ -16,9 +16,8 @@ var createEcsdaKernelAccountClient = require('./utils/createEcsdaKernelAccountCl
|
|
|
16
16
|
var getEcdsaValidator = require('./utils/getEcdsaValidator.cjs');
|
|
17
17
|
var getEntryPoint = require('./utils/getEntryPoint.cjs');
|
|
18
18
|
var getKernelVersion = require('./utils/getKernelVersion.cjs');
|
|
19
|
-
var AccountAbstractionConnector = require('./AccountAbstractionConnector.cjs');
|
|
20
19
|
|
|
21
|
-
class ZeroDevConnector extends
|
|
20
|
+
class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
22
21
|
constructor(opts) {
|
|
23
22
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
24
23
|
super(opts);
|
|
@@ -29,6 +28,7 @@ class ZeroDevConnector extends AccountAbstractionConnector.AccountAbstractionCon
|
|
|
29
28
|
this.ChainWallet = ethereumCore.EthereumWallet;
|
|
30
29
|
this.connectedChain = 'EVM';
|
|
31
30
|
this.supportedChains = ['ETH', 'EVM'];
|
|
31
|
+
this.isGasSponsorshipDisabled = false;
|
|
32
32
|
this.isEmbeddedWallet = true;
|
|
33
33
|
this.providersFromApi = [];
|
|
34
34
|
this.name = 'ZeroDev';
|
|
@@ -60,9 +60,6 @@ class ZeroDevConnector extends AccountAbstractionConnector.AccountAbstractionCon
|
|
|
60
60
|
this.defaultChainId = defaultProvider === null || defaultProvider === void 0 ? void 0 : defaultProvider.chain;
|
|
61
61
|
this.ecdsaProviderType = (_j = opts.apiProviders.zerodev) === null || _j === void 0 ? void 0 : _j.ecdsaProviderType;
|
|
62
62
|
}
|
|
63
|
-
confirmTransactionStatus() {
|
|
64
|
-
throw new Error('confirmTransactionStatus not implemented in ZeroDevConnector');
|
|
65
|
-
}
|
|
66
63
|
get currentNetworkProvider() {
|
|
67
64
|
// check if the last used chain id is in the provider map
|
|
68
65
|
if (this.providerMap[this.lastUsedChainId]) {
|
|
@@ -107,6 +104,13 @@ class ZeroDevConnector extends AccountAbstractionConnector.AccountAbstractionCon
|
|
|
107
104
|
handleChainChange(chainId);
|
|
108
105
|
});
|
|
109
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated You should get the EOA connector by passing the SCW to getEOAConnector,
|
|
109
|
+
* from the useSmartWallet hook
|
|
110
|
+
*/
|
|
111
|
+
getEOAConnector() {
|
|
112
|
+
return this.eoaConnector;
|
|
113
|
+
}
|
|
110
114
|
getAccountAbstractionProvider({ withSponsorship, } = {}) {
|
|
111
115
|
if (withSponsorship && this.kernelClientWithSponsorship) {
|
|
112
116
|
return this.kernelClientWithSponsorship;
|
|
@@ -118,14 +122,6 @@ class ZeroDevConnector extends AccountAbstractionConnector.AccountAbstractionCon
|
|
|
118
122
|
utils.StorageService.removeItem(constants.ZERO_DEV_LAST_USED_CHAIN_ID_KEY);
|
|
119
123
|
});
|
|
120
124
|
}
|
|
121
|
-
initialize(_a) {
|
|
122
|
-
return _tslib.__awaiter(this, arguments, void 0, function* ({ smartWalletAddress, eoaAddress, eoaConnector, properties, shouldSetEoaConnector, }) {
|
|
123
|
-
yield this.registerEoa(Object.assign({ eoaAddress,
|
|
124
|
-
eoaConnector,
|
|
125
|
-
shouldSetEoaConnector,
|
|
126
|
-
smartWalletAddress }, properties));
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
125
|
registerEoa(_a) {
|
|
130
126
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
131
127
|
var { smartWalletAddress, eoaAddress, eoaConnector, shouldSetEoaConnector = false } = _a, properties = _tslib.__rest(_a, ["smartWalletAddress", "eoaAddress", "eoaConnector", "shouldSetEoaConnector"]);
|
|
@@ -373,7 +369,7 @@ class ZeroDevConnector extends AccountAbstractionConnector.AccountAbstractionCon
|
|
|
373
369
|
onSendTransaction: (_b) => _tslib.__awaiter(this, [_b], void 0, function* ({ transaction }) {
|
|
374
370
|
try {
|
|
375
371
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
376
|
-
const effectiveProvider = this.isGasSponsorshipDisabled
|
|
372
|
+
const effectiveProvider = this.isGasSponsorshipDisabled
|
|
377
373
|
? provider
|
|
378
374
|
: this.kernelClientWithSponsorship;
|
|
379
375
|
if (!effectiveProvider) {
|
|
@@ -544,6 +540,9 @@ class ZeroDevConnector extends AccountAbstractionConnector.AccountAbstractionCon
|
|
|
544
540
|
return sponsored;
|
|
545
541
|
});
|
|
546
542
|
}
|
|
543
|
+
disableGasSponsorshipOnce() {
|
|
544
|
+
this.isGasSponsorshipDisabled = true;
|
|
545
|
+
}
|
|
547
546
|
getBalance(address) {
|
|
548
547
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
549
548
|
var _a;
|
|
@@ -605,9 +604,6 @@ class ZeroDevConnector extends AccountAbstractionConnector.AccountAbstractionCon
|
|
|
605
604
|
getEnabledNetworks() {
|
|
606
605
|
return this.evmNetworks;
|
|
607
606
|
}
|
|
608
|
-
initializeZksyncConnector() {
|
|
609
|
-
throw new Error('Not implemented');
|
|
610
|
-
}
|
|
611
607
|
}
|
|
612
608
|
|
|
613
609
|
exports.ZeroDevConnector = ZeroDevConnector;
|
|
@@ -6,12 +6,11 @@ import { type Chain as ViemChain } from 'viem/chains';
|
|
|
6
6
|
import { EntryPointType, KERNEL_VERSION_TYPE } from '@zerodev/sdk/types';
|
|
7
7
|
import { EthereumWallet, RegisterEvmProvidersConfig } from '@dynamic-labs/ethereum-core';
|
|
8
8
|
import { EcdsaValidatorOptions, Provider, ProviderEntryPointVersionEnum, ProviderEnum, ProviderKernelVersionEnum, ProviderMultichainAccountAbstractionProviders } from '@dynamic-labs/sdk-api-core';
|
|
9
|
-
import { Chain, InternalWalletConnector,
|
|
9
|
+
import { Chain, IZeroDevConnector, InternalWalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
10
10
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
11
|
-
import { GenericNetwork, IUITransaction,
|
|
11
|
+
import { EvmNetwork, GenericNetwork, IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
|
|
12
12
|
import { BundlerProvider } from './utils';
|
|
13
|
-
|
|
14
|
-
type ZeroDevConnectorProps = AccountAbstractionConnectorProps & {
|
|
13
|
+
type ZeroDevConnectorProps = {
|
|
15
14
|
apiProviders: {
|
|
16
15
|
[key in ProviderEnum]?: Provider;
|
|
17
16
|
};
|
|
@@ -24,7 +23,7 @@ type ZeroDevConnectorProps = AccountAbstractionConnectorProps & {
|
|
|
24
23
|
providersConfig?: RegisterEvmProvidersConfig;
|
|
25
24
|
};
|
|
26
25
|
type KernelClient = KernelAccountClient<Transport, ViemChain, SmartAccount, Client, RpcSchema>;
|
|
27
|
-
export declare class ZeroDevConnector extends
|
|
26
|
+
export declare class ZeroDevConnector extends WalletConnectorBase<typeof EthereumWallet> implements IZeroDevConnector {
|
|
28
27
|
clientId: string;
|
|
29
28
|
eoaConnector: InternalWalletConnector | undefined;
|
|
30
29
|
eoaAddress: string | undefined;
|
|
@@ -33,7 +32,9 @@ export declare class ZeroDevConnector extends AccountAbstractionConnector implem
|
|
|
33
32
|
ChainWallet: typeof EthereumWallet;
|
|
34
33
|
connectedChain: Chain;
|
|
35
34
|
supportedChains: Chain[];
|
|
35
|
+
evmNetworks: EvmNetwork[];
|
|
36
36
|
providersConfig: RegisterEvmProvidersConfig;
|
|
37
|
+
private isGasSponsorshipDisabled;
|
|
37
38
|
isEmbeddedWallet: boolean;
|
|
38
39
|
entryPoint: EntryPointType<EntryPointVersion>;
|
|
39
40
|
kernelVersion: KERNEL_VERSION_TYPE;
|
|
@@ -61,9 +62,9 @@ export declare class ZeroDevConnector extends AccountAbstractionConnector implem
|
|
|
61
62
|
name: string;
|
|
62
63
|
};
|
|
63
64
|
enableEIP7702Mode: boolean;
|
|
65
|
+
private _walletUiUtils;
|
|
64
66
|
private authorization?;
|
|
65
67
|
constructor(opts: ZeroDevConnectorProps);
|
|
66
|
-
confirmTransactionStatus(): Promise<TransactionReceipt>;
|
|
67
68
|
get currentNetworkProvider(): {
|
|
68
69
|
kernelClient: KernelClient;
|
|
69
70
|
kernelClientWithSponsorship: KernelClient;
|
|
@@ -75,22 +76,15 @@ export declare class ZeroDevConnector extends AccountAbstractionConnector implem
|
|
|
75
76
|
switchNetwork({ networkChainId, }: {
|
|
76
77
|
networkChainId?: number | string;
|
|
77
78
|
}): Promise<void>;
|
|
78
|
-
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated You should get the EOA connector by passing the SCW to getEOAConnector,
|
|
81
|
+
* from the useSmartWallet hook
|
|
82
|
+
*/
|
|
83
|
+
getEOAConnector(): InternalWalletConnector | undefined;
|
|
84
|
+
getAccountAbstractionProvider({ withSponsorship, }?: {
|
|
79
85
|
withSponsorship?: boolean;
|
|
80
|
-
}):
|
|
86
|
+
}): KernelClient | undefined;
|
|
81
87
|
endSession(): Promise<void>;
|
|
82
|
-
initialize({ smartWalletAddress, eoaAddress, eoaConnector, properties, shouldSetEoaConnector, }: {
|
|
83
|
-
smartWalletAddress: string;
|
|
84
|
-
eoaAddress: string;
|
|
85
|
-
eoaConnector: InternalWalletConnector;
|
|
86
|
-
shouldSetEoaConnector: boolean;
|
|
87
|
-
properties?: {
|
|
88
|
-
ecdsaProviderType?: EcdsaValidatorOptions;
|
|
89
|
-
kernelVersion?: ProviderKernelVersionEnum;
|
|
90
|
-
entryPointVersion?: ProviderEntryPointVersionEnum;
|
|
91
|
-
enableKernelV3Migration?: boolean;
|
|
92
|
-
};
|
|
93
|
-
}): Promise<void>;
|
|
94
88
|
registerEoa({ smartWalletAddress, eoaAddress, eoaConnector, shouldSetEoaConnector, ...properties }: {
|
|
95
89
|
smartWalletAddress: string;
|
|
96
90
|
eoaAddress: string;
|
|
@@ -7818,12 +7812,12 @@ export declare class ZeroDevConnector extends AccountAbstractionConnector implem
|
|
|
7818
7812
|
value?: bigint;
|
|
7819
7813
|
data?: string;
|
|
7820
7814
|
}): Promise<boolean>;
|
|
7815
|
+
disableGasSponsorshipOnce(): void;
|
|
7821
7816
|
getBalance(address: string): Promise<string | undefined>;
|
|
7822
7817
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
7823
7818
|
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
7824
7819
|
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
7825
7820
|
getBlockExplorerUrlsForCurrentNetwork(): Promise<string[]>;
|
|
7826
7821
|
getEnabledNetworks(): GenericNetwork[];
|
|
7827
|
-
initializeZksyncConnector(): Promise<void>;
|
|
7828
7822
|
}
|
|
7829
7823
|
export {};
|
package/src/ZeroDevConnector.js
CHANGED
|
@@ -4,7 +4,7 @@ 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, createViemUiTransaction } from '@dynamic-labs/ethereum-core';
|
|
7
|
-
import { eventListenerHandlers, isTurnkeyWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
7
|
+
import { WalletConnectorBase, eventListenerHandlers, isTurnkeyWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
8
8
|
import { parseEvmNetworks, StorageService, DynamicError, DeferredPromise, parseChainId, wrapMethodWithCallback, TransactionGasCannotBeSponsoredError, InsufficientFundsError } from '@dynamic-labs/utils';
|
|
9
9
|
import { ZERO_DEV_LAST_USED_CHAIN_ID_KEY } from './constants.js';
|
|
10
10
|
import { logger } from './utils/logger.js';
|
|
@@ -12,9 +12,8 @@ import { createEcdsaKernelAccountClientWith7702, createEcdsaKernelAccountClient
|
|
|
12
12
|
import { getEcdsaValidator } from './utils/getEcdsaValidator.js';
|
|
13
13
|
import { getEntryPoint } from './utils/getEntryPoint.js';
|
|
14
14
|
import { getKernelVersion } from './utils/getKernelVersion.js';
|
|
15
|
-
import { AccountAbstractionConnector } from './AccountAbstractionConnector.js';
|
|
16
15
|
|
|
17
|
-
class ZeroDevConnector extends
|
|
16
|
+
class ZeroDevConnector extends WalletConnectorBase {
|
|
18
17
|
constructor(opts) {
|
|
19
18
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
20
19
|
super(opts);
|
|
@@ -25,6 +24,7 @@ class ZeroDevConnector extends AccountAbstractionConnector {
|
|
|
25
24
|
this.ChainWallet = EthereumWallet;
|
|
26
25
|
this.connectedChain = 'EVM';
|
|
27
26
|
this.supportedChains = ['ETH', 'EVM'];
|
|
27
|
+
this.isGasSponsorshipDisabled = false;
|
|
28
28
|
this.isEmbeddedWallet = true;
|
|
29
29
|
this.providersFromApi = [];
|
|
30
30
|
this.name = 'ZeroDev';
|
|
@@ -56,9 +56,6 @@ class ZeroDevConnector extends AccountAbstractionConnector {
|
|
|
56
56
|
this.defaultChainId = defaultProvider === null || defaultProvider === void 0 ? void 0 : defaultProvider.chain;
|
|
57
57
|
this.ecdsaProviderType = (_j = opts.apiProviders.zerodev) === null || _j === void 0 ? void 0 : _j.ecdsaProviderType;
|
|
58
58
|
}
|
|
59
|
-
confirmTransactionStatus() {
|
|
60
|
-
throw new Error('confirmTransactionStatus not implemented in ZeroDevConnector');
|
|
61
|
-
}
|
|
62
59
|
get currentNetworkProvider() {
|
|
63
60
|
// check if the last used chain id is in the provider map
|
|
64
61
|
if (this.providerMap[this.lastUsedChainId]) {
|
|
@@ -103,6 +100,13 @@ class ZeroDevConnector extends AccountAbstractionConnector {
|
|
|
103
100
|
handleChainChange(chainId);
|
|
104
101
|
});
|
|
105
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated You should get the EOA connector by passing the SCW to getEOAConnector,
|
|
105
|
+
* from the useSmartWallet hook
|
|
106
|
+
*/
|
|
107
|
+
getEOAConnector() {
|
|
108
|
+
return this.eoaConnector;
|
|
109
|
+
}
|
|
106
110
|
getAccountAbstractionProvider({ withSponsorship, } = {}) {
|
|
107
111
|
if (withSponsorship && this.kernelClientWithSponsorship) {
|
|
108
112
|
return this.kernelClientWithSponsorship;
|
|
@@ -114,14 +118,6 @@ class ZeroDevConnector extends AccountAbstractionConnector {
|
|
|
114
118
|
StorageService.removeItem(ZERO_DEV_LAST_USED_CHAIN_ID_KEY);
|
|
115
119
|
});
|
|
116
120
|
}
|
|
117
|
-
initialize(_a) {
|
|
118
|
-
return __awaiter(this, arguments, void 0, function* ({ smartWalletAddress, eoaAddress, eoaConnector, properties, shouldSetEoaConnector, }) {
|
|
119
|
-
yield this.registerEoa(Object.assign({ eoaAddress,
|
|
120
|
-
eoaConnector,
|
|
121
|
-
shouldSetEoaConnector,
|
|
122
|
-
smartWalletAddress }, properties));
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
121
|
registerEoa(_a) {
|
|
126
122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
123
|
var { smartWalletAddress, eoaAddress, eoaConnector, shouldSetEoaConnector = false } = _a, properties = __rest(_a, ["smartWalletAddress", "eoaAddress", "eoaConnector", "shouldSetEoaConnector"]);
|
|
@@ -369,7 +365,7 @@ class ZeroDevConnector extends AccountAbstractionConnector {
|
|
|
369
365
|
onSendTransaction: (_b) => __awaiter(this, [_b], void 0, function* ({ transaction }) {
|
|
370
366
|
try {
|
|
371
367
|
this._walletUiUtils.disabledConfirmationOnce();
|
|
372
|
-
const effectiveProvider = this.isGasSponsorshipDisabled
|
|
368
|
+
const effectiveProvider = this.isGasSponsorshipDisabled
|
|
373
369
|
? provider
|
|
374
370
|
: this.kernelClientWithSponsorship;
|
|
375
371
|
if (!effectiveProvider) {
|
|
@@ -540,6 +536,9 @@ class ZeroDevConnector extends AccountAbstractionConnector {
|
|
|
540
536
|
return sponsored;
|
|
541
537
|
});
|
|
542
538
|
}
|
|
539
|
+
disableGasSponsorshipOnce() {
|
|
540
|
+
this.isGasSponsorshipDisabled = true;
|
|
541
|
+
}
|
|
543
542
|
getBalance(address) {
|
|
544
543
|
return __awaiter(this, void 0, void 0, function* () {
|
|
545
544
|
var _a;
|
|
@@ -601,9 +600,6 @@ class ZeroDevConnector extends AccountAbstractionConnector {
|
|
|
601
600
|
getEnabledNetworks() {
|
|
602
601
|
return this.evmNetworks;
|
|
603
602
|
}
|
|
604
|
-
initializeZksyncConnector() {
|
|
605
|
-
throw new Error('Not implemented');
|
|
606
|
-
}
|
|
607
603
|
}
|
|
608
604
|
|
|
609
605
|
export { ZeroDevConnector };
|
package/src/index.cjs
CHANGED
|
@@ -6,7 +6,6 @@ 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 createEcsdaKernelAccountClient = require('./utils/createEcsdaKernelAccountClient.cjs');
|
|
11
10
|
var fetchZeroDevChain = require('./utils/fetchZeroDevChain.cjs');
|
|
12
11
|
var getEcdsaValidator = require('./utils/getEcdsaValidator.cjs');
|
|
@@ -14,7 +13,6 @@ var getEntryPoint = require('./utils/getEntryPoint.cjs');
|
|
|
14
13
|
var getKernelVersion = require('./utils/getKernelVersion.cjs');
|
|
15
14
|
var ethereumAa = require('./ethereum-aa.cjs');
|
|
16
15
|
var isZeroDevConnector = require('./utils/isZeroDevConnector.cjs');
|
|
17
|
-
var isZKsyncConnector = require('./utils/isZKsyncConnector.cjs');
|
|
18
16
|
|
|
19
17
|
assertPackageVersion.assertPackageVersion('@dynamic-labs/ethereum-aa', _package.version);
|
|
20
18
|
const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, } = {}) => {
|
|
@@ -31,13 +29,6 @@ const ZeroDevSmartWalletConnectors = (props) => {
|
|
|
31
29
|
}
|
|
32
30
|
return [];
|
|
33
31
|
};
|
|
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
32
|
|
|
42
33
|
exports.createEcdsaKernelAccountClient = createEcsdaKernelAccountClient.createEcdsaKernelAccountClient;
|
|
43
34
|
exports.fetchZeroDevChain = fetchZeroDevChain.fetchZeroDevChain;
|
|
@@ -46,7 +37,5 @@ exports.getEntryPoint = getEntryPoint.getEntryPoint;
|
|
|
46
37
|
exports.getKernelVersion = getKernelVersion.getKernelVersion;
|
|
47
38
|
exports.EthereumAaConnector = ethereumAa.EthereumAaConnector;
|
|
48
39
|
exports.isZeroDevConnector = isZeroDevConnector.isZeroDevConnector;
|
|
49
|
-
exports.isZKsyncConnector = isZKsyncConnector.isZKsyncConnector;
|
|
50
|
-
exports.ZKsyncSmartWalletConnectors = ZKsyncSmartWalletConnectors;
|
|
51
40
|
exports.ZeroDevSmartWalletConnectors = ZeroDevSmartWalletConnectors;
|
|
52
41
|
exports.ZeroDevSmartWalletConnectorsWithConfig = ZeroDevSmartWalletConnectorsWithConfig;
|
package/src/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export { getEntryPoint } from './utils/getEntryPoint';
|
|
|
7
7
|
export { getKernelVersion } from './utils/getKernelVersion';
|
|
8
8
|
export * from './ethereum-aa';
|
|
9
9
|
export { isZeroDevConnector } from './utils/isZeroDevConnector';
|
|
10
|
-
export { isZKsyncConnector } from './utils/isZKsyncConnector';
|
|
11
10
|
export declare const ZeroDevSmartWalletConnectorsWithConfig: ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, }?: {
|
|
12
11
|
bundlerProvider?: BundlerProvider;
|
|
13
12
|
bundlerRpc?: string;
|
|
@@ -15,4 +14,3 @@ export declare const ZeroDevSmartWalletConnectorsWithConfig: ({ bundlerProvider,
|
|
|
15
14
|
kernelDelegationAddress?: `0x${string}`;
|
|
16
15
|
}) => (props: any) => WalletConnectorConstructor[];
|
|
17
16
|
export declare const ZeroDevSmartWalletConnectors: (props: any) => WalletConnectorConstructor[];
|
|
18
|
-
export declare const ZKsyncSmartWalletConnectors: (props: any) => WalletConnectorConstructor[];
|
package/src/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
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/createEcsdaKernelAccountClient.js';
|
|
7
6
|
export { fetchZeroDevChain } from './utils/fetchZeroDevChain.js';
|
|
8
7
|
export { getEcdsaValidator } from './utils/getEcdsaValidator.js';
|
|
@@ -10,7 +9,6 @@ export { getEntryPoint } from './utils/getEntryPoint.js';
|
|
|
10
9
|
export { getKernelVersion } from './utils/getKernelVersion.js';
|
|
11
10
|
export { EthereumAaConnector } from './ethereum-aa.js';
|
|
12
11
|
export { isZeroDevConnector } from './utils/isZeroDevConnector.js';
|
|
13
|
-
export { isZKsyncConnector } from './utils/isZKsyncConnector.js';
|
|
14
12
|
|
|
15
13
|
assertPackageVersion('@dynamic-labs/ethereum-aa', version);
|
|
16
14
|
const ZeroDevSmartWalletConnectorsWithConfig = ({ bundlerProvider, bundlerRpc, paymasterRpc, kernelDelegationAddress, } = {}) => {
|
|
@@ -27,12 +25,5 @@ const ZeroDevSmartWalletConnectors = (props) => {
|
|
|
27
25
|
}
|
|
28
26
|
return [];
|
|
29
27
|
};
|
|
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
28
|
|
|
38
|
-
export {
|
|
29
|
+
export { ZeroDevSmartWalletConnectors, ZeroDevSmartWalletConnectorsWithConfig };
|
|
@@ -1,75 +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 balance for an address
|
|
51
|
-
*/
|
|
52
|
-
getBalance(address) {
|
|
53
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
const publicClient = yield this.getPublicClient();
|
|
55
|
-
if (!publicClient) {
|
|
56
|
-
throw new utils.DynamicError('No public client available');
|
|
57
|
-
}
|
|
58
|
-
const balance = yield publicClient.getBalance({ address });
|
|
59
|
-
return viem.formatEther(balance);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Validates that the expected wallet is active
|
|
64
|
-
*/
|
|
65
|
-
validateActiveWallet(expectedAddress) {
|
|
66
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
const currentAddress = yield this.getAddress();
|
|
68
|
-
if ((currentAddress === null || currentAddress === void 0 ? void 0 : currentAddress.toLowerCase()) !== expectedAddress.toLowerCase()) {
|
|
69
|
-
throw new utils.DynamicError('Invalid active wallet');
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
exports.AccountAbstractionConnector = AccountAbstractionConnector;
|
|
@@ -1,56 +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
|
-
export type AccountAbstractionConnectorProps = {
|
|
6
|
-
walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
7
|
-
walletBook: WalletBookSchema;
|
|
8
|
-
evmNetworks: GenericNetwork[];
|
|
9
|
-
};
|
|
10
|
-
export declare abstract class AccountAbstractionConnector extends WalletConnectorBase<typeof EthereumWallet> {
|
|
11
|
-
abstract eoaConnector: InternalWalletConnector | undefined;
|
|
12
|
-
abstract eoaAddress: string | undefined;
|
|
13
|
-
protected _walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
14
|
-
private _isGasSponsorshipDisabled;
|
|
15
|
-
protected evmNetworks: GenericNetwork[];
|
|
16
|
-
ChainWallet: typeof EthereumWallet;
|
|
17
|
-
isEmbeddedWallet: boolean;
|
|
18
|
-
connectedChain: Chain;
|
|
19
|
-
supportedChains: Chain[];
|
|
20
|
-
constructor(opts: AccountAbstractionConnectorProps);
|
|
21
|
-
/**
|
|
22
|
-
* Gets the EOA connector associated with this account abstraction wallet
|
|
23
|
-
* @deprecated Use getEOAConnector with a specific smart contract wallet address instead
|
|
24
|
-
*/
|
|
25
|
-
getEOAConnector(): InternalWalletConnector | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Disables gas sponsorship for the next transaction
|
|
28
|
-
*/
|
|
29
|
-
disableGasSponsorshipOnce(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Protected method to check if gas sponsorship is disabled
|
|
32
|
-
*/
|
|
33
|
-
protected isGasSponsorshipDisabled(): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Gets the enabled networks
|
|
36
|
-
*/
|
|
37
|
-
getEnabledNetworks(): GenericNetwork[];
|
|
38
|
-
/**
|
|
39
|
-
* Gets the balance for an address
|
|
40
|
-
*/
|
|
41
|
-
getBalance(address: string): Promise<string | undefined>;
|
|
42
|
-
/**
|
|
43
|
-
* Validates that the expected wallet is active
|
|
44
|
-
*/
|
|
45
|
-
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
46
|
-
abstract canSponsorTransactionGas(transaction: {
|
|
47
|
-
from: string;
|
|
48
|
-
to?: string;
|
|
49
|
-
value?: bigint;
|
|
50
|
-
data?: string;
|
|
51
|
-
}): Promise<boolean>;
|
|
52
|
-
abstract createUiTransaction(from: string): Promise<IUITransaction>;
|
|
53
|
-
abstract getAccountAbstractionProvider<T>({ withSponsorship, }: {
|
|
54
|
-
withSponsorship: boolean;
|
|
55
|
-
}): Promise<T>;
|
|
56
|
-
}
|
|
@@ -1,71 +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 } 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 balance for an address
|
|
47
|
-
*/
|
|
48
|
-
getBalance(address) {
|
|
49
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
const publicClient = yield this.getPublicClient();
|
|
51
|
-
if (!publicClient) {
|
|
52
|
-
throw new DynamicError('No public client available');
|
|
53
|
-
}
|
|
54
|
-
const balance = yield publicClient.getBalance({ address });
|
|
55
|
-
return formatEther(balance);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Validates that the expected wallet is active
|
|
60
|
-
*/
|
|
61
|
-
validateActiveWallet(expectedAddress) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const currentAddress = yield this.getAddress();
|
|
64
|
-
if ((currentAddress === null || currentAddress === void 0 ? void 0 : currentAddress.toLowerCase()) !== expectedAddress.toLowerCase()) {
|
|
65
|
-
throw new DynamicError('Invalid active wallet');
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export { AccountAbstractionConnector };
|