import { DBClient } from '../singletons' import { Status } from '../models/Status' import { forEachAsync } from '../utils' import { InitiaClient } from '../InitiaClient' async function startCheck(concurrency) { const accountsRaw = await DBClient.instance.randomTask.findMany({ where: { finish: 2, }, take: 10000, }) await forEachAsync(accountsRaw, concurrency, async (account, index) => { console.log(`${index}/${accountsRaw.length}: processing ${account.address}`) console.log(account.id) try { // await faucetAccount(account.address) const client = new InitiaClient(account.mnemonic, true) const done = await client.mintJennie() if (done == `done`) { await DBClient.instance.randomTask.update({ where: { id: account.id }, data: { finish: 3 }, }) } else if (done == `undone`) { await DBClient.instance.randomTask.update({ where: { id: account.id }, data: { finish: 1 }, }) } // const unApprovedList = await client.mintJennie() } catch (e) { console.log(e) // await DBClient.instance.account.update({ // where: { id: account.id }, // data: { status: Status.MayQueued, message: e.message }, // }) } }) } startCheck(120)