|
@@ -40,10 +40,11 @@ export abstract class JennieModule extends BaseClient {
|
|
|
[],
|
|
|
[bcs.address().serialize(this.key.accAddress).toBase64()],
|
|
|
)
|
|
|
+ console.log(mintProgress)
|
|
|
|
|
|
// Check if 'jennie' is already minted
|
|
|
if (mintProgress.is_minted) {
|
|
|
- return
|
|
|
+ return `done`
|
|
|
}
|
|
|
|
|
|
// Initialize a flag to determine if all parts are minted
|
|
@@ -60,7 +61,7 @@ export abstract class JennieModule extends BaseClient {
|
|
|
|
|
|
// If not all parts are minted, exit the function
|
|
|
if (!allPartsMinted) {
|
|
|
- return
|
|
|
+ return `undone`
|
|
|
}
|
|
|
|
|
|
// Prepare the minting message
|
|
@@ -74,56 +75,54 @@ export abstract class JennieModule extends BaseClient {
|
|
|
)
|
|
|
|
|
|
// Broadcast the minting message
|
|
|
- await this.broadcast(msg)
|
|
|
+ return await this.broadcast(msg)
|
|
|
}
|
|
|
- async mintPartApprovedAll() {
|
|
|
+ // async mintPartApprovedAll() {
|
|
|
+ // const axios = getAxiosClient(true)
|
|
|
+ // const res = await axios.get(
|
|
|
+ // `https://xp-api.initiation-1.initia.xyz/xp/mint_parts/${this.key.accAddress}`,
|
|
|
+ // )
|
|
|
+ // const data = res.data
|
|
|
+ // console.log(data.length)
|
|
|
+ // let undone = [1, 2, 3, 4, 5, 6]
|
|
|
+ // for (const item of data) {
|
|
|
+ // const task = Number(item.task_id) + 1
|
|
|
+ // undone = undone.filter(value => value !== task)
|
|
|
+ // }
|
|
|
+ // return undone
|
|
|
+ // }
|
|
|
+ async mintPart() {
|
|
|
+ // 获取 'jennie' 的铸造进度
|
|
|
const axios = getAxiosClient(true)
|
|
|
const res = await axios.get(
|
|
|
`https://xp-api.initiation-1.initia.xyz/xp/mint_parts/${this.key.accAddress}`,
|
|
|
)
|
|
|
const data = res.data
|
|
|
- console.log(data)
|
|
|
- const need = [1, 2, 3, 4, 5, 6]
|
|
|
- let newUndone = []
|
|
|
+ console.log(data.length)
|
|
|
+ if (data.length !== 6) {
|
|
|
+ return `undone`
|
|
|
+ }
|
|
|
+ const msgs = []
|
|
|
for (const item of data) {
|
|
|
- const task = item.task_id + 1
|
|
|
- newUndone = need.filter(value => value !== task)
|
|
|
+ const msg = new MsgExecute(
|
|
|
+ this.key.accAddress,
|
|
|
+ '0x9065fda28f52bb14ade545411f02e8e07a9cb4ba',
|
|
|
+ 'jennie',
|
|
|
+ 'mint_part_v2',
|
|
|
+ [],
|
|
|
+ [
|
|
|
+ bcs.u8().serialize(item.task_id).toBase64(),
|
|
|
+ bcs
|
|
|
+ .vector(bcs.u8())
|
|
|
+ .serialize(Buffer.from(item.signature, 'base64'))
|
|
|
+ .toBase64(),
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ msgs.push(msg)
|
|
|
}
|
|
|
- console.log(newUndone)
|
|
|
- }
|
|
|
- async mintPart() {
|
|
|
- // 获取 'jennie' 的铸造进度
|
|
|
- const mintProgress: MintProgress = await this.lcd.move.viewFunction(
|
|
|
- '0x9065fda28f52bb14ade545411f02e8e07a9cb4ba',
|
|
|
- 'jennie',
|
|
|
- 'get_jennie_mint_progress',
|
|
|
- [],
|
|
|
- [bcs.address().serialize(this.key.accAddress).toBase64()],
|
|
|
- )
|
|
|
-
|
|
|
// 初始化消息数组
|
|
|
- const msgs: MsgExecute[] = []
|
|
|
-
|
|
|
- // console.log(mintProgress.jennie_part_progresses)
|
|
|
-
|
|
|
- // 遍历每个部件的进度
|
|
|
- for (const item of mintProgress.jennie_part_progresses) {
|
|
|
- // 如果部件已批准但未铸造,创建消息
|
|
|
- if (item.is_approved && !item.is_minted) {
|
|
|
- const msg = new MsgExecute(
|
|
|
- this.key.accAddress,
|
|
|
- '0x9065fda28f52bb14ade545411f02e8e07a9cb4ba',
|
|
|
- 'jennie',
|
|
|
- 'mint_part',
|
|
|
- [],
|
|
|
- [bcs.u8().serialize(item.task).toBase64()],
|
|
|
- )
|
|
|
- msgs.push(msg)
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- // 广播所有消息
|
|
|
- await this.broadcast(msgs)
|
|
|
+ return await this.broadcast(msgs)
|
|
|
}
|
|
|
async claimable() {
|
|
|
//https://xp-api.initiation-1.initia.xyz/xp/claimable/init1w6ftxlsv7y5putq955ymxh2kd0wru7nqshetka
|