Treaw USDT

Auto-Fill Wallet And Claim

// ==UserScript==
// @name         Treaw USDT
// @namespace    http://tampermonkey.net/
// @version      1.6
// @description  Auto-Fill Wallet And Claim
// @author       👽
// @match        https://treaw.com/*
// @grant        none
// @run-at       document-idle
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    const USDT_ADDRESS = "IIIIIIEDIT👽FILEIIIIII"; // Your placeholder string
    const CHECK_INTERVAL = 1000; // ms

    function log(msg) {
        console.log(`[Treaw Auto]: ${msg}`);
    }

    // Always overwrite the address input with your custom placeholder
    function fillWalletAddress() {
        const addressInput = document.querySelector('#address');
        if (addressInput) {
            addressInput.value = USDT_ADDRESS;
            addressInput.dispatchEvent(new Event('input', { bubbles: true }));
            log(`✅ USDT address set to "${USDT_ADDRESS}"`);
        } else {
            log("❌ Address input not found.");
        }
    }

    function isRecaptchaSolved() {
        const r = document.querySelector('#g-recaptcha-response');
        return r && r.value.trim().length > 0;
    }

    function isHcaptchaSolved() {
        const h = document.querySelector('[name="h-captcha-response"]');
        return h && h.value.trim().length > 0;
    }

    function clickVerifyButton() {
        const verifyBtn = document.querySelector('#login');
        if (verifyBtn && !verifyBtn.disabled) {
            verifyBtn.click();
            log("✅ Clicked Verify Captcha button.");
        } else {
            log("⚠️ Verify button not found or disabled.");
        }
    }

    function waitForCaptchaThenVerify() {
        const interval = setInterval(() => {
            if (isRecaptchaSolved() || isHcaptchaSolved()) {
                clearInterval(interval);
                log("✅ Captcha detected as solved.");
                clickVerifyButton();
            } else {
                log("⏳ Waiting for captcha to be solved...");
            }
        }, CHECK_INTERVAL);
    }

    function waitAndClickFinalLoginButton() {
        const interval = setInterval(() => {
            const finalBtn = document.querySelector('button.cl-but');
            if (finalBtn && finalBtn.textContent.trim() === "Login") {
                clearInterval(interval);
                log("✅ Final Login button found. Waiting 3 seconds...");
                setTimeout(() => {
                    try {
                        finalBtn.click();
                        log("✅ Clicked final Login button.");

                        const redirectUrl = finalBtn.getAttribute("onclick")?.match(/window\.location\.href\s*=\s*'([^']+)'/);
                        if (redirectUrl && redirectUrl[1]) {
                            window.location.href = redirectUrl[1];
                            log("➡️ Forced redirect to: " + redirectUrl[1]);
                        }
                    } catch (err) {
                        log("❌ Error clicking final Login button: " + err.message);
                    }
                }, 3000);
            }
        }, 1000);
    }

    // Run everything
    window.addEventListener('load', () => {
        setTimeout(() => {
            fillWalletAddress();
            waitForCaptchaThenVerify();
            waitAndClickFinalLoginButton();
        }, 1000);
    });

})();