Skip to content

Commit

Permalink
Merge pull request #2280 from cosmos/fedekunze/2273-fix-atoms
Browse files Browse the repository at this point in the history
Hotfix: fix atoms and yarn
  • Loading branch information
faboweb authored Mar 15, 2019
2 parents 3e49d77 + e097de2 commit d047486
Show file tree
Hide file tree
Showing 27 changed files with 103 additions and 96 deletions.
18 changes: 12 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [1.0.0-beta.20] - 2019-03-15

### Fixed

- [\#2273](https://github.com/cosmos/voyager/issues/2273) fixed atoms and uatoms conversion @fedekunze

## [1.0.0-beta.19] - 2019-03-15

### Added

- [\#2263](https://github.com/cosmos/voyager/pull/2263) Added guide on how to connect via a local full node to any network @faboweb

### Fixed

- Fix for inflation on our testnet
- [\#2257](https://github.com/cosmos/voyager/pull/2257) fixed console error on page validator if loading the page from URL @faboweb

### Changed

- [\#1337](https://github.com/cosmos/voyager/issues/1337) refactor unit tests: Page404, ShortBech32 @fedekunze
- [\#2255](https://github.com/cosmos/voyager/pull/2255) removed onboarding tutorial @fedekunze
- [\#2259](https://github.com/cosmos/voyager/issues/2259) removed PagePreferences @fedekunze
- [\#1337](https://github.com/cosmos/voyager/issues/1337) refactor unit tests: Page404, ShortBech32 @fedekunze

### Fixed

- Fix for inflation on our testnet
- [\#2257](https://github.com/cosmos/voyager/pull/2257) fixed console error on page validator if loading the page from URL @faboweb


## [1.0.0-beta.18] - 2019-03-14
Expand Down
12 changes: 6 additions & 6 deletions app/src/renderer/scripts/num.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import BigNumber from "bignumber.js"
* @module num
*/

const SMALLEST = 1e-7
const SMALLEST = 1e-6
const language = window.navigator.userLanguage || window.navigator.language
function full(number = 0) {
return new Intl.NumberFormat(language, { minimumFractionDigits: 7 })
return new Intl.NumberFormat(language, { minimumFractionDigits: 6 })
.format(number)
}
function shortNumber(number = 0) {
Expand All @@ -29,12 +29,12 @@ function prettyDecimals(number = 0) {
).format(number)

// remove all trailing zeros
while(longDecimals.charAt(longDecimals.length - 1) === `0`) {
while (longDecimals.charAt(longDecimals.length - 1) === `0`) {
longDecimals = longDecimals.substr(0, longDecimals.length - 1)
}

// remove decimal separator from whole numbers
if(Number.isNaN(Number(longDecimals.charAt(longDecimals.length - 1)))) {
if (Number.isNaN(Number(longDecimals.charAt(longDecimals.length - 1)))) {
longDecimals = longDecimals.substr(0, longDecimals.length - 1)
}

Expand All @@ -53,10 +53,10 @@ function percent(number = 0) {
).format(Math.round(number * 10000) / 100) + `%`
}
function atoms(number = 0) {
return BigNumber(number).div(10e6).toNumber()
return BigNumber(number).div(1e6).toNumber()
}
function uatoms(number = 0) {
return BigNumber(number).times(10e6).toString()
return BigNumber(number).times(1e6).toString()
}

module.exports = {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cosmos-voyager",
"productName": "Cosmos Voyager",
"version": "1.0.0-beta.19",
"version": "1.0.0-beta.20",
"description": "Voyager is an electron-based user interface for the Cosmos Network.",
"author": "All In Bits, Inc <[email protected]>",
"license": "Apache-2.0",
Expand Down Expand Up @@ -149,4 +149,4 @@
"vuelidate": "0.7.3",
"vuex": "3.0.1"
}
}
}
4 changes: 2 additions & 2 deletions test/unit/specs/components/common/TmBalance.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ describe(`TmBalance`, () => {
})

it(`displays unbonded tokens`, () => {
expect(wrapper.vm.unbondedAtoms).toBe(`123.0000…`)
expect(wrapper.vm.unbondedAtoms).toBe(`1,230.0000…`)
})
it(`gets user rewards`, () => {
expect(wrapper.vm.rewards).toBe(`100,045.0000…`)
expect(wrapper.vm.rewards).toBe(`1,000,450.0000…`)
})

it(`shows 0 if user doesn't have rewards`, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exports[`TmBalance has the expected html structure before adding props 1`] = `
class="total-atoms__value"
>
321.0000…
3,210.0000…
</h2>
Expand All @@ -44,7 +44,7 @@ exports[`TmBalance has the expected html structure before adding props 1`] = `
</h3>
<h2>
123.0000…
1,230.0000…
</h2>
</div>
Expand All @@ -56,7 +56,7 @@ exports[`TmBalance has the expected html structure before adding props 1`] = `
</h3>
<h2>
100,045.0000…
1,000,450.0000…
</h2>
<tm-btn-stub
Expand Down
8 changes: 4 additions & 4 deletions test/unit/specs/components/governance/ModalDeposit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ describe(`ModalDeposit`, () => {
let wrapper, store
const { mount, localVue } = setup()
localVue.use(Vuelidate)
localVue.directive(`tooltip`, () => {})
localVue.directive(`focus`, () => {})
localVue.directive(`tooltip`, () => { })
localVue.directive(`focus`, () => { })

beforeEach(async () => {
const coins = [
Expand Down Expand Up @@ -68,7 +68,7 @@ describe(`ModalDeposit`, () => {
})

it(`when the amount deposited higher than the user's balance`, async () => {
wrapper.setData({ amount: 25 })
wrapper.setData({ amount: 250 })
expect(wrapper.vm.validateForm()).toBe(false)
await wrapper.vm.$nextTick()
const errorMessage = wrapper.find(`input#amount + div`)
Expand Down Expand Up @@ -110,7 +110,7 @@ describe(`ModalDeposit`, () => {
{
amount: [
{
amount: `100000000`,
amount: `10000000`,
denom: `stake`
}
],
Expand Down
4 changes: 2 additions & 2 deletions test/unit/specs/components/governance/ModalPropose.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe(`ModalPropose`, () => {

it(`if the amount for initial deposit is higher than the user's balance`, async () => {
wrapper.setData(inputs)
wrapper.setData({ amount: 25 })
wrapper.setData({ amount: 250 })
await wrapper.vm.$nextTick()
expect(wrapper.vm.validateForm()).toBe(false)
await wrapper.vm.$nextTick()
Expand Down Expand Up @@ -162,7 +162,7 @@ describe(`ModalPropose`, () => {
`submitProposal`,
{
description: `a valid description for the proposal`,
initial_deposit: [{ amount: `150000000`, denom: `stake` }],
initial_deposit: [{ amount: `15000000`, denom: `stake` }],
title: `A new text proposal for Cosmos`,
type: `Text`,
password: `1234567890`,
Expand Down
6 changes: 3 additions & 3 deletions test/unit/specs/components/governance/TabParameters.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ describe(`TabParameters`, () => {
let wrapper, store
const { mount, localVue } = setup()
localVue.use(Vuelidate)
localVue.directive(`tooltip`, () => {})
localVue.directive(`focus`, () => {})
localVue.directive(`tooltip`, () => { })
localVue.directive(`focus`, () => { })

const $store = {
commit: jest.fn(),
Expand Down Expand Up @@ -47,7 +47,7 @@ describe(`TabParameters`, () => {
})

it(`displays the minimum deposit`, () => {
expect(wrapper.vm.minimumDeposit).toEqual(`10 STAKEs`)
expect(wrapper.vm.minimumDeposit).toEqual(`100 STAKEs`)
})

it(`displays deposit period in days`, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,31 @@ exports[`LiProposal has the expected html structure 1`] = `
class="li-proposal__value yes"
>
500
5000
</td>
<td
class="li-proposal__value no"
>
25
250
</td>
<td
class="li-proposal__value no_with_veto"
>
10
100
</td>
<td
class="li-proposal__value abstain"
>
56
560
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ exports[`PageProposal has the expected html structure if user has signed in 1`]
<dd>
200 stake
2000 stake
</dd>
</dl>
Expand Down Expand Up @@ -302,7 +302,7 @@ exports[`PageProposal renders votes in HTML when voting is open 1`] = `
<dd>
200 stake
2000 stake
</dd>
</dl>
Expand All @@ -315,7 +315,7 @@ exports[`PageProposal renders votes in HTML when voting is open 1`] = `
</dt>
<dd>
1000
10000
</dd>
</dl>
</div>
Expand All @@ -335,7 +335,7 @@ exports[`PageProposal renders votes in HTML when voting is open 1`] = `
</dt>
<dd>
100 / 10%
1000 / 10%
</dd>
</dl>
Expand All @@ -347,7 +347,7 @@ exports[`PageProposal renders votes in HTML when voting is open 1`] = `
</dt>
<dd>
200 / 20%
2000 / 20%
</dd>
</dl>
Expand All @@ -360,7 +360,7 @@ exports[`PageProposal renders votes in HTML when voting is open 1`] = `
<dd>
300 / 30%
3000 / 30%
</dd>
</dl>
Expand All @@ -373,7 +373,7 @@ exports[`PageProposal renders votes in HTML when voting is open 1`] = `
</dt>
<dd>
400 / 40%
4000 / 40%
</dd>
</dl>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exports[`TabParameters has the expected html structure 1`] = `
<dd>
10 STAKEs
100 STAKEs
</dd>
</dl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,31 +143,31 @@ exports[`TabProposals has the expected html structure 1`] = `
class="li-proposal__value yes"
>
10
100
</td>
<td
class="li-proposal__value no"
>
30
300
</td>
<td
class="li-proposal__value no_with_veto"
>
100
1000
</td>
<td
class="li-proposal__value abstain"
>
20
200
</td>
</tr>
Expand Down Expand Up @@ -351,31 +351,31 @@ exports[`TabProposals has the expected html structure 1`] = `
class="li-proposal__value yes"
>
500
5000
</td>
<td
class="li-proposal__value no"
>
25
250
</td>
<td
class="li-proposal__value no_with_veto"
>
10
100
</td>
<td
class="li-proposal__value abstain"
>
56
560
</td>
</tr>
Expand Down
Loading

0 comments on commit d047486

Please sign in to comment.