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(frontend): isIcToken and isIcTokenCanistersStrict validation #3357

Merged
merged 4 commits into from
Nov 5, 2024

Conversation

peterpeterparker
Copy link
Member

@peterpeterparker peterpeterparker commented Nov 5, 2024

Motivation

We will need to know if IC tokens are provided with or without Index Canister ID. Unrelated but, somehow related, we also want to know if a token is just a token or an IC token.

Notes

Some test uncommented and will be activated in PR #3334 because they cannot be active unless the Index Canister ID is set to optional.

Changes

  • New validators isIcToken, isNotIcToken, isIcTokenCanistersStrict and isNotIcTokenCanistersStrict

Copy link
Collaborator

@AntonioVentilii AntonioVentilii left a comment

Choose a reason for hiding this comment

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

LGTM tks!

I have a generic question: shall this checking function be in validation or in utils? Asking because I am doing a similar one for TokenSchema

peterpeterparker added a commit that referenced this pull request Nov 5, 2024
# Motivation

As discussed offline in the context of #3357. We actually adopt a new
convention in which Zod schema related are provided in sub-folder
`schema`.

This prevents the introduction of circular dependencies when the
validation uses both types and Zod schema.

# Changes

- Rename `ic-token.validation` to `ic-token.schema`
@peterpeterparker peterpeterparker changed the title feat(frontend): isIcToken and isIcTokenCanistersStrict utils feat(frontend): isIcToken and isIcTokenCanistersStrict validation Nov 5, 2024
@peterpeterparker
Copy link
Member Author

As discussed offline: we ultimally agreed those were "validation" and not "utils". So we proceeded with some refactoring and I finally renamed the code of this PR from "utils" to "validation".

@peterpeterparker peterpeterparker merged commit 09a3f68 into main Nov 5, 2024
10 checks passed
@peterpeterparker peterpeterparker deleted the feat/is-ic-token branch November 5, 2024 15:39
@peterpeterparker
Copy link
Member Author

Relates to #2883

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