Skip to content

feat: restore transaction history from event log#438

Open
ngutech21 wants to merge 3 commits into
masterfrom
feat-restore-history
Open

feat: restore transaction history from event log#438
ngutech21 wants to merge 3 commits into
masterfrom
feat-restore-history

Conversation

@ngutech21
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment thread src/stores/wallet.ts Outdated
@ngutech21
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment thread src/stores/wallet.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_KEY and wasRestoredFromMnemonic state.
  • Add getTransactionsPage fallback to read and map the federation event log into Transactions (with internal cursor support).
  • Update Lightning transaction components (and tests) to render amounts from amountMsats when 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.

Comment thread src/stores/wallet.ts
Comment on lines +1365 to +1377
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
Comment thread src/stores/wallet.ts
invoice: '',
outcome: 'claimed',
gateway: '',
txId: operationId,
Comment on lines +107 to +112
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
}
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.

2 participants