@dynamic-labs/ethereum-aa 2.0.0-alpha.19 → 2.0.0-alpha.20

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 CHANGED
@@ -1,4 +1,13 @@
1
1
 
2
+ ## [2.0.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.19...v2.0.0-alpha.20) (2024-03-19)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * prevent solflare connect popping up on page refresh when connected ([#5032](https://github.com/dynamic-labs/DynamicAuth/issues/5032)) ([28175a9](https://github.com/dynamic-labs/DynamicAuth/commit/28175a9af43f3e7f2cab30148563eaf5573477d1))
8
+ * show correct user identifier in onboarding view ([#5021](https://github.com/dynamic-labs/DynamicAuth/issues/5021)) ([c84747f](https://github.com/dynamic-labs/DynamicAuth/commit/c84747f01eb2a0a827ca48e62f03739d4e6df136))
9
+ * use address as the wallet client account ([#5037](https://github.com/dynamic-labs/DynamicAuth/issues/5037)) ([287631e](https://github.com/dynamic-labs/DynamicAuth/commit/287631e9a027e3a39ee2ad6b45ca404febd03929))
10
+
2
11
  ## [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
12
 
4
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum-aa",
3
- "version": "2.0.0-alpha.19",
3
+ "version": "2.0.0-alpha.20",
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.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"
30
+ "@dynamic-labs/logger": "2.0.0-alpha.20",
31
+ "@dynamic-labs/types": "2.0.0-alpha.20",
32
+ "@dynamic-labs/utils": "2.0.0-alpha.20",
33
+ "@dynamic-labs/viem-utils": "2.0.0-alpha.20",
34
+ "@dynamic-labs/wallet-book": "2.0.0-alpha.20",
35
+ "@dynamic-labs/wallet-connector-core": "2.0.0-alpha.20"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@zerodev/presets": "^5.1.4",
@@ -171,12 +171,14 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
171
171
  return transport;
172
172
  }
173
173
  getWalletClient(chainId) {
174
+ var _a;
174
175
  const provider = this.kernelClient;
175
176
  if (!provider)
176
177
  throw new utils.DynamicError('No provider');
177
178
  const transport = this.getTransport(provider);
179
+ const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
178
180
  const walletClient = viem.createWalletClient({
179
- account: provider.account,
181
+ account: address,
180
182
  chain: chainId ? viemUtils.chainsMap[chainId] : provider.chain,
181
183
  transport,
182
184
  });
@@ -191,18 +193,8 @@ class ZeroDevConnector extends walletConnectorCore.WalletConnectorBase {
191
193
  });
192
194
  }
193
195
  getSigner() {
194
- var _a;
195
196
  return _tslib.__awaiter(this, void 0, void 0, function* () {
196
- const provider = this.kernelClient;
197
- if (!provider)
198
- throw new utils.DynamicError('No provider');
199
- const transport = this.getTransport(provider);
200
- const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
201
- const walletClient = viem.createWalletClient({
202
- account: address,
203
- transport,
204
- });
205
- return walletClient;
197
+ return this.getWalletClient();
206
198
  });
207
199
  }
208
200
  canSponsorTransactionGas(transaction) {
@@ -1,6 +1,6 @@
1
1
  import { KernelAccountClient } from '@zerodev/sdk';
2
2
  import { type Provider as BundlerProvider } from '@zerodev/presets';
3
- import { PublicClient, Transport, WalletClient } from 'viem';
3
+ import { Account, PublicClient, Transport, WalletClient } from 'viem';
4
4
  import { type Chain as ViemChain } from 'viem/chains';
5
5
  import { Provider, ProviderEnum } from '@dynamic-labs/sdk-api';
6
6
  import { Chain, IAccountAbstractionWalletConnector, ISendBalanceWalletConnector, WalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
@@ -49,7 +49,264 @@ export declare class ZeroDevConnector extends WalletConnectorBase implements IZe
49
49
  private getTransport;
50
50
  getWalletClient(chainId?: string): WalletClient<Transport, ViemChain> | undefined;
51
51
  getPublicClient(): Promise<void | PublicClient | undefined>;
52
- getSigner(): Promise<WalletClient | undefined>;
52
+ getSigner(): Promise<{
53
+ account: Account | undefined;
54
+ batch?: {
55
+ multicall?: boolean | {
56
+ batchSize?: number | undefined;
57
+ wait?: number | undefined;
58
+ } | undefined;
59
+ } | undefined;
60
+ cacheTime: number;
61
+ chain: ViemChain;
62
+ key: string;
63
+ name: string;
64
+ pollingInterval: number;
65
+ request: import("viem").EIP1193RequestFn<import("viem").WalletRpcSchema>;
66
+ transport: import("viem").TransportConfig<string, import("viem").EIP1193RequestFn> & Record<string, any>;
67
+ type: string;
68
+ uid: string;
69
+ addChain: (args: import("viem").AddChainParameters) => Promise<void>;
70
+ deployContract: <const abi extends import("viem").Abi | readonly unknown[], chainOverride extends ViemChain | undefined>(args: import("viem").DeployContractParameters<abi, ViemChain, Account | undefined, chainOverride>) => Promise<`0x${string}`>;
71
+ getAddresses: () => Promise<import("viem").GetAddressesReturnType>;
72
+ getChainId: () => Promise<number>;
73
+ getPermissions: () => Promise<import("viem").GetPermissionsReturnType>;
74
+ prepareTransactionRequest: <TParameterType extends import("viem").PrepareTransactionRequestParameterType, TChainOverride extends ViemChain | undefined = undefined, TAccountOverride extends `0x${string}` | Account | undefined = undefined>(args: import("viem").PrepareTransactionRequestParameters<ViemChain, Account | undefined, TChainOverride, TAccountOverride, TParameterType>) => Promise<import("viem").PrepareTransactionRequestReturnType<ViemChain, Account | undefined, TChainOverride, TAccountOverride, TParameterType>>;
75
+ requestAddresses: () => Promise<import("viem").RequestAddressesReturnType>;
76
+ requestPermissions: (args: {
77
+ [x: string]: Record<string, any>;
78
+ eth_accounts: Record<string, any>;
79
+ }) => Promise<import("viem").RequestPermissionsReturnType>;
80
+ sendRawTransaction: (args: import("viem").SendRawTransactionParameters) => Promise<`0x${string}`>;
81
+ sendTransaction: <TChainOverride_1 extends ViemChain | undefined = undefined>(args: import("viem").SendTransactionParameters<ViemChain, Account | undefined, TChainOverride_1>) => Promise<`0x${string}`>;
82
+ signMessage: (args: import("viem").SignMessageParameters<Account | undefined>) => Promise<`0x${string}`>;
83
+ signTransaction: <TChainOverride_2 extends ViemChain | undefined>(args: import("viem").SignTransactionParameters<ViemChain, Account | undefined, TChainOverride_2>) => Promise<`0x${string}`>;
84
+ signTypedData: <const TTypedData extends {
85
+ [x: string]: readonly import("viem").TypedDataParameter[];
86
+ [x: `string[${string}]`]: undefined;
87
+ [x: `function[${string}]`]: undefined;
88
+ [x: `address[${string}]`]: undefined;
89
+ [x: `bool[${string}]`]: undefined;
90
+ [x: `bytes[${string}]`]: undefined;
91
+ [x: `bytes9[${string}]`]: undefined;
92
+ [x: `bytes1[${string}]`]: undefined;
93
+ [x: `bytes32[${string}]`]: undefined;
94
+ [x: `bytes31[${string}]`]: undefined;
95
+ [x: `bytes30[${string}]`]: undefined;
96
+ [x: `bytes29[${string}]`]: undefined;
97
+ [x: `bytes28[${string}]`]: undefined;
98
+ [x: `bytes27[${string}]`]: undefined;
99
+ [x: `bytes26[${string}]`]: undefined;
100
+ [x: `bytes25[${string}]`]: undefined;
101
+ [x: `bytes24[${string}]`]: undefined;
102
+ [x: `bytes23[${string}]`]: undefined;
103
+ [x: `bytes22[${string}]`]: undefined;
104
+ [x: `bytes21[${string}]`]: undefined;
105
+ [x: `bytes20[${string}]`]: undefined;
106
+ [x: `bytes19[${string}]`]: undefined;
107
+ [x: `bytes2[${string}]`]: undefined;
108
+ [x: `bytes18[${string}]`]: undefined;
109
+ [x: `bytes17[${string}]`]: undefined;
110
+ [x: `bytes16[${string}]`]: undefined;
111
+ [x: `bytes15[${string}]`]: undefined;
112
+ [x: `bytes14[${string}]`]: undefined;
113
+ [x: `bytes13[${string}]`]: undefined;
114
+ [x: `bytes12[${string}]`]: undefined;
115
+ [x: `bytes11[${string}]`]: undefined;
116
+ [x: `bytes10[${string}]`]: undefined;
117
+ [x: `bytes8[${string}]`]: undefined;
118
+ [x: `bytes7[${string}]`]: undefined;
119
+ [x: `bytes6[${string}]`]: undefined;
120
+ [x: `bytes5[${string}]`]: undefined;
121
+ [x: `bytes4[${string}]`]: undefined;
122
+ [x: `bytes3[${string}]`]: undefined;
123
+ [x: `int[${string}]`]: undefined;
124
+ [x: `int40[${string}]`]: undefined;
125
+ [x: `int32[${string}]`]: undefined;
126
+ [x: `int24[${string}]`]: undefined;
127
+ [x: `int16[${string}]`]: undefined;
128
+ [x: `int8[${string}]`]: undefined;
129
+ [x: `int48[${string}]`]: undefined;
130
+ [x: `int56[${string}]`]: undefined;
131
+ [x: `int64[${string}]`]: undefined;
132
+ [x: `int72[${string}]`]: undefined;
133
+ [x: `int80[${string}]`]: undefined;
134
+ [x: `int88[${string}]`]: undefined;
135
+ [x: `int96[${string}]`]: undefined;
136
+ [x: `int104[${string}]`]: undefined;
137
+ [x: `int112[${string}]`]: undefined;
138
+ [x: `int120[${string}]`]: undefined;
139
+ [x: `int128[${string}]`]: undefined;
140
+ [x: `int136[${string}]`]: undefined;
141
+ [x: `int144[${string}]`]: undefined;
142
+ [x: `int152[${string}]`]: undefined;
143
+ [x: `int160[${string}]`]: undefined;
144
+ [x: `int168[${string}]`]: undefined;
145
+ [x: `int176[${string}]`]: undefined;
146
+ [x: `int184[${string}]`]: undefined;
147
+ [x: `int192[${string}]`]: undefined;
148
+ [x: `int200[${string}]`]: undefined;
149
+ [x: `int208[${string}]`]: undefined;
150
+ [x: `int216[${string}]`]: undefined;
151
+ [x: `int224[${string}]`]: undefined;
152
+ [x: `int232[${string}]`]: undefined;
153
+ [x: `int240[${string}]`]: undefined;
154
+ [x: `int248[${string}]`]: undefined;
155
+ [x: `int256[${string}]`]: undefined;
156
+ [x: `uint[${string}]`]: undefined;
157
+ [x: `uint40[${string}]`]: undefined;
158
+ [x: `uint32[${string}]`]: undefined;
159
+ [x: `uint24[${string}]`]: undefined;
160
+ [x: `uint16[${string}]`]: undefined;
161
+ [x: `uint8[${string}]`]: undefined;
162
+ [x: `uint48[${string}]`]: undefined;
163
+ [x: `uint56[${string}]`]: undefined;
164
+ [x: `uint64[${string}]`]: undefined;
165
+ [x: `uint72[${string}]`]: undefined;
166
+ [x: `uint80[${string}]`]: undefined;
167
+ [x: `uint88[${string}]`]: undefined;
168
+ [x: `uint96[${string}]`]: undefined;
169
+ [x: `uint104[${string}]`]: undefined;
170
+ [x: `uint112[${string}]`]: undefined;
171
+ [x: `uint120[${string}]`]: undefined;
172
+ [x: `uint128[${string}]`]: undefined;
173
+ [x: `uint136[${string}]`]: undefined;
174
+ [x: `uint144[${string}]`]: undefined;
175
+ [x: `uint152[${string}]`]: undefined;
176
+ [x: `uint160[${string}]`]: undefined;
177
+ [x: `uint168[${string}]`]: undefined;
178
+ [x: `uint176[${string}]`]: undefined;
179
+ [x: `uint184[${string}]`]: undefined;
180
+ [x: `uint192[${string}]`]: undefined;
181
+ [x: `uint200[${string}]`]: undefined;
182
+ [x: `uint208[${string}]`]: undefined;
183
+ [x: `uint216[${string}]`]: undefined;
184
+ [x: `uint224[${string}]`]: undefined;
185
+ [x: `uint232[${string}]`]: undefined;
186
+ [x: `uint240[${string}]`]: undefined;
187
+ [x: `uint248[${string}]`]: undefined;
188
+ [x: `uint256[${string}]`]: undefined;
189
+ string?: undefined;
190
+ address?: undefined;
191
+ bool?: undefined;
192
+ bytes?: undefined;
193
+ bytes9?: undefined;
194
+ bytes1?: undefined;
195
+ bytes32?: undefined;
196
+ bytes31?: undefined;
197
+ bytes30?: undefined;
198
+ bytes29?: undefined;
199
+ bytes28?: undefined;
200
+ bytes27?: undefined;
201
+ bytes26?: undefined;
202
+ bytes25?: undefined;
203
+ bytes24?: undefined;
204
+ bytes23?: undefined;
205
+ bytes22?: undefined;
206
+ bytes21?: undefined;
207
+ bytes20?: undefined;
208
+ bytes19?: undefined;
209
+ bytes2?: undefined;
210
+ bytes18?: undefined;
211
+ bytes17?: undefined;
212
+ bytes16?: undefined;
213
+ bytes15?: undefined;
214
+ bytes14?: undefined;
215
+ bytes13?: undefined;
216
+ bytes12?: undefined;
217
+ bytes11?: undefined;
218
+ bytes10?: undefined;
219
+ bytes8?: undefined;
220
+ bytes7?: undefined;
221
+ bytes6?: undefined;
222
+ bytes5?: undefined;
223
+ bytes4?: undefined;
224
+ bytes3?: undefined;
225
+ int40?: undefined;
226
+ int32?: undefined;
227
+ int24?: undefined;
228
+ int16?: undefined;
229
+ int8?: undefined;
230
+ int48?: undefined;
231
+ int56?: undefined;
232
+ int64?: undefined;
233
+ int72?: undefined;
234
+ int80?: undefined;
235
+ int88?: undefined;
236
+ int96?: undefined;
237
+ int104?: undefined;
238
+ int112?: undefined;
239
+ int120?: undefined;
240
+ int128?: undefined;
241
+ int136?: undefined;
242
+ int144?: undefined;
243
+ int152?: undefined;
244
+ int160?: undefined;
245
+ int168?: undefined;
246
+ int176?: undefined;
247
+ int184?: undefined;
248
+ int192?: undefined;
249
+ int200?: undefined;
250
+ int208?: undefined;
251
+ int216?: undefined;
252
+ int224?: undefined;
253
+ int232?: undefined;
254
+ int240?: undefined;
255
+ int248?: undefined;
256
+ int256?: undefined;
257
+ uint40?: undefined;
258
+ uint32?: undefined;
259
+ uint24?: undefined;
260
+ uint16?: undefined;
261
+ uint8?: undefined;
262
+ uint48?: undefined;
263
+ uint56?: undefined;
264
+ uint64?: undefined;
265
+ uint72?: undefined;
266
+ uint80?: undefined;
267
+ uint88?: undefined;
268
+ uint96?: undefined;
269
+ uint104?: undefined;
270
+ uint112?: undefined;
271
+ uint120?: undefined;
272
+ uint128?: undefined;
273
+ uint136?: undefined;
274
+ uint144?: undefined;
275
+ uint152?: undefined;
276
+ uint160?: undefined;
277
+ uint168?: undefined;
278
+ uint176?: undefined;
279
+ uint184?: undefined;
280
+ uint192?: undefined;
281
+ uint200?: undefined;
282
+ uint208?: undefined;
283
+ uint216?: undefined;
284
+ uint224?: undefined;
285
+ uint232?: undefined;
286
+ uint240?: undefined;
287
+ uint248?: undefined;
288
+ uint256?: undefined;
289
+ } | {
290
+ [key: string]: unknown;
291
+ }, TPrimaryType extends string>(args: import("viem").SignTypedDataParameters<TTypedData, TPrimaryType, Account | undefined>) => Promise<`0x${string}`>;
292
+ switchChain: (args: import("viem").SwitchChainParameters) => Promise<void>;
293
+ watchAsset: (args: import("viem").WatchAssetParams) => Promise<boolean>;
294
+ writeContract: <const abi_1 extends import("viem").Abi | readonly unknown[], functionName extends import("viem").ContractFunctionName<abi_1, "nonpayable" | "payable">, args extends import("viem").ContractFunctionArgs<abi_1, "pure" | "view", functionName>, TChainOverride_3 extends ViemChain | undefined = undefined>(args: import("viem").WriteContractParameters<abi_1, functionName, args, ViemChain, Account | undefined, TChainOverride_3>) => Promise<`0x${string}`>;
295
+ extend: <const client extends {
296
+ [x: string]: unknown;
297
+ account?: undefined;
298
+ batch?: undefined;
299
+ cacheTime?: undefined;
300
+ chain?: undefined;
301
+ key?: undefined;
302
+ name?: undefined;
303
+ pollingInterval?: undefined;
304
+ request?: undefined;
305
+ transport?: undefined;
306
+ type?: undefined;
307
+ uid?: undefined;
308
+ } & Partial<Pick<import("viem").PublicActions<Transport, ViemChain, Account | undefined>, "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getChainId" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "prepareTransactionRequest" | "readContract" | "sendRawTransaction" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions<ViemChain, Account | undefined>, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<Transport, ViemChain, Account | undefined, import("viem").WalletRpcSchema, import("viem").WalletActions<ViemChain, Account | undefined>>) => client) => import("viem").Client<Transport, ViemChain, Account | undefined, import("viem").WalletRpcSchema, { [K in keyof client]: client[K]; } & import("viem").WalletActions<ViemChain, Account | undefined>>;
309
+ } | undefined>;
53
310
  canSponsorTransactionGas(transaction: IUITransaction): Promise<boolean>;
54
311
  disableGasSponsorshipOnce(): void;
55
312
  getBalance(): Promise<string | undefined>;
@@ -167,12 +167,14 @@ class ZeroDevConnector extends WalletConnectorBase {
167
167
  return transport;
168
168
  }
169
169
  getWalletClient(chainId) {
170
+ var _a;
170
171
  const provider = this.kernelClient;
171
172
  if (!provider)
172
173
  throw new DynamicError('No provider');
173
174
  const transport = this.getTransport(provider);
175
+ const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
174
176
  const walletClient = createWalletClient({
175
- account: provider.account,
177
+ account: address,
176
178
  chain: chainId ? chainsMap[chainId] : provider.chain,
177
179
  transport,
178
180
  });
@@ -187,18 +189,8 @@ class ZeroDevConnector extends WalletConnectorBase {
187
189
  });
188
190
  }
189
191
  getSigner() {
190
- var _a;
191
192
  return __awaiter(this, void 0, void 0, function* () {
192
- const provider = this.kernelClient;
193
- if (!provider)
194
- throw new DynamicError('No provider');
195
- const transport = this.getTransport(provider);
196
- const address = (_a = provider.account) === null || _a === void 0 ? void 0 : _a.address;
197
- const walletClient = createWalletClient({
198
- account: address,
199
- transport,
200
- });
201
- return walletClient;
193
+ return this.getWalletClient();
202
194
  });
203
195
  }
204
196
  canSponsorTransactionGas(transaction) {