Skip to content

feat: add fee estimation method to UniFFI bridge#53

Merged
xdustinface merged 1 commit intov0.42-devfrom
claude/issue-51-20260314-0057
Mar 14, 2026
Merged

feat: add fee estimation method to UniFFI bridge#53
xdustinface merged 1 commit intov0.42-devfrom
claude/issue-51-20260314-0057

Conversation

@xdustinface
Copy link
Owner

Closes #51

Adds fee estimation to the UniFFI bridge:

  • FeeEstimate record with fee (duffs), fee_rate, estimated_size (bytes)
  • estimate_fee(amount, fee_rate) method with static fee rates: low=1, medium=10, high=100 duff/byte
  • Standard P2PKH size estimate: 226 bytes (1 input + 2 outputs)
  • 9 unit tests covering all rates, edge cases, and case-insensitivity

- Add `FeeEstimate` UniFFI record with `fee: u64` (duffs), `fee_rate: String`,
  and `estimated_size: u32` fields
- Add `SpvClient::estimate_fee(amount, fee_rate)` method: fee rates "low"=1,
  "medium"=10 (default), "high"=100 duff/byte; size estimated as standard
  1-input/2-output P2PKH transaction (226 bytes)
- Add 9 unit tests covering all fee rate levels, edge cases (zero amount,
  unknown rate, case-insensitivity, amount independence)

Closes #51

Co-authored-by: Kevin Rombach <xdustinface@users.noreply.github.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.72%. Comparing base (baab810) to head (bf937c6).
⚠️ Report is 1 commits behind head on v0.42-dev.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@              Coverage Diff              @@
##           v0.42-dev      #53      +/-   ##
=============================================
- Coverage      73.01%   67.72%   -5.30%     
=============================================
  Files            287      316      +29     
  Lines          58149    68474   +10325     
=============================================
+ Hits           42456    46371    +3915     
- Misses         15693    22103    +6410     
Flag Coverage Δ
core 75.14% <ø> (ø)
ffi 37.20% <ø> (?)
rpc 19.92% <ø> (ø)
spv 84.58% <100.00%> (+0.12%) ⬆️
wallet 66.40% <ø> (ø)
Files with missing lines Coverage Δ
dash-spv/src/bridge/mod.rs 89.76% <100.00%> (+0.80%) ⬆️

... and 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xdustinface xdustinface merged commit aa28af3 into v0.42-dev Mar 14, 2026
76 of 81 checks passed
@xdustinface xdustinface deleted the claude/issue-51-20260314-0057 branch March 14, 2026 01:20
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.

feat: add fee estimation method to UniFFI bridge

2 participants