import { InitiaTask } from './InitiaTask' import { MsgSend } from '@initia/initia.js' export class InitiaClient extends InitiaTask { constructor(mnemonic: string, useProxy: boolean = false) { super(mnemonic, useProxy) } async transfer(to: string, amount: number) { const msg = new MsgSend( this.wallet.key.accAddress, to, `${amount * Math.pow(10, 6)}uinit`, ) const signed = await this.wallet.createAndSignTx({ // sequence: 3, msgs: [msg], }) const broadcast = await this.lcd.tx.broadcast(signed) return broadcast.txhash } async week2Task2(toAddr: string) { const uinitAmount = await this.getTargetAmount(toAddr) console.log(uinitAmount) if (Number(uinitAmount) > 0) { return `done` } else { return await this.transfer(toAddr, 1) } } }