Skip to content

Instantly share code, notes, and snippets.

@ksaynice
Last active January 15, 2024 16:15
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
  • Save ksaynice/d719ece7db549f7fc3a1f67016c4b613 to your computer and use it in GitHub Desktop.
Save ksaynice/d719ece7db549f7fc3a1f67016c4b613 to your computer and use it in GitHub Desktop.
Blast Airdrop Lucky/Twitter/Super Spin AUTO Scripts
const axios = {
get(url, { headers = {} }) {
return new Promise((resolve, reject) => {
const xhr = window.XMLHttpRequest
? new XMLHttpRequest()
: new ActiveXObject("Microsoft.XMLHTTP");
xhr.open("get", url);
xhr.withCredentials = true;
// Object.entries(headers).forEach(([key,value]) => xhr.setRequestHeader(key, value));
xhr.send(null);
xhr.onreadystatechange = function () {
if (this.readyState === 4) {
const data = JSON.parse(this.responseText);
return resolve({ data })
}
}
xhr.onerror = function (error) {
return reject(error);
}
})
},
post(url, data, { headers = {} }) {
return new Promise((resolve, reject) => {
const xhr = window.XMLHttpRequest
? new XMLHttpRequest()
: new ActiveXObject("Microsoft.XMLHTTP");
xhr.open("post", url);
xhr.withCredentials = true;
xhr.setRequestHeader("Content-Type","application/json");
// Object.entries(headers).forEach(([key,value]) => xhr.setRequestHeader(key, value));
xhr.send(JSON.stringify(data));
xhr.onreadystatechange = function () {
if (this.readyState === 4) {
const data = JSON.parse(this.responseText);
return resolve({ data })
}
}
xhr.onerror = function (error) {
return reject(error);
}
})
}
}
async function run() {
const spinList = await getSpinList();
//test
// const spinList = [ { spinType: 'tweet-spin', spinMultiplier: 1 }, { spinType: 'super-spin', spinMultiplier: 1 } ] ;
log('spinList -> ', spinList);
if (!spinList.length) {
log('no spin');
return;
}
// [ { spinType: 'tweet-spin', spinMultiplier: 1 } ]
const splitSpinList = [];
spinList.forEach(({ spinType, spinMultiplier }) => {
new Array(spinMultiplier).fill(0).forEach(() => {
splitSpinList.push({
spinType,
spinMultiplier: 1
})
})
})
log('splitSpinList -> ', splitSpinList);
for (let i = 0; i < splitSpinList.length; i++) {
const item = splitSpinList[i];
const isSuper = item.spinType === 'super-spin';
log(`${i} send spinType ${item.spinType} ...`);
try {
const url = `https://waitlist-api.prod.blast.io/v1${isSuper ? '/spins/sample-superspin' : '/spins/execute'}`
const spinRes = await axios.post(url, isSuper ? {} : splitSpinList[i], {
// headers: {
// 'cookie': `accessToken=${accessToken}`,
// }
});
if(!isSuper) {
const { data: { result: { numberPoints, rarity } } } = spinRes;
log(`${i} => rarity ${rarity} => numberPoints ${numberPoints}`);
}else {
const { data: { spinMultiplier = 1, spinType = 'super-spin' } } = spinRes;
const url = `https://waitlist-api.prod.blast.io/v1/spins/execute`
const spinRes1 = await axios.post(url, {
spinMultiplier: spinMultiplier || 1,
spinType: spinType || 'super-spin'
}, {});
const { data: { result: { numberPoints, rarity } } } = spinRes1;
log(`${i} => rarity ${rarity} => numberPoints ${numberPoints}`);
}
} catch (error) {
log('❌ spin failed', error.response?.data?.message || 'unknown reason', error.toString());
}
}
}
function getSpinList() {
log('get spinList ...');
return new Promise(resolve => {
const request = async () => {
try {
const { data: {
spins
} } = await axios.get('https://waitlist-api.prod.blast.io/v1/user/dashboard', {
// headers: {
// 'cookie': `accessToken=${accessToken}`,
// }
});
const spinList = Object.entries(spins).map(([key, value]) => ({
spinType: key,
spinMultiplier: value
})).filter(item => item.spinMultiplier > 0)
resolve(spinList);
} catch (error) {
log('get spinList error', error.toString(), ' retring...');
setTimeout(request, 2000);
}
}
request();
})
}
function log(...msgs) {
const date = new Date();
console.log(`${getDateTime()}`, ...msgs);
}
function getDateTime() {
const date = new Date();
const now = date.getTime();
const ms = String(now).slice(-3);
return `[${date.toLocaleString()}.${ms}]`;
}
run();
@qianzhentao1
Copy link

6

@lansetop
Copy link

6

@nyealovey
Copy link

6

@Thatisgreat
Copy link

6

@GalaxySciTech
Copy link

6

@lee1888
Copy link

lee1888 commented Nov 23, 2023

666

@ksaynice
Copy link
Author

ksaynice commented Nov 23, 2023

v0.11 updated Super Spin logic

@ksaynice
Copy link
Author

ksaynice commented Nov 23, 2023

v0.12
fixed super spin last 1 does not run correctly issue

@ksaynice
Copy link
Author

permeant invite link:

blast.io/DPV9C

@Ye493
Copy link

Ye493 commented Nov 25, 2023

666

@Realank
Copy link

Realank commented Nov 28, 2023

blast.io/33HD5

@badan123
Copy link

6

@ZZzzzioi
Copy link

ZZzzzioi commented Jan 5, 2024

6

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