Skip to content

docs: Fullnode Typings [13] - Nano methods#1015

Merged
tuliomir merged 5 commits intomasterfrom
docs/ts-nanos
Mar 5, 2026
Merged

docs: Fullnode Typings [13] - Nano methods#1015
tuliomir merged 5 commits intomasterfrom
docs/ts-nanos

Conversation

@tuliomir
Copy link
Copy Markdown
Contributor

@tuliomir tuliomir commented Feb 9, 2026

Depends on #1013 for the test coverage reduction

Acceptance Criteria

  • Adds typings to the Nano Contract methods

Security Checklist

  • Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.

Summary by CodeRabbit

  • Refactor
    • Enhanced type safety for Nano Contract and On-Chain Blueprint operations with strictly typed method signatures, parameters, and return types.
    • Improved API clarity for nano contract transactions, token creation flows, and on-chain blueprint operations across wallet methods.

@tuliomir tuliomir self-assigned this Feb 9, 2026
@tuliomir tuliomir moved this from Todo to In Progress (WIP) in Hathor Network Feb 9, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 93.54839% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.39%. Comparing base (56b81da) to head (c87254c).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/new/wallet.ts 93.54% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1015      +/-   ##
==========================================
+ Coverage   87.38%   87.39%   +0.01%     
==========================================
  Files         114      114              
  Lines        8790     8791       +1     
  Branches     1983     1984       +1     
==========================================
+ Hits         7681     7683       +2     
+ Misses       1081     1080       -1     
  Partials       28       28              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tuliomir tuliomir moved this from In Progress (WIP) to In Progress (Done) in Hathor Network Feb 9, 2026
Comment thread src/new/wallet.ts
r4mmer
r4mmer previously approved these changes Feb 12, 2026
@tuliomir tuliomir moved this from In Progress (Done) to In Review (WIP) in Hathor Network Feb 14, 2026
@tuliomir tuliomir moved this from In Review (WIP) to Parking Lot in Hathor Network Feb 20, 2026
@tuliomir tuliomir moved this from Parking Lot to In Review (WIP) in Hathor Network Feb 20, 2026
@tuliomir tuliomir moved this from In Review (WIP) to In Progress (WIP) in Hathor Network Feb 27, 2026
# Conflicts:
#	src/new/wallet.ts
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 28, 2026

📝 Walkthrough

Walkthrough

This PR enhances type safety for Nano contract and on-chain blueprint operations by replacing generic any type signatures with concrete, strongly-typed method signatures across eight methods in the wallet class. It introduces specific parameter and return types, adds corresponding type imports, and applies non-null assertions to required data fields. Additionally, a seqnum?: number property is added to the IAddressMetadata interface.

Changes

Cohort / File(s) Summary
Nano & On-Chain Contract Typing
src/new/wallet.ts
Enhanced method signatures for createAndSendNanoContractTransaction, createNanoContractTransaction, createAndSendNanoContractCreateTokenTransaction, createNanoContractCreateTokenTransaction, createAndSendOnChainBlueprintTransaction, createOnChainBlueprintTransaction, and getNanoHeaderSeqnum. Changed parameters from any to concrete types (string, CreateNanoTxData, CreateNanoTokenTxOptions, CreateOnChainBlueprintTxOptions) and return types from Promise<any> to specific types (Promise<Transaction | null>, Promise<SendTransaction>, Promise<number>). Added imports for NanoContractBuilderCreateTokenOptions and NanoContractVertexType.
Metadata Interface Extension
src/types.ts
Added optional seqnum?: number property to IAddressMetadata interface with a TODO comment regarding optionality for v3.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #1013: Modifies typing and public signatures in src/new/wallet.ts for queue/websocket types and connection state management, sharing similar patterns of signature refinement and type safety improvements.

Suggested reviewers

  • pedroferreira1
  • raul-oliveira
  • r4mmer

Poem

🐰 From fuzzy any to types crystalline,
Nano contracts now shine with clarity divine,
Strong signatures guide each transaction's flight,
The wallet grows safer, its API tight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references Nano methods typing changes, which aligns with the main objective of adding typings to Nano Contract methods, though it uses the vague abbreviation format '[13]' that may be unclear without context.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/ts-nanos

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/new/wallet.ts`:
- Around line 3441-3443: In getNanoHeaderSeqnum, guard the result of
this.storage.getAddressInfo(address) and its seqnum before incrementing: check
if addressInfo is null/undefined and treat a missing seqnum as 0 (or explicitly
handle the null case by throwing if that’s preferred), then compute and return
(seqnum || 0) + 1; update references to addressInfo and seqnum so you never read
.seqnum from a null value (use a local const seqnum = addressInfo?.seqnum ?? 0
and return seqnum + 1).
- Around line 3076-3081: Add runtime checks at the start of
createNanoContractTransaction and createNanoContractCreateTokenTransaction to
validate that CreateNanoTxData.blueprintId, ncId, and args are present (not
undefined or null) and throw a descriptive error (e.g., "blueprintId is required
for nano contract transaction") if any are missing; then remove the non-null
assertions in the builder chain (replace data.blueprintId!, data.ncId!,
data.args! with data.blueprintId, data.ncId, data.args) so the code uses the
validated values and fails fast with a clear message.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 506dde9 and 9910015.

📒 Files selected for processing (2)
  • src/new/wallet.ts
  • src/types.ts

Comment thread src/new/wallet.ts
Comment thread src/new/wallet.ts
@tuliomir tuliomir moved this from In Progress (WIP) to In Progress (Done) in Hathor Network Mar 2, 2026
@tuliomir tuliomir requested a review from r4mmer March 2, 2026 16:18
Copy link
Copy Markdown
Contributor

@raul-oliveira raul-oliveira left a comment

Choose a reason for hiding this comment

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

LGTM

@tuliomir tuliomir moved this from In Progress (Done) to In Review (WIP) in Hathor Network Mar 4, 2026
@tuliomir tuliomir merged commit 8e6bf10 into master Mar 5, 2026
6 of 7 checks passed
@github-project-automation github-project-automation bot moved this from In Review (WIP) to Waiting to be deployed in Hathor Network Mar 5, 2026
@tuliomir tuliomir deleted the docs/ts-nanos branch March 5, 2026 14:47
@tuliomir tuliomir moved this from Waiting to be deployed to Done in Hathor Network Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants