Skip to content

Instantly share code, notes, and snippets.

@yubrew
Created January 2, 2024 23:36
Show Gist options
  • Save yubrew/3239143e2115ebfa2fdec7fc1699508a to your computer and use it in GitHub Desktop.
Save yubrew/3239143e2115ebfa2fdec7fc1699508a to your computer and use it in GitHub Desktop.
dymension airdrop checker. first create wallets.txt with 1 address per line. then run this script
const fs = require("fs");
const readline = require("readline");
const axios = require("axios");
async function getAirdropStatus(address) {
const apiUrl = `https://geteligibleuserrequest-xqbg2swtrq-uc.a.run.app/?address=${address.toLowerCase()}`;
try {
const response = await axios.get(apiUrl);
const { amount } = response.data;
console.log(`${address} has a claim: ${amount} DYM`);
} catch (error) {
if (error?.response?.data?.error !== "Address or claimAddress not found") {
console.error(`Error for ${address}: ${JSON.stringify(error.response)}`);
}
}
}
async function processFile(fileName) {
const fileStream = fs.createReadStream(fileName);
const rl = readline.createInterface({
input: fileStream,
crlfDelay: Infinity,
});
const batchPromises = [];
const batchSize = 10;
for await (const line of rl) {
const address = line.trim();
batchPromises.push(getAirdropStatus(address));
if (batchPromises.length === batchSize) {
await Promise.all(batchPromises);
batchPromises.length = 0;
}
}
}
const fileName = "wallets.txt";
processFile(fileName)
.then(() => {})
.catch((error) => console.error("Error:", error));
0x0
osmo1...
cosmos1...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment