Skip to content
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

expose reverse swap fees #1127

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

JssDWt
Copy link
Contributor

@JssDWt JssDWt commented Nov 18, 2024

Expose the lockup/claim/service fees from reverse swaps.

Historical fees are currently not backfilled. So this currently only works for new swaps.
The fees are synced with the remote.

If the fees cannot be found, they're set to 0.

Fixes #1111

Builds on top of #1125

The `send_onchain` function was deprecated since SDK version 0.3.6. It
has been replaced with `pay_onchain`. Removed deprecated functions:
- `send_onchain`, has replacement `pay_onchain`
- `max_reverse_swap_amount` has replacement `onchain_payment_limits`
- `on_progress_reverse_swaps` has replacement
  `in_progress_onchain_payments`
Copy link
Member

@roeierez roeierez left a comment

Choose a reason for hiding this comment

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

One small comment, otherwise LGTM.

invoice: response.invoice,
preimage: reverse_swap_keys.preimage,
private_key: reverse_swap_keys.priv_key,
timeout_block_height: response.timeout_block_height,
id: response.id,
onchain_amount_sat: response.onchain_amount,
sat_per_vbyte,
receive_amount_sat,
sat_per_vbyte: None,
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove now the sat_per_vbyte from the struct?

@@ -602,7 +602,7 @@ dictionary PrepareOnchainPaymentResponse {
f64 fees_percentage;
u64 fees_lockup;
u64 fees_claim;

u64 fees_service;
Copy link
Contributor

@ok300 ok300 Nov 27, 2024

Choose a reason for hiding this comment

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

fees_percentage above and the new fees_service refer to the same thing. Wouldn't one have to go, to avoid confusing the user?

u64 fees_lockup;
u64 fees_claim;
u64 fees_service;
u64 total_fees;
Copy link
Contributor

Choose a reason for hiding this comment

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

To keep with the other 3 new fields, maybe fees_total is better?

Comment on lines +646 to +649
ALTER TABLE reverse_swaps ADD column fees_lockup INTEGER DEFAULT 0;
ALTER TABLE reverse_swaps ADD column fees_claim INTEGER DEFAULT 0;
ALTER TABLE reverse_swaps ADD column fees_service INTEGER DEFAULT 0;
ALTER TABLE reverse_swaps ADD column total_fees INTEGER DEFAULT 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the udl doesn't treat them as optional, maybe INTEGER NOT NULL DEFAULT 0 is more appropriate?

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.

Exposing fees in ReverseSwapInfo
3 participants