binance-multi-withdrawal / index.ts
index.ts
Raw
import fs from "fs/promises";
import random from "lodash/random";
import round from "lodash/round";
import ccxt from "ccxt";
import { delay } from "./utils";

const FILENAME = "wallets.txt";

const CURRENCY = "ETH";
const NETWORK = "Arbitrum";

const API_KEY = "your_api_key";
const API_SECRET = "your_api_secret";

const data = await fs.readFile(FILENAME, { encoding: "utf8" });
const wallets = data.split("\n").filter(Boolean).map((item) => item.trim());

async function binanceWithdraw(address: string, amount: number) {
  const account = new ccxt.binance({
    apiKey: API_KEY,
    secret: API_SECRET,
    enableRateLimit: true,
    options: {
      defaultType: "spot",
    },
  });

  try {
    await account.withdraw(CURRENCY, amount, address, null, {
      "network": NETWORK,
    });
    console.log(`${address}, amount: ${amount} - SUCCESS`);
  } catch (e) {
    console.log(`${address}, amount: ${amount} - FAIL`, e);
  }
}

for (const wallet of wallets) {
  // случайное число от 0.04 до 0.051
  const randomValue = random(0.04, 0.051);

  // округляем оставляя 3 знака после запятой,
  // чтобы значения 0.043720921111392634 сделать 0.043
  const amount = round(randomValue, 3);

  await binanceWithdraw(wallet, amount);

  // Задержка от 200 до 300 секунд
  await delay(random(200, 300));
}