Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add payment expiry #622

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ typedef struct 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;
uint32_t liquid_expiration_blockheight;
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;
Expand All @@ -506,6 +507,8 @@ typedef struct wire_cst_PaymentDetails_Liquid {
typedef struct wire_cst_PaymentDetails_Bitcoin {
struct wire_cst_list_prim_u_8_strict *swap_id;
struct wire_cst_list_prim_u_8_strict *description;
uint32_t *liquid_expiration_blockheight;
uint32_t *bitcoin_expiration_blockheight;
struct wire_cst_list_prim_u_8_strict *refund_tx_id;
uint64_t *refund_tx_amount_sat;
} wire_cst_PaymentDetails_Bitcoin;
Expand Down Expand Up @@ -710,16 +713,26 @@ typedef struct wire_cst_list_refundable_swap {
int32_t len;
} wire_cst_list_refundable_swap;

typedef struct wire_cst_blockchain_info {
uint32_t liquid_tip;
uint32_t bitcoin_tip;
} wire_cst_blockchain_info;

typedef struct wire_cst_check_message_response {
bool is_valid;
} wire_cst_check_message_response;

typedef struct wire_cst_get_info_response {
typedef struct wire_cst_wallet_info {
uint64_t balance_sat;
uint64_t pending_send_sat;
uint64_t pending_receive_sat;
struct wire_cst_list_prim_u_8_strict *fingerprint;
struct wire_cst_list_prim_u_8_strict *pubkey;
} wire_cst_wallet_info;

typedef struct wire_cst_get_info_response {
struct wire_cst_wallet_info wallet_info;
struct wire_cst_blockchain_info blockchain_info;
} wire_cst_get_info_response;

typedef struct wire_cst_InputType_BitcoinAddress {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ class SwapUpdatedTask : TaskProtocol {
func getSwapId(details: PaymentDetails?) -> String? {
if let details = details {
switch details {
case let .bitcoin(swapId, _, _, _):
case let .bitcoin(swapId, _, _, _, _, _):
return swapId
case let .lightning(swapId, _, _, _, _, _, _, _, _):
case let .lightning(swapId, _, _, _, _, _, _, _, _, _):
return swapId
default:
break
Expand Down
16 changes: 13 additions & 3 deletions lib/bindings/src/breez_sdk_liquid.udl
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,24 @@ dictionary ConnectWithSignerRequest {
Config config;
};

dictionary GetInfoResponse {
dictionary BlockchainInfo {
u32 liquid_tip;
u32 bitcoin_tip;
};

dictionary WalletInfo {
u64 balance_sat;
u64 pending_send_sat;
u64 pending_receive_sat;
string fingerprint;
string pubkey;
};

dictionary GetInfoResponse {
WalletInfo wallet_info;
BlockchainInfo blockchain_info;
};

dictionary SignMessageRequest {
string message;
};
Expand Down Expand Up @@ -569,9 +579,9 @@ dictionary LnUrlInfo {

[Enum]
interface PaymentDetails {
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);
Lightning(string swap_id, string description, u32 liquid_expiration_blockheight, 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);
Bitcoin(string swap_id, string description, u32? bitcoin_expiration_blockheight, u32? liquid_expiration_blockheight, string? refund_tx_id, u64? refund_tx_amount_sat);
};

dictionary Payment {
Expand Down
2 changes: 1 addition & 1 deletion lib/bindings/tests/bindings/csharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

GetInfoResponse? info = sdk.GetInfo();

Console.WriteLine(info!.pubkey);
Console.WriteLine(info!.walletInfo.pubkey);
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ func main() {
log.Fatalf("GetInfo failed: %#v", err)
}

log.Print(info.Pubkey)
log.Print(info.WalletInfo.Pubkey)
}
2 changes: 1 addition & 1 deletion lib/bindings/tests/bindings/test_breez_liquid_sdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

GetInfoResponse? info = sdk.GetInfo();

Console.WriteLine(info!.pubkey);
Console.WriteLine(info!.walletInfo.pubkey);
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/bindings/tests/bindings/test_breez_sdk_liquid.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ try {
sdk.removeEventListener(listenerId)

println("$nodeInfo")
assert(nodeInfo.pubkey.equals("03d902f35f560e0470c63313c7369168d9d7df2d49bf295fd9fb7cb109ccee0494"))
assert(nodeInfo.walletInfo.pubkey.equals("03d902f35f560e0470c63313c7369168d9d7df2d49bf295fd9fb7cb109ccee0494"))
} catch (ex: Exception) {
throw RuntimeException(ex.toString())
}
2 changes: 1 addition & 1 deletion lib/bindings/tests/bindings/test_breez_sdk_liquid.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ def test():
sdk.remove_event_listener(listener_id)

print(node_info)
assert node_info.pubkey == "03d902f35f560e0470c63313c7369168d9d7df2d49bf295fd9fb7cb109ccee0494"
assert node_info.wallet_info.pubkey == "03d902f35f560e0470c63313c7369168d9d7df2d49bf295fd9fb7cb109ccee0494"

test()
2 changes: 1 addition & 1 deletion lib/bindings/tests/bindings/test_breez_sdk_liquid.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ let nodeInfo = try sdk.getInfo();
try sdk.removeEventListener(id: listenerId);

print(nodeInfo);
assert(nodeInfo.pubkey == "03d902f35f560e0470c63313c7369168d9d7df2d49bf295fd9fb7cb109ccee0494", "nodeInfo.pubkey");
assert(nodeInfo.walletInfo.pubkey == "03d902f35f560e0470c63313c7369168d9d7df2d49bf295fd9fb7cb109ccee0494", "nodeInfo.pubkey");
4 changes: 1 addition & 3 deletions lib/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ bip39 = "2.0.0"
boltz-client = { git = "https://github.com/SatoshiPortal/boltz-rust", branch = "trunk" }
chrono = "0.4"
env_logger = "0.11"
flutter_rust_bridge = { version = "=2.7.0", features = [
"chrono",
], optional = true }
flutter_rust_bridge = { version = "=2.7.0", features = ["chrono"], optional = true }
log = { workspace = true }
lwk_common = "0.7.0"
lwk_signer = "0.7.0"
Expand Down
Loading
Loading