import { __awaiter, __generator } from "tslib";
import hre from "hardhat";
/**
 * Mines a random number of blocks.
 * @param amount Amount of blocks to mine. If not provided, a random number of blocks will be mined.
 */
export function mineRandomBlocks(amount) {
    return __awaiter(this, void 0, void 0, function () {
        var randomBlocksToMine, i;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    randomBlocksToMine = amount !== null && amount !== void 0 ? amount : Math.ceil(Math.random() * 10);
                    i = 0;
                    _a.label = 1;
                case 1:
                    if (!(i < randomBlocksToMine)) return [3 /*break*/, 4];
                    return [4 /*yield*/, hre.network.provider.send("evm_mine")];
                case 2:
                    _a.sent();
                    _a.label = 3;
                case 3:
                    i++;
                    return [3 /*break*/, 1];
                case 4: return [2 /*return*/];
            }
        });
    });
}
//# sourceMappingURL=BlockchainUtils.js.map