feat: restore transaction history from event log#438
Conversation
…ents to display restored amounts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b170b0a77
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7102a0abd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…r transaction pagination
There was a problem hiding this comment.
Pull request overview
This PR adds a transaction-history recovery path for wallets restored from a mnemonic by reconstructing visible transactions from the Fedimint event log when the normal listTransactions/listOperations history is empty, and updates Lightning UI rendering to support restored transactions that may not have an invoice string.
Changes:
- Track whether the wallet was restored from mnemonic via
FEDIMINT_WALLET_RESTORED_KEYandwasRestoredFromMnemonicstate. - Add
getTransactionsPagefallback to read and map the federation event log intoTransactions(with internal cursor support). - Update Lightning transaction components (and tests) to render amounts from
amountMsatswhen invoice/gateway/txId fields are missing.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/stores/wallet.ts |
Adds restored-wallet flag + event-log-based transaction history fallback and pagination cursor support. |
src/components/LightningTransactionItem.vue |
Displays restored Lightning amounts from amountMsats without invoice decoding; updates fiat conversion behavior accordingly. |
src/components/LightningTransactionDetails.vue |
Hides gateway/invoice/txid sections when missing and uses restored amountMsats for sats/fiat display. |
test/vitest/stores/wallet.test.ts |
Adds coverage for restored event log fallback behavior and pagination/cursor behavior. |
test/vitest/components/LightningTransactionItem.test.ts |
Tests rendering restored amounts without decoding invoices. |
test/vitest/components/LightningTransactionDetails.test.ts |
Tests hiding missing fields and rendering restored amounts without decoding invoices. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const eventLog = await fetchCompleteRestoredEventLog(wallet) | ||
| const restoredTransactions = mapRestoredTransactionsFromEventLog(eventLog) | ||
| const startIndex = | ||
| cursor == null | ||
| ? 0 | ||
| : Math.max( | ||
| 0, | ||
| restoredTransactions.findIndex( | ||
| (transaction) => transaction.operationId === cursor.operationId, | ||
| ) + 1, | ||
| ) | ||
| const pageTransactions = restoredTransactions.slice(startIndex, startIndex + pageSize) | ||
| const hasMore = startIndex + pageSize < restoredTransactions.length |
| invoice: '', | ||
| outcome: 'claimed', | ||
| gateway: '', | ||
| txId: operationId, |
| function getLightningTransactionAmountSats(transaction: LightningTransaction): number | null { | ||
| const amountMsats = (transaction as LightningTransaction & { amountMsats?: unknown }).amountMsats | ||
| return typeof amountMsats === 'number' && Number.isFinite(amountMsats) && amountMsats > 0 | ||
| ? Math.floor(amountMsats / 1_000) | ||
| : null | ||
| } |
No description provided.