Skip to content

feat: show Stellar network/asset context before settlement and validate explorer links - #451

Merged
mergekeeper[bot] merged 5 commits into
mergepay:mainfrom
Orah-dev:main
Sep 1, 2026
Merged

feat: show Stellar network/asset context before settlement and validate explorer links#451
mergekeeper[bot] merged 5 commits into
mergepay:mainfrom
Orah-dev:main

Conversation

@Orah-dev

Copy link
Copy Markdown
Contributor

Summary

This PR addresses two issues in a single changeset:

Closes #118 — Show explicit Stellar network and asset context before settlement

Add a pre-sign confirmation panel that displays the configured Stellar network, settlement asset, amount, and recipient before the user opens Freighter. This prevents signing against an unintended environment and reduces settlement mistakes.

  • SettlementConfirmation component — Shows network label (derived from configuration), asset badge (XLM/USDC), amount, recipient, and a network mismatch warning when the intent passphrase does not match the deployment config
  • Network passphrase validationisNetworkMismatch() helper in useSettlementFlow.tsx and a defense-in-depth check in stellar.tsx block signing when the API returns an envelope for the wrong network
  • Stale/missing data — The confirmation panel is only rendered when valid settlement data exists; missing or stale data keeps the sign button disabled via the existing WalletPrerequisiteNotice

Closes #121 — Safe external-link handling for Stellar transaction records

The existing explorer.ts and TxLink component already implement safe link handling (validated URLs, rel="noopener noreferrer", sr-only accessible names, plain-text fallback for invalid hashes). This PR adds comprehensive test coverage:

  • Testnet/mainnet link isolation (no cross-network linking)
  • Path traversal attack rejection
  • Short, long, non-hex, whitespace, and special character hash rejection
  • Numeric and object input rejection

Changes

File Change
src/components/settle/settlement-confirmation.tsx New — Pre-sign confirmation panel
src/components/settle/settlement-confirmation.vitest.test.tsx New — 11 tests for the confirmation panel
src/components/settle/settle-dialog.tsx Replace step list with SettlementConfirmation in review step
src/lib/useSettlementFlow.tsx Add isNetworkMismatch() pure helper + network validation in submit flow
src/lib/stellar.tsx Add network passphrase validation in signAndConfirmSettlement()
src/lib/__tests__/explorer.test.ts 11 new edge-case tests for explorer URL safety
src/lib/__tests__/useSettlementFlow.test.ts 7 new tests for isNetworkMismatch()

Verification

  • tsc --noEmit — No type errors
  • npm run lint — No ESLint warnings or errors
  • npm run test — 755/755 tests passing
  • npm run build — Build succeeds

🤖 Generated with Codebuff
Co-Authored-By: Codebuff noreply@codebuff.com

…te explorer links

Add pre-sign confirmation panel (mergepay#118) that displays the configured
Stellar network, settlement asset, amount, and recipient before the
user opens Freighter. Block signing when the API's intent network
passphrase does not match the deployment configuration.

Centralize network-aware explorer URL construction and validate all
transaction identifiers before rendering as links (mergepay#121). Ensure
malformed hashes and missing data fall back to plain text instead of
producing broken external links.

Closes mergepay#118
Closes mergepay#121

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@mergekeeper

mergekeeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

MergeKeeper review

Scope: in scope for linked issue #118.
Verdict: clean

The pull request correctly implements pre-sign Stellar network and asset confirmation for settlements (#118) and robust test coverage for safe external explorer links (#121) following all repository guidelines.

Reviewed commit: 679be43ef3860f8e60e8574e10cc097fbfa58408.
CI and merge eligibility are checked separately.

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Orah-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@mergekeeper

mergekeeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

MergeKeeper review unavailable

AI provider review response did not contain valid JSON

No approval or merge action was taken.

@mergekeeper

mergekeeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

MergeKeeper merge status

Status: blocked
PR state: open
Mergeability: mergeable
Checked commit: 6cd080b4acc8d4684073d2d4c7c1f1445558eb6b.

Reason: One or more required CI checks failed.

Failing checks:

Next steps:

  1. Open the failing check details above and fix the reported error.
  2. Run the same checks locally where possible.
  3. Commit and push the fix.
  4. MergeKeeper will automatically re-review the updated PR.

Orah-dev and others added 2 commits September 1, 2026 11:46
Tests assumed CONFIGURED_NETWORK defaulted to "testnet" but the codebase
defaults to "public", causing mismatch checks to fire in the wrong
direction. Also updated the amount assertion to match the formatted
"10.00 XLM" output and fixed the a11y test to match the actual aria-label.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
The Money component renders "10.00 XLM" in both an aria-hidden span and
an sr-only span, causing getByText to throw on multiple matches.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>

@mergekeeper mergekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved

The pull request correctly implements pre-sign Stellar network and asset confirmation for settlements (#118) and robust test coverage for safe external explorer links (#121) following all repository guidelines.

@mergekeeper
mergekeeper Bot merged commit b349c3a into mergepay:main Sep 1, 2026
1 check passed
@mergekeeper

mergekeeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Merged

Merged with squash.

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 safe external-link handling for Stellar transaction records Show explicit Stellar network and asset context before settlement

1 participant