-
Notifications
You must be signed in to change notification settings - Fork 13
asp.ts: read history and vtxos from database #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughReplaces Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant SWWallet as ServiceWorkerWallet
participant Repo as walletRepository
Caller->>SWWallet: getVtxos(wallet)
SWWallet->>SWWallet: getAddress()
SWWallet->>Repo: getVtxos(address)
Repo-->>SWWallet: [vtxo[]]
SWWallet-->>Caller: return classified VTXOs
note right of SWWallet #e6f7ff: Classification uses isSpentOffchain and isSettled
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying wallet-bitcoin-v8 with
|
| Latest commit: |
96d6ee5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://36b79d88.wallet-v8.pages.dev |
| Branch Preview URL: | https://read-from-db.wallet-v8.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/lib/asp.ts(3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
📚 Learning: 2025-06-30T18:33:29.839Z
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
Applied to files:
src/lib/asp.ts
🧬 Code graph analysis (1)
src/lib/asp.ts (1)
src/lib/types.ts (2)
Tx(70-80)Vtxo(95-95)
🔇 Additional comments (3)
src/lib/asp.ts (3)
1-1: LGTM: Import added for ServiceWorkerWallet.The import is necessary for the updated function signatures.
129-131: ---The code correctly uses "settledBy" — no issue found.
The codebase uses
settledByconsistently at src/lib/asp.ts:130, and there are no usages ofsettleByelsewhere. The property name appears correct (semantically, "settledBy" is the past participle form, meaning "settled by [transaction]"). The review comment's concern about a discrepancy between PR description and code cannot be verified without access to the PR objectives, but the implementation itself is consistent and correct.
123-125: The concern in the review comment is invalid. ThegetVtxossignature change is justified and not a problematic breaking change.The implementation requires
wallet.walletRepository.getVtxos(address), which is a ServiceWorkerWallet-specific property. This pattern is consistent withgetTxHistory, which already has a ServiceWorkerWallet signature and similarly useswallet.walletRepository.getTransactionHistory(address). UnlikegetBalanceandcollaborativeExitthat can accept IWallet, thegetVtxosfunction cannot function with IWallet due to missing the repository property.The single caller in
src/providers/wallet.tsx:112already passesswWallet, which is ServiceWorkerWallet, so no additional updates are needed.
Deploying wallet-signet with
|
| Latest commit: |
96d6ee5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7622c838.wallet-23u.pages.dev |
| Branch Preview URL: | https://read-from-db.wallet-23u.pages.dev |
Deploying wallet-mutinynet with
|
| Latest commit: |
96d6ee5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://63458145.arkade-wallet.pages.dev |
| Branch Preview URL: | https://read-from-db.arkade-wallet.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/providers/wallet.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: bordalix
PR: arkade-os/wallet#114
File: src/lib/asp.ts:0-0
Timestamp: 2025-06-30T18:33:29.839Z
Learning: In src/lib/asp.ts, only the collaborativeExit function should accept both IWallet and ServiceWorkerWallet types. Other wallet functions (getBalance, getTxHistory, getReceivingAddresses, redeemNotes, sendOnChain, settleVtxos) should maintain their original IWallet-only signatures and not be updated for consistency.
|
ack |
Co-authored-by: João Bordalo <bordalix@users.noreply.github.com> Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
This PR contains an hotfix regarding vtxos filtrering ("settleBy" must not be considered as spendable).
It also sources the app data from the DB instead of contacting service worker.
Summary by CodeRabbit
Refactor
Chores