@wagmi/core 0.7.8 → 0.8.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 (36) hide show
  1. package/dist/{base-a32d0b91.d.ts → base-a82112a9.d.ts} +1 -1
  2. package/dist/chains.d.ts +1 -3
  3. package/dist/chains.js +13 -1
  4. package/dist/chunk-6KG5TOAU.js +42 -0
  5. package/dist/{chunk-HEIMP7HQ.js → chunk-F4A7FMUQ.js} +1166 -1126
  6. package/dist/chunk-J6DUE3KA.js +0 -0
  7. package/dist/chunk-VCRGL4ZG.js +191 -0
  8. package/dist/connectors/coinbaseWallet.d.ts +2 -2
  9. package/dist/connectors/coinbaseWallet.js +8 -5
  10. package/dist/connectors/metaMask.d.ts +4 -3
  11. package/dist/connectors/metaMask.js +2 -2
  12. package/dist/connectors/mock/index.d.ts +3 -2
  13. package/dist/connectors/mock/index.js +6 -185
  14. package/dist/connectors/walletConnect.d.ts +2 -2
  15. package/dist/connectors/walletConnect.js +8 -4
  16. package/dist/{index-58cffc47.d.ts → index-971cda79.d.ts} +2 -103
  17. package/dist/index.d.ts +51 -46
  18. package/dist/index.js +9 -20
  19. package/dist/{injected-82510902.d.ts → injected-610c34b6.d.ts} +3 -2
  20. package/dist/{internal.d.ts → internal/index.d.ts} +3 -2
  21. package/dist/internal/index.js +8 -0
  22. package/dist/internal/test.d.ts +12 -0
  23. package/dist/internal/test.js +142 -0
  24. package/dist/providers/alchemy.d.ts +2 -1
  25. package/dist/providers/alchemy.js +2 -2
  26. package/dist/providers/infura.d.ts +2 -1
  27. package/dist/providers/infura.js +2 -2
  28. package/dist/providers/jsonRpc.d.ts +2 -1
  29. package/dist/providers/jsonRpc.js +2 -2
  30. package/dist/providers/public.d.ts +2 -1
  31. package/dist/providers/public.js +2 -2
  32. package/internal/package.json +1 -1
  33. package/internal/test/package.json +4 -0
  34. package/package.json +12 -7
  35. package/dist/chunk-4DNFSL2K.js +0 -376
  36. package/dist/internal.js +0 -8
package/dist/index.d.ts CHANGED
@@ -1,16 +1,34 @@
1
- import { P as Provider, W as WebSocketProvider, C as Chain, U as Unit, S as Signer, H as Hash, a as ChainProviderFn, b as ProviderWithFallbackConfig } from './index-58cffc47.js';
2
- export { C as Chain, a as ChainProviderFn, E as Ethereum, F as FallbackProviderConfig, H as Hash, P as Provider, b as ProviderWithFallbackConfig, S as Signer, U as Unit, W as WebSocketProvider, c as alchemyRpcUrls, d as allChains, e as chain, f as chainId, g as defaultChains, h as defaultL2Chains, i as etherscanBlockExplorers, j as infuraRpcUrls, p as publicRpcUrls, u as units } from './index-58cffc47.js';
1
+ import * as _wagmi_chains from '@wagmi/chains';
2
+ import { Chain } from '@wagmi/chains';
3
+ export { Chain, goerli, mainnet } from '@wagmi/chains';
3
4
  import { Mutate, StoreApi } from 'zustand/vanilla';
4
- import { C as Connector, a as ConnectorData } from './base-a32d0b91.js';
5
- export { C as Connector, a as ConnectorData, b as ConnectorEvents } from './base-a32d0b91.js';
5
+ import { P as Provider, W as WebSocketProvider, U as Unit, S as Signer, H as Hash, C as ChainProviderFn, a as ProviderWithFallbackConfig } from './index-971cda79.js';
6
+ export { C as ChainProviderFn, E as Ethereum, F as FallbackProviderConfig, H as Hash, P as Provider, a as ProviderWithFallbackConfig, S as Signer, U as Unit, W as WebSocketProvider, u as units } from './index-971cda79.js';
7
+ import { C as Connector, a as ConnectorData } from './base-a82112a9.js';
8
+ export { C as Connector, a as ConnectorData, b as ConnectorEvents } from './base-a82112a9.js';
6
9
  import * as abitype from 'abitype';
7
10
  import { Address, ResolvedConfig, TypedDataDomain, Narrow, TypedData, TypedDataToPrimitiveTypes, Abi, ExtractAbiFunction, ExtractAbiEventNames, AbiParametersToPrimitiveTypes, ExtractAbiEvent, AbiFunction, AbiParameter, AbiParameterToPrimitiveType, AbiEvent, ExtractAbiFunctionNames } from 'abitype';
8
11
  export { Address } from 'abitype';
9
12
  import { PopulatedTransaction, Signer as Signer$1, providers, Contract as Contract$1, ethers, ContractInterface } from 'ethers';
10
13
  import { O as Options$2, D as DefaultOptions, G as GetConfig$1, a as GetOverridesForAbiStateMutability, U as UnionToIntersection, C as CountOccurrences, A as AbiItemName, I as IsUnknown, E as Event, b as ContractsConfig, c as ContractsResult, d as GetReturnType, e as Or, f as IsNever, N as NotEqual } from './contracts-3880ee54.js';
11
- export { I as InjectedConnector, a as InjectedConnectorOptions } from './injected-82510902.js';
14
+ import { TransactionResponse } from '@ethersproject/providers';
15
+ export { I as InjectedConnector, a as InjectedConnectorOptions } from './injected-610c34b6.js';
12
16
  import 'eventemitter3';
13
17
 
18
+ type BaseStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
19
+ type ClientStorage = {
20
+ getItem<T>(key: string, defaultState?: T | null): T | null;
21
+ setItem<T>(key: string, value: T | null): void;
22
+ removeItem(key: string): void;
23
+ };
24
+ declare const noopStorage: BaseStorage;
25
+ declare function createStorage({ deserialize, key: prefix, serialize, storage, }: {
26
+ deserialize?: <T>(value: string) => T;
27
+ key?: string;
28
+ serialize?: <T>(value: T) => string;
29
+ storage: BaseStorage;
30
+ }): ClientStorage;
31
+
14
32
  /**
15
33
  * [ERC-20 Token Standard](https://ethereum.org/en/developers/docs/standards/tokens/erc-20)
16
34
  */
@@ -772,20 +790,6 @@ declare const erc4626ABI: readonly [{
772
790
  readonly type: "function";
773
791
  }];
774
792
 
775
- type BaseStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
776
- type ClientStorage = {
777
- getItem<T>(key: string, defaultState?: T | null): T | null;
778
- setItem<T>(key: string, value: T | null): void;
779
- removeItem(key: string): void;
780
- };
781
- declare const noopStorage: BaseStorage;
782
- declare function createStorage({ deserialize, key: prefix, serialize, storage, }: {
783
- deserialize?: <T>(value: string) => T;
784
- key?: string;
785
- serialize?: <T>(value: T) => string;
786
- storage: BaseStorage;
787
- }): ClientStorage;
788
-
789
793
  type ClientConfig<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider> = {
790
794
  /** Enables reconnecting to last used connector on init */
791
795
  autoConnect?: boolean;
@@ -840,7 +844,7 @@ declare class Client<TProvider extends Provider = Provider, TWebSocketProvider e
840
844
  ]>;
841
845
  webSocketProviders: Map<number, TWebSocketProvider | undefined>;
842
846
  constructor({ autoConnect, connectors, provider, storage, logger, webSocketProvider, }: ClientConfig<TProvider, TWebSocketProvider>);
843
- get chains(): Chain[] | undefined;
847
+ get chains(): _wagmi_chains.Chain[] | undefined;
844
848
  get connectors(): Connector<any, any, any>[];
845
849
  get connector(): Connector<any, any, any> | undefined;
846
850
  get data(): Data$1<TProvider> | undefined;
@@ -871,6 +875,7 @@ declare class Client<TProvider extends Provider = Provider, TWebSocketProvider e
871
875
  setLastUsedConnector(lastUsedConnector?: string | null): void;
872
876
  }
873
877
  declare function createClient<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider>(config: ClientConfig<TProvider, TWebSocketProvider>): Client<TProvider, TWebSocketProvider>;
878
+ declare function getClient<TProvider extends Provider = Provider, TWebSocketProvider extends WebSocketProvider = WebSocketProvider>(): Client<TProvider, TWebSocketProvider>;
874
879
 
875
880
  type ConnectArgs = {
876
881
  /** Chain ID to connect to */
@@ -1406,13 +1411,13 @@ type WaitForTransactionArgs = {
1406
1411
  */
1407
1412
  confirmations?: number;
1408
1413
  /** Transaction hash to monitor */
1409
- hash?: Hash;
1414
+ hash: Hash;
1415
+ /** Callback to invoke when the transaction has been sped up. */
1416
+ onSpeedUp?: (transaction: TransactionResponse) => void;
1410
1417
  timeout?: number;
1411
- /** Function resolving to transaction receipt */
1412
- wait?: providers.TransactionResponse['wait'];
1413
1418
  };
1414
1419
  type WaitForTransactionResult = providers.TransactionReceipt;
1415
- declare function waitForTransaction({ chainId, confirmations, hash, timeout, wait: wait_, }: WaitForTransactionArgs): Promise<WaitForTransactionResult>;
1420
+ declare function waitForTransaction({ chainId, confirmations, hash, onSpeedUp, timeout, }: WaitForTransactionArgs): Promise<WaitForTransactionResult>;
1416
1421
 
1417
1422
  type Options = Options$2 & {
1418
1423
  isRequestOptional?: boolean;
@@ -1570,18 +1575,18 @@ declare function watchWebSocketProvider<TWebSocketProvider extends WebSocketProv
1570
1575
  * @see https://eips.ethereum.org/EIPS/eip-1474
1571
1576
  */
1572
1577
  declare class RpcError<T = undefined> extends Error {
1578
+ readonly cause: unknown;
1573
1579
  readonly code: number;
1574
1580
  readonly data?: T;
1575
- readonly internal?: unknown;
1576
1581
  constructor(
1577
- /** Number error code */
1578
- code: number,
1579
1582
  /** Human-readable string */
1580
- message: string,
1581
- /** Low-level error */
1582
- internal?: unknown,
1583
- /** Other useful information about error */
1584
- data?: T);
1583
+ message: string, options: {
1584
+ cause?: unknown;
1585
+ /** Number error code */
1586
+ code: number;
1587
+ /** Other useful information about error */
1588
+ data?: T;
1589
+ });
1585
1590
  }
1586
1591
  /**
1587
1592
  * Error subclass implementing Ethereum Provider errors per EIP-1193.
@@ -1593,17 +1598,17 @@ declare class ProviderRpcError<T = undefined> extends RpcError<T> {
1593
1598
  * `code` must be an integer in the 1000 <= 4999 range.
1594
1599
  */
1595
1600
  constructor(
1596
- /**
1597
- * Number error code
1598
- * @see https://eips.ethereum.org/EIPS/eip-1193#error-standards
1599
- */
1600
- code: 4001 | 4100 | 4200 | 4900 | 4901 | 4902,
1601
1601
  /** Human-readable string */
1602
- message: string,
1603
- /** Low-level error */
1604
- internal?: unknown,
1605
- /** Other useful information about error */
1606
- data?: T);
1602
+ message: string, options: {
1603
+ cause?: unknown;
1604
+ /**
1605
+ * Number error code
1606
+ * @see https://eips.ethereum.org/EIPS/eip-1193#error-standards
1607
+ */
1608
+ code: 4001 | 4100 | 4200 | 4900 | 4901 | 4902;
1609
+ /** Other useful information about error */
1610
+ data?: T;
1611
+ });
1607
1612
  }
1608
1613
  declare class AddChainError extends Error {
1609
1614
  name: string;
@@ -1681,11 +1686,11 @@ declare class ProviderChainsNotFound extends Error {
1681
1686
  }
1682
1687
  declare class ResourceUnavailableError extends RpcError {
1683
1688
  name: string;
1684
- constructor(error: unknown);
1689
+ constructor(cause: unknown);
1685
1690
  }
1686
1691
  declare class SwitchChainError extends ProviderRpcError {
1687
1692
  name: string;
1688
- constructor(error: unknown);
1693
+ constructor(cause: unknown);
1689
1694
  }
1690
1695
  declare class SwitchChainNotSupportedError extends Error {
1691
1696
  name: string;
@@ -1695,7 +1700,7 @@ declare class SwitchChainNotSupportedError extends Error {
1695
1700
  }
1696
1701
  declare class UserRejectedRequestError extends ProviderRpcError {
1697
1702
  name: string;
1698
- constructor(error: unknown);
1703
+ constructor(cause: unknown);
1699
1704
  }
1700
1705
 
1701
1706
  type ConfigureChainsConfig = {
@@ -1758,4 +1763,4 @@ type CircularReplacer = (key: string, value: any, referenceKey: string) => any;
1758
1763
  */
1759
1764
  declare function serialize(value: any, replacer?: StandardReplacer | null | undefined, indent?: number | null | undefined, circularReplacer?: CircularReplacer | null | undefined): string;
1760
1765
 
1761
- export { AddChainError, ChainDoesNotSupportMulticallError, ChainMismatchError, ChainNotConfiguredError, Client, ClientConfig, ConfigureChainsConfig, ConnectArgs, ConnectResult, ConnectorAlreadyConnectedError, ConnectorNotFoundError, ContractMethodDoesNotExistError, ContractMethodNoResultError, ContractMethodRevertedError, ContractResultDecodeError, FetchBalanceArgs, FetchBalanceResult, FetchBlockNumberArgs, FetchBlockNumberResult, FetchEnsAddressArgs, FetchEnsAddressResult, FetchEnsAvatarArgs, FetchEnsAvatarResult, FetchEnsNameArgs, FetchEnsNameResult, FetchEnsResolverArgs, FetchEnsResolverResult, FetchFeeDataArgs, FetchFeeDataResult, FetchSignerArgs, FetchSignerResult, FetchTokenArgs, FetchTokenResult, FetchTransactionArgs, FetchTransactionResult, GetAccountResult, GetContractArgs, GetContractResult, GetNetworkResult, GetProviderArgs, GetProviderResult, GetWebSocketProviderArgs, GetWebSocketProviderResult, MulticallConfig, MulticallResult, PrepareSendTransactionArgs, PrepareSendTransactionResult, PrepareWriteContractConfig, PrepareWriteContractResult, ProviderChainsNotFound, ProviderRpcError, ReadContractConfig, ReadContractResult, ReadContractsConfig, ReadContractsResult, ResourceUnavailableError, RpcError, SendTransactionArgs, SendTransactionPreparedRequest, SendTransactionResult, SendTransactionUnpreparedRequest, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, ClientStorage as Storage, SwitchChainError, SwitchChainNotSupportedError, SwitchNetworkArgs, SwitchNetworkResult, UserRejectedRequestError, WaitForTransactionArgs, WaitForTransactionResult, WatchAccountCallback, WatchBlockNumberArgs, WatchBlockNumberCallback, WatchMulticallCallback, WatchMulticallConfig, WatchNetworkCallback, WatchProviderCallback, WatchReadContractCallback, WatchReadContractConfig, WatchReadContractsCallback, WatchReadContractsConfig, WatchSignerCallback, WatchWebSocketProviderCallback, WriteContractArgs, WriteContractPreparedArgs, WriteContractResult, WriteContractUnpreparedArgs, configureChains, connect, createClient, createStorage, deepEqual, deserialize, disconnect, erc20ABI, erc4626ABI, erc721ABI, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, fetchTransaction, getAccount, getContract, getNetwork, getProvider, getWebSocketProvider, minimizeContractInterface, multicall, noopStorage, normalizeChainId, parseContractResult, prepareSendTransaction, prepareWriteContract, readContract, readContracts, sendTransaction, serialize, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchMulticall, watchNetwork, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract };
1766
+ export { AddChainError, ChainDoesNotSupportMulticallError, ChainMismatchError, ChainNotConfiguredError, Client, ClientConfig, ConfigureChainsConfig, ConnectArgs, ConnectResult, ConnectorAlreadyConnectedError, ConnectorNotFoundError, ContractMethodDoesNotExistError, ContractMethodNoResultError, ContractMethodRevertedError, ContractResultDecodeError, FetchBalanceArgs, FetchBalanceResult, FetchBlockNumberArgs, FetchBlockNumberResult, FetchEnsAddressArgs, FetchEnsAddressResult, FetchEnsAvatarArgs, FetchEnsAvatarResult, FetchEnsNameArgs, FetchEnsNameResult, FetchEnsResolverArgs, FetchEnsResolverResult, FetchFeeDataArgs, FetchFeeDataResult, FetchSignerArgs, FetchSignerResult, FetchTokenArgs, FetchTokenResult, FetchTransactionArgs, FetchTransactionResult, GetAccountResult, GetContractArgs, GetContractResult, GetNetworkResult, GetProviderArgs, GetProviderResult, GetWebSocketProviderArgs, GetWebSocketProviderResult, MulticallConfig, MulticallResult, PrepareSendTransactionArgs, PrepareSendTransactionResult, PrepareWriteContractConfig, PrepareWriteContractResult, ProviderChainsNotFound, ProviderRpcError, ReadContractConfig, ReadContractResult, ReadContractsConfig, ReadContractsResult, ResourceUnavailableError, RpcError, SendTransactionArgs, SendTransactionPreparedRequest, SendTransactionResult, SendTransactionUnpreparedRequest, SignMessageArgs, SignMessageResult, SignTypedDataArgs, SignTypedDataResult, ClientStorage as Storage, SwitchChainError, SwitchChainNotSupportedError, SwitchNetworkArgs, SwitchNetworkResult, UserRejectedRequestError, WaitForTransactionArgs, WaitForTransactionResult, WatchAccountCallback, WatchBlockNumberArgs, WatchBlockNumberCallback, WatchMulticallCallback, WatchMulticallConfig, WatchNetworkCallback, WatchProviderCallback, WatchReadContractCallback, WatchReadContractConfig, WatchReadContractsCallback, WatchReadContractsConfig, WatchSignerCallback, WatchWebSocketProviderCallback, WriteContractArgs, WriteContractPreparedArgs, WriteContractResult, WriteContractUnpreparedArgs, configureChains, connect, createClient, createStorage, deepEqual, deserialize, disconnect, erc20ABI, erc4626ABI, erc721ABI, fetchBalance, fetchBlockNumber, fetchEnsAddress, fetchEnsAvatar, fetchEnsName, fetchEnsResolver, fetchFeeData, fetchSigner, fetchToken, fetchTransaction, getAccount, getClient, getContract, getNetwork, getProvider, getWebSocketProvider, minimizeContractInterface, multicall, noopStorage, normalizeChainId, parseContractResult, prepareSendTransaction, prepareWriteContract, readContract, readContracts, sendTransaction, serialize, signMessage, signTypedData, switchNetwork, waitForTransaction, watchAccount, watchBlockNumber, watchContractEvent, watchMulticall, watchNetwork, watchProvider, watchReadContract, watchReadContracts, watchSigner, watchWebSocketProvider, writeContract };
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "./chunk-J6DUE3KA.js";
1
2
  import {
2
3
  AddChainError,
3
4
  ChainDoesNotSupportMulticallError,
@@ -40,6 +41,7 @@ import {
40
41
  fetchToken,
41
42
  fetchTransaction,
42
43
  getAccount,
44
+ getClient,
43
45
  getContract,
44
46
  getNetwork,
45
47
  getProvider,
@@ -71,18 +73,11 @@ import {
71
73
  watchSigner,
72
74
  watchWebSocketProvider,
73
75
  writeContract
74
- } from "./chunk-HEIMP7HQ.js";
76
+ } from "./chunk-F4A7FMUQ.js";
75
77
  import {
76
- alchemyRpcUrls,
77
- allChains,
78
- chain,
79
- chainId,
80
- defaultChains,
81
- defaultL2Chains,
82
- etherscanBlockExplorers,
83
- infuraRpcUrls,
84
- publicRpcUrls
85
- } from "./chunk-4DNFSL2K.js";
78
+ goerli,
79
+ mainnet
80
+ } from "./chunk-6KG5TOAU.js";
86
81
  import "./chunk-MQXBDTVK.js";
87
82
  export {
88
83
  AddChainError,
@@ -105,23 +100,16 @@ export {
105
100
  SwitchChainError,
106
101
  SwitchChainNotSupportedError,
107
102
  UserRejectedRequestError,
108
- alchemyRpcUrls,
109
- allChains,
110
- chain,
111
- chainId,
112
103
  configureChains,
113
104
  connect,
114
105
  createClient,
115
106
  createStorage,
116
107
  deepEqual,
117
- defaultChains,
118
- defaultL2Chains,
119
108
  deserialize,
120
109
  disconnect,
121
110
  erc20ABI,
122
111
  erc4626ABI,
123
112
  erc721ABI,
124
- etherscanBlockExplorers,
125
113
  fetchBalance,
126
114
  fetchBlockNumber,
127
115
  fetchEnsAddress,
@@ -133,11 +121,13 @@ export {
133
121
  fetchToken,
134
122
  fetchTransaction,
135
123
  getAccount,
124
+ getClient,
136
125
  getContract,
137
126
  getNetwork,
138
127
  getProvider,
139
128
  getWebSocketProvider,
140
- infuraRpcUrls,
129
+ goerli,
130
+ mainnet,
141
131
  minimizeContractInterface,
142
132
  multicall,
143
133
  noopStorage,
@@ -145,7 +135,6 @@ export {
145
135
  parseContractResult,
146
136
  prepareSendTransaction,
147
137
  prepareWriteContract,
148
- publicRpcUrls,
149
138
  readContract,
150
139
  readContracts,
151
140
  sendTransaction,
@@ -1,7 +1,8 @@
1
- import { C as Chain, E as Ethereum } from './index-58cffc47.js';
1
+ import { Chain } from '@wagmi/chains';
2
2
  import { Address } from 'abitype';
3
3
  import { providers } from 'ethers';
4
- import { C as Connector } from './base-a32d0b91.js';
4
+ import { C as Connector } from './base-a82112a9.js';
5
+ import { E as Ethereum } from './index-971cda79.js';
5
6
 
6
7
  type InjectedConnectorOptions = {
7
8
  /** Name of connector */
@@ -1,7 +1,8 @@
1
- import './index-58cffc47.js';
2
- export { g as AbiParameter, h as ContractConfig, b as ContractsConfig, c as ContractsResult, E as Event, i as GetArgs, G as GetConfig, d as GetReturnType, f as IsNever, N as NotEqual, j as Optional, e as Or } from './contracts-3880ee54.js';
1
+ export { g as AbiParameter, h as ContractConfig, b as ContractsConfig, c as ContractsResult, E as Event, i as GetArgs, G as GetConfig, d as GetReturnType, f as IsNever, N as NotEqual, j as Optional, e as Or } from '../contracts-3880ee54.js';
2
+ import '../index-971cda79.js';
3
3
  import 'abitype';
4
4
  import 'ethers';
5
+ import '@wagmi/chains';
5
6
 
6
7
  declare function debounce(fn: (...args: any) => void, waitTime?: number): (...args: any) => void;
7
8
 
@@ -0,0 +1,8 @@
1
+ import {
2
+ debounce
3
+ } from "../chunk-F4A7FMUQ.js";
4
+ import "../chunk-6KG5TOAU.js";
5
+ import "../chunk-MQXBDTVK.js";
6
+ export {
7
+ debounce
8
+ };
@@ -0,0 +1,12 @@
1
+ import '../index-971cda79.js';
2
+ import { Wallet, providers } from 'ethers';
3
+ import { Chain } from '@wagmi/chains';
4
+ import 'abitype';
5
+
6
+ declare const testChains: Chain[];
7
+ declare class WalletSigner extends Wallet {
8
+ connectUnchecked(): providers.JsonRpcSigner;
9
+ }
10
+ declare function getSigners(): WalletSigner[];
11
+
12
+ export { getSigners, testChains };
@@ -0,0 +1,142 @@
1
+ import "../chunk-J6DUE3KA.js";
2
+ import "../chunk-VCRGL4ZG.js";
3
+ import "../chunk-F4A7FMUQ.js";
4
+ import {
5
+ foundry,
6
+ goerli,
7
+ mainnet,
8
+ optimism,
9
+ polygon
10
+ } from "../chunk-6KG5TOAU.js";
11
+ import "../chunk-MQXBDTVK.js";
12
+
13
+ // test/utils.ts
14
+ import { BigNumber, Wallet, providers } from "ethers";
15
+ function getNetwork(chain) {
16
+ return {
17
+ chainId: chain.id,
18
+ ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
19
+ name: chain.name
20
+ };
21
+ }
22
+ var foundryMainnet = {
23
+ ...mainnet,
24
+ rpcUrls: foundry.rpcUrls
25
+ };
26
+ var testChains = [foundryMainnet, mainnet, goerli, optimism, polygon];
27
+ var EthersProviderWrapper = class extends providers.StaticJsonRpcProvider {
28
+ toJSON() {
29
+ return `<Provider network={${this.network.chainId}} />`;
30
+ }
31
+ };
32
+ function getProvider({
33
+ chains = testChains,
34
+ chainId
35
+ } = {}) {
36
+ const chain = testChains.find((x) => x.id === chainId) ?? foundryMainnet;
37
+ const url = foundryMainnet.rpcUrls.default.http[0];
38
+ const provider = new EthersProviderWrapper(url, getNetwork(chain));
39
+ provider.pollingInterval = 1e3;
40
+ return Object.assign(provider, { chains });
41
+ }
42
+ var EthersWebSocketProviderWrapper = class extends providers.WebSocketProvider {
43
+ toJSON() {
44
+ return `<WebSocketProvider network={${this.network.chainId}} />`;
45
+ }
46
+ };
47
+ var accounts = [
48
+ {
49
+ privateKey: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
50
+ balance: "10000000000000000000000"
51
+ },
52
+ {
53
+ privateKey: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
54
+ balance: "10000000000000000000000"
55
+ },
56
+ {
57
+ privateKey: "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a",
58
+ balance: "10000000000000000000000"
59
+ },
60
+ {
61
+ privateKey: "0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6",
62
+ balance: "10000000000000000000000"
63
+ },
64
+ {
65
+ privateKey: "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
66
+ balance: "10000000000000000000000"
67
+ },
68
+ {
69
+ privateKey: "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
70
+ balance: "10000000000000000000000"
71
+ },
72
+ {
73
+ privateKey: "0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e",
74
+ balance: "10000000000000000000000"
75
+ },
76
+ {
77
+ privateKey: "0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356",
78
+ balance: "10000000000000000000000"
79
+ },
80
+ {
81
+ privateKey: "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97",
82
+ balance: "10000000000000000000000"
83
+ },
84
+ {
85
+ privateKey: "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6",
86
+ balance: "10000000000000000000000"
87
+ },
88
+ {
89
+ privateKey: "0xf214f2b2cd398c806f84e317254e0f0b801d0643303237d97a22a48e01628897",
90
+ balance: "10000000000000000000000"
91
+ },
92
+ {
93
+ privateKey: "0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82",
94
+ balance: "10000000000000000000000"
95
+ },
96
+ {
97
+ privateKey: "0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1",
98
+ balance: "10000000000000000000000"
99
+ },
100
+ {
101
+ privateKey: "0x47c99abed3324a2707c28affff1267e45918ec8c3f20b8aa892e8b065d2942dd",
102
+ balance: "10000000000000000000000"
103
+ },
104
+ {
105
+ privateKey: "0xc526ee95bf44d8fc405a158bb884d9d1238d99f0612e9f33d006bb0789009aaa",
106
+ balance: "10000000000000000000000"
107
+ },
108
+ {
109
+ privateKey: "0x8166f546bab6da521a8369cab06c5d2b9e46670292d85c875ee9ec20e84ffb61",
110
+ balance: "10000000000000000000000"
111
+ },
112
+ {
113
+ privateKey: "0xea6c44ac03bff858b476bba40716402b03e41b8e97e276d1baec7c37d42484a0",
114
+ balance: "10000000000000000000000"
115
+ },
116
+ {
117
+ privateKey: "0x689af8efa8c651a91ad287602527f3af2fe9f6501a7ac4b061667b5a93e037fd",
118
+ balance: "10000000000000000000000"
119
+ },
120
+ {
121
+ privateKey: "0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0",
122
+ balance: "10000000000000000000000"
123
+ },
124
+ {
125
+ privateKey: "0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e",
126
+ balance: "10000000000000000000000"
127
+ }
128
+ ];
129
+ var WalletSigner = class extends Wallet {
130
+ connectUnchecked() {
131
+ const uncheckedSigner = this.provider.getUncheckedSigner(this.address);
132
+ return uncheckedSigner;
133
+ }
134
+ };
135
+ function getSigners() {
136
+ const provider = getProvider();
137
+ return accounts.map((x) => new WalletSigner(x.privateKey, provider));
138
+ }
139
+ export {
140
+ getSigners,
141
+ testChains
142
+ };
@@ -1,6 +1,7 @@
1
1
  import { providers } from 'ethers';
2
- import { F as FallbackProviderConfig, a as ChainProviderFn } from '../index-58cffc47.js';
2
+ import { F as FallbackProviderConfig, C as ChainProviderFn } from '../index-971cda79.js';
3
3
  import 'abitype';
4
+ import '@wagmi/chains';
4
5
 
5
6
  type AlchemyProviderConfig = FallbackProviderConfig & {
6
7
  /** Your Alchemy API key from the [Alchemy Dashboard](https://dashboard.alchemyapi.io/). */
@@ -9,14 +9,14 @@ function alchemyProvider({
9
9
  weight
10
10
  }) {
11
11
  return function(chain) {
12
- if (!chain.rpcUrls.alchemy)
12
+ if (!chain.rpcUrls.alchemy?.http[0])
13
13
  return null;
14
14
  return {
15
15
  chain: {
16
16
  ...chain,
17
17
  rpcUrls: {
18
18
  ...chain.rpcUrls,
19
- default: `${chain.rpcUrls.alchemy}/${apiKey}`
19
+ default: { http: [`${chain.rpcUrls.alchemy?.http[0]}/${apiKey}`] }
20
20
  }
21
21
  },
22
22
  provider: () => {
@@ -1,6 +1,7 @@
1
1
  import { providers } from 'ethers';
2
- import { F as FallbackProviderConfig, a as ChainProviderFn } from '../index-58cffc47.js';
2
+ import { F as FallbackProviderConfig, C as ChainProviderFn } from '../index-971cda79.js';
3
3
  import 'abitype';
4
+ import '@wagmi/chains';
4
5
 
5
6
  type InfuraProviderConfig = FallbackProviderConfig & {
6
7
  /** Your Infura API key from the [Infura Dashboard](https://infura.io/login). */
@@ -9,14 +9,14 @@ function infuraProvider({
9
9
  weight
10
10
  }) {
11
11
  return function(chain) {
12
- if (!chain.rpcUrls.infura)
12
+ if (!chain.rpcUrls.infura?.http[0])
13
13
  return null;
14
14
  return {
15
15
  chain: {
16
16
  ...chain,
17
17
  rpcUrls: {
18
18
  ...chain.rpcUrls,
19
- default: `${chain.rpcUrls.infura}/${apiKey}`
19
+ default: { http: [`${chain.rpcUrls.infura?.http[0]}/${apiKey}`] }
20
20
  }
21
21
  },
22
22
  provider: () => {
@@ -1,5 +1,6 @@
1
1
  import { providers } from 'ethers';
2
- import { F as FallbackProviderConfig, C as Chain, a as ChainProviderFn } from '../index-58cffc47.js';
2
+ import { Chain } from '@wagmi/chains';
3
+ import { F as FallbackProviderConfig, C as ChainProviderFn } from '../index-971cda79.js';
3
4
  import 'abitype';
4
5
 
5
6
  type JsonRpcProviderConfig = FallbackProviderConfig & {
@@ -18,13 +18,13 @@ function jsonRpcProvider({
18
18
  ...chain,
19
19
  rpcUrls: {
20
20
  ...chain.rpcUrls,
21
- default: rpcConfig.http
21
+ default: { http: [rpcConfig.http] }
22
22
  }
23
23
  },
24
24
  provider: () => {
25
25
  const RpcProvider = static_ ? providers.StaticJsonRpcProvider : providers.JsonRpcProvider;
26
26
  const provider = new RpcProvider(rpcConfig.http, {
27
- ensAddress: chain.ens?.address,
27
+ ensAddress: chain.contracts?.ensRegistry?.address,
28
28
  chainId: chain.id,
29
29
  name: chain.network
30
30
  });
@@ -1,6 +1,7 @@
1
1
  import { providers } from 'ethers';
2
- import { F as FallbackProviderConfig, a as ChainProviderFn } from '../index-58cffc47.js';
2
+ import { F as FallbackProviderConfig, C as ChainProviderFn } from '../index-971cda79.js';
3
3
  import 'abitype';
4
+ import '@wagmi/chains';
4
5
 
5
6
  type PublicProviderConfig = FallbackProviderConfig;
6
7
  declare function publicProvider({ priority, stallTimeout, weight, }?: PublicProviderConfig): ChainProviderFn<providers.StaticJsonRpcProvider>;
@@ -8,13 +8,13 @@ function publicProvider({
8
8
  weight
9
9
  } = {}) {
10
10
  return function(chain) {
11
- if (!chain.rpcUrls.default)
11
+ if (!chain.rpcUrls.default.http[0])
12
12
  return null;
13
13
  return {
14
14
  chain,
15
15
  provider: () => {
16
16
  const provider = new providers.StaticJsonRpcProvider(
17
- chain.rpcUrls.default,
17
+ chain.rpcUrls.default.http[0],
18
18
  {
19
19
  chainId: chain.id,
20
20
  name: chain.network
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "type": "module",
3
- "main": "../dist/internal.js"
3
+ "main": "../dist/internal/index.js"
4
4
  }
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "module",
3
+ "main": "../../dist/internal/test.js"
4
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wagmi/core",
3
3
  "description": "Vanilla JS library for Ethereum",
4
4
  "license": "MIT",
5
- "version": "0.7.8",
5
+ "version": "0.8.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/wagmi-dev/wagmi.git",
@@ -35,10 +35,6 @@
35
35
  "types": "./dist/chains.d.ts",
36
36
  "default": "./dist/chains.js"
37
37
  },
38
- "./internal": {
39
- "types": "./dist/internal.d.ts",
40
- "default": "./dist/internal.js"
41
- },
42
38
  "./connectors/coinbaseWallet": {
43
39
  "types": "./dist/connectors/coinbaseWallet.d.ts",
44
40
  "default": "./dist/connectors/coinbaseWallet.js"
@@ -55,6 +51,14 @@
55
51
  "types": "./dist/connectors/walletConnect.d.ts",
56
52
  "default": "./dist/connectors/walletConnect.js"
57
53
  },
54
+ "./internal": {
55
+ "types": "./dist/internal/index.d.ts",
56
+ "default": "./dist/internal/index.js"
57
+ },
58
+ "./internal/test": {
59
+ "types": "./dist/internal/test.d.ts",
60
+ "default": "./dist/internal/test.js"
61
+ },
58
62
  "./providers/infura": {
59
63
  "types": "./dist/providers/infura.d.ts",
60
64
  "default": "./dist/providers/infura.js"
@@ -82,7 +86,7 @@
82
86
  "/dist"
83
87
  ],
84
88
  "peerDependencies": {
85
- "@coinbase/wallet-sdk": ">=3.3.0",
89
+ "@coinbase/wallet-sdk": ">=3.6.0",
86
90
  "@walletconnect/ethereum-provider": ">=1.7.5",
87
91
  "ethers": ">=5.5.1"
88
92
  },
@@ -95,12 +99,13 @@
95
99
  }
96
100
  },
97
101
  "dependencies": {
102
+ "@wagmi/chains": "^0.1.0",
98
103
  "abitype": "^0.1.8",
99
104
  "eventemitter3": "^4.0.7",
100
105
  "zustand": "^4.1.4"
101
106
  },
102
107
  "devDependencies": {
103
- "@coinbase/wallet-sdk": "^3.4.1",
108
+ "@coinbase/wallet-sdk": "^3.6.0",
104
109
  "@walletconnect/ethereum-provider": "^1.7.8",
105
110
  "typescript": "^4.9.3"
106
111
  },