@wagmi/connectors 3.1.1 → 4.0.0

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 (73) hide show
  1. package/dist/esm/coinbaseWallet.js +141 -0
  2. package/dist/esm/coinbaseWallet.js.map +1 -0
  3. package/dist/esm/index.js +7 -0
  4. package/dist/esm/index.js.map +1 -0
  5. package/dist/esm/index.test-d.js +4 -0
  6. package/dist/esm/index.test-d.js.map +1 -0
  7. package/dist/esm/injected.js +372 -0
  8. package/dist/esm/injected.js.map +1 -0
  9. package/dist/esm/ledger.js +162 -0
  10. package/dist/esm/ledger.js.map +1 -0
  11. package/dist/esm/safe.js +88 -0
  12. package/dist/esm/safe.js.map +1 -0
  13. package/dist/esm/tsconfig.build.tsbuildinfo +1 -0
  14. package/dist/esm/version.js +2 -0
  15. package/dist/esm/version.js.map +1 -0
  16. package/dist/esm/walletConnect.js +280 -0
  17. package/dist/esm/walletConnect.js.map +1 -0
  18. package/dist/types/coinbaseWallet.d.ts +21 -0
  19. package/dist/types/coinbaseWallet.d.ts.map +1 -0
  20. package/dist/types/index.d.ts +7 -0
  21. package/dist/types/index.d.ts.map +1 -0
  22. package/dist/types/index.test-d.d.ts +2 -0
  23. package/dist/types/index.test-d.d.ts.map +1 -0
  24. package/dist/types/injected.d.ts +381 -0
  25. package/dist/types/injected.d.ts.map +1 -0
  26. package/dist/types/ledger.d.ts +18 -0
  27. package/dist/types/ledger.d.ts.map +1 -0
  28. package/dist/types/safe.d.ts +18 -0
  29. package/dist/types/safe.d.ts.map +1 -0
  30. package/dist/types/version.d.ts +2 -0
  31. package/dist/types/version.d.ts.map +1 -0
  32. package/dist/types/walletConnect.d.ts +63 -0
  33. package/dist/types/walletConnect.d.ts.map +1 -0
  34. package/package.json +44 -83
  35. package/src/coinbaseWallet.ts +207 -0
  36. package/src/index.ts +17 -0
  37. package/src/injected.ts +527 -0
  38. package/src/ledger.ts +210 -0
  39. package/src/safe.ts +114 -0
  40. package/src/version.ts +1 -0
  41. package/src/walletConnect.ts +394 -0
  42. package/README.md +0 -46
  43. package/coinbaseWallet/package.json +0 -4
  44. package/dist/base-70e3a8a9.d.ts +0 -142
  45. package/dist/chunk-2UFLHRLT.js +0 -391
  46. package/dist/chunk-OQILYQDO.js +0 -15
  47. package/dist/chunk-UGBGYVBH.js +0 -22
  48. package/dist/chunk-W65LBPLT.js +0 -58
  49. package/dist/coinbaseWallet.d.ts +0 -62
  50. package/dist/coinbaseWallet.js +0 -216
  51. package/dist/index.d.ts +0 -20
  52. package/dist/index.js +0 -16
  53. package/dist/injected.d.ts +0 -64
  54. package/dist/injected.js +0 -9
  55. package/dist/ledger.d.ts +0 -69
  56. package/dist/ledger.js +0 -261
  57. package/dist/metaMask.d.ts +0 -33
  58. package/dist/metaMask.js +0 -144
  59. package/dist/mock/index.d.ts +0 -80
  60. package/dist/mock/index.js +0 -200
  61. package/dist/safe.d.ts +0 -53
  62. package/dist/safe.js +0 -129
  63. package/dist/walletConnect.d.ts +0 -109
  64. package/dist/walletConnect.js +0 -325
  65. package/dist/walletConnectLegacy.d.ts +0 -38
  66. package/dist/walletConnectLegacy.js +0 -179
  67. package/injected/package.json +0 -4
  68. package/ledger/package.json +0 -4
  69. package/metaMask/package.json +0 -4
  70. package/mock/package.json +0 -4
  71. package/safe/package.json +0 -4
  72. package/walletConnect/package.json +0 -4
  73. package/walletConnectLegacy/package.json +0 -4
@@ -0,0 +1,381 @@
1
+ import type { Evaluate } from '@wagmi/core/internal';
2
+ import { type EIP1193Provider, type ProviderConnectInfo } from 'viem';
3
+ export type InjectedParameters = {
4
+ /**
5
+ * MetaMask and other injected providers do not support programmatic disconnect.
6
+ * This flag simulates the disconnect behavior by keeping track of connection status in storage. See [GitHub issue](https://github.com/MetaMask/metamask-extension/issues/10353) for more info.
7
+ * @default true
8
+ */
9
+ shimDisconnect?: boolean | undefined;
10
+ unstable_shimAsyncInject?: boolean | number | undefined;
11
+ /**
12
+ * [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) Ethereum Provider to target
13
+ */
14
+ wallet?: WalletId | (() => (WalletMap[WalletId] & {
15
+ id: string;
16
+ }) | undefined) | undefined;
17
+ };
18
+ export declare function injected(parameters?: InjectedParameters): import("@wagmi/core").CreateConnectorFn<{
19
+ on: <TEvent extends keyof import("viem").EIP1193EventMap>(event: TEvent, listener: import("viem").EIP1193EventMap[TEvent]) => void;
20
+ removeListener: <TEvent_1 extends keyof import("viem").EIP1193EventMap>(event: TEvent_1, listener: import("viem").EIP1193EventMap[TEvent_1]) => void;
21
+ request: import("viem").EIP1193RequestFn<[{
22
+ Method: "web3_clientVersion";
23
+ Parameters?: undefined;
24
+ ReturnType: string;
25
+ }, {
26
+ Method: "web3_sha3";
27
+ Parameters: [data: `0x${string}`];
28
+ ReturnType: string;
29
+ }, {
30
+ Method: "net_listening";
31
+ Parameters?: undefined;
32
+ ReturnType: boolean;
33
+ }, {
34
+ Method: "net_peerCount";
35
+ Parameters?: undefined;
36
+ ReturnType: `0x${string}`;
37
+ }, {
38
+ Method: "net_version";
39
+ Parameters?: undefined;
40
+ ReturnType: `0x${string}`;
41
+ }, {
42
+ Method: "eth_blockNumber";
43
+ Parameters?: undefined;
44
+ ReturnType: `0x${string}`;
45
+ }, {
46
+ Method: "eth_call";
47
+ Parameters: [transaction: Partial<import("viem").RpcTransactionRequest>] | [transaction: Partial<import("viem").RpcTransactionRequest>, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
48
+ ReturnType: `0x${string}`;
49
+ }, {
50
+ Method: "eth_chainId";
51
+ Parameters?: undefined;
52
+ ReturnType: `0x${string}`;
53
+ }, {
54
+ Method: "eth_coinbase";
55
+ Parameters?: undefined;
56
+ ReturnType: `0x${string}`;
57
+ }, {
58
+ Method: "eth_estimateGas";
59
+ Parameters: [transaction: import("viem").RpcTransactionRequest] | [transaction: import("viem").RpcTransactionRequest, block: `0x${string}` | import("viem").BlockTag];
60
+ ReturnType: `0x${string}`;
61
+ }, {
62
+ Method: "eth_feeHistory";
63
+ Parameters: [blockCount: `0x${string}`, newestBlock: `0x${string}` | import("viem").BlockTag, rewardPercentiles: number[] | undefined];
64
+ ReturnType: import("viem").RpcFeeHistory;
65
+ }, {
66
+ Method: "eth_gasPrice";
67
+ Parameters?: undefined;
68
+ ReturnType: `0x${string}`;
69
+ }, {
70
+ Method: "eth_getBalance";
71
+ Parameters: [address: `0x${string}`, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
72
+ ReturnType: `0x${string}`;
73
+ }, {
74
+ Method: "eth_getBlockByHash";
75
+ Parameters: [hash: `0x${string}`, includeTransactionObjects: boolean];
76
+ ReturnType: import("viem").RpcBlock | null;
77
+ }, {
78
+ Method: "eth_getBlockByNumber";
79
+ Parameters: [block: `0x${string}` | import("viem").BlockTag, includeTransactionObjects: boolean];
80
+ ReturnType: import("viem").RpcBlock | null;
81
+ }, {
82
+ Method: "eth_getBlockTransactionCountByHash";
83
+ Parameters: [hash: `0x${string}`];
84
+ ReturnType: `0x${string}`;
85
+ }, {
86
+ Method: "eth_getBlockTransactionCountByNumber";
87
+ Parameters: [block: `0x${string}` | import("viem").BlockTag];
88
+ ReturnType: `0x${string}`;
89
+ }, {
90
+ Method: "eth_getCode";
91
+ Parameters: [address: `0x${string}`, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
92
+ ReturnType: `0x${string}`;
93
+ }, {
94
+ Method: "eth_getFilterChanges";
95
+ Parameters: [filterId: `0x${string}`];
96
+ ReturnType: `0x${string}`[] | import("viem").RpcLog[];
97
+ }, {
98
+ Method: "eth_getFilterLogs";
99
+ Parameters: [filterId: `0x${string}`];
100
+ ReturnType: import("viem").RpcLog[];
101
+ }, {
102
+ Method: "eth_getLogs";
103
+ Parameters: [{
104
+ address?: `0x${string}` | `0x${string}`[] | undefined;
105
+ topics?: import("viem").LogTopic[] | undefined;
106
+ } & ({
107
+ fromBlock?: `0x${string}` | import("viem").BlockTag | undefined;
108
+ toBlock?: `0x${string}` | import("viem").BlockTag | undefined;
109
+ blockHash?: undefined;
110
+ } | {
111
+ fromBlock?: undefined;
112
+ toBlock?: undefined;
113
+ blockHash?: `0x${string}` | undefined;
114
+ })];
115
+ ReturnType: import("viem").RpcLog[];
116
+ }, {
117
+ Method: "eth_getStorageAt";
118
+ Parameters: [address: `0x${string}`, index: `0x${string}`, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
119
+ ReturnType: `0x${string}`;
120
+ }, {
121
+ Method: "eth_getTransactionByBlockHashAndIndex";
122
+ Parameters: [hash: `0x${string}`, index: `0x${string}`];
123
+ ReturnType: import("viem").RpcTransaction | null;
124
+ }, {
125
+ Method: "eth_getTransactionByBlockNumberAndIndex";
126
+ Parameters: [block: `0x${string}` | import("viem").BlockTag, index: `0x${string}`];
127
+ ReturnType: import("viem").RpcTransaction | null;
128
+ }, {
129
+ Method: "eth_getTransactionByHash";
130
+ Parameters: [hash: `0x${string}`];
131
+ ReturnType: import("viem").RpcTransaction | null;
132
+ }, {
133
+ Method: "eth_getTransactionCount";
134
+ Parameters: [address: `0x${string}`, block: `0x${string}` | import("viem").BlockTag | import("viem").RpcBlockIdentifier];
135
+ ReturnType: `0x${string}`;
136
+ }, {
137
+ Method: "eth_getTransactionReceipt";
138
+ Parameters: [hash: `0x${string}`];
139
+ ReturnType: import("viem").RpcTransactionReceipt | null;
140
+ }, {
141
+ Method: "eth_getUncleByBlockHashAndIndex";
142
+ Parameters: [hash: `0x${string}`, index: `0x${string}`];
143
+ ReturnType: import("viem").RpcUncle | null;
144
+ }, {
145
+ Method: "eth_getUncleByBlockNumberAndIndex";
146
+ Parameters: [block: `0x${string}` | import("viem").BlockTag, index: `0x${string}`];
147
+ ReturnType: import("viem").RpcUncle | null;
148
+ }, {
149
+ Method: "eth_getUncleCountByBlockHash";
150
+ Parameters: [hash: `0x${string}`];
151
+ ReturnType: `0x${string}`;
152
+ }, {
153
+ Method: "eth_getUncleCountByBlockNumber";
154
+ Parameters: [block: `0x${string}` | import("viem").BlockTag];
155
+ ReturnType: `0x${string}`;
156
+ }, {
157
+ Method: "eth_maxPriorityFeePerGas";
158
+ Parameters?: undefined;
159
+ ReturnType: `0x${string}`;
160
+ }, {
161
+ Method: "eth_newBlockFilter";
162
+ Parameters?: undefined;
163
+ ReturnType: `0x${string}`;
164
+ }, {
165
+ Method: "eth_newFilter";
166
+ Parameters: [filter: {
167
+ fromBlock?: `0x${string}` | import("viem").BlockTag | undefined;
168
+ toBlock?: `0x${string}` | import("viem").BlockTag | undefined;
169
+ address?: `0x${string}` | `0x${string}`[] | undefined;
170
+ topics?: import("viem").LogTopic[] | undefined;
171
+ }];
172
+ ReturnType: `0x${string}`;
173
+ }, {
174
+ Method: "eth_newPendingTransactionFilter";
175
+ Parameters?: undefined;
176
+ ReturnType: `0x${string}`;
177
+ }, {
178
+ Method: "eth_protocolVersion";
179
+ Parameters?: undefined;
180
+ ReturnType: string;
181
+ }, {
182
+ Method: "eth_sendRawTransaction";
183
+ Parameters: [signedTransaction: `0x${string}`];
184
+ ReturnType: `0x${string}`;
185
+ }, {
186
+ Method: "eth_uninstallFilter";
187
+ Parameters: [filterId: `0x${string}`];
188
+ ReturnType: boolean;
189
+ }, {
190
+ Method: "eth_accounts";
191
+ Parameters?: undefined;
192
+ ReturnType: `0x${string}`[];
193
+ }, {
194
+ Method: "eth_chainId";
195
+ Parameters?: undefined;
196
+ ReturnType: `0x${string}`;
197
+ }, {
198
+ Method: "eth_estimateGas";
199
+ Parameters: [transaction: import("viem").RpcTransactionRequest] | [transaction: import("viem").RpcTransactionRequest, block: `0x${string}` | import("viem").BlockTag];
200
+ ReturnType: `0x${string}`;
201
+ }, {
202
+ Method: "eth_requestAccounts";
203
+ Parameters?: undefined;
204
+ ReturnType: `0x${string}`[];
205
+ }, {
206
+ Method: "eth_sendTransaction";
207
+ Parameters: [transaction: import("viem").RpcTransactionRequest];
208
+ ReturnType: `0x${string}`;
209
+ }, {
210
+ Method: "eth_sendRawTransaction";
211
+ Parameters: [signedTransaction: `0x${string}`];
212
+ ReturnType: `0x${string}`;
213
+ }, {
214
+ Method: "eth_sign";
215
+ Parameters: [address: `0x${string}`, data: `0x${string}`];
216
+ ReturnType: `0x${string}`;
217
+ }, {
218
+ Method: "eth_signTransaction";
219
+ Parameters: [request: import("viem").RpcTransactionRequest];
220
+ ReturnType: `0x${string}`;
221
+ }, {
222
+ Method: "eth_signTypedData_v4";
223
+ Parameters: [address: `0x${string}`, message: string];
224
+ ReturnType: `0x${string}`;
225
+ }, {
226
+ Method: "eth_syncing";
227
+ Parameters?: undefined;
228
+ ReturnType: false | import("viem").NetworkSync;
229
+ }, {
230
+ Method: "personal_sign";
231
+ Parameters: [data: `0x${string}`, address: `0x${string}`];
232
+ ReturnType: `0x${string}`;
233
+ }, {
234
+ Method: "wallet_addEthereumChain";
235
+ Parameters: [chain: import("viem").AddEthereumChainParameter];
236
+ ReturnType: null;
237
+ }, {
238
+ Method: "wallet_getPermissions";
239
+ Parameters?: undefined;
240
+ ReturnType: import("viem").WalletPermission[];
241
+ }, {
242
+ Method: "wallet_requestPermissions";
243
+ Parameters: [permissions: {
244
+ eth_accounts: Record<string, any>;
245
+ }];
246
+ ReturnType: import("viem").WalletPermission[];
247
+ }, {
248
+ Method: "wallet_switchEthereumChain";
249
+ Parameters: [chain: {
250
+ chainId: string;
251
+ }];
252
+ ReturnType: null;
253
+ }, {
254
+ Method: "wallet_watchAsset";
255
+ Parameters: import("viem").WatchAssetParams;
256
+ ReturnType: boolean;
257
+ }]>;
258
+ isApexWallet?: true | undefined;
259
+ isAvalanche?: true | undefined;
260
+ isBackpack?: true | undefined;
261
+ isBifrost?: true | undefined;
262
+ isBitKeep?: true | undefined;
263
+ isBitski?: true | undefined;
264
+ isBlockWallet?: true | undefined;
265
+ isBraveWallet?: true | undefined;
266
+ isCoinbaseWallet?: true | undefined;
267
+ isDawn?: true | undefined;
268
+ isEnkrypt?: true | undefined;
269
+ isExodus?: true | undefined;
270
+ isFrame?: true | undefined;
271
+ isFrontier?: true | undefined;
272
+ isGamestop?: true | undefined;
273
+ isHyperPay?: true | undefined;
274
+ isImToken?: true | undefined;
275
+ isKuCoinWallet?: true | undefined;
276
+ isMathWallet?: true | undefined;
277
+ isMetaMask: true;
278
+ isOkxWallet?: true | undefined;
279
+ isOKExWallet?: true | undefined;
280
+ isOneInchAndroidWallet?: true | undefined;
281
+ isOneInchIOSWallet?: true | undefined;
282
+ isOpera?: true | undefined;
283
+ isPhantom?: true | undefined;
284
+ isPortal?: true | undefined;
285
+ isRabby?: true | undefined;
286
+ isRainbow?: true | undefined;
287
+ isStatus?: true | undefined;
288
+ isTally?: true | undefined;
289
+ isTokenPocket?: true | undefined;
290
+ isTokenary?: true | undefined;
291
+ isTrust?: true | undefined;
292
+ isTrustWallet?: true | undefined;
293
+ isXDEFI?: true | undefined;
294
+ isZerion?: true | undefined;
295
+ providers?: any[] | undefined;
296
+ _events: {
297
+ connect?: (() => void) | undefined;
298
+ };
299
+ _state?: {
300
+ accounts?: string[] | undefined;
301
+ initialized?: boolean | undefined;
302
+ isConnected?: boolean | undefined;
303
+ isPermanentlyDisconnected?: boolean | undefined;
304
+ isUnlocked?: boolean | undefined;
305
+ } | undefined;
306
+ } | undefined, {
307
+ onConnect(connectInfo: ProviderConnectInfo): void;
308
+ }, {
309
+ [x: `${string}.connected`]: true;
310
+ }>;
311
+ export type WalletId = 'coinbaseWallet' | 'metaMask' | 'phantom' | 'rainbow';
312
+ type Wallet = {
313
+ name: string;
314
+ provider: keyof WindowProviderFlags | ((window?: Window) => WindowProvider | undefined);
315
+ features?: readonly 'wallet_requestPermissions'[];
316
+ };
317
+ type WalletMap = Record<WalletId, Wallet>;
318
+ type WindowProviderFlags = {
319
+ isApexWallet?: true | undefined;
320
+ isAvalanche?: true | undefined;
321
+ isBackpack?: true | undefined;
322
+ isBifrost?: true | undefined;
323
+ isBitKeep?: true | undefined;
324
+ isBitski?: true | undefined;
325
+ isBlockWallet?: true | undefined;
326
+ isBraveWallet?: true | undefined;
327
+ isCoinbaseWallet?: true | undefined;
328
+ isDawn?: true | undefined;
329
+ isEnkrypt?: true | undefined;
330
+ isExodus?: true | undefined;
331
+ isFrame?: true | undefined;
332
+ isFrontier?: true | undefined;
333
+ isGamestop?: true | undefined;
334
+ isHyperPay?: true | undefined;
335
+ isImToken?: true | undefined;
336
+ isKuCoinWallet?: true | undefined;
337
+ isMathWallet?: true | undefined;
338
+ isMetaMask?: true | undefined;
339
+ isOkxWallet?: true | undefined;
340
+ isOKExWallet?: true | undefined;
341
+ isOneInchAndroidWallet?: true | undefined;
342
+ isOneInchIOSWallet?: true | undefined;
343
+ isOpera?: true | undefined;
344
+ isPhantom?: true | undefined;
345
+ isPortal?: true | undefined;
346
+ isRabby?: true | undefined;
347
+ isRainbow?: true | undefined;
348
+ isStatus?: true | undefined;
349
+ isTally?: true | undefined;
350
+ isTokenPocket?: true | undefined;
351
+ isTokenary?: true | undefined;
352
+ isTrust?: true | undefined;
353
+ isTrustWallet?: true | undefined;
354
+ isXDEFI?: true | undefined;
355
+ isZerion?: true | undefined;
356
+ };
357
+ type WindowProvider = Evaluate<EIP1193Provider & WindowProviderFlags & {
358
+ providers?: WindowProvider[] | undefined;
359
+ isMetaMask: true;
360
+ /** Only exists in MetaMask as of 2022/04/03 */
361
+ _events: {
362
+ connect?: (() => void) | undefined;
363
+ };
364
+ /** Only exists in MetaMask as of 2022/04/03 */
365
+ _state?: {
366
+ accounts?: string[];
367
+ initialized?: boolean;
368
+ isConnected?: boolean;
369
+ isPermanentlyDisconnected?: boolean;
370
+ isUnlocked?: boolean;
371
+ } | undefined;
372
+ }>;
373
+ type Window = {
374
+ coinbaseWalletExtension?: WindowProvider | undefined;
375
+ ethereum?: WindowProvider | undefined;
376
+ phantom?: {
377
+ ethereum: WindowProvider;
378
+ } | undefined;
379
+ };
380
+ export {};
381
+ //# sourceMappingURL=injected.d.ts.map
@@ -0,0 +1 @@
1
+ {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E,OAAO,CAAA;KACrB,GACD,SAAS,CAAA;CACd,CACJ,CAAA;AAED,KAAK,MAAM,GAAG;IACZ,uBAAuB,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;IACpD,QAAQ,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;IACrC,OAAO,CAAC,EAAE;QAAE,QAAQ,EAAE,cAAc,CAAA;KAAE,GAAG,SAAS,CAAA;CACnD,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { type EthereumProvider } from '@ledgerhq/connect-kit-loader';
2
+ import { type ProviderConnectInfo } from 'viem';
3
+ export type LedgerParameters = {
4
+ enableDebugLogs?: boolean | undefined;
5
+ optionalEvents?: string[] | undefined;
6
+ optionalMethods?: string[] | undefined;
7
+ projectId?: string | undefined;
8
+ requiredChains?: number[] | undefined;
9
+ requiredEvents?: string[] | undefined;
10
+ requiredMethods?: string[] | undefined;
11
+ };
12
+ export declare function ledger(parameters?: LedgerParameters): import("@wagmi/core").CreateConnectorFn<EthereumProvider, {
13
+ onConnect(connectInfo: ProviderConnectInfo): void;
14
+ onSessionDelete(data: {
15
+ topic: string;
16
+ }): void;
17
+ }, {}>;
18
+ //# sourceMappingURL=ledger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../src/ledger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,8BAA8B,CAAA;AAMrC,OAAO,EACL,KAAK,mBAAmB,EAMzB,MAAM,MAAM,CAAA;AAEb,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACrC,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IACrC,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IACtC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IACrC,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IACrC,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;CACvC,CAAA;AAED,wBAAgB,MAAM,CAAC,UAAU,GAAE,gBAAqB;2BAG7B,mBAAmB,GAAG,IAAI;0BAC3B;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;OAgLjD"}
@@ -0,0 +1,18 @@
1
+ import { SafeAppProvider } from '@safe-global/safe-apps-provider';
2
+ import { type Opts } from '@safe-global/safe-apps-sdk';
3
+ import type { Evaluate } from '@wagmi/core/internal';
4
+ export type SafeParameters = Evaluate<Opts & {
5
+ /**
6
+ * Connector automatically connects when used as Safe App.
7
+ *
8
+ * This flag simulates the disconnect behavior by keeping track of connection status in storage
9
+ * and only autoconnecting when previously connected by user action (e.g. explicitly choosing to connect).
10
+ *
11
+ * @default false
12
+ */
13
+ shimDisconnect?: boolean | undefined;
14
+ }>;
15
+ export declare function safe(parameters?: SafeParameters): import("@wagmi/core").CreateConnectorFn<SafeAppProvider, {}, {
16
+ 'safe.shimDisconnect': true;
17
+ }>;
18
+ //# sourceMappingURL=safe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../../src/safe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAE,KAAK,IAAI,EAA0B,MAAM,4BAA4B,CAAA;AAG9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAGpD,MAAM,MAAM,cAAc,GAAG,QAAQ,CACnC,IAAI,GAAG;IACL;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACrC,CACF,CAAA;AAED,wBAAgB,IAAI,CAAC,UAAU,GAAE,cAAmB;2BAGN,IAAI;GAyFjD"}
@@ -0,0 +1,2 @@
1
+ export declare const version = "4.0.0";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAA"}
@@ -0,0 +1,63 @@
1
+ import type { Evaluate, ExactPartial, Omit } from '@wagmi/core/internal';
2
+ import { EthereumProvider } from '@walletconnect/ethereum-provider';
3
+ import { type Address, type ProviderConnectInfo } from 'viem';
4
+ type EthereumProviderOptions = Parameters<typeof EthereumProvider['init']>[0];
5
+ export type WalletConnectParameters = Evaluate<{
6
+ /**
7
+ * If a new chain is added to a previously existing configured connector `chains`, this flag
8
+ * will determine if that chain should be considered as stale. A stale chain is a chain that
9
+ * WalletConnect has yet to establish a relationship with (ie. the user has not approved or
10
+ * rejected the chain).
11
+ *
12
+ * Preface: Whereas WalletConnect v1 supported dynamic chain switching, WalletConnect v2 requires
13
+ * the user to pre-approve a set of chains up-front. This comes with consequent UX nuances (see below) when
14
+ * a user tries to switch to a chain that they have not approved.
15
+ *
16
+ * This flag mainly affects the behavior when a wallet does not support dynamic chain authorization
17
+ * with WalletConnect v2.
18
+ *
19
+ * If `true` (default), the new chain will be treated as a stale chain. If the user
20
+ * has yet to establish a relationship (approved/rejected) with this chain in their WalletConnect
21
+ * session, the connector will disconnect upon the dapp auto-connecting, and the user will have to
22
+ * reconnect to the dapp (revalidate the chain) in order to approve the newly added chain.
23
+ * This is the default behavior to avoid an unexpected error upon switching chains which may
24
+ * be a confusing user experience (ie. the user will not know they have to reconnect
25
+ * unless the dapp handles these types of errors).
26
+ *
27
+ * If `false`, the new chain will be treated as a validated chain. This means that if the user
28
+ * has yet to establish a relationship with the chain in their WalletConnect session, wagmi will successfully
29
+ * auto-connect the user. This comes with the trade-off that the connector will throw an error
30
+ * when attempting to switch to the unapproved chain. This may be useful in cases where a dapp constantly
31
+ * modifies their configured chains, and they do not want to disconnect the user upon
32
+ * auto-connecting. If the user decides to switch to the unapproved chain, it is important that the
33
+ * dapp handles this error and prompts the user to reconnect to the dapp in order to approve
34
+ * the newly added chain.
35
+ *
36
+ * @default true
37
+ */
38
+ isNewChainsStale?: boolean;
39
+ } & Omit<EthereumProviderOptions, 'chains' | 'events' | 'optionalChains' | 'optionalEvents' | 'optionalMethods' | 'methods' | 'rpcMap' | 'showQrModal'> & ExactPartial<Pick<EthereumProviderOptions, 'showQrModal'>>>;
40
+ export declare function walletConnect(parameters: WalletConnectParameters): import("@wagmi/core").CreateConnectorFn<import("@walletconnect/ethereum-provider").default, {
41
+ connect(parameters?: {
42
+ chainId?: number;
43
+ pairingTopic?: string;
44
+ }): Promise<{
45
+ accounts: readonly Address[];
46
+ chainId: number;
47
+ }>;
48
+ getNamespaceChainsIds(): number[];
49
+ getNamespaceMethods(): ("wallet_switchEthereumChain" | "wallet_addEthereumChain")[];
50
+ getRequestedChainsIds(): Promise<number[]>;
51
+ isChainsStale(): Promise<boolean>;
52
+ onConnect(connectInfo: ProviderConnectInfo): void;
53
+ onDisplayUri(uri: string): void;
54
+ onSessionDelete(data: {
55
+ topic: string;
56
+ }): void;
57
+ setRequestedChainsIds(chains: number[]): void;
58
+ requestedChainsStorageKey: `${string}.requestedChains`;
59
+ }, {
60
+ [x: `${string}.requestedChains`]: number[];
61
+ }>;
62
+ export {};
63
+ //# sourceMappingURL=walletConnect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walletConnect.d.ts","sourceRoot":"","sources":["../../src/walletConnect.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,EACL,gBAAgB,EAGjB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,mBAAmB,EAMzB,MAAM,MAAM,CAAA;AAEb,KAAK,uBAAuB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE7E,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAC5C;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,IAAI,CACN,uBAAuB,EACrB,QAAQ,GACR,QAAQ,GACR,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,SAAS,GACT,QAAQ,GACR,aAAa,CAChB,GACC,YAAY,CAAC,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC,CAC7D,CAAA;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,uBAAuB;yBAQxC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,QAAQ;QACzE,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAA;QAC5B,OAAO,EAAE,MAAM,CAAA;KAChB,CAAC;6BACuB,MAAM,EAAE;;6BAER,QAAQ,MAAM,EAAE,CAAC;qBACzB,QAAQ,OAAO,CAAC;2BACV,mBAAmB,GAAG,IAAI;sBAC/B,MAAM,GAAG,IAAI;0BACT;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;kCAChB,MAAM,EAAE,GAAG,IAAI;+BAClB,GAAG,MAAM,kBAAkB;;;GA4SzD"}
package/package.json CHANGED
@@ -1,11 +1,36 @@
1
1
  {
2
2
  "name": "@wagmi/connectors",
3
3
  "description": "A collection of connectors for wagmi",
4
+ "version": "4.0.0",
4
5
  "license": "MIT",
5
- "version": "3.1.1",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/wagmi-dev/wagmi.git",
9
+ "directory": "packages/connectors"
10
+ },
11
+ "files": [
12
+ "dist/**",
13
+ "!dist/**/*.tsbuildinfo",
14
+ "src/**/*.ts",
15
+ "!src/**/*.test.ts",
16
+ "!src/**/*.test-d.ts"
17
+ ],
18
+ "sideEffects": false,
19
+ "type": "module",
20
+ "main": "./dist/esm/index.js",
21
+ "types": "./dist/types/index.d.ts",
22
+ "typings": "./dist/types/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/types/index.d.ts",
26
+ "default": "./dist/esm/index.js"
27
+ },
28
+ "./package.json": "./package.json"
29
+ },
6
30
  "peerDependencies": {
7
- "typescript": ">=5.0.4",
8
- "viem": ">=0.3.35"
31
+ "@wagmi/core": "^2",
32
+ "typescript": ">=5",
33
+ "viem": "*"
9
34
  },
10
35
  "peerDependenciesMeta": {
11
36
  "typescript": {
@@ -13,95 +38,28 @@
13
38
  }
14
39
  },
15
40
  "dependencies": {
16
- "@coinbase/wallet-sdk": "^3.6.6",
17
- "@ledgerhq/connect-kit-loader": "^1.1.0",
18
- "@safe-global/safe-apps-provider": "^0.17.1",
19
- "@safe-global/safe-apps-sdk": "^8.0.0",
20
- "@walletconnect/ethereum-provider": "2.10.0",
21
- "@walletconnect/utils": "2.10.0",
22
- "@walletconnect/legacy-provider": "^2.0.0",
23
- "@walletconnect/modal": "2.6.1",
24
- "abitype": "0.8.7",
25
- "eventemitter3": "^4.0.7"
41
+ "@coinbase/wallet-sdk": "3.8.0-beta.2",
42
+ "@ledgerhq/connect-kit-loader": "^1.1.2",
43
+ "@safe-global/safe-apps-provider": "^0.18.0",
44
+ "@safe-global/safe-apps-sdk": "^8.1.0",
45
+ "@walletconnect/ethereum-provider": "^2.10.0",
46
+ "@walletconnect/modal": "^2.6.2"
26
47
  },
27
48
  "devDependencies": {
28
- "viem": "^1.0.0"
29
- },
30
- "type": "module",
31
- "main": "dist/index.js",
32
- "types": "dist/index.d.ts",
33
- "exports": {
34
- ".": {
35
- "types": "./dist/index.d.ts",
36
- "default": "./dist/index.js"
37
- },
38
- "./coinbaseWallet": {
39
- "types": "./dist/coinbaseWallet.d.ts",
40
- "default": "./dist/coinbaseWallet.js"
41
- },
42
- "./injected": {
43
- "types": "./dist/injected.d.ts",
44
- "default": "./dist/injected.js"
45
- },
46
- "./ledger": {
47
- "types": "./dist/ledger.d.ts",
48
- "default": "./dist/ledger.js"
49
- },
50
- "./metaMask": {
51
- "types": "./dist/metaMask.d.ts",
52
- "default": "./dist/metaMask.js"
53
- },
54
- "./mock": {
55
- "types": "./dist/mock/index.d.ts",
56
- "default": "./dist/mock/index.js"
57
- },
58
- "./safe": {
59
- "types": "./dist/safe.d.ts",
60
- "default": "./dist/safe.js"
61
- },
62
- "./walletConnect": {
63
- "types": "./dist/walletConnect.d.ts",
64
- "default": "./dist/walletConnect.js"
65
- },
66
- "./walletConnectLegacy": {
67
- "types": "./dist/walletConnectLegacy.d.ts",
68
- "default": "./dist/walletConnectLegacy.js"
69
- },
70
- "./package.json": "./package.json"
49
+ "lokijs": "^1.5.12",
50
+ "msw": "^1.3.0",
51
+ "@wagmi/core": "2.0.0"
71
52
  },
72
- "files": [
73
- "/coinbaseWallet",
74
- "/injected",
75
- "/ledger",
76
- "/metaMask",
77
- "/mock",
78
- "/safe",
79
- "/walletConnect",
80
- "/walletConnectLegacy",
81
- "/dist"
82
- ],
83
- "sideEffects": false,
84
53
  "contributors": [
85
- "awkweb.eth <t@wagmi.sh>",
86
- "jxom.eth <j@wagmi.sh>"
54
+ "jxom.eth <j@wagmi.sh>",
55
+ "awkweb.eth <t@wagmi.sh>"
87
56
  ],
88
- "homepage": "https://wagmi.sh",
89
- "ethereum": "wagmi-dev.eth",
90
57
  "funding": [
91
- {
92
- "type": "gitcoin",
93
- "url": "https://wagmi.sh/gitcoin"
94
- },
95
58
  {
96
59
  "type": "github",
97
60
  "url": "https://github.com/sponsors/wagmi-dev"
98
61
  }
99
62
  ],
100
- "repository": {
101
- "type": "git",
102
- "url": "https://github.com/wagmi-dev/references.git",
103
- "directory": "packages/connectors"
104
- },
105
63
  "keywords": [
106
64
  "react",
107
65
  "hooks",
@@ -113,7 +71,10 @@
113
71
  "abi"
114
72
  ],
115
73
  "scripts": {
116
- "build": "tsup",
117
- "dev": "DEV=true tsup"
74
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
75
+ "build": "pnpm run clean && pnpm run build:esm+types",
76
+ "build:esm+types": "tsc --project tsconfig.build.json --module es2020 --outDir ./dist/esm --declaration --declarationMap --declarationDir ./dist/types",
77
+ "test:build": "publint --strict",
78
+ "typecheck": "tsc --noEmit"
118
79
  }
119
80
  }