-
Notifications
You must be signed in to change notification settings - Fork 68
Add spent trait to improve sent_and_received() #31
Copy link
Copy link
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Describe the enhancement
Add a TxAmountSpent trait to improve how transaction spending amounts are calculated. The trait will add a .spent() method to tuples returned by sent_and_received(), calculating total amount spent including fees.
Use case
// Current: Manual calculation needed
let (sent, received) = wallet.sent_and_received(&tx);
let fee = wallet.calculate_fee(&tx)?;
let total = sent - received + fee; // Error-prone
// Proposed: Clean trait implementation
let (sent, received) = wallet.sent_and_received(&tx);
let total = (sent, received, fee).spent(); // Clear and consistentAdditional context
- Non-breaking change that extends existing functionality
- Makes transaction cost calculations more intuitive
- Helps prevent calculation errors
- Small, focused improvement suitable for a first-time contributor
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers
Type
Projects
Status
Discussion