import { DBClient } from '../singletons' import { forEachAsync } from '../utils' import { InitiaClient } from '../InitiaClient' async function startCheck(concurrency) { const accountsRaw = await DBClient.instance.account.findMany({ where: { status: { notIn: [-2, 888, 889], }, }, take: 50000, }) await forEachAsync(accountsRaw, concurrency, async (account, index) => { console.log(`${index}/${accountsRaw.length}: processing ${account.address}`) try { // await faucetAccount(account.address) const client = new InitiaClient(account.mnemonic, true) const amount = await client.getGasAmount() if (amount < 0.01) { await DBClient.instance.account.update({ where: { id: account.id }, data: { status: -2 }, //可能领过还没到账的 }) } else { await DBClient.instance.account.update({ where: { id: account.id }, data: { status: 888 }, //可能领过还没到账的 }) } console.log(`amount:`, amount) } catch (e) {} }) } startCheck(20)