Commit Graph

206 Commits

Author SHA1 Message Date
Ross Savage
b3f1eed429 Prevent swap double claim (#542)
* Prevent receive swap double claim

* Prevent chain swap double claim
2024-10-30 10:08:13 +01:00
ok300
59dfacc12d Receive Chain Swap: support refund even when lockup address is re-used (#471)
* rescan_onchain_swaps: separate internal (scheduled) from external (manual) call

* Add TODOs for supporting more utxos in BtcSwapTx::new_refund

* Update boltz-client to build refund tx with all utxos

* list-refundables: show refundable amount, not swap amount

* Chain swap cooperative refund: fix "Liquid chain used for Bitcoin operations" error

* Revert "Chain swap cooperative refund: fix "Liquid chain used for Bitcoin operations" error"

This reverts commit 8a325e3c13b7e9b54b9f5256bea206989eac53b6.

* Bump boltz-rust to include sign_refund fix

* Bump boltz-rust to include sign_refund fix for non-coop refund

* Fix state handling when incoming chain swaps are refunded

* Move swap state change inside refund_incoming_swap

* Bump to latest boltz-client branch version
2024-10-29 12:56:55 +00:00
ok300
414c9f1ae9 Bring remaining u32 amount types to u64 (#537) 2024-10-28 14:36:33 +00:00
Ross Savage
96bfe463f4 Skip missed ticks (#534) 2024-10-20 20:53:27 +02:00
Roei Erez
6656d57c64 Fix working directory 2024-10-18 13:11:16 +03:00
Ross Savage
3ec1b9743e Fix wallet test 2024-10-18 11:58:12 +02:00
Roei Erez
f7b583c562 fix variable name 2024-10-18 11:32:32 +02:00
Roei Erez
72f29bf16b fix sign_message/check_message and add test 2024-10-18 11:32:29 +02:00
Roei Erez
2e559364d8 fix comments 2024-10-18 11:25:25 +02:00
Roei Erez
fe15534d68 Implement seperated signer 2024-10-18 11:14:22 +02:00
ok300
cbe835b565 GetInfoResponse: add fingerprint (#532)
* GetInfoResponse: add fingerprint

* Re-generate dart ffi with `just ffigen`

* Re-generate dart ffi with `just gen`
2024-10-17 14:36:33 +00:00
ok300
b5a1d957c3 Log exact error root cause when failing to lookup script address (#530) 2024-10-16 11:18:43 +00:00
Ross Savage
5f638aec37 Fix list payments filter (#529) 2024-10-15 10:18:11 +02:00
Ross Savage
0884106159 Add prepare_lnurl_pay (#524)
* Add prepare_lnurl_pay

* Move fields into prepare response
2024-10-14 10:06:14 +02:00
ok300
41a4065ff4 Add Breez electrum server for Liquid Mainnet 2024-10-11 14:44:08 +02:00
Ross Savage
3867fa91da Get Payment (#476)
* Get payment by destination

* CI fixes

* Remove claim_address from query

* Add PaymentDestination enum

* Add payment hash as a payment query option

* Bump Flutter dependencies

* Move destination/address queries to list_payments

* Apply suggestions from code review

Co-authored-by: yse <70684173+hydra-yse@users.noreply.github.com>

---------

Co-authored-by: yse <70684173+hydra-yse@users.noreply.github.com>
2024-10-10 17:44:32 +02:00
yse
42f4ca0129 feat: require Breez API key globally on mainnet (#520) 2024-10-08 16:17:34 +02:00
ok300
046e7ab1c8 list-refundables: show refundable amount, not swap amount (#516)
* list-refundables: show refundable amount, not swap amount

* Rename chainswap fn for clarity

get_lockup_swap_script_pubkey only applies to Receive Chain Swaps, so it was renamed to get_receive_lockup_swap_script_pubkey.

* list_refundables: batch calls to fetch balance from chain service

* Simplify conversion from Chain Swap to RefundableSwap

* Fix MockBitcoinChainService

* Re-generate flutter bindings

* Add utility for creating SdkError::Generic with &str or String

* Chain Swap getter for swap script pk: throw SdkError instead of anyhow::Error

* Update RefundableSwap comment

Co-authored-by: Ross Savage <551697+dangeross@users.noreply.github.com>

* Re-generate dart files

---------

Co-authored-by: Ross Savage <551697+dangeross@users.noreply.github.com>
2024-10-07 15:56:02 +00:00
yse
950d4243e6 fix: incoming Chain swap refund (#522) 2024-10-07 15:53:09 +02:00
ok300
7e193aafac Chain swap cooperative refund: fix triggering of refund_incoming_swap (#517)
* Chain swap cooperative refund: fix "Liquid chain used for Bitcoin operations" error

* Log error in case cooperative refund fails
2024-10-04 08:52:58 +00:00
Erdem Yerebasmaz
1389d49f03 Update flutter_rust_bridge to 2.4.0 (#511) 2024-10-01 13:31:55 +03:00
Ross Savage
9c0e469ad1 Fix pay onchain claim fee (#499)
* Fix pay onchain claim fee

* Bump flutter example dependencies
2024-09-25 10:44:33 +02:00
Roei Erez
b2d7026214 add validation for paying liquid fees 2024-09-25 09:20:00 +03:00
yse
7afa6fd4c1 fix: remove derive_fee_rate method 2024-09-24 22:51:49 +02:00
Roei Erez
70235968a6 fix lowball fee rates for onchain liquid tx 2024-09-24 23:03:37 +03:00
Ross Savage
91d80179fc Update electrum URLs (#497) 2024-09-24 09:50:31 +02:00
yse
646b86ce84 fix: incoming chain swap claim 2024-09-23 12:11:44 +02:00
yse
783c5ac450 feat: refactor refund logic and support lowball broadcasts (#407) 2024-09-20 15:57:54 +02:00
yse
189e257f89 feat: add lowball broadcast support with API key for all transaction types (#489) 2024-09-20 13:04:49 +02:00
Ross Savage
2446751bc4 Remove transaction (#493) 2024-09-18 14:36:10 +02:00
ok300
75aa988546 Bump boltz client library (#486)
* Bump boltz client library

* Fix tests
2024-09-13 10:45:39 +00:00
ok300
e8cd66f81f prepare-pay-onchain: add option for drain (#464)
* prepare-pay-onchain: add option for drain in req

* Fix clippy

* ChainSwapStateHandler: gracefully handle building both drain and non-drain lockups

* Send Chain swap: use standard feerate when estimating lockup tx fee

* UDL: move new drain field above the last PreparePayOnchainRequest optional field

* UDL: move new drain field optional

* prepare-pay-onchain: treat normal payment as drain if receiver amount is high enough

If the receiver amount is as high as it would be in case of drain, treat the current prepare-pay-onchain as drain, even if the drain flag is not set.

* build_drain_tx: add optional amount validation

* Add PayOnchainAmount enum to cover amount types (drain, receiver)

* Add ability to find max_receiver_amount_sat for non-drain sends

* Revert "Add ability to find max_receiver_amount_sat for non-drain sends"

This reverts commit 60ee1c768021810f72bc64a8ada69d35b638185e.

* prepare_pay_onchain: treat drain and non-drain cases separately

If the non-drain case is chosen with a receiver_amount equivalent to what drain would have calculated, it results in an error. For drain, the caller has to explicitly choose PayOnchainAmount::Drain.

* CLI: send-onchain-payment accepts optional amount

* CLI: add docs for send-onchain-payment drain arg

* SDK: expand docs for prepare_pay_onchain

* Re-generate RN bindings

* Re-generate flutter bindings
2024-09-11 15:52:56 +00:00
Ross Savage
c141d8e0a4 Change short_channel_id to string (#484)
* Change short_channel_id to string

* Bump sdk-common
2024-09-11 12:54:39 +02:00
Ross Savage
801a929437 Fix payment details rebase (#483)
* Fix payment details rebase

* Fix Flutter
2024-09-09 14:03:13 +02:00
yse
2dc3d57309 fix: set PaymentDetails as mandatory, default to LiquidAddress (#474) 2024-09-09 13:00:22 +02:00
ok300
fc820176a1 sync: correctly detect payment by refund tx ID (#470)
* sync: correctly detect payment by refund tx ID

* Payment: extract get_refund_tx_id() as own method
2024-09-08 20:12:32 +00:00
yse
b20c27a399 test: fix swap handlers tests by switching to mock chain service (#475) 2024-09-06 21:58:12 +02:00
Erdem Yerebasmaz
c2db7ebfea Update flutter_rust_bridge to 2.3.0 (#465) 2024-09-02 16:30:12 +03:00
Roei Erez
e912147408 Merge pull request #462 from breez/emit-pending-confirmation
Emit pending confirmation for liquid transactions
2024-09-01 11:30:44 +03:00
Roei Erez
cd35a63fe0 fix typo 2024-09-01 11:30:02 +03:00
ok300
5f74b9df4b Restore: Associate swap tx IDs from onchain data (#399)
* Add extend_incomplete_failed_send_swaps() on first sync

* Find lockup txs

* Send Swaps: find refund txs

* Simplify recover_send_swap_tx_ids, add recover_receive_swap_tx_ids

* recover_receive_swap_tx_ids: batch tx lookups

* Move onchain-restore methods to own module

* Store restored data in own struct

* Fix CI: bump pubspec.lock dependencies

* LiquidChainService: add get_scripts_history_electrum()

* restore_onchain: rely on batch call to fetch histories of all known swaps

* Rename get_scripts_history_electrum

* Rename restore_onchain.rs, flatten onchain inner module

* Rename ImmutableDb to SwapsList

* Simplify logic in restore.rs

* restore.rs: Add chain swap support, simplify logic

* restore.rs: add logging when script retrieval fails

* restore.rs: remove unused field create_resp

* restore.rs: rename SwapCompositeData to SwapHistory

* restore.rs: allow unused fields in simulated immutable data

* restore.rs: cargo fmt

* Cargo fmt

* Fix failing test

* When fetching script history, also fetch if tx is confirmed or not

* Recover send swaps: fetch claim tx IDs

* Recover onchain data: persist reconstructed swaps

* Simplify recover_from_onchain: store swap txs per swap ID

* Receive swaps: do not treat lockup/claim txs as pair

* Clarify meaning of partial swap state

* Cargo clippy

* Receive Chain Swap: distinguish BTC lockup from claim/refund tx

* Send Chain Swap: distinguish BTC lockup/claim by vout, not by history order

* get_partial_state: default to Created when state is unclear

* Receive Chain Swaps: differentiate BTC refund from BTC claim txs

* Send Swaps: clarify reason for defaulting to TimedOut on no lockup

* Chain swaps: add docs for meaning of server, user txs

* Recover Receive swaps: cover the case when only the lockup is available

* HistoryTxId: store confirmation block height

* Receive swaps: differentiate claim tx from swapper refund tx

* recover_from_onchain: extract immutable DB (swaps list) as arg

* Rename get_partial_state to derive_partial_state

* Restore: remove validation steps

* Restore chain swaps: treat as Complete only when claim is confirmed

* Fix clippy warnings

* Remove restore call from sync call
2024-08-30 17:18:25 +00:00
Roei Erez
59aefee0ef emit pending confirmation for liquid transactions 2024-08-29 17:37:30 +03:00
yse
0053007000 fix: ensure non-MRH invoices use lockup amount for fee calculation (#461) 2024-08-29 14:32:39 +02:00
Ross Savage
6b78919df8 Add sign_message and check_message (#443)
* Add sign and check message methods

* Use lightning message_signing module to verify the message signature

* Use hash engine
2024-08-29 08:42:16 +02:00
Ross Savage
deb9ed1b09 Add description hash to receive payment (#440)
* Add option to hash description

* Fix Flutter gen

* Switch to upstream boltz-rust

* Address feedback
2024-08-29 08:17:10 +02:00
Ross Savage
34774647bf Integrate webhooks (#410)
* Integrate webhooks

* Make hash_swap_id optional

* Hash and store the swap id

* Add webhook status include lists

* Remove superfluous webhook statuses

* Verify and fetch user_lockup_tx_id if missing

* Fix tests

* Use bitcoin sha256

* Fix flutter CI
2024-08-29 08:03:50 +02:00
ok300
ab63064343 Fix chain swap limits validation (#456)
* validate_chain_pairs: use payer_amount instead of ambiguous amount_sat

* validate_submarine_pairs: add comment

* prepare_receive_payment: clarify pair handling for PaymentMethod::Lightning

* Chain pair validation: use user_lockup_amount instead of payer_amount
2024-08-28 10:38:41 +00:00
ok300
152032dd82 pay-onchain: fix user lockup fee calculation, boltz fee calculation (#459) 2024-08-28 10:21:29 +00:00
yse
7b3085df8d send: consider request amount when preparing the payment (#454) 2024-08-27 01:37:56 +02:00
yse
1a89bcd6c1 feat: add BIP21 support (#414)
Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>
Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2024-08-22 12:23:36 +02:00