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/1809 update header on send #1830

Merged
merged 132 commits into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from 124 commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
dfe8443
removed several electron references
Jan 3, 2019
99e1237
basic sign in working
Jan 3, 2019
54b7fb5
added scripts for backend
Jan 3, 2019
1b255c1
fixed sign in
Jan 4, 2019
24c3063
fied missing tmdataloading on tabparameters
Jan 5, 2019
605ab52
update to latest tendermint lib
faboweb Jan 5, 2019
699621a
added ssl cert creation readme
faboweb Jan 5, 2019
88d9f65
use nilyra node
faboweb Jan 5, 2019
ac1d988
correct wait for connection on app start
faboweb Jan 5, 2019
80b1132
updated webpack
Jan 5, 2019
f608bab
linted
Jan 6, 2019
b8c200e
updated webpack dev server to work again
Jan 6, 2019
7e2e1d0
import genesis at build time
Jan 6, 2019
de40af8
readd google analytics
Jan 6, 2019
fe1e864
fied tmfield
Jan 6, 2019
65be788
added networks to dev server
Jan 6, 2019
5dc8d80
fixed pageview
Jan 6, 2019
a9e29b2
reconnect on signin
Jan 6, 2019
915a822
Revert "reconnect on signin"
Jan 6, 2019
fbcdd2b
fixed bug on LiProposal
Jan 6, 2019
224db52
increased timeout for waiting for blocks to proof connection
Jan 6, 2019
ba4aefc
Update app/src/renderer/components/common/TmSessionSignIn.vue
fedekunze Jan 7, 2019
1727720
refactor keystore
Jan 9, 2019
795579a
fixed keystore issues
Jan 9, 2019
1882811
made analytics not global
Jan 9, 2019
922fbc7
cleanup package scripts
Jan 9, 2019
cb99b90
cleanup deps
Jan 9, 2019
b3bd8ac
fixes signin feedback
Jan 9, 2019
b99e4c3
enable transactions in prod mode
Jan 9, 2019
f2d624b
removed config.toml
Jan 9, 2019
50e3131
code cleanup
Jan 9, 2019
5b132e5
removed browserified dependencies
Jan 9, 2019
1daf718
Merge branch 'fabo/voyager-web' of https://github.com/cosmos/voyager …
Jan 9, 2019
634f3bb
several
Jan 9, 2019
e1451d2
several tests refactored
Jan 10, 2019
a07fe33
several
Jan 10, 2019
7c12fb1
several
Jan 11, 2019
1d729eb
several
Jan 11, 2019
6ce74c3
remove build test
Jan 11, 2019
aa89193
override write to clipboard in test
Jan 11, 2019
1063a40
more
Jan 11, 2019
1a06f3b
override copy to clipboard in test for btncopy
Jan 11, 2019
27dfc5a
fixed app menu test
Jan 11, 2019
ff1c885
add gos genesis
Jan 11, 2019
4108895
added proxy
Jan 11, 2019
1b011df
added to start script
Jan 11, 2019
daba935
remove logging in prxy
Jan 11, 2019
f684107
refactored connection tests
Jan 11, 2019
401fd0e
fixed tests
Jan 11, 2019
bb47c96
removed network config folder getter script
Jan 11, 2019
cb95dd3
refactored tests
Jan 11, 2019
29d229d
linted
Jan 11, 2019
62b7cef
Merge branch 'fabo/voyager-web' of https://github.com/cosmos/voyager …
Jan 11, 2019
5c1f18b
add wallet test
Jan 11, 2019
2ad991c
added tests for keystroe and wallet
Jan 11, 2019
1589fbd
added salt
Jan 11, 2019
58172b0
linted
Jan 11, 2019
2e0fd07
remove e2e tests for now
Jan 11, 2019
ae15184
Revert "remove e2e tests for now"
Jan 11, 2019
301c857
removed dependency ref
Jan 11, 2019
9b2f668
Merge remote-tracking branch 'refs/remotes/origin/develop'Conflicts: …
Jan 11, 2019
cd10062
changelog
Jan 11, 2019
3476070
reenable console error safe guard
Jan 11, 2019
ca1bb91
fixed snapshots
Jan 11, 2019
533e406
fixed session import
Jan 11, 2019
85f9b0c
redo local testnet creation
Jan 11, 2019
b265381
switched proxy
Jan 12, 2019
35a3b7f
migrate to latest SDK
Jan 12, 2019
d237fdf
add new generate_only logic
Jan 12, 2019
32b188d
Revert "redo local testnet creation"
Jan 11, 2019
e367a42
reenable testnet logic
Jan 12, 2019
f806f22
revert to working SDK
Jan 12, 2019
2678f3d
better start scripts
Jan 12, 2019
6089cee
added skip rebuild
Jan 12, 2019
d2d3639
fixed send snapshot
Jan 12, 2019
3240ce1
linted
Jan 12, 2019
08f7c20
moved to latest SDK
Jan 12, 2019
179aefd
make not creating the nodes the default
Jan 12, 2019
5f9806b
working gen and post
Jan 12, 2019
5541629
working
Jan 12, 2019
15f82b9
comments
Jan 12, 2019
9763faa
remove mnemonic from wallet
Jan 12, 2019
7f2ebf7
stripped console log
Jan 12, 2019
d259b4f
fixed lcdClient + tests
Jan 12, 2019
8521053
fixed send tests
Jan 12, 2019
a1d8da7
fix keystore tests
Jan 12, 2019
37b5172
added send tests
Jan 13, 2019
6659f24
remove caddy binary
Jan 13, 2019
0f2405e
latest working SDK patch
Jan 13, 2019
3f17b2b
reenable error handlers
Jan 13, 2019
5898084
removed commented lines
Jan 13, 2019
088d4d4
removed naviagtor mock
Jan 13, 2019
4f2fd77
fix session sign up
Jan 13, 2019
2d33ee2
cleanup of config
Jan 14, 2019
b3f117e
refactored waiting for node
Jan 14, 2019
079258b
made default gas a config value
Jan 14, 2019
4f095ca
fixed typo
Jan 14, 2019
2e7fa92
a
Jan 14, 2019
4abd6a6
refactor of keystore test
Jan 14, 2019
65fae41
fixed gas config
Jan 14, 2019
9b7d5f6
catch wrong password
Jan 14, 2019
0eb93a1
fixed tests
Jan 14, 2019
34e6e53
fixed tmformmsg
Jan 14, 2019
04dbf70
added coverage for getKey
Jan 14, 2019
ab15cdb
ignore some lines from coverage
Jan 14, 2019
ea5afba
increase coverage user.js
Jan 14, 2019
8d1df58
refactored request postprocessors
Jan 14, 2019
5e128b4
ignore coverage for network.js
Jan 14, 2019
4be4826
removed more theme
Jan 14, 2019
36683fb
added test for main
Jan 14, 2019
f98450b
ignore coverage in google analytics script
Jan 14, 2019
34957b1
removed more theme stuff
Jan 14, 2019
a5188df
disable e2e tests for now
Jan 14, 2019
b420490
go with 2 nodes as the third node fails currently
Jan 14, 2019
4b9349a
updating header correctly and provide liquidAtoms getter
Jan 15, 2019
042d500
Update test/unit/specs/components/governance/PageGovernance.spec.js
fedekunze Jan 16, 2019
1795b46
removed comments
Jan 16, 2019
dcea101
fixed pagevalidator test
Jan 16, 2019
632d08c
Merge branch 'fabo/1809-update-header-on-send' of https://github.com/…
Jan 16, 2019
1ee6a3f
updated tablevalidator jest
Jan 16, 2019
20b3558
added coverage
Jan 16, 2019
8217e52
Merge remote-tracking branch 'origin/web' into fabo/1809-update-heade…
Jan 16, 2019
2115a94
Merge remote-tracking branch 'origin/web' into fabo/1809-update-heade…
Jan 17, 2019
8639fa6
Merge remote-tracking branch 'origin/web' into fabo/1809-update-heade…
Jan 18, 2019
1b4344b
update balance correct after sending
Jan 20, 2019
7ca1ec0
implemented feedback by Karoly
Jan 20, 2019
8f12c2c
fixed integration test
Jan 20, 2019
3e86327
tally bug
Jan 21, 2019
0f62367
fixed serialization of txs
Jan 21, 2019
79491bb
fix circleci audit job
sabau Jan 21, 2019
badf905
fixed tally prop
faboweb Jan 23, 2019
1e7f117
fixed tests
Jan 23, 2019
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [\#1572](https://github.com/cosmos/voyager/issues/1572) Fixed scroll bug when switching between tabs @jbibla
- [\#1749](https://github.com/cosmos/voyager/issues/1749) Fixed proposal tally update after voting @fedekunze
- [\#1765](https://github.com/cosmos/voyager/pull/1765) Fixed proposal deposit update after submitting a deposit @fedekunze
- [\#1791](https://github.com/cosmos/voyager/issue/1791) Fixed a problem with initializing the Voyager config dir @faboweb
- [\#1815](https://github.com/cosmos/voyager/issue/1815) Fixed getters for proposals denominator, reverted to 945803d586b83d65547cd16f4cd5994eac2957ea until interfaces are ready @sabau
- [\#1809](https://github.com/cosmos/voyager/issue/1809) Fixed optimistically updating the header on sending @faboweb
- [\#1791](https://github.com/cosmos/voyager/pull/1791) Fixed a problem with initializing the Voyager config dir @faboweb
- [\#1707](https://github.com/cosmos/voyager/issues/1707) Governance txs are now disabled if the user doesn't hold any min_deposit token @fedekunze
- [\#1815](https://github.com/cosmos/voyager/pull/1815) Fixed getters for proposals denominator, reverted to 945803d586b83d65547cd16f4cd5994eac2957ea until interfaces are ready @sabau
Expand Down
4 changes: 2 additions & 2 deletions app/src/renderer/components/common/TmBalance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ export default {
}
},
computed: {
...mapGetters([`user`, `totalAtoms`, `bondDenom`]),
...mapGetters([`user`, `liquidAtoms`, `totalAtoms`, `bondDenom`]),
address() {
return this.user.address
},
unbondedAtoms() {
return this.num.shortNumber(this.user.atoms)
return this.num.shortNumber(this.liquidAtoms)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! 💧

}
}
}
Expand Down
10 changes: 3 additions & 7 deletions app/src/renderer/components/staking/PageValidator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ export default {
`committedDelegations`,
`config`,
`keybase`,
`oldBondedAtoms`,
`totalAtoms`,
`liquidAtoms`,
`wallet`,
`connected`
]),
Expand Down Expand Up @@ -312,9 +311,6 @@ export default {

// status: active
return `green`
},
availableAtoms() {
return this.totalAtoms - this.oldBondedAtoms
}
},
watch: {
Expand All @@ -332,7 +328,7 @@ export default {
},
onDelegation() {
this.action = `delegate`
if (this.availableAtoms > 0) {
if (this.liquidAtoms > 0) {
this.showDelegationModal = true
} else {
this.showCannotModal = true
Expand Down Expand Up @@ -415,7 +411,7 @@ export default {
let myWallet = [
{
address: this.wallet.address,
maximum: Math.floor(this.totalAtoms - this.oldBondedAtoms),
maximum: Math.floor(this.liquidAtoms),
key: `My Wallet - ${shortAddress(this.wallet.address, 20)}`,
value: 0
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/renderer/components/staking/TableValidators.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default {
`committedDelegations`,
`config`,
`user`,
`liquidAtoms`,
`connected`,
`bondDenom`,
`keybase`
Expand Down Expand Up @@ -110,7 +111,7 @@ export default {
}
},
userCanDelegate() {
return this.user.atoms > 0 && this.delegation.loaded
return this.liquidAtoms > 0 && this.delegation.loaded
},
properties() {
return [
Expand Down
9 changes: 5 additions & 4 deletions app/src/renderer/components/wallet/PageSend.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,12 @@ export default {
let denom = this.fields.denom
try {
let type = `send`
await this.sendTx({
await this.sendCoins({
type,
password: this.fields.password,
to: address,
amount: [{ denom, amount: amount.toString() }]
receiver: address,
denom,
amount
})
this.sending = false
this.$store.commit(`notify`, {
Expand Down Expand Up @@ -271,7 +272,7 @@ export default {
return false
}
},
...mapActions([`sendTx`])
...mapActions([`sendCoins`])
},
validations() {
return {
Expand Down
8 changes: 7 additions & 1 deletion app/src/renderer/vuex/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ export const allTransactions = state =>
export const wallet = state => state.wallet

// staking
export const liquidAtoms = state =>
(
state.wallet.balances.find(
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
balance => balance.denom === state.stakingParameters.parameters.bond_denom
) || { amount: 0 }
).amount
export const delegation = state => state.delegation
export const totalAtoms = (state, getters) => {
return new BN(getters.user.atoms)
return new BN(getters.liquidAtoms)
.plus(new BN(getters.oldBondedAtoms))
.plus(new BN(getters.oldUnbondingAtoms))
.toString()
Expand Down
8 changes: 6 additions & 2 deletions app/src/renderer/vuex/modules/delegation.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ export default ({ node }) => {
},
async submitDelegation(
{
rootState: { stakingParameters, user, wallet },
rootState: { stakingParameters, wallet },
getters: { liquidAtoms },
state,
dispatch,
commit
Expand All @@ -165,7 +166,10 @@ export default ({ node }) => {
})

// optimistic update the atoms of the user before we get the new values from chain
commit(`setAtoms`, user.atoms - amount)
commit(`updateWalletBalance`, {
denom,
amount: liquidAtoms - amount
})
// optimistically update the committed delegations
Vue.set(
faboweb marked this conversation as resolved.
Show resolved Hide resolved
state.committedDelegates,
Expand Down
3 changes: 0 additions & 3 deletions app/src/renderer/vuex/modules/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ export default ({}) => {
setAccounts(state, accounts) {
state.accounts = accounts
},
setAtoms(state, atoms) {
state.atoms = atoms
},
addHistory(state, path) {
state.history.push(path)
state.externals.track(`pageview`, {
Expand Down
39 changes: 31 additions & 8 deletions app/src/renderer/vuex/modules/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ export default ({ node }) => {
state.balances = balances
state.loading = false
},
updateWalletBalance(state, balance) {
let updated = false
state.balances = state.balances.map(oldBalance => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

if (oldBalance.denom === balance.denom) {
updated = true
return balance
}
return oldBalance
})

if (!updated) {
state.balances.push(balance)
}
},
setWalletAddress(state, address) {
state.address = address
},
Expand Down Expand Up @@ -64,14 +78,6 @@ export default ({ node }) => {
commit(`setNonce`, res.sequence)
commit(`setAccountNumber`, res.account_number)
commit(`setWalletBalances`, coins)
for (let coin of coins) {
if (
coin.denom === rootState.stakingParameters.parameters.bond_denom
) {
commit(`setAtoms`, parseFloat(coin.amount))
break
}
}
state.loading = false
state.loaded = true
} catch (error) {
Expand All @@ -83,6 +89,23 @@ export default ({ node }) => {
state.error = error
}
},
async sendCoins(
{ dispatch, commit, state },
{ receiver, amount, denom, password }
) {
await dispatch(`sendTx`, {
type: `send`,
password,
to: receiver,
amount: [{ denom, amount: amount.toString() }]
})

const oldBalance = state.balances.find(balance => balance.denom === denom)
commit(`updateWalletBalance`, {
denom,
amount: oldBalance.amount - amount
})
},
async loadDenoms({ commit, state }) {
try {
const { genesis } = await network()
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/components/common/TmBalance.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ describe(`TmBalance`, () => {
getters: {
user: () => {
return {
atoms: 123,
address: `useraddress16876876876876876786876876876876876`
}
},
liquidAtoms: () => 123,
totalAtoms: () => {
return 321
}
Expand Down
8 changes: 5 additions & 3 deletions test/unit/specs/components/governance/PageGovernance.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ const proposal = {
type: `Text`,
password: `1234567890`
}
const { governanceParameters, stakingParameters } = lcdClientMock.state
const { governanceParameters } = lcdClientMock.state
const depositDenom = governanceParameters.deposit.min_deposit[0].denom

// TODO: refactor according to new unit test standard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

describe(`PageGovernance`, () => {
let wrapper, store
let { mount, localVue } = setup()
Expand All @@ -25,15 +26,16 @@ describe(`PageGovernance`, () => {
let instance = mount(PageGovernance, {
doBefore: ({ store }) => {
store.commit(`setGovParameters`, governanceParameters)
store.commit(`setStakingParameters`, stakingParameters.parameters)
store.commit(`setConnected`, true)
},
stubs: {
"tm-balance": true
}
})
wrapper = instance.wrapper
store = instance.store
store.state.user.address = lcdClientMock.addresses[0]
store.dispatch(`updateDelegates`)
store.commit(`setAtoms`, 1337)
})

it(`has the expected html structure`, async () => {
Expand Down
10 changes: 8 additions & 2 deletions test/unit/specs/components/governance/TableProposals.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ describe(`TableProposals`, () => {
doBefore: ({ store }) => {
store.commit(`setConnected`, true)
store.state.user.address = `address1234`
store.commit(`setAtoms`, 1337)
store.commit(`updateWalletBalance`, {
denom: `atom`,
amount: 1337
})
for (const [proposal_id, tally_result] of Object.entries(tallies)) {
store.commit(`setProposalTally`, { proposal_id, tally_result })
}
Expand Down Expand Up @@ -83,7 +86,10 @@ describe(`TableProposals`, () => {
doBefore: ({ store }) => {
store.commit(`setConnected`, true)
store.state.user.address = `address1234`
store.commit(`setAtoms`, 1337)
store.commit(`updateWalletBalance`, {
denom: `atom`,
amount: 1337
})
},
propsData: { proposals: {} },
stubs: { "data-empty-search": true }
Expand Down
Loading