@dynamic-labs/ethereum-aa 2.0.0-alpha.18 → 2.0.0-alpha.19
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 +9 -0
- package/package.json +7 -7
- package/src/ZeroDevConnector.cjs +12 -1
- package/src/ZeroDevConnector.d.ts +9 -6
- package/src/ZeroDevConnector.js +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.19](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.18...v2.0.0-alpha.19) (2024-03-19)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* add localization to email form ([#5009](https://github.com/dynamic-labs/DynamicAuth/issues/5009)) ([f3c100c](https://github.com/dynamic-labs/DynamicAuth/commit/f3c100cb0b815880d11c6b619d94bfaa7330a115))
|
|
8
|
+
* include domain on signTypedData for ZeroDev connector ([#5017](https://github.com/dynamic-labs/DynamicAuth/issues/5017)) ([71c9131](https://github.com/dynamic-labs/DynamicAuth/commit/71c91311a75309810bc497c8f82981553ddc57fd))
|
|
9
|
+
* Remove Copy Address button if there is no wallet ([#4994](https://github.com/dynamic-labs/DynamicAuth/issues/4994)) ([fe1e641](https://github.com/dynamic-labs/DynamicAuth/commit/fe1e6417be2299e65ba4bcbc3347dfc27f021853))
|
|
10
|
+
|
|
2
11
|
## [2.0.0-alpha.18](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.17...v2.0.0-alpha.18) (2024-03-15)
|
|
3
12
|
|
|
4
13
|
## [2.0.0-alpha.17](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.16...v2.0.0-alpha.17) (2024-03-15)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum-aa",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.19",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@dynamic-labs/sdk-api": "0.0.389",
|
|
30
|
-
"@dynamic-labs/logger": "2.0.0-alpha.
|
|
31
|
-
"@dynamic-labs/types": "2.0.0-alpha.
|
|
32
|
-
"@dynamic-labs/utils": "2.0.0-alpha.
|
|
33
|
-
"@dynamic-labs/viem-utils": "2.0.0-alpha.
|
|
34
|
-
"@dynamic-labs/wallet-book": "2.0.0-alpha.
|
|
35
|
-
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.
|
|
30
|
+
"@dynamic-labs/logger": "2.0.0-alpha.19",
|
|
31
|
+
"@dynamic-labs/types": "2.0.0-alpha.19",
|
|
32
|
+
"@dynamic-labs/utils": "2.0.0-alpha.19",
|
|
33
|
+
"@dynamic-labs/viem-utils": "2.0.0-alpha.19",
|
|
34
|
+
"@dynamic-labs/wallet-book": "2.0.0-alpha.19",
|
|
35
|
+
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.19"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@zerodev/presets": "^5.1.4",
|
package/src/ZeroDevConnector.cjs
CHANGED
|
@@ -157,6 +157,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
157
157
|
const signTypedData = JSON.parse(message);
|
|
158
158
|
return provider.signTypedData({
|
|
159
159
|
account: provider.account,
|
|
160
|
+
domain: signTypedData.domain,
|
|
160
161
|
message: signTypedData.message,
|
|
161
162
|
primaryType: signTypedData.primaryType,
|
|
162
163
|
types: signTypedData.types,
|
|
@@ -176,7 +177,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
176
177
|
const transport = this.getTransport(provider);
|
|
177
178
|
const walletClient = viem.createWalletClient({
|
|
178
179
|
account: provider.account,
|
|
179
|
-
chain: chainId ? viemUtils.chainsMap[chainId] :
|
|
180
|
+
chain: chainId ? viemUtils.chainsMap[chainId] : provider.chain,
|
|
180
181
|
transport,
|
|
181
182
|
});
|
|
182
183
|
return walletClient;
|
|
@@ -261,6 +262,16 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
261
262
|
});
|
|
262
263
|
});
|
|
263
264
|
}
|
|
265
|
+
createUiTransaction(from) {
|
|
266
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
267
|
+
const walletClient = this.getWalletClient();
|
|
268
|
+
const publicClient = yield this.getPublicClient();
|
|
269
|
+
if (!publicClient || !walletClient) {
|
|
270
|
+
throw new utils.DynamicError('No public client available');
|
|
271
|
+
}
|
|
272
|
+
return viemUtils.createViemUiTransaction({ from, publicClient, walletClient });
|
|
273
|
+
});
|
|
274
|
+
}
|
|
264
275
|
}
|
|
265
276
|
|
|
266
277
|
exports.ZeroDevConnector = ZeroDevConnector;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { KernelAccountClient } from '@zerodev/sdk';
|
|
2
2
|
import { type Provider as BundlerProvider } from '@zerodev/presets';
|
|
3
|
-
import { PublicClient,
|
|
3
|
+
import { PublicClient, Transport, WalletClient } from 'viem';
|
|
4
|
+
import { type Chain as ViemChain } from 'viem/chains';
|
|
4
5
|
import { Provider, ProviderEnum } from '@dynamic-labs/sdk-api';
|
|
5
|
-
import { Chain, IAccountAbstractionWalletConnector, WalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import { Chain, IAccountAbstractionWalletConnector, ISendBalanceWalletConnector, WalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
6
7
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
7
|
-
import { EvmNetwork, GenericNetwork, WalletUiUtils } from '@dynamic-labs/types';
|
|
8
|
+
import { EvmNetwork, GenericNetwork, IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
|
|
8
9
|
type ZeroDevConnectorProps = {
|
|
9
10
|
apiProviders: {
|
|
10
11
|
[key in ProviderEnum]?: Provider;
|
|
@@ -14,7 +15,8 @@ type ZeroDevConnectorProps = {
|
|
|
14
15
|
walletUiUtils: WalletUiUtils<WalletConnector>;
|
|
15
16
|
bundlerProvider: BundlerProvider | undefined;
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
+
type IZeroDevConnector = IAccountAbstractionWalletConnector & ISendBalanceWalletConnector;
|
|
19
|
+
export declare class ZeroDevConnector extends WalletConnectorBase implements IZeroDevConnector {
|
|
18
20
|
projectId: string;
|
|
19
21
|
kernelClient: KernelAccountClient | undefined;
|
|
20
22
|
eoaConnector: WalletConnector | undefined;
|
|
@@ -45,12 +47,13 @@ export declare class ZeroDevConnector extends WalletConnectorBase implements IAc
|
|
|
45
47
|
getConnectedAccounts(): Promise<string[]>;
|
|
46
48
|
getNetwork(): Promise<number | undefined>;
|
|
47
49
|
private getTransport;
|
|
48
|
-
getWalletClient(chainId?: string): WalletClient | undefined;
|
|
50
|
+
getWalletClient(chainId?: string): WalletClient<Transport, ViemChain> | undefined;
|
|
49
51
|
getPublicClient(): Promise<void | PublicClient | undefined>;
|
|
50
52
|
getSigner(): Promise<WalletClient | undefined>;
|
|
51
|
-
canSponsorTransactionGas(transaction:
|
|
53
|
+
canSponsorTransactionGas(transaction: IUITransaction): Promise<boolean>;
|
|
52
54
|
disableGasSponsorshipOnce(): void;
|
|
53
55
|
getBalance(): Promise<string | undefined>;
|
|
54
56
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
57
|
+
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
55
58
|
}
|
|
56
59
|
export {};
|
package/src/ZeroDevConnector.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createEcdsaKernelAccountClient } from '@zerodev/presets';
|
|
|
3
3
|
import { publicActions, custom, createWalletClient, isHex, fromHex, formatEther } from 'viem';
|
|
4
4
|
import { walletClientToSmartAccountSigner } from 'permissionless';
|
|
5
5
|
import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import { confirmationTransport, chainsMap, unFormatTransaction } from '@dynamic-labs/viem-utils';
|
|
6
|
+
import { confirmationTransport, chainsMap, unFormatTransaction, createViemUiTransaction } from '@dynamic-labs/viem-utils';
|
|
7
7
|
import { parseEvmNetworks, DynamicError, DeferredPromise, wrapMethodWithCallback, TransactionGasCannotBeSponsoredError, InsufficientFundsError } from '@dynamic-labs/utils';
|
|
8
8
|
import { cachedChainIdKey, fetchChain } from './utils/fetchChain.js';
|
|
9
9
|
import { logger } from './utils/logger.js';
|
|
@@ -153,6 +153,7 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
153
153
|
const signTypedData = JSON.parse(message);
|
|
154
154
|
return provider.signTypedData({
|
|
155
155
|
account: provider.account,
|
|
156
|
+
domain: signTypedData.domain,
|
|
156
157
|
message: signTypedData.message,
|
|
157
158
|
primaryType: signTypedData.primaryType,
|
|
158
159
|
types: signTypedData.types,
|
|
@@ -172,7 +173,7 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
172
173
|
const transport = this.getTransport(provider);
|
|
173
174
|
const walletClient = createWalletClient({
|
|
174
175
|
account: provider.account,
|
|
175
|
-
chain: chainId ? chainsMap[chainId] :
|
|
176
|
+
chain: chainId ? chainsMap[chainId] : provider.chain,
|
|
176
177
|
transport,
|
|
177
178
|
});
|
|
178
179
|
return walletClient;
|
|
@@ -257,6 +258,16 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
257
258
|
});
|
|
258
259
|
});
|
|
259
260
|
}
|
|
261
|
+
createUiTransaction(from) {
|
|
262
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
263
|
+
const walletClient = this.getWalletClient();
|
|
264
|
+
const publicClient = yield this.getPublicClient();
|
|
265
|
+
if (!publicClient || !walletClient) {
|
|
266
|
+
throw new DynamicError('No public client available');
|
|
267
|
+
}
|
|
268
|
+
return createViemUiTransaction({ from, publicClient, walletClient });
|
|
269
|
+
});
|
|
270
|
+
}
|
|
260
271
|
}
|
|
261
272
|
|
|
262
273
|
export { ZeroDevConnector };
|