2019-08-25 09:39:20 +03:00
|
|
|
"use strict";
|
|
|
|
import { UrlJsonRpcProvider } from "./url-json-rpc-provider";
|
|
|
|
import { Logger } from "@ethersproject/logger";
|
|
|
|
import { version } from "./_version";
|
|
|
|
const logger = new Logger(version);
|
|
|
|
export class CloudflareProvider extends UrlJsonRpcProvider {
|
2019-11-20 12:57:38 +03:00
|
|
|
static getApiKey(apiKey) {
|
2019-08-25 09:39:20 +03:00
|
|
|
if (apiKey != null) {
|
|
|
|
logger.throwArgumentError("apiKey not supported for cloudflare", "apiKey", apiKey);
|
|
|
|
}
|
2019-11-20 12:57:38 +03:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
static getUrl(network, apiKey) {
|
2019-08-25 09:39:20 +03:00
|
|
|
let host = null;
|
|
|
|
switch (network.name) {
|
|
|
|
case "homestead":
|
|
|
|
host = "https://cloudflare-eth.com/";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
logger.throwArgumentError("unsupported network", "network", arguments[0]);
|
|
|
|
}
|
|
|
|
return host;
|
|
|
|
}
|
|
|
|
}
|