Comment on page
Providers
Deprecation of Hethers.js by October 20, 2023
As we continue to evolve and improve the Hedera ecosystem, we are committed to ensuring that our developer tools and resources remain easy to use and up-to-date. With this goal in mind, the Hethers.js library will be deprecated by October 20, 2023.
A Provider is an abstraction of a connection to the Hedera Hashgraph network, providing a concise, consistent interface to standard Hedera Hashgraph consensus node and mirror nodes functionality.
The hethers.js library provides several options which should cover the vast majority of use-cases but also includes the necessary functions and classes for sub-classing if a more custom configuration is necessary.
The default provider is the safest, easiest way to begin developing on Hedera Hashgraph, and it is also robust enough for use in production. It creates a
DefaultHederaProvider
connection to a Hedera backend service.Returns a new Provider, backed by multiple services (Hedera Consensus Nodes and Mirror Nodes), connected to the network. If no network is provided, mainnet is used.
The network may also be a URL to connect to, such as
http://localhost:50211
It is highly recommended for production services to acquire unthrottled access to Mirror Node.
The provider class uses
axios
under the hood. Users can override the headers through the provider's options
parameter.const options = { headers: {testHeader: '123'} };
hethers.providers.getDefaultProvider('testnet', options);
Note: Only the
headers
part will be propagated to AxiosThere are several official common Hedera networks (as well as custom networks and other compatible projects).
Any API that accepts a Networkish can be passed a common name (such as
"mainnet"
or "previewnet"
) or chain ID to use that network definition or may specify custom parameters.// By Chain Name
getNetwork("mainnet");
// {
// chainId: 290,
// ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
// name: 'mainnet'
// }
// By Chain ID
getNetwork(290);
// {
// chainId: 290,
// ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
// name: 'mainnet'
// }
Last modified 1mo ago