diff --git a/CHANGELOG.md b/CHANGELOG.md index 17163edc47..f2950d7184 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -174,6 +174,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [\#1859](https://github.com/cosmos/voyager/pull/1859) Fix security check in circleci @sabau - [\#1892](https://github.com/cosmos/voyager/issues/1892) Fix TmSessionImport form validation @faboweb - Fixed signing issues related to https://github.com/cosmos/cosmos-sdk/issues/3336 @faboweb +- [\#1896](https://github.com/cosmos/voyager/issues/1896) Correctly update balances if account is empty @faboweb ## [0.10.7] - 2018-10-10 diff --git a/app/src/renderer/connectors/lcdClient.js b/app/src/renderer/connectors/lcdClient.js index d7f4eb98ca..922b0bcbe9 100644 --- a/app/src/renderer/connectors/lcdClient.js +++ b/app/src/renderer/connectors/lcdClient.js @@ -51,7 +51,11 @@ const Client = (axios, remoteLcdURL) => { (err.response.data.includes(`account bytes are empty`) || err.response.data.includes(`failed to prove merkle proof`)) ) { - return null + return { + coins: [], + sequence: `0`, + account_number: `0` + } } throw err }) diff --git a/app/src/renderer/vuex/modules/wallet.js b/app/src/renderer/vuex/modules/wallet.js index 6bb22ca6b5..93e6921a62 100644 --- a/app/src/renderer/vuex/modules/wallet.js +++ b/app/src/renderer/vuex/modules/wallet.js @@ -64,11 +64,6 @@ export default ({ node }) => { try { const res = await node.queryAccount(state.address) - if (!res) { - state.loading = false - state.loaded = true - return - } state.error = null const coins = res.coins || [] commit(`setNonce`, res.sequence) diff --git a/test/unit/specs/connectors/lcdClient.spec.js b/test/unit/specs/connectors/lcdClient.spec.js index 436227511b..33f8570b0d 100644 --- a/test/unit/specs/connectors/lcdClient.spec.js +++ b/test/unit/specs/connectors/lcdClient.spec.js @@ -598,7 +598,11 @@ describe(`LCD Client`, () => { }) ) const res = await client.queryAccount(`address`) - expect(res).toBe(null) + expect(res).toEqual({ + coins: [], + sequence: `0`, + account_number: `0` + }) }) it(`does not throw error for failed merkle proof error`, async () => { @@ -610,7 +614,11 @@ describe(`LCD Client`, () => { }) ) const res = await client.queryAccount(`address`) - expect(res).toBe(null) + expect(res).toEqual({ + coins: [], + sequence: `0`, + account_number: `0` + }) }) it(`throws error for error other than empty account`, async () => {