|
@@ -0,0 +1,63 @@
|
|
|
+import { DBClient } from '../singletons'
|
|
|
+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 undone = await client.mintPartApprovedAll()
|
|
|
+ if (undone.length != 0) {
|
|
|
+ const data = {
|
|
|
+ finish: 0,
|
|
|
+ task2: 1,
|
|
|
+ task3: 1,
|
|
|
+ task4: 1,
|
|
|
+ task5: 1,
|
|
|
+ task6: 1,
|
|
|
+ }
|
|
|
+
|
|
|
+ const taskMapping = {
|
|
|
+ 2: 'task2',
|
|
|
+ 3: 'task3',
|
|
|
+ 4: 'task4',
|
|
|
+ 5: 'task5',
|
|
|
+ 6: 'task6',
|
|
|
+ }
|
|
|
+
|
|
|
+ undone.forEach(task => {
|
|
|
+ if (taskMapping[task]) {
|
|
|
+ data[taskMapping[task]] = 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ await DBClient.instance.randomTask.update({
|
|
|
+ where: { id: account.id },
|
|
|
+ data: data,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ await DBClient.instance.randomTask.update({
|
|
|
+ where: { id: account.id },
|
|
|
+ data: { finish: 1 },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // const unApprovedList = await client.mintJennie()
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e.message)
|
|
|
+ // await DBClient.instance.account.update({
|
|
|
+ // where: { id: account.id },
|
|
|
+ // data: { status: Status.MayQueued, message: e.message },
|
|
|
+ // })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+startCheck(50)
|