ethers.js/docs/v5/api/providers/README.md

85 lines
2.3 KiB
Markdown
Raw Normal View History

2020-06-10 06:56:58 +03:00
-----
2020-07-03 08:54:56 +03:00
Documentation: [html](https://docs.ethers.io/)
2020-06-10 06:56:58 +03:00
-----
Providers
=========
Default Provider
----------------
#### *ethers* . **getDefaultProvider**( [ network , [ options ] ] ) => *[Provider](/v5/api/providers/provider/)*
2020-11-23 07:07:13 +03:00
Returns a new Provider, backed by multiple services, connected to *network*. If no *network* is provided, **homestead** (i.e. mainnet) is used.
2020-06-10 06:56:58 +03:00
2020-09-08 08:12:15 +03:00
The *network* may also be a URL to connect to, such as `http://localhost:8545` or `wss://example.com`.
2020-06-10 06:56:58 +03:00
The *options* is an object, with the following properties:
Option Properties
#### Note: API Keys
2020-11-23 07:07:13 +03:00
It is highly recommended for production services to acquire and specify an API Key for each service.
2020-06-10 06:56:58 +03:00
2020-07-03 08:54:56 +03:00
The default API Keys used by ethers are shared across all users, so services may throttle all services that are using the default API Keys during periods of load without realizing it.
2020-06-10 06:56:58 +03:00
2020-07-03 08:54:56 +03:00
Many services also have monitoring and usage metrics, which are only available if an API Key is specified. This allows tracking how many requests are being sent and which methods are being used the most.
2020-06-10 06:56:58 +03:00
2020-07-03 08:54:56 +03:00
Some services also provide additional paid features, which are only available when specifying an API Key.
2020-06-10 06:56:58 +03:00
2020-09-08 08:12:15 +03:00
Networks
--------
### Custom ENS Contract
```
const network = {
name: "dev",
chianId: 1337,
ensAddress: customEnsAddress
};
```
2020-06-10 06:56:58 +03:00
Provider Documentation
----------------------
* [Provider](provider)
* [Accounts Methods](provider)
* [Blocks Methods](provider)
* [Ethereum Naming Service (ENS) Methods](provider)
* [Logs Methods](provider)
* [Network Status Methods](provider)
* [Transactions Methods](provider)
* [Event Emitter Methods](provider)
* [Inspection Methods](provider)
* [JsonRpcProvider](jsonrpc-provider)
* [JsonRpcSigner](jsonrpc-provider)
* [JsonRpcUncheckedSigner](jsonrpc-provider)
* [Node-Specific Methods](jsonrpc-provider)
* [API Providers](api-providers)
* [EtherscanProvider](api-providers)
* [InfuraProvider](api-providers)
* [AlchemyProvider](api-providers)
* [CloudflareProvider](api-providers)
* [Other Providers](other)
* [FallbackProvider](other)
* [IpcProvider](other)
* [UrlJsonRpcProvider](other)
* [Web3Provider](other)
2020-07-03 08:54:56 +03:00
* [WebSocketProvider](other)
2020-06-10 06:56:58 +03:00
* [Types](types)
* [BlockTag](types)
2020-09-08 08:12:15 +03:00
* [Networkish](types)
2020-06-10 06:56:58 +03:00
* [Network](types)
* [Block](types)
* [Events and Logs](types)
* [Transactions](types)