Skip to content

feat(frontend): add a copyable Stellar explorer link on the success toast (#1741) - #1779

Open
amehsamuel200225-sketch wants to merge 1 commit into
Junirezz:mainfrom
amehsamuel200225-sketch:feat/1741-copyable-explorer-link-toast
Open

amehsamuel200225-sketch wants to merge 1 commit into
Junirezz:mainfrom
amehsamuel200225-sketch:feat/1741-copyable-explorer-link-toast

Conversation

@amehsamuel200225-sketch

Copy link
Copy Markdown

Summary

Closes #1741.

After a successful deposit or withdrawal the user had to open the Transaction History page, find the row, and copy the hash by hand. The success toast now carries the hash itself, a copy control, and a direct explorer link.

Acceptance criteria

Criterion Implementation
Link uses the network-correct explorer base URL from config getStellarExplorerUrl(hash, networkConfig.isTestnet ? "testnet" : "mainnet"), which reads stellarExplorerBaseUrls from src/config/network — so a VITE_STELLAR_EXPLORER_URL override is honoured
Copy action uses clipboard API with a success/failure toast copyTextToClipboard() (Clipboard API with the execCommand fallback) raising toast.success / toast.error through the app's toast system
Hash is truncated for display but copied in full Visible text is truncateHash() (aaaaaaaa...aaaa); the clipboard always receives the full 64-character hash
Works for deposit, withdrawal and strategy transactions All three funnel into the single success toast in VaultDashboard — strategy pages call triggerDepositIntent(), which routes into the same deposit handler

What changed

frontend/src/components/ToastTransactionRow.tsx (new)
The hash row: truncated hash (full value in title + data-tx-hash), a copy button with idle/copied/failed icon + text states and aria-label, and a target="_blank" rel="noopener noreferrer" explorer link whose accessible name is "View transaction {full hash} on the Stellar explorer".
If the hash does not parse as a valid 64-character hash the row renders nothing — there is no explorer page for it and nothing trustworthy to copy.

frontend/src/context/ToastContext.tsx

  • ToastOptions gains an optional txHash.
  • pushSonner() now renders the description plus the hash row as one inline group. Without txHash the payload is the plain string, byte-for-byte what it was before, so no existing toast changes.
  • The provider injects a notify prop rather than the row calling useToast(). The row is rendered from inside the toast tree, so importing the context from it would create a circular ToastContext ↔ ToastTransactionRow import.

frontend/src/components/VaultDashboard.tsx — passes txHash: submittedTxHash to the deposit/withdrawal success toast.

frontend/src/i18n/locales/en.ts / es.ts — new txToast block (10 keys) in both locales.

frontend/src/index.css — styles for the row, mirroring the existing .copy-button conventions (including light-theme and :focus-visible handling).

Design notes

  • Copy feedback is deduplicated (dedupeKey: "tx-hash-copy"), so repeatedly clicking Copy does not queue identical toasts.
  • The description text is preserved. The hash row is appended beneath "100.00 USDC has been deposited into the vault.", not instead of it.
  • Everything in the row is <span>-based with display: block wrappers, so the markup stays valid whether sonner nests the description in a <div> or a <p>.

Validation

New tests (7):

ToastTransactionRow.test.tsx   6 passed
ToastContext.test.tsx          1 passed (new case added to existing suite)

Covering: network-correct testnet and mainnet hrefs, full-hash-not-truncated on the clipboard, success toast on copy, failure toast when the clipboard rejects, null render for unparseable / wrong-length hashes, and the end-to-end render inside ToastProvider.

npx tsc -b                     → exit 0
npx eslint <7 changed files>   → 0 errors (1 pre-existing a11y warning at VaultDashboard.tsx:1298)

Full frontend suite: 1463 passed | 14 failed (1477).

The 14 failures are pre-existing on origin/main and unrelated to this change — they sit in Navbar, NotificationBell, TransactionConfirmationModal, and VaultDashboard (missing WithdrawalNotificationProvider in test harnesses, an ambiguous $1,000,000 query, etc.).

Verified rather than assumed: git stash → re-ran those files on a clean origin/main checkout → reproduced the identical 4 failed files / 14 failed result, including the exact same VaultDashboard test:

FAIL src/components/VaultDashboard.test.tsx > VaultDashboard > updates the TVL display after a successful deposit
   (on clean origin/main, with all of this PR's changes stashed)

Baseline origin/main = 1470 tests / 1456 passed / 14 failed; this branch = 1477 / 1463 / 14 — +7 passing, failures unchanged.

@drips-wave

drips-wave Bot commented Nov 22, 2026

Copy link
Copy Markdown

@amehsamuel200225-sketch 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

This branch has not been deployed

No deployments
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.

feat(frontend): add a copyable Stellar explorer link for the transaction hash on the success toast

1 participant