import { clients } from "../../src";
// Adds functions to MockHubPoolClient to facilitate Dataworker unit testing.
export class MockHubPoolClient extends clients.mocks.MockHubPoolClient {
    latestBundleEndBlocks = {};
    constructor(logger, hubPool, configStoreClient, deploymentBlock = 0, chainId = 1) {
        super(logger, hubPool, configStoreClient, deploymentBlock, chainId);
    }
    setLatestBundleEndBlockForChain(chainId, latestBundleEndBlock) {
        this.latestBundleEndBlocks[chainId] = latestBundleEndBlock;
    }
    getLatestBundleEndBlockForChain(chainIdList, latestMainnetBlock, chainId) {
        return (this.latestBundleEndBlocks[chainId] ??
            super.getLatestBundleEndBlockForChain(chainIdList, latestMainnetBlock, chainId) ??
            0);
    }
    getL1TokenForDeposit(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.getL1TokenForDeposit(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
     */
    getL2TokenForDeposit(deposit, l2ChainId = deposit.destinationChainId) {
        const l1Token = this.getL1TokenForDeposit(deposit);
        // Use the latest hub block number to find the L2 token counterpart.
        return l1Token
            ? this.getL2TokenForL1TokenAtBlock(l1Token, l2ChainId, deposit.quoteBlockNumber)?.toNative()
            : undefined;
    }
}
//# sourceMappingURL=MockHubPoolClient.js.map