Skip to content
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

Suggestion to open PR #3708

Conversation

jorbuedo
Copy link
Contributor

For #3707

This makes the certificate types more consistent, so there's no need to cast as them everywhere.
Basically FormattedCertificate is more strict so once you discriminate by type, the value already has the correct shape:

type FormattedCertificate = {
    type: "StakeRegistration";
    value: StakeRegistrationJSON;
} | {
    type: "StakeDeregistration";
    value: StakeDeregistrationJSON;
} | {
    type: "StakeDelegation";
    value: StakeDelegationJSON;
} | {
    type: "PoolRegistration";
    value: PoolRegistrationJSON;
} | {
    type: "PoolRetirement";
    value: PoolRetirementJSON;
} | {
    type: "GenesisKeyDelegation";
    value: GenesisKeyDelegationJSON;
} | {
    type: "MoveInstantaneousRewardsCert";
    value: MoveInstantaneousRewardsCertJSON;
} | {
    type: "CommitteeHotAuth";
    value: CommitteeHotAuthJSON;
} | {
    type: "CommitteeColdResign";
    value: CommitteeColdResignJSON;
} | {
    type: "DRepDeregistration";
    value: DRepDeregistrationJSON;
} | {
    type: "DRepRegistration";
    value: DRepRegistrationJSON;
} | {
    type: "DRepUpdate";
    value: DRepUpdateJSON;
} | {
    type: "StakeAndVoteDelegation";
    value: StakeAndVoteDelegationJSON;
} | {
    type: "StakeRegistrationAndDelegation";
    value: StakeRegistrationAndDelegationJSON;
} | {
    type: "StakeVoteRegistrationAndDelegation";
    value: StakeVoteRegistrationAndDelegationJSON;
} | ... 2 more

@jorbuedo jorbuedo added proposal Feature proposal for triage. Required for non-trivial features. refactor labels Oct 24, 2024
@jorbuedo jorbuedo requested a review from banklesss October 24, 2024 13:33
@jorbuedo jorbuedo self-assigned this Oct 24, 2024
@banklesss
Copy link
Contributor

Interesting !!

Copy link
Member

@stackchain stackchain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it.

@stackchain stackchain added this to the 5.1.0 "Notify me" milestone Oct 24, 2024
@stackchain stackchain merged commit 6596120 into feature/new-tx-review-for-withdraw-rewards Oct 24, 2024
3 checks passed
@stackchain stackchain deleted the refactor-tx-review-cert-types branch October 24, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Feature proposal for triage. Required for non-trivial features. refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants