import { __extends } from "tslib";
import { clients } from "../../src";
// Adds functions to MockHubPoolClient to facilitate Dataworker unit testing.
var MockHubPoolClient = /** @class */ (function (_super) {
    __extends(MockHubPoolClient, _super);
    function MockHubPoolClient(logger, hubPool, configStoreClient, deploymentBlock, chainId) {
        if (deploymentBlock === void 0) { deploymentBlock = 0; }
        if (chainId === void 0) { chainId = 1; }
        var _this = _super.call(this, logger, hubPool, configStoreClient, deploymentBlock, chainId) || this;
        _this.latestBundleEndBlocks = {};
        return _this;
    }
    MockHubPoolClient.prototype.setLatestBundleEndBlockForChain = function (chainId, latestBundleEndBlock) {
        this.latestBundleEndBlocks[chainId] = latestBundleEndBlock;
    };
    MockHubPoolClient.prototype.getLatestBundleEndBlockForChain = function (chainIdList, latestMainnetBlock, chainId) {
        var _a, _b;
        return ((_b = (_a = this.latestBundleEndBlocks[chainId]) !== null && _a !== void 0 ? _a : _super.prototype.getLatestBundleEndBlockForChain.call(this, chainIdList, latestMainnetBlock, chainId)) !== null && _b !== void 0 ? _b : 0);
    };
    MockHubPoolClient.prototype.getL1TokenForDeposit = function (deposit) {
        // L1-->L2 token mappings are set via PoolRebalanceRoutes which occur on mainnet,
        // so we use the latest token mapping. This way if a very old deposit is filled, the relayer can use the
        // latest L2 token mapping to find the L1 token counterpart.
        return _super.prototype.getL1TokenForDeposit.call(this, deposit);
    };
    /**
     * Returns the L2 token that should be used as a counterpart to a deposit event. For example, the caller
     * might want to know what the refund token will be on l2ChainId for the deposit event.
     * @param l2ChainId Chain where caller wants to get L2 token counterpart for
     * @param event Deposit event
     * @returns string L2 token counterpart on l2ChainId
     */
    MockHubPoolClient.prototype.getL2TokenForDeposit = function (deposit, l2ChainId) {
        var _a;
        if (l2ChainId === void 0) { l2ChainId = deposit.destinationChainId; }
        var l1Token = this.getL1TokenForDeposit(deposit);
        // Use the latest hub block number to find the L2 token counterpart.
        return l1Token
            ? (_a = this.getL2TokenForL1TokenAtBlock(l1Token, l2ChainId, deposit.quoteBlockNumber)) === null || _a === void 0 ? void 0 : _a.toNative()
            : undefined;
    };
    return MockHubPoolClient;
}(clients.mocks.MockHubPoolClient));
export { MockHubPoolClient };
//# sourceMappingURL=MockHubPoolClient.js.map