Files
ObsidianDragon/src/ui/windows/transactions_tab.h
T
DanSandClaude Opus 4.8 8b46ead72a feat(export): CSV export scope — All / current filter / date range
Finishes the transactions-export partial. The dialog now offers three scopes:
- All transactions (unchanged default; exported with no copy).
- Current History filter — the Transactions tab publishes a TxFilterSnapshot of
  the visible legs (a merged autoshield row contributes both its send+receive
  legs, so the CSV stays a per-leg record like an unfiltered export); the radio
  is disabled with an explanation when no filter is active, and a snapshot that
  predates the current tx list (revision mismatch) is refused rather than
  silently exporting everything.
- Date range (YYYY-MM-DD, inclusive end-of-day; pending/dateless rows excluded
  with a note; invalid/reversed dates blocked inline).
The live count reflects what will actually be exported. formatTransactionsCsv
and the atomic write are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-19 00:19:24 -05:00

55 lines
1.8 KiB
C++

// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
#pragma once
#include <string>
#include <vector>
#include <cstdint>
#include <cstddef>
namespace dragonx {
class App;
namespace ui {
/**
* @brief Snapshot of what the History tab currently shows, for "export current filter".
*
* `indices` are positions into WalletState::transactions of every leg currently visible (a merged
* autoshield row contributes both its send and receive legs), sorted ascending. Published only when the
* filtered list is (re)built, so it reflects the last state the History tab rendered. `txRevision` lets a
* consumer reject a snapshot that predates the current tx list.
*/
struct TxFilterSnapshot {
bool valid = false;
bool active = false; // a type filter and/or search text is applied
std::uint64_t txRevision = 0;
std::string description; // human label of the active filter
std::vector<std::size_t> indices;
};
/// The latest History-tab filter snapshot (see TxFilterSnapshot).
const TxFilterSnapshot& GetTransactionsFilterSnapshot();
/**
* @brief Render the Transactions tab
* Shows transaction history
*/
void RenderTransactionsTab(App* app);
/**
* @brief Pre-filter the Transactions (History) tab by an address.
*
* Sets the History search box to @p address and resets the type filter to All on the next
* render, then the caller navigates to the History tab. Used by the "View transactions"
* actions in Contacts, the Balance address list, and the Receive tab. Because shielded /
* received-from attribution is incomplete, this shows transactions *involving* the address,
* not a guaranteed-complete set.
*/
void SetTransactionsAddressFilter(const std::string& address);
} // namespace ui
} // namespace dragonx