123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 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: 1,
- },
- take: 100,
- })
- 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.mintPart()
- if (done !== `undone`) {
- await DBClient.instance.randomTask.update({
- where: { id: account.id },
- data: { finish: 2 },
- })
- } else {
- await DBClient.instance.randomTask.update({
- where: { id: account.id },
- data: { finish: -2 },
- })
- }
- // 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(10)
|