mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-23 17:04:25 +01:00
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:
124
cli/Cargo.lock
generated
124
cli/Cargo.lock
generated
@@ -1440,7 +1440,7 @@ dependencies = [
|
||||
"rustls 0.22.4",
|
||||
"rustls-pki-types",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tokio-rustls 0.25.0",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
@@ -2340,7 +2340,7 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustls 0.22.4",
|
||||
"rustls-pemfile",
|
||||
"rustls-pemfile 2.1.2",
|
||||
"rustls-pki-types",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -2348,7 +2348,7 @@ dependencies = [
|
||||
"sync_wrapper",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tokio-rustls 0.25.0",
|
||||
"tower-service",
|
||||
"url",
|
||||
"wasm-bindgen",
|
||||
@@ -2358,6 +2358,21 @@ dependencies = [
|
||||
"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]]
|
||||
name = "ring"
|
||||
version = "0.17.8"
|
||||
@@ -2368,8 +2383,8 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"getrandom",
|
||||
"libc",
|
||||
"spin",
|
||||
"untrusted",
|
||||
"spin 0.9.8",
|
||||
"untrusted 0.9.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
@@ -2416,6 +2431,18 @@ dependencies = [
|
||||
"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]]
|
||||
name = "rustls"
|
||||
version = "0.21.12"
|
||||
@@ -2423,7 +2450,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
"ring 0.17.8",
|
||||
"rustls-webpki 0.101.7",
|
||||
"sct",
|
||||
]
|
||||
@@ -2435,13 +2462,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
"ring 0.17.8",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki 0.102.3",
|
||||
"subtle",
|
||||
"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]]
|
||||
name = "rustls-pemfile"
|
||||
version = "2.1.2"
|
||||
@@ -2464,8 +2512,8 @@ version = "0.101.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
"ring 0.17.8",
|
||||
"untrusted 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2474,9 +2522,9 @@ version = "0.102.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"ring 0.17.8",
|
||||
"rustls-pki-types",
|
||||
"untrusted",
|
||||
"untrusted 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2546,14 +2594,14 @@ version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
"ring 0.17.8",
|
||||
"untrusted 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sdk-common"
|
||||
version = "0.4.1"
|
||||
source = "git+https://github.com/breez/breez-sdk?branch=main#7c48c1e5a6f0450ae6f6150b8e40235ee31fd330"
|
||||
version = "0.4.2-rc3"
|
||||
source = "git+https://github.com/breez/breez-sdk?branch=main#3ddd68cdc524a4a640463f687f4e4d819069de01"
|
||||
dependencies = [
|
||||
"aes 0.8.4",
|
||||
"anyhow",
|
||||
@@ -2778,6 +2826,12 @@ dependencies = [
|
||||
"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]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
@@ -2971,6 +3025,17 @@ dependencies = [
|
||||
"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]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.25.0"
|
||||
@@ -3043,7 +3108,10 @@ dependencies = [
|
||||
"pin-project",
|
||||
"prost",
|
||||
"prost-derive",
|
||||
"rustls-native-certs",
|
||||
"rustls-pemfile 1.0.4",
|
||||
"tokio",
|
||||
"tokio-rustls 0.23.4",
|
||||
"tokio-stream",
|
||||
"tokio-util",
|
||||
"tower",
|
||||
@@ -3051,6 +3119,7 @@ dependencies = [
|
||||
"tower-service",
|
||||
"tracing",
|
||||
"tracing-futures",
|
||||
"webpki-roots 0.22.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3215,6 +3284,12 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.9.0"
|
||||
@@ -3382,6 +3457,25 @@ dependencies = [
|
||||
"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]]
|
||||
name = "webpki-roots"
|
||||
version = "0.25.4"
|
||||
|
||||
124
lib/Cargo.lock
generated
124
lib/Cargo.lock
generated
@@ -1639,7 +1639,7 @@ dependencies = [
|
||||
"rustls 0.22.4",
|
||||
"rustls-pki-types",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tokio-rustls 0.25.0",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
@@ -2674,7 +2674,7 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustls 0.22.4",
|
||||
"rustls-pemfile",
|
||||
"rustls-pemfile 2.1.2",
|
||||
"rustls-pki-types",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -2682,7 +2682,7 @@ dependencies = [
|
||||
"sync_wrapper",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tokio-rustls 0.25.0",
|
||||
"tower-service",
|
||||
"url",
|
||||
"wasm-bindgen",
|
||||
@@ -2692,6 +2692,21 @@ dependencies = [
|
||||
"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]]
|
||||
name = "ring"
|
||||
version = "0.17.8"
|
||||
@@ -2702,8 +2717,8 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"getrandom",
|
||||
"libc",
|
||||
"spin",
|
||||
"untrusted",
|
||||
"spin 0.9.8",
|
||||
"untrusted 0.9.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
@@ -2750,6 +2765,18 @@ dependencies = [
|
||||
"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]]
|
||||
name = "rustls"
|
||||
version = "0.21.12"
|
||||
@@ -2757,7 +2784,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
"ring 0.17.8",
|
||||
"rustls-webpki 0.101.7",
|
||||
"sct",
|
||||
]
|
||||
@@ -2769,13 +2796,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring",
|
||||
"ring 0.17.8",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki 0.102.3",
|
||||
"subtle",
|
||||
"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]]
|
||||
name = "rustls-pemfile"
|
||||
version = "2.1.2"
|
||||
@@ -2798,8 +2846,8 @@ version = "0.101.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
"ring 0.17.8",
|
||||
"untrusted 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2808,9 +2856,9 @@ version = "0.102.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"ring 0.17.8",
|
||||
"rustls-pki-types",
|
||||
"untrusted",
|
||||
"untrusted 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2886,14 +2934,14 @@ version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
"ring 0.17.8",
|
||||
"untrusted 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sdk-common"
|
||||
version = "0.4.1"
|
||||
source = "git+https://github.com/breez/breez-sdk?branch=main#7c48c1e5a6f0450ae6f6150b8e40235ee31fd330"
|
||||
version = "0.4.2-rc3"
|
||||
source = "git+https://github.com/breez/breez-sdk?branch=main#3ddd68cdc524a4a640463f687f4e4d819069de01"
|
||||
dependencies = [
|
||||
"aes 0.8.4",
|
||||
"anyhow",
|
||||
@@ -3148,6 +3196,12 @@ dependencies = [
|
||||
"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]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
@@ -3376,6 +3430,17 @@ dependencies = [
|
||||
"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]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.25.0"
|
||||
@@ -3457,7 +3522,10 @@ dependencies = [
|
||||
"pin-project",
|
||||
"prost",
|
||||
"prost-derive",
|
||||
"rustls-native-certs",
|
||||
"rustls-pemfile 1.0.4",
|
||||
"tokio",
|
||||
"tokio-rustls 0.23.4",
|
||||
"tokio-stream",
|
||||
"tokio-util",
|
||||
"tower",
|
||||
@@ -3465,6 +3533,7 @@ dependencies = [
|
||||
"tower-service",
|
||||
"tracing",
|
||||
"tracing-futures",
|
||||
"webpki-roots 0.22.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3978,6 +4047,12 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.9.0"
|
||||
@@ -4154,6 +4229,25 @@ dependencies = [
|
||||
"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]]
|
||||
name = "webpki-roots"
|
||||
version = "0.25.4"
|
||||
|
||||
@@ -195,7 +195,6 @@ typedef struct wire_cst_liquid_sdk_event {
|
||||
} wire_cst_liquid_sdk_event;
|
||||
|
||||
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 *bitcoin_electrum_url;
|
||||
struct wire_cst_list_prim_u_8_strict *working_dir;
|
||||
|
||||
@@ -244,7 +244,6 @@ enum PaymentError {
|
||||
};
|
||||
|
||||
dictionary Config {
|
||||
string boltz_url;
|
||||
string liquid_electrum_url;
|
||||
string bitcoin_electrum_url;
|
||||
string working_dir;
|
||||
|
||||
@@ -13,7 +13,7 @@ frb = ["dep:flutter_rust_bridge"]
|
||||
|
||||
[dependencies]
|
||||
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/dangeross/boltz-rust", branch = "savage-chain-swaps" }
|
||||
chrono = "0.4"
|
||||
|
||||
@@ -390,7 +390,6 @@ impl CstDecode<crate::model::Config> for wire_cst_config {
|
||||
// Codec=Cst (C-struct based), see doc to use other codecs
|
||||
fn cst_decode(self) -> crate::model::Config {
|
||||
crate::model::Config {
|
||||
boltz_url: self.boltz_url.cst_decode(),
|
||||
liquid_electrum_url: self.liquid_electrum_url.cst_decode(),
|
||||
bitcoin_electrum_url: self.bitcoin_electrum_url.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 {
|
||||
fn new_with_null_ptr() -> Self {
|
||||
Self {
|
||||
boltz_url: core::ptr::null_mut(),
|
||||
liquid_electrum_url: core::ptr::null_mut(),
|
||||
bitcoin_electrum_url: core::ptr::null_mut(),
|
||||
working_dir: core::ptr::null_mut(),
|
||||
@@ -2611,7 +2609,6 @@ pub struct wire_cst_bitcoin_address_data {
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
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,
|
||||
bitcoin_electrum_url: *mut wire_cst_list_prim_u_8_strict,
|
||||
working_dir: *mut wire_cst_list_prim_u_8_strict,
|
||||
|
||||
@@ -1583,7 +1583,6 @@ impl SseDecode for bool {
|
||||
impl SseDecode for crate::model::Config {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
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_bitcoinElectrumUrl = <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_zeroConfMaxAmountSat = <Option<u64>>::sse_decode(deserializer);
|
||||
return crate::model::Config {
|
||||
boltz_url: var_boltzUrl,
|
||||
liquid_electrum_url: var_liquidElectrumUrl,
|
||||
bitcoin_electrum_url: var_bitcoinElectrumUrl,
|
||||
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 {
|
||||
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.bitcoin_electrum_url.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 {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
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.bitcoin_electrum_url, serializer);
|
||||
<String>::sse_encode(self.working_dir, serializer);
|
||||
|
||||
@@ -2,7 +2,6 @@ use anyhow::{anyhow, Result};
|
||||
use boltz_client::network::Chain;
|
||||
use boltz_client::swaps::boltzv2::{
|
||||
CreateChainResponse, CreateReverseResponse, CreateSubmarineResponse, Leaf, Side, SwapTree,
|
||||
BOLTZ_MAINNET_URL_V2, BOLTZ_TESTNET_URL_V2,
|
||||
};
|
||||
use boltz_client::{BtcSwapScriptV2, BtcSwapTxV2, Keypair, LBtcSwapScriptV2, LBtcSwapTxV2};
|
||||
use lwk_wollet::ElementsNetwork;
|
||||
@@ -23,7 +22,6 @@ pub const LOWBALL_FEE_RATE_SAT_PER_VBYTE: f32 = 0.01;
|
||||
/// Configuration for the Liquid SDK
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub struct Config {
|
||||
pub boltz_url: String,
|
||||
pub liquid_electrum_url: String,
|
||||
pub bitcoin_electrum_url: String,
|
||||
/// Directory in which all SDK files (DB, log, cache) are stored.
|
||||
@@ -43,7 +41,6 @@ pub struct Config {
|
||||
impl Config {
|
||||
pub fn mainnet() -> Self {
|
||||
Config {
|
||||
boltz_url: BOLTZ_MAINNET_URL_V2.to_owned(),
|
||||
liquid_electrum_url: "blockstream.info:995".to_string(),
|
||||
bitcoin_electrum_url: "blockstream.info:700".to_string(),
|
||||
working_dir: ".".to_string(),
|
||||
@@ -56,7 +53,6 @@ impl Config {
|
||||
|
||||
pub fn testnet() -> Self {
|
||||
Config {
|
||||
boltz_url: BOLTZ_TESTNET_URL_V2.to_owned(),
|
||||
liquid_electrum_url: "blockstream.info:465".to_string(),
|
||||
bitcoin_electrum_url: "blockstream.info:993".to_string(),
|
||||
working_dir: ".".to_string(),
|
||||
|
||||
66
lib/core/src/persist/cache.rs
Normal file
66
lib/core/src/persist/cache.rs
Normal 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(())
|
||||
}
|
||||
}
|
||||
@@ -56,5 +56,9 @@ pub(crate) fn current_migrations() -> Vec<&'static str> {
|
||||
created_at INTEGER NOT NULL,
|
||||
state INTEGER NOT NULL
|
||||
) STRICT;",
|
||||
"CREATE TABLE IF NOT EXISTS cached_items (
|
||||
key TEXT NOT NULL PRIMARY KEY,
|
||||
value TEXT NOT NULL
|
||||
) STRICT;",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
mod backup;
|
||||
mod cache;
|
||||
pub(crate) mod chain;
|
||||
mod migrations;
|
||||
pub(crate) mod receive;
|
||||
|
||||
@@ -58,14 +58,27 @@ pub struct LiquidSdk {
|
||||
|
||||
impl LiquidSdk {
|
||||
pub async fn connect(req: ConnectRequest) -> Result<Arc<LiquidSdk>> {
|
||||
let config = req.config;
|
||||
let sdk = LiquidSdk::new(config, req.mnemonic)?;
|
||||
let maybe_swapper_proxy_url =
|
||||
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?;
|
||||
|
||||
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)?;
|
||||
|
||||
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 (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 liquid_chain_service =
|
||||
|
||||
@@ -12,7 +12,8 @@ use boltz_client::network::Chain;
|
||||
use boltz_client::swaps::boltzv2::{
|
||||
self, BoltzApiClientV2, ChainPair, Cooperative, CreateChainRequest, CreateChainResponse,
|
||||
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::{Amount, Bolt11Invoice, BtcSwapTxV2, Keypair, LBtcSwapTxV2, LockTime};
|
||||
@@ -21,6 +22,7 @@ use log::{debug, info};
|
||||
use lwk_wollet::elements;
|
||||
use serde_json::Value;
|
||||
use tokio::sync::{broadcast, watch};
|
||||
use url::Url;
|
||||
|
||||
use crate::error::{LiquidSdkError, PaymentError};
|
||||
use crate::model::{
|
||||
@@ -152,15 +154,46 @@ pub trait Swapper: Send + Sync {
|
||||
|
||||
pub struct BoltzSwapper {
|
||||
client: BoltzApiClientV2,
|
||||
boltz_url: String,
|
||||
referral_id: Option<String>,
|
||||
config: Config,
|
||||
liquid_electrum_config: ElectrumConfig,
|
||||
bitcoin_electrum_config: ElectrumConfig,
|
||||
}
|
||||
|
||||
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 {
|
||||
client: BoltzApiClientV2::new(&config.boltz_url),
|
||||
client: BoltzApiClientV2::new(&boltz_url),
|
||||
boltz_url,
|
||||
referral_id,
|
||||
config: config.clone(),
|
||||
liquid_electrum_config: ElectrumConfig::new(
|
||||
config.network.into(),
|
||||
@@ -195,7 +228,7 @@ impl BoltzSwapper {
|
||||
swap_script.clone(),
|
||||
refund_address,
|
||||
&self.liquid_electrum_config,
|
||||
self.config.boltz_url.clone(),
|
||||
self.boltz_url.clone(),
|
||||
swap_id,
|
||||
)?),
|
||||
};
|
||||
@@ -291,7 +324,7 @@ impl BoltzSwapper {
|
||||
swap_script,
|
||||
swap.claim_address.clone(),
|
||||
&self.liquid_electrum_config,
|
||||
self.config.boltz_url.clone(),
|
||||
self.boltz_url.clone(),
|
||||
swap.id.clone(),
|
||||
)?;
|
||||
|
||||
@@ -449,7 +482,11 @@ impl Swapper for BoltzSwapper {
|
||||
&self,
|
||||
req: CreateChainRequest,
|
||||
) -> 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
|
||||
@@ -457,7 +494,11 @@ impl Swapper for BoltzSwapper {
|
||||
&self,
|
||||
req: CreateSubmarineRequest,
|
||||
) -> 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
|
||||
@@ -649,7 +690,11 @@ impl Swapper for BoltzSwapper {
|
||||
&self,
|
||||
req: CreateReverseRequest,
|
||||
) -> 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
|
||||
@@ -669,7 +714,7 @@ impl Swapper for BoltzSwapper {
|
||||
swap_script,
|
||||
claim_address,
|
||||
&self.liquid_electrum_config,
|
||||
self.config.boltz_url.clone(),
|
||||
self.boltz_url.clone(),
|
||||
swap.id.clone(),
|
||||
)?;
|
||||
|
||||
@@ -701,7 +746,7 @@ impl Swapper for BoltzSwapper {
|
||||
}
|
||||
|
||||
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> {
|
||||
|
||||
@@ -17,7 +17,7 @@ use crate::{
|
||||
};
|
||||
|
||||
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 tempdir::TempDir;
|
||||
use tokio::sync::Mutex;
|
||||
@@ -30,7 +30,7 @@ pub(crate) fn new_send_swap_state_handler(
|
||||
) -> Result<SendSwapStateHandler> {
|
||||
let config = Config::testnet();
|
||||
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())?));
|
||||
|
||||
Ok(SendSwapStateHandler::new(
|
||||
@@ -47,7 +47,7 @@ pub(crate) fn new_receive_swap_state_handler(
|
||||
) -> Result<ReceiveSwapStateHandler> {
|
||||
let config = Config::testnet();
|
||||
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())?));
|
||||
|
||||
Ok(ReceiveSwapStateHandler::new(
|
||||
@@ -64,7 +64,7 @@ pub(crate) fn new_chain_swap_state_handler(
|
||||
) -> Result<ChainSwapStateHandler> {
|
||||
let config = Config::testnet();
|
||||
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 bitcoin_chain_service = Arc::new(Mutex::new(bitcoin::ElectrumClient::new(
|
||||
&ElectrumUrl::new(&config.bitcoin_electrum_url, true, true),
|
||||
|
||||
@@ -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 {
|
||||
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);
|
||||
boltz_client::Keypair::from_secret_key(&secp, &secret_key)
|
||||
}
|
||||
|
||||
@@ -1170,16 +1170,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
Config dco_decode_config(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
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(
|
||||
boltzUrl: dco_decode_String(arr[0]),
|
||||
liquidElectrumUrl: dco_decode_String(arr[1]),
|
||||
bitcoinElectrumUrl: dco_decode_String(arr[2]),
|
||||
workingDir: dco_decode_String(arr[3]),
|
||||
network: dco_decode_liquid_network(arr[4]),
|
||||
paymentTimeoutSec: dco_decode_u_64(arr[5]),
|
||||
zeroConfMinFeeRate: dco_decode_f_32(arr[6]),
|
||||
zeroConfMaxAmountSat: dco_decode_opt_box_autoadd_u_64(arr[7]),
|
||||
liquidElectrumUrl: dco_decode_String(arr[0]),
|
||||
bitcoinElectrumUrl: dco_decode_String(arr[1]),
|
||||
workingDir: dco_decode_String(arr[2]),
|
||||
network: dco_decode_liquid_network(arr[3]),
|
||||
paymentTimeoutSec: dco_decode_u_64(arr[4]),
|
||||
zeroConfMinFeeRate: dco_decode_f_32(arr[5]),
|
||||
zeroConfMaxAmountSat: dco_decode_opt_box_autoadd_u_64(arr[6]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2399,7 +2398,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
@protected
|
||||
Config sse_decode_config(SseDeserializer deserializer) {
|
||||
// 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_bitcoinElectrumUrl = 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_zeroConfMaxAmountSat = sse_decode_opt_box_autoadd_u_64(deserializer);
|
||||
return Config(
|
||||
boltzUrl: var_boltzUrl,
|
||||
liquidElectrumUrl: var_liquidElectrumUrl,
|
||||
bitcoinElectrumUrl: var_bitcoinElectrumUrl,
|
||||
workingDir: var_workingDir,
|
||||
@@ -3679,7 +3676,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
@protected
|
||||
void sse_encode_config(Config self, SseSerializer serializer) {
|
||||
// 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.bitcoinElectrumUrl, serializer);
|
||||
sse_encode_String(self.workingDir, serializer);
|
||||
|
||||
@@ -1363,7 +1363,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
|
||||
@protected
|
||||
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.bitcoin_electrum_url = cst_encode_String(apiObj.bitcoinElectrumUrl);
|
||||
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 {
|
||||
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> bitcoin_electrum_url;
|
||||
|
||||
@@ -31,7 +31,6 @@ class BackupRequest {
|
||||
|
||||
/// Configuration for the Liquid SDK
|
||||
class Config {
|
||||
final String boltzUrl;
|
||||
final String liquidElectrumUrl;
|
||||
final String bitcoinElectrumUrl;
|
||||
|
||||
@@ -52,7 +51,6 @@ class Config {
|
||||
final BigInt? zeroConfMaxAmountSat;
|
||||
|
||||
const Config({
|
||||
required this.boltzUrl,
|
||||
required this.liquidElectrumUrl,
|
||||
required this.bitcoinElectrumUrl,
|
||||
required this.workingDir,
|
||||
@@ -64,7 +62,6 @@ class Config {
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
boltzUrl.hashCode ^
|
||||
liquidElectrumUrl.hashCode ^
|
||||
bitcoinElectrumUrl.hashCode ^
|
||||
workingDir.hashCode ^
|
||||
@@ -78,7 +75,6 @@ class Config {
|
||||
identical(this, other) ||
|
||||
other is Config &&
|
||||
runtimeType == other.runtimeType &&
|
||||
boltzUrl == other.boltzUrl &&
|
||||
liquidElectrumUrl == other.liquidElectrumUrl &&
|
||||
bitcoinElectrumUrl == other.bitcoinElectrumUrl &&
|
||||
workingDir == other.workingDir &&
|
||||
|
||||
@@ -1318,8 +1318,6 @@ final class wire_cst_liquid_sdk_event 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> bitcoin_electrum_url;
|
||||
|
||||
@@ -118,7 +118,6 @@ fun asConfig(config: ReadableMap): Config? {
|
||||
if (!validateMandatoryFields(
|
||||
config,
|
||||
arrayOf(
|
||||
"boltzUrl",
|
||||
"liquidElectrumUrl",
|
||||
"bitcoinElectrumUrl",
|
||||
"workingDir",
|
||||
@@ -130,7 +129,6 @@ fun asConfig(config: ReadableMap): Config? {
|
||||
) {
|
||||
return null
|
||||
}
|
||||
val boltzUrl = config.getString("boltzUrl")!!
|
||||
val liquidElectrumUrl = config.getString("liquidElectrumUrl")!!
|
||||
val bitcoinElectrumUrl = config.getString("bitcoinElectrumUrl")!!
|
||||
val workingDir = config.getString("workingDir")!!
|
||||
@@ -148,7 +146,6 @@ fun asConfig(config: ReadableMap): Config? {
|
||||
null
|
||||
}
|
||||
return Config(
|
||||
boltzUrl,
|
||||
liquidElectrumUrl,
|
||||
bitcoinElectrumUrl,
|
||||
workingDir,
|
||||
@@ -161,7 +158,6 @@ fun asConfig(config: ReadableMap): Config? {
|
||||
|
||||
fun readableMapOf(config: Config): ReadableMap =
|
||||
readableMapOf(
|
||||
"boltzUrl" to config.boltzUrl,
|
||||
"liquidElectrumUrl" to config.liquidElectrumUrl,
|
||||
"bitcoinElectrumUrl" to config.bitcoinElectrumUrl,
|
||||
"workingDir" to config.workingDir,
|
||||
|
||||
@@ -144,9 +144,6 @@ enum BreezLiquidSDKMapper {
|
||||
}
|
||||
|
||||
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 {
|
||||
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "liquidElectrumUrl", typeName: "Config"))
|
||||
}
|
||||
@@ -176,7 +173,6 @@ enum BreezLiquidSDKMapper {
|
||||
}
|
||||
|
||||
return Config(
|
||||
boltzUrl: boltzUrl,
|
||||
liquidElectrumUrl: liquidElectrumUrl,
|
||||
bitcoinElectrumUrl: bitcoinElectrumUrl,
|
||||
workingDir: workingDir,
|
||||
@@ -189,7 +185,6 @@ enum BreezLiquidSDKMapper {
|
||||
|
||||
static func dictionaryOf(config: Config) -> [String: Any?] {
|
||||
return [
|
||||
"boltzUrl": config.boltzUrl,
|
||||
"liquidElectrumUrl": config.liquidElectrumUrl,
|
||||
"bitcoinElectrumUrl": config.bitcoinElectrumUrl,
|
||||
"workingDir": config.workingDir,
|
||||
|
||||
@@ -37,7 +37,6 @@ export interface BitcoinAddressData {
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
boltzUrl: string
|
||||
liquidElectrumUrl: string
|
||||
bitcoinElectrumUrl: string
|
||||
workingDir: string
|
||||
|
||||
Reference in New Issue
Block a user