"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
const swapToken_1 = require("./web3/skills/swapToken");
const configModule = __importStar(require("./web3/config"));
// Mock getAddress to bypass Vault lock
configModule.getAddress = async () => "0x28C6c06298d514Db089934071355E22Af1257125"; // dummy address
const CHAINS = ["ethereum", "bsc", "base", "arbitrum", "optimism", "polygon"];
const ROUTERS = ["auto", "lifi", "relay", "uniswap_v2", "uniswap_v3", "pancakeswap", "1inch", "cowswap"];
// Helper to get native and stablecoin addresses per chain
const TOKENS = {
    ethereum: { in: "0x0000000000000000000000000000000000000000", out: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" }, // ETH to USDC
    bsc: { in: "0x0000000000000000000000000000000000000000", out: "0x55d398326f99059fF775485246999027B3197955" }, // BNB to USDT
    base: { in: "0x0000000000000000000000000000000000000000", out: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }, // ETH to USDC
    arbitrum: { in: "0x0000000000000000000000000000000000000000", out: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" }, // ETH to USDC
    optimism: { in: "0x0000000000000000000000000000000000000000", out: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85" }, // ETH to USDC
    polygon: { in: "0x0000000000000000000000000000000000000000", out: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359" } // MATIC to USDC
};
async function runAllTests() {
    console.log("=== COMPREHENSIVE ROUTER TEST ===");
    for (const chain of CHAINS) {
        console.log(`\\n--- 🌐 Testing Chain: ${chain.toUpperCase()} ---`);
        const { in: fromToken, out: toToken } = TOKENS[chain];
        for (const router of ROUTERS) {
            try {
                const res = await (0, swapToken_1.prepareSwapToken)(chain, fromToken, toToken, "0.01", "manual", router);
                // Extract just the success info to keep logs readable
                const outputMatch = res.match(/Expected Output: ~([\\d.]+) /);
                if (outputMatch) {
                    console.log(`[✅ SUCCESS] ${router.padEnd(15)} -> Quote: ~${outputMatch[1]} USDC/USDT`);
                }
                else {
                    console.log(`[⚠️ PENDING] ${router.padEnd(15)} -> ${res.substring(0, 50)}...`);
                }
            }
            catch (err) {
                console.log(`[❌ FAILED]  ${router.padEnd(15)} -> ${err.message.split('\\n')[0]}`);
            }
        }
    }
}
runAllTests();
