ethers.js/lib.commonjs/providers/provider-ankr.d.ts
2023-02-02 22:04:33 -05:00

51 lines
1.8 KiB
TypeScript

/**
* [[link-ankr]] provides a third-party service for connecting to
* various blockchains over JSON-RPC.
*
* **Supported Networks**
*
* - Ethereum Mainnet (``mainnet``)
* - Goerli Testnet (``goerli``)
* - Polygon (``matic``)
* - Arbitrum (``arbitrum``)
*
* @_subsection: api/providers/thirdparty:Ankr [providers-ankr]
*/
import { FetchRequest } from "../utils/index.js";
import { AbstractProvider } from "./abstract-provider.js";
import { Network } from "./network.js";
import { JsonRpcProvider } from "./provider-jsonrpc.js";
import type { CommunityResourcable } from "./community.js";
import type { Networkish } from "./network.js";
import type { JsonRpcError, JsonRpcPayload } from "./provider-jsonrpc.js";
/**
* The **AnkrProvider** connects to the [[link-ankr]]
* JSON-RPC end-points.
*
* By default, a highly-throttled API key is used, which is
* appropriate for quick prototypes and simple scripts. To
* gain access to an increased rate-limit, it is highly
* recommended to [sign up here](link-ankr-signup).
*/
export declare class AnkrProvider extends JsonRpcProvider implements CommunityResourcable {
/**
* The API key for the Ankr connection.
*/
readonly apiKey: string;
/**
* Create a new **AnkrProvider**.
*
* By default connecting to ``mainnet`` with a highly throttled
* API key.
*/
constructor(_network?: Networkish, apiKey?: null | string);
_getProvider(chainId: number): AbstractProvider;
/**
* Returns a prepared request for connecting to %%network%% with
* %%apiKey%%.
*/
static getRequest(network: Network, apiKey?: null | string): FetchRequest;
getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error;
isCommunityResource(): boolean;
}