"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.minimalAdapterInterface = exports.minimalSpokePoolInterface = exports.zeroAddress = void 0;
exports.askYesNoQuestion = askYesNoQuestion;
const ethers_1 = require("ethers");
const readline_1 = __importDefault(require("readline"));
exports.zeroAddress = ethers_1.ethers.constants.AddressZero;
exports.minimalSpokePoolInterface = [
    {
        inputs: [
            { internalType: "address", name: "l2Token", type: "address" },
            { internalType: "address", name: "l1Token", type: "address" },
        ],
        name: "whitelistToken",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            { internalType: "address", name: "l2Token", type: "address" },
            { internalType: "address", name: "tokenBridge", type: "address" },
        ],
        name: "setTokenBridge",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint32",
                name: "rootBundleId",
                type: "uint32",
            },
            {
                components: [
                    {
                        internalType: "uint256",
                        name: "amountToReturn",
                        type: "uint256",
                    },
                    {
                        internalType: "uint256",
                        name: "chainId",
                        type: "uint256",
                    },
                    {
                        internalType: "uint256[]",
                        name: "refundAmounts",
                        type: "uint256[]",
                    },
                    {
                        internalType: "uint32",
                        name: "leafId",
                        type: "uint32",
                    },
                    {
                        internalType: "address",
                        name: "l2TokenAddress",
                        type: "address",
                    },
                    {
                        internalType: "address[]",
                        name: "refundAddresses",
                        type: "address[]",
                    },
                ],
                internalType: "struct SpokePoolInterface.RelayerRefundLeaf",
                name: "relayerRefundLeaf",
                type: "tuple",
            },
            {
                internalType: "bytes32[]",
                name: "proof",
                type: "bytes32[]",
            },
        ],
        name: "executeRelayerRefundLeaf",
        outputs: [],
        stateMutability: "payable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "bytes32",
                name: "relayerRefundRoot",
                type: "bytes32",
            },
            {
                internalType: "bytes32",
                name: "slowRelayRoot",
                type: "bytes32",
            },
        ],
        name: "relayRootBundle",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
        ],
        name: "rootBundles",
        outputs: [
            {
                internalType: "bytes32",
                name: "slowRelayRoot",
                type: "bytes32",
            },
            {
                internalType: "bytes32",
                name: "relayerRefundRoot",
                type: "bytes32",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
];
exports.minimalAdapterInterface = [
    {
        inputs: [
            {
                internalType: "address",
                name: "target",
                type: "address",
            },
            {
                internalType: "bytes",
                name: "message",
                type: "bytes",
            },
        ],
        name: "relayMessage",
        outputs: [],
        stateMutability: "payable",
        type: "function",
    },
];
async function askQuestion(query) {
    const rl = readline_1.default.createInterface({ input: process.stdin, output: process.stdout });
    return new Promise((resolve) => rl.question(query, (ans) => {
        rl.close();
        resolve(ans);
    }));
}
async function askYesNoQuestion(query) {
    const ans = (await askQuestion(`${query} (y/n) `));
    if (ans.toLowerCase() === "y")
        return true;
    if (ans.toLowerCase() === "n")
        return false;
    return askYesNoQuestion(query);
}
