-
-
Notifications
You must be signed in to change notification settings - Fork 15
Ban enums, and replace them with alternatives #280
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -131,19 +131,22 @@ export const CaipAssetTypeOrIdStruct = definePattern< | |||||||||||
| export type CaipAssetTypeOrId = Infer<typeof CaipAssetTypeOrIdStruct>; | ||||||||||||
|
|
||||||||||||
| /** Known CAIP namespaces. */ | ||||||||||||
| export enum KnownCaipNamespace { | ||||||||||||
| export const KnownCaipNamespace = { | ||||||||||||
| /** BIP-122 (Bitcoin) compatible chains. */ | ||||||||||||
| Bip122 = 'bip122', | ||||||||||||
| Bip122: 'bip122', | ||||||||||||
| /** Solana compatible chains */ | ||||||||||||
| Solana = 'solana', | ||||||||||||
| Solana: 'solana', | ||||||||||||
| /** Stellar compatible chains */ | ||||||||||||
| Stellar = 'stellar', | ||||||||||||
| Stellar: 'stellar', | ||||||||||||
| /** Tron compatible chains */ | ||||||||||||
| Tron = 'tron', | ||||||||||||
| Tron: 'tron', | ||||||||||||
| /** EIP-155 compatible chains. */ | ||||||||||||
| Eip155 = 'eip155', | ||||||||||||
| Wallet = 'wallet', | ||||||||||||
| } | ||||||||||||
| Eip155: 'eip155', | ||||||||||||
| Wallet: 'wallet', | ||||||||||||
| } as const; | ||||||||||||
|
|
||||||||||||
| export type KnownCaipNamespace = | ||||||||||||
| (typeof KnownCaipNamespace)[keyof typeof KnownCaipNamespace]; | ||||||||||||
|
Comment on lines
+148
to
+149
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting, at first glance it seems like this would create a circular type reference, but is it actually referring to the object
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's right. If this had been written from scratch then I would have used
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is fine. Wondering if it makes sense to add a simple helper for this though, maybe it makes it a little bit easier to understand?
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO that's neat. Value and type have matching names and they should not conflict. But I guess that's a personal opinion 😁 |
||||||||||||
|
|
||||||||||||
| /** | ||||||||||||
| * A CAIP-2 chain ID that is guaranteed to have a known CAIP namespace | ||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add this to the shared ESLint configs at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you created an issue for this already, so disregard this comment. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked about enabling this in
accountstoo, but indeed if that's enforced by the shared eslint, that's even better 🚀