Add Cardano support#7
Open
Tomasvrba wants to merge 7 commits into
Open
Conversation
benma
reviewed
Jul 7, 2026
Comment on lines
+59
to
+71
| function validateUint32(value: number, detail: string): number { | ||
| if (!Number.isInteger(value) || value < 0 || value > UINT32_MAX) { | ||
| throw invalidTypeError(detail); | ||
| } | ||
| return value; | ||
| } | ||
|
|
||
| function validateUint64(value: bigint, detail: string): bigint { | ||
| if (typeof value !== 'bigint' || value < 0n || value > UINT64_MAX) { | ||
| throw invalidTypeError(detail); | ||
| } | ||
| return value; | ||
| } |
Comment on lines
+222
to
+224
| function bytesArray(bytes: Uint8Array): number[] { | ||
| return Array.from(bytes); | ||
| } |
Contributor
There was a problem hiding this comment.
Why a helper function that wraps an existing function?
| cardanoSupported(): boolean { | ||
| this.#requireOpen('cardanoSupported'); | ||
| return false; | ||
| return cardanoSupportedImpl(this.#requireOpen('cardanoSupported').info); |
Contributor
There was a problem hiding this comment.
In ETH, the method is implemented right here in index.ts. Maybe do the same for Cardano for consistency. The Rust-based package uses "self.is_multi_edition()", could make sense to have a similar helper here.
Comment on lines
+52
to
+53
| import { parseKeypath } from '../eth/keypath.js'; | ||
| import { requireVersion } from '../eth/version.js'; |
Contributor
There was a problem hiding this comment.
Move these helpers to internal/keypath.js and internal/version.js? Not clean to have Cardano (and later BTC) import from eth.
Collaborator
Author
There was a problem hiding this comment.
oops, missed that one
| return Array.from(bytes); | ||
| } | ||
|
|
||
| async function queryCardano( |
Contributor
There was a problem hiding this comment.
The corresponding ETH function lives in eth/query.ts - change Cardano or ETH to make it consistent? 😄
Move keypath parsing, firmware version checks, product support checks, and integer validation into neutral internal modules. Make Cardano query helper consistent with ETH query layout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.