hel 1 سال پیش
والد
کامیت
334ddaec88
3فایلهای تغییر یافته به همراه16 افزوده شده و 19 حذف شده
  1. 1 15
      src/JennieModule.ts
  2. 14 3
      src/onchain/finalTask.ts
  3. 1 1
      src/onchain/week3/randomWeek3.ts

+ 1 - 15
src/JennieModule.ts

@@ -259,23 +259,9 @@ export abstract class JennieModule extends BaseClient {
             .toBase64(),
         ],
       )
-      const randLimit = 370000 + Math.floor(Math.random() * 10000)
-      const signed = await this.wallet.createAndSignTx({
-        msgs: Array.isArray(msg) ? msg : [msg],
-        fee: new Fee(
-          randLimit,
-          new Coins([
-            new Coin(
-              'move/944f8dd8dc49f96c25fea9849f16436dcfa6d564eec802f3ef7f8b3ea85368ff',
-              randLimit / 2,
-            ),
-          ]),
-        ),
-      })
-      const broadcast = await this.lcd.tx.broadcastAsync(signed)
+      return await this.broadcast(msg)
       // console.log(broadcast.raw_log)
       // console.log(this.key.accAddress)
-      return broadcast.txhash
     } else {
       return `done`
     }

+ 14 - 3
src/onchain/finalTask.ts

@@ -5,7 +5,7 @@ import { InitiaClient } from '../InitiaClient'
 async function startCheck(concurrency) {
   const accountsRaw = await DBClient.instance.account.findMany({
     where: {
-      status: 2,
+      status: -3,
     },
     orderBy: {
       lastRun: 'desc',
@@ -19,7 +19,18 @@ async function startCheck(concurrency) {
       //   return
       // }
       const client = new InitiaClient(account.mnemonic, true)
-      // const gasGot = await client.gasGot()
+      const gasGot = await client.lcd.bank.balanceByDenom(
+        account.address,
+        `move/944f8dd8dc49f96c25fea9849f16436dcfa6d564eec802f3ef7f8b3ea85368ff`,
+      )
+      if (Number(gasGot.amount) < 300000) {
+        await DBClient.instance.account.update({
+          where: { id: account.id },
+          data: { status: -4 },
+          //可能领过还没到账的
+        })
+        return
+      }
       // if (!gasGot) {
       //   console.log(`gas got:`, gasGot)
       //   await DBClient.instance.account.update({
@@ -49,4 +60,4 @@ async function startCheck(concurrency) {
   })
 }
 
-startCheck(10)
+startCheck(20)

+ 1 - 1
src/onchain/week3/randomWeek3.ts

@@ -132,4 +132,4 @@ async function startCheck(concurrency) {
   })
 }
 
-startCheck(20)
+startCheck(50)