"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MockedProvider = void 0;
var tslib_1 = require("tslib");
var ethers_1 = require("ethers");
var BigNumberUtils_1 = require("../../utils/BigNumberUtils");
var MockedProvider = (function (_super) {
    tslib_1.__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: BigNumberUtils_1.bnZero,
            timestamp: 0,
            gasLimit: BigNumberUtils_1.bnZero,
            gasUsed: BigNumberUtils_1.bnZero,
            baseFeePerGas: this.stdLastBaseFeePerGas,
            miner: "0x",
            extraData: "0x",
        };
        return Promise.resolve(mockBlock);
    };
    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,
            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;
}(ethers_1.providers.StaticJsonRpcProvider));
exports.MockedProvider = MockedProvider;
//# sourceMappingURL=mockEthersProvider.js.map