2022-09-09 06:21:08 +03:00
|
|
|
import { throwArgumentError } 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";
|
|
|
|
|
|
|
|
|
|
|
|
export class CloudflareProvider extends JsonRpcProvider {
|
2022-09-30 04:55:13 +03:00
|
|
|
constructor(_network: Networkish = "mainnet") {
|
2022-09-05 23:14:43 +03:00
|
|
|
const network = Network.from(_network);
|
2022-09-30 04:55:13 +03:00
|
|
|
if (network.name !== "mainnet") {
|
2022-09-09 06:21:08 +03:00
|
|
|
return throwArgumentError("unsupported network", "network", _network);
|
2022-09-05 23:14:43 +03:00
|
|
|
}
|
|
|
|
super("https:/\/cloudflare-eth.com/", network, { staticNetwork: network });
|
|
|
|
}
|
|
|
|
}
|