Skip to content

Comments

feat(keyring-api): add assertCreateAccountOptionIsSupported helper (for createAccounts)#464

Merged
ccharly merged 8 commits intomainfrom
feat/create-account-option-type-helper
Feb 9, 2026
Merged

feat(keyring-api): add assertCreateAccountOptionIsSupported helper (for createAccounts)#464
ccharly merged 8 commits intomainfrom
feat/create-account-option-type-helper

Conversation

@ccharly
Copy link
Contributor

@ccharly ccharly commented Feb 6, 2026

Helper to guide TS and narrow down CreateAccountOptions.type to a specific set of values.

This way, a createAccounts implementation can assert this and work with specific types rather than having to deal with a default branch/case for the unsupported types.


Note

Low Risk
Adds a small runtime assertion helper plus tests; no changes to keyring execution paths beyond optional use of the helper.

Overview
Adds a new assertCreateAccountOptionIsSupported helper in the v2 create-account API to let createAccounts implementations reject unsupported CreateAccountOptions.type values and narrow the option type in TypeScript.

Includes comprehensive unit tests covering supported/unsupported type behavior and compile-time narrowing expectations, and documents the addition in the keyring-api changelog.

Written by Cursor Bugbot for commit ff8b694. This will update automatically on new commits. Configure here.

@ccharly ccharly requested a review from a team as a code owner February 6, 2026 12:38
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

export function assertCreateAccountOptionTypeIsSupported<
Type extends CreateAccountOptions['type'],
>(
type: CreateAccountOptions['type'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should assert the type of options instead of options.type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, I agree, this would synergies pretty well with createAccounts params itself. I'll change this, thanks!

@ccharly ccharly changed the title feat(keyring-api): add assertCreateAccountOptionTypeIsSupported helper (for createAccounts) feat(keyring-api): add assertCreateAccountOptionIsSupported helper (for createAccounts) Feb 9, 2026
mathieuartu
mathieuartu previously approved these changes Feb 9, 2026
@ccharly ccharly enabled auto-merge February 9, 2026 10:37
@ccharly ccharly added this pull request to the merge queue Feb 9, 2026
Merged via the queue into main with commit c85296b Feb 9, 2026
37 checks passed
@ccharly ccharly deleted the feat/create-account-option-type-helper branch February 9, 2026 10:53
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.

3 participants