feat: libs: add Promise.resolve in getGovProposalTally

In the getGovProposalTally method, added `Promise.resolve` to the adapter function to ensure it returns a Promise.
This resolves the TypeScript error related to the return type mismatch.

Signed-off-by: Salman Wahib <sxlmnwb@nodex.one>
This commit is contained in:
Salman Wahib 2024-01-31 12:03:48 +00:00
parent 4c53591e85
commit 4e0606b8ab
2 changed files with 17 additions and 3 deletions

View File

@ -162,13 +162,15 @@ export class CosmosRestClient extends BaseRestClient<RequestRegistry> {
}
async getGovProposalTally(proposal_id: string) {
return this.request(this.registry.gov_proposals_tally, { proposal_id }, undefined, (source: any) => {
return {tally: {
return Promise.resolve({ tally: {
yes: source.tally.yes || source.tally.yes_count,
abstain: source.tally.abstain || source.tally.abstain_count,
no: source.tally.no || source.tally.no_count,
no_with_veto: source.tally.no_with_veto || source.tally.no_with_veto_count,
}};
});
},
});
}
);
}
async getGovProposalVotes(proposal_id: string, page?: PageRequest) {
if(!page) page = new PageRequest()

View File

@ -2184,6 +2184,11 @@
estree-walker "^2.0.2"
picomatch "^2.3.1"
"@shikijs/core@1.0.0-beta.1":
version "1.0.0-beta.1"
resolved "https://registry.yarnpkg.com/@shikijs/core/-/core-1.0.0-beta.1.tgz#40d21605cfc30c9d83bdc3c03414d478930ec30c"
integrity sha512-z3gdznaRj/DJSLQdR2Gdx6AB3e5+Il/kSGdLTGHI7HnalgPL15RbGgBSdLHW8rKAz4+dezAcTdnxm8z6YTu7nA==
"@sinclair/typebox@^0.24.1":
version "0.24.51"
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.51.tgz#645f33fe4e02defe26f2f5c0410e1c094eac7f5f"
@ -6008,6 +6013,13 @@ shelljs@0.8.5:
interpret "^1.0.0"
rechoir "^0.6.2"
shiki@^1.0.0-beta.0:
version "1.0.0-beta.1"
resolved "https://registry.yarnpkg.com/shiki/-/shiki-1.0.0-beta.1.tgz#fbff19e1ba180e3093f274b00fd6578237d157bd"
integrity sha512-iq32WxjemJVlAHg5HjYoL1qCxGmvyh3Z8kr2E/gMTQdcxyXxTpMhahIC7myxFBapAk9o8QN8mxCpr4JT5rqpRQ==
dependencies:
"@shikijs/core" "1.0.0-beta.1"
side-channel@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"