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

Remove CAIP types definitions in favor of @metamask/utils types #3043

Closed
GuillaumeRx opened this issue Jan 28, 2025 · 0 comments · Fixed by #3071
Closed

Remove CAIP types definitions in favor of @metamask/utils types #3043

GuillaumeRx opened this issue Jan 28, 2025 · 0 comments · Fixed by #3071
Assignees

Comments

@GuillaumeRx
Copy link
Contributor

Remove our definitions of CAIP types in our packages in favor of the types in @metamask/utils.

export const ChainIdStringStruct = define<ChainId>(
'Chain ID',
string().validator,
);
/**
* A CAIP-2 chain ID, i.e., a human-readable namespace and reference.
*/
export const ChainIdStruct = pattern<ChainId, null>(
ChainIdStringStruct,
CHAIN_ID_REGEX,
);
export type Caip2ChainId = InferMatching<typeof ChainIdStruct, ChainId>;
export const AccountIdStruct = pattern(string(), ACCOUNT_ID_REGEX);
export const AccountIdArrayStruct = array(AccountIdStruct);
export const AccountAddressStruct = pattern(string(), ACCOUNT_ADDRESS_REGEX);
export type AccountAddress = Infer<typeof AccountAddressStruct>;

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 a pull request may close this issue.

2 participants