diff --git a/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/ChainHistoryBuilder.ts b/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/ChainHistoryBuilder.ts index 6ee1374b801..b90c6b799af 100644 --- a/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/ChainHistoryBuilder.ts +++ b/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/ChainHistoryBuilder.ts @@ -93,14 +93,16 @@ const mapWithdrawals: (source: [{ credential: DbSyncCredential; network: string const getGovernanceAction = ({ denominator, description, - numerator, - type + numerator }: ProposalProcedureModel): Cardano.GovernanceAction => { - const { contents } = description; + const { contents, tag } = description; const governanceActionId = contents && contents[0] ? { actionIndex: contents[0].govActionIx, id: contents[0].txId } : null; - switch (type) { + if (!tag) throw new Error('Missing "tag" in governance action proposal description'); + if (typeof tag !== 'string') throw new Error('Wrong "tag" type in governance action proposal description'); + + switch (tag) { case 'HardForkInitiation': return { __typename: GovernanceActionType.hard_fork_initiation_action, @@ -159,7 +161,7 @@ const getGovernanceAction = ({ }; } - throw new Error(`Unknown GovernanceActionType '${type}' with description "${JSON.stringify(description)}"`); + throw new Error(`Unknown GovernanceActionType '${tag}' with description "${JSON.stringify(description)}"`); }; const getVoter = ( diff --git a/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/queries.ts b/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/queries.ts index a791d84cac4..129b0210d75 100644 --- a/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/queries.ts +++ b/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/queries.ts @@ -222,7 +222,6 @@ export const findProposalProceduresByTxIds = ` tx.hash AS tx_id, ga.deposit, ga.description, - ga.type, va.url, va.data_hash, sa.view, @@ -298,8 +297,6 @@ export const findStakeCertsByTxIds = ` FROM tx JOIN stake_registration AS cert ON cert.tx_id = tx.id JOIN stake_address AS addr ON addr.id = cert.addr_id - JOIN block ON block_id = block.id - JOIN epoch_param ON block.epoch_no = epoch_param.epoch_no WHERE tx.id = ANY($1) ORDER BY tx.id ASC) UNION diff --git a/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/types.ts b/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/types.ts index 2fc0456e899..1790a03f792 100644 --- a/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/types.ts +++ b/packages/cardano-services/src/ChainHistory/DbSyncChainHistory/types.ts @@ -137,7 +137,6 @@ export interface ProposalProcedureModel { // eslint-disable-next-line @typescript-eslint/no-explicit-any description: any; tx_id: Buffer; - type: string; url: string; view: string; // LW-9675