Skip to content

feat: rewrite in ts#41

Merged
leonardotc merged 25 commits intomainfrom
510-rewrite-the-remaining-code-in-typescript
Mar 6, 2026
Merged

feat: rewrite in ts#41
leonardotc merged 25 commits intomainfrom
510-rewrite-the-remaining-code-in-typescript

Conversation

@leonardotc
Copy link
Contributor

No description provided.

@leonardotc leonardotc marked this pull request as draft March 3, 2026 15:45
@leonardotc leonardotc force-pushed the 510-rewrite-the-remaining-code-in-typescript branch 2 times, most recently from 198b433 to 9764e17 Compare March 5, 2026 16:43
@Trac-Systems Trac-Systems deleted a comment from github-actions bot Mar 5, 2026
@leonardotc leonardotc force-pushed the 510-rewrite-the-remaining-code-in-typescript branch from 05eabd0 to da02fc9 Compare March 5, 2026 16:47
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

Coverage

Metric Coverage Covered/Total
Lines 100% 335/335
Statements 100% 335/335
Functions 100% 32/32
Branches 100% 56/56

@leonardotc leonardotc marked this pull request as ready for review March 5, 2026 19:22
@leonardotc leonardotc requested a review from b-garbacz March 5, 2026 19:35
@leonardotc leonardotc changed the title feat: Rewrite in ts feat: rewrite in ts Mar 5, 2026
* @param {Signature} message - The message to verify.
* @returns {boolean} true if valid, false otherwise.
*/
verify(signature: Signature, message: Message): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

The JSDoc of this function has swapped types for the parameters.

Change to:

/**
     * Verifies a signature using the wallet's public key.
     * @param {Signature} signature - The signature to verify.
     * @param {Message} message - The message to verify.
     * @returns {boolean} true if valid, false otherwise.
     */

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

* @returns {Promise<void>}
* @throws {Error} If required parameters are missing or invalid.
*/
export const importFromFile = async (filePath: string, password: Buffer | Uint8Array = b4a.alloc(0)): Promise<IWallet | IHDWallet> => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The return type for this function looks wrong in the JSDoc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

src/wallet.ts Outdated
const sanitizeMnemonic = (mnemonic: string) => {
const sanitized = tracCryptoApi.mnemonic.sanitize(mnemonic)
if (sanitized === null) {
throw new Error('Invalid secret key format. Please provide a valid hex string');
Copy link
Contributor

Choose a reason for hiding this comment

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

This error message looks wrong. We say we have an invalid secret key format instead of invalid mnemonic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@leonardotc leonardotc merged commit b61b822 into main Mar 6, 2026
4 checks passed
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.

Rewrite the remaining code in typescript

2 participants