Skip to content

Refactor/small optimizations #1403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading