Skip to content

fix: repair root typecheck and pin lint/format tooling#93

Merged
thephez merged 3 commits into
mainfrom
fix/setupclient
Jun 11, 2026
Merged

fix: repair root typecheck and pin lint/format tooling#93
thephez merged 3 commits into
mainfrom
fix/setupclient

Conversation

@thephez

@thephez thephez commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

The root npm run lint was failing against setupDashClient.mjs. This branch fixes the typecheck, pins the tooling it depends on, and adds an identity balance readout to view-wallet.mjs.

What changed

  • Fix root typechecksetupDashClient-core.d.mts was added as a narrow typed boundary for the example apps and only declared the subset they consume. Because the root tsc resolves this .d.mts instead of the JSDoc-typed .mjs, the wrapper failed to typecheck against members it relies on. Declared the missing exports and widened createClient's return to the full SDK surface; the example apps' imports are unaffected.
  • Pin tooling — moved prettier and typescript from npx to pinned devDependencies and pointed the fmt/lint scripts at the local binaries.
  • view-wallet balanceview-wallet.mjs now fetches the identity and prints its balance in credits and DASH.

Test plan

  • npm run lint passes (previously errored)
  • node view-wallet.mjs shows the identity balance line

Summary by CodeRabbit

  • New Features
    • Added address management capabilities with new key management functionality
    • Introduced new identity key manager factory method for streamlined setup
    • Wallet now displays balance information including credits and converted DASH value

thephez added 3 commits June 10, 2026 16:43
The setupDashClient-core.d.mts was added as a narrow typed boundary for the example apps and only declared the subset they consume. Node16 resolution makes the root tsc lint resolve this .d.mts instead of the JSDoc-typed .mjs, so the root wrapper failed to typecheck against members it relies on.

Declare the missing exports (createForNewIdentity, AddressKeyManager, KEY_SPECS, dip13KeyPath), export ConnectedDashClientLike, and widen createClient's return to ConnectedDashClientLike & EvoSDK so the wrapper sees the full SDK surface.
Move prettier and typescript from on-the-fly npx invocations to pinned devDependencies, and call the local binaries directly in the fmt and lint scripts.
Fetch the identity after resolving its ID and print the balance, converting credits to DASH (1000 credits = 1 duff, 1e8 duffs = 1 DASH).
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates build tooling to use locally installed binaries, expands the SDK type surface with key and address management APIs, and enhances the wallet script to fetch and display identity balance information from the Dash network.

Changes

Wallet Balance Display Feature

Layer / File(s) Summary
Package build tool configuration
package.json
Format and lint scripts now invoke locally installed prettier and tsc directly instead of npx with pinned versions; prettier@3.8.1 and typescript@4.9.5 are added to devDependencies.
SDK type definitions for key and address management
setupDashClient-core.d.mts
New EvoSDK and PlatformAddress imports support an AddressEntry interface. ConnectedDashClientLike is now exported. IdentityKeyManager gains a createForNewIdentity(...) static factory. New AddressKeyManager class provides address storage and key signing via getSigner() and getFullSigner() methods. KEY_SPECS constant and dip13KeyPath(...) function are exported. createClient() return type is widened to ConnectedDashClientLike & EvoSDK.
Wallet balance display implementation
view-wallet.mjs
Script fetches the authenticated identity balance via sdk.identities.fetch(identityId), then conditionally logs the balance in credits and as converted DASH amount (formatted to 8 decimal places).

🎯 2 (Simple) | ⏱️ ~12 minutes

🐰 A rabbit hops through SDK fields so bright,
With balance displayed, the wallet shines light.
Tools now installed, no npx delay,
Key management ready—hop, hop, hooray! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the three main changes: fixing root typecheck, pinning lint/format tooling, and the identity balance feature aligns with PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/setupclient

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@thephez

thephez commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@dashpay dashpay deleted a comment from coderabbitai Bot Jun 11, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@setupDashClient-core.d.mts`:
- Around line 162-167: The added type declarations for non-exported symbols must
be removed or replaced to match the installed `@dashevo/evo-sdk` (3.1.0-dev.6):
remove or revert the declarations for AddressKeyManager, KEY_SPECS, dip13KeyPath
and the static IdentityKeyManager.createForNewIdentity signature, and instead
use the actual exported types from the package (EvoSDK and EvoSDKOptions / any
types available in dist/sdk.d.ts); update any references in
setupDashClient-core.d.mts that import or rely on
IdentityKeyManager.createForNewIdentity to use the EvoSDK-provided APIs or
factory functions exposed by EvoSDK/EvoSDKOptions so the declaration file
matches the package's real exports.

In `@view-wallet.mjs`:
- Line 49: The current guard only checks balance !== null which still allows
undefined and leads to NaN when doing Number(balance)/1e11; update the condition
around where balance (derived from identity.balance) is used (the if block that
begins with "if (balance !== null)") to explicitly check for both null and
undefined (e.g., use balance != null or balance !== null && balance !==
undefined) so the conversion Number(balance)/1e11 only runs when balance is
actually present.
- Around line 33-34: sdk.identities.fetch(identityId) can return undefined, so
before reading identity.balance you must guard the fetch result (the identity
variable from sdk.identities.fetch) and handle the case where it's undefined;
verify the wasm.Identity type for the exact shape and nullability of the balance
property and coerce/convert it to the expected primitive (e.g., Number or
string) or default to 0 if absent. Update the code path using identity.balance
to first check for identity !== undefined (or throw/return an error),
assert/extract the confirmed balance type from wasm.Identity, and assign a safe
fallback to balance so downstream code never accesses a property on undefined.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b663337d-61c4-4cc2-931f-90620618fb24

📥 Commits

Reviewing files that changed from the base of the PR and between 484d2f2 and 9100cd8.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • package.json
  • setupDashClient-core.d.mts
  • view-wallet.mjs

Comment thread setupDashClient-core.d.mts
Comment thread view-wallet.mjs
Comment thread view-wallet.mjs
@thephez thephez merged commit a719917 into main Jun 11, 2026
3 checks passed
@thephez thephez deleted the fix/setupclient branch June 11, 2026 20:15
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.

1 participant