diff --git a/changes/colw_graphql-validators b/changes/colw_graphql-validators new file mode 100644 index 0000000000..355f8c8341 --- /dev/null +++ b/changes/colw_graphql-validators @@ -0,0 +1 @@ +[Changed] [#2926](https://github.com/cosmos/lunie/pull/2926) Fetch validator information using graphql @colw \ No newline at end of file diff --git a/src/components/common/TmPage.vue b/src/components/common/TmPage.vue index ceac657bbb..3deed84902 100644 --- a/src/components/common/TmPage.vue +++ b/src/components/common/TmPage.vue @@ -77,7 +77,7 @@ export default { default: false }, error: { - type: Error, + type: Boolean, default: undefined }, tabs: { diff --git a/src/components/staking/DelegationsOverview.vue b/src/components/staking/DelegationsOverview.vue index 2f6e42a518..e1ce2c1d35 100644 --- a/src/components/staking/DelegationsOverview.vue +++ b/src/components/staking/DelegationsOverview.vue @@ -1,13 +1,13 @@ diff --git a/src/components/staking/LiValidator.vue b/src/components/staking/LiValidator.vue index ad3e42305d..7acd27e389 100644 --- a/src/components/staking/LiValidator.vue +++ b/src/components/staking/LiValidator.vue @@ -1,7 +1,7 @@ diff --git a/src/components/staking/PageValidator.vue b/src/components/staking/PageValidator.vue index 165bcdbb49..dffc1bef2b 100644 --- a/src/components/staking/PageValidator.vue +++ b/src/components/staking/PageValidator.vue @@ -1,49 +1,43 @@ `; -exports[`PageValidators shows a message if still loading 1`] = ` +exports[`PageValidators shows a message if there is an error to display 1`] = ` @@ -52,6 +56,7 @@ exports[`PageValidators shows a message if still loading 1`] = ` exports[`PageValidators shows a message if there is nothing to display 1`] = ` + + diff --git a/tests/unit/specs/components/transactions/__snapshots__/TransactionDetails.spec.js.snap b/tests/unit/specs/components/transactions/__snapshots__/TransactionDetails.spec.js.snap index 1bae9a3f1a..7ae65499f6 100644 --- a/tests/unit/specs/components/transactions/__snapshots__/TransactionDetails.spec.js.snap +++ b/tests/unit/specs/components/transactions/__snapshots__/TransactionDetails.spec.js.snap @@ -956,7 +956,7 @@ exports[`TransactionDetails renders MsgUndelegate transaction item 1`] = ` From  cosmosvaloper…laks diff --git a/tests/unit/specs/components/wallet/PageTransactions.spec.js b/tests/unit/specs/components/wallet/PageTransactions.spec.js index faa9824d15..f6cacaf7fd 100644 --- a/tests/unit/specs/components/wallet/PageTransactions.spec.js +++ b/tests/unit/specs/components/wallet/PageTransactions.spec.js @@ -9,8 +9,8 @@ describe(`PageTransactions`, () => { `cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5ctpesxxn9`, `cosmos1pxdf0lvq5jvl9uxznklgc5gxuwzpdy5ynem546` ] - const validators = { - cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctqzh8yqw: { + const validators = [ + { operator_address: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctqzh8yqw`, pub_key: `cosmosvalpub1234`, revoked: false, @@ -34,7 +34,7 @@ describe(`PageTransactions`, () => { }, prev_bonded_shares: `0` }, - cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au: { + { operator_address: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au`, pub_key: `cosmosvalpub5678`, revoked: false, @@ -58,7 +58,7 @@ describe(`PageTransactions`, () => { }, prev_bonded_shares: `0` }, - cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctgurrg7n: { + { operator_address: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctgurrg7n`, pub_key: `cosmosvalpub8910`, tokens: `19`, @@ -82,7 +82,7 @@ describe(`PageTransactions`, () => { }, prev_bonded_shares: `0` } - } + ] const flatOrderedTransactionList = [ { @@ -198,8 +198,7 @@ describe(`PageTransactions`, () => { let wrapper, $store const getters = { - flatOrderedTransactionList, - validators + flatOrderedTransactionList } const state = { @@ -290,4 +289,41 @@ describe(`PageTransactions`, () => { wrapper.vm.loadMore() expect(wrapper.vm.showingTransactions.length).toBe(7) }) + it(`should load more transactions (infinite scrolling)`, async () => { + const refreshTransactions = jest.fn() + wrapper = shallowMount(PageTransactions, { + localVue, + mocks: { + $store + }, + directives: { + infiniteScroll: () => {} + }, + methods: { + refreshTransactions + } + }) + wrapper.setData({ session: { signedIn: false } }) + wrapper.vm.$nextTick() + expect(refreshTransactions).toHaveBeenCalled() + }) + + it(`validator address map to be correct`, async () => { + wrapper = shallowMount(PageTransactions, { + localVue, + mocks: { + $store + }, + directives: { + infiniteScroll: () => {} + } + }) + wrapper.setData({ validators }) + // console.log(wrapper.vm.validatorsAddressMap) + expect(Object.keys(wrapper.vm.validatorsAddressMap)).toEqual([ + "cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctqzh8yqw", + "cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au", + "cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctgurrg7n" + ]) + }) }) diff --git a/tests/unit/specs/filters/filters.spec.js b/tests/unit/specs/filters/filters.spec.js index 550250af2b..007b765841 100644 --- a/tests/unit/specs/filters/filters.spec.js +++ b/tests/unit/specs/filters/filters.spec.js @@ -52,9 +52,7 @@ describe(`resolveValidatorName Filter`, () => { beforeEach(() => { validators = { cosmosvaloper1xyz: { - description: { - moniker: "Big Val" - } + moniker: "Big Val" } } }) diff --git a/tests/unit/specs/store/getters.spec.js b/tests/unit/specs/store/getters.spec.js index 5f932588e5..4cc9d59017 100644 --- a/tests/unit/specs/store/getters.spec.js +++ b/tests/unit/specs/store/getters.spec.js @@ -10,7 +10,10 @@ import { flatOrderedTransactionList, validators as validatorsAddressMap } from "src/vuex/getters.js" -import validators from "./json/validators.js" + +import validatorsFull from "./json/validators.js" + +const validators = validatorsFull.slice(0, 3) describe(`Store: getters`, () => { it(`liquidAtoms`, () => { diff --git a/tests/unit/specs/store/json/validators.js b/tests/unit/specs/store/json/validators.js index 3da89234b2..8620fa120f 100644 --- a/tests/unit/specs/store/json/validators.js +++ b/tests/unit/specs/store/json/validators.js @@ -1,87 +1,132 @@ export default [ { - id: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctqzh8yqw`, - operator_address: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctqzh8yqw`, - pub_key: `cosmosvalpub1234`, - revoked: false, - tokens: `14`, - delegator_shares: `14`, - description: { - website: `www.monty.ca`, - details: `Mr Mounty`, - moniker: `mr_mounty`, - country: `Canada`, - identity: `keybase` - }, - signing_info: { - missed_blocks_counter: 2 - }, + avatarUrl: "https://s3.amazonaws.com/img/path.jpg", + consensus_pubkey: "cosmosvalpub1234", + customized: false, + delegator_shares: "697935712090.000000000000000000", + details: "Mr Mounty", + identity: "keybase", + jailed: false, + keybaseId: "keybase", + lastUpdated: "2019-08-15T16:03:34.988007+00:00", + max_change_rate: "0.010000000000000000", + max_rate: "0.500000000000000000", + min_self_delegation: "1", + moniker: "mr_mounty", + operator_address: "cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctqzh8yqw", + profileUrl: "https://keybase.io/melea", + rate: "0", status: 2, - bond_height: `0`, - bond_intra_tx_counter: 6, - proposer_reward_pool: null, - commission: { - rate: 0, - max_rate: `0`, - max_change_rate: `0`, - update_time: `1970-01-01T00:00:00Z` - }, - prev_bonded_shares: `0` + tokens: 14, + unbonding_height: 556130, + unbonding_time: "2019-06-26T23:50:09.38840326Z", + update_time: "2019-04-01T17:07:19.892771401Z", + uptime_percentage: "0.9962", + userName: "mr_mounty", + website: "www.monty.ca" }, { - id: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au`, - operator_address: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au`, - pub_key: `cosmosvalpub5678`, - revoked: false, - tokens: `0`, - delegator_shares: `0`, - description: { - website: `www.greg.com`, - details: `Good Guy Greg`, - moniker: `good_greg`, - country: `USA`, - identity: `keybase` - }, - signing_info: null, + avatarUrl: "https://s3.amazonaws.com/img/path.jpg", + consensus_pubkey: "cosmosvalpub5678", + customized: false, + delegator_shares: "0", + details: "Good Guy Greg", + id: "9cfd0f08-c750-4cde-a267-e5a38feede20", + identity: "keybase", + jailed: false, + keybaseId: "keybase", + lastUpdated: "2019-08-15T16:03:34.988007+00:00", + max_change_rate: "0.010000000000000000", + max_rate: "0.500000000000000000", + min_self_delegation: "1", + moniker: "good_greg", + operator_address: "cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctplpn3au", + rate: "0", status: 2, - bond_height: `0`, - bond_intra_tx_counter: 6, - proposer_reward_pool: null, - commission: { - rate: 0, - max_rate: `0`, - max_change_rate: `0`, - update_time: new Date(Date.now()).toISOString() - }, - prev_bonded_shares: `0` + tokens: 0, + unbonding_height: 556130, + unbonding_time: "2019-06-26T23:50:09.38840326Z", + update_time: "2019-04-01T17:07:19.892771401Z", + uptime_percentage: "0.9962", + userName: "mr_mounty", + website: "www.greg.com" }, { - id: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctgurrg7n`, - operator_address: `cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctgurrg7n`, - pub_key: `cosmosvalpub8910`, - tokens: `19`, - delegator_shares: `19`, - description: { - details: `Herr Schmidt`, - website: `www.schmidt.de`, - moniker: `herr_schmidt_revoked`, - country: `DE`, - identity: `keybase` - }, - revoked: true, - signing_info: { - missed_blocks_counter: 2000 - }, + avatarUrl: "https://s3.amazonaws.com/img/path.jpg", + consensus_pubkey: "cosmosvalpub8910", + customized: false, + delegator_shares: "19", + details: "Herr Schmidt", + id: "9cfd0f08-c750-4cde-a267-e5a38feede20", + identity: "keybase", + jailed: false, + keybaseId: "keybase", + lastUpdated: "2019-08-15T16:03:34.988007+00:00", + max_change_rate: "0.010000000000000000", + max_rate: "0.500000000000000000", + min_self_delegation: "1", + moniker: "herr_schmidt_revoked", + operator_address: "cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctgurrg7n", + rate: "0", status: 2, - bond_height: `0`, - bond_intra_tx_counter: 6, - proposer_reward_pool: null, - commission: { - rate: 0, - max_rate: `0`, - max_change_rate: `0`, - update_time: new Date(Date.now()).toISOString() - }, - prev_bonded_shares: `0` + tokens: 19, + unbonding_height: 556130, + unbonding_time: "2019-06-26T23:50:09.38840326Z", + update_time: "2019-04-01T17:07:19.892771401Z", + uptime_percentage: "0.9962", + userName: "mr_mounty", + website: "www.schmidt.de" + }, + { + avatarUrl: "https://s3.amazonaws.com/img/path.jpg", + consensus_pubkey: "cosmosvalpub8910", + customized: false, + delegator_shares: "19", + details: "Herr Schmidt", + id: "9cfd0f08-c750-4cde-a267-e5a38feede20", + identity: "keybase", + jailed: true, + keybaseId: "keybase", + lastUpdated: "2019-08-15T16:03:34.988007+00:00", + max_change_rate: "0.010000000000000000", + max_rate: "0.500000000000000000", + min_self_delegation: "1", + moniker: "herr_schmidt_revoked", + operator_address: "cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctgurrg7n", + rate: "0", + status: 2, + tokens: 19, + unbonding_height: 556130, + unbonding_time: "2019-06-26T23:50:09.38840326Z", + update_time: "2019-04-01T17:07:19.892771401Z", + uptime_percentage: "0.9962", + userName: "mr_mounty jailed", + website: "www.schmidt.de" + }, + { + avatarUrl: "https://s3.amazonaws.com/img/path.jpg", + consensus_pubkey: "cosmosvalpub8910", + customized: false, + delegator_shares: "19", + details: "Herr Schmidt", + id: "9cfd0f08-c750-4cde-a267-e5a38feede20", + identity: "keybase", + jailed: false, + keybaseId: "keybase", + lastUpdated: "2019-08-15T16:03:34.988007+00:00", + max_change_rate: "0.010000000000000000", + max_rate: "0.500000000000000000", + min_self_delegation: "1", + moniker: "herr_schmidt_revoked", + operator_address: "cosmosvaladdr15ky9du8a2wlstz6fpx3p4mqpjyrm5ctgurrg7n", + rate: "0", + status: 0, + tokens: 19, + unbonding_height: 556130, + unbonding_time: "2019-06-26T23:50:09.38840326Z", + update_time: "2019-04-01T17:07:19.892771401Z", + uptime_percentage: "0.9962", + userName: "mr_mounty inactive", + website: "www.schmidt.de" } ]