Skip to content

Commit

Permalink
Merge pull request #2135 from cosmos/fedekunze/1805-add-remaining-txs
Browse files Browse the repository at this point in the history
add missing transactions
  • Loading branch information
faboweb authored Mar 7, 2019
2 parents 3028c41 + f03d7a0 commit f3c0cfd
Show file tree
Hide file tree
Showing 50 changed files with 2,165 additions and 2,070 deletions.
6 changes: 5 additions & 1 deletion PENDING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## [Unreleased]

### Added

- [\#2104](https://github.com/cosmos/voyager/issues/2104) fix transaction times @fedekunze

### Changed

- [#\2202](https://github.com/cosmos/voyager/pull/2202) Fix circle configuration for publishing @sabau

- [\#1805](https://github.com/cosmos/voyager/issues/1805) support all transaction types @fedekunze
2 changes: 1 addition & 1 deletion app/src/renderer/components/common/ActionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<img
class="icon action-modal-atom"
src="~assets/images/cosmos-logo.png"
/>
>
<span class="action-modal-title">
{{ session.signedIn ? title : `Sign in required` }}
</span>
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/common/TmHardwareState.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="tm-hardware-state">
<img v-if="loading" src="~assets/images/loader.svg" >
<img v-if="loading" src="~assets/images/loader.svg">
<i class="tm-hardware-state__icon material-icons">{{ icon }}</i>
<div class="tm-hardware-state__label">
<slot />
Expand Down
12 changes: 6 additions & 6 deletions app/src/renderer/components/governance/PageProposal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
<dt>Proposal Status</dt>
<dd>
{{
proposal.proposal_status === `DepositPeriod`
? `Deposit period ends ${depositEndsIn}.`
: `Voting started ${votingStartedAgo}.`
proposal.proposal_status === `DepositPeriod`
? `Deposit period ends ${depositEndsIn}.`
: `Voting started ${votingStartedAgo}.`
}}
</dd>
</dl>
Expand All @@ -77,9 +77,9 @@
<dt>Deposit Count</dt>
<dd>
{{
num.atoms(proposal.total_deposit[0].amount) +
` ` +
proposal.total_deposit[0].denom
num.atoms(proposal.total_deposit[0].amount) +
` ` +
proposal.total_deposit[0].denom
}}
</dd>
</dl>
Expand Down
30 changes: 15 additions & 15 deletions app/src/renderer/components/staking/TabMyDelegations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</h3>
<div class="unbonding-transactions">
<template v-for="transaction in unbondingTransactions">
<tm-li-stake-transaction
<li-stake-transaction
:key="transaction.hash"
:transaction="transaction"
:validators="yourValidators"
Expand All @@ -37,6 +37,7 @@
delegation.unbondingDelegations
)
"
tx-type="cosmos-sdk/Undelegate"
/>
</template>
</div>
Expand All @@ -46,7 +47,7 @@

<script>
import { mapGetters } from "vuex"
import TmLiStakeTransaction from "../transactions/TmLiStakeTransaction"
import LiStakeTransaction from "../transactions/LiStakeTransaction"
import TmDataMsg from "common/TmDataMsg"
import CardSignInRequired from "common/CardSignInRequired"
import TmDataLoading from "common/TmDataLoading"
Expand All @@ -61,7 +62,7 @@ export default {
TmDataMsg,
TmDataConnecting,
TmDataLoading,
TmLiStakeTransaction,
LiStakeTransaction,
CardSignInRequired
},
data: () => ({
Expand All @@ -71,7 +72,7 @@ export default {
}),
computed: {
...mapGetters([
`allTransactions`,
`transactions`,
`delegates`,
`delegation`,
`committedDelegations`,
Expand All @@ -84,26 +85,25 @@ export default {
({ operator_address }) => operator_address in committedDelegations
)
},
unbondingTransactions: ({ allTransactions, delegation } = this) =>
// TODO still needed?
allTransactions
unbondingTransactions: ({ transactions, delegation } = this) =>
// Checking the type of transaction
// getting the unbonding time and checking if it has passed already
transactions.staking && transactions.staking
.filter(
transaction =>
// Checking the type of transaction
transaction.tx.value.msg[0].type === `cosmos-sdk/Undelegate` &&
// getting the unbonding time and checking if it has passed already
time.getUnbondingTime(
transaction.tx.value.msg[0].type === `cosmos-sdk/Undelegate`
&& time.getUnbondingTime(
transaction,
delegation.unbondingDelegations
) >= Date.now()
)
.map(transaction => ({
...transaction,
unbondingDelegation:
delegation.unbondingDelegations[
transaction.tx.value.msg[0].value.validator_addr
]
unbondingDelegation: delegation.unbondingDelegations[
transaction.tx.value.msg[0].value.validator_addr
]
}))
},
mounted() {
this.$store.dispatch(`updateDelegates`)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,58 @@
<template>
<tm-li-bank-transaction
<li-bank-transaction
v-if="bankTx"
:transaction="transaction"
:address="address"
/>
<tm-li-stake-transaction
<li-stake-transaction
v-else-if="stakingTx"
:transaction="transaction"
:validators="validators"
:url="validatorsUrl"
:unbonding-time="unbondingTime"
:bonding-denom="bondingDenom"
@end-unbonding="$emit('end-unbonding')"
:tx-type="type"
/>
<tm-li-gov-transaction
<li-gov-transaction
v-else-if="governanceTx"
:transaction="transaction"
:bonding-denom="bondingDenom"
:url="proposalsUrl"
:tx-type="type"
/>
<tm-li-transaction
<li-distribution-transaction
v-else-if="distributionTx"
:transaction="transaction"
:url="validatorsUrl"
:bonding-denom="bondingDenom"
:tx-type="type"
:validators="validators"
/>
<li-transaction
v-else
:color="colors.grey"
:time="transaction.time"
:block="transaction.height"
color="grey"
>
<span slot="caption">Unknown Transaction Type</span>
</tm-li-transaction>
</li-transaction>
</template>

<script>
import TmLiBankTransaction from "./TmLiBankTransaction"
import TmLiStakeTransaction from "./TmLiStakeTransaction"
import TmLiGovTransaction from "./TmLiGovTransaction"
import TmLiTransaction from "./TmLiTransaction"
import colors from "./transaction-colors.js"
import LiBankTransaction from "./LiBankTransaction"
import LiStakeTransaction from "./LiStakeTransaction"
import LiGovTransaction from "./LiGovTransaction"
import LiDistributionTransaction from "./LiDistributionTransaction"
import LiTransaction from "./LiTransaction"
export default {
name: `TmLiAnyTransaction`,
name: `li-any-transaction`,
components: {
TmLiBankTransaction,
TmLiGovTransaction,
TmLiStakeTransaction,
TmLiTransaction
LiBankTransaction,
LiGovTransaction,
LiStakeTransaction,
LiDistributionTransaction,
LiTransaction
},
props: {
transaction: {
Expand Down Expand Up @@ -74,7 +84,6 @@ export default {
default: null
}
},
data: () => ({ colors }),
computed: {
type() {
return this.transaction.tx.value.msg[0].type
Expand All @@ -84,16 +93,27 @@ export default {
},
stakingTx() {
return [
`cosmos-sdk/MsgCreateValidator`,
`cosmos-sdk/MsgEditValidator`,
`cosmos-sdk/MsgDelegate`,
`cosmos-sdk/Undelegate`,
`cosmos-sdk/CompleteUnbonding`,
`cosmos-sdk/BeginRedelegate`
`cosmos-sdk/BeginRedelegate`,
`cosmos-sdk/MsgUnjail`
].includes(this.type)
},
governanceTx() {
return [`cosmos-sdk/MsgSubmitProposal`, `cosmos-sdk/MsgDeposit`].includes(
this.type
)
return [
`cosmos-sdk/MsgSubmitProposal`,
`cosmos-sdk/MsgDeposit`,
`cosmos-sdk/MsgVote`
].includes(this.type)
},
distributionTx() {
return [
`cosmos-sdk/MsgSetWithdrawAddress`,
`cosmos-sdk/MsgWithdrawDelegationReward`,
`cosmos-sdk/MsgWithdrawValidatorCommission`
].includes(this.type)
}
}
}
Expand Down
75 changes: 75 additions & 0 deletions app/src/renderer/components/transactions/LiBankTransaction.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<li-transaction
:color="`#ED553B`"
:time="transaction.time"
:block="transaction.height"
>
<template v-if="sent">
<div slot="caption">
Sent&nbsp;<b>{{ atoms(coins.amount) }}</b><span>&nbsp;{{ coins.denom.toUpperCase() }}</span>
</div>
<span
slot="details"
>
<template
v-if="sentSelf"
>
To yourself!
</template><template
v-else
>
To {{ receiver }}
</template>
</span>
</template><template v-else>
<div slot="caption">
Received&nbsp;<b>{{ atoms(coins.amount) }}</b><span>&nbsp;{{ coins.denom.toUpperCase() }}</span>
</div>
<span slot="details">From {{ sender }}</span>
</template>
</li-transaction>
</template>

<script>
import LiTransaction from "./LiTransaction"
import { atoms } from "../../scripts/num.js"
export default {
name: `li-bank-transaction`,
components: { LiTransaction },
props: {
transaction: {
type: Object,
required: true
},
address: {
type: String,
default: null
}
},
data: () => ({
atoms
}),
computed: {
tx() {
return this.transaction.tx.value.msg[0].value
},
// TODO: sum relevant inputs/outputs
sentSelf() {
return this.tx.from_address === this.tx.to_address
},
sent() {
return this.tx.from_address === this.address
},
sender() {
return this.tx.from_address
},
coins() {
return this.tx.amount[0]
},
receiver() {
return this.tx.to_address
}
}
}
</script>
Loading

0 comments on commit f3c0cfd

Please sign in to comment.