|
@@ -1,6 +1,5 @@
|
|
|
import { getAxiosClient } from '../utils'
|
|
|
import { DBClient } from '../singletons'
|
|
|
-import { Status } from '../models/Status'
|
|
|
import polly from 'polly-js'
|
|
|
import { forEachAsync } from 'useless-helpers'
|
|
|
|
|
@@ -23,24 +22,25 @@ async function faucetTuc(address: string) {
|
|
|
}
|
|
|
|
|
|
async function startFaucet(concurrency: number) {
|
|
|
- const accounts = await DBClient.instance.faucet.findMany({
|
|
|
- where: { tucStatus: Status.Inited },
|
|
|
+ const accounts = await DBClient.instance.account.findMany({
|
|
|
+ where: { status: 5 },
|
|
|
+ // take: 500,
|
|
|
})
|
|
|
await forEachAsync(accounts, concurrency, async account => {
|
|
|
try {
|
|
|
await faucetTuc(account.address)
|
|
|
- await DBClient.instance.faucet.update({
|
|
|
+ await DBClient.instance.account.update({
|
|
|
where: { id: account.id },
|
|
|
- data: { tucStatus: Status.Fauceted },
|
|
|
+ data: { status: 6 },
|
|
|
})
|
|
|
} catch (e) {
|
|
|
console.log(e)
|
|
|
- await DBClient.instance.faucet.update({
|
|
|
- where: { id: account.id },
|
|
|
- data: { tucStatus: Status.FaucetFailed },
|
|
|
- })
|
|
|
+ // await DBClient.instance.faucet.update({
|
|
|
+ // where: { id: account.id },
|
|
|
+ // data: { tucStatus: Status.FaucetFailed },
|
|
|
+ // })
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-await startFaucet(5)
|
|
|
+await startFaucet(20)
|