@dynamic-labs/ethereum 2.0.0-alpha.2 → 2.0.0-alpha.21

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +236 -0
  2. package/package.json +10 -11
  3. package/src/EthWalletConnector.cjs +1 -20
  4. package/src/EthWalletConnector.d.ts +9 -10
  5. package/src/EthWalletConnector.js +3 -22
  6. package/src/coinbase/client/client.cjs +2 -2
  7. package/src/coinbase/client/client.d.ts +2 -2
  8. package/src/coinbase/client/client.js +2 -2
  9. package/src/coinbase/coinbase.cjs +30 -9
  10. package/src/coinbase/coinbase.d.ts +19 -17
  11. package/src/coinbase/coinbase.js +31 -10
  12. package/src/ethProviderHelper.cjs +10 -5
  13. package/src/ethProviderHelper.d.ts +4 -3
  14. package/src/ethProviderHelper.js +10 -5
  15. package/src/index.cjs +7 -13
  16. package/src/index.d.ts +1 -0
  17. package/src/index.js +7 -13
  18. package/src/injected/ExodusEvm.cjs +1 -0
  19. package/src/injected/ExodusEvm.d.ts +1 -0
  20. package/src/injected/ExodusEvm.js +1 -0
  21. package/src/injected/InjectedWalletBase.cjs +6 -14
  22. package/src/injected/InjectedWalletBase.d.ts +2 -2
  23. package/src/injected/InjectedWalletBase.js +6 -14
  24. package/src/injected/PhantomEvm.cjs +4 -3
  25. package/src/injected/PhantomEvm.d.ts +2 -1
  26. package/src/injected/PhantomEvm.js +4 -3
  27. package/src/injected/fetchInjectedWalletConnectors.d.ts +0 -1
  28. package/src/walletConnect/fetchWalletConnectWallets.cjs +14 -33
  29. package/src/walletConnect/fetchWalletConnectWallets.d.ts +2 -5
  30. package/src/walletConnect/fetchWalletConnectWallets.js +14 -33
  31. package/src/walletConnect/index.d.ts +1 -2
  32. package/src/walletConnect/walletConnect.cjs +427 -79
  33. package/src/walletConnect/walletConnect.d.ts +309 -28
  34. package/src/walletConnect/walletConnect.js +426 -79
  35. package/src/walletConnect/client/client.cjs +0 -201
  36. package/src/walletConnect/client/client.d.ts +0 -17
  37. package/src/walletConnect/client/client.js +0 -187
  38. package/src/walletConnect/client/index.d.ts +0 -1
  39. package/src/walletConnect/client/types.d.ts +0 -4
  40. package/src/walletConnect/walletConnectV2.cjs +0 -475
  41. package/src/walletConnect/walletConnectV2.d.ts +0 -333
  42. package/src/walletConnect/walletConnectV2.js +0 -466
@@ -1,333 +0,0 @@
1
- import type { SessionTypes } from '@walletconnect/types';
2
- import { Hex, WalletClient } from 'viem';
3
- import { Chain, FetchPublicAddressOpts, DeepLinkVariant } from '@dynamic-labs/wallet-connector-core';
4
- import { EvmNetwork } from '@dynamic-labs/types';
5
- import { EthWalletConnector, EthWalletConnectorOpts } from '../EthWalletConnector';
6
- export type WalletConnectorV2Opts = EthWalletConnectorOpts & {
7
- projectId?: string;
8
- walletName: string;
9
- deepLinkPreference?: DeepLinkVariant;
10
- walletConnectPreferredChains?: `eip155:${number}`[];
11
- };
12
- export declare class WalletConnectV2 extends EthWalletConnector {
13
- supportedChains: Chain[];
14
- connectedChain: Chain;
15
- name: string;
16
- session: SessionTypes.Struct | undefined;
17
- activeAccount: Hex | undefined;
18
- isInitialized: boolean;
19
- initializePromise: Promise<void> | undefined;
20
- canConnectViaQrCode: boolean;
21
- isWalletConnect: boolean;
22
- private static provider;
23
- private projectId?;
24
- private deepLinkPreference;
25
- private preferredChains;
26
- private _currentChainId;
27
- private _hasSwitchedNetwork;
28
- constructor(opts: WalletConnectorV2Opts);
29
- private getMappedChains;
30
- private getMappedChainsByPreferredOrder;
31
- private initConnection;
32
- private createInitProviderPromise;
33
- private initProvider;
34
- private refreshSession;
35
- init(): Promise<void>;
36
- get sessionTopicKey(): string;
37
- get activeAccountKey(): string;
38
- get swicthedNetworkKey(): string;
39
- get currentChainKey(): string;
40
- private set currentChainId(value);
41
- private get currentChainId();
42
- private set hasSwitchedNetwork(value);
43
- private get hasSwitchedNetwork();
44
- supportsNetworkSwitching(): boolean;
45
- setupEventListeners(): void;
46
- teardownEventListeners(): void;
47
- getWalletClient(): {
48
- account: undefined;
49
- batch?: {
50
- multicall?: boolean | {
51
- batchSize?: number | undefined;
52
- wait?: number | undefined;
53
- } | undefined;
54
- } | undefined;
55
- cacheTime: number;
56
- chain: undefined;
57
- key: string;
58
- name: string;
59
- pollingInterval: number;
60
- request: import("viem").EIP1193RequestFn<import("viem").WalletRpcSchema>;
61
- transport: import("viem").TransportConfig<"custom", import("viem").EIP1193RequestFn>;
62
- type: string;
63
- uid: string;
64
- addChain: (args: import("viem").AddChainParameters) => Promise<void>;
65
- deployContract: <const TAbi extends import("viem").Abi | readonly unknown[], TChainOverride extends import("viem").Chain | undefined = undefined>(args: import("viem").DeployContractParameters<TAbi, undefined, undefined, TChainOverride>) => Promise<`0x${string}`>;
66
- getAddresses: () => Promise<import("viem").GetAddressesReturnType>;
67
- getChainId: () => Promise<number>;
68
- getPermissions: () => Promise<import("viem").GetPermissionsReturnType>;
69
- prepareTransactionRequest: <TChainOverride_1 extends import("viem").Chain | undefined = undefined>(args: import("viem").PrepareTransactionRequestParameters<undefined, undefined, TChainOverride_1>) => Promise<import("viem").PrepareTransactionRequestReturnType>;
70
- requestAddresses: () => Promise<import("viem").RequestAddressesReturnType>;
71
- requestPermissions: (args: {
72
- [x: string]: Record<string, any>;
73
- eth_accounts: Record<string, any>;
74
- }) => Promise<import("viem").RequestPermissionsReturnType>;
75
- sendRawTransaction: (args: import("node_modules/viem/_types/actions/wallet/sendRawTransaction").SendRawTransactionParameters) => Promise<`0x${string}`>;
76
- sendTransaction: <TChainOverride_2 extends import("viem").Chain | undefined = undefined>(args: import("viem").SendTransactionParameters<undefined, undefined, TChainOverride_2>) => Promise<`0x${string}`>;
77
- signMessage: (args: import("viem").SignMessageParameters<undefined>) => Promise<`0x${string}`>;
78
- signTransaction: <TChainOverride_3 extends import("viem").Chain | undefined = undefined>(args: import("node_modules/viem/_types/actions/wallet/signTransaction").SignTransactionParameters<undefined, undefined, TChainOverride_3>) => Promise<`0x${string}`>;
79
- signTypedData: <const TTypedData extends {
80
- [x: string]: readonly import("viem").TypedDataParameter[];
81
- [x: `string[${string}]`]: undefined;
82
- [x: `function[${string}]`]: undefined;
83
- [x: `address[${string}]`]: undefined;
84
- [x: `bool[${string}]`]: undefined;
85
- [x: `bytes[${string}]`]: undefined;
86
- [x: `bytes16[${string}]`]: undefined;
87
- [x: `bytes1[${string}]`]: undefined;
88
- [x: `bytes2[${string}]`]: undefined;
89
- [x: `bytes3[${string}]`]: undefined;
90
- [x: `bytes4[${string}]`]: undefined;
91
- [x: `bytes5[${string}]`]: undefined;
92
- [x: `bytes6[${string}]`]: undefined;
93
- [x: `bytes7[${string}]`]: undefined;
94
- [x: `bytes8[${string}]`]: undefined;
95
- [x: `bytes9[${string}]`]: undefined;
96
- [x: `bytes10[${string}]`]: undefined;
97
- [x: `bytes11[${string}]`]: undefined;
98
- [x: `bytes12[${string}]`]: undefined;
99
- [x: `bytes13[${string}]`]: undefined;
100
- [x: `bytes14[${string}]`]: undefined;
101
- [x: `bytes15[${string}]`]: undefined;
102
- [x: `bytes17[${string}]`]: undefined;
103
- [x: `bytes18[${string}]`]: undefined;
104
- [x: `bytes19[${string}]`]: undefined;
105
- [x: `bytes20[${string}]`]: undefined;
106
- [x: `bytes21[${string}]`]: undefined;
107
- [x: `bytes22[${string}]`]: undefined;
108
- [x: `bytes23[${string}]`]: undefined;
109
- [x: `bytes24[${string}]`]: undefined;
110
- [x: `bytes25[${string}]`]: undefined;
111
- [x: `bytes26[${string}]`]: undefined;
112
- [x: `bytes27[${string}]`]: undefined;
113
- [x: `bytes28[${string}]`]: undefined;
114
- [x: `bytes29[${string}]`]: undefined;
115
- [x: `bytes30[${string}]`]: undefined;
116
- [x: `bytes31[${string}]`]: undefined;
117
- [x: `bytes32[${string}]`]: undefined;
118
- [x: `int[${string}]`]: undefined;
119
- [x: `int16[${string}]`]: undefined;
120
- [x: `int8[${string}]`]: undefined;
121
- [x: `int24[${string}]`]: undefined;
122
- [x: `int32[${string}]`]: undefined;
123
- [x: `int40[${string}]`]: undefined;
124
- [x: `int48[${string}]`]: undefined;
125
- [x: `int56[${string}]`]: undefined;
126
- [x: `int64[${string}]`]: undefined;
127
- [x: `int72[${string}]`]: undefined;
128
- [x: `int80[${string}]`]: undefined;
129
- [x: `int88[${string}]`]: undefined;
130
- [x: `int96[${string}]`]: undefined;
131
- [x: `int104[${string}]`]: undefined;
132
- [x: `int112[${string}]`]: undefined;
133
- [x: `int120[${string}]`]: undefined;
134
- [x: `int128[${string}]`]: undefined;
135
- [x: `int136[${string}]`]: undefined;
136
- [x: `int144[${string}]`]: undefined;
137
- [x: `int152[${string}]`]: undefined;
138
- [x: `int160[${string}]`]: undefined;
139
- [x: `int168[${string}]`]: undefined;
140
- [x: `int176[${string}]`]: undefined;
141
- [x: `int184[${string}]`]: undefined;
142
- [x: `int192[${string}]`]: undefined;
143
- [x: `int200[${string}]`]: undefined;
144
- [x: `int208[${string}]`]: undefined;
145
- [x: `int216[${string}]`]: undefined;
146
- [x: `int224[${string}]`]: undefined;
147
- [x: `int232[${string}]`]: undefined;
148
- [x: `int240[${string}]`]: undefined;
149
- [x: `int248[${string}]`]: undefined;
150
- [x: `int256[${string}]`]: undefined;
151
- [x: `uint[${string}]`]: undefined;
152
- [x: `uint16[${string}]`]: undefined;
153
- [x: `uint8[${string}]`]: undefined;
154
- [x: `uint24[${string}]`]: undefined;
155
- [x: `uint32[${string}]`]: undefined;
156
- [x: `uint40[${string}]`]: undefined;
157
- [x: `uint48[${string}]`]: undefined;
158
- [x: `uint56[${string}]`]: undefined;
159
- [x: `uint64[${string}]`]: undefined;
160
- [x: `uint72[${string}]`]: undefined;
161
- [x: `uint80[${string}]`]: undefined;
162
- [x: `uint88[${string}]`]: undefined;
163
- [x: `uint96[${string}]`]: undefined;
164
- [x: `uint104[${string}]`]: undefined;
165
- [x: `uint112[${string}]`]: undefined;
166
- [x: `uint120[${string}]`]: undefined;
167
- [x: `uint128[${string}]`]: undefined;
168
- [x: `uint136[${string}]`]: undefined;
169
- [x: `uint144[${string}]`]: undefined;
170
- [x: `uint152[${string}]`]: undefined;
171
- [x: `uint160[${string}]`]: undefined;
172
- [x: `uint168[${string}]`]: undefined;
173
- [x: `uint176[${string}]`]: undefined;
174
- [x: `uint184[${string}]`]: undefined;
175
- [x: `uint192[${string}]`]: undefined;
176
- [x: `uint200[${string}]`]: undefined;
177
- [x: `uint208[${string}]`]: undefined;
178
- [x: `uint216[${string}]`]: undefined;
179
- [x: `uint224[${string}]`]: undefined;
180
- [x: `uint232[${string}]`]: undefined;
181
- [x: `uint240[${string}]`]: undefined;
182
- [x: `uint248[${string}]`]: undefined;
183
- [x: `uint256[${string}]`]: undefined;
184
- string?: undefined;
185
- address?: undefined;
186
- bool?: undefined;
187
- bytes?: undefined;
188
- bytes16?: undefined;
189
- bytes1?: undefined;
190
- bytes2?: undefined;
191
- bytes3?: undefined;
192
- bytes4?: undefined;
193
- bytes5?: undefined;
194
- bytes6?: undefined;
195
- bytes7?: undefined;
196
- bytes8?: undefined;
197
- bytes9?: undefined;
198
- bytes10?: undefined;
199
- bytes11?: undefined;
200
- bytes12?: undefined;
201
- bytes13?: undefined;
202
- bytes14?: undefined;
203
- bytes15?: undefined;
204
- bytes17?: undefined;
205
- bytes18?: undefined;
206
- bytes19?: undefined;
207
- bytes20?: undefined;
208
- bytes21?: undefined;
209
- bytes22?: undefined;
210
- bytes23?: undefined;
211
- bytes24?: undefined;
212
- bytes25?: undefined;
213
- bytes26?: undefined;
214
- bytes27?: undefined;
215
- bytes28?: undefined;
216
- bytes29?: undefined;
217
- bytes30?: undefined;
218
- bytes31?: undefined;
219
- bytes32?: undefined;
220
- int16?: undefined;
221
- int8?: undefined;
222
- int24?: undefined;
223
- int32?: undefined;
224
- int40?: undefined;
225
- int48?: undefined;
226
- int56?: undefined;
227
- int64?: undefined;
228
- int72?: undefined;
229
- int80?: undefined;
230
- int88?: undefined;
231
- int96?: undefined;
232
- int104?: undefined;
233
- int112?: undefined;
234
- int120?: undefined;
235
- int128?: undefined;
236
- int136?: undefined;
237
- int144?: undefined;
238
- int152?: undefined;
239
- int160?: undefined;
240
- int168?: undefined;
241
- int176?: undefined;
242
- int184?: undefined;
243
- int192?: undefined;
244
- int200?: undefined;
245
- int208?: undefined;
246
- int216?: undefined;
247
- int224?: undefined;
248
- int232?: undefined;
249
- int240?: undefined;
250
- int248?: undefined;
251
- int256?: undefined;
252
- uint16?: undefined;
253
- uint8?: undefined;
254
- uint24?: undefined;
255
- uint32?: undefined;
256
- uint40?: undefined;
257
- uint48?: undefined;
258
- uint56?: undefined;
259
- uint64?: undefined;
260
- uint72?: undefined;
261
- uint80?: undefined;
262
- uint88?: undefined;
263
- uint96?: undefined;
264
- uint104?: undefined;
265
- uint112?: undefined;
266
- uint120?: undefined;
267
- uint128?: undefined;
268
- uint136?: undefined;
269
- uint144?: undefined;
270
- uint152?: undefined;
271
- uint160?: undefined;
272
- uint168?: undefined;
273
- uint176?: undefined;
274
- uint184?: undefined;
275
- uint192?: undefined;
276
- uint200?: undefined;
277
- uint208?: undefined;
278
- uint216?: undefined;
279
- uint224?: undefined;
280
- uint232?: undefined;
281
- uint240?: undefined;
282
- uint248?: undefined;
283
- uint256?: undefined;
284
- } | {
285
- [key: string]: unknown;
286
- }, TPrimaryType extends string>(args: import("viem").SignTypedDataParameters<TTypedData, TPrimaryType, undefined>) => Promise<`0x${string}`>;
287
- switchChain: (args: import("viem").SwitchChainParameters) => Promise<void>;
288
- watchAsset: (args: import("viem").WatchAssetParams) => Promise<boolean>;
289
- writeContract: <const TAbi_1 extends import("viem").Abi | readonly unknown[], TFunctionName extends string, TChainOverride_4 extends import("viem").Chain | undefined = undefined>(args: import("viem").WriteContractParameters<TAbi_1, TFunctionName, undefined, undefined, TChainOverride_4>) => Promise<`0x${string}`>;
290
- extend: <const client extends {
291
- [x: string]: unknown;
292
- account?: undefined;
293
- batch?: undefined;
294
- cacheTime?: undefined;
295
- chain?: undefined;
296
- key?: undefined;
297
- name?: undefined;
298
- pollingInterval?: undefined;
299
- request?: undefined;
300
- transport?: undefined;
301
- type?: undefined;
302
- uid?: undefined;
303
- } & Partial<Pick<import("viem").PublicActions, "getChainId" | "prepareTransactionRequest" | "sendRawTransaction" | "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<import("viem").CustomTransport, undefined, undefined, import("viem").WalletRpcSchema, import("viem").WalletActions<undefined, undefined>>) => client) => import("viem").Client<import("viem").CustomTransport, undefined, undefined, import("viem").WalletRpcSchema, { [K in keyof client]: client[K]; } & import("viem").WalletActions<undefined, undefined>>;
304
- } | undefined;
305
- fetchPublicAddress(opts?: FetchPublicAddressOpts): Promise<string | undefined>;
306
- /**
307
- * WalletConnect V2 will fail to send the sign message request if the chainId
308
- * is not the same as the one in the session. This method will wait for the
309
- * chainId to change and then retry the sign message request.
310
- *
311
- * Otherwise it will just return the result of the sign message request.
312
- *
313
- * @param signMessageFn - Function to sign message with provider
314
- * @param messageToSign - Message to sign
315
- * @returns
316
- */
317
- protected waitForSignMessage(signMessageFn: (messageToSign: string) => Promise<string | undefined>, messageToSign: string): Promise<string | undefined>;
318
- getDeepLink(): string | undefined;
319
- signMessage(messageToSign: string): Promise<string | undefined>;
320
- private clearActiveAccount;
321
- private clearSession;
322
- private setActiveAccount;
323
- private setSession;
324
- endSession(): Promise<void>;
325
- getNetwork(): Promise<number | undefined>;
326
- providerSwitchNetwork({ network, provider, }: {
327
- network: EvmNetwork;
328
- provider: WalletClient;
329
- }): Promise<void>;
330
- getConnectedAccounts(): Promise<string[]>;
331
- private isMetaMask;
332
- getSupportedNetworks(): Promise<string[] | undefined>;
333
- }