fixed gov issue of osmos

This commit is contained in:
liangping 2022-01-29 09:05:09 +08:00
parent 13b1dbe9fd
commit eec49e8391
2 changed files with 7 additions and 7 deletions

View File

@ -21,20 +21,20 @@ export default class Proposal {
init(element, total) { init(element, total) {
this.element = element this.element = element
this.id = element.id this.id = element.proposal_id || element.id
this.status = element.status this.status = element.status
this.type = element.content.type 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.tally = new ProposalTally().init(element.final_tally_result, total)
this.submit_time = element.submit_time this.submit_time = element.submit_time
this.voting_end_time = element.voting_end_time this.voting_end_time = element.voting_end_time
this.voting_start_time = element.voting_start_time this.voting_start_time = element.voting_start_time
// eslint-disable-next-line prefer-destructuring // eslint-disable-next-line prefer-destructuring
this.total_deposit = element.total_deposit[0] 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 return this
} }

View File

@ -225,7 +225,7 @@ export default class ChainFetch {
} }
async getGovernanceList() { 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])) const pool = new StakingPool().init(commonProcess(data[1]))
let proposals = commonProcess(data[0]) let proposals = commonProcess(data[0])
if (Array.isArray(proposals.proposals)) { if (Array.isArray(proposals.proposals)) {