Skip to content

feat(admin): add admin action history feed #616 - #624

Open
sunnykid-02 wants to merge 1 commit into
drydocs:mainfrom
sunnykid-02:fix/admin-action-history-feed
Open

feat(admin): add admin action history feed #616#624
sunnykid-02 wants to merge 1 commit into
drydocs:mainfrom
sunnykid-02:fix/admin-action-history-feed

Conversation

@sunnykid-02

Copy link
Copy Markdown

Overview

This PR adds the Admin Action History feed for the admin dashboard (issue #616). It provides a chronological list of past set_admin, set_paused, set_adapter, migrate_adapter, transfer_admin, and accept_admin calls, each with a summary, timestamp, and a link to the transaction.

Related Issue

Closes #616

Changes

📋 Admin Action History Scanner

  • [ADD] packages/stellar-sdk-helpers/src/admin-history.ts

    • Scans Horizon /operations for invoke_host_function entries whose base64-encoded parameters[0] matches the vault contract ID and parameters[1] matches one of the six admin function names.
    • Decodes ScVal parameters using @stellar/stellar-sdk XDR parsing.
    • Paginates through Horizon operations with configurable limit and maxPages.
    • Produces color-coded summaries for each action type.
  • [ADD] packages/stellar-sdk-helpers/src/admin-history.test.ts

    • Unit tests for decodeScVal (address, symbol, u64 decoding) and summarizeAction (all six admin function types).

🌐 API Layer

  • [ADD] packages/api-core/src/admin-history.ts

    • Framework-agnostic handler that validates the vault against KNOWN_POOLS and returns paginated admin actions.
  • [ADD] api/v1/admin/history.ts

    • Vercel serverless endpoint: GET /api/v1/admin/history?vaultId=...
    • Cached at the edge (s-maxage=30, stale-while-revalidate=120).

🎨 Frontend

  • [ADD] apps/web/src/components/dashboard/AdminActionHistory.tsx

    • Feed component with color-coded badges, one-line summaries, timestamps, and transaction links.
    • Empty state handling and error states.
  • [ADD] apps/web/src/hooks/useAdminHistory.ts

    • React Query hook for the admin history API.
  • [ADD] apps/web/src/hooks/useIsAdmin.ts

    • Reads get_admin via Soroban RPC to determine if the connected wallet is the current vault admin.
  • [MODIFY] apps/web/src/App.tsx

    • Wires AdminActionHistory into the dashboard below VaultPanel.
    • Renders only when the connected wallet is the vault admin.
  • [MODIFY] apps/web/src/lib/api.ts

    • Adds getAdminHistory(vaultId) method.
  • [MODIFY] apps/web/messages/en.json / fr.json

    • Adds i18n strings for the admin history panel.
  • [MODIFY] packages/stellar-sdk-helpers/src/index.ts

    • Exports the new admin-history module.

Data Source Decision

The vault contract does not emit Soroban events, and redeploying it to add events would change the contract ID and break existing integrations. Instead, Horizon's /operations endpoint exposes invoke_host_function operations whose base64-encoded parameters[0] is the target contract address and parameters[1] is the function name. This provides a complete, queryable off-chain history without any contract changes.

Verification Results

✅ XDR decoding verified against live Horizon testnet data
✅ Contract IDs and function names parse correctly
✅ summarizeAction tested for all six admin function types
✅ API handler unit tests pass (mocked)
✅ Empty state, error state, and loading state handled in UI

Acceptance Criteria

Criterion Status
Data source confirmed and documented ✅ Horizon operations provide complete queryable history
Feed shows action type (badge, color-coded) ✅ Badges for set_admin, set_paused, set_adapter, migrate_adapter, transfer_admin, accept_admin
One-line summary + timestamp + tx link ✅ Implemented in AdminActionHistory.tsx
Empty state handled ✅ "No admin actions recorded yet"
Matches design spacing/colors ✅ Uses existing dark theme (#161b22, #0d1117, accent colors)
No contract redeployment required ✅ Pure off-chain scan

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@sunnykid-02 is attempting to deploy a commit to the Collins' projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@sunnykid-02 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

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.

[Feature] Admin dashboard: admin action history feed

1 participant