Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fabo/1433 migrate to latest sdk #1450

Merged
merged 28 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed

* Changed minor component of version number to match testnet version. @NodeGuy
* [\#1433](https://github.com/cosmos/voyager/issues/1433) Migrated to latest SDK commit 6c9e71b654995b22e3ba4d121553ab20432616a9. @faboweb
* [\#1183](https://github.com/cosmos/voyager/issues/1183) Changed a bunch of JavaScript files to strict mode. @NodeGuy
* Updated contribution guidelines. @faboweb
* [\#1447](https://github.com/cosmos/voyager/issues/1447) Removed titles from all pages. @faboweb
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,18 @@ async function startLCD(home, nodeURL) {
return new Promise(async (resolve, reject) => {
log(`startLCD`, home)
let child = startProcess(LCD_BINARY_NAME, [
`advanced`,
`rest-server`,
`--insecure`,
`--laddr`,
`tcp://localhost:${LCD_PORT}`,
`--home`,
home,
`--node`,
nodeURL,
`--chain-id`,
chainId
chainId,
`--trust-node`,
true
])
logProcess(child, join(home, `lcd.log`))

Expand Down Expand Up @@ -493,7 +495,7 @@ async function pickAndConnect() {
}

async function connect() {
log(`starting gaia rest server with nodeURL ${config.lcd_rpc}`)
log(`starting gaia rest server with nodeURL ${config.node_lcd}`)
try {
lcdProcess = await startLCD(lcdHome, config.node_rpc)
log(`gaia rest server ready`)
Expand Down
4 changes: 2 additions & 2 deletions app/src/renderer/components/staking/LiValidator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ li.li-validator(:class='styles')
img.avatar(v-else src="~assets/images/validator-icon.svg" width="48" height="48")
.vert
.top {{ validator.description.moniker }}
short-bech32(:address="validator.pub_key")
short-bech32(:address="validator.operator_address")
.li-validator__value.your-votes
span {{ yourVotes.isLessThan(0.01) && yourVotes.isGreaterThan(0) ? '< ' + num.full(0.01) : num.full(yourVotes) }}
.li-validator__value.your-rewards
Expand Down Expand Up @@ -43,7 +43,7 @@ export default {
return `n/a` //TODO: add slashes
},
commission() {
return `${this.num.pretty(this.validator.commission)}%`
return `${this.num.pretty(this.validator.commission.rate)}%`
},
uptime() {
let rollingWindow = 10000 // param of slashing period
Expand Down
46 changes: 3 additions & 43 deletions app/src/renderer/components/staking/PageStaking.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ tm-page(data-title="Staking")
</template>

<script>
import { mapGetters } from "vuex"
import { mapGetters, mapActions } from "vuex"
import num from "scripts/num"
import { includes, orderBy } from "lodash"
import Mousetrap from "mousetrap"
import { TmBtn, TmPage, TmDataEmpty, TmDataLoading } from "@tendermint/ui"
import DataEmptySearch from "common/TmDataEmptySearch"
import { calculateTokens } from "scripts/common"
import ModalSearch from "common/TmModalSearch"
import PanelSort from "staking/PanelSort"
import VmToolBar from "common/VmToolBar"
Expand Down Expand Up @@ -63,45 +61,6 @@ export default {
somethingToSearch() {
return !!this.delegates.delegates.length
},
vpTotal() {
return this.delegates.delegates
.slice(0)
.map(v => {
v.voting_power = v.voting_power ? Number(v.voting_power) : 0
return v
})
.sort((a, b) => b.voting_power - a.voting_power)
.slice(0, 100)
.reduce((sum, v) => sum + v.voting_power, 0)
},
enrichedDelegates() {
return !this.somethingToSearch
? []
: this.delegates.delegates.map(v => {
v.small_moniker = v.description.moniker.toLowerCase()
v.percent_of_vote = num.percent(v.voting_power / this.vpTotal)
v.your_votes = this.num.full(
calculateTokens(v, this.committedDelegations[v.id])
)
v.keybase = this.keybase[v.description.identity]
return v
})
},
sortedFilteredEnrichedDelegates() {
let query = this.filters.delegates.search.query || ``
let sortedEnrichedDelegates = orderBy(
this.enrichedDelegates.slice(0),
[this.sort.property, `small_moniker`],
[this.sort.order, `asc`]
)
if (this.filters.delegates.search.visible) {
return sortedEnrichedDelegates.filter(i =>
includes(JSON.stringify(i).toLowerCase(), query.toLowerCase())
)
} else {
return sortedEnrichedDelegates
}
},
properties() {
return [
{
Expand Down Expand Up @@ -159,7 +118,8 @@ export default {
setSearch(bool = !this.filters[`delegates`].search.visible) {
if (!this.somethingToSearch) return false
this.$store.commit(`setSearchVisible`, [`delegates`, bool])
}
},
...mapActions([`updateDelegates`])
},
async mounted() {
Mousetrap.bind([`command+f`, `ctrl+f`], () => this.setSearch(true))
Expand Down
38 changes: 21 additions & 17 deletions app/src/renderer/components/staking/PageValidator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ tm-page(data-title="Validator")
div.validator-profile__status-and-title
span.validator-profile__status(v-bind:class="statusColor" v-tooltip.top="status")
.validator-profile__header__name__title {{ validator.description.moniker }}
short-bech32(:address="validator.pub_key")
short-bech32(:address="validator.operator_address")
.column.validator-profile__header__actions
tm-btn#delegation-btn(value="Delegate" color="primary" @click.native="onDelegation")

Expand All @@ -43,7 +43,7 @@ tm-page(data-title="Validator")
dd(id="validator-profile__uptime") {{ validator.signing_info ? pretty(validator.signing_info.signed_blocks_counter/100) : `n/a`}} %
dl.colored_dl
dt Commission
dd(id="validator-profile__commission") {{ validator.commission }} %
dd(id="validator-profile__commission") {{ validator.commission.rate }} %
dl.colored_dl(v-if="config.devMode")
dt Slashes
dd n/a
Expand All @@ -52,8 +52,8 @@ tm-page(data-title="Validator")
.row
.column
dl.info_dl
dt Owner
dd {{validator.owner}}
dt Operator
dd {{validator.operator_address}}
dl.info_dl
dt Keybase ID
dd {{translateEmptyDescription(validator.description.identity)}}
Expand All @@ -69,16 +69,16 @@ tm-page(data-title="Validator")
.column
dl.info_dl
dt Commission Rate
dd {{validator.commission}} %
dd {{validator.commission.rate}} %
dl.info_dl
dt Max Commission Rate
dd {{validator.commission_max}} %
dl.info_dl
dt Commission Change Today
dd {{validator.commission_change_today}} %
dd {{validator.commission.max_rate}} %
dl.info_dl
dt Max Daily Commission Change
dd {{validator.commission_change_rate}} %
dd {{validator.commission.max_change_rate}} %
dl.info_dl
dt Last Commission Change
dd {{new Date(validator.commission.update_time).getTime() === 0 ? 'Never' : moment(new Date(validator.commission.update_time)).fromNow() }}
dl.info_dl
dt Self Bonded {{bondingDenom}}
dd(id="validator-profile__self-bond") {{selfBond}} %
Expand All @@ -91,7 +91,7 @@ tm-page(data-title="Validator")
v-on:submitDelegation="submitDelegation"
:showDelegationModal.sync="showDelegationModal"
:fromOptions="delegationTargetOptions()"
:to="validator.owner"
:to="validator.operator_address"
)

undelegation-modal(
Expand All @@ -113,6 +113,7 @@ tm-page(data-title="Validator")
</template>

<script>
import moment from "moment"
import { calculateTokens } from "scripts/common"
import { mapGetters } from "vuex"
import num from "scripts/num"
Expand Down Expand Up @@ -148,7 +149,8 @@ export default {
showUndelegationModal: false,
shortAddress,
tabIndex: 1,
action: ``
action: ``,
moment
}),
computed: {
...mapGetters([
Expand All @@ -164,7 +166,7 @@ export default {
]),
validator() {
let validator = this.delegates.delegates.find(
v => this.$route.params.validator === v.owner
v => this.$route.params.validator === v.operator_address
)
if (validator)
validator.keybase = this.keybase[validator.description.identity]
Expand All @@ -178,7 +180,7 @@ export default {
myBond() {
return calculateTokens(
this.validator,
this.committedDelegations[this.validator.owner] || 0
this.committedDelegations[this.validator.operator_address] || 0
)
},
powerRatio() {
Expand Down Expand Up @@ -267,7 +269,9 @@ export default {
txBody = `redelegated`
txAction = `redelegating`

let validatorFrom = this.delegates.delegates.find(v => from === v.owner)
let validatorFrom = this.delegates.delegates.find(
v => from === v.operator_address
)

stakingTransactions.redelegations = [
{
Expand Down Expand Up @@ -364,13 +368,13 @@ export default {
.filter(address => address != this.$route.params.validator)
.map((address, index) => {
let delegate = this.delegates.delegates.find(function(validator) {
return validator.owner === address
return validator.operator_address === address
})
return {
address: address,
maximum: Math.floor(this.committedDelegations[address]),
key: `${delegate.description.moniker} - ${shortAddress(
delegate.owner,
delegate.operator_address,
20
)}`,
value: index + 1
Expand Down
8 changes: 3 additions & 5 deletions app/src/renderer/components/staking/TabValidators.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</template>

<script>
import { mapGetters } from "vuex"
import { mapGetters, mapActions } from "vuex"
import num from "scripts/num"
import { includes, orderBy } from "lodash"
import Mousetrap from "mousetrap"
Expand Down Expand Up @@ -163,13 +163,11 @@ export default {
}
},
methods: {
updateDelegates() {
this.$store.dispatch(`updateDelegates`)
},
setSearch(bool = !this.filters[`delegates`].search.visible) {
if (!this.somethingToSearch) return false
this.$store.commit(`setSearchVisible`, [`delegates`, bool])
}
},
...mapActions([`updateDelegates`])
},
async mounted() {
Mousetrap.bind([`command+f`, `ctrl+f`], () => this.setSearch(true))
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/wallet/PageSend.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ tm-page(data-title='Send')

p(v-if='mockedConnector')
span Try sending to the address "
strong(style="font-weight: bold") cosmosaccaddr1p6zajjw6xged056andyhn62lm7axwzyspkzjq0
strong(style="font-weight: bold") cosmos1p6zajjw6xged056andyhn62lm7axwzyspkzjq0
span ", it's a friendly bot which will send the money back to you!
br(v-if='mockedConnector')

Expand Down
5 changes: 2 additions & 3 deletions app/src/renderer/connectors/lcdClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Client {
}
}

let fetchAccount = argReq(`GET`, `/accounts`)
let fetchAccount = argReq(`GET`, `/auth/accounts`)

Object.assign(Client.prototype, {
// meta
Expand All @@ -68,8 +68,7 @@ Object.assign(Client.prototype, {
deleteKey: argReq(`DELETE`, `/keys`),

// coins
send: argReq(`POST`, `/accounts`, `/send`),
ibcSend: argReq(`POST`, `/ibc`, `/send`),
send: argReq(`POST`, `/bank/accounts`, `/transfers`),
queryAccount(address) {
return fetchAccount
.call(this, address)
Expand Down
Loading