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
This commit is contained in:
ok300
2024-06-25 17:19:02 +00:00
committed by GitHub
parent 0e2f185472
commit 7bd9b6ddb2
22 changed files with 379 additions and 94 deletions

124
cli/Cargo.lock generated
View File

@@ -1440,7 +1440,7 @@ dependencies = [
"rustls 0.22.4", "rustls 0.22.4",
"rustls-pki-types", "rustls-pki-types",
"tokio", "tokio",
"tokio-rustls", "tokio-rustls 0.25.0",
"tower-service", "tower-service",
] ]
@@ -2340,7 +2340,7 @@ dependencies = [
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rustls 0.22.4", "rustls 0.22.4",
"rustls-pemfile", "rustls-pemfile 2.1.2",
"rustls-pki-types", "rustls-pki-types",
"serde", "serde",
"serde_json", "serde_json",
@@ -2348,7 +2348,7 @@ dependencies = [
"sync_wrapper", "sync_wrapper",
"system-configuration", "system-configuration",
"tokio", "tokio",
"tokio-rustls", "tokio-rustls 0.25.0",
"tower-service", "tower-service",
"url", "url",
"wasm-bindgen", "wasm-bindgen",
@@ -2358,6 +2358,21 @@ dependencies = [
"winreg 0.52.0", "winreg 0.52.0",
] ]
[[package]]
name = "ring"
version = "0.16.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
dependencies = [
"cc",
"libc",
"once_cell",
"spin 0.5.2",
"untrusted 0.7.1",
"web-sys",
"winapi",
]
[[package]] [[package]]
name = "ring" name = "ring"
version = "0.17.8" version = "0.17.8"
@@ -2368,8 +2383,8 @@ dependencies = [
"cfg-if", "cfg-if",
"getrandom", "getrandom",
"libc", "libc",
"spin", "spin 0.9.8",
"untrusted", "untrusted 0.9.0",
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
@@ -2416,6 +2431,18 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "rustls"
version = "0.20.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99"
dependencies = [
"log",
"ring 0.16.20",
"sct",
"webpki",
]
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.21.12" version = "0.21.12"
@@ -2423,7 +2450,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
dependencies = [ dependencies = [
"log", "log",
"ring", "ring 0.17.8",
"rustls-webpki 0.101.7", "rustls-webpki 0.101.7",
"sct", "sct",
] ]
@@ -2435,13 +2462,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432"
dependencies = [ dependencies = [
"log", "log",
"ring", "ring 0.17.8",
"rustls-pki-types", "rustls-pki-types",
"rustls-webpki 0.102.3", "rustls-webpki 0.102.3",
"subtle", "subtle",
"zeroize", "zeroize",
] ]
[[package]]
name = "rustls-native-certs"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
dependencies = [
"openssl-probe",
"rustls-pemfile 1.0.4",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pemfile"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
dependencies = [
"base64 0.21.7",
]
[[package]] [[package]]
name = "rustls-pemfile" name = "rustls-pemfile"
version = "2.1.2" version = "2.1.2"
@@ -2464,8 +2512,8 @@ version = "0.101.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
dependencies = [ dependencies = [
"ring", "ring 0.17.8",
"untrusted", "untrusted 0.9.0",
] ]
[[package]] [[package]]
@@ -2474,9 +2522,9 @@ version = "0.102.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf"
dependencies = [ dependencies = [
"ring", "ring 0.17.8",
"rustls-pki-types", "rustls-pki-types",
"untrusted", "untrusted 0.9.0",
] ]
[[package]] [[package]]
@@ -2546,14 +2594,14 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
dependencies = [ dependencies = [
"ring", "ring 0.17.8",
"untrusted", "untrusted 0.9.0",
] ]
[[package]] [[package]]
name = "sdk-common" name = "sdk-common"
version = "0.4.1" version = "0.4.2-rc3"
source = "git+https://github.com/breez/breez-sdk?branch=main#7c48c1e5a6f0450ae6f6150b8e40235ee31fd330" source = "git+https://github.com/breez/breez-sdk?branch=main#3ddd68cdc524a4a640463f687f4e4d819069de01"
dependencies = [ dependencies = [
"aes 0.8.4", "aes 0.8.4",
"anyhow", "anyhow",
@@ -2778,6 +2826,12 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]] [[package]]
name = "spin" name = "spin"
version = "0.9.8" version = "0.9.8"
@@ -2971,6 +3025,17 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "tokio-rustls"
version = "0.23.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59"
dependencies = [
"rustls 0.20.9",
"tokio",
"webpki",
]
[[package]] [[package]]
name = "tokio-rustls" name = "tokio-rustls"
version = "0.25.0" version = "0.25.0"
@@ -3043,7 +3108,10 @@ dependencies = [
"pin-project", "pin-project",
"prost", "prost",
"prost-derive", "prost-derive",
"rustls-native-certs",
"rustls-pemfile 1.0.4",
"tokio", "tokio",
"tokio-rustls 0.23.4",
"tokio-stream", "tokio-stream",
"tokio-util", "tokio-util",
"tower", "tower",
@@ -3051,6 +3119,7 @@ dependencies = [
"tower-service", "tower-service",
"tracing", "tracing",
"tracing-futures", "tracing-futures",
"webpki-roots 0.22.6",
] ]
[[package]] [[package]]
@@ -3215,6 +3284,12 @@ dependencies = [
"subtle", "subtle",
] ]
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]] [[package]]
name = "untrusted" name = "untrusted"
version = "0.9.0" version = "0.9.0"
@@ -3382,6 +3457,25 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "webpki"
version = "0.22.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53"
dependencies = [
"ring 0.17.8",
"untrusted 0.9.0",
]
[[package]]
name = "webpki-roots"
version = "0.22.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87"
dependencies = [
"webpki",
]
[[package]] [[package]]
name = "webpki-roots" name = "webpki-roots"
version = "0.25.4" version = "0.25.4"

124
lib/Cargo.lock generated
View File

@@ -1639,7 +1639,7 @@ dependencies = [
"rustls 0.22.4", "rustls 0.22.4",
"rustls-pki-types", "rustls-pki-types",
"tokio", "tokio",
"tokio-rustls", "tokio-rustls 0.25.0",
"tower-service", "tower-service",
] ]
@@ -2674,7 +2674,7 @@ dependencies = [
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rustls 0.22.4", "rustls 0.22.4",
"rustls-pemfile", "rustls-pemfile 2.1.2",
"rustls-pki-types", "rustls-pki-types",
"serde", "serde",
"serde_json", "serde_json",
@@ -2682,7 +2682,7 @@ dependencies = [
"sync_wrapper", "sync_wrapper",
"system-configuration", "system-configuration",
"tokio", "tokio",
"tokio-rustls", "tokio-rustls 0.25.0",
"tower-service", "tower-service",
"url", "url",
"wasm-bindgen", "wasm-bindgen",
@@ -2692,6 +2692,21 @@ dependencies = [
"winreg 0.52.0", "winreg 0.52.0",
] ]
[[package]]
name = "ring"
version = "0.16.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
dependencies = [
"cc",
"libc",
"once_cell",
"spin 0.5.2",
"untrusted 0.7.1",
"web-sys",
"winapi",
]
[[package]] [[package]]
name = "ring" name = "ring"
version = "0.17.8" version = "0.17.8"
@@ -2702,8 +2717,8 @@ dependencies = [
"cfg-if", "cfg-if",
"getrandom", "getrandom",
"libc", "libc",
"spin", "spin 0.9.8",
"untrusted", "untrusted 0.9.0",
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
@@ -2750,6 +2765,18 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "rustls"
version = "0.20.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99"
dependencies = [
"log",
"ring 0.16.20",
"sct",
"webpki",
]
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.21.12" version = "0.21.12"
@@ -2757,7 +2784,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
dependencies = [ dependencies = [
"log", "log",
"ring", "ring 0.17.8",
"rustls-webpki 0.101.7", "rustls-webpki 0.101.7",
"sct", "sct",
] ]
@@ -2769,13 +2796,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432"
dependencies = [ dependencies = [
"log", "log",
"ring", "ring 0.17.8",
"rustls-pki-types", "rustls-pki-types",
"rustls-webpki 0.102.3", "rustls-webpki 0.102.3",
"subtle", "subtle",
"zeroize", "zeroize",
] ]
[[package]]
name = "rustls-native-certs"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
dependencies = [
"openssl-probe",
"rustls-pemfile 1.0.4",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pemfile"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
dependencies = [
"base64 0.21.7",
]
[[package]] [[package]]
name = "rustls-pemfile" name = "rustls-pemfile"
version = "2.1.2" version = "2.1.2"
@@ -2798,8 +2846,8 @@ version = "0.101.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
dependencies = [ dependencies = [
"ring", "ring 0.17.8",
"untrusted", "untrusted 0.9.0",
] ]
[[package]] [[package]]
@@ -2808,9 +2856,9 @@ version = "0.102.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf"
dependencies = [ dependencies = [
"ring", "ring 0.17.8",
"rustls-pki-types", "rustls-pki-types",
"untrusted", "untrusted 0.9.0",
] ]
[[package]] [[package]]
@@ -2886,14 +2934,14 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
dependencies = [ dependencies = [
"ring", "ring 0.17.8",
"untrusted", "untrusted 0.9.0",
] ]
[[package]] [[package]]
name = "sdk-common" name = "sdk-common"
version = "0.4.1" version = "0.4.2-rc3"
source = "git+https://github.com/breez/breez-sdk?branch=main#7c48c1e5a6f0450ae6f6150b8e40235ee31fd330" source = "git+https://github.com/breez/breez-sdk?branch=main#3ddd68cdc524a4a640463f687f4e4d819069de01"
dependencies = [ dependencies = [
"aes 0.8.4", "aes 0.8.4",
"anyhow", "anyhow",
@@ -3148,6 +3196,12 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]] [[package]]
name = "spin" name = "spin"
version = "0.9.8" version = "0.9.8"
@@ -3376,6 +3430,17 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "tokio-rustls"
version = "0.23.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59"
dependencies = [
"rustls 0.20.9",
"tokio",
"webpki",
]
[[package]] [[package]]
name = "tokio-rustls" name = "tokio-rustls"
version = "0.25.0" version = "0.25.0"
@@ -3457,7 +3522,10 @@ dependencies = [
"pin-project", "pin-project",
"prost", "prost",
"prost-derive", "prost-derive",
"rustls-native-certs",
"rustls-pemfile 1.0.4",
"tokio", "tokio",
"tokio-rustls 0.23.4",
"tokio-stream", "tokio-stream",
"tokio-util", "tokio-util",
"tower", "tower",
@@ -3465,6 +3533,7 @@ dependencies = [
"tower-service", "tower-service",
"tracing", "tracing",
"tracing-futures", "tracing-futures",
"webpki-roots 0.22.6",
] ]
[[package]] [[package]]
@@ -3978,6 +4047,12 @@ dependencies = [
"subtle", "subtle",
] ]
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]] [[package]]
name = "untrusted" name = "untrusted"
version = "0.9.0" version = "0.9.0"
@@ -4154,6 +4229,25 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "webpki"
version = "0.22.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53"
dependencies = [
"ring 0.17.8",
"untrusted 0.9.0",
]
[[package]]
name = "webpki-roots"
version = "0.22.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87"
dependencies = [
"webpki",
]
[[package]] [[package]]
name = "webpki-roots" name = "webpki-roots"
version = "0.25.4" version = "0.25.4"

View File

@@ -195,7 +195,6 @@ typedef struct wire_cst_liquid_sdk_event {
} wire_cst_liquid_sdk_event; } wire_cst_liquid_sdk_event;
typedef struct wire_cst_config { typedef struct wire_cst_config {
struct wire_cst_list_prim_u_8_strict *boltz_url;
struct wire_cst_list_prim_u_8_strict *liquid_electrum_url; struct wire_cst_list_prim_u_8_strict *liquid_electrum_url;
struct wire_cst_list_prim_u_8_strict *bitcoin_electrum_url; struct wire_cst_list_prim_u_8_strict *bitcoin_electrum_url;
struct wire_cst_list_prim_u_8_strict *working_dir; struct wire_cst_list_prim_u_8_strict *working_dir;

View File

@@ -244,7 +244,6 @@ enum PaymentError {
}; };
dictionary Config { dictionary Config {
string boltz_url;
string liquid_electrum_url; string liquid_electrum_url;
string bitcoin_electrum_url; string bitcoin_electrum_url;
string working_dir; string working_dir;

View File

@@ -13,7 +13,7 @@ frb = ["dep:flutter_rust_bridge"]
[dependencies] [dependencies]
anyhow = { workspace = true } anyhow = { workspace = true }
bip39 = { version = "2.0.0", features = ["serde"] } bip39 = "2.0.0"
#boltz-client = { git = "https://github.com/SatoshiPortal/boltz-rust", rev = "a05731cc33030ada9ae14afcafe0cded22842ba6" } #boltz-client = { git = "https://github.com/SatoshiPortal/boltz-rust", rev = "a05731cc33030ada9ae14afcafe0cded22842ba6" }
boltz-client = { git = "https://github.com/dangeross/boltz-rust", branch = "savage-chain-swaps" } boltz-client = { git = "https://github.com/dangeross/boltz-rust", branch = "savage-chain-swaps" }
chrono = "0.4" chrono = "0.4"

View File

@@ -390,7 +390,6 @@ impl CstDecode<crate::model::Config> for wire_cst_config {
// Codec=Cst (C-struct based), see doc to use other codecs // Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::Config { fn cst_decode(self) -> crate::model::Config {
crate::model::Config { crate::model::Config {
boltz_url: self.boltz_url.cst_decode(),
liquid_electrum_url: self.liquid_electrum_url.cst_decode(), liquid_electrum_url: self.liquid_electrum_url.cst_decode(),
bitcoin_electrum_url: self.bitcoin_electrum_url.cst_decode(), bitcoin_electrum_url: self.bitcoin_electrum_url.cst_decode(),
working_dir: self.working_dir.cst_decode(), working_dir: self.working_dir.cst_decode(),
@@ -1313,7 +1312,6 @@ impl Default for wire_cst_bitcoin_address_data {
impl NewWithNullPtr for wire_cst_config { impl NewWithNullPtr for wire_cst_config {
fn new_with_null_ptr() -> Self { fn new_with_null_ptr() -> Self {
Self { Self {
boltz_url: core::ptr::null_mut(),
liquid_electrum_url: core::ptr::null_mut(), liquid_electrum_url: core::ptr::null_mut(),
bitcoin_electrum_url: core::ptr::null_mut(), bitcoin_electrum_url: core::ptr::null_mut(),
working_dir: core::ptr::null_mut(), working_dir: core::ptr::null_mut(),
@@ -2611,7 +2609,6 @@ pub struct wire_cst_bitcoin_address_data {
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub struct wire_cst_config { pub struct wire_cst_config {
boltz_url: *mut wire_cst_list_prim_u_8_strict,
liquid_electrum_url: *mut wire_cst_list_prim_u_8_strict, liquid_electrum_url: *mut wire_cst_list_prim_u_8_strict,
bitcoin_electrum_url: *mut wire_cst_list_prim_u_8_strict, bitcoin_electrum_url: *mut wire_cst_list_prim_u_8_strict,
working_dir: *mut wire_cst_list_prim_u_8_strict, working_dir: *mut wire_cst_list_prim_u_8_strict,

View File

@@ -1583,7 +1583,6 @@ impl SseDecode for bool {
impl SseDecode for crate::model::Config { impl SseDecode for crate::model::Config {
// Codec=Sse (Serialization based), see doc to use other codecs // Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut var_boltzUrl = <String>::sse_decode(deserializer);
let mut var_liquidElectrumUrl = <String>::sse_decode(deserializer); let mut var_liquidElectrumUrl = <String>::sse_decode(deserializer);
let mut var_bitcoinElectrumUrl = <String>::sse_decode(deserializer); let mut var_bitcoinElectrumUrl = <String>::sse_decode(deserializer);
let mut var_workingDir = <String>::sse_decode(deserializer); let mut var_workingDir = <String>::sse_decode(deserializer);
@@ -1592,7 +1591,6 @@ impl SseDecode for crate::model::Config {
let mut var_zeroConfMinFeeRate = <f32>::sse_decode(deserializer); let mut var_zeroConfMinFeeRate = <f32>::sse_decode(deserializer);
let mut var_zeroConfMaxAmountSat = <Option<u64>>::sse_decode(deserializer); let mut var_zeroConfMaxAmountSat = <Option<u64>>::sse_decode(deserializer);
return crate::model::Config { return crate::model::Config {
boltz_url: var_boltzUrl,
liquid_electrum_url: var_liquidElectrumUrl, liquid_electrum_url: var_liquidElectrumUrl,
bitcoin_electrum_url: var_bitcoinElectrumUrl, bitcoin_electrum_url: var_bitcoinElectrumUrl,
working_dir: var_workingDir, working_dir: var_workingDir,
@@ -2902,7 +2900,6 @@ impl flutter_rust_bridge::IntoIntoDart<FrbWrapper<crate::bindings::BitcoinAddres
impl flutter_rust_bridge::IntoDart for crate::model::Config { impl flutter_rust_bridge::IntoDart for crate::model::Config {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[ [
self.boltz_url.into_into_dart().into_dart(),
self.liquid_electrum_url.into_into_dart().into_dart(), self.liquid_electrum_url.into_into_dart().into_dart(),
self.bitcoin_electrum_url.into_into_dart().into_dart(), self.bitcoin_electrum_url.into_into_dart().into_dart(),
self.working_dir.into_into_dart().into_dart(), self.working_dir.into_into_dart().into_dart(),
@@ -4253,7 +4250,6 @@ impl SseEncode for bool {
impl SseEncode for crate::model::Config { impl SseEncode for crate::model::Config {
// Codec=Sse (Serialization based), see doc to use other codecs // Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<String>::sse_encode(self.boltz_url, serializer);
<String>::sse_encode(self.liquid_electrum_url, serializer); <String>::sse_encode(self.liquid_electrum_url, serializer);
<String>::sse_encode(self.bitcoin_electrum_url, serializer); <String>::sse_encode(self.bitcoin_electrum_url, serializer);
<String>::sse_encode(self.working_dir, serializer); <String>::sse_encode(self.working_dir, serializer);

View File

@@ -2,7 +2,6 @@ use anyhow::{anyhow, Result};
use boltz_client::network::Chain; use boltz_client::network::Chain;
use boltz_client::swaps::boltzv2::{ use boltz_client::swaps::boltzv2::{
CreateChainResponse, CreateReverseResponse, CreateSubmarineResponse, Leaf, Side, SwapTree, CreateChainResponse, CreateReverseResponse, CreateSubmarineResponse, Leaf, Side, SwapTree,
BOLTZ_MAINNET_URL_V2, BOLTZ_TESTNET_URL_V2,
}; };
use boltz_client::{BtcSwapScriptV2, BtcSwapTxV2, Keypair, LBtcSwapScriptV2, LBtcSwapTxV2}; use boltz_client::{BtcSwapScriptV2, BtcSwapTxV2, Keypair, LBtcSwapScriptV2, LBtcSwapTxV2};
use lwk_wollet::ElementsNetwork; use lwk_wollet::ElementsNetwork;
@@ -23,7 +22,6 @@ pub const LOWBALL_FEE_RATE_SAT_PER_VBYTE: f32 = 0.01;
/// Configuration for the Liquid SDK /// Configuration for the Liquid SDK
#[derive(Clone, Debug, Serialize)] #[derive(Clone, Debug, Serialize)]
pub struct Config { pub struct Config {
pub boltz_url: String,
pub liquid_electrum_url: String, pub liquid_electrum_url: String,
pub bitcoin_electrum_url: String, pub bitcoin_electrum_url: String,
/// Directory in which all SDK files (DB, log, cache) are stored. /// Directory in which all SDK files (DB, log, cache) are stored.
@@ -43,7 +41,6 @@ pub struct Config {
impl Config { impl Config {
pub fn mainnet() -> Self { pub fn mainnet() -> Self {
Config { Config {
boltz_url: BOLTZ_MAINNET_URL_V2.to_owned(),
liquid_electrum_url: "blockstream.info:995".to_string(), liquid_electrum_url: "blockstream.info:995".to_string(),
bitcoin_electrum_url: "blockstream.info:700".to_string(), bitcoin_electrum_url: "blockstream.info:700".to_string(),
working_dir: ".".to_string(), working_dir: ".".to_string(),
@@ -56,7 +53,6 @@ impl Config {
pub fn testnet() -> Self { pub fn testnet() -> Self {
Config { Config {
boltz_url: BOLTZ_TESTNET_URL_V2.to_owned(),
liquid_electrum_url: "blockstream.info:465".to_string(), liquid_electrum_url: "blockstream.info:465".to_string(),
bitcoin_electrum_url: "blockstream.info:993".to_string(), bitcoin_electrum_url: "blockstream.info:993".to_string(),
working_dir: ".".to_string(), working_dir: ".".to_string(),

View File

@@ -0,0 +1,66 @@
use anyhow::Result;
use super::Persister;
const KEY_SWAPPER_PROXY_URL: &str = "swapper_proxy_url";
impl Persister {
pub fn get_cached_item(&self, key: &str) -> Result<Option<String>> {
let res = self.get_connection()?.query_row(
"SELECT value FROM cached_items WHERE key = ?1",
[key],
|row| row.get(0),
);
Ok(res.ok())
}
pub fn update_cached_item(&self, key: &str, value: String) -> Result<()> {
self.get_connection()?.execute(
"INSERT OR REPLACE INTO cached_items (key, value) VALUES (?1,?2)",
(key, value),
)?;
Ok(())
}
#[allow(dead_code)]
pub fn delete_cached_item(&self, key: &str) -> Result<()> {
self.get_connection()?
.execute("DELETE FROM cached_items WHERE key = ?1", [key])?;
Ok(())
}
pub fn set_swapper_proxy_url(&self, swapper_proxy_url: String) -> Result<()> {
self.update_cached_item(KEY_SWAPPER_PROXY_URL, swapper_proxy_url)
}
#[allow(dead_code)]
pub fn remove_swapper_proxy_url(&self) -> Result<()> {
self.delete_cached_item(KEY_SWAPPER_PROXY_URL)
}
pub fn get_swapper_proxy_url(&self) -> Result<Option<String>> {
self.get_cached_item(KEY_SWAPPER_PROXY_URL)
}
}
#[cfg(test)]
mod tests {
use anyhow::Result;
use crate::test_utils::new_persister;
#[test]
fn test_cached_items() -> Result<()> {
let (_temp_dir, persister) = new_persister()?;
persister.update_cached_item("key1", "val1".to_string())?;
let item_value = persister.get_cached_item("key1")?;
assert_eq!(item_value, Some("val1".to_string()));
persister.delete_cached_item("key1")?;
let item_value = persister.get_cached_item("key1")?;
assert_eq!(item_value, None);
Ok(())
}
}

View File

@@ -56,5 +56,9 @@ pub(crate) fn current_migrations() -> Vec<&'static str> {
created_at INTEGER NOT NULL, created_at INTEGER NOT NULL,
state INTEGER NOT NULL state INTEGER NOT NULL
) STRICT;", ) STRICT;",
"CREATE TABLE IF NOT EXISTS cached_items (
key TEXT NOT NULL PRIMARY KEY,
value TEXT NOT NULL
) STRICT;",
] ]
} }

View File

@@ -1,4 +1,5 @@
mod backup; mod backup;
mod cache;
pub(crate) mod chain; pub(crate) mod chain;
mod migrations; mod migrations;
pub(crate) mod receive; pub(crate) mod receive;

View File

@@ -58,14 +58,27 @@ pub struct LiquidSdk {
impl LiquidSdk { impl LiquidSdk {
pub async fn connect(req: ConnectRequest) -> Result<Arc<LiquidSdk>> { pub async fn connect(req: ConnectRequest) -> Result<Arc<LiquidSdk>> {
let config = req.config; let maybe_swapper_proxy_url =
let sdk = LiquidSdk::new(config, req.mnemonic)?; match BreezServer::new("https://bs1.breez-abc.technology:443".into(), None) {
Ok(breez_server) => breez_server
.fetch_boltz_swapper_urls()
.await
.ok()
.and_then(|swapper_urls| swapper_urls.first().cloned()),
Err(_) => None,
};
let sdk = LiquidSdk::new(req.config, maybe_swapper_proxy_url, req.mnemonic)?;
sdk.start().await?; sdk.start().await?;
Ok(sdk) Ok(sdk)
} }
fn new(config: Config, mnemonic: String) -> Result<Arc<Self>> { fn new(
config: Config,
swapper_proxy_url: Option<String>,
mnemonic: String,
) -> Result<Arc<Self>> {
fs::create_dir_all(&config.working_dir)?; fs::create_dir_all(&config.working_dir)?;
let persister = Arc::new(Persister::new(&config.working_dir, config.network)?); let persister = Arc::new(Persister::new(&config.working_dir, config.network)?);
@@ -74,7 +87,11 @@ impl LiquidSdk {
let event_manager = Arc::new(EventManager::new()); let event_manager = Arc::new(EventManager::new());
let (shutdown_sender, shutdown_receiver) = watch::channel::<()>(()); let (shutdown_sender, shutdown_receiver) = watch::channel::<()>(());
let swapper = Arc::new(BoltzSwapper::new(config.clone())); if let Some(swapper_proxy_url) = swapper_proxy_url {
persister.set_swapper_proxy_url(swapper_proxy_url)?;
}
let cached_swapper_proxy_url = persister.get_swapper_proxy_url()?;
let swapper = Arc::new(BoltzSwapper::new(config.clone(), cached_swapper_proxy_url));
let status_stream = Arc::<dyn SwapperStatusStream>::from(swapper.create_status_stream()); let status_stream = Arc::<dyn SwapperStatusStream>::from(swapper.create_status_stream());
let liquid_chain_service = let liquid_chain_service =

View File

@@ -12,7 +12,8 @@ use boltz_client::network::Chain;
use boltz_client::swaps::boltzv2::{ use boltz_client::swaps::boltzv2::{
self, BoltzApiClientV2, ChainPair, Cooperative, CreateChainRequest, CreateChainResponse, self, BoltzApiClientV2, ChainPair, Cooperative, CreateChainRequest, CreateChainResponse,
CreateReverseRequest, CreateReverseResponse, CreateSubmarineRequest, CreateSubmarineResponse, CreateReverseRequest, CreateReverseResponse, CreateSubmarineRequest, CreateSubmarineResponse,
ReversePair, SubmarineClaimTxResponse, SubmarinePair, ReversePair, SubmarineClaimTxResponse, SubmarinePair, BOLTZ_MAINNET_URL_V2,
BOLTZ_TESTNET_URL_V2,
}; };
use boltz_client::util::secrets::Preimage; use boltz_client::util::secrets::Preimage;
use boltz_client::{Amount, Bolt11Invoice, BtcSwapTxV2, Keypair, LBtcSwapTxV2, LockTime}; use boltz_client::{Amount, Bolt11Invoice, BtcSwapTxV2, Keypair, LBtcSwapTxV2, LockTime};
@@ -21,6 +22,7 @@ use log::{debug, info};
use lwk_wollet::elements; use lwk_wollet::elements;
use serde_json::Value; use serde_json::Value;
use tokio::sync::{broadcast, watch}; use tokio::sync::{broadcast, watch};
use url::Url;
use crate::error::{LiquidSdkError, PaymentError}; use crate::error::{LiquidSdkError, PaymentError};
use crate::model::{ use crate::model::{
@@ -152,15 +154,46 @@ pub trait Swapper: Send + Sync {
pub struct BoltzSwapper { pub struct BoltzSwapper {
client: BoltzApiClientV2, client: BoltzApiClientV2,
boltz_url: String,
referral_id: Option<String>,
config: Config, config: Config,
liquid_electrum_config: ElectrumConfig, liquid_electrum_config: ElectrumConfig,
bitcoin_electrum_config: ElectrumConfig, bitcoin_electrum_config: ElectrumConfig,
} }
impl BoltzSwapper { impl BoltzSwapper {
pub fn new(config: Config) -> BoltzSwapper { pub fn new(config: Config, swapper_proxy_url: Option<String>) -> BoltzSwapper {
let (boltz_api_base_url, referral_id) = match &config.network {
LiquidNetwork::Testnet => (None, None),
LiquidNetwork::Mainnet => match &swapper_proxy_url {
Some(swapper_proxy_url) => Url::parse(swapper_proxy_url)
.map(|url| match url.query() {
None => (None, None),
Some(query) => {
let api_base_url =
url.domain().map(|domain| format!("https://{domain}/v2"));
let parts: Vec<String> = query.split('=').map(Into::into).collect();
let referral_id = parts.get(1).cloned();
(api_base_url, referral_id)
}
})
.unwrap_or_default(),
None => (None, None),
},
};
let boltz_url = boltz_api_base_url.unwrap_or(
match config.network {
LiquidNetwork::Mainnet => BOLTZ_MAINNET_URL_V2,
LiquidNetwork::Testnet => BOLTZ_TESTNET_URL_V2,
}
.to_string(),
);
BoltzSwapper { BoltzSwapper {
client: BoltzApiClientV2::new(&config.boltz_url), client: BoltzApiClientV2::new(&boltz_url),
boltz_url,
referral_id,
config: config.clone(), config: config.clone(),
liquid_electrum_config: ElectrumConfig::new( liquid_electrum_config: ElectrumConfig::new(
config.network.into(), config.network.into(),
@@ -195,7 +228,7 @@ impl BoltzSwapper {
swap_script.clone(), swap_script.clone(),
refund_address, refund_address,
&self.liquid_electrum_config, &self.liquid_electrum_config,
self.config.boltz_url.clone(), self.boltz_url.clone(),
swap_id, swap_id,
)?), )?),
}; };
@@ -291,7 +324,7 @@ impl BoltzSwapper {
swap_script, swap_script,
swap.claim_address.clone(), swap.claim_address.clone(),
&self.liquid_electrum_config, &self.liquid_electrum_config,
self.config.boltz_url.clone(), self.boltz_url.clone(),
swap.id.clone(), swap.id.clone(),
)?; )?;
@@ -449,7 +482,11 @@ impl Swapper for BoltzSwapper {
&self, &self,
req: CreateChainRequest, req: CreateChainRequest,
) -> Result<CreateChainResponse, PaymentError> { ) -> Result<CreateChainResponse, PaymentError> {
Ok(self.client.post_chain_req(req)?) let modified_req = CreateChainRequest {
referral_id: self.referral_id.clone(),
..req.clone()
};
Ok(self.client.post_chain_req(modified_req)?)
} }
/// Create a new send swap /// Create a new send swap
@@ -457,7 +494,11 @@ impl Swapper for BoltzSwapper {
&self, &self,
req: CreateSubmarineRequest, req: CreateSubmarineRequest,
) -> Result<CreateSubmarineResponse, PaymentError> { ) -> Result<CreateSubmarineResponse, PaymentError> {
Ok(self.client.post_swap_req(&req)?) let modified_req = CreateSubmarineRequest {
referral_id: self.referral_id.clone(),
..req.clone()
};
Ok(self.client.post_swap_req(&modified_req)?)
} }
/// Get a chain pair information /// Get a chain pair information
@@ -649,7 +690,11 @@ impl Swapper for BoltzSwapper {
&self, &self,
req: CreateReverseRequest, req: CreateReverseRequest,
) -> Result<CreateReverseResponse, PaymentError> { ) -> Result<CreateReverseResponse, PaymentError> {
Ok(self.client.post_reverse_req(req)?) let modified_req = CreateReverseRequest {
referral_id: self.referral_id.clone(),
..req.clone()
};
Ok(self.client.post_reverse_req(modified_req)?)
} }
// Get a reverse pair information // Get a reverse pair information
@@ -669,7 +714,7 @@ impl Swapper for BoltzSwapper {
swap_script, swap_script,
claim_address, claim_address,
&self.liquid_electrum_config, &self.liquid_electrum_config,
self.config.boltz_url.clone(), self.boltz_url.clone(),
swap.id.clone(), swap.id.clone(),
)?; )?;
@@ -701,7 +746,7 @@ impl Swapper for BoltzSwapper {
} }
fn create_status_stream(&self) -> Box<dyn SwapperStatusStream> { fn create_status_stream(&self) -> Box<dyn SwapperStatusStream> {
Box::new(BoltzStatusStream::new(&self.config.boltz_url)) Box::new(BoltzStatusStream::new(&self.boltz_url))
} }
fn check_for_mrh(&self, invoice: &str) -> Result<Option<(String, f64)>, PaymentError> { fn check_for_mrh(&self, invoice: &str) -> Result<Option<(String, f64)>, PaymentError> {

View File

@@ -17,7 +17,7 @@ use crate::{
}; };
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use bip39::rand::{self, distributions::Alphanumeric, Rng}; use lwk_wollet::secp256k1::rand::{self, distributions::Alphanumeric, Rng};
use lwk_wollet::ElectrumUrl; use lwk_wollet::ElectrumUrl;
use tempdir::TempDir; use tempdir::TempDir;
use tokio::sync::Mutex; use tokio::sync::Mutex;
@@ -30,7 +30,7 @@ pub(crate) fn new_send_swap_state_handler(
) -> Result<SendSwapStateHandler> { ) -> Result<SendSwapStateHandler> {
let config = Config::testnet(); let config = Config::testnet();
let onchain_wallet = Arc::new(new_onchain_wallet(&config)?); let onchain_wallet = Arc::new(new_onchain_wallet(&config)?);
let swapper = Arc::new(BoltzSwapper::new(config.clone())); let swapper = Arc::new(BoltzSwapper::new(config.clone(), None));
let chain_service = Arc::new(Mutex::new(HybridLiquidChainService::new(config.clone())?)); let chain_service = Arc::new(Mutex::new(HybridLiquidChainService::new(config.clone())?));
Ok(SendSwapStateHandler::new( Ok(SendSwapStateHandler::new(
@@ -47,7 +47,7 @@ pub(crate) fn new_receive_swap_state_handler(
) -> Result<ReceiveSwapStateHandler> { ) -> Result<ReceiveSwapStateHandler> {
let config = Config::testnet(); let config = Config::testnet();
let onchain_wallet = Arc::new(new_onchain_wallet(&config)?); let onchain_wallet = Arc::new(new_onchain_wallet(&config)?);
let swapper = Arc::new(BoltzSwapper::new(config.clone())); let swapper = Arc::new(BoltzSwapper::new(config.clone(), None));
let liquid_chain_service = Arc::new(Mutex::new(HybridLiquidChainService::new(config.clone())?)); let liquid_chain_service = Arc::new(Mutex::new(HybridLiquidChainService::new(config.clone())?));
Ok(ReceiveSwapStateHandler::new( Ok(ReceiveSwapStateHandler::new(
@@ -64,7 +64,7 @@ pub(crate) fn new_chain_swap_state_handler(
) -> Result<ChainSwapStateHandler> { ) -> Result<ChainSwapStateHandler> {
let config = Config::testnet(); let config = Config::testnet();
let onchain_wallet = Arc::new(new_onchain_wallet(&config)?); let onchain_wallet = Arc::new(new_onchain_wallet(&config)?);
let swapper = Arc::new(BoltzSwapper::new(config.clone())); let swapper = Arc::new(BoltzSwapper::new(config.clone(), None));
let liquid_chain_service = Arc::new(Mutex::new(HybridLiquidChainService::new(config.clone())?)); let liquid_chain_service = Arc::new(Mutex::new(HybridLiquidChainService::new(config.clone())?));
let bitcoin_chain_service = Arc::new(Mutex::new(bitcoin::ElectrumClient::new( let bitcoin_chain_service = Arc::new(Mutex::new(bitcoin::ElectrumClient::new(
&ElectrumUrl::new(&config.bitcoin_electrum_url, true, true), &ElectrumUrl::new(&config.bitcoin_electrum_url, true, true),

View File

@@ -25,7 +25,7 @@ pub(crate) fn json_to_pubkey(json: &str) -> Result<boltz_client::PublicKey, Paym
pub(crate) fn generate_keypair() -> boltz_client::Keypair { pub(crate) fn generate_keypair() -> boltz_client::Keypair {
let secp = boltz_client::Secp256k1::new(); let secp = boltz_client::Secp256k1::new();
let mut rng = bip39::rand::rngs::OsRng; let mut rng = lwk_wollet::secp256k1::rand::thread_rng();
let secret_key = lwk_wollet::secp256k1::SecretKey::new(&mut rng); let secret_key = lwk_wollet::secp256k1::SecretKey::new(&mut rng);
boltz_client::Keypair::from_secret_key(&secp, &secret_key) boltz_client::Keypair::from_secret_key(&secp, &secret_key)
} }

View File

@@ -1170,16 +1170,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
Config dco_decode_config(dynamic raw) { Config dco_decode_config(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs // Codec=Dco (DartCObject based), see doc to use other codecs
final arr = raw as List<dynamic>; final arr = raw as List<dynamic>;
if (arr.length != 8) throw Exception('unexpected arr length: expect 8 but see ${arr.length}'); if (arr.length != 7) throw Exception('unexpected arr length: expect 7 but see ${arr.length}');
return Config( return Config(
boltzUrl: dco_decode_String(arr[0]), liquidElectrumUrl: dco_decode_String(arr[0]),
liquidElectrumUrl: dco_decode_String(arr[1]), bitcoinElectrumUrl: dco_decode_String(arr[1]),
bitcoinElectrumUrl: dco_decode_String(arr[2]), workingDir: dco_decode_String(arr[2]),
workingDir: dco_decode_String(arr[3]), network: dco_decode_liquid_network(arr[3]),
network: dco_decode_liquid_network(arr[4]), paymentTimeoutSec: dco_decode_u_64(arr[4]),
paymentTimeoutSec: dco_decode_u_64(arr[5]), zeroConfMinFeeRate: dco_decode_f_32(arr[5]),
zeroConfMinFeeRate: dco_decode_f_32(arr[6]), zeroConfMaxAmountSat: dco_decode_opt_box_autoadd_u_64(arr[6]),
zeroConfMaxAmountSat: dco_decode_opt_box_autoadd_u_64(arr[7]),
); );
} }
@@ -2399,7 +2398,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
@protected @protected
Config sse_decode_config(SseDeserializer deserializer) { Config sse_decode_config(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs // Codec=Sse (Serialization based), see doc to use other codecs
var var_boltzUrl = sse_decode_String(deserializer);
var var_liquidElectrumUrl = sse_decode_String(deserializer); var var_liquidElectrumUrl = sse_decode_String(deserializer);
var var_bitcoinElectrumUrl = sse_decode_String(deserializer); var var_bitcoinElectrumUrl = sse_decode_String(deserializer);
var var_workingDir = sse_decode_String(deserializer); var var_workingDir = sse_decode_String(deserializer);
@@ -2408,7 +2406,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
var var_zeroConfMinFeeRate = sse_decode_f_32(deserializer); var var_zeroConfMinFeeRate = sse_decode_f_32(deserializer);
var var_zeroConfMaxAmountSat = sse_decode_opt_box_autoadd_u_64(deserializer); var var_zeroConfMaxAmountSat = sse_decode_opt_box_autoadd_u_64(deserializer);
return Config( return Config(
boltzUrl: var_boltzUrl,
liquidElectrumUrl: var_liquidElectrumUrl, liquidElectrumUrl: var_liquidElectrumUrl,
bitcoinElectrumUrl: var_bitcoinElectrumUrl, bitcoinElectrumUrl: var_bitcoinElectrumUrl,
workingDir: var_workingDir, workingDir: var_workingDir,
@@ -3679,7 +3676,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
@protected @protected
void sse_encode_config(Config self, SseSerializer serializer) { void sse_encode_config(Config self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs // Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_String(self.boltzUrl, serializer);
sse_encode_String(self.liquidElectrumUrl, serializer); sse_encode_String(self.liquidElectrumUrl, serializer);
sse_encode_String(self.bitcoinElectrumUrl, serializer); sse_encode_String(self.bitcoinElectrumUrl, serializer);
sse_encode_String(self.workingDir, serializer); sse_encode_String(self.workingDir, serializer);

View File

@@ -1363,7 +1363,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected @protected
void cst_api_fill_to_wire_config(Config apiObj, wire_cst_config wireObj) { void cst_api_fill_to_wire_config(Config apiObj, wire_cst_config wireObj) {
wireObj.boltz_url = cst_encode_String(apiObj.boltzUrl);
wireObj.liquid_electrum_url = cst_encode_String(apiObj.liquidElectrumUrl); wireObj.liquid_electrum_url = cst_encode_String(apiObj.liquidElectrumUrl);
wireObj.bitcoin_electrum_url = cst_encode_String(apiObj.bitcoinElectrumUrl); wireObj.bitcoin_electrum_url = cst_encode_String(apiObj.bitcoinElectrumUrl);
wireObj.working_dir = cst_encode_String(apiObj.workingDir); wireObj.working_dir = cst_encode_String(apiObj.workingDir);
@@ -3730,8 +3729,6 @@ final class wire_cst_liquid_sdk_event extends ffi.Struct {
} }
final class wire_cst_config extends ffi.Struct { final class wire_cst_config extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> boltz_url;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> liquid_electrum_url; external ffi.Pointer<wire_cst_list_prim_u_8_strict> liquid_electrum_url;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> bitcoin_electrum_url; external ffi.Pointer<wire_cst_list_prim_u_8_strict> bitcoin_electrum_url;

View File

@@ -31,7 +31,6 @@ class BackupRequest {
/// Configuration for the Liquid SDK /// Configuration for the Liquid SDK
class Config { class Config {
final String boltzUrl;
final String liquidElectrumUrl; final String liquidElectrumUrl;
final String bitcoinElectrumUrl; final String bitcoinElectrumUrl;
@@ -52,7 +51,6 @@ class Config {
final BigInt? zeroConfMaxAmountSat; final BigInt? zeroConfMaxAmountSat;
const Config({ const Config({
required this.boltzUrl,
required this.liquidElectrumUrl, required this.liquidElectrumUrl,
required this.bitcoinElectrumUrl, required this.bitcoinElectrumUrl,
required this.workingDir, required this.workingDir,
@@ -64,7 +62,6 @@ class Config {
@override @override
int get hashCode => int get hashCode =>
boltzUrl.hashCode ^
liquidElectrumUrl.hashCode ^ liquidElectrumUrl.hashCode ^
bitcoinElectrumUrl.hashCode ^ bitcoinElectrumUrl.hashCode ^
workingDir.hashCode ^ workingDir.hashCode ^
@@ -78,7 +75,6 @@ class Config {
identical(this, other) || identical(this, other) ||
other is Config && other is Config &&
runtimeType == other.runtimeType && runtimeType == other.runtimeType &&
boltzUrl == other.boltzUrl &&
liquidElectrumUrl == other.liquidElectrumUrl && liquidElectrumUrl == other.liquidElectrumUrl &&
bitcoinElectrumUrl == other.bitcoinElectrumUrl && bitcoinElectrumUrl == other.bitcoinElectrumUrl &&
workingDir == other.workingDir && workingDir == other.workingDir &&

View File

@@ -1318,8 +1318,6 @@ final class wire_cst_liquid_sdk_event extends ffi.Struct {
} }
final class wire_cst_config extends ffi.Struct { final class wire_cst_config extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> boltz_url;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> liquid_electrum_url; external ffi.Pointer<wire_cst_list_prim_u_8_strict> liquid_electrum_url;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> bitcoin_electrum_url; external ffi.Pointer<wire_cst_list_prim_u_8_strict> bitcoin_electrum_url;

View File

@@ -118,7 +118,6 @@ fun asConfig(config: ReadableMap): Config? {
if (!validateMandatoryFields( if (!validateMandatoryFields(
config, config,
arrayOf( arrayOf(
"boltzUrl",
"liquidElectrumUrl", "liquidElectrumUrl",
"bitcoinElectrumUrl", "bitcoinElectrumUrl",
"workingDir", "workingDir",
@@ -130,7 +129,6 @@ fun asConfig(config: ReadableMap): Config? {
) { ) {
return null return null
} }
val boltzUrl = config.getString("boltzUrl")!!
val liquidElectrumUrl = config.getString("liquidElectrumUrl")!! val liquidElectrumUrl = config.getString("liquidElectrumUrl")!!
val bitcoinElectrumUrl = config.getString("bitcoinElectrumUrl")!! val bitcoinElectrumUrl = config.getString("bitcoinElectrumUrl")!!
val workingDir = config.getString("workingDir")!! val workingDir = config.getString("workingDir")!!
@@ -148,7 +146,6 @@ fun asConfig(config: ReadableMap): Config? {
null null
} }
return Config( return Config(
boltzUrl,
liquidElectrumUrl, liquidElectrumUrl,
bitcoinElectrumUrl, bitcoinElectrumUrl,
workingDir, workingDir,
@@ -161,7 +158,6 @@ fun asConfig(config: ReadableMap): Config? {
fun readableMapOf(config: Config): ReadableMap = fun readableMapOf(config: Config): ReadableMap =
readableMapOf( readableMapOf(
"boltzUrl" to config.boltzUrl,
"liquidElectrumUrl" to config.liquidElectrumUrl, "liquidElectrumUrl" to config.liquidElectrumUrl,
"bitcoinElectrumUrl" to config.bitcoinElectrumUrl, "bitcoinElectrumUrl" to config.bitcoinElectrumUrl,
"workingDir" to config.workingDir, "workingDir" to config.workingDir,

View File

@@ -144,9 +144,6 @@ enum BreezLiquidSDKMapper {
} }
static func asConfig(config: [String: Any?]) throws -> Config { static func asConfig(config: [String: Any?]) throws -> Config {
guard let boltzUrl = config["boltzUrl"] as? String else {
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "boltzUrl", typeName: "Config"))
}
guard let liquidElectrumUrl = config["liquidElectrumUrl"] as? String else { guard let liquidElectrumUrl = config["liquidElectrumUrl"] as? String else {
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "liquidElectrumUrl", typeName: "Config")) throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "liquidElectrumUrl", typeName: "Config"))
} }
@@ -176,7 +173,6 @@ enum BreezLiquidSDKMapper {
} }
return Config( return Config(
boltzUrl: boltzUrl,
liquidElectrumUrl: liquidElectrumUrl, liquidElectrumUrl: liquidElectrumUrl,
bitcoinElectrumUrl: bitcoinElectrumUrl, bitcoinElectrumUrl: bitcoinElectrumUrl,
workingDir: workingDir, workingDir: workingDir,
@@ -189,7 +185,6 @@ enum BreezLiquidSDKMapper {
static func dictionaryOf(config: Config) -> [String: Any?] { static func dictionaryOf(config: Config) -> [String: Any?] {
return [ return [
"boltzUrl": config.boltzUrl,
"liquidElectrumUrl": config.liquidElectrumUrl, "liquidElectrumUrl": config.liquidElectrumUrl,
"bitcoinElectrumUrl": config.bitcoinElectrumUrl, "bitcoinElectrumUrl": config.bitcoinElectrumUrl,
"workingDir": config.workingDir, "workingDir": config.workingDir,

View File

@@ -37,7 +37,6 @@ export interface BitcoinAddressData {
} }
export interface Config { export interface Config {
boltzUrl: string
liquidElectrumUrl: string liquidElectrumUrl: string
bitcoinElectrumUrl: string bitcoinElectrumUrl: string
workingDir: string workingDir: string