Commit Graph

66 Commits

Author SHA1 Message Date
Ross Savage
59f5e0636c Handle in RN codegen multiple fields in enum variant (#453)
* Update RN example

* Handle enum variants with multiple fields
2024-08-23 06:12:39 +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
Erdem Yerebasmaz
5248dfc235 Depend on sdk-common with liquid feature (#452)
* Add copy script to packages/react-native makefile
  * Reorder scripts
* Depend on sdk-common with liquid feature
  * chore: cargo update
* Generate Dart bindings
* Generate UniFFI bindings
* Simplify import resolution by using prelude::*
  * Applies changes from https://github.com/breez/breez-sdk-greenlight/pull/1078
2024-08-20 18:50:27 +03:00
Roei Erez
d123a77b12 update version to 0.2.1 2024-08-01 16:27:08 +03:00
Roei Erez
ad55007add Fix conflict with os.Logger 2024-08-01 16:10:51 +03:00
Roei Erez
65ce16ea5f update version to 0.2.0 2024-07-25 17:19:47 +03:00
Roei Erez
63e5a12abb Merge branch 'v0.1.4' 2024-07-25 17:16:27 +03:00
Ross Savage
baa8096852 Update boltz-rust and add receive payment description (#409)
* Update boltz-rust

* Store description and add to Payment struct

* Fix examples
2024-07-25 12:46:40 +02:00
Roei Erez
ad0bad1431 update versions to 0.1.4 2024-07-22 15:18:02 +03:00
Ross Savage
bfeb785221 Buy Bitcoin (#398)
* Add fiat on-ramp service

* Use sdk-common MoonpayProvider

* Bump flutter qr dependency

* Bump sdk-common dependency
2024-07-19 14:57:51 +02:00
Ross Savage
8ac220275e Update version to 0.1.3.rc2 2024-07-17 08:19:54 +02:00
Ross Savage
a3eb4caaf2 Add validate url success action param (#395) 2024-07-16 10:08:30 +02:00
Ross Savage
02408d2e04 Add validate url success action param
(cherry picked from commit bcd1b33004cb0f6762db7e8e3acfcf77d7eb9429)
2024-07-16 10:06:22 +03:00
Roei Erez
938f74d7d1 update version to 0.1.3.rc1 2024-07-16 09:14:39 +03:00
Ross Savage
0da35259fe Allow custom pay_onchain claim fees (#391)
* Allow optional fee rate for pay onchain BTC claim

* Add recommended_fees method

* Fix example Config

* Address review comments
2024-07-15 17:38:10 +02:00
Ross Savage
a69f302e53 Regenerate RN (#387) 2024-07-11 19:17:57 +02:00
Ross Savage
a4a8f961d2 Update UDL to fix python default argment ordering (#385) 2024-07-11 19:17:36 +02:00
Ross Savage
143993fd3a List payments filtering and paging (#369)
* List payments in reverse chonological order

* Add payment filtering and paging

* Fix examples

* Apply suggestions from code review

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>

* Set timestamp for pseudo payments

* Filter by the first non-null timestamp from the join query

---------

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>
2024-07-10 17:50:53 +02:00
Ross Savage
da43f7ff78 Rename namespace (#345)
* Rename namespace

* Fix flutter build

* Fix kotlin-multiplatform CI

* Rename repositories
2024-07-09 17:25:05 +02:00
Ross Savage
05507063f0 Change Config param to zero_conf_min_fee_rate_msat (#374)
* Change Config param to zero_conf_min_fee_rate_msat

* Fix Flutter example
2024-07-09 14:13:42 +02:00
Ross Savage
86d778f3b6 Fix type generation (#362) 2024-07-04 18:54:19 +02:00
ok300
08b2e5a6e2 Add fetch_onchain_limits service method (#343)
* Add pay_onchain_limits service method

* Add receive_onchain_limits service method

* Merge pay/receive_onchain_limits

* Update field names

* Split swapper method in get_chain_pair and get_chain_pairs

* Fix test

* Introduce and re-use Limits model

* Add fetch_lightning_limits SDK method

* Fix CI: propagate latest sdk-common changes
2024-07-03 09:22:29 +00:00
Ross Savage
15a243251e Fix example network and logger call (#349) 2024-07-01 10:11:02 +02:00
Ross Savage
9820b0e38c Change onchain request/response structs for clarity (#340)
* Rename fields for clarity

* Remove ReceiveOnchainRequest
2024-06-28 16:30:35 +02:00
Ross Savage
a98ee61242 Add payment examples to the RN app (#337)
* Add payment examples to the RN app

* Apply suggestions from code review

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>

---------

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>
2024-06-27 14:02:15 +02:00
Ross Savage
a4af73352a Fix handling of f32 type (#336) 2024-06-27 13:07:41 +02:00
Ross Savage
e7844473cd Monitor chain swap addresses (#322)
* Check chain swap addresses for unspent outputs

* Monitoring expired swaps up to 4320 blocks after expiration

* Refactor chain swap monitoring

* Handle the error to prevent the loop exiting

* Add RefundPending state

* Check if RefundPendingbefore setting to Refundable

* Use script_get_balance to determine spent state

* Use unconfirmed balance to check if RefundPending should be reset to Refundable
2024-06-26 16:53:41 +02:00
ok300
ef5cd28fa5 Add FiatAPI methods to Liquid SDK (#331)
* Add FiatAPI methods to Liquid SDK

* Add mirrored structs of fiat crate on Dart bindings

* Re-generate bindings

* Fix sdk-common imports

* Avoid using hardcoded Breez Server URL, re-use sdk-common constant

* Update Cargo.lock

---------

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>
2024-06-26 13:55:44 +00:00
ok300
7bd9b6ddb2 Use swapper proxy to extract referral ID (#329)
* Use swapper proxy to extract referral ID

* Derive swapper API base URL from proxy URL

* Update RN bindings

* Remove referral_id from Config, move proxy_url parsing to swapper

* Fix tests

* Cache swapper proxy URL

* Move boltz_url from Config to swapper

* Silently fail when fetching proxy swapper URLs

* Update RN bindings

* Fix sdk-common dependency

* Fix dependency issues
2024-06-25 17:19:02 +00:00
Ross Savage
9da16fba78 Receive Chain Swaps (#310)
* Implement Chain Swaps for receiving

* Send: validate if we have sufficient funds (#321)

* Implement Chain Swaps for receiving

* Fix rebase of flutter_rust_bridge version

* Send: validate if we have sufficient funds

* Re-generate FRB

---------

Co-authored-by: Ross Savage <hello@satimoto.com>

* Chaim swap claim: remove refund_tx arg (#328)

---------

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2024-06-25 17:33:38 +02:00
ok300
bcb4743260 Integrate sdk-common (#308)
* Rename Network to LiquidSdkNetwork to avoid naming conflicts with sdk-common

* Integrate sdk-common: re-use parse_invoice

* Fix UDL bindings tests

* Add input parser support

* CLI: Add input parser support

* Integrate lnurl-pay

* Cargo format, re-generate FRB and RN bindings

* Duplicate LnUrlPayError, update FRB/UniFFI bindings

* Move duplicate LnUrlPayError to FRB bindings.rs

* Add support for lnurl-withdraw

* Lnurl-withdraw: convert units, incorporate fees

* Bump sdk-common, rename InputType::LnUrlError

* Bump sdk-common, remove Wrapped prefix from LnUrlPaySuccessData, LnUrlPayResult

* LNURL-withdraw: add missing UDL mappings

* Add support for LNURL-auth

* Move LNURL structs into models.rs

* Rename LiquidSdkNetwork to LiquidNetwork

* Fix binding tests

* Fix tests

* Move FRB mirroring structs to bindings.rs

* Remove TODO

* Bump sdk-common, remove sdk-common dependency on rusqlite

* Propagate LiquidNetwork rename into flutter example app

* CI: install protobuf before running clippy

* CI: add rust cache, protobuf for remaining rust steps
2024-06-20 16:18:50 +00:00
Ross Savage
428d69729b Implement Chain Swaps for sending (#298) 2024-06-19 12:48:13 +02:00
yse
4e76e94d26 feat: invoice details to Payment (#309) 2024-06-18 17:32:51 +02:00
Ross Savage
78228d8961 Publish CI fixes (#289)
* Fix CI publish directories

* Fix kotlin multiplatform build

* Fix python ffi directory

* Add swift PAT to release

* Fix file copy

* Fix mvn check

* Test windows build (#290)

* Add jitpack yml

* Fix RN example android build
2024-06-18 09:34:47 +02:00
yse
bcf84fe8cd feat: add zero-conf checks when receive lockup is in the mempool (#292) 2024-06-13 10:22:05 +02:00
yse
2b64708e36 Receive: Switch payment to pending state when lockup is in the mempool (#301)
* feat: switch to pending state when receive lockup is in the mempool

* rebasing

* fix: move socket update logic to sub-crate

* Update payments query, to avoid duplicate Receive Swaps

This can happen if the app is stopped before the temporary lockup tx is removed from the DB. The Receive Swap would then forever result in two payments in list_payments.

* Add comments to clarify use of temp lockup txid

* Re-generate flutter bridge bindings

* feat: set Payment `tx_id` as optional and change `list_payments` logic

* fix: debug typo

* fix: undo `remove_temporary_tx` changes

* fix: switch to full join rather than manual filtering

* fix: bindings

* fix: improve error handling when tx data is not present

* fix: RN bindings

* fix: exclude Created receives from the list

* fix: fixing nits

* Re-generate FRB bindings

---------

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2024-06-12 20:44:31 +00:00
ok300
31e2ab44af get_info: remove with_scan argument (#306)
* get_info: remove with_scan argument

* Fix binding tests

* Update dart test and kotlin example app

* Update RN example app
2024-06-12 13:23:32 +00:00
ok300
7276346a5f Cleanup, fix typos (#299)
* Fix typo in PaymentSucceeded event name

* Remove fixed todo

* Organize imports

* Fix log typos

* Re-generate flutter bindings

* Re-generate RN bindings

* Fix "Unhandled msg" logs for WS pings

* Hide ureq debug logs, showing raw HTTP headers for Boltz calls
2024-06-07 04:53:14 +00:00
ok300
2928e0fa58 Add magic routing hint support (#265)
* Receive: Add magic routing hint support

* Send: add MRH support

* Filter out and reject self-transfers

* Extract self-transfer validation in own fn

* PrepareSendResponse: use onchain fee as fees_sat if MRH present

* Use onchain tx fee as payment fee, if MRH used for direct onchain tx

* Fix swap fee calculation when MRH is used

* Apply boltz-client patch that aborts send if tx broadcast fails

* Send with MRH: return pending payment

* Receive with MRH: validate BIP21 amount, address

* Emit remaining events for MRH Send, Receive

* Sync: update swap info and emit events after new tx data is persisted

* Extract MRH send into its own send_payment_via_mrh()

* Pending Send via swap: store tx fees for pseudo-tx

* Fix clippy
2024-06-07 00:40:42 +00:00
Ross Savage
6055a77033 Run codegen with ktlint 1.3.0 (#294) 2024-06-05 13:58:49 +02:00
Ross Savage
d54aae3b10 Remove file trailing space (#288) 2024-06-03 13:34:39 +02:00
Ross Savage
5d9a8f18a3 Add Config (#267)
* Add config

* Add rustdocs to Config, send_payment (#271)

---------

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2024-06-01 06:32:45 +02:00
ok300
f6082f2aa5 Add global SDK logger (#242)
* Add SDK global logger

* Add bindings

* Fix path to internal uniffi log

* Exclude "set_log_stream" from generated RN methods

* Move logger-specific structs to a separate module

* Delegate init_logging to method in logger.rs

* Rename uniffi BindingLogger to UniffiBindingLogger

* Add set_log_stream for dart bindings

* Add SDK logger to Dart bindings

* Rename dart binding logger to DartBindingLogger

* Add rustdocs

* RN bindings: Add manual handling for setLogStream()

* Re-generate dart bindings

* Re-generate RN bindings

* Remove LOG_INIT cell

* Set global maximum log level once on initialization

Return a LiquidSdkError::Generic instead of Anyhow error when initializing log stream on Dart bindings

* Do not panic when initializing binding loggers

* Rename LogStream to Logger

---------

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>
2024-05-31 18:01:39 +00:00
Ross Savage
585184a35c Cancel the created swap on timeout (#249)
* Cancel slow swap

* Change Cancelled to TimedOut

* Set Created send swaps to TimedOut on start
2024-05-31 07:37:44 +02:00
ok300
e5dba1043e Add ability to parse an invoice (#240)
* Add ability to parse an invoice

* Simplify LNInvoice initialization

* Add missing LNInvoice fields

* Cargo fmt

* Re-generate bindings after merging main branch

* Explicitly check the invoice signature

* Remove redundant signature check

* Strip potential lightning: prefix before parsing bolt11
2024-05-30 13:26:00 +00:00
Ross Savage
35561bacc5 Improve stream handling (#244)
* Improve stream management

* Check swap for existing lockup/refund tx

* Set broadcast capacity to 30
2024-05-30 14:54:15 +02:00
ok300
434fb80d49 Add shutdown signal (#238)
* Add shutdown signal handling

Revert periodic sync interval change

Revert keep-alive interval change

CLI: Add disconnect command

SDK: Add scaffolding for is_started, shutdown()

Simplify instance init

* Rebase on savage-async-ws branch

* Avoid waiting when shutdown signal is received in the sync loop

* Directly use shutdown signal in background threads

* Acquire is_started lock at the very beginning of start()

* Fix cargo clippy warnings

* Update RN generator (kt): set bindingLiquidSdk to null on disconnect()

* Update RN generator (swift): set bindingLiquidSdk to nil on disconnect()

* Startup: only run foreground sync() if this could be the first run

* Start a sync() in background, before regular sync() loop

* Remove ensure_started check from start()

* Add bindings for disconnect()

* Remove foreground sync condition from startup

* Simplify background sync loop
2024-05-30 08:04:30 +00:00
yse
9d2f6f0839 Fix cooperative refund and improve keypair generation (#223)
* feat: add random keypair generation

* Encapsulate decode_keypair in SendSwap::get_refund_keypair()

* Add refund_tx_id and refund_tx_amount_sat to Payment

* fix: remove blocking on refund

* fix: change `refund_private_key` order

* fix: rebasing

* fix: set `next_unused_address` as refund output

* Handle refunds in `get_info`, `list_payments` (#226)

* Exclude refund txs from payment list

* Adjust balance calculation to account for refunds

* fix: revert boltz changes and fix locktime

* Replace subquery with LEFT JOIN to get refund data

* Rewrite locktime check for more clarity

* Rewrite locktime check for more clarity

* Fix select_payment_query in case of refunds

* Include boltz-client fixes (handling of unwraps for failed broadcasts)

* Cargo.toml: Use boltz-client branch instead of commit

---------

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2024-05-28 08:07:29 +00:00
yse
2fcefee45e Add option to specify backup path (#228)
* feat: add backup_path to backup method

* Re-generate bindings with flutter_rust_bridge`@ 2.0.0-dev.35

* Rebased on main

* Update backup path description

---------

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2024-05-27 19:01:49 +00:00
Ross Savage
06b848a8f3 SDK events framework (#193)
* Add events framework

* Adapt RN codegen and add synced event

* Only use get_connection internally
2024-05-25 06:20:14 +02:00