Repository navigation
fix: resolve wallet auth bug, missing dep, test consolidation, and Stellar coverage - #671
Merged
DeFiVC merged 4 commits intoOct 24, 2026
Conversation
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
❌ Deploy Preview for chainlearn failed.
|
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.
Closes #531, Closes #532, Closes #533, Closes #535
Type of Change
Summary
This PR resolves four issues in a single branch:
connectWalletinsrc/lib/hooks/use-auth.tshad a leftover Freighter-only code path that redeclaredaddressand calledisFreighterInstalled()/connectFreighter()without importing them, breaking the core wallet connection flow. The legacy block is removed so all wallets go throughconnectStellarWallet().avatar-upload.tsximportsreact-easy-crop, but the package was never declared inpackage.json. It is now listed underdependencies.vitest.config.ts) and a single test root (src/tests/).toScValargument conversion, andsimulateContractCallerror handling.Motivation / Context
Closes #531, Closes #532, Closes #533, Closes #535
Changes
src/lib/hooks/use-auth.tsaddress, missing imports);connectWalletnow solely usesconnectStellarWallet()package.json"react-easy-crop": "^6.2.4"todependenciesvitest.config.mtsvitest.config.ts)src/test/cleanup()+useParamsmock intosrc/tests/setup.tsxsrc/tests/shared/format.test.tssrc/lib/utils/__tests__/format.test.ts, 184 lines vs 56)*.test.tsxfilessrc/tests/src/tests/shared/stellar-core-gaps.test.tssignChallenge(success/empty signature/LOBSTR limitation),toScValviabuildContractInvokeTx, andsimulateContractCallsuccess/RPC-errorTesting
Expected outcomes:
npm run typecheckno longer reports duplicateaddress/ missingisFreighterInstalled/connectFreightersymbols inuse-auth.tsnpm installinstallsreact-easy-crop;npm run buildresolves the import inavatar-upload.tsxnpm testruns from a single config (vitest.config.ts) and single setup (src/tests/setup.tsx); no test file lost — only exact-duplicate pairs were removed, always keeping the more comprehensive copynpm testpasses the newstellar-core-gaps.test.tssuite (12 cases)Tradeoffs
package-lock.jsonnot regenerated — runningnpm installwas out of scope for this environment. CI / the nextnpm installwill resolve and pinreact-easy-crop@6.2.4. If maintainers prefer a pre-updated lockfile, I can push that follow-up.src/tests/— the centralized copies were larger and better structured (shareddefaultProps, 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.tskept insrc/lib/utils/__tests__/— it is the more comprehensive suite (184 vs 56 lines) and sits next to the module it tests.Out of scope
package-lock.json(requiresnpm install)wallet.ts/transactions.ts/contracts.tsbeyond what the tests exercisestellar-contracts-helpers.test.ts(fail-open credential validation,readCredentialMetadatadecode issue) — those are tracked separatelytest_output.logartifact (unrelated cleanup)