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>
This commit is contained in:
yse
2024-12-24 10:39:43 +01:00
committed by GitHub
parent b0b88b8f1c
commit 6782e8beef
61 changed files with 8566 additions and 3043 deletions

View File

@@ -1060,6 +1060,17 @@ class FlutterBreezLiquidBindings {
_frbgen_breez_liquid_cst_new_box_autoadd_ln_url_error_dataPtr
.asFunction<ffi.Pointer<wire_cst_ln_url_error_data> Function()>();
ffi.Pointer<wire_cst_ln_url_info> frbgen_breez_liquid_cst_new_box_autoadd_ln_url_info() {
return _frbgen_breez_liquid_cst_new_box_autoadd_ln_url_info();
}
late final _frbgen_breez_liquid_cst_new_box_autoadd_ln_url_infoPtr =
_lookup<ffi.NativeFunction<ffi.Pointer<wire_cst_ln_url_info> Function()>>(
'frbgen_breez_liquid_cst_new_box_autoadd_ln_url_info');
late final _frbgen_breez_liquid_cst_new_box_autoadd_ln_url_info =
_frbgen_breez_liquid_cst_new_box_autoadd_ln_url_infoPtr
.asFunction<ffi.Pointer<wire_cst_ln_url_info> Function()>();
ffi.Pointer<wire_cst_ln_url_pay_error_data>
frbgen_breez_liquid_cst_new_box_autoadd_ln_url_pay_error_data() {
return _frbgen_breez_liquid_cst_new_box_autoadd_ln_url_pay_error_data();
@@ -1503,6 +1514,21 @@ class FlutterBreezLiquidBindings {
late final _frbgen_breez_liquid_cst_new_list_payment = _frbgen_breez_liquid_cst_new_list_paymentPtr
.asFunction<ffi.Pointer<wire_cst_list_payment> Function(int)>();
ffi.Pointer<wire_cst_list_payment_state> frbgen_breez_liquid_cst_new_list_payment_state(
int len,
) {
return _frbgen_breez_liquid_cst_new_list_payment_state(
len,
);
}
late final _frbgen_breez_liquid_cst_new_list_payment_statePtr =
_lookup<ffi.NativeFunction<ffi.Pointer<wire_cst_list_payment_state> Function(ffi.Int32)>>(
'frbgen_breez_liquid_cst_new_list_payment_state');
late final _frbgen_breez_liquid_cst_new_list_payment_state =
_frbgen_breez_liquid_cst_new_list_payment_statePtr
.asFunction<ffi.Pointer<wire_cst_list_payment_state> Function(int)>();
ffi.Pointer<wire_cst_list_payment_type> frbgen_breez_liquid_cst_new_list_payment_type(
int len,
) {
@@ -3862,6 +3888,26 @@ class FlutterBreezLiquidBindings {
late final _uniffi_breez_sdk_liquid_bindings_checksum_method_signer_hmac_sha256 =
_uniffi_breez_sdk_liquid_bindings_checksum_method_signer_hmac_sha256Ptr.asFunction<int Function()>();
int uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_encrypt() {
return _uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_encrypt();
}
late final _uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_encryptPtr =
_lookup<ffi.NativeFunction<ffi.Uint16 Function()>>(
'uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_encrypt');
late final _uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_encrypt =
_uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_encryptPtr.asFunction<int Function()>();
int uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_decrypt() {
return _uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_decrypt();
}
late final _uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_decryptPtr =
_lookup<ffi.NativeFunction<ffi.Uint16 Function()>>(
'uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_decrypt');
late final _uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_decrypt =
_uniffi_breez_sdk_liquid_bindings_checksum_method_signer_ecies_decryptPtr.asFunction<int Function()>();
int ffi_breez_sdk_liquid_bindings_uniffi_contract_version() {
return _ffi_breez_sdk_liquid_bindings_uniffi_contract_version();
}
@@ -3949,6 +3995,13 @@ final class wire_cst_list_payment_type extends ffi.Struct {
external int len;
}
final class wire_cst_list_payment_state extends ffi.Struct {
external ffi.Pointer<ffi.Int32> ptr;
@ffi.Int32()
external int len;
}
final class wire_cst_ListPaymentDetails_Liquid extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> destination;
}
@@ -3973,6 +4026,8 @@ final class wire_cst_list_payment_details extends ffi.Struct {
final class wire_cst_list_payments_request extends ffi.Struct {
external ffi.Pointer<wire_cst_list_payment_type> filters;
external ffi.Pointer<wire_cst_list_payment_state> states;
external ffi.Pointer<ffi.Int64> from_timestamp;
external ffi.Pointer<ffi.Int64> to_timestamp;
@@ -4167,6 +4222,30 @@ final class wire_cst_send_destination extends ffi.Struct {
external SendDestinationKind kind;
}
final class wire_cst_ln_url_pay_request_data extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> callback;
@ffi.Uint64()
external int min_sendable;
@ffi.Uint64()
external int max_sendable;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> metadata_str;
@ffi.Uint16()
external int comment_allowed;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> domain;
@ffi.Bool()
external bool allows_nostr;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> nostr_pubkey;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> ln_address;
}
final class wire_cst_aes_success_action_data extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> description;
@@ -4221,6 +4300,10 @@ final class wire_cst_prepare_ln_url_pay_response extends ffi.Struct {
@ffi.Uint64()
external int fees_sat;
external wire_cst_ln_url_pay_request_data data;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> comment;
external ffi.Pointer<wire_cst_success_action> success_action;
}
@@ -4276,30 +4359,6 @@ final class wire_cst_prepare_buy_bitcoin_request extends ffi.Struct {
external int amount_sat;
}
final class wire_cst_ln_url_pay_request_data extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> callback;
@ffi.Uint64()
external int min_sendable;
@ffi.Uint64()
external int max_sendable;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> metadata_str;
@ffi.Uint16()
external int comment_allowed;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> domain;
@ffi.Bool()
external bool allows_nostr;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> nostr_pubkey;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> ln_address;
}
final class wire_cst_prepare_ln_url_pay_request extends ffi.Struct {
external wire_cst_ln_url_pay_request_data data;
@@ -4411,6 +4470,76 @@ final class wire_cst_binding_event_listener extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> stream;
}
final class wire_cst_aes_success_action_data_decrypted extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> description;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> plaintext;
}
final class wire_cst_AesSuccessActionDataResult_Decrypted extends ffi.Struct {
external ffi.Pointer<wire_cst_aes_success_action_data_decrypted> data;
}
final class wire_cst_AesSuccessActionDataResult_ErrorStatus extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> reason;
}
final class AesSuccessActionDataResultKind extends ffi.Union {
external wire_cst_AesSuccessActionDataResult_Decrypted Decrypted;
external wire_cst_AesSuccessActionDataResult_ErrorStatus ErrorStatus;
}
final class wire_cst_aes_success_action_data_result extends ffi.Struct {
@ffi.Int32()
external int tag;
external AesSuccessActionDataResultKind kind;
}
final class wire_cst_SuccessActionProcessed_Aes extends ffi.Struct {
external ffi.Pointer<wire_cst_aes_success_action_data_result> result;
}
final class wire_cst_SuccessActionProcessed_Message extends ffi.Struct {
external ffi.Pointer<wire_cst_message_success_action_data> data;
}
final class wire_cst_SuccessActionProcessed_Url extends ffi.Struct {
external ffi.Pointer<wire_cst_url_success_action_data> data;
}
final class SuccessActionProcessedKind extends ffi.Union {
external wire_cst_SuccessActionProcessed_Aes Aes;
external wire_cst_SuccessActionProcessed_Message Message;
external wire_cst_SuccessActionProcessed_Url Url;
}
final class wire_cst_success_action_processed extends ffi.Struct {
@ffi.Int32()
external int tag;
external SuccessActionProcessedKind kind;
}
final class wire_cst_ln_url_info extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> ln_address;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> lnurl_pay_comment;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> lnurl_pay_domain;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> lnurl_pay_metadata;
external ffi.Pointer<wire_cst_success_action_processed> lnurl_pay_success_action;
external ffi.Pointer<wire_cst_success_action> lnurl_pay_unprocessed_success_action;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> lnurl_withdraw_endpoint;
}
final class wire_cst_PaymentDetails_Lightning extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> swap_id;
@@ -4424,6 +4553,8 @@ final class wire_cst_PaymentDetails_Lightning extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> payment_hash;
external ffi.Pointer<wire_cst_ln_url_info> lnurl_info;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> refund_tx_id;
external ffi.Pointer<ffi.Uint64> refund_tx_amount_sat;
@@ -4565,6 +4696,8 @@ final class wire_cst_config extends ffi.Struct {
@ffi.Uint32()
external int zero_conf_min_fee_rate_msat;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> sync_service_url;
external ffi.Pointer<ffi.Uint64> zero_conf_max_amount_sat;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> breez_api_key;
@@ -4581,33 +4714,6 @@ final class wire_cst_connect_request extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> mnemonic;
}
final class wire_cst_aes_success_action_data_decrypted extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> description;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> plaintext;
}
final class wire_cst_AesSuccessActionDataResult_Decrypted extends ffi.Struct {
external ffi.Pointer<wire_cst_aes_success_action_data_decrypted> data;
}
final class wire_cst_AesSuccessActionDataResult_ErrorStatus extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> reason;
}
final class AesSuccessActionDataResultKind extends ffi.Union {
external wire_cst_AesSuccessActionDataResult_Decrypted Decrypted;
external wire_cst_AesSuccessActionDataResult_ErrorStatus ErrorStatus;
}
final class wire_cst_aes_success_action_data_result extends ffi.Struct {
@ffi.Int32()
external int tag;
external AesSuccessActionDataResultKind kind;
}
final class wire_cst_bitcoin_address_data extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> address;
@@ -4631,33 +4737,6 @@ final class wire_cst_ln_url_pay_error_data extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> reason;
}
final class wire_cst_SuccessActionProcessed_Aes extends ffi.Struct {
external ffi.Pointer<wire_cst_aes_success_action_data_result> result;
}
final class wire_cst_SuccessActionProcessed_Message extends ffi.Struct {
external ffi.Pointer<wire_cst_message_success_action_data> data;
}
final class wire_cst_SuccessActionProcessed_Url extends ffi.Struct {
external ffi.Pointer<wire_cst_url_success_action_data> data;
}
final class SuccessActionProcessedKind extends ffi.Union {
external wire_cst_SuccessActionProcessed_Aes Aes;
external wire_cst_SuccessActionProcessed_Message Message;
external wire_cst_SuccessActionProcessed_Url Url;
}
final class wire_cst_success_action_processed extends ffi.Struct {
@ffi.Int32()
external int tag;
external SuccessActionProcessedKind kind;
}
final class wire_cst_ln_url_pay_success_data extends ffi.Struct {
external wire_cst_payment payment;