@dynamic-labs/ethereum-aa 2.0.0-alpha.10 → 2.0.0-alpha.11
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 +27 -0
- package/package.json +7 -7
- package/src/ZeroDevConnector.cjs +6 -4
- package/src/ZeroDevConnector.d.ts +2 -2
- package/src/ZeroDevConnector.js +7 -5
- package/src/utils/fetchChain.cjs +3 -24
- package/src/utils/fetchChain.js +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.11](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.10...v2.0.0-alpha.11) (2024-03-12)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* rename FetchPublicAddressOpts to GetAddressOpts (#4910)
|
|
8
|
+
* remove use effect in useWalletEventListeners (#4843)
|
|
9
|
+
* rename fetchPublicAddress to getAddress (#4851)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* Add farcaster to iconic ([#4925](https://github.com/dynamic-labs/DynamicAuth/issues/4925)) ([ab282dc](https://github.com/dynamic-labs/DynamicAuth/commit/ab282dc9cdcc0fe11f014d002b056ef4d3b34234))
|
|
14
|
+
* use transaction confirmation ui on signAndSendTransaction for solana embedded wallets ([#4909](https://github.com/dynamic-labs/DynamicAuth/issues/4909)) ([d77e89e](https://github.com/dynamic-labs/DynamicAuth/commit/d77e89ecff9dfc67ed48537f541a9995b2662e1e))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* add back connect button css variables ([#4922](https://github.com/dynamic-labs/DynamicAuth/issues/4922)) ([1119d62](https://github.com/dynamic-labs/DynamicAuth/commit/1119d62c2db6504952393060930524c3823e4a00))
|
|
20
|
+
* keep adaptive wallet list height ([#4916](https://github.com/dynamic-labs/DynamicAuth/issues/4916)) ([62aa54e](https://github.com/dynamic-labs/DynamicAuth/commit/62aa54e81d563082f7aa519f2ff2b5132e7dd83d))
|
|
21
|
+
* pass account and chain to walletClient ([#4865](https://github.com/dynamic-labs/DynamicAuth/issues/4865)) ([17a143f](https://github.com/dynamic-labs/DynamicAuth/commit/17a143f87a77e56227b2517038c20cf67f8e08bf))
|
|
22
|
+
* update walletbook to fix zerion in-app browser detection issue ([#4917](https://github.com/dynamic-labs/DynamicAuth/issues/4917)) ([48b05d7](https://github.com/dynamic-labs/DynamicAuth/commit/48b05d78e4f7add09787b64505723d4eca34d3e0))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
* remove use effect in useWalletEventListeners ([#4843](https://github.com/dynamic-labs/DynamicAuth/issues/4843)) ([2e948bb](https://github.com/dynamic-labs/DynamicAuth/commit/2e948bbca0dbdceab7460a844d0988eacd47f581))
|
|
26
|
+
* rename fetchPublicAddress to getAddress ([#4851](https://github.com/dynamic-labs/DynamicAuth/issues/4851)) ([668e7dd](https://github.com/dynamic-labs/DynamicAuth/commit/668e7dd62e1f323dbe64209b5c59c2cd0ee45d61))
|
|
27
|
+
* rename FetchPublicAddressOpts to GetAddressOpts ([#4910](https://github.com/dynamic-labs/DynamicAuth/issues/4910)) ([e5e4b1b](https://github.com/dynamic-labs/DynamicAuth/commit/e5e4b1b08a4e010afa44f8abb0bf6af7f236a86a))
|
|
28
|
+
|
|
2
29
|
## [2.0.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.9...v2.0.0-alpha.10) (2024-03-08)
|
|
3
30
|
|
|
4
31
|
|
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.11",
|
|
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.376",
|
|
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.11",
|
|
31
|
+
"@dynamic-labs/types": "2.0.0-alpha.11",
|
|
32
|
+
"@dynamic-labs/utils": "2.0.0-alpha.11",
|
|
33
|
+
"@dynamic-labs/viem-utils": "2.0.0-alpha.11",
|
|
34
|
+
"@dynamic-labs/wallet-book": "2.0.0-alpha.11",
|
|
35
|
+
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.11"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@zerodev/presets": "^5.1.4",
|
package/src/ZeroDevConnector.cjs
CHANGED
|
@@ -100,7 +100,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
100
100
|
return this.kernelClientWithSponsorship;
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
getAddress() {
|
|
104
104
|
var _a, _b, _c;
|
|
105
105
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
106
106
|
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
@@ -169,12 +169,14 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
169
169
|
});
|
|
170
170
|
return transport;
|
|
171
171
|
}
|
|
172
|
-
getWalletClient() {
|
|
172
|
+
getWalletClient(chainId) {
|
|
173
173
|
const provider = this.kernelClient;
|
|
174
174
|
if (!provider)
|
|
175
175
|
throw new utils.DynamicError('No provider');
|
|
176
176
|
const transport = this.getTransport(provider);
|
|
177
177
|
const walletClient = viem.createWalletClient({
|
|
178
|
+
account: provider.account,
|
|
179
|
+
chain: chainId ? viemUtils.chainsMap[chainId] : undefined,
|
|
178
180
|
transport,
|
|
179
181
|
});
|
|
180
182
|
return walletClient;
|
|
@@ -237,7 +239,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
237
239
|
const rpcClient = this.kernelClient.extend(viem.publicActions);
|
|
238
240
|
if (!rpcClient)
|
|
239
241
|
throw new utils.DynamicError('No RPC client');
|
|
240
|
-
const address = yield this.
|
|
242
|
+
const address = yield this.getAddress();
|
|
241
243
|
if (!address)
|
|
242
244
|
return;
|
|
243
245
|
return viem.formatEther(yield rpcClient.getBalance({ address: address }));
|
|
@@ -246,7 +248,7 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
246
248
|
signMessage(messageToSign) {
|
|
247
249
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
248
250
|
const client = yield this.getSigner();
|
|
249
|
-
const account = yield this.
|
|
251
|
+
const account = yield this.getAddress();
|
|
250
252
|
if (!account || !client)
|
|
251
253
|
return;
|
|
252
254
|
return client.signMessage({
|
|
@@ -38,11 +38,11 @@ export declare class ZeroDevConnector extends WalletConnectorBase implements IAc
|
|
|
38
38
|
setEoaConnector(connector: WalletConnector): Promise<void>;
|
|
39
39
|
private checkIsProjectChainEnabled;
|
|
40
40
|
private getKernelClientWithSponsorshipValidation;
|
|
41
|
-
|
|
41
|
+
getAddress(): Promise<string | undefined>;
|
|
42
42
|
getConnectedAccounts(): Promise<string[]>;
|
|
43
43
|
getNetwork(): Promise<number | undefined>;
|
|
44
44
|
private getTransport;
|
|
45
|
-
getWalletClient(): WalletClient | undefined;
|
|
45
|
+
getWalletClient(chainId?: string): WalletClient | undefined;
|
|
46
46
|
getPublicClient(): Promise<void | PublicClient | undefined>;
|
|
47
47
|
getSigner(): Promise<WalletClient | undefined>;
|
|
48
48
|
canSponsorTransactionGas(transaction: RpcTransactionRequest): Promise<boolean>;
|
package/src/ZeroDevConnector.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createEcdsaKernelAccountClient } from '@zerodev/presets';
|
|
|
3
3
|
import { custom, createWalletClient, publicActions, isHex, fromHex, formatEther } from 'viem';
|
|
4
4
|
import { walletClientToSmartAccountSigner } from 'permissionless';
|
|
5
5
|
import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import { confirmationTransport, unFormatTransaction } from '@dynamic-labs/viem-utils';
|
|
6
|
+
import { confirmationTransport, chainsMap, unFormatTransaction } 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';
|
|
@@ -96,7 +96,7 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
96
96
|
return this.kernelClientWithSponsorship;
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
getAddress() {
|
|
100
100
|
var _a, _b, _c;
|
|
101
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
102
|
yield ((_a = this.kernelClientDeferredPromise) === null || _a === void 0 ? void 0 : _a.promise);
|
|
@@ -165,12 +165,14 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
165
165
|
});
|
|
166
166
|
return transport;
|
|
167
167
|
}
|
|
168
|
-
getWalletClient() {
|
|
168
|
+
getWalletClient(chainId) {
|
|
169
169
|
const provider = this.kernelClient;
|
|
170
170
|
if (!provider)
|
|
171
171
|
throw new DynamicError('No provider');
|
|
172
172
|
const transport = this.getTransport(provider);
|
|
173
173
|
const walletClient = createWalletClient({
|
|
174
|
+
account: provider.account,
|
|
175
|
+
chain: chainId ? chainsMap[chainId] : undefined,
|
|
174
176
|
transport,
|
|
175
177
|
});
|
|
176
178
|
return walletClient;
|
|
@@ -233,7 +235,7 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
233
235
|
const rpcClient = this.kernelClient.extend(publicActions);
|
|
234
236
|
if (!rpcClient)
|
|
235
237
|
throw new DynamicError('No RPC client');
|
|
236
|
-
const address = yield this.
|
|
238
|
+
const address = yield this.getAddress();
|
|
237
239
|
if (!address)
|
|
238
240
|
return;
|
|
239
241
|
return formatEther(yield rpcClient.getBalance({ address: address }));
|
|
@@ -242,7 +244,7 @@ class ZeroDevConnector extends WalletConnectorBase {
|
|
|
242
244
|
signMessage(messageToSign) {
|
|
243
245
|
return __awaiter(this, void 0, void 0, function* () {
|
|
244
246
|
const client = yield this.getSigner();
|
|
245
|
-
const account = yield this.
|
|
247
|
+
const account = yield this.getAddress();
|
|
246
248
|
if (!account || !client)
|
|
247
249
|
return;
|
|
248
250
|
return client.signMessage({
|
package/src/utils/fetchChain.cjs
CHANGED
|
@@ -3,40 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
6
|
-
var
|
|
6
|
+
var viemUtils = require('@dynamic-labs/viem-utils');
|
|
7
7
|
var logger = require('./logger.cjs');
|
|
8
8
|
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
if (k !== 'default') {
|
|
15
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return e[k]; }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n["default"] = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var chains__namespace = /*#__PURE__*/_interopNamespace(chains);
|
|
28
|
-
|
|
29
|
-
const chainsMap = Object.values(chains__namespace).reduce((acc, chain) => (Object.assign(Object.assign({}, acc), { [chain.id]: chain })), {});
|
|
30
9
|
const cachedChainIdKey = 'dynamic_zd_chain_id';
|
|
31
10
|
const fetchChain = (projectId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
32
11
|
try {
|
|
33
12
|
const cachedChainId = localStorage.getItem(cachedChainIdKey);
|
|
34
13
|
if (cachedChainId) {
|
|
35
|
-
return chainsMap[cachedChainId];
|
|
14
|
+
return viemUtils.chainsMap[cachedChainId];
|
|
36
15
|
}
|
|
37
16
|
const response = yield (yield fetch(`https://prod-api.zerodev.app/projects/${projectId}`)).json();
|
|
38
17
|
localStorage.setItem(cachedChainIdKey, response.chainId);
|
|
39
|
-
return chainsMap[response.chainId];
|
|
18
|
+
return viemUtils.chainsMap[response.chainId];
|
|
40
19
|
}
|
|
41
20
|
catch (err) {
|
|
42
21
|
logger.logger.error('Failed to fetch ZeroDev project settings from ZeroDev API ' +
|
package/src/utils/fetchChain.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
-
import
|
|
2
|
+
import { chainsMap } from '@dynamic-labs/viem-utils';
|
|
3
3
|
import { logger } from './logger.js';
|
|
4
4
|
|
|
5
|
-
const chainsMap = Object.values(chains).reduce((acc, chain) => (Object.assign(Object.assign({}, acc), { [chain.id]: chain })), {});
|
|
6
5
|
const cachedChainIdKey = 'dynamic_zd_chain_id';
|
|
7
6
|
const fetchChain = (projectId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8
7
|
try {
|