diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 0c8e6ca3..28a5ab78 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -130,6 +130,14 @@ export default class ChainFetch { return this.get(`/cosmos/tx/v1beta1/txs/${hash}`).then(data => WrapStdTx.create(data, ver)) } + async getIBCReceipts(channel_id, port_id, sequence) { + return this.get(`/ibc/core/channel/v1/channels/${channel_id}/ports/${port_id}/packet_receipts/${sequence}`) + } + + async getIBCAcks(channel_id, port_id, sequence) { + return this.get(`/ibc/core/channel/v1/channels/${channel_id}/ports/${port_id}/packet_acks/${sequence}`) + } + async getTxsBySender(sender) { return this.get(`/cosmos/tx/v1beta1/txs?events=message.sender='${sender}'&pagination.reverse=true`) } diff --git a/src/views/Transaction.vue b/src/views/Transaction.vue index c76b83d3..7e90db8d 100644 --- a/src/views/Transaction.vue +++ b/src/views/Transaction.vue @@ -89,7 +89,7 @@ Messages (total: {{ tx.tx.messages.length }}) + + IBC Acknowledgements + + + + { + const x1 = x + if (this.ibcAcks[i]) { + x1.status = this.ibcAcks[i].acknowledgement + } + return x1 + }) + }, + }, created() { const { hash } = this.$route.params this.$http.getTxs(hash).then(res => { this.error = null this.tx = res + res.logs.forEach((log, i) => { + log.events.forEach(e => { + const keys = Object.values(e.attributes).map(x => x.key) + if (keys.includes('packet_src_port')) { + const att = {} + e.attributes.forEach(x => { + att[x.key] = x.value + }) + // console.log(att) + // this.$http.getIBCReceipts(att.packet_dst_channel, att.packet_dst_port, att.packet_sequence).then(re => console.log(re)) + this.$http.getIBCAcks(att.packet_src_channel, att.packet_src_port, att.packet_sequence).then(re => { + this.$set(this.ibcAcks, i, JSON.parse(JSON.stringify(re))) + }) + } + }) + }) }).catch(err => { this.error = err })