Skip to content

Commit

Permalink
Fixups from merge
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeHartnell committed Nov 20, 2023
1 parent add9298 commit 8fce084
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,17 +339,20 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> {
COMPLETED_PROPOSALS.load(deps.storage, id)?;
}

to_binary(&pending)
to_json_binary(&pending)
}
QueryExt::Proposal { id } => {
if let Some(pending) = PENDING_PROPOSALS.may_load(deps.storage, id)? {
to_binary(&pending)
to_json_binary(&pending)
} else {
// Force load completed proposal if not pending, throwing
// error if not found.
to_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?)
to_json_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?)
}
}
QueryExt::PendingProposal { id } => {
to_json_binary(&PENDING_PROPOSALS.load(deps.storage, id)?)
}
QueryExt::PendingProposals { start_after, limit } => {
to_json_binary(&paginate_map_values(
deps,
Expand All @@ -370,27 +373,29 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> {
Order::Descending,
)?),
QueryExt::CompletedProposal { id } => {
to_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?)
to_json_binary(&COMPLETED_PROPOSALS.load(deps.storage, id)?)
}
QueryExt::CompletedProposals { start_after, limit } => {
to_json_binary(&paginate_map_values(
deps,
&COMPLETED_PROPOSALS,
start_after,
limit,
Order::Ascending,
)?)
}
QueryExt::CompletedProposals { start_after, limit } => to_binary(&paginate_map_values(
deps,
&COMPLETED_PROPOSALS,
start_after,
limit,
Order::Ascending,
)?),
QueryExt::ReverseCompletedProposals {
start_before,
limit,
} => to_binary(&paginate_map_values(
} => to_json_binary(&paginate_map_values(
deps,
&COMPLETED_PROPOSALS,
start_before,
limit,
Order::Descending,
)?),
QueryExt::CompletedProposalIdForCreatedProposalId { id } => {
to_binary(&CREATED_PROPOSAL_TO_COMPLETED_PROPOSAL.may_load(deps.storage, id)?)
to_json_binary(&CREATED_PROPOSAL_TO_COMPLETED_PROPOSAL.may_load(deps.storage, id)?)
}
},
_ => PrePropose::default().query(deps, env, msg),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> {
to_json_binary(&PRE_PROPOSE_APPROVAL_CONTRACT.load(deps.storage)?)
}
QueryExt::PreProposeApprovalIdForApproverProposalId { id } => {
to_binary(&PROPOSAL_ID_TO_PRE_PROPOSE_ID.may_load(deps.storage, id)?)
to_json_binary(&PROPOSAL_ID_TO_PRE_PROPOSE_ID.may_load(deps.storage, id)?)
}
},
_ => PrePropose::default().query(deps, env, msg),
Expand Down

0 comments on commit 8fce084

Please sign in to comment.