improve incompatible events display

This commit is contained in:
liangping 2023-12-26 09:18:04 +08:00
parent 6a4d1952ed
commit 84e26e26ad

View File

@ -122,6 +122,13 @@ function loadAccount(address: string) {
function updateEvent() {
loadAccount(props.address);
}
function mapAmount(events:{type: string, attributes: {key: string, value: string}[]}[]) {
if(!events) return []
return events.find(x => x.type==='coin_received')?.attributes
.filter(x => x.key === 'YW1vdW50'|| x.key === `amount`)
.map(x => x.key==='amount'? x.value : String.fromCharCode(...fromBase64(x.value)))
}
</script>
<template>
<div v-if="account">
@ -571,7 +578,7 @@ function updateEvent() {
</td>
<td class="flex items-center py-3">
<div class="mr-2">
{{ v.events.find(x => x.type==='coin_received')?.attributes.filter(x => x.key === 'YW1vdW50').map(x => String.fromCharCode(...fromBase64(x.value))).join(", ")}}
{{ mapAmount(v.events)?.join(", ")}}
</div>
<Icon
v-if="v.code === 0"