"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var networks_1 = require("@ethersproject/networks"); var properties_1 = require("@ethersproject/properties"); var logger_1 = require("@ethersproject/logger"); var _version_1 = require("./_version"); var logger = new logger_1.Logger(_version_1.version); var json_rpc_provider_1 = require("./json-rpc-provider"); var UrlJsonRpcProvider = /** @class */ (function (_super) { __extends(UrlJsonRpcProvider, _super); function UrlJsonRpcProvider(network, apiKey) { var _newTarget = this.constructor; var _this = this; logger.checkAbstract(_newTarget, UrlJsonRpcProvider); // Normalize the Network and API Key network = properties_1.getStatic((_newTarget), "getNetwork")(network); apiKey = properties_1.getStatic((_newTarget), "getApiKey")(apiKey); var url = properties_1.getStatic((_newTarget), "getUrl")(network, apiKey); _this = _super.call(this, url, network) || this; properties_1.defineReadOnly(_this, "apiKey", apiKey); return _this; } UrlJsonRpcProvider.prototype._startPending = function () { logger.warn("WARNING: API provider does not support pending filters"); }; UrlJsonRpcProvider.prototype.getSigner = function (address) { logger.throwError("API provider does not support signing", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "getSigner" }); return null; }; UrlJsonRpcProvider.prototype.listAccounts = function () { return Promise.resolve([]); }; UrlJsonRpcProvider.getNetwork = function (network) { return networks_1.getNetwork((network == null) ? "homestead" : network); }; // Return a defaultApiKey if null, otherwise validate the API key UrlJsonRpcProvider.getApiKey = function (apiKey) { return apiKey; }; // Returns the url for the given network and API key UrlJsonRpcProvider.getUrl = function (network, apiKey) { return logger.throwError("not implemented; sub-classes must override getUrl", logger_1.Logger.errors.NOT_IMPLEMENTED, { operation: "getUrl" }); }; return UrlJsonRpcProvider; }(json_rpc_provider_1.JsonRpcProvider)); exports.UrlJsonRpcProvider = UrlJsonRpcProvider;