Skip to content

Commit

Permalink
tweak (txpool): decoded_tx memo, redeem_id
Browse files Browse the repository at this point in the history
  • Loading branch information
vaultec81 committed Dec 1, 2023
1 parent 740e246 commit 8cebb24
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/services/transactionPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ export class TransactionPoolService {
opts['decoded_tx.amount'] = tx.payload.inputs.map(e => e.amount).reduce((a, b) => {
return a + b;
})
opts['decoded_tx.memo'] = tx.payload.memo;
}

if(op_category === "wrap_mint") {
Expand Down Expand Up @@ -493,6 +494,31 @@ export class TransactionPoolService {
opts['decoded_tx.amount'] = tx.payload.inputs.map(e => e.amount).reduce((a, b) => {
return a + b;
})
const contractInfo = await this.self.contractEngine.contractDb.findOne({
id: tx.contract_id
})
try {
const listPathsCid = await this.self.ipfs.dag.resolve(IPFS.CID.parse(contractInfo.state_merkle), {
path: `outputs/${tx.payload.inputs[0].id}`,
})

const data2 = await this.self.ipfs.dag.get(listPathsCid.cid)
const redeemId = data2.value.outputs.find(e => e.type === "REDEEM").id;

const redeemCid = await this.self.ipfs.dag.resolve(IPFS.CID.parse(contractInfo.state_merkle), {
path: `redeems/${redeemId}`,
})

opts['decoded_tx.redeem_id'] = redeemId
// dest = data2.value.val
// opts['decoded_tx.amount'] = wrapValue
// break;
} catch (ex) {
if (!ex.message.includes('no link named')) {
console.log(ex)
}
// console.log(ex)
}
}


Expand Down

0 comments on commit 8cebb24

Please sign in to comment.