Skip to content

fix: resolve wallet auth bug, missing dep, test consolidation, and Stellar coverage - #671

Merged
DeFiVC merged 4 commits into
ChainLearnOfficial:mainfrom
KidDev88:fix/wave10-issues-531-532-533-535
Oct 24, 2026
Merged

DeFiVC merged 4 commits into
ChainLearnOfficial:mainfrom
KidDev88:fix/wave10-issues-531-532-533-535

Conversation

@KidDev88

Copy link
Copy Markdown
Contributor

Closes #531, Closes #532, Closes #533, Closes #535

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Refactoring (no functional or behavioral changes)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Performance improvement
  • Documentation update
  • Build / CI configuration change
  • Dependency update
  • Other:

Summary

This PR resolves four issues in a single branch:

  1. Fix broken use-auth.ts: duplicate variable declaration and missing imports #531 — connectWallet in src/lib/hooks/use-auth.ts had a leftover Freighter-only code path that redeclared address and called isFreighterInstalled() / connectFreighter() without importing them, breaking the core wallet connection flow. The legacy block is removed so all wallets go through connectStellarWallet().
  2. Add missing react-easy-crop dependency to package.json #532 — avatar-upload.tsx imports react-easy-crop, but the package was never declared in package.json. It is now listed under dependencies.
  3. Consolidate duplicate vitest configs and test directories #533 — Duplicate vitest configs, test setup directories, and co-located test files are consolidated into a single config (vitest.config.ts) and a single test root (src/tests/).
  4. Add tests for Stellar wallet, transactions, and contracts modules #535 — New unit tests cover the previously untested surfaces of the Stellar modules: network helpers, SEP-10 challenge signing, toScVal argument conversion, and simulateContractCall error handling.

Motivation / Context

Closes #531, Closes #532, Closes #533, Closes #535


Changes

Issue File(s) Change
#531 src/lib/hooks/use-auth.ts Removed dead Freighter-only block (duplicate address, missing imports); connectWallet now solely uses connectStellarWallet()
#532 package.json Added "react-easy-crop": "^6.2.4" to dependencies
#533 vitest.config.mts Deleted (kept the more complete vitest.config.ts)
#533 src/test/ Deleted after merging unique cleanup() + useParams mock into src/tests/setup.tsx
#533 src/tests/shared/format.test.ts Deleted (kept the more comprehensive src/lib/utils/__tests__/format.test.ts, 184 lines vs 56)
#533 15 co-located *.test.tsx files Deleted duplicates of the larger centralized copies under src/tests/
#535 src/tests/shared/stellar-core-gaps.test.ts New: 12 tests covering wallet network helpers, signChallenge (success/empty signature/LOBSTR limitation), toScVal via buildContractInvokeTx, and simulateContractCall success/RPC-error

Testing

Note: Local npm / node execution was intentionally skipped in this environment (sandbox restriction). Please run CI or the commands below to verify.

npm install   # resolves react-easy-crop and updates package-lock.json
npm test
npm run typecheck

Expected outcomes:

Tradeoffs

  • package-lock.json not regenerated — running npm install was out of scope for this environment. CI / the next npm install will resolve and pin react-easy-crop@6.2.4. If maintainers prefer a pre-updated lockfile, I can push that follow-up.
  • Co-located duplicates removed in favor of src/tests/ — the centralized copies were larger and better structured (shared defaultProps, loading-state coverage) in 14/15 pairs. The one pair where co-located was longer (claim-button.test.tsx) tested the same behaviors with a different fixture shape; the centralized version covers the loading state the co-located one missed.
  • format.test.ts kept in src/lib/utils/__tests__/ — it is the more comprehensive suite (184 vs 56 lines) and sits next to the module it tests.

Out of scope

  • Regenerating package-lock.json (requires npm install)
  • Refactoring wallet.ts / transactions.ts / contracts.ts beyond what the tests exercise
  • Fixing the "KNOWN BUG" cases already documented in stellar-contracts-helpers.test.ts (fail-open credential validation, readCredentialMetadata decode issue) — those are tracked separately
  • Removing the committed test_output.log artifact (unrelated cleanup)

The multi-wallet StellarWalletsKit migration left a dead Freighter-only
code path in connectWallet that redeclared the address binding and called
isFreighterInstalled()/connectFreighter() without importing them. Drop the
legacy block so connectWallet uses connectStellarWallet() for all wallet
types (Freighter, LOBSTR, Rabet).

Closes ChainLearnOfficial#531
avatar-upload.tsx imports react-easy-crop for image cropping but the
package was never declared in package.json, so fresh installs fail to
resolve the import and break the settings avatar upload flow.

Closes ChainLearnOfficial#532
Remove vitest.config.mts in favour of the more complete vitest.config.ts,
merge the unique cleanup/useParams setup from src/test/setup.ts into
src/tests/setup.tsx, and drop the src/test/ directory. Remove the
duplicate format.test.ts (keeping the more comprehensive
src/lib/utils/__tests__/format.test.ts) and the 15 co-located test files
that duplicated the centralized copies under src/tests/.

Closes ChainLearnOfficial#533
Add unit tests for the Stellar modules covering the gaps left by the
existing stellar-*.test.ts suites: network helper functions
(getNetworkPassphrase, getRpcUrl, getHorizonUrl, normalizeNetwork),
SEP-10 challenge signing success and error paths, toScVal argument
conversion through buildContractInvokeTx, and simulateContractCall
success/RPC-error handling. All external dependencies (StellarWalletsKit,
Soroban RPC, fetch) are mocked.

Closes ChainLearnOfficial#535
@netlify

netlify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for chainlearn failed.

Name Link
🔨 Latest commit 18ca7b5
🔍 Latest deploy log https://app.netlify.com/projects/chainlearn/deploys/6adbc5c12a8abd1cd826e5f7

@DeFiVC
DeFiVC merged commit 922845e into ChainLearnOfficial:main Oct 24, 2026
1 of 8 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

2 participants