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

feat: add additional CAIP-19 types and parsing functions to align with proposal #227

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

erwolff
Copy link
Contributor

@erwolff erwolff commented Dec 12, 2024

Added full support for CAIP-19 Asset IDs including the necessary regex, structs, and parsing functions.

A few notes:

  • While the regex of a chain namespace is technically the same as an asset namespace, the official proposal makes a clear distinction between the two, and so it's within the spirit of the spec to break these out into separate properties. The same cannot be said for a chain reference vs asset reference: these require different regex for validation.
  • Previously, CaipAssetId required a tokenId (/${string}) to be present. This has been changed to allow for tokenId to be optional (as dictated by the official proposal) in both the type and its corresponding regex string
  • For completeness, toCaipAccountId and parseCaipAssetId functions were added

@erwolff erwolff force-pushed the feat/add-additional-caip-types branch from 78ea315 to 8b22bb4 Compare December 12, 2024 21:40
src/caip-types.ts Outdated Show resolved Hide resolved
src/caip-types.ts Outdated Show resolved Hide resolved
@erwolff erwolff merged commit 48267f8 into main Dec 13, 2024
17 checks passed
@erwolff erwolff deleted the feat/add-additional-caip-types branch December 13, 2024 16:36
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.

2 participants