Merge pull request #136 from breez/yse-remove-api-fields

Improve submarine swap flow
This commit is contained in:
ok300
2024-05-15 08:15:13 +00:00
committed by GitHub
34 changed files with 3955 additions and 1446 deletions

192
cli/Cargo.lock generated
View File

@@ -127,47 +127,48 @@ dependencies = [
[[package]]
name = "anstream"
version = "0.6.13"
version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb"
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.6"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
[[package]]
name = "anstyle-parse"
version = "0.2.3"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c"
checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648"
checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5"
dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.2"
version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
dependencies = [
"anstyle",
"windows-sys 0.52.0",
@@ -175,9 +176,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.82"
version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3"
[[package]]
name = "atomic"
@@ -198,9 +199,9 @@ dependencies = [
[[package]]
name = "autocfg"
version = "1.2.0"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]]
name = "backtrace"
@@ -231,9 +232,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
[[package]]
name = "base64"
version = "0.22.0"
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "bech32"
@@ -262,13 +263,15 @@ dependencies = [
[[package]]
name = "bitcoin"
version = "0.29.2"
version = "0.30.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0694ea59225b0c5f3cb405ff3f670e4828358ed26aec49dc352f730f0cb1a8a3"
checksum = "1945a5048598e4189e239d3f809b19bdad4845c4b2ba400d304d2dcf26d2c462"
dependencies = [
"bech32 0.9.1",
"bitcoin_hashes 0.11.0",
"secp256k1 0.24.3",
"bitcoin-private",
"bitcoin_hashes 0.12.0",
"hex_lit",
"secp256k1 0.27.0",
]
[[package]]
@@ -308,6 +311,15 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4"
[[package]]
name = "bitcoin_hashes"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d7066118b13d4b20b23645932dfb3a81ce7e29f95726c2036fa33cd7b092501"
dependencies = [
"bitcoin-private",
]
[[package]]
name = "bitcoin_hashes"
version = "0.13.0"
@@ -343,7 +355,7 @@ dependencies = [
[[package]]
name = "boltz-client"
version = "0.1.3"
source = "git+https://github.com/SatoshiPortal/boltz-rust?rev=6f45fff8b87c7530c847eb05f018906c48785a6c#6f45fff8b87c7530c847eb05f018906c48785a6c"
source = "git+https://github.com/hydra-yse/boltz-rust?rev=be8395900495e415699a54e15f4bd0bc6d774237#be8395900495e415699a54e15f4bd0bc6d774237"
dependencies = [
"bip39",
"bitcoin 0.31.2",
@@ -383,6 +395,7 @@ dependencies = [
"anyhow",
"bip39",
"boltz-client",
"elements",
"flutter_rust_bridge",
"log",
"lwk_common",
@@ -392,7 +405,9 @@ dependencies = [
"rusqlite",
"rusqlite_migration",
"serde",
"serde_json",
"thiserror",
"tungstenite",
]
[[package]]
@@ -427,9 +442,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
[[package]]
name = "cc"
version = "1.0.95"
version = "1.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b"
checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
[[package]]
name = "cfg-if"
@@ -511,9 +526,9 @@ dependencies = [
[[package]]
name = "colorchoice"
version = "1.0.0"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
[[package]]
name = "console_error_panic_hook"
@@ -599,9 +614,9 @@ dependencies = [
[[package]]
name = "data-encoding"
version = "2.5.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2"
[[package]]
name = "delegate-attr"
@@ -762,9 +777,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
[[package]]
name = "fastrand"
version = "2.0.2"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984"
checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
[[package]]
name = "fd-lock"
@@ -779,9 +794,9 @@ dependencies = [
[[package]]
name = "flate2"
version = "1.0.29"
version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4556222738635b7a3417ae6130d8f52201e45a0c4d1a907f0826383adb5f85e7"
checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae"
dependencies = [
"crc32fast",
"miniz_oxide",
@@ -957,9 +972,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.2.14"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
"cfg-if",
"js-sys",
@@ -1001,9 +1016,9 @@ checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403"
[[package]]
name = "hashbrown"
version = "0.14.3"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
"ahash",
"allocator-api2",
@@ -1231,6 +1246,12 @@ version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
[[package]]
name = "is_terminal_polyfill"
version = "1.70.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
[[package]]
name = "itoa"
version = "1.0.11"
@@ -1254,9 +1275,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.153"
version = "0.2.154"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
[[package]]
name = "libsqlite3-sys"
@@ -1271,25 +1292,25 @@ dependencies = [
[[package]]
name = "lightning"
version = "0.0.118"
version = "0.0.122"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52cec5fa9382154fe9671e8df93095b800c7d77abc66e2a5ef839d672521c5e"
checksum = "0d9b36ae12b379905bfc429ce5d4e8ca4a55c8dd3de73074309bd0bcc053bcac"
dependencies = [
"bitcoin 0.29.2",
"bitcoin 0.30.2",
"hex-conservative",
]
[[package]]
name = "lightning-invoice"
version = "0.26.0"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eb24878b0f4ef75f020976c886d9ad1503867802329cc963e0ab4623ea3b25c"
checksum = "106fdb897e69df697480f45bf0a564b425af488fb0f7407e770a770c39b19a21"
dependencies = [
"bech32 0.9.1",
"bitcoin 0.29.2",
"bitcoin_hashes 0.11.0",
"bitcoin 0.30.2",
"lightning",
"num-traits",
"secp256k1 0.24.3",
"secp256k1 0.27.0",
]
[[package]]
@@ -1485,9 +1506,9 @@ dependencies = [
[[package]]
name = "num-traits"
version = "0.2.18"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
@@ -1657,9 +1678,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro2"
version = "1.0.81"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba"
checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b"
dependencies = [
"unicode-ident",
]
@@ -1850,9 +1871,9 @@ dependencies = [
[[package]]
name = "rustc-demangle"
version = "0.1.23"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustix"
@@ -1904,9 +1925,9 @@ dependencies = [
[[package]]
name = "rustls-pki-types"
version = "1.5.0"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54"
checksum = "51f344d206c5e1b010eec27349b815a4805f70a778895959d70b74b9b529b30a"
[[package]]
name = "rustls-webpki"
@@ -1965,9 +1986,9 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.17"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]]
name = "schannel"
@@ -1996,12 +2017,12 @@ dependencies = [
[[package]]
name = "secp256k1"
version = "0.24.3"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62"
checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f"
dependencies = [
"bitcoin_hashes 0.11.0",
"secp256k1-sys 0.6.1",
"bitcoin_hashes 0.12.0",
"secp256k1-sys 0.8.1",
]
[[package]]
@@ -2018,9 +2039,9 @@ dependencies = [
[[package]]
name = "secp256k1-sys"
version = "0.6.1"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b"
checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e"
dependencies = [
"cc",
]
@@ -2057,11 +2078,11 @@ dependencies = [
[[package]]
name = "security-framework"
version = "2.10.0"
version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6"
checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0"
dependencies = [
"bitflags 1.3.2",
"bitflags 2.5.0",
"core-foundation",
"core-foundation-sys",
"libc",
@@ -2070,9 +2091,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
version = "2.10.0"
version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef"
checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7"
dependencies = [
"core-foundation-sys",
"libc",
@@ -2080,9 +2101,9 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.199"
version = "1.0.200"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a"
checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f"
dependencies = [
"serde_derive",
]
@@ -2108,9 +2129,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.199"
version = "1.0.200"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc"
checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb"
dependencies = [
"proc-macro2",
"quote",
@@ -2168,9 +2189,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "socket2"
version = "0.5.6"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871"
checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
dependencies = [
"libc",
"windows-sys 0.52.0",
@@ -2196,9 +2217,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]]
name = "syn"
version = "2.0.60"
version = "2.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3"
checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9"
dependencies = [
"proc-macro2",
"quote",
@@ -2255,18 +2276,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.59"
version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa"
checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.59"
version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66"
checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524"
dependencies = [
"proc-macro2",
"quote",
@@ -2325,16 +2346,15 @@ dependencies = [
[[package]]
name = "tokio-util"
version = "0.7.10"
version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15"
checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"pin-project-lite",
"tokio",
"tracing",
]
[[package]]
@@ -2461,7 +2481,7 @@ version = "2.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd"
dependencies = [
"base64 0.22.0",
"base64 0.22.1",
"flate2",
"log",
"native-tls",
@@ -2822,18 +2842,18 @@ dependencies = [
[[package]]
name = "zerocopy"
version = "0.7.32"
version = "0.7.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.32"
version = "0.7.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
dependencies = [
"proc-macro2",
"quote",

View File

@@ -117,12 +117,12 @@ pub(crate) fn handle_command(
}
Command::SendPayment { bolt11, delay } => {
let prepare_response =
sdk.prepare_send_payment(PrepareSendRequest { invoice: bolt11 })?;
sdk.prepare_send_payment(&PrepareSendRequest { invoice: bolt11 })?;
wait_confirmation!(
format!(
"Fees: {} sat. Are the fees acceptable? (y/N) ",
prepare_response.total_fees
prepare_response.fees_sat
),
"Payment send halted"
);

216
lib/Cargo.lock generated
View File

@@ -127,47 +127,48 @@ dependencies = [
[[package]]
name = "anstream"
version = "0.6.13"
version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb"
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.6"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
[[package]]
name = "anstyle-parse"
version = "0.2.3"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c"
checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648"
checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5"
dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.2"
version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
dependencies = [
"anstyle",
"windows-sys 0.52.0",
@@ -175,9 +176,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.82"
version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3"
dependencies = [
"backtrace",
]
@@ -227,7 +228,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -281,9 +282,9 @@ dependencies = [
[[package]]
name = "autocfg"
version = "1.2.0"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]]
name = "backtrace"
@@ -314,9 +315,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
[[package]]
name = "base64"
version = "0.22.0"
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "basic-toml"
@@ -385,13 +386,15 @@ dependencies = [
[[package]]
name = "bitcoin"
version = "0.29.2"
version = "0.30.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0694ea59225b0c5f3cb405ff3f670e4828358ed26aec49dc352f730f0cb1a8a3"
checksum = "1945a5048598e4189e239d3f809b19bdad4845c4b2ba400d304d2dcf26d2c462"
dependencies = [
"bech32 0.9.1",
"bitcoin_hashes 0.11.0",
"secp256k1 0.24.3",
"bitcoin-private",
"bitcoin_hashes 0.12.0",
"hex_lit",
"secp256k1 0.27.0",
]
[[package]]
@@ -431,6 +434,15 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4"
[[package]]
name = "bitcoin_hashes"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d7066118b13d4b20b23645932dfb3a81ce7e29f95726c2036fa33cd7b092501"
dependencies = [
"bitcoin-private",
]
[[package]]
name = "bitcoin_hashes"
version = "0.13.0"
@@ -466,7 +478,7 @@ dependencies = [
[[package]]
name = "boltz-client"
version = "0.1.3"
source = "git+https://github.com/SatoshiPortal/boltz-rust?rev=6f45fff8b87c7530c847eb05f018906c48785a6c#6f45fff8b87c7530c847eb05f018906c48785a6c"
source = "git+https://github.com/hydra-yse/boltz-rust?rev=be8395900495e415699a54e15f4bd0bc6d774237#be8395900495e415699a54e15f4bd0bc6d774237"
dependencies = [
"bip39",
"bitcoin 0.31.2",
@@ -490,6 +502,7 @@ dependencies = [
"anyhow",
"bip39",
"boltz-client",
"elements",
"flutter_rust_bridge",
"log",
"lwk_common",
@@ -499,8 +512,10 @@ dependencies = [
"rusqlite",
"rusqlite_migration",
"serde",
"serde_json",
"tempdir",
"thiserror",
"tungstenite",
"uuid",
]
@@ -581,9 +596,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.0.95"
version = "1.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b"
checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
[[package]]
name = "cfg-if"
@@ -675,7 +690,7 @@ dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -695,9 +710,9 @@ checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
[[package]]
name = "colorchoice"
version = "1.0.0"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
[[package]]
name = "console_error_panic_hook"
@@ -795,7 +810,7 @@ checksum = "51aac4c99b2e6775164b412ea33ae8441b2fde2dbf05a20bc0052a63d08c475b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -961,7 +976,7 @@ checksum = "d852460bc16316c4491a60e1652612f717764d436f3a97f8f1cc7c3b54d9a0dc"
dependencies = [
"hex",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -1065,7 +1080,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -1110,9 +1125,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.2.14"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
"cfg-if",
"js-sys",
@@ -1438,6 +1453,12 @@ version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
[[package]]
name = "is_terminal_polyfill"
version = "1.70.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
[[package]]
name = "itoa"
version = "1.0.11"
@@ -1461,9 +1482,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.153"
version = "0.2.154"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
[[package]]
name = "libsqlite3-sys"
@@ -1478,25 +1499,25 @@ dependencies = [
[[package]]
name = "lightning"
version = "0.0.118"
version = "0.0.122"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52cec5fa9382154fe9671e8df93095b800c7d77abc66e2a5ef839d672521c5e"
checksum = "0d9b36ae12b379905bfc429ce5d4e8ca4a55c8dd3de73074309bd0bcc053bcac"
dependencies = [
"bitcoin 0.29.2",
"bitcoin 0.30.2",
"hex-conservative",
]
[[package]]
name = "lightning-invoice"
version = "0.26.0"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eb24878b0f4ef75f020976c886d9ad1503867802329cc963e0ab4623ea3b25c"
checksum = "106fdb897e69df697480f45bf0a564b425af488fb0f7407e770a770c39b19a21"
dependencies = [
"bech32 0.9.1",
"bitcoin 0.29.2",
"bitcoin_hashes 0.11.0",
"bitcoin 0.30.2",
"lightning",
"num-traits",
"secp256k1 0.24.3",
"secp256k1 0.27.0",
]
[[package]]
@@ -1698,9 +1719,9 @@ dependencies = [
[[package]]
name = "num-traits"
version = "0.2.18"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
@@ -1765,7 +1786,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -1863,9 +1884,9 @@ dependencies = [
[[package]]
name = "paste"
version = "1.0.14"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "percent-encoding"
@@ -1941,9 +1962,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.81"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba"
checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b"
dependencies = [
"unicode-ident",
]
@@ -2173,9 +2194,9 @@ dependencies = [
[[package]]
name = "rustc-demangle"
version = "0.1.23"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustix"
@@ -2227,9 +2248,9 @@ dependencies = [
[[package]]
name = "rustls-pki-types"
version = "1.5.0"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54"
checksum = "51f344d206c5e1b010eec27349b815a4805f70a778895959d70b74b9b529b30a"
[[package]]
name = "rustls-webpki"
@@ -2254,9 +2275,9 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.17"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]]
name = "schannel"
@@ -2299,7 +2320,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -2310,7 +2331,7 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -2325,12 +2346,12 @@ dependencies = [
[[package]]
name = "secp256k1"
version = "0.24.3"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62"
checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f"
dependencies = [
"bitcoin_hashes 0.11.0",
"secp256k1-sys 0.6.1",
"bitcoin_hashes 0.12.0",
"secp256k1-sys 0.8.1",
]
[[package]]
@@ -2347,9 +2368,9 @@ dependencies = [
[[package]]
name = "secp256k1-sys"
version = "0.6.1"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b"
checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e"
dependencies = [
"cc",
]
@@ -2386,11 +2407,11 @@ dependencies = [
[[package]]
name = "security-framework"
version = "2.10.0"
version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6"
checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0"
dependencies = [
"bitflags 1.3.2",
"bitflags 2.5.0",
"core-foundation",
"core-foundation-sys",
"libc",
@@ -2399,9 +2420,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
version = "2.10.0"
version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef"
checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7"
dependencies = [
"core-foundation-sys",
"libc",
@@ -2409,18 +2430,18 @@ dependencies = [
[[package]]
name = "semver"
version = "1.0.22"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
dependencies = [
"serde",
]
[[package]]
name = "serde"
version = "1.0.199"
version = "1.0.200"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a"
checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f"
dependencies = [
"serde_derive",
]
@@ -2446,13 +2467,13 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.199"
version = "1.0.200"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc"
checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -2578,9 +2599,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.60"
version = "2.0.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3"
checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9"
dependencies = [
"proc-macro2",
"quote",
@@ -2658,22 +2679,22 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.59"
version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa"
checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.59"
version = "1.0.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66"
checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -2727,7 +2748,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -2742,16 +2763,15 @@ dependencies = [
[[package]]
name = "tokio-util"
version = "0.7.10"
version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15"
checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"pin-project-lite",
"tokio",
"tracing",
]
[[package]]
@@ -2788,7 +2808,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -3031,7 +3051,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55137c122f712d9330fd985d66fa61bdc381752e89c35708c13ce63049a3002c"
dependencies = [
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -3041,7 +3061,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae7e5a6c33b1dec3f255f57ec0b6af0f0b2bb3021868be1d5eec7a38e2905ebc"
dependencies = [
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]
@@ -3108,7 +3128,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 2.0.60",
"syn 2.0.61",
"toml",
"uniffi_meta 0.27.1",
]
@@ -3236,7 +3256,7 @@ version = "2.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd"
dependencies = [
"base64 0.22.0",
"base64 0.22.1",
"flate2",
"log",
"native-tls",
@@ -3330,7 +3350,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
"wasm-bindgen-shared",
]
@@ -3364,7 +3384,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -3624,22 +3644,22 @@ dependencies = [
[[package]]
name = "zerocopy"
version = "0.7.32"
version = "0.7.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.32"
version = "0.7.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.60",
"syn 2.0.61",
]
[[package]]

File diff suppressed because it is too large Load Diff

View File

@@ -15,10 +15,10 @@ void store_dart_post_cobject(DartPostCObjectFnType ptr);
typedef struct _Dart_Handle* Dart_Handle;
/**
* Claim tx feerate for Receive, in sats per vbyte.
* Claim tx feerate, in sats per vbyte.
* Since the Liquid blocks are consistently empty for now, we hardcode the minimum feerate.
*/
#define LIQUID_CLAIM_TX_FEERATE 0.1
#define LIQUID_CLAIM_TX_FEERATE_MSAT 100.0
typedef struct wire_cst_list_prim_u_8_strict {
uint8_t *ptr;
@@ -44,7 +44,6 @@ typedef struct wire_cst_prepare_send_request {
} wire_cst_prepare_send_request;
typedef struct wire_cst_prepare_receive_response {
struct wire_cst_list_prim_u_8_strict *pair_hash;
uint64_t payer_amount_sat;
uint64_t fees_sat;
} wire_cst_prepare_receive_response;
@@ -54,12 +53,8 @@ typedef struct wire_cst_restore_request {
} wire_cst_restore_request;
typedef struct wire_cst_prepare_send_response {
struct wire_cst_list_prim_u_8_strict *id;
uint64_t payer_amount_sat;
uint64_t receiver_amount_sat;
uint64_t total_fees;
struct wire_cst_list_prim_u_8_strict *funding_address;
struct wire_cst_list_prim_u_8_strict *invoice;
uint64_t fees_sat;
} wire_cst_prepare_send_response;
typedef struct wire_cst_payment {
@@ -89,6 +84,11 @@ typedef struct wire_cst_PaymentError_LwkError {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_LwkError;
typedef struct wire_cst_PaymentError_Refunded {
struct wire_cst_list_prim_u_8_strict *err;
struct wire_cst_list_prim_u_8_strict *txid;
} wire_cst_PaymentError_Refunded;
typedef struct wire_cst_PaymentError_SendError {
struct wire_cst_list_prim_u_8_strict *err;
} wire_cst_PaymentError_SendError;
@@ -100,6 +100,7 @@ typedef struct wire_cst_PaymentError_SignerError {
typedef union PaymentErrorKind {
struct wire_cst_PaymentError_Generic Generic;
struct wire_cst_PaymentError_LwkError LwkError;
struct wire_cst_PaymentError_Refunded Refunded;
struct wire_cst_PaymentError_SendError SendError;
struct wire_cst_PaymentError_SignerError SignerError;
} PaymentErrorKind;
@@ -137,17 +138,11 @@ void frbgen_breez_liquid_wire_prepare_send_payment(int64_t port_,
void frbgen_breez_liquid_wire_receive_payment(int64_t port_,
struct wire_cst_prepare_receive_response *req);
void frbgen_breez_liquid_wire_recover_funds(int64_t port_, uintptr_t recovery);
void frbgen_breez_liquid_wire_restore(int64_t port_, struct wire_cst_restore_request *req);
void frbgen_breez_liquid_wire_send_payment(int64_t port_,
struct wire_cst_prepare_send_response *req);
void frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(const void *ptr);
void frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(const void *ptr);
struct wire_cst_connect_request *frbgen_breez_liquid_cst_new_box_autoadd_connect_request(void);
struct wire_cst_get_info_request *frbgen_breez_liquid_cst_new_box_autoadd_get_info_request(void);
@@ -182,8 +177,6 @@ static int64_t dummy_method_to_enforce_bundling(void) {
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_u_64);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_prim_u_8_strict);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_backup);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_connect);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_empty_wallet_cache);
@@ -192,7 +185,6 @@ static int64_t dummy_method_to_enforce_bundling(void) {
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_prepare_receive_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_prepare_send_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_receive_payment);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_recover_funds);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_restore);
dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire_send_payment);
dummy_var ^= ((int64_t) (void*) store_dart_post_cobject);

View File

@@ -5,14 +5,17 @@ enum LiquidSdkError {
[Error]
enum PaymentError {
"AmountOutOfRange",
"AlreadyClaimed",
"AmountOutOfRange",
"Generic",
"InvalidOrExpiredFees",
"InsufficientFunds",
"InvalidInvoice",
"InvalidPreimage",
"LwkError",
"PairsNotFound",
"PersistError",
"Refunded",
"SendError",
"SignerError",
};
@@ -42,12 +45,8 @@ dictionary PrepareSendRequest {
};
dictionary PrepareSendResponse {
string id;
u64 payer_amount_sat;
u64 receiver_amount_sat;
u64 total_fees;
string funding_address;
string invoice;
u64 fees_sat;
};
dictionary SendPaymentResponse {
@@ -59,7 +58,6 @@ dictionary PrepareReceiveRequest {
};
dictionary PrepareReceiveResponse {
string pair_hash;
u64 payer_amount_sat;
u64 fees_sat;
};

View File

@@ -21,7 +21,7 @@ impl BindingLiquidSdk {
&self,
req: PrepareSendRequest,
) -> Result<PrepareSendResponse, PaymentError> {
self.sdk.prepare_send_payment(req)
self.sdk.prepare_send_payment(&req)
}
pub fn send_payment(

View File

@@ -10,7 +10,8 @@ crate-type = ["lib", "cdylib", "staticlib"]
[dependencies]
anyhow = { workspace = true }
bip39 = { version = "2.0.0", features = ["serde"] }
boltz-client = { git = "https://github.com/SatoshiPortal/boltz-rust", rev = "6f45fff8b87c7530c847eb05f018906c48785a6c" }
#boltz-client = { git = "https://github.com/SatoshiPortal/boltz-rust", rev = "a05731cc33030ada9ae14afcafe0cded22842ba6" }
boltz-client = { git = "https://github.com/hydra-yse/boltz-rust", rev = "be8395900495e415699a54e15f4bd0bc6d774237" }
flutter_rust_bridge = { version = "=2.0.0-dev.33", features = ["chrono"], optional = true }
log = "0.4.20"
lwk_common = "0.3.0"
@@ -19,8 +20,12 @@ lwk_wollet = "0.3.0"
rusqlite = { version = "0.31", features = ["backup", "bundled"] }
rusqlite_migration = "1.0"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.116"
thiserror = { workspace = true }
tungstenite = { version = "0.21.0", features = ["native-tls-vendored"] }
openssl = { version = "0.10", features = ["vendored"] }
# TODO Remove once fully migrated to v2 API
elements = "0.24.1"
[dev-dependencies]
tempdir = "0.3.7"

View File

@@ -1,5 +1,4 @@
use anyhow::{anyhow, Result};
pub(crate) use boltz_client::util::secrets::LBtcReverseRecovery;
use std::sync::{Arc, OnceLock};
use crate::{error::*, model::*, sdk::LiquidSdk};
@@ -26,7 +25,7 @@ pub fn prepare_send_payment(req: PrepareSendRequest) -> Result<PrepareSendRespon
.get()
.ok_or(anyhow!("Not initialized"))
.map_err(|e| LiquidSdkError::Generic { err: e.to_string() })?
.prepare_send_payment(req)
.prepare_send_payment(&req)
}
pub fn send_payment(req: PrepareSendResponse) -> Result<SendPaymentResponse, PaymentError> {
@@ -65,14 +64,6 @@ pub fn list_payments(with_scan: bool, include_pending: bool) -> Result<Vec<Payme
.list_payments(with_scan, include_pending)
}
pub fn recover_funds(recovery: LBtcReverseRecovery) -> Result<String> {
LIQUID_SDK_INSTANCE
.get()
.ok_or(anyhow!("Not initialized"))
.map_err(|e| LiquidSdkError::Generic { err: e.to_string() })?
.recover_funds(&recovery)
}
pub fn empty_wallet_cache() -> Result<()> {
LIQUID_SDK_INSTANCE
.get()

View File

@@ -0,0 +1,212 @@
use std::collections::HashSet;
use std::io::ErrorKind;
use std::net::TcpStream;
use std::str::FromStr;
use std::sync::{Arc, Mutex};
use std::thread;
use anyhow::{anyhow, Result};
use boltz_client::swaps::{
boltz::{RevSwapStates, SubSwapStates},
boltzv2::{Subscription, SwapUpdate},
};
use boltz_client::SwapType;
use log::{error, info, warn};
use tungstenite::stream::MaybeTlsStream;
use tungstenite::{Message, WebSocket};
use crate::model::*;
use crate::sdk::LiquidSdk;
pub(super) struct BoltzStatusStream {
// socket: WebSocket<MaybeTlsStream<TcpStream>>,
swap_in_ids: Arc<Mutex<HashSet<String>>>,
swap_out_ids: Arc<Mutex<HashSet<String>>>,
}
impl BoltzStatusStream {
pub(super) fn new() -> Self {
BoltzStatusStream {
swap_in_ids: Default::default(),
swap_out_ids: Default::default(),
}
}
pub(super) fn insert_tracked_swap(&self, id: &str, swap_type: SwapType) {
match swap_type {
SwapType::Submarine => self.swap_in_ids.lock().unwrap().insert(id.to_string()),
SwapType::ReverseSubmarine => self.swap_out_ids.lock().unwrap().insert(id.to_string()),
};
}
pub(super) fn resolve_tracked_swap(&self, id: &str, swap_type: SwapType) {
match swap_type {
SwapType::Submarine => self.swap_in_ids.lock().unwrap().remove(id),
SwapType::ReverseSubmarine => self.swap_out_ids.lock().unwrap().remove(id),
};
}
pub(super) fn track_pending_swaps(&self, sdk: Arc<LiquidSdk>) -> Result<()> {
// Track subscribed swap IDs
let mut socket = sdk
.boltz_client_v2()
.connect_ws()
.map_err(|e| anyhow!("Failed to connect to websocket: {e:?}"))?;
// Set underlying TCP stream to nonblocking mode
match socket.get_mut() {
tungstenite::stream::MaybeTlsStream::Plain(s) => s.set_nonblocking(true)?,
tungstenite::stream::MaybeTlsStream::NativeTls(s) => {
s.get_mut().set_nonblocking(true)?
}
_ => Err(anyhow!("Unsupported stream type"))?,
};
let swap_in_ids = self.swap_in_ids.clone();
let swap_out_ids = self.swap_out_ids.clone();
thread::spawn(move || loop {
let maybe_subscribe_fn =
|ongoing_swap: &OngoingSwap, socket: &mut WebSocket<MaybeTlsStream<TcpStream>>| {
let id = ongoing_swap.id();
let is_ongoing_swap_already_tracked = match ongoing_swap {
OngoingSwap::Send(_) => swap_in_ids.lock().unwrap().contains(&id),
OngoingSwap::Receive(_) => swap_out_ids.lock().unwrap().contains(&id),
};
if !is_ongoing_swap_already_tracked {
info!("Subscribing to status for ongoing swap ID {id}");
let subscription = Subscription::new(&id);
let subscribe_json = serde_json::to_string(&subscription)
.map_err(|e| anyhow!("Invalid subscription msg: {e:?}"))
.unwrap();
socket
.send(tungstenite::Message::Text(subscribe_json))
.map_err(|e| anyhow!("Failed to subscribe to {id}: {e:?}"))
.unwrap();
match ongoing_swap {
OngoingSwap::Send(_) => swap_in_ids.lock().unwrap().insert(id),
OngoingSwap::Receive(_) => swap_out_ids.lock().unwrap().insert(id),
};
}
};
// Initially subscribe to all ongoing swaps
match sdk.list_ongoing_swaps() {
Ok(initial_ongoing_swaps) => {
info!("Got {} initial ongoing swaps", initial_ongoing_swaps.len());
for ongoing_swap in &initial_ongoing_swaps {
maybe_subscribe_fn(ongoing_swap, &mut socket);
}
}
Err(e) => error!("Failed to list initial ongoing swaps: {e:?}"),
}
loop {
match &socket.read() {
Ok(Message::Close(_)) => {
warn!("Received close msg, exiting socket loop");
break;
}
Ok(msg) => {
info!("Received msg : {msg:?}");
// Each time socket.read() returns, we have the opportunity to socket.send().
// We use this window to subscribe to any new ongoing swaps.
// This happens on any non-close socket messages, in particular:
// Ping (periodic keep-alive), Text (status update)
match sdk.list_ongoing_swaps() {
Ok(ongoing_swaps) => {
for ongoing_swap in &ongoing_swaps {
maybe_subscribe_fn(ongoing_swap, &mut socket);
}
}
Err(e) => error!("Failed to list new ongoing swaps: {e:?}"),
}
// We parse and handle any Text websocket messages, which are likely status updates
if msg.is_text() {
let response: SwapUpdate = serde_json::from_str(&msg.to_string())
.map_err(|e| anyhow!("WS response is invalid SwapUpdate: {e:?}"))
.unwrap();
info!("Received update : {response:?}");
match response {
// Subscription confirmation
boltz_client::swaps::boltzv2::SwapUpdate::Subscription {
..
} => {}
// Status update
boltz_client::swaps::boltzv2::SwapUpdate::Update {
event: _,
channel: _,
args,
} => {
let update = args.first().unwrap().clone(); // TODO
let update_swap_id = update.id.clone();
let update_state_str = update.status.clone();
if swap_in_ids.lock().unwrap().contains(&update_swap_id) {
// Known OngoingSwapIn / Send swap
match SubSwapStates::from_str(&update_state_str) {
Ok(new_state) => {
let res = sdk.try_handle_submarine_swap_status(
new_state,
&update_swap_id,
);
info!("ongoingswapin / send try_handle_submarine_swap_status res: {res:?}");
}
Err(_) => error!("Invalid state for submarine swap {update_swap_id}: {update_state_str}")
}
} else if swap_out_ids.lock().unwrap().contains(&update_swap_id)
{
// Known OngoingSwapOut / receive swap
match RevSwapStates::from_str(&update_state_str) {
Ok(new_state) => {
let res = sdk.try_handle_reverse_swap_status(
new_state,
&update_swap_id,
);
info!("OngoingSwapOut / receive try_handle_reverse_swap_status res: {res:?}");
}
Err(_) => error!("Invalid state for reverse swap {update_swap_id}: {update_state_str}")
}
} else {
// We got an update for a swap we did not track as ongoing
todo!()
}
}
// Error related to subscription, like "Unknown swap ID"
boltz_client::swaps::boltzv2::SwapUpdate::Error { .. } => todo!(),
}
}
}
Err(tungstenite::Error::Io(io_err)) => {
match io_err.kind() {
// Calling socket.read() on a non-blocking stream when there is nothing
// to read results in an WouldBlock error. In this case, we do nothing
// and continue the loop.
ErrorKind::WouldBlock => {}
_ => {
error!("Received stream IO error : {io_err:?}");
break;
}
}
}
Err(e) => {
error!("Received stream error : {e:?}");
break;
}
}
}
});
Ok(())
}
}

View File

@@ -24,15 +24,21 @@ impl From<anyhow::Error> for LiquidSdkError {
#[derive(thiserror::Error, Debug)]
pub enum PaymentError {
#[error("Invoice amount is out of range")]
AmountOutOfRange,
#[error("The specified funds have already been claimed")]
AlreadyClaimed,
#[error("Invoice amount is out of range")]
AmountOutOfRange,
#[error("Generic error: {err}")]
Generic { err: String },
#[error("The provided fees have expired")]
InvalidOrExpiredFees,
#[error("Cannot pay: not enough funds")]
InsufficientFunds,
#[error("The specified invoice is not valid")]
InvalidInvoice,
@@ -48,6 +54,9 @@ pub enum PaymentError {
#[error("Could not store the swap details locally")]
PersistError,
#[error("The payment has been refunded. Reason for failure: {err}")]
Refunded { err: String, txid: String },
#[error("Could not sign/send the transaction: {err}")]
SendError { err: String },
@@ -65,6 +74,13 @@ impl From<boltz_client::error::Error> for PaymentError {
PaymentError::Generic { err: msg }
}
boltz_client::error::Error::HTTP(ureq) => {
dbg!(ureq.into_response().unwrap().into_string().unwrap());
PaymentError::Generic {
err: "Could not contact servers".to_string(),
}
}
_ => PaymentError::Generic {
err: format!("{err:?}"),
},

View File

@@ -4,7 +4,6 @@
// Section: imports
use super::*;
use crate::bindings::*;
use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
use flutter_rust_bridge::for_generated::transform_result_dco;
use flutter_rust_bridge::{Handler, IntoIntoDart};
@@ -23,30 +22,6 @@ impl CstDecode<flutter_rust_bridge::for_generated::anyhow::Error>
unimplemented!()
}
}
impl CstDecode<LBtcReverseRecovery> for usize {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> LBtcReverseRecovery {
CstDecode::<
RustOpaqueNom<
flutter_rust_bridge::for_generated::RustAutoOpaqueInner<LBtcReverseRecovery>,
>,
>::cst_decode(self)
.rust_auto_opaque_decode_owned()
}
}
impl
CstDecode<
RustOpaqueNom<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<LBtcReverseRecovery>>,
> for usize
{
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(
self,
) -> RustOpaqueNom<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<LBtcReverseRecovery>>
{
unsafe { decode_rust_opaque_nom(self as _) }
}
}
impl CstDecode<String> for *mut wire_cst_list_prim_u_8_strict {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> String {
@@ -178,31 +153,40 @@ impl CstDecode<crate::error::PaymentError> for wire_cst_payment_error {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::error::PaymentError {
match self.tag {
0 => crate::error::PaymentError::AmountOutOfRange,
1 => crate::error::PaymentError::AlreadyClaimed,
0 => crate::error::PaymentError::AlreadyClaimed,
1 => crate::error::PaymentError::AmountOutOfRange,
2 => {
let ans = unsafe { self.kind.Generic };
crate::error::PaymentError::Generic {
err: ans.err.cst_decode(),
}
}
3 => crate::error::PaymentError::InvalidInvoice,
4 => crate::error::PaymentError::InvalidPreimage,
5 => {
3 => crate::error::PaymentError::InvalidOrExpiredFees,
4 => crate::error::PaymentError::InsufficientFunds,
5 => crate::error::PaymentError::InvalidInvoice,
6 => crate::error::PaymentError::InvalidPreimage,
7 => {
let ans = unsafe { self.kind.LwkError };
crate::error::PaymentError::LwkError {
err: ans.err.cst_decode(),
}
}
6 => crate::error::PaymentError::PairsNotFound,
7 => crate::error::PaymentError::PersistError,
8 => {
8 => crate::error::PaymentError::PairsNotFound,
9 => crate::error::PaymentError::PersistError,
10 => {
let ans = unsafe { self.kind.Refunded };
crate::error::PaymentError::Refunded {
err: ans.err.cst_decode(),
txid: ans.txid.cst_decode(),
}
}
11 => {
let ans = unsafe { self.kind.SendError };
crate::error::PaymentError::SendError {
err: ans.err.cst_decode(),
}
}
9 => {
12 => {
let ans = unsafe { self.kind.SignerError };
crate::error::PaymentError::SignerError {
err: ans.err.cst_decode(),
@@ -224,7 +208,6 @@ impl CstDecode<crate::model::PrepareReceiveResponse> for wire_cst_prepare_receiv
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::PrepareReceiveResponse {
crate::model::PrepareReceiveResponse {
pair_hash: self.pair_hash.cst_decode(),
payer_amount_sat: self.payer_amount_sat.cst_decode(),
fees_sat: self.fees_sat.cst_decode(),
}
@@ -242,12 +225,8 @@ impl CstDecode<crate::model::PrepareSendResponse> for wire_cst_prepare_send_resp
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> crate::model::PrepareSendResponse {
crate::model::PrepareSendResponse {
id: self.id.cst_decode(),
payer_amount_sat: self.payer_amount_sat.cst_decode(),
receiver_amount_sat: self.receiver_amount_sat.cst_decode(),
total_fees: self.total_fees.cst_decode(),
funding_address: self.funding_address.cst_decode(),
invoice: self.invoice.cst_decode(),
fees_sat: self.fees_sat.cst_decode(),
}
}
}
@@ -360,7 +339,6 @@ impl Default for wire_cst_prepare_receive_request {
impl NewWithNullPtr for wire_cst_prepare_receive_response {
fn new_with_null_ptr() -> Self {
Self {
pair_hash: core::ptr::null_mut(),
payer_amount_sat: Default::default(),
fees_sat: Default::default(),
}
@@ -386,12 +364,8 @@ impl Default for wire_cst_prepare_send_request {
impl NewWithNullPtr for wire_cst_prepare_send_response {
fn new_with_null_ptr() -> Self {
Self {
id: core::ptr::null_mut(),
payer_amount_sat: Default::default(),
receiver_amount_sat: Default::default(),
total_fees: Default::default(),
funding_address: core::ptr::null_mut(),
invoice: core::ptr::null_mut(),
fees_sat: Default::default(),
}
}
}
@@ -494,11 +468,6 @@ pub extern "C" fn frbgen_breez_liquid_wire_receive_payment(
wire_receive_payment_impl(port_, req)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_recover_funds(port_: i64, recovery: usize) {
wire_recover_funds_impl(port_, recovery)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_wire_restore(port_: i64, req: *mut wire_cst_restore_request) {
wire_restore_impl(port_, req)
@@ -512,24 +481,6 @@ pub extern "C" fn frbgen_breez_liquid_wire_send_payment(
wire_send_payment_impl(port_, req)
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
ptr: *const std::ffi::c_void,
) {
unsafe {
StdArc::<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<LBtcReverseRecovery>>::increment_strong_count(ptr as _);
}
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
ptr: *const std::ffi::c_void,
) {
unsafe {
StdArc::<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<LBtcReverseRecovery>>::decrement_strong_count(ptr as _);
}
}
#[no_mangle]
pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_connect_request(
) -> *mut wire_cst_connect_request {
@@ -670,6 +621,7 @@ pub struct wire_cst_payment_error {
pub union PaymentErrorKind {
Generic: wire_cst_PaymentError_Generic,
LwkError: wire_cst_PaymentError_LwkError,
Refunded: wire_cst_PaymentError_Refunded,
SendError: wire_cst_PaymentError_SendError,
SignerError: wire_cst_PaymentError_SignerError,
nil__: (),
@@ -686,6 +638,12 @@ pub struct wire_cst_PaymentError_LwkError {
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_PaymentError_Refunded {
err: *mut wire_cst_list_prim_u_8_strict,
txid: *mut wire_cst_list_prim_u_8_strict,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_PaymentError_SendError {
err: *mut wire_cst_list_prim_u_8_strict,
}
@@ -702,7 +660,6 @@ pub struct wire_cst_prepare_receive_request {
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_prepare_receive_response {
pair_hash: *mut wire_cst_list_prim_u_8_strict,
payer_amount_sat: u64,
fees_sat: u64,
}
@@ -714,12 +671,8 @@ pub struct wire_cst_prepare_send_request {
#[repr(C)]
#[derive(Clone, Copy)]
pub struct wire_cst_prepare_send_response {
id: *mut wire_cst_list_prim_u_8_strict,
payer_amount_sat: u64,
receiver_amount_sat: u64,
total_fees: u64,
funding_address: *mut wire_cst_list_prim_u_8_strict,
invoice: *mut wire_cst_list_prim_u_8_strict,
fees_sat: u64,
}
#[repr(C)]
#[derive(Clone, Copy)]

View File

@@ -19,7 +19,6 @@
// Section: imports
use crate::bindings::*;
use flutter_rust_bridge::for_generated::byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
use flutter_rust_bridge::for_generated::transform_result_dco;
use flutter_rust_bridge::{Handler, IntoIntoDart};
@@ -32,7 +31,7 @@ flutter_rust_bridge::frb_generated_boilerplate!(
default_rust_auto_opaque = RustAutoOpaqueNom,
);
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.0.0-dev.33";
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = -1225779344;
pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = -451265040;
// Section: executor
@@ -170,24 +169,6 @@ fn wire_receive_payment_impl(
},
)
}
fn wire_recover_funds_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
recovery: impl CstDecode<LBtcReverseRecovery>,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap_normal::<flutter_rust_bridge::for_generated::DcoCodec, _, _>(
flutter_rust_bridge::for_generated::TaskInfo {
debug_name: "recover_funds",
port: Some(port_),
mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal,
},
move || {
let api_recovery = recovery.cst_decode();
move |context| {
transform_result_dco((move || crate::bindings::recover_funds(api_recovery))())
}
},
)
}
fn wire_restore_impl(
port_: flutter_rust_bridge::for_generated::MessagePort,
req: impl CstDecode<crate::model::RestoreRequest>,
@@ -275,12 +256,6 @@ impl CstDecode<u8> for u8 {
self
}
}
impl CstDecode<usize> for usize {
// Codec=Cst (C-struct based), see doc to use other codecs
fn cst_decode(self) -> usize {
self
}
}
impl SseDecode for flutter_rust_bridge::for_generated::anyhow::Error {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -288,26 +263,6 @@ impl SseDecode for flutter_rust_bridge::for_generated::anyhow::Error {
}
}
impl SseDecode for LBtcReverseRecovery {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut inner = <RustOpaqueNom<
flutter_rust_bridge::for_generated::RustAutoOpaqueInner<LBtcReverseRecovery>,
>>::sse_decode(deserializer);
return inner.rust_auto_opaque_decode_owned();
}
}
impl SseDecode
for RustOpaqueNom<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<LBtcReverseRecovery>>
{
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
let mut inner = <usize>::sse_decode(deserializer);
return unsafe { decode_rust_opaque_nom(inner) };
}
}
impl SseDecode for String {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@@ -461,36 +416,50 @@ impl SseDecode for crate::error::PaymentError {
let mut tag_ = <i32>::sse_decode(deserializer);
match tag_ {
0 => {
return crate::error::PaymentError::AmountOutOfRange;
return crate::error::PaymentError::AlreadyClaimed;
}
1 => {
return crate::error::PaymentError::AlreadyClaimed;
return crate::error::PaymentError::AmountOutOfRange;
}
2 => {
let mut var_err = <String>::sse_decode(deserializer);
return crate::error::PaymentError::Generic { err: var_err };
}
3 => {
return crate::error::PaymentError::InvalidInvoice;
return crate::error::PaymentError::InvalidOrExpiredFees;
}
4 => {
return crate::error::PaymentError::InvalidPreimage;
return crate::error::PaymentError::InsufficientFunds;
}
5 => {
return crate::error::PaymentError::InvalidInvoice;
}
6 => {
return crate::error::PaymentError::InvalidPreimage;
}
7 => {
let mut var_err = <String>::sse_decode(deserializer);
return crate::error::PaymentError::LwkError { err: var_err };
}
6 => {
8 => {
return crate::error::PaymentError::PairsNotFound;
}
7 => {
9 => {
return crate::error::PaymentError::PersistError;
}
8 => {
10 => {
let mut var_err = <String>::sse_decode(deserializer);
let mut var_txid = <String>::sse_decode(deserializer);
return crate::error::PaymentError::Refunded {
err: var_err,
txid: var_txid,
};
}
11 => {
let mut var_err = <String>::sse_decode(deserializer);
return crate::error::PaymentError::SendError { err: var_err };
}
9 => {
12 => {
let mut var_err = <String>::sse_decode(deserializer);
return crate::error::PaymentError::SignerError { err: var_err };
}
@@ -528,11 +497,9 @@ impl SseDecode for crate::model::PrepareReceiveRequest {
impl SseDecode for crate::model::PrepareReceiveResponse {
// 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_pairHash = <String>::sse_decode(deserializer);
let mut var_payerAmountSat = <u64>::sse_decode(deserializer);
let mut var_feesSat = <u64>::sse_decode(deserializer);
return crate::model::PrepareReceiveResponse {
pair_hash: var_pairHash,
payer_amount_sat: var_payerAmountSat,
fees_sat: var_feesSat,
};
@@ -552,19 +519,11 @@ impl SseDecode for crate::model::PrepareSendRequest {
impl SseDecode for crate::model::PrepareSendResponse {
// 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_id = <String>::sse_decode(deserializer);
let mut var_payerAmountSat = <u64>::sse_decode(deserializer);
let mut var_receiverAmountSat = <u64>::sse_decode(deserializer);
let mut var_totalFees = <u64>::sse_decode(deserializer);
let mut var_fundingAddress = <String>::sse_decode(deserializer);
let mut var_invoice = <String>::sse_decode(deserializer);
let mut var_feesSat = <u64>::sse_decode(deserializer);
return crate::model::PrepareSendResponse {
id: var_id,
payer_amount_sat: var_payerAmountSat,
receiver_amount_sat: var_receiverAmountSat,
total_fees: var_totalFees,
funding_address: var_fundingAddress,
invoice: var_invoice,
fees_sat: var_feesSat,
};
}
}
@@ -625,13 +584,6 @@ impl SseDecode for () {
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {}
}
impl SseDecode for usize {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
deserializer.cursor.read_u64::<NativeEndian>().unwrap() as _
}
}
fn pde_ffi_dispatcher_primary_impl(
func_id: i32,
port: flutter_rust_bridge::for_generated::MessagePort,
@@ -659,24 +611,6 @@ fn pde_ffi_dispatcher_sync_impl(
// Section: rust2dart
// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for FrbWrapper<LBtcReverseRecovery> {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, StdArc<_>>(self.0)
.into_dart()
}
}
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
for FrbWrapper<LBtcReverseRecovery>
{
}
impl flutter_rust_bridge::IntoIntoDart<FrbWrapper<LBtcReverseRecovery>> for LBtcReverseRecovery {
fn into_into_dart(self) -> FrbWrapper<LBtcReverseRecovery> {
self.into()
}
}
// Codec=Dco (DartCObject based), see doc to use other codecs
impl flutter_rust_bridge::IntoDart for crate::model::ConnectRequest {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
@@ -767,23 +701,31 @@ impl flutter_rust_bridge::IntoIntoDart<crate::model::Payment> for crate::model::
impl flutter_rust_bridge::IntoDart for crate::error::PaymentError {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
match self {
crate::error::PaymentError::AmountOutOfRange => [0.into_dart()].into_dart(),
crate::error::PaymentError::AlreadyClaimed => [1.into_dart()].into_dart(),
crate::error::PaymentError::AlreadyClaimed => [0.into_dart()].into_dart(),
crate::error::PaymentError::AmountOutOfRange => [1.into_dart()].into_dart(),
crate::error::PaymentError::Generic { err } => {
[2.into_dart(), err.into_into_dart().into_dart()].into_dart()
}
crate::error::PaymentError::InvalidInvoice => [3.into_dart()].into_dart(),
crate::error::PaymentError::InvalidPreimage => [4.into_dart()].into_dart(),
crate::error::PaymentError::InvalidOrExpiredFees => [3.into_dart()].into_dart(),
crate::error::PaymentError::InsufficientFunds => [4.into_dart()].into_dart(),
crate::error::PaymentError::InvalidInvoice => [5.into_dart()].into_dart(),
crate::error::PaymentError::InvalidPreimage => [6.into_dart()].into_dart(),
crate::error::PaymentError::LwkError { err } => {
[5.into_dart(), err.into_into_dart().into_dart()].into_dart()
[7.into_dart(), err.into_into_dart().into_dart()].into_dart()
}
crate::error::PaymentError::PairsNotFound => [6.into_dart()].into_dart(),
crate::error::PaymentError::PersistError => [7.into_dart()].into_dart(),
crate::error::PaymentError::PairsNotFound => [8.into_dart()].into_dart(),
crate::error::PaymentError::PersistError => [9.into_dart()].into_dart(),
crate::error::PaymentError::Refunded { err, txid } => [
10.into_dart(),
err.into_into_dart().into_dart(),
txid.into_into_dart().into_dart(),
]
.into_dart(),
crate::error::PaymentError::SendError { err } => {
[8.into_dart(), err.into_into_dart().into_dart()].into_dart()
[11.into_dart(), err.into_into_dart().into_dart()].into_dart()
}
crate::error::PaymentError::SignerError { err } => {
[9.into_dart(), err.into_into_dart().into_dart()].into_dart()
[12.into_dart(), err.into_into_dart().into_dart()].into_dart()
}
}
}
@@ -832,7 +774,6 @@ impl flutter_rust_bridge::IntoIntoDart<crate::model::PrepareReceiveRequest>
impl flutter_rust_bridge::IntoDart for crate::model::PrepareReceiveResponse {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[
self.pair_hash.into_into_dart().into_dart(),
self.payer_amount_sat.into_into_dart().into_dart(),
self.fees_sat.into_into_dart().into_dart(),
]
@@ -871,12 +812,8 @@ impl flutter_rust_bridge::IntoIntoDart<crate::model::PrepareSendRequest>
impl flutter_rust_bridge::IntoDart for crate::model::PrepareSendResponse {
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
[
self.id.into_into_dart().into_dart(),
self.payer_amount_sat.into_into_dart().into_dart(),
self.receiver_amount_sat.into_into_dart().into_dart(),
self.total_fees.into_into_dart().into_dart(),
self.funding_address.into_into_dart().into_dart(),
self.invoice.into_into_dart().into_dart(),
self.fees_sat.into_into_dart().into_dart(),
]
.into_dart()
}
@@ -952,24 +889,6 @@ impl SseEncode for flutter_rust_bridge::for_generated::anyhow::Error {
}
}
impl SseEncode for LBtcReverseRecovery {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<RustOpaqueNom<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<LBtcReverseRecovery>>>::sse_encode(flutter_rust_bridge::for_generated::rust_auto_opaque_encode::<_, StdArc<_>>(self), serializer);
}
}
impl SseEncode
for RustOpaqueNom<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<LBtcReverseRecovery>>
{
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
let (ptr, size) = self.sse_encode_raw();
<usize>::sse_encode(ptr, serializer);
<i32>::sse_encode(size, serializer);
}
}
impl SseEncode for String {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
@@ -1097,38 +1016,49 @@ impl SseEncode for crate::error::PaymentError {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
match self {
crate::error::PaymentError::AmountOutOfRange => {
crate::error::PaymentError::AlreadyClaimed => {
<i32>::sse_encode(0, serializer);
}
crate::error::PaymentError::AlreadyClaimed => {
crate::error::PaymentError::AmountOutOfRange => {
<i32>::sse_encode(1, serializer);
}
crate::error::PaymentError::Generic { err } => {
<i32>::sse_encode(2, serializer);
<String>::sse_encode(err, serializer);
}
crate::error::PaymentError::InvalidInvoice => {
crate::error::PaymentError::InvalidOrExpiredFees => {
<i32>::sse_encode(3, serializer);
}
crate::error::PaymentError::InvalidPreimage => {
crate::error::PaymentError::InsufficientFunds => {
<i32>::sse_encode(4, serializer);
}
crate::error::PaymentError::LwkError { err } => {
crate::error::PaymentError::InvalidInvoice => {
<i32>::sse_encode(5, serializer);
}
crate::error::PaymentError::InvalidPreimage => {
<i32>::sse_encode(6, serializer);
}
crate::error::PaymentError::LwkError { err } => {
<i32>::sse_encode(7, serializer);
<String>::sse_encode(err, serializer);
}
crate::error::PaymentError::PairsNotFound => {
<i32>::sse_encode(6, serializer);
<i32>::sse_encode(8, serializer);
}
crate::error::PaymentError::PersistError => {
<i32>::sse_encode(7, serializer);
<i32>::sse_encode(9, serializer);
}
crate::error::PaymentError::Refunded { err, txid } => {
<i32>::sse_encode(10, serializer);
<String>::sse_encode(err, serializer);
<String>::sse_encode(txid, serializer);
}
crate::error::PaymentError::SendError { err } => {
<i32>::sse_encode(8, serializer);
<i32>::sse_encode(11, serializer);
<String>::sse_encode(err, serializer);
}
crate::error::PaymentError::SignerError { err } => {
<i32>::sse_encode(9, serializer);
<i32>::sse_encode(12, serializer);
<String>::sse_encode(err, serializer);
}
}
@@ -1163,7 +1093,6 @@ impl SseEncode for crate::model::PrepareReceiveRequest {
impl SseEncode for crate::model::PrepareReceiveResponse {
// 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.pair_hash, serializer);
<u64>::sse_encode(self.payer_amount_sat, serializer);
<u64>::sse_encode(self.fees_sat, serializer);
}
@@ -1179,12 +1108,8 @@ impl SseEncode for crate::model::PrepareSendRequest {
impl SseEncode for crate::model::PrepareSendResponse {
// 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.id, serializer);
<u64>::sse_encode(self.payer_amount_sat, serializer);
<u64>::sse_encode(self.receiver_amount_sat, serializer);
<u64>::sse_encode(self.total_fees, serializer);
<String>::sse_encode(self.funding_address, serializer);
<String>::sse_encode(self.invoice, serializer);
<u64>::sse_encode(self.fees_sat, serializer);
}
}
@@ -1236,16 +1161,6 @@ impl SseEncode for () {
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {}
}
impl SseEncode for usize {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
serializer
.cursor
.write_u64::<NativeEndian>(self as _)
.unwrap();
}
}
#[cfg(not(target_family = "wasm"))]
#[path = "bridge.io.rs"]
mod io;

View File

@@ -1,8 +1,10 @@
#[cfg(feature = "frb")]
pub mod bindings;
pub(crate) mod boltz_status_stream;
pub mod error;
#[cfg(feature = "frb")]
pub mod frb;
pub mod model;
pub mod persist;
pub mod sdk;
pub(crate) mod utils;

View File

@@ -86,7 +86,6 @@ pub struct PrepareReceiveRequest {
#[derive(Debug, Serialize)]
pub struct PrepareReceiveResponse {
pub pair_hash: String,
pub payer_amount_sat: u64,
pub fees_sat: u64,
}
@@ -104,12 +103,8 @@ pub struct PrepareSendRequest {
#[derive(Debug, Serialize, Clone)]
pub struct PrepareSendResponse {
pub id: String,
pub payer_amount_sat: u64,
pub receiver_amount_sat: u64,
pub total_fees: u64,
pub funding_address: String,
pub invoice: String,
pub fees_sat: u64,
}
#[derive(Debug, Serialize)]
@@ -133,23 +128,38 @@ pub struct RestoreRequest {
pub backup_path: Option<String>,
}
#[derive(Debug)]
#[derive(Clone, Debug)]
pub(crate) enum OngoingSwap {
Send {
id: String,
funding_address: String,
invoice: String,
receiver_amount_sat: u64,
txid: Option<String>,
},
Receive {
id: String,
preimage: String,
redeem_script: String,
blinding_key: String,
invoice: String,
receiver_amount_sat: u64,
},
Send(OngoingSwapIn),
Receive(OngoingSwapOut),
}
impl OngoingSwap {
pub(crate) fn id(&self) -> String {
match &self {
OngoingSwap::Send(OngoingSwapIn { id, .. })
| OngoingSwap::Receive(OngoingSwapOut { id, .. }) => id.clone(),
}
}
}
#[derive(Clone, Debug)]
pub(crate) struct OngoingSwapIn {
pub(crate) id: String,
pub(crate) invoice: String,
pub(crate) payer_amount_sat: u64,
pub(crate) create_response_json: String,
pub(crate) lockup_txid: Option<String>,
}
#[derive(Clone, Debug)]
pub(crate) struct OngoingSwapOut {
pub(crate) id: String,
pub(crate) preimage: String,
pub(crate) redeem_script: String,
pub(crate) blinding_key: String,
pub(crate) invoice: String,
pub(crate) receiver_amount_sat: u64,
pub(crate) claim_fees_sat: u64,
}
#[derive(Debug, Clone, PartialEq, Serialize)]
@@ -169,33 +179,32 @@ pub struct Payment {
#[serde(rename(serialize = "type"))]
pub payment_type: PaymentType,
/// Only for [PaymentType::PendingReceive]
pub invoice: Option<String>,
}
impl From<OngoingSwap> for Payment {
fn from(swap: OngoingSwap) -> Self {
match swap {
OngoingSwap::Send {
OngoingSwap::Send(OngoingSwapIn {
invoice,
receiver_amount_sat,
payer_amount_sat,
..
} => {
let payer_amount_sat = get_invoice_amount!(invoice);
}) => {
let receiver_amount_sat = get_invoice_amount!(invoice);
Payment {
id: None,
timestamp: None,
payment_type: PaymentType::PendingSend,
amount_sat: payer_amount_sat,
invoice: Some(invoice),
fees_sat: Some(receiver_amount_sat - payer_amount_sat),
fees_sat: Some(payer_amount_sat - receiver_amount_sat),
}
}
OngoingSwap::Receive {
OngoingSwap::Receive(OngoingSwapOut {
receiver_amount_sat,
invoice,
..
} => {
}) => {
let payer_amount_sat = get_invoice_amount!(invoice);
Payment {
id: None,
@@ -212,6 +221,7 @@ impl From<OngoingSwap> for Payment {
pub(crate) struct PaymentData {
pub payer_amount_sat: u64,
pub receiver_amount_sat: u64,
}
#[macro_export]

View File

@@ -7,19 +7,21 @@ pub(crate) fn current_migrations() -> Vec<&'static str> {
blinding_key TEXT NOT NULL,
invoice TEXT NOT NULL,
receiver_amount_sat INTEGER NOT NULL,
created_at TEXT DEFAULT CURRENT_TIMESTAMP
) STRICT;",
"CREATE TABLE IF NOT EXISTS ongoing_send_swaps (
id TEXT NOT NULL PRIMARY KEY,
funding_address TEXT NOT NULL,
invoice TEXT NOT NULL,
receiver_amount_sat INTEGER NOT NULL,
txid TEXT,
created_at TEXT DEFAULT CURRENT_TIMESTAMP
created_at TEXT DEFAULT CURRENT_TIMESTAMP,
claim_fees_sat INTEGER NOT NULL
) STRICT;",
"CREATE TABLE IF NOT EXISTS ongoing_send_swaps(
id TEXT NOT NULL PRIMARY KEY,
invoice TEXT NOT NULL,
payer_amount_sat INTEGER NOT NULL,
create_response_json TEXT NOT NULL,
lockup_txid TEXT,
created_at TEXT DEFAULT CURRENT_TIMESTAMP
) STRICT;",
"CREATE TABLE IF NOT EXISTS payment_data(
id TEXT NOT NULL PRIMARY KEY,
payer_amount_sat INTEGER NOT NULL
payer_amount_sat INTEGER NOT NULL,
receiver_amount_sat INTEGER NOT NULL
) STRICT;",
]
}

View File

@@ -1,5 +1,7 @@
mod backup;
mod migrations;
mod swap_in;
mod swap_out;
use std::{collections::HashMap, fs::create_dir_all, path::PathBuf, str::FromStr};
@@ -8,7 +10,7 @@ use migrations::current_migrations;
use rusqlite::{params, Connection};
use rusqlite_migration::{Migrations, M};
use crate::model::{Network, Network::*, OngoingSwap, PaymentData};
use crate::model::{Network::*, *};
pub(crate) struct Persister {
main_db_dir: PathBuf,
@@ -47,69 +49,6 @@ impl Persister {
Ok(())
}
pub fn insert_or_update_ongoing_swap(&self, swaps: &[OngoingSwap]) -> Result<()> {
let con = self.get_connection()?;
for swap in swaps {
match swap {
OngoingSwap::Send {
id,
funding_address,
invoice,
receiver_amount_sat,
txid,
} => {
let mut stmt = con.prepare(
"
INSERT OR REPLACE INTO ongoing_send_swaps (
id,
funding_address,
invoice,
receiver_amount_sat,
txid
)
VALUES (?, ?, ?, ?, ?)
",
)?;
_ = stmt.execute((id, funding_address, invoice, receiver_amount_sat, txid))?
}
OngoingSwap::Receive {
id,
preimage,
redeem_script,
blinding_key,
invoice,
receiver_amount_sat,
} => {
let mut stmt = con.prepare(
"
INSERT OR REPLACE INTO ongoing_receive_swaps (
id,
preimage,
redeem_script,
blinding_key,
invoice,
receiver_amount_sat
)
VALUES (?, ?, ?, ?, ?, ?)
",
)?;
_ = stmt.execute((
id,
preimage,
redeem_script,
blinding_key,
invoice,
receiver_amount_sat,
))?
}
}
}
Ok(())
}
pub fn resolve_ongoing_swap(
&self,
id: &str,
@@ -125,9 +64,13 @@ impl Persister {
)?;
if let Some((txid, payment_data)) = payment_data {
tx.execute(
"INSERT INTO payment_data(id, payer_amount_sat)
VALUES(?, ?)",
(txid, payment_data.payer_amount_sat),
"INSERT INTO payment_data(id, payer_amount_sat, receiver_amount_sat)
VALUES(?, ?, ?)",
(
txid,
payment_data.payer_amount_sat,
payment_data.receiver_amount_sat,
),
)?;
}
tx.commit()?;
@@ -135,75 +78,19 @@ impl Persister {
Ok(())
}
pub fn list_ongoing_swaps(&self) -> Result<Vec<OngoingSwap>> {
pub(crate) fn list_ongoing_swaps(&self) -> Result<Vec<OngoingSwap>> {
let con = self.get_connection()?;
let mut ongoing_swaps = self.list_ongoing_send(&con)?;
ongoing_swaps.append(&mut self.list_ongoing_receive(&con)?);
Ok(ongoing_swaps)
}
fn list_ongoing_send(&self, con: &Connection) -> Result<Vec<OngoingSwap>, rusqlite::Error> {
let mut stmt = con.prepare(
"
SELECT
id,
funding_address,
invoice,
receiver_amount_sat,
txid,
created_at
FROM ongoing_send_swaps
ORDER BY created_at
",
)?;
let ongoing_send = stmt
.query_map(params![], |row| {
Ok(OngoingSwap::Send {
id: row.get(0)?,
funding_address: row.get(1)?,
invoice: row.get(2)?,
receiver_amount_sat: row.get(3)?,
txid: row.get(4)?,
})
})?
.map(|i| i.unwrap())
let ongoing_swap_ins: Vec<OngoingSwap> = self
.list_ongoing_send(&con, vec![])?
.into_iter()
.map(OngoingSwap::Send)
.collect();
Ok(ongoing_send)
}
fn list_ongoing_receive(&self, con: &Connection) -> Result<Vec<OngoingSwap>, rusqlite::Error> {
let mut stmt = con.prepare(
"
SELECT
id,
preimage,
redeem_script,
blinding_key,
invoice,
receiver_amount_sat,
created_at
FROM ongoing_receive_swaps
ORDER BY created_at
",
)?;
let ongoing_receive = stmt
.query_map(params![], |row| {
Ok(OngoingSwap::Receive {
id: row.get(0)?,
preimage: row.get(1)?,
redeem_script: row.get(2)?,
blinding_key: row.get(3)?,
invoice: row.get(4)?,
receiver_amount_sat: row.get(5)?,
})
})?
.map(|i| i.unwrap())
let ongoing_swap_outs: Vec<OngoingSwap> = self
.list_ongoing_receive(&con, vec![])?
.into_iter()
.map(OngoingSwap::Receive)
.collect();
Ok(ongoing_receive)
Ok([ongoing_swap_ins, ongoing_swap_outs].concat())
}
pub fn get_payment_data(&self) -> Result<HashMap<String, PaymentData>> {
@@ -211,7 +98,7 @@ impl Persister {
let mut stmt = con.prepare(
"
SELECT id, payer_amount_sat
SELECT id, payer_amount_sat, receiver_amount_sat
FROM payment_data
",
)?;
@@ -222,6 +109,7 @@ impl Persister {
row.get(0)?,
PaymentData {
payer_amount_sat: row.get(1)?,
receiver_amount_sat: row.get(2)?,
},
))
})?

View File

@@ -0,0 +1,88 @@
use crate::model::*;
use crate::persist::Persister;
use anyhow::Result;
use rusqlite::{params, Connection, OptionalExtension, Row};
impl Persister {
pub(crate) fn insert_or_update_ongoing_swap_in(&self, swap_in: OngoingSwapIn) -> Result<()> {
let con = self.get_connection()?;
let mut stmt = con.prepare(
"
INSERT OR REPLACE INTO ongoing_send_swaps (
id,
invoice,
payer_amount_sat,
create_response_json,
lockup_txid
)
VALUES (?, ?, ?, ?, ?)",
)?;
_ = stmt.execute((
swap_in.id,
swap_in.invoice,
swap_in.payer_amount_sat,
swap_in.create_response_json,
swap_in.lockup_txid,
))?;
Ok(())
}
fn list_ongoing_swap_in_query(where_clauses: Vec<&str>) -> String {
let mut where_clause_str = String::new();
if !where_clauses.is_empty() {
where_clause_str = String::from("WHERE ");
where_clause_str.push_str(where_clauses.join(" AND ").as_str());
}
format!(
"
SELECT
id,
invoice,
payer_amount_sat,
create_response_json,
lockup_txid,
created_at
FROM ongoing_send_swaps
{where_clause_str}
ORDER BY created_at
"
)
}
pub(crate) fn fetch_ongoing_swap_in(
con: &Connection,
id: &str,
) -> rusqlite::Result<Option<OngoingSwapIn>> {
let query = Self::list_ongoing_swap_in_query(vec!["id = ?1"]);
con.query_row(&query, [id], Self::sql_row_to_ongoing_swap_in)
.optional()
}
fn sql_row_to_ongoing_swap_in(row: &Row) -> rusqlite::Result<OngoingSwapIn> {
Ok(OngoingSwapIn {
id: row.get(0)?,
invoice: row.get(1)?,
payer_amount_sat: row.get(2)?,
create_response_json: row.get(3)?,
lockup_txid: row.get(4)?,
})
}
pub(crate) fn list_ongoing_send(
&self,
con: &Connection,
where_clauses: Vec<&str>,
) -> rusqlite::Result<Vec<OngoingSwapIn>> {
let query = Self::list_ongoing_swap_in_query(where_clauses);
let ongoing_send = con
.prepare(&query)?
.query_map(params![], Self::sql_row_to_ongoing_swap_in)?
.map(|i| i.unwrap())
.collect();
Ok(ongoing_send)
}
}

View File

@@ -0,0 +1,96 @@
use crate::model::*;
use crate::persist::Persister;
use anyhow::Result;
use rusqlite::{params, Connection, OptionalExtension, Row};
impl Persister {
pub(crate) fn insert_or_update_ongoing_swap_out(&self, swap_out: OngoingSwapOut) -> Result<()> {
let con = self.get_connection()?;
let mut stmt = con.prepare(
"
INSERT OR REPLACE INTO ongoing_receive_swaps (
id,
preimage,
redeem_script,
blinding_key,
invoice,
receiver_amount_sat,
claim_fees_sat
)
VALUES (?, ?, ?, ?, ?, ?, ?)",
)?;
_ = stmt.execute((
swap_out.id,
swap_out.preimage,
swap_out.redeem_script,
swap_out.blinding_key,
swap_out.invoice,
swap_out.receiver_amount_sat,
swap_out.claim_fees_sat,
))?;
Ok(())
}
fn list_ongoing_swap_out_query(where_clauses: Vec<&str>) -> String {
let mut where_clause_str = String::new();
if !where_clauses.is_empty() {
where_clause_str = String::from("WHERE ");
where_clause_str.push_str(where_clauses.join(" AND ").as_str());
}
format!(
"
SELECT
id,
preimage,
redeem_script,
blinding_key,
invoice,
receiver_amount_sat,
claim_fees_sat,
created_at
FROM ongoing_receive_swaps
{where_clause_str}
ORDER BY created_at
"
)
}
pub(crate) fn fetch_ongoing_swap_out(
con: &Connection,
id: &str,
) -> rusqlite::Result<Option<OngoingSwapOut>> {
let query = Self::list_ongoing_swap_out_query(vec!["id = ?1"]);
con.query_row(&query, [id], Self::sql_row_to_ongoing_swap_out)
.optional()
}
fn sql_row_to_ongoing_swap_out(row: &Row) -> rusqlite::Result<OngoingSwapOut> {
Ok(OngoingSwapOut {
id: row.get(0)?,
preimage: row.get(1)?,
redeem_script: row.get(2)?,
blinding_key: row.get(3)?,
invoice: row.get(4)?,
receiver_amount_sat: row.get(5)?,
claim_fees_sat: row.get(6)?,
})
}
pub(crate) fn list_ongoing_receive(
&self,
con: &Connection,
where_clauses: Vec<&str>,
) -> rusqlite::Result<Vec<OngoingSwapOut>> {
let query = Self::list_ongoing_swap_out_query(where_clauses);
let ongoing_receive = con
.prepare(&query)?
.query_map(params![], Self::sql_row_to_ongoing_swap_out)?
.map(|i| i.unwrap())
.collect();
Ok(ongoing_receive)
}
}

File diff suppressed because it is too large Load Diff

142
lib/core/src/utils.rs Normal file
View File

@@ -0,0 +1,142 @@
use std::net::TcpStream;
use anyhow::{anyhow, ensure, Result};
use boltz_client::swaps::boltzv2::SwapUpdate;
use log::{error, info};
use tungstenite::{stream::MaybeTlsStream, WebSocket};
/// Fetch the swap status using the websocket endpoint
pub(crate) fn get_swap_status_v2(
socket: &mut WebSocket<MaybeTlsStream<TcpStream>>,
swap_id: &str,
) -> Result<String> {
loop {
let response: SwapUpdate = serde_json::from_str(&socket.read()?.to_string())
.map_err(|e| anyhow!("WS response is invalid SwapUpdate: {e:?}"))?;
match response {
SwapUpdate::Subscription {
event,
channel,
args,
} => {
ensure!(event == "subscribe", "Wrong WS reply event {event}");
ensure!(channel == "swap.update", "Wrong WS reply channel {channel}");
let first_arg = args.first();
let is_ok = matches!(first_arg.as_ref(), Some(&x) if x == swap_id);
ensure!(is_ok, "Wrong WS reply subscription ID {first_arg:?}");
info!("Subscription successful for swap : {swap_id}");
}
SwapUpdate::Update {
event,
channel,
args,
} => {
ensure!(event == "update", "Wrong WS reply event {event}");
ensure!(channel == "swap.update", "Wrong WS reply channel {channel}");
return match args.first() {
Some(update) if update.id == swap_id => {
info!("Got new swap status: {}", update.status);
Ok(update.status.clone())
}
Some(update) => Err(anyhow!("WS reply has wrong swap ID {update:?}")),
None => Err(anyhow!("WS reply contains no update")),
};
}
SwapUpdate::Error {
event,
channel,
args,
} => {
ensure!(event == "update", "Wrong WS reply event {event}");
ensure!(channel == "swap.update", "Wrong WS reply channel {channel}");
for e in &args {
error!("Got error: {} for swap: {}", e.error, e.id);
}
return Err(anyhow!("Got SwapUpdate errors: {args:?}"));
}
}
}
}
// Fetch the reverse swap status using the websocket endpoint
// pub(crate) fn get_rev_swap_status_v2(
// client_v2: BoltzApiClientV2,
// swap_id: &str,
// ) -> Result<RevSwapStates> {
// let mut socket = client_v2
// .connect_ws()
// .map_err(|e| anyhow!("Failed to connect to websocket: {e:?}"))?;
//
// let sub_id = swap_id.to_string();
// let subscription = Subscription::new(&sub_id);
// let subscribe_json = serde_json::to_string(&subscription)
// .map_err(|e| anyhow!("Failed to serialize subscription msg: {e:?}"))?;
// socket
// .send(tungstenite::Message::Text(subscribe_json))
// .map_err(|e| anyhow!("Failed to subscribe to websocket updates: {e:?}"))?;
//
// loop {
// let response: SwapUpdate = serde_json::from_str(&socket.read()?.to_string())
// .map_err(|e| anyhow!("WS response is invalid SwapUpdate: {e:?}"))?;
//
// match response {
// SwapUpdate::Subscription {
// event,
// channel,
// args,
// } => {
// ensure!(event == "subscribe", "Wrong WS reply event {event}");
// ensure!(channel == "swap.update", "Wrong WS reply channel {channel}");
//
// let first_arg = args.first();
// let is_ok = matches!(first_arg.as_ref(), Some(&x) if x == &sub_id);
// ensure!(is_ok, "Wrong WS reply subscription ID {first_arg:?}");
//
// info!("Subscription successful for swap : {sub_id}");
// }
//
// SwapUpdate::Update {
// event,
// channel,
// args,
// } => {
// ensure!(event == "update", "Wrong WS reply event {event}");
// ensure!(channel == "swap.update", "Wrong WS reply channel {channel}");
//
// return match args.first() {
// Some(update) if update.id == sub_id => {
// info!("Got new reverse swap status: {}", update.status);
//
// RevSwapStates::from_str(&update.status).map_err(|_| {
// anyhow!("Invalid state for rev swap {swap_id}: {}", update.status)
// })
// }
// Some(update) => Err(anyhow!("WS reply has wrong swap ID {update:?}")),
// None => Err(anyhow!("WS reply contains no update")),
// };
// }
//
// SwapUpdate::Error {
// event,
// channel,
// args,
// } => {
// ensure!(event == "update", "Wrong WS reply event {event}");
// ensure!(channel == "swap.update", "Wrong WS reply channel {channel}");
//
// for e in &args {
// error!("Got error: {} for swap: {}", e.error, e.id);
// }
// return Err(anyhow!("Got SwapUpdate errors: {args:?}"));
// }
// }
// }
// }

View File

@@ -29,28 +29,9 @@ Future<ReceivePaymentResponse> receivePayment({required PrepareReceiveResponse r
Future<List<Payment>> listPayments({required bool withScan, required bool includePending, dynamic hint}) =>
RustLib.instance.api.listPayments(withScan: withScan, includePending: includePending, hint: hint);
Future<String> recoverFunds({required LBtcReverseRecovery recovery, dynamic hint}) =>
RustLib.instance.api.recoverFunds(recovery: recovery, hint: hint);
Future<void> emptyWalletCache({dynamic hint}) => RustLib.instance.api.emptyWalletCache(hint: hint);
Future<void> backup({dynamic hint}) => RustLib.instance.api.backup(hint: hint);
Future<void> restore({required RestoreRequest req, dynamic hint}) =>
RustLib.instance.api.restore(req: req, hint: hint);
// Rust type: RustOpaqueNom<flutter_rust_bridge::for_generated::RustAutoOpaqueInner<LBtcReverseRecovery>>
@sealed
class LBtcReverseRecovery extends RustOpaque {
LBtcReverseRecovery.dcoDecode(List<dynamic> wire) : super.dcoDecode(wire, _kStaticData);
LBtcReverseRecovery.sseDecode(int ptr, int externalSizeOnNative)
: super.sseDecode(ptr, externalSizeOnNative, _kStaticData);
static final _kStaticData = RustArcStaticData(
rustArcIncrementStrongCount: RustLib.instance.api.rust_arc_increment_strong_count_LBtcReverseRecovery,
rustArcDecrementStrongCount: RustLib.instance.api.rust_arc_decrement_strong_count_LBtcReverseRecovery,
rustArcDecrementStrongCountPtr:
RustLib.instance.api.rust_arc_decrement_strong_count_LBtcReverseRecoveryPtr,
);
}

View File

@@ -12,11 +12,13 @@ part 'error.freezed.dart';
sealed class PaymentError with _$PaymentError implements FrbException {
const PaymentError._();
const factory PaymentError.amountOutOfRange() = PaymentError_AmountOutOfRange;
const factory PaymentError.alreadyClaimed() = PaymentError_AlreadyClaimed;
const factory PaymentError.amountOutOfRange() = PaymentError_AmountOutOfRange;
const factory PaymentError.generic({
required String err,
}) = PaymentError_Generic;
const factory PaymentError.invalidOrExpiredFees() = PaymentError_InvalidOrExpiredFees;
const factory PaymentError.insufficientFunds() = PaymentError_InsufficientFunds;
const factory PaymentError.invalidInvoice() = PaymentError_InvalidInvoice;
const factory PaymentError.invalidPreimage() = PaymentError_InvalidPreimage;
const factory PaymentError.lwkError({
@@ -24,6 +26,10 @@ sealed class PaymentError with _$PaymentError implements FrbException {
}) = PaymentError_LwkError;
const factory PaymentError.pairsNotFound() = PaymentError_PairsNotFound;
const factory PaymentError.persistError() = PaymentError_PersistError;
const factory PaymentError.refunded({
required String err,
required String txid,
}) = PaymentError_Refunded;
const factory PaymentError.sendError({
required String err,
}) = PaymentError_SendError;

View File

@@ -33,47 +33,6 @@ class _$PaymentErrorCopyWithImpl<$Res, $Val extends PaymentError> implements $Pa
final $Res Function($Val) _then;
}
/// @nodoc
abstract class _$$PaymentError_AmountOutOfRangeImplCopyWith<$Res> {
factory _$$PaymentError_AmountOutOfRangeImplCopyWith(_$PaymentError_AmountOutOfRangeImpl value,
$Res Function(_$PaymentError_AmountOutOfRangeImpl) then) =
__$$PaymentError_AmountOutOfRangeImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_AmountOutOfRangeImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_AmountOutOfRangeImpl>
implements _$$PaymentError_AmountOutOfRangeImplCopyWith<$Res> {
__$$PaymentError_AmountOutOfRangeImplCopyWithImpl(
_$PaymentError_AmountOutOfRangeImpl _value, $Res Function(_$PaymentError_AmountOutOfRangeImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_AmountOutOfRangeImpl extends PaymentError_AmountOutOfRange {
const _$PaymentError_AmountOutOfRangeImpl() : super._();
@override
String toString() {
return 'PaymentError.amountOutOfRange()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$PaymentError_AmountOutOfRangeImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_AmountOutOfRange extends PaymentError {
const factory PaymentError_AmountOutOfRange() = _$PaymentError_AmountOutOfRangeImpl;
const PaymentError_AmountOutOfRange._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_AlreadyClaimedImplCopyWith<$Res> {
factory _$$PaymentError_AlreadyClaimedImplCopyWith(
@@ -115,6 +74,47 @@ abstract class PaymentError_AlreadyClaimed extends PaymentError {
const PaymentError_AlreadyClaimed._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_AmountOutOfRangeImplCopyWith<$Res> {
factory _$$PaymentError_AmountOutOfRangeImplCopyWith(_$PaymentError_AmountOutOfRangeImpl value,
$Res Function(_$PaymentError_AmountOutOfRangeImpl) then) =
__$$PaymentError_AmountOutOfRangeImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_AmountOutOfRangeImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_AmountOutOfRangeImpl>
implements _$$PaymentError_AmountOutOfRangeImplCopyWith<$Res> {
__$$PaymentError_AmountOutOfRangeImplCopyWithImpl(
_$PaymentError_AmountOutOfRangeImpl _value, $Res Function(_$PaymentError_AmountOutOfRangeImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_AmountOutOfRangeImpl extends PaymentError_AmountOutOfRange {
const _$PaymentError_AmountOutOfRangeImpl() : super._();
@override
String toString() {
return 'PaymentError.amountOutOfRange()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$PaymentError_AmountOutOfRangeImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_AmountOutOfRange extends PaymentError {
const factory PaymentError_AmountOutOfRange() = _$PaymentError_AmountOutOfRangeImpl;
const PaymentError_AmountOutOfRange._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_GenericImplCopyWith<$Res> {
factory _$$PaymentError_GenericImplCopyWith(
@@ -187,6 +187,88 @@ abstract class PaymentError_Generic extends PaymentError {
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$PaymentError_InvalidOrExpiredFeesImplCopyWith<$Res> {
factory _$$PaymentError_InvalidOrExpiredFeesImplCopyWith(_$PaymentError_InvalidOrExpiredFeesImpl value,
$Res Function(_$PaymentError_InvalidOrExpiredFeesImpl) then) =
__$$PaymentError_InvalidOrExpiredFeesImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_InvalidOrExpiredFeesImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_InvalidOrExpiredFeesImpl>
implements _$$PaymentError_InvalidOrExpiredFeesImplCopyWith<$Res> {
__$$PaymentError_InvalidOrExpiredFeesImplCopyWithImpl(_$PaymentError_InvalidOrExpiredFeesImpl _value,
$Res Function(_$PaymentError_InvalidOrExpiredFeesImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_InvalidOrExpiredFeesImpl extends PaymentError_InvalidOrExpiredFees {
const _$PaymentError_InvalidOrExpiredFeesImpl() : super._();
@override
String toString() {
return 'PaymentError.invalidOrExpiredFees()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$PaymentError_InvalidOrExpiredFeesImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_InvalidOrExpiredFees extends PaymentError {
const factory PaymentError_InvalidOrExpiredFees() = _$PaymentError_InvalidOrExpiredFeesImpl;
const PaymentError_InvalidOrExpiredFees._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_InsufficientFundsImplCopyWith<$Res> {
factory _$$PaymentError_InsufficientFundsImplCopyWith(_$PaymentError_InsufficientFundsImpl value,
$Res Function(_$PaymentError_InsufficientFundsImpl) then) =
__$$PaymentError_InsufficientFundsImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$PaymentError_InsufficientFundsImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_InsufficientFundsImpl>
implements _$$PaymentError_InsufficientFundsImplCopyWith<$Res> {
__$$PaymentError_InsufficientFundsImplCopyWithImpl(
_$PaymentError_InsufficientFundsImpl _value, $Res Function(_$PaymentError_InsufficientFundsImpl) _then)
: super(_value, _then);
}
/// @nodoc
class _$PaymentError_InsufficientFundsImpl extends PaymentError_InsufficientFunds {
const _$PaymentError_InsufficientFundsImpl() : super._();
@override
String toString() {
return 'PaymentError.insufficientFunds()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$PaymentError_InsufficientFundsImpl);
}
@override
int get hashCode => runtimeType.hashCode;
}
abstract class PaymentError_InsufficientFunds extends PaymentError {
const factory PaymentError_InsufficientFunds() = _$PaymentError_InsufficientFundsImpl;
const PaymentError_InsufficientFunds._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_InvalidInvoiceImplCopyWith<$Res> {
factory _$$PaymentError_InvalidInvoiceImplCopyWith(
@@ -423,6 +505,88 @@ abstract class PaymentError_PersistError extends PaymentError {
const PaymentError_PersistError._() : super._();
}
/// @nodoc
abstract class _$$PaymentError_RefundedImplCopyWith<$Res> {
factory _$$PaymentError_RefundedImplCopyWith(
_$PaymentError_RefundedImpl value, $Res Function(_$PaymentError_RefundedImpl) then) =
__$$PaymentError_RefundedImplCopyWithImpl<$Res>;
@useResult
$Res call({String err, String txid});
}
/// @nodoc
class __$$PaymentError_RefundedImplCopyWithImpl<$Res>
extends _$PaymentErrorCopyWithImpl<$Res, _$PaymentError_RefundedImpl>
implements _$$PaymentError_RefundedImplCopyWith<$Res> {
__$$PaymentError_RefundedImplCopyWithImpl(
_$PaymentError_RefundedImpl _value, $Res Function(_$PaymentError_RefundedImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? err = null,
Object? txid = null,
}) {
return _then(_$PaymentError_RefundedImpl(
err: null == err
? _value.err
: err // ignore: cast_nullable_to_non_nullable
as String,
txid: null == txid
? _value.txid
: txid // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$PaymentError_RefundedImpl extends PaymentError_Refunded {
const _$PaymentError_RefundedImpl({required this.err, required this.txid}) : super._();
@override
final String err;
@override
final String txid;
@override
String toString() {
return 'PaymentError.refunded(err: $err, txid: $txid)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PaymentError_RefundedImpl &&
(identical(other.err, err) || other.err == err) &&
(identical(other.txid, txid) || other.txid == txid));
}
@override
int get hashCode => Object.hash(runtimeType, err, txid);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$PaymentError_RefundedImplCopyWith<_$PaymentError_RefundedImpl> get copyWith =>
__$$PaymentError_RefundedImplCopyWithImpl<_$PaymentError_RefundedImpl>(this, _$identity);
}
abstract class PaymentError_Refunded extends PaymentError {
const factory PaymentError_Refunded({required final String err, required final String txid}) =
_$PaymentError_RefundedImpl;
const PaymentError_Refunded._() : super._();
String get err;
String get txid;
@JsonKey(ignore: true)
_$$PaymentError_RefundedImplCopyWith<_$PaymentError_RefundedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$PaymentError_SendErrorImplCopyWith<$Res> {
factory _$$PaymentError_SendErrorImplCopyWith(

View File

@@ -53,7 +53,7 @@ class RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {
String get codegenVersion => '2.0.0-dev.33';
@override
int get rustContentHash => -1225779344;
int get rustContentHash => -451265040;
static const kDefaultExternalLibraryLoaderConfig = ExternalLibraryLoaderConfig(
stem: 'breez_liquid_sdk',
@@ -79,17 +79,9 @@ abstract class RustLibApi extends BaseApi {
Future<ReceivePaymentResponse> receivePayment({required PrepareReceiveResponse req, dynamic hint});
Future<String> recoverFunds({required LBtcReverseRecovery recovery, dynamic hint});
Future<void> restore({required RestoreRequest req, dynamic hint});
Future<SendPaymentResponse> sendPayment({required PrepareSendResponse req, dynamic hint});
RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_LBtcReverseRecovery;
RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_LBtcReverseRecovery;
CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_LBtcReverseRecoveryPtr;
}
class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
@@ -283,31 +275,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
argNames: ["req"],
);
@override
Future<String> recoverFunds({required LBtcReverseRecovery recovery, dynamic hint}) {
return handler.executeNormal(NormalTask(
callFfi: (port_) {
var arg0 =
cst_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
recovery);
return wire.wire_recover_funds(port_, arg0);
},
codec: DcoCodec(
decodeSuccessData: dco_decode_String,
decodeErrorData: dco_decode_AnyhowException,
),
constMeta: kRecoverFundsConstMeta,
argValues: [recovery],
apiImpl: this,
hint: hint,
));
}
TaskConstMeta get kRecoverFundsConstMeta => const TaskConstMeta(
debugName: "recover_funds",
argNames: ["recovery"],
);
@override
Future<void> restore({required RestoreRequest req, dynamic hint}) {
return handler.executeNormal(NormalTask(
@@ -354,34 +321,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
argNames: ["req"],
);
RustArcIncrementStrongCountFnType get rust_arc_increment_strong_count_LBtcReverseRecovery => wire
.rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery;
RustArcDecrementStrongCountFnType get rust_arc_decrement_strong_count_LBtcReverseRecovery => wire
.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery;
@protected
AnyhowException dco_decode_AnyhowException(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return AnyhowException(raw as String);
}
@protected
LBtcReverseRecovery
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return LBtcReverseRecovery.dcoDecode(raw as List<dynamic>);
}
@protected
LBtcReverseRecovery
dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return LBtcReverseRecovery.dcoDecode(raw as List<dynamic>);
}
@protected
String dco_decode_String(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
@@ -543,30 +488,39 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
// Codec=Dco (DartCObject based), see doc to use other codecs
switch (raw[0]) {
case 0:
return PaymentError_AmountOutOfRange();
case 1:
return PaymentError_AlreadyClaimed();
case 1:
return PaymentError_AmountOutOfRange();
case 2:
return PaymentError_Generic(
err: dco_decode_String(raw[1]),
);
case 3:
return PaymentError_InvalidInvoice();
return PaymentError_InvalidOrExpiredFees();
case 4:
return PaymentError_InvalidPreimage();
return PaymentError_InsufficientFunds();
case 5:
return PaymentError_InvalidInvoice();
case 6:
return PaymentError_InvalidPreimage();
case 7:
return PaymentError_LwkError(
err: dco_decode_String(raw[1]),
);
case 6:
return PaymentError_PairsNotFound();
case 7:
return PaymentError_PersistError();
case 8:
return PaymentError_PairsNotFound();
case 9:
return PaymentError_PersistError();
case 10:
return PaymentError_Refunded(
err: dco_decode_String(raw[1]),
txid: dco_decode_String(raw[2]),
);
case 11:
return PaymentError_SendError(
err: dco_decode_String(raw[1]),
);
case 9:
case 12:
return PaymentError_SignerError(
err: dco_decode_String(raw[1]),
);
@@ -595,11 +549,10 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
PrepareReceiveResponse dco_decode_prepare_receive_response(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
final arr = raw as List<dynamic>;
if (arr.length != 3) throw Exception('unexpected arr length: expect 3 but see ${arr.length}');
if (arr.length != 2) throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
return PrepareReceiveResponse(
pairHash: dco_decode_String(arr[0]),
payerAmountSat: dco_decode_u_64(arr[1]),
feesSat: dco_decode_u_64(arr[2]),
payerAmountSat: dco_decode_u_64(arr[0]),
feesSat: dco_decode_u_64(arr[1]),
);
}
@@ -617,14 +570,10 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
PrepareSendResponse dco_decode_prepare_send_response(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
final arr = raw as List<dynamic>;
if (arr.length != 6) throw Exception('unexpected arr length: expect 6 but see ${arr.length}');
if (arr.length != 2) throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
return PrepareSendResponse(
id: dco_decode_String(arr[0]),
payerAmountSat: dco_decode_u_64(arr[1]),
receiverAmountSat: dco_decode_u_64(arr[2]),
totalFees: dco_decode_u_64(arr[3]),
fundingAddress: dco_decode_String(arr[4]),
invoice: dco_decode_String(arr[5]),
invoice: dco_decode_String(arr[0]),
feesSat: dco_decode_u_64(arr[1]),
);
}
@@ -683,12 +632,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return;
}
@protected
int dco_decode_usize(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return dcoDecodeI64OrU64(raw);
}
@protected
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -696,22 +639,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return AnyhowException(inner);
}
@protected
LBtcReverseRecovery
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
return LBtcReverseRecovery.sseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer));
}
@protected
LBtcReverseRecovery
sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
return LBtcReverseRecovery.sseDecode(sse_decode_usize(deserializer), sse_decode_i_32(deserializer));
}
@protected
String sse_decode_String(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -893,27 +820,35 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
var tag_ = sse_decode_i_32(deserializer);
switch (tag_) {
case 0:
return PaymentError_AmountOutOfRange();
case 1:
return PaymentError_AlreadyClaimed();
case 1:
return PaymentError_AmountOutOfRange();
case 2:
var var_err = sse_decode_String(deserializer);
return PaymentError_Generic(err: var_err);
case 3:
return PaymentError_InvalidInvoice();
return PaymentError_InvalidOrExpiredFees();
case 4:
return PaymentError_InvalidPreimage();
return PaymentError_InsufficientFunds();
case 5:
return PaymentError_InvalidInvoice();
case 6:
return PaymentError_InvalidPreimage();
case 7:
var var_err = sse_decode_String(deserializer);
return PaymentError_LwkError(err: var_err);
case 6:
return PaymentError_PairsNotFound();
case 7:
return PaymentError_PersistError();
case 8:
return PaymentError_PairsNotFound();
case 9:
return PaymentError_PersistError();
case 10:
var var_err = sse_decode_String(deserializer);
var var_txid = sse_decode_String(deserializer);
return PaymentError_Refunded(err: var_err, txid: var_txid);
case 11:
var var_err = sse_decode_String(deserializer);
return PaymentError_SendError(err: var_err);
case 9:
case 12:
var var_err = sse_decode_String(deserializer);
return PaymentError_SignerError(err: var_err);
default:
@@ -938,11 +873,9 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
@protected
PrepareReceiveResponse sse_decode_prepare_receive_response(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var var_pairHash = sse_decode_String(deserializer);
var var_payerAmountSat = sse_decode_u_64(deserializer);
var var_feesSat = sse_decode_u_64(deserializer);
return PrepareReceiveResponse(
pairHash: var_pairHash, payerAmountSat: var_payerAmountSat, feesSat: var_feesSat);
return PrepareReceiveResponse(payerAmountSat: var_payerAmountSat, feesSat: var_feesSat);
}
@protected
@@ -955,19 +888,9 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
@protected
PrepareSendResponse sse_decode_prepare_send_response(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var var_id = sse_decode_String(deserializer);
var var_payerAmountSat = sse_decode_u_64(deserializer);
var var_receiverAmountSat = sse_decode_u_64(deserializer);
var var_totalFees = sse_decode_u_64(deserializer);
var var_fundingAddress = sse_decode_String(deserializer);
var var_invoice = sse_decode_String(deserializer);
return PrepareSendResponse(
id: var_id,
payerAmountSat: var_payerAmountSat,
receiverAmountSat: var_receiverAmountSat,
totalFees: var_totalFees,
fundingAddress: var_fundingAddress,
invoice: var_invoice);
var var_feesSat = sse_decode_u_64(deserializer);
return PrepareSendResponse(invoice: var_invoice, feesSat: var_feesSat);
}
@protected
@@ -1015,28 +938,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
// Codec=Sse (Serialization based), see doc to use other codecs
}
@protected
int sse_decode_usize(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
return deserializer.buffer.getUint64();
}
@protected
int cst_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
LBtcReverseRecovery raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
// ignore: invalid_use_of_internal_member
return raw.cstEncode(move: true);
}
@protected
int cst_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
LBtcReverseRecovery raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
// ignore: invalid_use_of_internal_member
return raw.cstEncode();
}
@protected
bool cst_encode_bool(bool raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
@@ -1079,33 +980,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return raw;
}
@protected
int cst_encode_usize(int raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
return raw;
}
@protected
void sse_encode_AnyhowException(AnyhowException self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
throw UnimplementedError('Unreachable ()');
}
@protected
void
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
LBtcReverseRecovery self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_usize(self.sseEncode(move: true), serializer);
}
@protected
void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
LBtcReverseRecovery self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_usize(self.sseEncode(move: null), serializer);
}
@protected
void sse_encode_String(String self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
@@ -1267,29 +1147,37 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
void sse_encode_payment_error(PaymentError self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
switch (self) {
case PaymentError_AmountOutOfRange():
sse_encode_i_32(0, serializer);
case PaymentError_AlreadyClaimed():
sse_encode_i_32(0, serializer);
case PaymentError_AmountOutOfRange():
sse_encode_i_32(1, serializer);
case PaymentError_Generic(err: final err):
sse_encode_i_32(2, serializer);
sse_encode_String(err, serializer);
case PaymentError_InvalidInvoice():
case PaymentError_InvalidOrExpiredFees():
sse_encode_i_32(3, serializer);
case PaymentError_InvalidPreimage():
case PaymentError_InsufficientFunds():
sse_encode_i_32(4, serializer);
case PaymentError_LwkError(err: final err):
case PaymentError_InvalidInvoice():
sse_encode_i_32(5, serializer);
case PaymentError_InvalidPreimage():
sse_encode_i_32(6, serializer);
case PaymentError_LwkError(err: final err):
sse_encode_i_32(7, serializer);
sse_encode_String(err, serializer);
case PaymentError_PairsNotFound():
sse_encode_i_32(6, serializer);
case PaymentError_PersistError():
sse_encode_i_32(7, serializer);
case PaymentError_SendError(err: final err):
sse_encode_i_32(8, serializer);
case PaymentError_PersistError():
sse_encode_i_32(9, serializer);
case PaymentError_Refunded(err: final err, txid: final txid):
sse_encode_i_32(10, serializer);
sse_encode_String(err, serializer);
sse_encode_String(txid, serializer);
case PaymentError_SendError(err: final err):
sse_encode_i_32(11, serializer);
sse_encode_String(err, serializer);
case PaymentError_SignerError(err: final err):
sse_encode_i_32(9, serializer);
sse_encode_i_32(12, serializer);
sse_encode_String(err, serializer);
}
}
@@ -1309,7 +1197,6 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
@protected
void sse_encode_prepare_receive_response(PrepareReceiveResponse self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_String(self.pairHash, serializer);
sse_encode_u_64(self.payerAmountSat, serializer);
sse_encode_u_64(self.feesSat, serializer);
}
@@ -1323,12 +1210,8 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
@protected
void sse_encode_prepare_send_response(PrepareSendResponse self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_String(self.id, serializer);
sse_encode_u_64(self.payerAmountSat, serializer);
sse_encode_u_64(self.receiverAmountSat, serializer);
sse_encode_u_64(self.totalFees, serializer);
sse_encode_String(self.fundingAddress, serializer);
sse_encode_String(self.invoice, serializer);
sse_encode_u_64(self.feesSat, serializer);
}
@protected
@@ -1372,10 +1255,4 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
void sse_encode_unit(void self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
}
@protected
void sse_encode_usize(int self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
serializer.buffer.putUint64(self);
}
}

View File

@@ -20,22 +20,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
required super.portManager,
});
CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_LBtcReverseRecoveryPtr => wire
._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecoveryPtr;
@protected
AnyhowException dco_decode_AnyhowException(dynamic raw);
@protected
LBtcReverseRecovery
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
dynamic raw);
@protected
LBtcReverseRecovery
dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
dynamic raw);
@protected
String dco_decode_String(dynamic raw);
@@ -141,22 +128,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void dco_decode_unit(dynamic raw);
@protected
int dco_decode_usize(dynamic raw);
@protected
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer);
@protected
LBtcReverseRecovery
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
SseDeserializer deserializer);
@protected
LBtcReverseRecovery
sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
SseDeserializer deserializer);
@protected
String sse_decode_String(SseDeserializer deserializer);
@@ -262,9 +236,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_decode_unit(SseDeserializer deserializer);
@protected
int sse_decode_usize(SseDeserializer deserializer);
@protected
ffi.Pointer<wire_cst_list_prim_u_8_strict> cst_encode_AnyhowException(AnyhowException raw) {
// Codec=Cst (C-struct based), see doc to use other codecs
@@ -463,11 +434,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void cst_api_fill_to_wire_payment_error(PaymentError apiObj, wire_cst_payment_error wireObj) {
if (apiObj is PaymentError_AmountOutOfRange) {
if (apiObj is PaymentError_AlreadyClaimed) {
wireObj.tag = 0;
return;
}
if (apiObj is PaymentError_AlreadyClaimed) {
if (apiObj is PaymentError_AmountOutOfRange) {
wireObj.tag = 1;
return;
}
@@ -477,37 +448,53 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
wireObj.kind.Generic.err = pre_err;
return;
}
if (apiObj is PaymentError_InvalidInvoice) {
if (apiObj is PaymentError_InvalidOrExpiredFees) {
wireObj.tag = 3;
return;
}
if (apiObj is PaymentError_InvalidPreimage) {
if (apiObj is PaymentError_InsufficientFunds) {
wireObj.tag = 4;
return;
}
if (apiObj is PaymentError_InvalidInvoice) {
wireObj.tag = 5;
return;
}
if (apiObj is PaymentError_InvalidPreimage) {
wireObj.tag = 6;
return;
}
if (apiObj is PaymentError_LwkError) {
var pre_err = cst_encode_String(apiObj.err);
wireObj.tag = 5;
wireObj.tag = 7;
wireObj.kind.LwkError.err = pre_err;
return;
}
if (apiObj is PaymentError_PairsNotFound) {
wireObj.tag = 6;
wireObj.tag = 8;
return;
}
if (apiObj is PaymentError_PersistError) {
wireObj.tag = 7;
wireObj.tag = 9;
return;
}
if (apiObj is PaymentError_Refunded) {
var pre_err = cst_encode_String(apiObj.err);
var pre_txid = cst_encode_String(apiObj.txid);
wireObj.tag = 10;
wireObj.kind.Refunded.err = pre_err;
wireObj.kind.Refunded.txid = pre_txid;
return;
}
if (apiObj is PaymentError_SendError) {
var pre_err = cst_encode_String(apiObj.err);
wireObj.tag = 8;
wireObj.tag = 11;
wireObj.kind.SendError.err = pre_err;
return;
}
if (apiObj is PaymentError_SignerError) {
var pre_err = cst_encode_String(apiObj.err);
wireObj.tag = 9;
wireObj.tag = 12;
wireObj.kind.SignerError.err = pre_err;
return;
}
@@ -522,7 +509,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void cst_api_fill_to_wire_prepare_receive_response(
PrepareReceiveResponse apiObj, wire_cst_prepare_receive_response wireObj) {
wireObj.pair_hash = cst_encode_String(apiObj.pairHash);
wireObj.payer_amount_sat = cst_encode_u_64(apiObj.payerAmountSat);
wireObj.fees_sat = cst_encode_u_64(apiObj.feesSat);
}
@@ -536,12 +522,8 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void cst_api_fill_to_wire_prepare_send_response(
PrepareSendResponse apiObj, wire_cst_prepare_send_response wireObj) {
wireObj.id = cst_encode_String(apiObj.id);
wireObj.payer_amount_sat = cst_encode_u_64(apiObj.payerAmountSat);
wireObj.receiver_amount_sat = cst_encode_u_64(apiObj.receiverAmountSat);
wireObj.total_fees = cst_encode_u_64(apiObj.totalFees);
wireObj.funding_address = cst_encode_String(apiObj.fundingAddress);
wireObj.invoice = cst_encode_String(apiObj.invoice);
wireObj.fees_sat = cst_encode_u_64(apiObj.feesSat);
}
@protected
@@ -562,14 +544,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
wireObj.txid = cst_encode_String(apiObj.txid);
}
@protected
int cst_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
LBtcReverseRecovery raw);
@protected
int cst_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
LBtcReverseRecovery raw);
@protected
bool cst_encode_bool(bool raw);
@@ -591,21 +565,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void cst_encode_unit(void raw);
@protected
int cst_encode_usize(int raw);
@protected
void sse_encode_AnyhowException(AnyhowException self, SseSerializer serializer);
@protected
void
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
LBtcReverseRecovery self, SseSerializer serializer);
@protected
void sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
LBtcReverseRecovery self, SseSerializer serializer);
@protected
void sse_encode_String(String self, SseSerializer serializer);
@@ -710,9 +672,6 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_unit(void self, SseSerializer serializer);
@protected
void sse_encode_usize(int self, SseSerializer serializer);
}
// Section: wire_class
@@ -871,20 +830,6 @@ class RustLibWire implements BaseWire {
late final _wire_receive_payment = _wire_receive_paymentPtr
.asFunction<void Function(int, ffi.Pointer<wire_cst_prepare_receive_response>)>();
void wire_recover_funds(
int port_,
int recovery,
) {
return _wire_recover_funds(
port_,
recovery,
);
}
late final _wire_recover_fundsPtr = _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.UintPtr)>>(
'frbgen_breez_liquid_wire_recover_funds');
late final _wire_recover_funds = _wire_recover_fundsPtr.asFunction<void Function(int, int)>();
void wire_restore(
int port_,
ffi.Pointer<wire_cst_restore_request> req,
@@ -917,38 +862,6 @@ class RustLibWire implements BaseWire {
late final _wire_send_payment =
_wire_send_paymentPtr.asFunction<void Function(int, ffi.Pointer<wire_cst_prepare_send_response>)>();
void
rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
ffi.Pointer<ffi.Void> ptr,
) {
return _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
ptr,
);
}
late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecoveryPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
'frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery');
late final _rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery =
_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecoveryPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
void
rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
ffi.Pointer<ffi.Void> ptr,
) {
return _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
ptr,
);
}
late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecoveryPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
'frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery');
late final _rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery =
_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecoveryPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
ffi.Pointer<wire_cst_connect_request> cst_new_box_autoadd_connect_request() {
return _cst_new_box_autoadd_connect_request();
}
@@ -1123,8 +1036,6 @@ final class wire_cst_prepare_send_request extends ffi.Struct {
}
final class wire_cst_prepare_receive_response extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> pair_hash;
@ffi.Uint64()
external int payer_amount_sat;
@@ -1137,20 +1048,10 @@ final class wire_cst_restore_request extends ffi.Struct {
}
final class wire_cst_prepare_send_response extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> id;
@ffi.Uint64()
external int payer_amount_sat;
@ffi.Uint64()
external int receiver_amount_sat;
@ffi.Uint64()
external int total_fees;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> funding_address;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> invoice;
@ffi.Uint64()
external int fees_sat;
}
final class wire_cst_payment extends ffi.Struct {
@@ -1191,6 +1092,12 @@ final class wire_cst_PaymentError_LwkError extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
}
final class wire_cst_PaymentError_Refunded extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> txid;
}
final class wire_cst_PaymentError_SendError extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
}
@@ -1204,6 +1111,8 @@ final class PaymentErrorKind extends ffi.Union {
external wire_cst_PaymentError_LwkError LwkError;
external wire_cst_PaymentError_Refunded Refunded;
external wire_cst_PaymentError_SendError SendError;
external wire_cst_PaymentError_SignerError SignerError;
@@ -1226,4 +1135,4 @@ final class wire_cst_send_payment_response extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> txid;
}
const double LIQUID_CLAIM_TX_FEERATE = 0.1;
const double LIQUID_CLAIM_TX_FEERATE_MSAT = 100.0;

View File

@@ -79,8 +79,6 @@ class Payment {
final int amountSat;
final int? feesSat;
final PaymentType paymentType;
/// Only for [PaymentType::PendingReceive]
final String? invoice;
const Payment({
@@ -141,25 +139,22 @@ class PrepareReceiveRequest {
}
class PrepareReceiveResponse {
final String pairHash;
final int payerAmountSat;
final int feesSat;
const PrepareReceiveResponse({
required this.pairHash,
required this.payerAmountSat,
required this.feesSat,
});
@override
int get hashCode => pairHash.hashCode ^ payerAmountSat.hashCode ^ feesSat.hashCode;
int get hashCode => payerAmountSat.hashCode ^ feesSat.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is PrepareReceiveResponse &&
runtimeType == other.runtimeType &&
pairHash == other.pairHash &&
payerAmountSat == other.payerAmountSat &&
feesSat == other.feesSat;
}
@@ -181,42 +176,24 @@ class PrepareSendRequest {
}
class PrepareSendResponse {
final String id;
final int payerAmountSat;
final int receiverAmountSat;
final int totalFees;
final String fundingAddress;
final String invoice;
final int feesSat;
const PrepareSendResponse({
required this.id,
required this.payerAmountSat,
required this.receiverAmountSat,
required this.totalFees,
required this.fundingAddress,
required this.invoice,
required this.feesSat,
});
@override
int get hashCode =>
id.hashCode ^
payerAmountSat.hashCode ^
receiverAmountSat.hashCode ^
totalFees.hashCode ^
fundingAddress.hashCode ^
invoice.hashCode;
int get hashCode => invoice.hashCode ^ feesSat.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is PrepareSendResponse &&
runtimeType == other.runtimeType &&
id == other.id &&
payerAmountSat == other.payerAmountSat &&
receiverAmountSat == other.receiverAmountSat &&
totalFees == other.totalFees &&
fundingAddress == other.fundingAddress &&
invoice == other.invoice;
invoice == other.invoice &&
feesSat == other.feesSat;
}
class ReceivePaymentResponse {

View File

@@ -23,6 +23,6 @@ dev_dependencies:
test: ^1.25.4
dependencies:
ffi: ^2.1.2
flutter_rust_bridge: ">=2.0.0-dev.0 <=2.0.0-dev.33"
flutter_rust_bridge: 2.0.0-dev.33
freezed_annotation: ^2.4.1
meta: ^1.11.0

View File

@@ -106,11 +106,7 @@ class _MyAppState extends State<MyApp> {
return const Text('Loading...');
}
if (snapshot.requireData.pairHash.isEmpty) {
return const Text('No pair hash.');
}
final prepareReceiveResponse = snapshot.data!;
debugPrint(prepareReceiveResponse.pairHash);
return Column(
children: [
@@ -121,9 +117,6 @@ class _MyAppState extends State<MyApp> {
style: Theme.of(context).textTheme.headlineSmall,
),
),
ListTile(
title: Text("Pair Hash: ${prepareReceiveResponse.pairHash}"),
),
ListTile(
title: Text("Payer Amount: ${prepareReceiveResponse.payerAmountSat} (in sats)"),
),

View File

@@ -17,4 +17,4 @@ preamble: |
comments:
style: any
length: full
ignore-source-errors: true
ignore-source-errors: true

View File

@@ -164,22 +164,6 @@ class FlutterBreezLiquidBindings {
late final _frbgen_breez_liquid_wire_receive_payment = _frbgen_breez_liquid_wire_receive_paymentPtr
.asFunction<void Function(int, ffi.Pointer<wire_cst_prepare_receive_response>)>();
void frbgen_breez_liquid_wire_recover_funds(
int port_,
int recovery,
) {
return _frbgen_breez_liquid_wire_recover_funds(
port_,
recovery,
);
}
late final _frbgen_breez_liquid_wire_recover_fundsPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.UintPtr)>>(
'frbgen_breez_liquid_wire_recover_funds');
late final _frbgen_breez_liquid_wire_recover_funds =
_frbgen_breez_liquid_wire_recover_fundsPtr.asFunction<void Function(int, int)>();
void frbgen_breez_liquid_wire_restore(
int port_,
ffi.Pointer<wire_cst_restore_request> req,
@@ -212,38 +196,6 @@ class FlutterBreezLiquidBindings {
late final _frbgen_breez_liquid_wire_send_payment = _frbgen_breez_liquid_wire_send_paymentPtr
.asFunction<void Function(int, ffi.Pointer<wire_cst_prepare_send_response>)>();
void
frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
ffi.Pointer<ffi.Void> ptr,
) {
return _frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
ptr,
);
}
late final _frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecoveryPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
'frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery');
late final _frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery =
_frbgen_breez_liquid_rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecoveryPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
void
frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
ffi.Pointer<ffi.Void> ptr,
) {
return _frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery(
ptr,
);
}
late final _frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecoveryPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>(
'frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery');
late final _frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecovery =
_frbgen_breez_liquid_rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerLBtcReverseRecoveryPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
ffi.Pointer<wire_cst_connect_request> frbgen_breez_liquid_cst_new_box_autoadd_connect_request() {
return _frbgen_breez_liquid_cst_new_box_autoadd_connect_request();
}
@@ -440,8 +392,6 @@ final class wire_cst_prepare_send_request extends ffi.Struct {
}
final class wire_cst_prepare_receive_response extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> pair_hash;
@ffi.Uint64()
external int payer_amount_sat;
@@ -454,20 +404,10 @@ final class wire_cst_restore_request extends ffi.Struct {
}
final class wire_cst_prepare_send_response extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> id;
@ffi.Uint64()
external int payer_amount_sat;
@ffi.Uint64()
external int receiver_amount_sat;
@ffi.Uint64()
external int total_fees;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> funding_address;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> invoice;
@ffi.Uint64()
external int fees_sat;
}
final class wire_cst_payment extends ffi.Struct {
@@ -508,6 +448,12 @@ final class wire_cst_PaymentError_LwkError extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
}
final class wire_cst_PaymentError_Refunded extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
external ffi.Pointer<wire_cst_list_prim_u_8_strict> txid;
}
final class wire_cst_PaymentError_SendError extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> err;
}
@@ -521,6 +467,8 @@ final class PaymentErrorKind extends ffi.Union {
external wire_cst_PaymentError_LwkError LwkError;
external wire_cst_PaymentError_Refunded Refunded;
external wire_cst_PaymentError_SendError SendError;
external wire_cst_PaymentError_SignerError SignerError;
@@ -543,4 +491,4 @@ final class wire_cst_send_payment_response extends ffi.Struct {
external ffi.Pointer<wire_cst_list_prim_u_8_strict> txid;
}
const double LIQUID_CLAIM_TX_FEERATE = 0.1;
const double LIQUID_CLAIM_TX_FEERATE_MSAT = 100.0;

View File

@@ -150,7 +150,6 @@ fun asPrepareReceiveResponse(prepareReceiveResponse: ReadableMap): PrepareReceiv
if (!validateMandatoryFields(
prepareReceiveResponse,
arrayOf(
"pairHash",
"payerAmountSat",
"feesSat",
),
@@ -158,11 +157,9 @@ fun asPrepareReceiveResponse(prepareReceiveResponse: ReadableMap): PrepareReceiv
) {
return null
}
val pairHash = prepareReceiveResponse.getString("pairHash")!!
val payerAmountSat = prepareReceiveResponse.getDouble("payerAmountSat").toULong()
val feesSat = prepareReceiveResponse.getDouble("feesSat").toULong()
return PrepareReceiveResponse(
pairHash,
payerAmountSat,
feesSat,
)
@@ -170,7 +167,6 @@ fun asPrepareReceiveResponse(prepareReceiveResponse: ReadableMap): PrepareReceiv
fun readableMapOf(prepareReceiveResponse: PrepareReceiveResponse): ReadableMap {
return readableMapOf(
"pairHash" to prepareReceiveResponse.pairHash,
"payerAmountSat" to prepareReceiveResponse.payerAmountSat,
"feesSat" to prepareReceiveResponse.feesSat,
)
@@ -224,41 +220,25 @@ fun asPrepareSendResponse(prepareSendResponse: ReadableMap): PrepareSendResponse
if (!validateMandatoryFields(
prepareSendResponse,
arrayOf(
"id",
"payerAmountSat",
"receiverAmountSat",
"totalFees",
"fundingAddress",
"invoice",
"feesSat",
),
)
) {
return null
}
val id = prepareSendResponse.getString("id")!!
val payerAmountSat = prepareSendResponse.getDouble("payerAmountSat").toULong()
val receiverAmountSat = prepareSendResponse.getDouble("receiverAmountSat").toULong()
val totalFees = prepareSendResponse.getDouble("totalFees").toULong()
val fundingAddress = prepareSendResponse.getString("fundingAddress")!!
val invoice = prepareSendResponse.getString("invoice")!!
val feesSat = prepareSendResponse.getDouble("feesSat").toULong()
return PrepareSendResponse(
id,
payerAmountSat,
receiverAmountSat,
totalFees,
fundingAddress,
invoice,
feesSat,
)
}
fun readableMapOf(prepareSendResponse: PrepareSendResponse): ReadableMap {
return readableMapOf(
"id" to prepareSendResponse.id,
"payerAmountSat" to prepareSendResponse.payerAmountSat,
"receiverAmountSat" to prepareSendResponse.receiverAmountSat,
"totalFees" to prepareSendResponse.totalFees,
"fundingAddress" to prepareSendResponse.fundingAddress,
"invoice" to prepareSendResponse.invoice,
"feesSat" to prepareSendResponse.feesSat,
)
}

View File

@@ -154,9 +154,6 @@ enum BreezLiquidSDKMapper {
}
static func asPrepareReceiveResponse(prepareReceiveResponse: [String: Any?]) throws -> PrepareReceiveResponse {
guard let pairHash = prepareReceiveResponse["pairHash"] as? String else {
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "pairHash", typeName: "PrepareReceiveResponse"))
}
guard let payerAmountSat = prepareReceiveResponse["payerAmountSat"] as? UInt64 else {
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "payerAmountSat", typeName: "PrepareReceiveResponse"))
}
@@ -165,7 +162,6 @@ enum BreezLiquidSDKMapper {
}
return PrepareReceiveResponse(
pairHash: pairHash,
payerAmountSat: payerAmountSat,
feesSat: feesSat
)
@@ -173,7 +169,6 @@ enum BreezLiquidSDKMapper {
static func dictionaryOf(prepareReceiveResponse: PrepareReceiveResponse) -> [String: Any?] {
return [
"pairHash": prepareReceiveResponse.pairHash,
"payerAmountSat": prepareReceiveResponse.payerAmountSat,
"feesSat": prepareReceiveResponse.feesSat,
]
@@ -229,43 +224,23 @@ enum BreezLiquidSDKMapper {
}
static func asPrepareSendResponse(prepareSendResponse: [String: Any?]) throws -> PrepareSendResponse {
guard let id = prepareSendResponse["id"] as? String else {
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "id", typeName: "PrepareSendResponse"))
}
guard let payerAmountSat = prepareSendResponse["payerAmountSat"] as? UInt64 else {
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "payerAmountSat", typeName: "PrepareSendResponse"))
}
guard let receiverAmountSat = prepareSendResponse["receiverAmountSat"] as? UInt64 else {
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "receiverAmountSat", typeName: "PrepareSendResponse"))
}
guard let totalFees = prepareSendResponse["totalFees"] as? UInt64 else {
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "totalFees", typeName: "PrepareSendResponse"))
}
guard let fundingAddress = prepareSendResponse["fundingAddress"] as? String else {
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "fundingAddress", typeName: "PrepareSendResponse"))
}
guard let invoice = prepareSendResponse["invoice"] as? String else {
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "invoice", typeName: "PrepareSendResponse"))
}
guard let feesSat = prepareSendResponse["feesSat"] as? UInt64 else {
throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "feesSat", typeName: "PrepareSendResponse"))
}
return PrepareSendResponse(
id: id,
payerAmountSat: payerAmountSat,
receiverAmountSat: receiverAmountSat,
totalFees: totalFees,
fundingAddress: fundingAddress,
invoice: invoice
invoice: invoice,
feesSat: feesSat
)
}
static func dictionaryOf(prepareSendResponse: PrepareSendResponse) -> [String: Any?] {
return [
"id": prepareSendResponse.id,
"payerAmountSat": prepareSendResponse.payerAmountSat,
"receiverAmountSat": prepareSendResponse.receiverAmountSat,
"totalFees": prepareSendResponse.totalFees,
"fundingAddress": prepareSendResponse.fundingAddress,
"invoice": prepareSendResponse.invoice,
"feesSat": prepareSendResponse.feesSat,
]
}

View File

@@ -37,7 +37,6 @@ export interface PrepareReceiveRequest {
}
export interface PrepareReceiveResponse {
pairHash: string
payerAmountSat: number
feesSat: number
}
@@ -47,12 +46,8 @@ export interface PrepareSendRequest {
}
export interface PrepareSendResponse {
id: string
payerAmountSat: number
receiverAmountSat: number
totalFees: number
fundingAddress: string
invoice: string
feesSat: number
}
export interface ReceivePaymentResponse {