Skip to content

Commit

Permalink
Merge branch 'rt-sync' into savage-receive-chain-pending
Browse files Browse the repository at this point in the history
  • Loading branch information
dangeross authored Dec 23, 2024
2 parents 3f49619 + f4f9529 commit 1e6dbd4
Show file tree
Hide file tree
Showing 28 changed files with 1,458 additions and 333 deletions.
2 changes: 1 addition & 1 deletion cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

132 changes: 74 additions & 58 deletions lib/bindings/langs/flutter/breez_sdk_liquid/include/breez_sdk_liquid.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,18 @@ typedef struct wire_cst_send_destination {
union SendDestinationKind kind;
} wire_cst_send_destination;

typedef struct wire_cst_ln_url_pay_request_data {
struct wire_cst_list_prim_u_8_strict *callback;
uint64_t min_sendable;
uint64_t max_sendable;
struct wire_cst_list_prim_u_8_strict *metadata_str;
uint16_t comment_allowed;
struct wire_cst_list_prim_u_8_strict *domain;
bool allows_nostr;
struct wire_cst_list_prim_u_8_strict *nostr_pubkey;
struct wire_cst_list_prim_u_8_strict *ln_address;
} wire_cst_ln_url_pay_request_data;

typedef struct wire_cst_aes_success_action_data {
struct wire_cst_list_prim_u_8_strict *description;
struct wire_cst_list_prim_u_8_strict *ciphertext;
Expand Down Expand Up @@ -279,6 +291,8 @@ typedef struct wire_cst_success_action {
typedef struct wire_cst_prepare_ln_url_pay_response {
struct wire_cst_send_destination destination;
uint64_t fees_sat;
struct wire_cst_ln_url_pay_request_data data;
struct wire_cst_list_prim_u_8_strict *comment;
struct wire_cst_success_action *success_action;
} wire_cst_prepare_ln_url_pay_response;

Expand Down Expand Up @@ -316,18 +330,6 @@ typedef struct wire_cst_prepare_buy_bitcoin_request {
uint64_t amount_sat;
} wire_cst_prepare_buy_bitcoin_request;

typedef struct wire_cst_ln_url_pay_request_data {
struct wire_cst_list_prim_u_8_strict *callback;
uint64_t min_sendable;
uint64_t max_sendable;
struct wire_cst_list_prim_u_8_strict *metadata_str;
uint16_t comment_allowed;
struct wire_cst_list_prim_u_8_strict *domain;
bool allows_nostr;
struct wire_cst_list_prim_u_8_strict *nostr_pubkey;
struct wire_cst_list_prim_u_8_strict *ln_address;
} wire_cst_ln_url_pay_request_data;

typedef struct wire_cst_prepare_ln_url_pay_request {
struct wire_cst_ln_url_pay_request_data data;
uint64_t amount_msat;
Expand Down Expand Up @@ -411,13 +413,70 @@ typedef struct wire_cst_binding_event_listener {
struct wire_cst_list_prim_u_8_strict *stream;
} wire_cst_binding_event_listener;

typedef struct wire_cst_aes_success_action_data_decrypted {
struct wire_cst_list_prim_u_8_strict *description;
struct wire_cst_list_prim_u_8_strict *plaintext;
} wire_cst_aes_success_action_data_decrypted;

typedef struct wire_cst_AesSuccessActionDataResult_Decrypted {
struct wire_cst_aes_success_action_data_decrypted *data;
} wire_cst_AesSuccessActionDataResult_Decrypted;

typedef struct wire_cst_AesSuccessActionDataResult_ErrorStatus {
struct wire_cst_list_prim_u_8_strict *reason;
} wire_cst_AesSuccessActionDataResult_ErrorStatus;

typedef union AesSuccessActionDataResultKind {
struct wire_cst_AesSuccessActionDataResult_Decrypted Decrypted;
struct wire_cst_AesSuccessActionDataResult_ErrorStatus ErrorStatus;
} AesSuccessActionDataResultKind;

typedef struct wire_cst_aes_success_action_data_result {
int32_t tag;
union AesSuccessActionDataResultKind kind;
} wire_cst_aes_success_action_data_result;

typedef struct wire_cst_SuccessActionProcessed_Aes {
struct wire_cst_aes_success_action_data_result *result;
} wire_cst_SuccessActionProcessed_Aes;

typedef struct wire_cst_SuccessActionProcessed_Message {
struct wire_cst_message_success_action_data *data;
} wire_cst_SuccessActionProcessed_Message;

typedef struct wire_cst_SuccessActionProcessed_Url {
struct wire_cst_url_success_action_data *data;
} wire_cst_SuccessActionProcessed_Url;

typedef union SuccessActionProcessedKind {
struct wire_cst_SuccessActionProcessed_Aes Aes;
struct wire_cst_SuccessActionProcessed_Message Message;
struct wire_cst_SuccessActionProcessed_Url Url;
} SuccessActionProcessedKind;

typedef struct wire_cst_success_action_processed {
int32_t tag;
union SuccessActionProcessedKind kind;
} wire_cst_success_action_processed;

typedef struct wire_cst_ln_url_info {
struct wire_cst_list_prim_u_8_strict *ln_address;
struct wire_cst_list_prim_u_8_strict *lnurl_pay_comment;
struct wire_cst_list_prim_u_8_strict *lnurl_pay_domain;
struct wire_cst_list_prim_u_8_strict *lnurl_pay_metadata;
struct wire_cst_success_action_processed *lnurl_pay_success_action;
struct wire_cst_success_action *lnurl_pay_unprocessed_success_action;
struct wire_cst_list_prim_u_8_strict *lnurl_withdraw_endpoint;
} wire_cst_ln_url_info;

typedef struct wire_cst_PaymentDetails_Lightning {
struct wire_cst_list_prim_u_8_strict *swap_id;
struct wire_cst_list_prim_u_8_strict *description;
struct wire_cst_list_prim_u_8_strict *preimage;
struct wire_cst_list_prim_u_8_strict *bolt11;
struct wire_cst_list_prim_u_8_strict *bolt12_offer;
struct wire_cst_list_prim_u_8_strict *payment_hash;
struct wire_cst_ln_url_info *lnurl_info;
struct wire_cst_list_prim_u_8_strict *refund_tx_id;
uint64_t *refund_tx_amount_sat;
} wire_cst_PaymentDetails_Lightning;
Expand Down Expand Up @@ -526,29 +585,6 @@ typedef struct wire_cst_connect_request {
struct wire_cst_list_prim_u_8_strict *mnemonic;
} wire_cst_connect_request;

typedef struct wire_cst_aes_success_action_data_decrypted {
struct wire_cst_list_prim_u_8_strict *description;
struct wire_cst_list_prim_u_8_strict *plaintext;
} wire_cst_aes_success_action_data_decrypted;

typedef struct wire_cst_AesSuccessActionDataResult_Decrypted {
struct wire_cst_aes_success_action_data_decrypted *data;
} wire_cst_AesSuccessActionDataResult_Decrypted;

typedef struct wire_cst_AesSuccessActionDataResult_ErrorStatus {
struct wire_cst_list_prim_u_8_strict *reason;
} wire_cst_AesSuccessActionDataResult_ErrorStatus;

typedef union AesSuccessActionDataResultKind {
struct wire_cst_AesSuccessActionDataResult_Decrypted Decrypted;
struct wire_cst_AesSuccessActionDataResult_ErrorStatus ErrorStatus;
} AesSuccessActionDataResultKind;

typedef struct wire_cst_aes_success_action_data_result {
int32_t tag;
union AesSuccessActionDataResultKind kind;
} wire_cst_aes_success_action_data_result;

typedef struct wire_cst_bitcoin_address_data {
struct wire_cst_list_prim_u_8_strict *address;
int32_t network;
Expand All @@ -566,29 +602,6 @@ typedef struct wire_cst_ln_url_pay_error_data {
struct wire_cst_list_prim_u_8_strict *reason;
} wire_cst_ln_url_pay_error_data;

typedef struct wire_cst_SuccessActionProcessed_Aes {
struct wire_cst_aes_success_action_data_result *result;
} wire_cst_SuccessActionProcessed_Aes;

typedef struct wire_cst_SuccessActionProcessed_Message {
struct wire_cst_message_success_action_data *data;
} wire_cst_SuccessActionProcessed_Message;

typedef struct wire_cst_SuccessActionProcessed_Url {
struct wire_cst_url_success_action_data *data;
} wire_cst_SuccessActionProcessed_Url;

typedef union SuccessActionProcessedKind {
struct wire_cst_SuccessActionProcessed_Aes Aes;
struct wire_cst_SuccessActionProcessed_Message Message;
struct wire_cst_SuccessActionProcessed_Url Url;
} SuccessActionProcessedKind;

typedef struct wire_cst_success_action_processed {
int32_t tag;
union SuccessActionProcessedKind kind;
} wire_cst_success_action_processed;

typedef struct wire_cst_ln_url_pay_success_data {
struct wire_cst_payment payment;
struct wire_cst_success_action_processed *success_action;
Expand Down Expand Up @@ -1237,6 +1250,8 @@ struct wire_cst_ln_url_auth_request_data *frbgen_breez_liquid_cst_new_box_autoad

struct wire_cst_ln_url_error_data *frbgen_breez_liquid_cst_new_box_autoadd_ln_url_error_data(void);

struct wire_cst_ln_url_info *frbgen_breez_liquid_cst_new_box_autoadd_ln_url_info(void);

struct wire_cst_ln_url_pay_error_data *frbgen_breez_liquid_cst_new_box_autoadd_ln_url_pay_error_data(void);

struct wire_cst_ln_url_pay_request *frbgen_breez_liquid_cst_new_box_autoadd_ln_url_pay_request(void);
Expand Down Expand Up @@ -1345,6 +1360,7 @@ static int64_t dummy_method_to_enforce_bundling(void) {
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_ln_offer);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_ln_url_auth_request_data);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_ln_url_error_data);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_ln_url_info);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_ln_url_pay_error_data);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_ln_url_pay_request);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_ln_url_pay_request_data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class SwapUpdatedTask : TaskProtocol {
switch details {
case let .bitcoin(swapId, _, _, _):
return swapId
case let .lightning(swapId, _, _, _, _, _, _, _):
case let .lightning(swapId, _, _, _, _, _, _, _, _):
return swapId
default:
break
Expand Down
14 changes: 13 additions & 1 deletion lib/bindings/src/breez_sdk_liquid.udl
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ dictionary PrepareLnUrlPayRequest {
dictionary PrepareLnUrlPayResponse {
SendDestination destination;
u64 fees_sat;
LnUrlPayRequestData data;
string? comment = null;
SuccessAction? success_action = null;
};

Expand Down Expand Up @@ -538,9 +540,19 @@ interface GetPaymentRequest {
Lightning(string payment_hash);
};

dictionary LnUrlInfo {
string? ln_address;
string? lnurl_pay_comment;
string? lnurl_pay_domain;
string? lnurl_pay_metadata;
SuccessActionProcessed? lnurl_pay_success_action;
SuccessAction? lnurl_pay_unprocessed_success_action;
string? lnurl_withdraw_endpoint;
};

[Enum]
interface PaymentDetails {
Lightning(string swap_id, string description, string? preimage, string? bolt11, string? bolt12_offer, string? payment_hash, string? refund_tx_id, u64? refund_tx_amount_sat);
Lightning(string swap_id, string description, string? preimage, string? bolt11, string? bolt12_offer, string? payment_hash, LnUrlInfo? lnurl_info, string? refund_tx_id, u64? refund_tx_amount_sat);
Liquid(string destination, string description);
Bitcoin(string swap_id, string description, string? refund_tx_id, u64? refund_tx_amount_sat);
};
Expand Down
2 changes: 1 addition & 1 deletion lib/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ lwk_wollet = { git = "https://github.com/dangeross/lwk", branch = "savage-full-s
#lwk_wollet = "0.7.0"
rusqlite = { version = "0.31", features = ["backup", "bundled"] }
rusqlite_migration = "1.0"
sdk-common = { git = "https://github.com/breez/breez-sdk", rev = "e537feb8ed134bc3c7af5196e10a0a189dd36ac7", features = ["liquid"] }
sdk-common = { git = "https://github.com/breez/breez-sdk", rev = "f77208acd34d74b571388889e856444908c59a85", features = ["liquid"] }
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.116"
strum = "0.25"
Expand Down
7 changes: 3 additions & 4 deletions lib/core/src/chain_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ impl ChainSwapHandler {
fees_sat: lockup_tx_fees_sat + swap.claim_fees_sat,
payment_type: PaymentType::Send,
is_confirmed: false,
}, None, None)?;
}, None, false)?;

self.update_swap_info(&ChainSwapUpdate {
swap_id: id,
Expand Down Expand Up @@ -819,7 +819,7 @@ impl ChainSwapHandler {
is_confirmed: false,
},
None,
None,
false,
)?;
Some(claim_tx_id.clone())
}
Expand Down Expand Up @@ -1299,9 +1299,8 @@ impl ChainSwapHandler {

#[cfg(test)]
mod tests {
use std::collections::{HashMap, HashSet};

use anyhow::Result;
use std::collections::{HashMap, HashSet};

use crate::{
model::{
Expand Down
Loading

0 comments on commit 1e6dbd4

Please sign in to comment.