/
LiGovTransaction.vue
114 lines (112 loc) · 2.75 KB
/
LiGovTransaction.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<template>
<li-transaction
:color="`#15CFCC`"
:time="time"
:block="block"
>
<template v-if="txType === `cosmos-sdk/MsgSubmitProposal`">
<div slot="caption">
Submit {{ tx.proposal_type.toLowerCase() }} proposal
<b>{{ initialDeposit.amount }}</b>
<span>{{ initialDeposit.denom }}s</span>
</div>
<div slot="details">
Title: <i>{{ tx.title }}</i>
</div>
<div slot="fees">
Network Fee:
<b>{{ convertedFees ? convertedFees.amount : full(0) }}</b>
<span>{{ convertedFees ? convertedFees.denom : bondingDenom }}s</span>
</div>
</template>
<template v-else-if="txType === `cosmos-sdk/MsgDeposit`">
<div slot="caption">
Deposit
<template>
<b>{{ deposit.amount }}</b>
<span>{{ deposit.denom }}s</span>
</template>
</div>
<div slot="details">
On
<router-link :to="`${url}/${tx.proposal_id}`">
Proposal #{{ tx.proposal_id }}
</router-link>
</div>
<div slot="fees">
Network Fee:
<b>{{ convertedFees ? convertedFees.amount : full(0) }}</b>
<span>{{ fees ? convertedFees.denom : bondingDenom }}s</span>
</div>
</template>
<template v-else-if="txType === `cosmos-sdk/MsgVote`">
<div slot="caption">
Vote {{ tx.option }}
</div>
<div slot="details">
On
<router-link :to="`${url}/${tx.proposal_id}`">
Proposal #{{ tx.proposal_id }}
</router-link>
</div>
<div slot="fees">
Network Fee:
<b>{{ convertedFees ? convertedFees.amount : full(0) }}</b>
<span>{{ convertedFees ? convertedFees.denom : bondingDenom }}s</span>
</div>
</template>
</li-transaction>
</template>
<script>
import LiTransaction from "./LiTransaction"
import num, { full, atoms } from "../../scripts/num.js"
export default {
name: `li-gov-transaction`,
components: { LiTransaction },
props: {
tx: {
type: Object,
required: true
},
fees: {
type: Object,
default: null
},
url: {
type: String,
required: true
},
bondingDenom: {
type: String,
required: true
},
txType: {
type: String,
required: true
},
time: {
type: String,
required: true
},
block: {
type: Number,
required: true
}
},
data: () => ({
full,
atoms
}),
computed: {
initialDeposit() {
return num.viewCoin(this.tx.initial_deposit[0])
},
deposit() {
return num.viewCoin(this.tx.amount[0])
},
convertedFees() {
return this.fees ? num.viewCoin(this.fees) : undefined
}
}
}
</script>