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
Open
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
11 changes: 10 additions & 1 deletion packages/types-kit/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

CONTRACT_SIGNATURE: 'CONTRACT_SIGNATURE',
EOA: 'EOA',
APPROVED_HASH: 'APPROVED_HASH',
ETH_SIGN: 'ETH_SIGN'
} as const

export type SignatureType = (typeof SignatureTypes)[keyof typeof SignatureTypes]

export interface SafeSetupConfig {
owners: string[]
threshold: number
Expand Down Expand Up @@ -194,7 +203,7 @@ export type SafeMultisigConfirmationResponse = {
readonly transactionHash?: string
readonly confirmationType?: string
readonly signature: string
readonly signatureType?: string
readonly signatureType: SignatureType
}

export type ListResponse<T> = {
Expand Down
Loading