UNPKG

1.89 kBTypeScriptView Raw
1import type { AbstractProvider } from "./abstract-provider.js";
2import type { Networkish } from "./network.js";
3import { WebSocketLike } from "./provider-websocket.js";
4/**
5 * Returns a default provider for %%network%%.
6 *
7 * If %%network%% is a [[WebSocketLike]] or string that begins with
8 * ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed
9 * by that WebSocket or URL.
10 *
11 * If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``,
12 * a [[JsonRpcProvider]] is returned connected to that URL.
13 *
14 * Otherwise, a default provider is created backed by well-known public
15 * Web3 backends (such as [[link-infura]]) using community-provided API
16 * keys.
17 *
18 * The %%options%% allows specifying custom API keys per backend (setting
19 * an API key to ``"-"`` will omit that provider) and ``options.exclusive``
20 * can be set to either a backend name or and array of backend names, which
21 * will whitelist **only** those backends.
22 *
23 * Current backend strings supported are:
24 * - ``"alchemy"``
25 * - ``"ankr"``
26 * - ``"cloudflare"``
27 * - ``"chainstack"``
28 * - ``"etherscan"``
29 * - ``"infura"``
30 * - ``"publicPolygon"``
31 * - ``"quicknode"``
32 *
33 * @example:
34 * // Connect to a local Geth node
35 * provider = getDefaultProvider("http://localhost:8545/");
36 *
37 * // Connect to Ethereum mainnet with any current and future
38 * // third-party services available
39 * provider = getDefaultProvider("mainnet");
40 *
41 * // Connect to Polygon, but only allow Etherscan and
42 * // INFURA and use "MY_API_KEY" in calls to Etherscan.
43 * provider = getDefaultProvider("matic", {
44 * etherscan: "MY_API_KEY",
45 * exclusive: [ "etherscan", "infura" ]
46 * });
47 */
48export declare function getDefaultProvider(network?: string | Networkish | WebSocketLike, options?: any): AbstractProvider;
49//# sourceMappingURL=default-provider.d.ts.map
\No newline at end of file