Commit Graph

70 Commits

Author SHA1 Message Date
Ross Savage
3f94fd970a Fix clippy test issues (#850)
* Fix clippy test issues

* Address review feedback
2025-04-03 10:21:27 +00:00
Ross Savage
cf601f4622 Store claim/refund addresses (#849)
* Store claim/refund addresses

* Store receive claim address before constructing the tx
2025-04-03 06:28:32 +02:00
Ross Savage
0c88e09fc3 Pay fees with USDT asset (payjoin) (#779)
* Add payjoin implementation

* Fix Core Wasm tests
2025-04-02 11:05:02 +00:00
Daniel Granhão
35aeb62e36 WASM: fix clippy and tests (#823) 2025-03-27 22:56:53 +00:00
yse
9b9d0ee2c4 fix[wasm]: minor compilation issues (#819) 2025-03-27 12:58:00 +01:00
yse
10e3ab71e0 feat: add Esplora client to chain services (#761)
Co-authored-by: Daniel Granhão <32176319+danielgranhao@users.noreply.github.com>
2025-03-27 10:40:10 +01:00
Daniel Granhão
37979e6052 WASM: spawn task (#797) 2025-03-24 14:50:46 +00:00
Daniel Granhão
a06c6d522e WASM: prevent filesystem access (#792)
* WASM: prevent filesystem access

* Exclude logger module on wasm

* Drop use of conditional compilation in `LiquidOnchainWallet`

* Expose `LiquidSdkBuilder` and configure build for wasm

* Move working_dir setup and log header to connect with signer

* Add in memory persister constructor

* Drop builder connect method

* Remove `empty_wallet_cache` from WASM interface

* Impose custom persister on wasm
2025-03-24 13:31:22 +00:00
Daniel Granhão
116a898c21 Fix swap recovery before wallet scan (#775)
* Fix swap recovery before wallet scan

* Only do full scan when required

* Move scan to `recover_from_onchain`

* Cache index without buffer
2025-03-17 13:29:19 +00:00
Roei Erez
1d5fda1428 Merge pull request #764 from breez/refactor-recoverer
Refactor recoverer
2025-03-15 16:21:40 +02:00
Daniel Granhão
7bd09aea5d WASM: Update boltz client dependency and use included wasm tokio-tungstenite (#769)
* Update boltz client dependency and use included wasm tokio-tungstenite

* Avoid unnecessary swapper init

* Update boltz client rev after merge
2025-03-15 10:29:35 +00:00
Roei Erez
79ca49d949 Add tests 2025-03-13 13:50:09 +02:00
Roei Erez
ecb95661d8 Refactor recoverer for more clarity 2025-03-13 13:41:53 +02:00
Ross Savage
6d72fdce57 WASM: Interface (#757)
* Define common types

* Define sdk types

* Add SDK methods

* Add LiquidSdkBuilder

* Add callback interfaces

* Update CI for WASM

* Replace async and test macros

* Update sdk-common/macros dependencies
2025-03-11 06:21:46 +01:00
yse
ae1a7fbf96 fix: use height instead of lwk Tip for wallet 2025-03-05 22:54:08 +01:00
Roei Erez
61ea9c5582 subscribe incoming synced records to swapper updates 2025-02-27 16:02:42 +02:00
Ross Savage
b390864986 Chain swap: calculate cooperative tx size and allow immediate refund (#715)
* Calculate cooperative tx sizes

* Allow immediate refund of failed incoming chain swap

* Update to merged trunk

* Calculate refundable amount from utxos

* Revert removable of utxo selection

* Apply suggestions from code review

Co-authored-by: Daniel Granhão <32176319+danielgranhao@users.noreply.github.com>

---------

Co-authored-by: Daniel Granhão <32176319+danielgranhao@users.noreply.github.com>
2025-02-21 08:09:53 +01:00
Daniel Granhão
3ec57ad93e Add tx propagation grace period to swap recovery (#733)
* Add tx propagation grace period to swap recovery

* Add missing tx reset checks and improve logs
2025-02-17 13:23:32 +00:00
Roei Erez
fb953c3386 lock free sync trigger 2025-02-11 17:58:43 +02:00
yse
e6747058d7 feat(rt-sync): add notifications endpoint (#694) 2025-02-09 04:01:23 +01:00
yse
e7a7adaf8a feat: remove swapper initialization at startup (#712) 2025-02-06 14:24:55 +01:00
Ross Savage
b24046c5e9 LNURL-pay drain (#674)
* LNURL-pay drain

* Fix min_sendable calculation
2025-01-29 14:44:46 +01:00
Roei Erez
9c68b9e8a3 remove lock for bitcoin chain service 2025-01-28 22:00:50 +02:00
Roei Erez
282978fddf remove lock for liquid chain servivce 2025-01-28 20:29:59 +02:00
Ross Savage
79462db2e2 Verify and claim swap if not verifiable in swap loop (#681)
* Verify and claim swap if not verifiable in swap loop

* Verify lockup amount

* Tolerate overpayment

* Adapt receive swap test

* Separate verification functions and set swap Failed if underpaid
2025-01-25 09:30:24 +01:00
Ross Savage
e196a91973 Multi-asset send/receive (#645)
* Multi-asset send/receive

* Apply suggestions from code review

Co-authored-by: Daniel Granhão <32176319+danielgranhao@users.noreply.github.com>

* Log the prepare asset_id

---------

Co-authored-by: Daniel Granhão <32176319+danielgranhao@users.noreply.github.com>
2025-01-24 16:55:51 +01:00
Daniel Granhão
7841939e6a Expose amountless swap fees auto acceptance (#690)
* Expose amountless swap fees auto acceptance

* Move field behind optional ones

* Add serde default to auto_accepted_fees
2025-01-24 10:18:34 +00:00
Daniel Granhão
0cdfa2057c Prevent claiming of overpaid swaps (#667)
* Handle overpayments gracefully

* Fix test mock txs and swaps

* Get actual payer amount from blockchain

* Check first tx output instead of script balance

* Fetch actual payer amount if not available

* Remove user lockup amount verification in recoverer

* Refactor user lockup amount check into appropriate method
2025-01-21 10:13:13 +00:00
yse
95998013a9 fix: remove mandatory API key checks (#639) 2025-01-21 08:32:05 +01:00
Ross Savage
746b6e0223 Discount Confidential Transactions (#637)
* Update dependencies

* Use discount-ct when building txs

* Broadcast using the electrum client

* Fix CI

* Remove use of esplora url

* Address PR feedback

* Fix dart/flutter

* Update zero-conf fee rate check

* Fix clippy
2025-01-19 13:57:38 +01:00
yse
b185ff0e35 feat: add cooperative preimage recovery and optimize flow (#669) 2025-01-17 14:32:58 +01:00
yse
bb0b370d17 fix: remove auto-formatting command from build (#655)
* feat: use `include_protos` macro instead of builder
* fix: pin boltz to rev SatoshiPortal/boltz-rust@3bbc0dd
2025-01-15 11:02:35 +01:00
Daniel Granhão
95bbd0e49b Implement optimistic locking for read-update-write swap operations (#652)
* Implement optimistic locking for read-update-write swap operations

* Fail on stale swap update and add tests
2025-01-12 22:44:15 +00:00
Ross Savage
50cb8be18c Add destination pubkey and bolt12 invoice to payment details (#649)
* Add destination pubkey and bolt12 invoice to payment details

* Change macro to fn
2025-01-10 13:53:43 +03:00
Ross Savage
66810ecdf6 feat: add swap expiry timestamp (#622) 2025-01-08 14:55:47 +01:00
Daniel Granhão
a1e5576286 Store actual payer and accepted receiver amounts 2025-01-02 10:40:25 +00:00
Daniel Granhão
351473a41e Expose fees for review + auto accept 2025-01-02 10:35:45 +00:00
Ross Savage
9253caa388 Store unblinding data for the tx (#584) 2025-01-02 09:03:01 +01:00
yse
6782e8beef feat: add real-time sync service (#629)
* feat(rt-sync): add persistency layer (#555)

* feat(rt-sync): add pull and merge (#556)

* feat(rt-sync): add push logic and run method (#568)

* feat(rt-sync): integrate rt-sync with the sdk

fix: add formatting command to build

feat: add secondary trigger to sync

deps: add tonic tls-webpki-roots

feat: prevent double claiming on status stream handlers

fix: add tx commit to chain swap update (#588)

fix: ensure we pull records before prepare_send

fix: fmt and tests

* fix: set initial pulled state to `Recoverable`

* feat(rt-sync): add `last_derivation_index` to sync service

* Single chain source

* Handle Recoverable state

* fix(rt-sync): chain recovery integration (#590)

Co-authored-by: yse <hydra_yse@proton.me>

* feat(rt-sync): add `pair_fees_json`

* fix(rt-sync): clean already persisted incoming records

* feat: cache wallet info (#591)

* log: add status-stream logging for non-local swaps

* Sync improvements (#598)

* Full sync on new Bitcoin block

* Track the last unconfirmed refund tx

* Trigger synced event on partial sync

* fix: remove `REPLACE` clause from swap insert/update

* fix(rt-sync): update chain swap payer/receiver amount (#604)

* Fix syncing last derivation index

* fix: update bindings and lockfile

* remove logs

* fix(rt-sync): avoid reuse of derivation index update logic (#608)

* Add 5 index buffer to full scan

* Fix storing claim_address (#609)

* Filter incoming MRH txs by swap timestamp

* fix liquid panding timestamp

* persist tx data timestamp

* Update unconfirmed transactions

* feat: add API key (#618)

* Use configured lazy connect channel in sync service

* fix: set lower-case header (#624)

* fix error message

* Store & Sync LNURL info (#617)

* Persist and decrypt LNURL info

* Update Notification Plugin

* Sync payment details

* Update list payments to include chain swaps with only user lockup (#620)

* Update payments query to include chain swaps without txs

* Allow emitting a payment event without tx_id

* fix: bindings

---------

Co-authored-by: Ross Savage <hello@satimoto.com>
Co-authored-by: Ross Savage <551697+dangeross@users.noreply.github.com>
Co-authored-by: Roei Erez <roeierez@gmail.com>
2024-12-24 10:39:43 +01:00
Daniel Granhão
015823c8b5 Remove Option from parsers field 2024-12-17 10:08:14 +00:00
Daniel Granhão
72a9aa66ff Support default external input parsers 2024-12-16 19:37:35 +00:00
Ross Savage
e3fa3d62d1 Zero-amount quote get balance retry (#603)
* Use non-blocking sleep

* Use script_get_balance_with_retry to get user lockup balance
2024-12-13 14:21:01 +01:00
Daniel Granhão
895e64b823 Implement external input parsing 2024-12-12 12:02:53 +00:00
ok300
cfc883ae00 Add zero-amount Receive Chain Swap (#538)
Add support for Zero-Amount Receive Chain Swaps
2024-12-09 16:10:52 +00:00
ok300
790dfa91be Persist swapper fees for swaps (#586)
* Add new Payment field swapper_fees_sat

* Add swapper fee handling for Receive Swaps

* Add swapper fee handling for Send Swaps

* Add swapper fee handling for Chain Swaps

* Fix tests

* Send Swap: persist pair JSON instead of service fee

* Receive Swap: persist pair JSON instead of service fee

* Chain Swap: persist pair JSON instead of service fee
2024-12-06 08:32:03 +00:00
ok300
fe1dc30917 Add support for paying to BOLT12 (#549)
Add support for paying to BOLT12
2024-11-19 13:08:50 +00:00
Ross Savage
4da57e3fe2 Liquid/Lightning drain (#553)
* Attempt drain using liquid or lightning payment

* Optimize estimation handling, use address in drain estimation

* Add drain option to PrepareSendRequest

* Block draining while there are pending payments

* Apply suggestions from code review

* Rename PayOnchainAmount to PayAmount
2024-11-11 21:50:18 +01:00
Ross Savage
4d036f2529 Reserved address pool (#531) 2024-10-30 11:06:10 +01:00
ok300
414c9f1ae9 Bring remaining u32 amount types to u64 (#537) 2024-10-28 14:36:33 +00:00
Roei Erez
fe15534d68 Implement seperated signer 2024-10-18 11:14:22 +02:00