test: add comprehensive unit tests for usePathPayment - strict-send and strict-receive modes#1
Open
believetimothy wants to merge 2 commits into
Open
test: add comprehensive unit tests for usePathPayment - strict-send and strict-receive modes#1believetimothy wants to merge 2 commits into
believetimothy wants to merge 2 commits into
Conversation
… strict-receive modes
…l hooks Add a new validation utility module (src/utils/validation.ts) that wraps StrKey from @stellar/stellar-sdk to validate Stellar public keys (G...) and Soroban contract IDs (C...). Validators throw descriptive ValidationError messages on invalid input. Hooks updated with public key validation: - useStellarAccount – validates publicKey before Horizon fetch - useStellarOffers – validates publicKey before Horizon fetch - useClaimableBalances – validates publicKey before Horizon fetch - usePayment – validates destination and asset.issuer (credit assets) - usePathPayment – validates destination, sendAsset.issuer, destAsset.issuer - useStellarTransaction – validates feeBump.sponsor address Hooks updated with contract ID validation: - useSorobanContract – validates contractId in call() and simulate() - useSorobanTokenBalance – validates contractId and accountAddress - useContractEvents – validates contractId in fetchEvents() Test mocks updated to expose StrKey validation functions. Closes dark-princezz#189
believetimothy
pushed a commit
that referenced
this pull request
Jun 24, 2026
feat: implement useMultiSig() — build and collect multi-signature transactions
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.
Summary
Adds 13 new unit tests to
usePathPayment.test.ts, expanding coverage from 8 to 21 tests. The new tests cover bothstrict-sendandstrict-receivemodes with better asset resolution, Horizon/Stellar SDK interaction verification, and edge case handling.Changes
New Strict-Send Tests
new Asset(code, issuer)is called for credit-type send assetsAsset.native()is called for native-type dest assetspathoption is providedconfig.horizonUrlloadAccountis called with the correct publicKeyaddOperationandsetTimeoutare invoked on the TransactionBuilderuseTransactionvi.hoisted)sendAmountanddestMinwith mixed asset typesNew Strict-Receive Tests
sendAmountmaps tosendMaxanddestMinmaps todestAmountInfrastructure
vi.hoistedto create a mutable publicKey mock, avoiding hoisting issues with inlinevi.mockcalls inside test bodiesTest Plan
Closes dark-princezz#141