ethers.js/src.ts/providers/provider-cloudflare.ts

25 lines
734 B
TypeScript
Raw Normal View History

2023-01-28 09:52:20 +03:00
/**
* About Cloudflare
*
* @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare]
*/
import { assertArgument } from "../utils/index.js";
2022-09-05 23:14:43 +03:00
import { Network } from "./network.js";
import { JsonRpcProvider } from "./provider-jsonrpc.js";
import type { Networkish } from "./network.js";
2022-11-30 21:44:47 +03:00
/**
2023-01-28 09:52:20 +03:00
* About Cloudflare...
2022-11-30 21:44:47 +03:00
*/
2022-09-05 23:14:43 +03:00
export class CloudflareProvider extends JsonRpcProvider {
2022-11-28 05:58:07 +03:00
constructor(_network?: Networkish) {
if (_network == null) { _network = "mainnet"; }
2022-09-05 23:14:43 +03:00
const network = Network.from(_network);
assertArgument(network.name === "mainnet", "unsupported network", "network", _network);
2022-09-05 23:14:43 +03:00
super("https:/\/cloudflare-eth.com/", network, { staticNetwork: network });
}
}