diff --git a/backend/src/proposal/proposal.service.ts b/backend/src/proposal/proposal.service.ts index 896bb22..14a65a9 100644 --- a/backend/src/proposal/proposal.service.ts +++ b/backend/src/proposal/proposal.service.ts @@ -88,7 +88,7 @@ export class ProposalService { createdEpochNo: govActionProposal.epoch_no, url: govActionProposal.url, metadataHash: govActionProposal.metadata_hash, - protocolParams: govActionProposal.row_to_json, + protocolParams: govActionProposal.proposal_params, title: govActionProposal.title, abstract: govActionProposal.abstract, motivation: govActionProposal.motivation, diff --git a/backend/src/sql/list-proposals.sql b/backend/src/sql/list-proposals.sql index 392ca68..65da8ad 100644 --- a/backend/src/sql/list-proposals.sql +++ b/backend/src/sql/list-proposals.sql @@ -59,7 +59,16 @@ SELECT creator_block.epoch_no, voting_anchor.url, encode(voting_anchor.data_hash, 'hex') AS metadata_hash, - ROW_TO_JSON(proposal_params), + jsonb_set( + ROW_TO_JSON(proposal_params)::jsonb, + '{cost_model}', + CASE + WHEN cost_model.id IS NOT NULL THEN + ROW_TO_JSON(cost_model)::jsonb + ELSE + 'null'::jsonb + END + ) AS proposal_params, off_chain_vote_gov_action_data.title, off_chain_vote_gov_action_data.abstract, off_chain_vote_gov_action_data.motivation, @@ -73,7 +82,7 @@ SELECT ) AS yes_votes, COALESCE(SUM(ldd_drep.amount) FILTER (WHERE voting_procedure.vote::text = 'No'), 0) + ( CASE WHEN gov_action_proposal.type = 'NoConfidence' THEN - 0 + 0` ELSE always_no_confidence_voting_power.amount END @@ -98,6 +107,7 @@ FROM JOIN block AS creator_block ON creator_block.id = creator_tx.block_id LEFT JOIN voting_anchor ON voting_anchor.id = gov_action_proposal.voting_anchor_id LEFT JOIN param_proposal AS proposal_params ON gov_action_proposal.param_proposal = proposal_params.id + LEFT JOIN cost_model AS cost_model ON proposal_params.cost_model_id = cost_model.id LEFT JOIN off_chain_vote_data ON off_chain_vote_data.voting_anchor_id = voting_anchor.id LEFT JOIN off_chain_vote_gov_action_data ON off_chain_vote_gov_action_data.off_chain_vote_data_id = off_chain_vote_data.id LEFT JOIN voting_procedure ON voting_procedure.gov_action_proposal_id = gov_action_proposal.id diff --git a/backend/src/types/proposal.ts b/backend/src/types/proposal.ts index bb9e526..e854b2a 100644 --- a/backend/src/types/proposal.ts +++ b/backend/src/types/proposal.ts @@ -44,7 +44,7 @@ export type RawQueryGovernanceActionProposalType = { epoch_no: number; url: string; encode: string; - row_to_json: any; + proposal_params: any; metadata_hash: string; title: string | null; abstract: string | null;