Auto Claim - Earn Solana

Autofill email, wait for CAPTCHA, login and claim LTC.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Auto Claim - Earn Solana
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Autofill email, wait for CAPTCHA, login and claim LTC.
// @author       Rubystance
// @license      MIT
// @match        https://earnsolana.xyz/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const email = "YOUR_FAUCETPAY_EMAIL_HERE"; // <-- Replace this with your FaucetPay email

    function waitForElement(selector, timeout = 10000) {
        return new Promise((resolve, reject) => {
            const intervalTime = 100;
            let elapsed = 0;
            const interval = setInterval(() => {
                const el = document.querySelector(selector);
                if (el) {
                    clearInterval(interval);
                    resolve(el);
                } else if (elapsed >= timeout) {
                    clearInterval(interval);
                    reject(`Element ${selector} not found after ${timeout}ms.`);
                }
                elapsed += intervalTime;
            }, intervalTime);
        });
    }

    async function autoLogin() {
        if (window.location.pathname === "/" || window.location.pathname === "/index") {
            try {
                const emailInput = await waitForElement('input[name="wallet"]');
                emailInput.value = email;

                const observer = new MutationObserver((mutations, obs) => {
                    const captchaStatus = document.querySelector('.iconcaptcha-modal__body-title');
                    if (captchaStatus && captchaStatus.textContent.includes("Verification complete")) {
                        const loginBtn = document.querySelector('button[type="submit"].btn-responsive');
                        if (loginBtn) {
                            loginBtn.click();
                            obs.disconnect();
                        }
                    }
                });

                observer.observe(document.body, { childList: true, subtree: true });
            } catch (e) {
                console.error("Login error:", e);
            }
        }
    }

    async function goToLTCFaucet() {
        if (window.location.pathname === "/dashboard") {
            const ltcLink = await waitForElement('a[href="https://earnsolana.xyz/faucet/currency/ltc"]'); // <<-- If you want to claim other crypto SOL/DOGE/FEY.
            ltcLink.click();
        }
    }

    async function clickGoClaim() {
        if (window.location.pathname.startsWith("/faucet/currency/ltc")) {
            const goClaimBtn = await waitForElement('a.btn.btn-primary[href="https://earnsolana.xyz/faucet/currency/ltc"]', 8000); // <<-- If you want to claim other crypto SOL/DOGE/FEY.
            if (goClaimBtn && goClaimBtn.textContent.includes("Go Claim")) {
              
                window.location.href = goClaimBtn.href;
            }
        }
    }

    async function autoClaim() {
        if (window.location.pathname.startsWith("/faucet/currency/ltc")) { // <<-- If you want to claim other crypto SOL/DOGE/FEY.
            const observer = new MutationObserver((mutations, obs) => {
                const captchaStatus = document.querySelector('.iconcaptcha-modal__body-title');
                if (captchaStatus && captchaStatus.textContent.includes("Verification complete")) {
                    const claimBtn = document.getElementById("subbutt");
                    if (claimBtn) {
                        claimBtn.click();
                        obs.disconnect();
                    }
                }
            });

            observer.observe(document.body, { childList: true, subtree: true });
        }
    }

    window.addEventListener('load', () => {
        autoLogin();
        goToLTCFaucet();
        clickGoClaim();
        autoClaim();
    });

})();