import { __extends } from "tslib";
import { providers } from "ethers";
import { bnZero } from "../../utils/BigNumberUtils";
/**
 * @notice Class used to test GasPriceOracle which makes ethers provider calls to the following implemented
 * methods.
 */
var MockedProvider = /** @class */ (function (_super) {
    __extends(MockedProvider, _super);
    function MockedProvider(stdLastBaseFeePerGas, stdMaxPriorityFeePerGas, defaultChainId) {
        if (defaultChainId === void 0) { defaultChainId = 1; }
        var _this = _super.call(this, undefined, defaultChainId) || this;
        _this.stdLastBaseFeePerGas = stdLastBaseFeePerGas;
        _this.stdMaxPriorityFeePerGas = stdMaxPriorityFeePerGas;
        _this.defaultChainId = defaultChainId;
        _this.transactions = {};
        return _this;
    }
    MockedProvider.prototype.getBlock = function (_blockHashOrBlockTag) {
        var mockBlock = {
            transactions: [],
            hash: "0x",
            parentHash: "0x",
            number: 0,
            nonce: "0",
            difficulty: 0,
            _difficulty: bnZero,
            timestamp: 0,
            gasLimit: bnZero,
            gasUsed: bnZero,
            baseFeePerGas: this.stdLastBaseFeePerGas,
            miner: "0x",
            extraData: "0x",
        };
        return Promise.resolve(mockBlock);
    };
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    MockedProvider.prototype.send = function (method, _params) {
        switch (method) {
            case "eth_maxPriorityFeePerGas":
                return Promise.resolve(this.stdMaxPriorityFeePerGas);
            default:
                throw new Error("MockedProvider#Unimplemented method: ".concat(method));
        }
    };
    MockedProvider.prototype.getFeeData = function () {
        return Promise.resolve({
            lastBaseFeePerGas: this.stdLastBaseFeePerGas,
            maxPriorityFeePerGas: this.stdMaxPriorityFeePerGas,
            // Following fields unused in GasPrice oracle
            maxFeePerGas: null,
            gasPrice: null,
        });
    };
    MockedProvider.prototype.getTransaction = function (hash) {
        return Promise.resolve(this.transactions[hash]);
    };
    MockedProvider.prototype.getGasPrice = function () {
        return Promise.resolve(this.stdLastBaseFeePerGas.add(this.stdMaxPriorityFeePerGas));
    };
    MockedProvider.prototype.getNetwork = function () {
        return Promise.resolve({
            name: "mocknetwork",
            chainId: this.defaultChainId,
        });
    };
    MockedProvider.prototype._setTransaction = function (hash, transaction) {
        this.transactions[hash] = transaction;
    };
    return MockedProvider;
}(providers.StaticJsonRpcProvider));
export { MockedProvider };
//# sourceMappingURL=mockEthersProvider.js.map