Skip to content

Add isOwnWallet utility function with unit tests#543

Merged
Chucks1093 merged 1 commit into
accesslayerorg:devfrom
Benedict315:feature/is-own-wallet-utility
Jul 23, 2026
Merged

Add isOwnWallet utility function with unit tests#543
Chucks1093 merged 1 commit into
accesslayerorg:devfrom
Benedict315:feature/is-own-wallet-utility

Conversation

@Benedict315

Copy link
Copy Markdown
Contributor

Description
Added a shared utility function isOwnWallet to consistently check whether a target address belongs to the connected wallet across UI interactions.

Implementation:

Added isOwnWallet(address: string, connectedAddress: string | null): boolean to walletConnection.utils.ts
Returns false when wallet is not connected (connectedAddress is null)
Performs case-insensitive address comparison to handle different casing formats
Simple, reusable helper for ownership checks (edit controls, sell buttons, etc.)
Testing:

Created comprehensive unit tests in walletConnection.utils.test.ts
6 tests covering all acceptance criteria:
Matching addresses return true
Non-matching addresses return false
Null connected address returns false
Case-insensitive comparison (uppercase vs lowercase)
Mixed casing scenarios
All tests passing
Code Quality:

Formatted with Prettier
ESLint compliant
Follows existing codebase patterns
Ready for code review

closes #530

- Add isOwnWallet(address, connectedAddress) to walletConnection.utils.ts
- Returns false when connectedAddress is null (wallet not connected)
- Performs case-insensitive comparison for address matching
- Add comprehensive unit tests covering all acceptance criteria:
  - Matching addresses return true
  - Non-matching addresses return false
  - Null connected address returns false
  - Case-insensitive comparison works correctly
@Chucks1093
Chucks1093 merged commit 1a85b01 into accesslayerorg:dev Jul 23, 2026
1 check 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

Development

Successfully merging this pull request may close these issues.

Add helper for detecting whether a Stellar address belongs to the connected wallet

3 participants