Skip to content

Instantly share code, notes, and snippets.

@a3-ton
Created May 11, 2025 10:21
Show Gist options
  • Save a3-ton/66b124c468a604b31f1bf5a3d8be0534 to your computer and use it in GitHub Desktop.
Save a3-ton/66b124c468a604b31f1bf5a3d8be0534 to your computer and use it in GitHub Desktop.
Г.внокод
import CryptoJS from 'crypto-js'
const MAX_PRICE_BUY: number = 0.855
const TIMEOUT = 1250
var buyed = [0]
var balance = 0
var floor = 0
const secretKey = "yowtfisthispieceofshitiiit"
// ТУТ НАДО ВСТАВИТЬ СВОЮ authData
const buyBody = JSON.parse("{\"authData\": authData из приложения}")
const encryptText = (txt: string) => {
return CryptoJS.AES.encrypt(txt, secretKey).toString()
}
function buy(giftIndex: number, price: number): Promise<Response> {
buyBody.price = price
buyBody.timestamp = Math.floor(new Date().getTime() / 1e3)
buyBody.wtf = encryptText(String(buyBody.timestamp))
const addr: string = "https://gifts.coffin.meme/api/buyGift/" + giftIndex
return fetch(addr, {
headers: {
"accept": "*/*",
"accept-language": "ru,en;q=0.9",
"content-type": "application/json",
"sec-ch-ua": "\"Chromium\";v=\"128\", \"Not;A=Brand\";v=\"24\", \"YaBrowser\";v=\"24.10\", \"Yowser\";v=\"2.5\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"macOS\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"Referer": "https://tonnel-gift.vercel.app/",
"Referrer-Policy": "strict-origin-when-cross-origin"
},
body: JSON.stringify(buyBody),
method: "POST"
});
}
const countBalance = 30000 / TIMEOUT
let checkBalance = countBalance
let latest = true
function saveData(gifts: any[]) {
let fl = 100
for (let index = 0; index < gifts.length; index++) {
const gift = gifts[index];
// console.log('xxx-', index, gift.gift_num, gift.price)
fl = fl < gift.price ? fl : gift.price
if (gift.gift_num < 120000
&& gift.price < MAX_PRICE_BUY
&& buyed.indexOf(gift.gift_id) < 0
) {
console.log('Good: ', gift)
const price = gift.price * 1.1
if (gift.name === 'Homemade Cake'
&& gift.asset === 'TON'
&& gift.status === 'forsale'
&& price < balance
) {
buy(gift.gift_id, gift.price)
.then(response => response.json())
.then((ok) => {
console.log('ok: ', ok)
if (ok.status !== 'error') {
buyed.push(gift.gift_id)
balance -= price
}
})
.catch(err => console.error(err))
buy(gift.gift_id, gift.price)
.then(response => response.json())
.then((ok) => {
console.log('ok2: ', ok)
if (ok.status !== 'error') {
buyed.push(gift.gift_id)
balance -= price
}
})
.catch(err => console.error(err))
}
}
}
checkBalance--
if (checkBalance < 1) {
getBalance()
checkBalance = countBalance
}
if (!latest) floor = fl
console.log("balance: ", balance, checkBalance, Number(floor * 1.1).toFixed(3), latest ? 'latest' : 'low')
}
let lowBodyIndex = 0
const lowBody1: string = "{\"page\":1,\"limit\":30,\"sort\":\"{\\\"price\\\":1,\\\"gift_id\\\":-1}\",\"filter\":\"{\\\"price\\\":{\\\"$exists\\\":true},\\\"refunded\\\":{\\\"$ne\\\":true},\\\"buyer\\\":{\\\"$exists\\\":false},\\\"export_at\\\":{\\\"$exists\\\":true},\\\"gift_name\\\":\\\"Homemade Cake\\\",\\\"asset\\\":\\\"TON\\\"}\",\"ref\":0,\"price_range\":null,\"user_auth\":\"\"}"
const lowBody2: string = "{\"page\":2,\"limit\":30,\"sort\":\"{\\\"price\\\":1,\\\"gift_id\\\":-1}\",\"filter\":\"{\\\"price\\\":{\\\"$exists\\\":true},\\\"refunded\\\":{\\\"$ne\\\":true},\\\"buyer\\\":{\\\"$exists\\\":false},\\\"export_at\\\":{\\\"$exists\\\":true},\\\"gift_name\\\":\\\"Homemade Cake\\\",\\\"asset\\\":\\\"TON\\\"}\",\"ref\":0,\"price_range\":null,\"user_auth\":\"\"}"
const lowBody3: string = "{\"page\":3,\"limit\":30,\"sort\":\"{\\\"price\\\":1,\\\"gift_id\\\":-1}\",\"filter\":\"{\\\"price\\\":{\\\"$exists\\\":true},\\\"refunded\\\":{\\\"$ne\\\":true},\\\"buyer\\\":{\\\"$exists\\\":false},\\\"export_at\\\":{\\\"$exists\\\":true},\\\"gift_name\\\":\\\"Homemade Cake\\\",\\\"asset\\\":\\\"TON\\\"}\",\"ref\":0,\"price_range\":null,\"user_auth\":\"\"}"
const lowBody4: string = "{\"page\":4,\"limit\":30,\"sort\":\"{\\\"price\\\":1,\\\"gift_id\\\":-1}\",\"filter\":\"{\\\"price\\\":{\\\"$exists\\\":true},\\\"refunded\\\":{\\\"$ne\\\":true},\\\"buyer\\\":{\\\"$exists\\\":false},\\\"export_at\\\":{\\\"$exists\\\":true},\\\"gift_name\\\":\\\"Homemade Cake\\\",\\\"asset\\\":\\\"TON\\\"}\",\"ref\":0,\"price_range\":null,\"user_auth\":\"\"}"
const lowBody = [lowBody1, lowBody2, lowBody3, lowBody4]
const getData = () => {
const latestBody: string = "{\"page\":1,\"limit\":30,\"sort\":\"{\\\"message_post_time\\\":-1,\\\"gift_id\\\":-1}\",\"filter\":\"{\\\"price\\\":{\\\"$exists\\\":true},\\\"refunded\\\":{\\\"$ne\\\":true},\\\"buyer\\\":{\\\"$exists\\\":false},\\\"export_at\\\":{\\\"$exists\\\":true},\\\"gift_name\\\":\\\"Homemade Cake\\\",\\\"asset\\\":\\\"TON\\\"}\",\"ref\":0,\"price_range\":null,\"user_auth\":\"\"}"
const body: string = latest ? latestBody : lowBody[lowBodyIndex]
lowBodyIndex++
if (lowBodyIndex >= lowBody.length) lowBodyIndex = 0
latest = !latest
fetch("https://gifts2.tonnel.network/api/pageGifts", {
"headers": {
"accept": "*/*",
"accept-language": "ru,en;q=0.9",
"content-type": "application/json",
"priority": "u=1, i",
"sec-ch-ua": "\"Chromium\";v=\"128\", \"Not;A=Brand\";v=\"24\", \"YaBrowser\";v=\"24.10\", \"Yowser\";v=\"2.5\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"macOS\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"Referer": "https://tonnel-gift.vercel.app/",
"Referrer-Policy": "strict-origin-when-cross-origin"
},
"body": body,
"method": "POST"
})
.then(response => response.json())
.then(saveData)
.catch(err => console.error(err))
}
const getBalance = () => {
fetch("https://gifts2.tonnel.network/api/balance/info", {
"headers": {
"accept": "*/*",
"accept-language": "ru,en;q=0.9",
"content-type": "application/json",
"priority": "u=1, i",
"sec-ch-ua": "\"Chromium\";v=\"128\", \"Not;A=Brand\";v=\"24\", \"YaBrowser\";v=\"24.10\", \"Yowser\";v=\"2.5\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"macOS\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"Referer": "https://tonnel-gift.vercel.app/",
"Referrer-Policy": "strict-origin-when-cross-origin"
},
// ТУТ НАДО ВСТАВИТЬ СВОЮ authData
"body": "{\"authData\": authData из приложения \",\"ref\":\"\"}",
"method": "POST"
})
.then(response => response.json())
.then((ok) => {
// console.log('ok: ', ok)
balance = ok.balance
if (balance < MAX_PRICE_BUY * 1.1) {
console.log('Stopped on low balance ', balance)
clearInterval(interval)
}
})
.catch(err => console.error(err))
}
getBalance()
const interval = setInterval(getData, TIMEOUT);
@a3-ton
Copy link
Author

a3-ton commented May 11, 2025

Пометил "ТУТ НАДО ВСТАВИТЬ СВОЮ authData" места где надо вставить авторизационные данные.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment