diff --git a/Cargo.lock b/Cargo.lock index 587ca83..928f338 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,6 +34,18 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -43,6 +55,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -60,22 +78,22 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "aquamarine" -version = "0.3.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1da02abba9f9063d786eab1509833ebb2fac0f966862ca59439c76b9c566760" +checksum = "21cc1548309245035eb18aa7f0967da6bc65587005170c56e6ef2788a4cf3f4e" dependencies = [ "include_dir", "itertools 0.10.5", "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.50", ] [[package]] @@ -108,11 +126,13 @@ dependencies = [ [[package]] name = "async-lock" -version = "2.8.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" dependencies = [ "event-listener", + "event-listener-strategy", + "pin-project-lite", ] [[package]] @@ -166,7 +186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3716c0d3970fe92d79a8f4cda2caf91113574505dff5b18e455e549d4b078e98" dependencies = [ "futures-util", - "gloo-timers", + "gloo-timers 0.2.6", "tokio", "wasm-bindgen-futures", ] @@ -272,15 +292,15 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.20.0" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.21.7" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" [[package]] name = "base64-compat" @@ -336,17 +356,16 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.65.1" +version = "0.69.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "cexpr", "clang-sys", + "itertools 0.10.5", "lazy_static", "lazycell", - "peeking_take_while", - "prettyplease", "proc-macro2", "quote", "regex", @@ -472,6 +491,12 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +[[package]] +name = "bitmaps" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d084b0137aaa901caf9f1e8b21daa6aa24d41cd806e111335541eff9683bd6" + [[package]] name = "bitvec" version = "1.0.1" @@ -501,13 +526,13 @@ dependencies = [ "async-trait", "axum", "base64 0.13.1", - "bls12_381", "chrono", "diesel", "dotenv", "fedimint-client", "fedimint-core", "fedimint-ln-client", + "fedimint-ln-common", "fedimint-mint-client", "fedimint-tbs", "fedimint-wallet-client", @@ -516,7 +541,6 @@ dependencies = [ "itertools 0.12.1", "jwt-compact", "lazy-regex", - "lightning-invoice 0.27.0", "log", "mockall", "mockito", @@ -768,6 +792,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "concurrent-queue" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -843,6 +876,41 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.50", +] + +[[package]] +name = "darling_macro" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.50", +] + [[package]] name = "data-encoding" version = "2.5.0" @@ -963,9 +1031,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.3.31" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c138974f9d5e7fe373eb04df7cae98833802ae4b11c24ac7039a21d5af4b26c" +checksum = "2b73807008a3c7f171cc40312f37d95ef0396e048b5848d775f54b1a4dd4a0d3" dependencies = [ "serde", ] @@ -994,27 +1062,35 @@ dependencies = [ [[package]] name = "event-listener" -version = "2.5.3" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] [[package]] -name = "fastrand" -version = "2.0.1" +name = "event-listener-strategy" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" +dependencies = [ + "event-listener", + "pin-project-lite", +] [[package]] -name = "fedimint" -version = "0.0.1" +name = "fastrand" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d79878f18e518d77cfb3126939d0e63a62cad845d51a3266f4ac866f2efe57f" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fedimint-aead" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6258d6dbd7b7f5dc1d62f26e64d47692c495d24c17c7b113b01e0a40ef5d6235" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "argon2", @@ -1025,9 +1101,8 @@ dependencies = [ [[package]] name = "fedimint-bitcoind" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a746535346df82a3c6e8646364dec07112fe64bb7c2491bd5c3b0830c082e16" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "async-trait", @@ -1040,24 +1115,23 @@ dependencies = [ "lazy_static", "rand", "serde", + "serde_json", "tracing", "url", ] [[package]] name = "fedimint-build" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48daee360af91937bf9f6c35e6da164d8574eb934d14b47f92668223b74cf995" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "serde_json", ] [[package]] name = "fedimint-client" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0e9c9046e3de54424108deefbd3501a92a48d2bc22f1af3d05242f29f5b7c31" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "aquamarine", @@ -1071,7 +1145,7 @@ dependencies = [ "fedimint-derive-secret", "fedimint-logging", "futures", - "itertools 0.10.5", + "itertools 0.12.1", "rand", "ring 0.17.8", "secp256k1-zkp", @@ -1081,14 +1155,14 @@ dependencies = [ "strum_macros", "thiserror", "tokio", + "tokio-stream", "tracing", ] [[package]] name = "fedimint-core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1397d89ac6951d49920001fd14b280b33a78de380e0d0db442021b00ca366e6" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "async-lock", @@ -1108,18 +1182,20 @@ dependencies = [ "fedimint-threshold-crypto", "futures", "getrandom", - "gloo-timers", + "gloo-timers 0.3.0", "hex", - "itertools 0.10.5", + "imbl", + "itertools 0.12.1", "js-sys", "jsonrpsee-core", "jsonrpsee-types", "jsonrpsee-wasm-client", "jsonrpsee-ws-client", - "lightning 0.0.118", - "lightning-invoice 0.26.0", + "lightning", + "lightning-invoice", + "lru", "macro_rules_attribute", - "miniscript", + "miniscript 10.0.0", "parity-scale-codec", "rand", "secp256k1-zkp", @@ -1138,21 +1214,19 @@ dependencies = [ [[package]] name = "fedimint-derive" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7490ad865cb9d8a3b5d24e0d38578df143fbe167f6cc80669a3bc7d5bc5b36d0" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ - "itertools 0.11.0", + "itertools 0.12.1", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.50", ] [[package]] name = "fedimint-derive-secret" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faacc99cbacf014e999865150f82d43808c26ac6dd07725a1d22406dce4f7b3a" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "fedimint-core", @@ -1164,18 +1238,16 @@ dependencies = [ [[package]] name = "fedimint-hkdf" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da421d229333ce5c80bf6403165a1afe831556145a3983ac3eecbce4f1a79132" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "bitcoin_hashes 0.11.0", ] [[package]] name = "fedimint-ln-client" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00f779dbc9b27274e166d4b0f790bf44bb9d3483db72f5c629e596d8218e2c9" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "aquamarine", @@ -1190,8 +1262,8 @@ dependencies = [ "fedimint-ln-common", "fedimint-threshold-crypto", "futures", - "itertools 0.10.5", - "lightning-invoice 0.26.0", + "itertools 0.12.1", + "lightning-invoice", "rand", "reqwest", "secp256k1 0.24.3", @@ -1208,9 +1280,8 @@ dependencies = [ [[package]] name = "fedimint-ln-common" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b56e00695812c1b300d9a97ea58edb2a8fde1f9f4b9771085de8f2eead30e3d4" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "aquamarine", @@ -1222,9 +1293,9 @@ dependencies = [ "fedimint-core", "fedimint-threshold-crypto", "futures", - "itertools 0.10.5", - "lightning 0.0.118", - "lightning-invoice 0.26.0", + "itertools 0.12.1", + "lightning", + "lightning-invoice", "rand", "secp256k1 0.24.3", "serde", @@ -1239,9 +1310,8 @@ dependencies = [ [[package]] name = "fedimint-logging" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14549cd81f904053dd43eeedc2c021c1f660f6d46257f8286b9d5d8c425bdb5e" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "tracing-subscriber", @@ -1249,15 +1319,14 @@ dependencies = [ [[package]] name = "fedimint-mint-client" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee3945f8d4d9c807672ee10b8db4998e0718bcf9dfaa277755f8d03cc9cfc561" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "aquamarine", "async-stream", "async-trait", - "base64 0.20.0", + "base64 0.22.0", "bincode", "bitcoin_hashes 0.11.0", "erased-serde", @@ -1269,7 +1338,7 @@ dependencies = [ "fedimint-tbs", "fedimint-threshold-crypto", "futures", - "itertools 0.10.5", + "itertools 0.12.1", "rand", "secp256k1 0.24.3", "secp256k1-zkp", @@ -1285,9 +1354,8 @@ dependencies = [ [[package]] name = "fedimint-mint-common" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d21c16ea6bec68e01fd8fa7a1d3526121c9679bc8fc83fd9d29b977cc447af4" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "async-trait", @@ -1297,7 +1365,7 @@ dependencies = [ "fedimint-tbs", "fedimint-threshold-crypto", "futures", - "itertools 0.10.5", + "itertools 0.12.1", "rand", "secp256k1 0.24.3", "secp256k1-zkp", @@ -1310,9 +1378,8 @@ dependencies = [ [[package]] name = "fedimint-rocksdb" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e13f4613c2eba7cc6a371d37ab0d869d6e2ba6496882f8502cb00c3c3d57627" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "async-trait", @@ -1325,9 +1392,8 @@ dependencies = [ [[package]] name = "fedimint-tbs" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9cfde5114fb8ccb2abc1b0a4807e5af9fa03027a54d75209cb301edd77c29cd" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "bitcoin_hashes 0.11.0", "bls12_381", @@ -1363,9 +1429,8 @@ dependencies = [ [[package]] name = "fedimint-wallet-client" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a4bafd7b495455f3c2fb4324fe4f7c15cf43ec01f9ce319805dc0af2708dac" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "aquamarine", @@ -1379,7 +1444,7 @@ dependencies = [ "fedimint-wallet-common", "futures", "impl-tools", - "miniscript", + "miniscript 10.0.0", "rand", "secp256k1 0.24.3", "serde", @@ -1395,9 +1460,8 @@ dependencies = [ [[package]] name = "fedimint-wallet-common" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27dc03be27d18fdb4e444b4801267cc219b5eccd5e0ef3521faa42a508b0f341" +version = "0.3.0-rc.2" +source = "git+https://github.com/fedimint/fedimint?tag=v0.3.0-rc.2#44f129b216df39a4d896f96146eb89efe264d838" dependencies = [ "anyhow", "async-trait", @@ -1406,7 +1470,8 @@ dependencies = [ "fedimint-core", "futures", "impl-tools", - "miniscript", + "miniscript 10.0.0", + "miniscript 9.0.2", "rand", "secp256k1 0.24.3", "serde", @@ -1557,7 +1622,7 @@ version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" dependencies = [ - "gloo-timers", + "gloo-timers 0.2.6", "send_wrapper 0.4.0", ] @@ -1616,9 +1681,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "gloo-net" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ac9e8288ae2c632fa9f8657ac70bfe38a1530f345282d7ba66a1f70b72b7dc4" +checksum = "43aaa242d1239a8822c15c645f02166398da4f8b5c4bae795c1f5b44e9eee173" dependencies = [ "futures-channel", "futures-core", @@ -1647,6 +1712,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gloo-timers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "gloo-utils" version = "0.2.0" @@ -1706,7 +1783,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" dependencies = [ - "ahash", + "ahash 0.3.8", "autocfg", ] @@ -1721,6 +1798,10 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash 0.8.11", + "allocator-api2", +] [[package]] name = "headers" @@ -1924,14 +2005,10 @@ dependencies = [ ] [[package]] -name = "idna" -version = "0.4.0" +name = "ident_case" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" @@ -1944,33 +2021,49 @@ dependencies = [ ] [[package]] -name = "if_chain" -version = "1.0.2" +name = "imbl" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978d142c8028edf52095703af2fad11d6f611af1246685725d6b850634647085" +dependencies = [ + "bitmaps", + "imbl-sized-chunks", + "rand_core", + "rand_xoshiro", + "version_check", +] + +[[package]] +name = "imbl-sized-chunks" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" +checksum = "144006fb58ed787dcae3f54575ff4349755b00ccc99f4b4873860b654be1ed63" +dependencies = [ + "bitmaps", +] [[package]] name = "impl-tools" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bde75c0fa563af28932bd7317eaa58186d4d29043858f5f3a8c199076c06da7" +checksum = "d82c305b1081f1a99fda262883c788e50ab57d36c00830bdd7e0a82894ad965c" dependencies = [ "autocfg", "impl-tools-lib", "proc-macro-error", - "syn 1.0.109", + "syn 2.0.50", ] [[package]] name = "impl-tools-lib" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ffdf3b0bdfaa18798f4df71bc965704f63fba521b24d425cd61fb2bc771a77b" +checksum = "85d3946d886eaab0702fa0c6585adcced581513223fa9df7ccfabbd9fa331a88" dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.50", ] [[package]] @@ -2071,15 +2164,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.1" @@ -2106,9 +2190,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -2127,9 +2211,9 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.20.3" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b005c793122d03217da09af68ba9383363caa950b90d3436106df8cabce935" +checksum = "9ab2e14e727d2faf388c99d9ca5210566ed3b044f07d92c29c3611718d178380" dependencies = [ "futures-channel", "futures-util", @@ -2137,21 +2221,22 @@ dependencies = [ "http", "jsonrpsee-core", "pin-project", + "rustls-pki-types", "soketto", "thiserror", "tokio", - "tokio-rustls 0.24.1", + "tokio-rustls 0.25.0", "tokio-util", "tracing", "url", - "webpki-roots", + "webpki-roots 0.26.1", ] [[package]] name = "jsonrpsee-core" -version = "0.20.3" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2327ba8df2fdbd5e897e2b5ed25ce7f299d345b9736b6828814c3dbd1fd47b" +checksum = "71962a1c49af43adf81d337e4ebc93f3c915faf6eccaa14d74e255107dfd7723" dependencies = [ "anyhow", "async-lock", @@ -2160,34 +2245,35 @@ dependencies = [ "futures-timer", "futures-util", "jsonrpsee-types", + "pin-project", "rustc-hash", "serde", "serde_json", "thiserror", "tokio", + "tokio-stream", "tracing", "wasm-bindgen-futures", ] [[package]] name = "jsonrpsee-types" -version = "0.20.3" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be0be325642e850ed0bdff426674d2e66b2b7117c9be23a7caef68a2902b7d9" +checksum = "1e53c72de6cd2ad6ac1aa6e848206ef8b736f92ed02354959130373dfa5b3cbd" dependencies = [ "anyhow", "beef", "serde", "serde_json", "thiserror", - "tracing", ] [[package]] name = "jsonrpsee-wasm-client" -version = "0.20.3" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c7cbb3447cf14fd4d2f407c3cc96e6c9634d5440aa1fbed868a31f3c02b27f0" +checksum = "8ae2c3f2411052b4a831cb7a34cd1498e0d8b9309bd49fca67567634ff64023d" dependencies = [ "jsonrpsee-client-transport", "jsonrpsee-core", @@ -2196,9 +2282,9 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.20.3" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca9cb3933ccae417eb6b08c3448eb1cb46e39834e5b503e395e5e5bd08546c0" +checksum = "c8a07ab8da9a283b906f6735ddd17d3680158bb72259e853441d1dd0167079ec" dependencies = [ "http", "jsonrpsee-client-transport", @@ -2297,9 +2383,9 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "librocksdb-sys" -version = "0.11.0+8.1.1" +version = "0.16.0+8.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" +checksum = "ce3d60bc059831dc1c83903fb45c103f75db65c5a7bf22272764d9cc683e348c" dependencies = [ "bindgen", "bzip2-sys", @@ -2333,16 +2419,6 @@ dependencies = [ "hashbrown 0.8.2", ] -[[package]] -name = "lightning" -version = "0.0.119" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32899363dc48d297838ce1264c4bb6867ede6ec11f06f3b9823f3ff403f1ccc2" -dependencies = [ - "bitcoin 0.30.2", - "hex-conservative", -] - [[package]] name = "lightning-invoice" version = "0.26.0" @@ -2352,25 +2428,12 @@ dependencies = [ "bech32", "bitcoin 0.29.2", "bitcoin_hashes 0.11.0", - "lightning 0.0.118", + "lightning", "num-traits", "secp256k1 0.24.3", "serde", ] -[[package]] -name = "lightning-invoice" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3421ccfaeac77763114f68f3fc5308f11a0e8a880618b4f84d1d22493aa465" -dependencies = [ - "bech32", - "bitcoin 0.30.2", - "lightning 0.0.119", - "num-traits", - "secp256k1 0.27.0", -] - [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -2393,6 +2456,15 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "lru" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +dependencies = [ + "hashbrown 0.14.3", +] + [[package]] name = "lz4-sys" version = "1.9.4" @@ -2405,9 +2477,9 @@ dependencies = [ [[package]] name = "macro_rules_attribute" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf0c9b980bf4f3a37fd7b1c066941dd1b1d0152ce6ee6e8fe8c49b9f6810d862" +checksum = "8a82271f7bc033d84bbca59a3ce3e4159938cb08a9c3aebbe54d215131518a13" dependencies = [ "macro_rules_attribute-proc_macro", "paste", @@ -2415,9 +2487,9 @@ dependencies = [ [[package]] name = "macro_rules_attribute-proc_macro" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58093314a45e00c77d5c508f76e77c3396afbbc0d01506e7fae47b018bac2b1d" +checksum = "b8dd856d451cc0da70e2ef2ce95a18e39a93b7558bedf10201ad28503f918568" [[package]] name = "matchers" @@ -2459,6 +2531,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5b106477a0709e2da253e5559ba4ab20a272f8577f1eefff72f3a905b5d35f5" dependencies = [ "bitcoin 0.29.2", +] + +[[package]] +name = "miniscript" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1eb102b66b2127a872dbcc73095b7b47aeb9d92f7b03c2b2298253ffc82c7594" +dependencies = [ + "bitcoin 0.30.2", + "bitcoin-private", "serde", ] @@ -2530,11 +2612,10 @@ dependencies = [ [[package]] name = "multimint" -version = "0.1.7" -source = "git+https://github.com/Kodylow/multimint?rev=00df9d34f0244d0200eee4d285094b22b34cf38b#00df9d34f0244d0200eee4d285094b22b34cf38b" +version = "0.1.12" +source = "git+https://github.com/fedimint/fedimint-clientd?rev=16fe9dd32c745267304a55aacee9501050bb03fa#16fe9dd32c745267304a55aacee9501050bb03fa" dependencies = [ "anyhow", - "fedimint", "fedimint-client", "fedimint-core", "fedimint-ln-client", @@ -2542,6 +2623,7 @@ dependencies = [ "fedimint-rocksdb", "fedimint-wallet-client", "futures-util", + "hex", "rand", "serde", "serde_json", @@ -2666,7 +2748,7 @@ dependencies = [ "tokio-tungstenite", "url-fork", "wasm-ws", - "webpki-roots", + "webpki-roots 0.25.4", ] [[package]] @@ -2830,6 +2912,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + [[package]] name = "parking_lot" version = "0.12.1" @@ -2870,12 +2958,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "percent-encoding" version = "2.3.1" @@ -2985,16 +3067,6 @@ dependencies = [ "log", ] -[[package]] -name = "prettyplease" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" -dependencies = [ - "proc-macro2", - "syn 2.0.50", -] - [[package]] name = "proc-macro-crate" version = "2.0.2" @@ -3094,6 +3166,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core", +] + [[package]] name = "rayon" version = "1.8.1" @@ -3169,9 +3250,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.24" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64 0.21.7", "bytes", @@ -3208,7 +3289,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", + "webpki-roots 0.25.4", "winreg", ] @@ -3244,9 +3325,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" +checksum = "6bd13e55d6d7b8cd0ea569161127567cd587676c99f4472f779a0279aa60a7a7" dependencies = [ "libc", "librocksdb-sys", @@ -3306,10 +3387,24 @@ checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring 0.17.8", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +dependencies = [ + "log", + "ring 0.17.8", + "rustls-pki-types", + "rustls-webpki 0.102.2", + "subtle", + "zeroize", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -3319,6 +3414,12 @@ dependencies = [ "base64 0.21.7", ] +[[package]] +name = "rustls-pki-types" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ede67b28608b4c60685c7d54122d4400d90f62b40caee7700e700380a390fa8" + [[package]] name = "rustls-webpki" version = "0.101.7" @@ -3329,6 +3430,17 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "rustls-webpki" +version = "0.102.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" +dependencies = [ + "ring 0.17.8", + "rustls-pki-types", + "untrusted 0.9.0", +] + [[package]] name = "rustversion" version = "1.0.14" @@ -3696,21 +3808,21 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" -version = "0.24.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", - "syn 1.0.109", + "syn 2.0.50", ] [[package]] @@ -3809,18 +3921,18 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", @@ -3923,6 +4035,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.2", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-socks" version = "0.5.1" @@ -3935,6 +4058,18 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", + "tokio-util", +] + [[package]] name = "tokio-tungstenite" version = "0.20.1" @@ -3947,7 +4082,7 @@ dependencies = [ "tokio", "tokio-rustls 0.24.1", "tungstenite", - "webpki-roots", + "webpki-roots 0.25.4", ] [[package]] @@ -4162,7 +4297,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna", "percent-encoding", "serde", ] @@ -4174,7 +4309,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fa3323c39b8e786154d3000b70ae9af0e9bd746c9791456da0d4a1f68ad89d6" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna", "percent-encoding", "serde", ] @@ -4187,12 +4322,12 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "validator" -version = "0.16.1" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b92f40481c04ff1f4f61f304d61793c7b56ff76ac1469f1beb199b1445b253bd" +checksum = "da339118f018cc70ebf01fafc103360528aad53717e4bf311db929cb01cb9345" dependencies = [ - "idna 0.4.0", - "lazy_static", + "idna", + "once_cell", "regex", "serde", "serde_derive", @@ -4203,28 +4338,16 @@ dependencies = [ [[package]] name = "validator_derive" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc44ca3088bb3ba384d9aecf40c6a23a676ce23e09bdaca2073d99c207f864af" +checksum = "76e88ea23b8f5e59230bff8a2f03c0ee0054a61d5b8343a38946bcd406fe624c" dependencies = [ - "if_chain", - "lazy_static", + "darling", "proc-macro-error", "proc-macro2", "quote", "regex", - "syn 1.0.109", - "validator_types", -] - -[[package]] -name = "validator_types" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111abfe30072511849c5910134e8baf8dc05de4c0e5903d681cbd5c9c4d611e3" -dependencies = [ - "proc-macro2", - "syn 1.0.109", + "syn 2.0.50", ] [[package]] @@ -4262,9 +4385,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4272,9 +4395,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", @@ -4287,9 +4410,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -4299,9 +4422,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4309,9 +4432,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", @@ -4322,9 +4445,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-ws" @@ -4369,6 +4492,15 @@ version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +[[package]] +name = "webpki-roots" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "winapi" version = "0.3.9" @@ -4569,6 +4701,26 @@ dependencies = [ "tap", ] +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] + [[package]] name = "zeroize" version = "1.7.0" diff --git a/Cargo.toml b/Cargo.toml index 7331136..4b4db97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,17 +16,16 @@ chrono = { version = "0.4.26", features = ["serde"] } diesel = { version = "2.1", features = ["postgres", "postgres_backend", "r2d2", "chrono", "numeric"] } dotenv = "0.15.0" async-trait = "0.1.77" -fedimint-tbs = "0.2.2" -fedimint-core = "0.2.2" -fedimint-client = "0.2.2" -fedimint-wallet-client = "0.2.2" -fedimint-mint-client = "0.2.2" -bls12_381 = { version = "0.7.1", features = [ "zeroize", "groups" ] } -fedimint-ln-client = "0.2.2" +fedimint-tbs = { git = "https://github.com/fedimint/fedimint", tag = "v0.3.0-rc.2" } +fedimint-core = { git = "https://github.com/fedimint/fedimint", tag = "v0.3.0-rc.2" } +fedimint-client = { git = "https://github.com/fedimint/fedimint", tag = "v0.3.0-rc.2" } +fedimint-wallet-client = { git = "https://github.com/fedimint/fedimint", tag = "v0.3.0-rc.2" } +fedimint-mint-client = { git = "https://github.com/fedimint/fedimint", tag = "v0.3.0-rc.2" } +fedimint-ln-client = { git = "https://github.com/fedimint/fedimint", tag = "v0.3.0-rc.2" } +fedimint-ln-common = { git = "https://github.com/fedimint/fedimint", tag = "v0.3.0-rc.2" } futures = "0.3.28" url = "2.5.0" itertools = "0.12.0" -lightning-invoice = "0.27.0" hex = "0.4.3" jwt-compact = { version = "0.8.0", features = ["es256k"] } nostr = "0.26.0" @@ -41,7 +40,7 @@ reqwest = { version = "0.11", features = ["json"] } tokio = { version = "1.12.0", features = ["full"] } tower-http = { version = "0.4.0", features = ["cors"] } lazy-regex = "3.1.0" -multimint = { git = "https://github.com/Kodylow/multimint", rev = "00df9d34f0244d0200eee4d285094b22b34cf38b" } +multimint = { git = "https://github.com/fedimint/fedimint-clientd", rev = "16fe9dd32c745267304a55aacee9501050bb03fa" } names = "0.14.0" [dev-dependencies] diff --git a/migrations/2024-02-20-210617_user_info/up.sql b/migrations/2024-02-20-210617_user_info/up.sql index 56f3847..3e0774d 100644 --- a/migrations/2024-02-20-210617_user_info/up.sql +++ b/migrations/2024-02-20-210617_user_info/up.sql @@ -4,7 +4,8 @@ CREATE TABLE app_user ( name VARCHAR(255) NOT NULL UNIQUE, unblinded_msg VARCHAR(255) NOT NULL UNIQUE, federation_id VARCHAR(64) NOT NULL, - federation_invite_code VARCHAR(255) NOT NULL + federation_invite_code VARCHAR(255) NOT NULL, + invoice_index INTEGER NOT NULL DEFAULT 0 ); CREATE INDEX idx_app_user_unblinded_msg ON app_user (unblinded_msg); @@ -14,7 +15,9 @@ CREATE TABLE invoice ( id SERIAL PRIMARY KEY, federation_id VARCHAR(64) NOT NULL, op_id VARCHAR(64) NOT NULL, + preimage VARCHAR(64) NOT NULL, app_user_id INTEGER NOT NULL references app_user(id), + user_invoice_index INTEGER NOT NULL, bolt11 VARCHAR(2048) NOT NULL, amount BIGINT NOT NULL, state INTEGER NOT NULL DEFAULT 0 diff --git a/src/db.rs b/src/db.rs index a244d65..4ab7f7e 100644 --- a/src/db.rs +++ b/src/db.rs @@ -21,6 +21,7 @@ pub(crate) trait DBConnection { fn set_invoice_state(&self, invoice: Invoice, s: i32) -> anyhow::Result<()>; fn get_user_by_name(&self, name: String) -> anyhow::Result>; fn get_user_by_id(&self, id: i32) -> anyhow::Result>; + fn get_user_and_increment_counter(&self, name: &str) -> anyhow::Result>; fn insert_new_zap(&self, new_zap: NewZap) -> anyhow::Result; fn get_zap_by_id(&self, id: i32) -> anyhow::Result>; fn set_zap_event_id(&self, zap: Zap, event_id: String) -> anyhow::Result<()>; @@ -66,6 +67,11 @@ impl DBConnection for PostgresConnection { AppUser::get_by_id(conn, id) } + fn get_user_and_increment_counter(&self, name: &str) -> anyhow::Result> { + let conn = &mut self.db.get()?; + AppUser::get_by_name_and_increment_counter(conn, name) + } + fn insert_new_invoice(&self, new_invoice: NewInvoice) -> anyhow::Result { let conn = &mut self.db.get()?; new_invoice.insert(conn) diff --git a/src/invoice.rs b/src/invoice.rs index 20f6eec..a98b21c 100644 --- a/src/invoice.rs +++ b/src/invoice.rs @@ -1,20 +1,20 @@ -use std::{collections::HashMap, str::FromStr, time::Duration}; +use std::{collections::HashMap, str::FromStr}; use anyhow::{anyhow, Result}; -use fedimint_client::{oplog::UpdateStreamOrOutcome, ClientArc}; -use fedimint_core::{config::FederationId, core::OperationId, task::spawn, Amount}; +use fedimint_client::oplog::UpdateStreamOrOutcome; +use fedimint_core::{config::FederationId, task::spawn}; use fedimint_ln_client::{LightningClientModule, LnReceiveState}; -use fedimint_mint_client::{MintClientModule, OOBNotes}; +use fedimint_ln_common::bitcoin::hashes::sha256::Hash as Sha256; +use fedimint_ln_common::bitcoin::hashes::Hash; +use fedimint_ln_common::bitcoin::secp256k1::{Secp256k1, SecretKey}; +use fedimint_ln_common::lightning_invoice::{Currency, InvoiceBuilder, PaymentSecret}; use futures::StreamExt; use itertools::Itertools; -use lightning_invoice::{Currency, InvoiceBuilder, PaymentSecret}; use log::{error, info}; -use nostr::hashes::Hash; -use nostr::key::{Secp256k1, SecretKey}; use nostr::prelude::rand::rngs::OsRng; use nostr::prelude::rand::RngCore; use nostr::secp256k1::XOnlyPublicKey; -use nostr::{bitcoin::hashes::sha256::Hash as Sha256, Keys}; +use nostr::Keys; use nostr::{Event, EventBuilder, JsonUtil}; use nostr_sdk::Client; use serde::{Deserialize, Serialize}; @@ -62,11 +62,10 @@ pub(crate) async fn handle_pending_invoices(state: &State) -> Result<()> { let user = state .db .get_user_by_id(invoice.app_user_id)? - .map_or(Err(anyhow!("no user")), Ok)?; + .ok_or(anyhow!("no user"))?; spawn_invoice_subscription( state.clone(), invoice, - client.clone(), user.clone(), subscription, ) @@ -83,8 +82,7 @@ pub(crate) async fn handle_pending_invoices(state: &State) -> Result<()> { pub(crate) async fn spawn_invoice_subscription( state: State, i: Invoice, - client: ClientArc, - userrelays: AppUser, + user: AppUser, subscription: UpdateStreamOrOutcome, ) { spawn("waiting for invoice being paid", async move { @@ -108,16 +106,7 @@ pub(crate) async fn spawn_invoice_subscription( } LnReceiveState::Claimed => { info!("Payment claimed"); - match notify_user( - client, - &nostr, - &state, - i.id, - i.amount as u64, - userrelays.clone(), - ) - .await - { + match notify_user(&nostr, &state, &i, user).await { Ok(_) => { match state.db.set_invoice_state(i, InvoiceState::Settled as i32) { Ok(_) => (), @@ -140,54 +129,38 @@ pub(crate) async fn spawn_invoice_subscription( } async fn notify_user( - client: ClientArc, nostr: &Client, state: &State, - id: i32, - amount: u64, - app_user_relays: AppUser, -) -> Result<(), Box> { - let mint = client.get_first_module::(); - let (operation_id, notes) = mint - .spend_notes(Amount::from_msats(amount), Duration::from_secs(604800), ()) - .await?; - - send_nostr_dm(nostr, &app_user_relays, operation_id, amount, notes).await?; - - // Send zap if needed - if let Some(zap) = state.db.get_zap_by_id(id)? { - let request = Event::from_json(zap.request.clone())?; - let event = create_zap_event(request, amount, nostr.keys().await)?; - - let event_id = nostr.send_event(event).await?; - info!("Broadcasted zap {event_id}!"); - - state.db.set_zap_event_id(zap, event_id.to_string())?; - } - - Ok(()) -} - -async fn send_nostr_dm( - nostr: &Client, - app_user_relays: &AppUser, - operation_id: OperationId, - amount: u64, - notes: OOBNotes, + invoice: &Invoice, + user: AppUser, ) -> Result<()> { + let zap = state.db.get_zap_by_id(invoice.id)?; + let dm = nostr .send_direct_msg( - XOnlyPublicKey::from_str(&app_user_relays.pubkey).unwrap(), + XOnlyPublicKey::from_str(&user.pubkey)?, json!({ - "operationId": operation_id, - "amount": amount, - "notes": notes.to_string(), + "federation_id": invoice.federation_id, + "tweak_index": invoice.user_invoice_index, + "amount": invoice.amount, + "zap_request": zap.as_ref().map(|z| z.request.clone()), }) .to_string(), None, ) .await?; + // Send zap if needed + if let Some(zap) = zap { + let request = Event::from_json(&zap.request)?; + let event = create_zap_event(request, invoice.amount as u64, nostr.keys().await)?; + + let event_id = nostr.send_event(event).await?; + info!("Broadcasted zap {event_id}!"); + + state.db.set_zap_event_id(zap, event_id.to_string())?; + } + info!("Sent nostr dm: {dm}"); Ok(()) } diff --git a/src/lnurlp.rs b/src/lnurlp.rs index 08e4669..3feaf14 100644 --- a/src/lnurlp.rs +++ b/src/lnurlp.rs @@ -7,12 +7,19 @@ use crate::{ State, }; use anyhow::anyhow; -use fedimint_core::{config::FederationId, Amount}; +use fedimint_core::{config::FederationId, Amount, BitcoinHash}; use fedimint_ln_client::LightningClientModule; +use fedimint_ln_common::bitcoin::hashes::sha256; +use fedimint_ln_common::bitcoin::secp256k1::Parity; +use fedimint_ln_common::lightning_invoice::{Bolt11InvoiceDescription, Sha256}; use nostr::{Event, JsonUtil, Kind}; use crate::routes::{LnurlStatus, LnurlType, LnurlWellKnownResponse}; +fn calc_metadata(name: &str, domain: &str) -> String { + format!("[[\"text/identifier\",\"{name}@{domain}\"],[\"text/plain\",\"Sats for {name}\"]]") +} + pub async fn well_known_lnurlp( state: &State, name: String, @@ -25,8 +32,8 @@ pub async fn well_known_lnurlp( let res = LnurlWellKnownResponse { callback: format!("{}/lnurlp/{}/callback", state.domain, name).parse()?, max_sendable: Amount { msats: 100000 }, - min_sendable: Amount { msats: 1000 }, - metadata: "test metadata".to_string(), // TODO what should this be? + min_sendable: Amount { msats: MIN_AMOUNT }, + metadata: calc_metadata(&name, &state.domain_no_http()), comment_allowed: None, tag: LnurlType::PayRequest, status: LnurlStatus::Ok, @@ -44,14 +51,17 @@ pub async fn lnurl_callback( name: String, params: LnurlCallbackParams, ) -> anyhow::Result { - let user = state.db.get_user_by_name(name.clone())?; + let user = state.db.get_user_and_increment_counter(&name)?; if user.is_none() { return Err(anyhow!("NotFound")); } let user = user.expect("just checked"); if params.amount < MIN_AMOUNT { - return Err(anyhow::anyhow!("Amount < MIN_AMOUNT")); + return Err(anyhow::anyhow!( + "Amount ({}) < MIN_AMOUNT ({MIN_AMOUNT})", + params.amount + )); } // verify nostr param is a zap request @@ -70,18 +80,36 @@ pub async fn lnurl_callback( .mm .get_federation_client(federation_id) .await - .map_or(Err(anyhow!("NotFound")), Ok)?; + .ok_or(anyhow!("NotFound"))?; let ln = client.get_first_module::(); - let (op_id, pr) = ln - .create_bolt11_invoice( - Amount { - msats: params.amount, - }, - "test invoice".to_string(), // todo set description hash properly - None, + // calculate description hash for invoice + let desc_hash = match params.nostr { + Some(ref nostr) => Sha256(sha256::Hash::hash(nostr.as_bytes())), + None => { + let metadata = calc_metadata(&name, &state.domain_no_http()); + Sha256(sha256::Hash::hash(metadata.as_bytes())) + } + }; + + let invoice_index = user.invoice_index; + + let gateway = state + .mm + .get_gateway(&federation_id) + .await + .ok_or(anyhow!("Not gateway configured for federation"))?; + + let (op_id, pr, preimage) = ln + .create_bolt11_invoice_for_user_tweaked( + Amount::from_msats(params.amount), + Bolt11InvoiceDescription::Hash(&desc_hash), + Some(86_400), // 1 day expiry + user.pubkey().public_key(Parity::Even), // todo is this parity correct / easy to work with? + invoice_index as u64, (), + Some(gateway), ) .await?; @@ -89,7 +117,9 @@ pub async fn lnurl_callback( let new_invoice = NewInvoice { federation_id: federation_id.to_string(), op_id: op_id.to_string(), + preimage: hex::encode(preimage), app_user_id: user.id, + user_invoice_index: invoice_index, bolt11: pr.to_string(), amount: params.amount as i64, state: InvoiceState::Pending as i32, @@ -112,14 +142,7 @@ pub async fn lnurl_callback( .await .expect("subscribing to a just created operation can't fail"); - spawn_invoice_subscription( - state.clone(), - created_invoice, - client, - user.clone(), - subscription, - ) - .await; + spawn_invoice_subscription(state.clone(), created_invoice, user.clone(), subscription).await; let verify_url = format!("{}/lnurlp/{}/verify/{}", state.domain, user.name, op_id); @@ -141,12 +164,12 @@ pub async fn verify( let invoice = state .db .get_invoice_by_op_id(op_id)? - .map_or(Err(anyhow::anyhow!("NotFound")), Ok)?; + .ok_or(anyhow::anyhow!("NotFound"))?; let user = state .db .get_user_by_name(name)? - .map_or(Err(anyhow::anyhow!("NotFound")), Ok)?; + .ok_or(anyhow::anyhow!("NotFound"))?; if invoice.app_user_id != user.id { return Err(anyhow::anyhow!("NotFound")); @@ -155,7 +178,7 @@ pub async fn verify( let verify_response = LnurlVerifyResponse { status: LnurlStatus::Ok, settled: invoice.state == InvoiceState::Settled as i32, - preimage: "".to_string(), // TODO: figure out how to get the preimage from fedimint client + preimage: invoice.preimage, pr: invoice.bolt11, }; diff --git a/src/main.rs b/src/main.rs index 52b0218..37df61d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,12 +3,11 @@ use axum::http::{request::Parts, HeaderValue, Method, StatusCode, Uri}; use axum::routing::get; use axum::{extract::DefaultBodyLimit, routing::post}; use axum::{http, Extension, Router, TypedHeader}; -use bls12_381::G2Affine; use log::{error, info}; use nostr_sdk::nostr::{key::FromSkStr, Keys}; use secp256k1::{All, Secp256k1}; use std::{path::PathBuf, str::FromStr, sync::Arc}; -use tbs::AggregatePublicKey; +use tbs::{AggregatePublicKey, PubKeyPoint}; use tokio::signal::unix::{signal, SignalKind}; use tokio::sync::oneshot; use tower_http::cors::{AllowOrigin, CorsLayer}; @@ -63,6 +62,15 @@ pub struct State { pub paid_pk: AggregatePublicKey, } +impl State { + pub fn domain_no_http(&self) -> String { + self.domain + .replace("http://", "") + .replace("https://", "") + .replace('/', "") + } +} + #[tokio::main] async fn main() -> anyhow::Result<()> { // Load .env file @@ -87,7 +95,7 @@ async fn main() -> anyhow::Result<()> { let free_pk = std::env::var("FREE_PK").expect("FREE_PK must be set"); let paid_pk = std::env::var("PAID_PK").expect("PAID_PK must be set"); let free_pk: AggregatePublicKey = AggregatePublicKey( - G2Affine::from_compressed( + PubKeyPoint::from_compressed( hex::decode(&free_pk).expect("Invalid key hex")[..] .try_into() .expect("Invalid key byte key"), @@ -95,7 +103,7 @@ async fn main() -> anyhow::Result<()> { .expect("Invalid FREE_PK"), ); let paid_pk: AggregatePublicKey = AggregatePublicKey( - G2Affine::from_compressed( + PubKeyPoint::from_compressed( hex::decode(&paid_pk).expect("Invalid key hex")[..] .try_into() .expect("Invalid key byte key"), diff --git a/src/mint.rs b/src/mint.rs index 2e51d39..dc1239f 100644 --- a/src/mint.rs +++ b/src/mint.rs @@ -1,6 +1,10 @@ use async_trait::async_trait; -use fedimint_client::ClientArc; +use fedimint_client::ClientHandleArc; use fedimint_core::{api::InviteCode, config::FederationId}; +use fedimint_ln_client::LightningClientModule; +use fedimint_ln_common::LightningGateway; +use log::error; +use std::collections::HashMap; use std::{path::PathBuf, sync::Arc}; use tokio::sync::RwLock; @@ -12,13 +16,16 @@ use multimint::MultiMint; #[async_trait] pub(crate) trait MultiMintWrapperTrait { async fn check_has_federation(&self, id: FederationId) -> bool; - async fn get_federation_client(&self, id: FederationId) -> Option; + async fn get_federation_client(&self, id: FederationId) -> Option; async fn register_new_federation(&self, invite_code: InviteCode) -> anyhow::Result<()>; + async fn get_gateway(&self, id: &FederationId) -> Option; } #[derive(Clone)] struct MultiMintWrapper { fm: Arc>, + /// Our preferred lightning gateway for each federation + gateways: Arc>>, } #[async_trait] @@ -27,25 +34,89 @@ impl MultiMintWrapperTrait for MultiMintWrapper { self.fm.read().await.clients.lock().await.contains_key(&id) } - async fn get_federation_client(&self, id: FederationId) -> Option { + async fn get_federation_client(&self, id: FederationId) -> Option { self.fm.read().await.clients.lock().await.get(&id).cloned() } async fn register_new_federation(&self, invite_code: InviteCode) -> anyhow::Result<()> { - self.fm + let id = self + .fm .write() .await - .register_new(invite_code, false) + .register_new(invite_code, None) .await?; + + let client = self + .get_federation_client(id) + .await + .expect("just registered"); + + if let Some(gateway) = select_gateway(&client).await { + self.gateways.write().await.insert(id, gateway); + } else { + error!("No suitable gateway found for federation {id}"); + } + Ok(()) } + + async fn get_gateway(&self, id: &FederationId) -> Option { + let lock = self.gateways.read().await; + lock.get(id).cloned() + } } pub(crate) async fn setup_multimint( db_path: PathBuf, ) -> anyhow::Result> { - let fm = Arc::new(RwLock::new(MultiMint::new(db_path).await?)); - let mmw = MultiMintWrapper { fm }; + let mm = MultiMint::new(db_path).await?; + + let clients = mm.clients.lock().await; + let mut gateways = HashMap::with_capacity(clients.len()); + + // select gateway for each federation + for (id, client) in clients.iter() { + match select_gateway(client).await { + Some(gateway) => { + gateways.insert(*id, gateway); + } + None => { + error!("No suitable gateway found for federation {id}"); + } + } + } + drop(clients); + + let mmw = MultiMintWrapper { + fm: Arc::new(RwLock::new(mm)), + gateways: Arc::new(RwLock::new(HashMap::new())), + }; Ok(Arc::new(mmw)) } + +pub(crate) async fn select_gateway(client: &ClientHandleArc) -> Option { + let ln = client.get_first_module::(); + let mut gateway_id = None; + for gateway in ln.list_gateways().await { + // first try to find a vetted gateway + if gateway.vetted { + gateway_id = Some(gateway.info.gateway_id); + break; // if vetted gateway found, use it + } + + // if no vetted gateway found, try to find a gateway with reasonable fees + let fees = gateway.info.fees; + if fees.base_msat >= 1_000 && fees.proportional_millionths >= 100 { + gateway_id = Some(gateway.info.gateway_id); + } + } + + if let Some(gateway_id) = gateway_id { + if let Some(gateway) = ln.select_gateway(&gateway_id).await { + return Some(gateway); + } + } + + None +} diff --git a/src/models/app_user.rs b/src/models/app_user.rs index f76b048..b5cb1f4 100644 --- a/src/models/app_user.rs +++ b/src/models/app_user.rs @@ -1,6 +1,8 @@ use crate::models::schema::app_user; use diesel::prelude::*; +use fedimint_ln_common::bitcoin::secp256k1::XOnlyPublicKey; use serde::{Deserialize, Serialize}; +use std::str::FromStr; #[derive( QueryableByName, Queryable, AsChangeset, Serialize, Deserialize, Debug, Clone, PartialEq, @@ -14,9 +16,14 @@ pub struct AppUser { pub unblinded_msg: String, pub federation_id: String, pub federation_invite_code: String, + pub invoice_index: i32, } impl AppUser { + pub fn pubkey(&self) -> XOnlyPublicKey { + XOnlyPublicKey::from_str(&self.pubkey).expect("invalid pubkey") + } + pub fn get_app_users(conn: &mut PgConnection) -> anyhow::Result> { Ok(app_user::table.load::(conn)?) } @@ -35,6 +42,27 @@ impl AppUser { .optional()?) } + pub fn get_by_name_and_increment_counter( + conn: &mut PgConnection, + name: &str, + ) -> anyhow::Result> { + conn.transaction(|conn| { + let user = app_user::table + .filter(app_user::name.eq(name)) + .first::(conn) + .optional()?; + + // if the user exists, increment their invoice index + if let Some(user) = &user { + diesel::update(app_user::table.filter(app_user::id.eq(user.id))) + .set(app_user::invoice_index.eq(app_user::invoice_index + 1)) + .execute(conn)?; + } + + Ok(user) + }) + } + pub fn check_available_name(conn: &mut PgConnection, name: String) -> anyhow::Result { Ok(app_user::table .filter(app_user::name.eq(name)) diff --git a/src/models/invoice.rs b/src/models/invoice.rs index 90b85bd..09f2550 100644 --- a/src/models/invoice.rs +++ b/src/models/invoice.rs @@ -11,7 +11,9 @@ pub struct Invoice { pub id: i32, pub federation_id: String, pub op_id: String, + pub preimage: String, pub app_user_id: i32, + pub user_invoice_index: i32, pub bolt11: String, pub amount: i64, pub state: i32, @@ -60,7 +62,9 @@ impl Invoice { pub struct NewInvoice { pub federation_id: String, pub op_id: String, + pub preimage: String, pub app_user_id: i32, + pub user_invoice_index: i32, pub bolt11: String, pub amount: i64, pub state: i32, diff --git a/src/models/schema.rs b/src/models/schema.rs index 763144d..6a61296 100644 --- a/src/models/schema.rs +++ b/src/models/schema.rs @@ -13,6 +13,7 @@ diesel::table! { federation_id -> Varchar, #[max_length = 255] federation_invite_code -> Varchar, + invoice_index -> Int4, } } @@ -23,7 +24,10 @@ diesel::table! { federation_id -> Varchar, #[max_length = 64] op_id -> Varchar, + #[max_length = 64] + preimage -> Varchar, app_user_id -> Int4, + user_invoice_index -> Int4, #[max_length = 2048] bolt11 -> Varchar, amount -> Int8, diff --git a/src/register.rs b/src/register.rs index 3836f6c..78f604d 100644 --- a/src/register.rs +++ b/src/register.rs @@ -176,9 +176,7 @@ mod tests { } #[cfg(all(test, feature = "integration-tests"))] -use tbs::{ - combine_valid_shares, AggregatePublicKey, BlindedMessage, BlindedSignature, SecretKeyShare, -}; +use tbs::{AggregatePublicKey, BlindedMessage, BlindedSignature, SecretKeyShare}; #[cfg(all(test, feature = "integration-tests"))] use sha2::Digest; @@ -209,7 +207,7 @@ impl BlindSigner { pub fn blind_sign(&self, blinded_message: BlindedMessage) -> BlindedSignature { let share = tbs::sign_blinded_msg(blinded_message, self.sk); - combine_valid_shares(vec![(0, share)], 1) + BlindedSignature(share.0) } }