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

more precise types for signature type in confirmations #1043

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

mmv08
Copy link
Member

@mmv08 mmv08 commented Nov 8, 2024

This pull request to packages/types-kit includes changes to enhance type safety and consistency in the codebase. The most significant changes involve the introduction of a new SignatureTypes constant and the corresponding SignatureType type and modifying existing types to utilize these new definitions.

Enhancements to type safety and consistency:

Reference to the SafeSignatureType enum in safe-eth-py and safe-transaction-service:

  1. https://github.com/safe-global/safe-eth-py/blob/4eceab2160a72052f0a1d5efaa2af5d78f464371/safe_eth/safe/safe_signature.py#L40
  2. https://github.com/safe-global/safe-transaction-service/blob/8fb64a47b024aecaebdf5968a56bb4df08959a91/safe_transaction_service/safe_messages/models.py#L71-L73

@@ -7,6 +7,15 @@ export enum OperationType {
DelegateCall // 1
}

export const SignatureTypes = {
Copy link
Member Author

@mmv08 mmv08 Nov 8, 2024

Choose a reason for hiding this comment

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

regarding enum vs const enum vs const:
https://www.perplexity.ai/search/enum-vs-const-enum-in-typescri-bBwicw7YQDGRvdxEiM56zA#0

here's why I went with const:

Type safety
Runtime object availability
No extra generated code
Better compatibility with modern JavaScript practices6

https://www.typescriptlang.org/docs/handbook/enums.html#objects-vs-enums

@dasanra dasanra changed the base branch from main to development November 8, 2024 10:17
@mmv08
Copy link
Member Author

mmv08 commented Nov 8, 2024

The tests failed because the private key was of the wrong size. I think it's because the PR is from a fork and it doesn't have access to environment variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant