"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MockedProvider = void 0;
const ethers_1 = require("ethers");
const BigNumberUtils_1 = require("../../utils/BigNumberUtils");
class MockedProvider extends ethers_1.providers.StaticJsonRpcProvider {
    stdLastBaseFeePerGas;
    stdMaxPriorityFeePerGas;
    defaultChainId;
    transactions = {};
    constructor(stdLastBaseFeePerGas, stdMaxPriorityFeePerGas, defaultChainId = 1) {
        super(undefined, defaultChainId);
        this.stdLastBaseFeePerGas = stdLastBaseFeePerGas;
        this.stdMaxPriorityFeePerGas = stdMaxPriorityFeePerGas;
        this.defaultChainId = defaultChainId;
    }
    getBlock(_blockHashOrBlockTag) {
        const 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);
    }
    send(method, _params) {
        switch (method) {
            case "eth_maxPriorityFeePerGas":
                return Promise.resolve(this.stdMaxPriorityFeePerGas);
            default:
                throw new Error(`MockedProvider#Unimplemented method: ${method}`);
        }
    }
    getFeeData() {
        return Promise.resolve({
            lastBaseFeePerGas: this.stdLastBaseFeePerGas,
            maxPriorityFeePerGas: this.stdMaxPriorityFeePerGas,
            maxFeePerGas: null,
            gasPrice: null,
        });
    }
    getTransaction(hash) {
        return Promise.resolve(this.transactions[hash]);
    }
    getGasPrice() {
        return Promise.resolve(this.stdLastBaseFeePerGas.add(this.stdMaxPriorityFeePerGas));
    }
    getNetwork() {
        return Promise.resolve({
            name: "mocknetwork",
            chainId: this.defaultChainId,
        });
    }
    _setTransaction(hash, transaction) {
        this.transactions[hash] = transaction;
    }
}
exports.MockedProvider = MockedProvider;
//# sourceMappingURL=mockEthersProvider.js.map