From eec49e83917f0b6536f862862c9e9fd2d4754a05 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Sat, 29 Jan 2022 09:05:09 +0800 Subject: [PATCH] fixed gov issue of osmos --- src/libs/data/proposal.js | 12 ++++++------ src/libs/fetch.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libs/data/proposal.js b/src/libs/data/proposal.js index 873ca2ce..6919ef81 100644 --- a/src/libs/data/proposal.js +++ b/src/libs/data/proposal.js @@ -21,20 +21,20 @@ export default class Proposal { init(element, total) { this.element = element - this.id = element.id + this.id = element.proposal_id || element.id this.status = element.status this.type = element.content.type - if (element.content.value) { - this.title = element.content.value.title - this.description = element.content.value.description - } this.tally = new ProposalTally().init(element.final_tally_result, total) this.submit_time = element.submit_time this.voting_end_time = element.voting_end_time this.voting_start_time = element.voting_start_time // eslint-disable-next-line prefer-destructuring this.total_deposit = element.total_deposit[0] - this.contents = element.content.value + this.contents = element.content.value || element.content + if (this.contents) { + this.title = this.contents.title + this.description = this.contents.description + } return this } diff --git a/src/libs/fetch.js b/src/libs/fetch.js index cff8c28d..6bf2fe4c 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -225,7 +225,7 @@ export default class ChainFetch { } async getGovernanceList() { - return Promise.all([this.get('/gov/proposals'), this.get('/staking/pool')]).then(data => { + return Promise.all([this.get('/cosmos/gov/v1beta1/proposals?pagination.limit=500'), this.get('/staking/pool')]).then(data => { const pool = new StakingPool().init(commonProcess(data[1])) let proposals = commonProcess(data[0]) if (Array.isArray(proposals.proposals)) {