diff --git a/taptrade-cli-demo/coordinator/.env b/taptrade-cli-demo/coordinator/.env new file mode 100644 index 0000000..bd8113e --- /dev/null +++ b/taptrade-cli-demo/coordinator/.env @@ -0,0 +1 @@ +ELECTRUM_BACKEND=127.0.0.1:50001 diff --git a/taptrade-cli-demo/coordinator/Cargo.lock b/taptrade-cli-demo/coordinator/Cargo.lock index 9be444c..4a94dab 100644 --- a/taptrade-cli-demo/coordinator/Cargo.lock +++ b/taptrade-cli-demo/coordinator/Cargo.lock @@ -18,53 +18,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "anstream" -version = "0.6.14" +name = "ahash" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", ] [[package]] -name = "anstyle" -version = "1.0.7" +name = "allocator-api2" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" - -[[package]] -name = "anstyle-parse" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "anyhow" @@ -80,16 +50,16 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] -name = "atomic-polyfill" -version = "1.0.3" +name = "atoi" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" dependencies = [ - "critical-section", + "num-traits", ] [[package]] @@ -161,9 +131,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.72" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -174,18 +144,18 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - [[package]] name = "base64" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -275,9 +245,12 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] [[package]] name = "block-buffer" @@ -308,9 +281,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.98" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +checksum = "c891175c3fb232128f48de6590095e59198bbeb8620c310be349bfc3afd12c7b" [[package]] name = "cfg-if" @@ -318,64 +291,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "clap" -version = "4.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.66", -] - -[[package]] -name = "clap_lex" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" - -[[package]] -name = "cobs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" - -[[package]] -name = "colorchoice" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" - -[[package]] -name = "const-crc32" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68d13f542d70e5b339bf46f6f74704ac052cfd526c58cd87996bd1ef4615b9a0" - [[package]] name = "const-oid" version = "0.9.6" @@ -389,11 +304,10 @@ dependencies = [ "anyhow", "axum", "bdk", - "clap", - "frost-secp256k1", - "hex", + "dotenv", "reqwest", "serde", + "sqlx", "tokio", ] @@ -422,6 +336,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + [[package]] name = "crc32fast" version = "1.4.2" @@ -431,12 +360,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "critical-section" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" - [[package]] name = "crossbeam-epoch" version = "0.9.18" @@ -446,24 +369,21 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "rand_core", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -474,12 +394,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "debugless-unwrap" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f400d0750c0c069e8493f2256cb4da6f604b6d2eeb69a0ca8863acde352f8400" - [[package]] name = "der" version = "0.7.9" @@ -487,20 +401,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", + "pem-rfc7468", "zeroize", ] -[[package]] -name = "derive-getters" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2c35ab6e03642397cdda1dd58abbc05d418aef8e36297f336d5aba060fe8df" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "digest" version = "0.10.7" @@ -514,33 +418,25 @@ dependencies = [ ] [[package]] -name = "document-features" -version = "0.2.8" +name = "dotenv" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5282ad69563b5fc40319526ba27e0e7363d552a896f0297d54f767717f9b95" -dependencies = [ - "litrs", -] +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] -name = "ecdsa" -version = "0.16.9" +name = "dotenvy" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" -dependencies = [ - "der", - "digest", - "elliptic-curve", - "rfc6979", - "signature", - "spki", -] +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "either" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +dependencies = [ + "serde", +] [[package]] name = "electrum-client" @@ -553,7 +449,7 @@ dependencies = [ "byteorder", "libc", "log", - "rustls", + "rustls 0.21.12", "serde", "serde_json", "webpki", @@ -561,31 +457,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest", - "ff", - "generic-array", - "group", - "pkcs8", - "rand_core", - "sec1", - "subtle", - "zeroize", -] - -[[package]] -name = "embedded-io" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" - [[package]] name = "encoding_rs" version = "0.8.34" @@ -611,6 +482,23 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "fastrand" version = "2.1.0" @@ -618,13 +506,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] -name = "ff" -version = "0.13.0" +name = "flume" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ - "rand_core", - "subtle", + "futures-core", + "futures-sink", + "spin", ] [[package]] @@ -657,54 +546,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "frost-core" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45d6280625f1603d160df24b23e4984a6a7286f41455ae606823d0104c32e834" -dependencies = [ - "byteorder", - "const-crc32", - "debugless-unwrap", - "derive-getters", - "document-features", - "hex", - "itertools", - "postcard", - "rand_core", - "serde", - "serdect", - "thiserror", - "visibility", - "zeroize", -] - -[[package]] -name = "frost-rerandomized" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52c58f58ea009000db490efd9a3936d0035647a2b00c7ba8f3868c2ed0306b0b" -dependencies = [ - "derive-getters", - "document-features", - "frost-core", - "rand_core", -] - -[[package]] -name = "frost-secp256k1" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0216d9edf7b792596fe44f56dca2f000881fab6f15ca446e77eab4d6e943a41b" -dependencies = [ - "document-features", - "frost-core", - "frost-rerandomized", - "k256", - "rand_core", - "sha2", -] - [[package]] name = "fs2" version = "0.4.3" @@ -731,6 +572,28 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot 0.12.3", +] + [[package]] name = "futures-io" version = "0.3.30" @@ -782,7 +645,6 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", - "zeroize", ] [[package]] @@ -802,17 +664,6 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core", - "subtle", -] - [[package]] name = "h2" version = "0.4.5" @@ -832,46 +683,33 @@ dependencies = [ "tracing", ] -[[package]] -name = "hash32" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" -dependencies = [ - "byteorder", -] - [[package]] name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] [[package]] -name = "heapless" -version = "0.7.17" +name = "hashlink" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "atomic-polyfill", - "hash32", - "rustc_version", - "serde", - "spin", - "stable_deref_trait", + "hashbrown", ] [[package]] name = "heck" -version = "0.5.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "hex" @@ -885,6 +723,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + [[package]] name = "hmac" version = "0.12.1" @@ -894,6 +741,15 @@ dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "http" version = "1.1.0" @@ -917,12 +773,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", - "futures-core", + "futures-util", "http", "http-body", "pin-project-lite", @@ -930,9 +786,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -961,6 +817,23 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls 0.23.10", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -1032,21 +905,6 @@ 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 = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.11" @@ -1063,17 +921,12 @@ dependencies = [ ] [[package]] -name = "k256" -version = "0.13.3" +name = "lazy_static" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "sha2", - "signature", + "spin", ] [[package]] @@ -1082,18 +935,29 @@ version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libsqlite3-sys" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" -[[package]] -name = "litrs" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" - [[package]] name = "lock_api" version = "0.4.12" @@ -1117,10 +981,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] -name = "memchr" -version = "2.7.2" +name = "md-5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -1128,6 +1002,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniscript" version = "10.0.0" @@ -1141,9 +1021,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] @@ -1177,20 +1057,67 @@ dependencies = [ ] [[package]] -name = "num_cpus" -version = "1.16.0" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "hermit-abi", - "libc", + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", ] [[package]] name = "object" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" +checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" dependencies = [ "memchr", ] @@ -1207,7 +1134,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -1224,7 +1151,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -1253,7 +1180,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.10", ] [[package]] @@ -1265,11 +1202,39 @@ dependencies = [ "cfg-if", "instant", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "winapi", ] +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.2", + "smallvec", + "windows-targets 0.52.5", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1293,7 +1258,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -1308,6 +1273,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + [[package]] name = "pkcs8" version = "0.10.2" @@ -1324,18 +1300,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" -[[package]] -name = "postcard" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" -dependencies = [ - "cobs", - "embedded-io", - "heapless", - "serde", -] - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1344,9 +1308,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.85" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -1400,10 +1364,28 @@ dependencies = [ ] [[package]] -name = "reqwest" -version = "0.12.4" +name = "redox_syscall" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +dependencies = [ + "bitflags 2.6.0", +] + +[[package]] +name = "reqwest" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ "base64 0.22.1", "bytes", @@ -1416,6 +1398,7 @@ dependencies = [ "http-body", "http-body-util", "hyper", + "hyper-rustls", "hyper-tls", "hyper-util", "ipnet", @@ -1430,7 +1413,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.1", "system-configuration", "tokio", "tokio-native-tls", @@ -1442,16 +1425,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - [[package]] name = "ring" version = "0.17.8" @@ -1467,28 +1440,39 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rsa" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", +] + [[package]] name = "rustc-demangle" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - [[package]] name = "rustix" version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -1503,10 +1487,23 @@ checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.23.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki 0.102.4", + "subtle", + "zeroize", +] + [[package]] name = "rustls-pemfile" version = "2.1.2" @@ -1533,6 +1530,17 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustls-webpki" +version = "0.102.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.17" @@ -1570,20 +1578,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", -] - [[package]] name = "secp256k1" version = "0.27.0" @@ -1611,7 +1605,7 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -1628,12 +1622,6 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - [[package]] name = "serde" version = "1.0.203" @@ -1651,14 +1639,14 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4" dependencies = [ "itoa", "ryu", @@ -1688,13 +1676,14 @@ dependencies = [ ] [[package]] -name = "serdect" -version = "0.2.0" +name = "sha1" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ - "base16ct", - "serde", + "cfg-if", + "cpufeatures", + "digest", ] [[package]] @@ -1740,7 +1729,7 @@ dependencies = [ "fxhash", "libc", "log", - "parking_lot", + "parking_lot 0.11.2", ] [[package]] @@ -1779,22 +1768,224 @@ dependencies = [ ] [[package]] -name = "stable_deref_trait" -version = "1.2.0" +name = "sqlformat" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "f895e3734318cc55f1fe66258926c9b910c124d47520339efecbb6c59cec7c1f" +dependencies = [ + "nom", + "unicode_categories", +] [[package]] -name = "strsim" -version = "0.11.1" +name = "sqlx" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" +dependencies = [ + "ahash", + "atoi", + "byteorder", + "bytes", + "crc", + "crossbeam-queue", + "either", + "event-listener", + "futures-channel", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashlink", + "hex", + "indexmap", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlformat", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "url", +] + +[[package]] +name = "sqlx-macros" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" +dependencies = [ + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-sqlite", + "syn 1.0.109", + "tempfile", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" +dependencies = [ + "atoi", + "base64 0.21.7", + "bitflags 2.6.0", + "byteorder", + "bytes", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" +dependencies = [ + "atoi", + "base64 0.21.7", + "bitflags 2.6.0", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" +dependencies = [ + "atoi", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "tracing", + "url", + "urlencoding", +] + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1809,9 +2000,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.66" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", @@ -1880,7 +2071,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -1908,7 +2099,6 @@ dependencies = [ "bytes", "libc", "mio", - "num_cpus", "pin-project-lite", "socket2", "tokio-macros", @@ -1923,7 +2113,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", ] [[package]] @@ -1936,6 +2126,28 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls 0.23.10", + "rustls-pki-types", + "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", +] + [[package]] name = "tokio-util" version = "0.7.11" @@ -1985,9 +2197,21 @@ checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "log", "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "tracing-core" version = "0.1.32" @@ -2030,6 +2254,24 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-properties" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291" + +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + [[package]] name = "untrusted" version = "0.9.0" @@ -2038,9 +2280,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -2048,10 +2290,10 @@ dependencies = [ ] [[package]] -name = "utf8parse" -version = "0.2.1" +name = "urlencoding" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" [[package]] name = "vcpkg" @@ -2065,17 +2307,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "visibility" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3fd98999db9227cf28e59d83e1f120f42bc233d4b152e8fab9bc87d5bb1e0f8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "want" version = "0.3.1" @@ -2091,6 +2322,12 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" version = "0.2.92" @@ -2112,7 +2349,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", "wasm-bindgen-shared", ] @@ -2146,7 +2383,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.68", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2186,6 +2423,16 @@ dependencies = [ "webpki", ] +[[package]] +name = "whoami" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" +dependencies = [ + "redox_syscall 0.4.1", + "wasite", +] + [[package]] name = "winapi" version = "0.3.9" @@ -2357,22 +2604,28 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] diff --git a/taptrade-cli-demo/coordinator/Cargo.toml b/taptrade-cli-demo/coordinator/Cargo.toml index 5b5eeeb..b43b8b1 100644 --- a/taptrade-cli-demo/coordinator/Cargo.toml +++ b/taptrade-cli-demo/coordinator/Cargo.toml @@ -4,12 +4,18 @@ version = "0.1.0" edition = "2021" [dependencies] +anyhow = "1.0.86" axum = "0.7.5" bdk = "0.29.0" -clap = { version = "4.5.4", features = ["derive", "cargo"] } -frost-secp256k1 = "1.0.0" +dotenv = "0.15.0" reqwest = { version = "0.12.4", features = ["blocking", "json"] } serde = "1.0.203" +sqlx = { version = "0.7.4", features = ["runtime-tokio", "sqlite"] } tokio = "1.38.0" + +[profile.release] +lto = true +opt-level = 3 +strip = true anyhow = "1.0.86" hex = "0.4" diff --git a/taptrade-cli-demo/coordinator/src/cli/mod.rs b/taptrade-cli-demo/coordinator/src/cli/mod.rs deleted file mode 100755 index 22b6a5c..0000000 --- a/taptrade-cli-demo/coordinator/src/cli/mod.rs +++ /dev/null @@ -1,91 +0,0 @@ -use clap::{command, Arg, Command, ArgMatches}; - -#[derive(Debug)] -pub struct Coordinator; - -#[derive(Debug)] -pub struct TraderSettings { - pub electrum_endpoint: String, - pub coordinator_endpoint: String, -} - -#[derive(Debug)] -pub enum CliSettings { - Coordinator(Coordinator), - Taker(TraderSettings), - Maker(TraderSettings) -} - -trait ArgMatchesParser { - fn parse_into_enum(&self) -> CliSettings; -} - -impl ArgMatchesParser for ArgMatches { - fn parse_into_enum(&self) -> CliSettings { - if let Some(_mode) = self.subcommand_matches("coordinator") { - CliSettings::Coordinator(Coordinator { }) - } else if let Some(mode) = self.subcommand_matches("trader") { - let trader_settings = TraderSettings { - coordinator_endpoint: mode.get_one::("coordinator-ep") - .expect("Coordinator endpoint not provided!").clone(), - electrum_endpoint: mode.get_one::("electrum-ep") - .expect("Electrum endpoint not provided").clone() - }; - if mode.contains_id("maker") { - CliSettings::Maker( trader_settings ) - } else if mode.contains_id("taker") { - CliSettings::Taker( trader_settings ) - } else { - panic!("Wrong arguments for Trader mode!") - } - } else { - panic!("Select either coordinator or trader mode!") - } - } -} - -pub fn parse_cli_args() -> CliSettings { - command!() - .about("RoboSats taproot onchain trade pipeline CLI demonstrator. Don't use with real funds.") - .subcommand( - Command::new("coordinator") - .about("Run in coordinator mode.") - ) - .subcommand( - Command::new("trader") - .about("Two available trader modes: Maker and Taker. Select one and provide Coordinator and Electum endpoint") - .arg( - Arg::new("taker") - .short('t') - .long("taker") - .help("Run program as taker") - .num_args(0) - .conflicts_with("maker") - ) - .arg ( - Arg::new("maker") - .short('m') - .long("maker") - .num_args(0) - .help("Run program as maker") - .conflicts_with("taker") - ) - .arg( - Arg::new("coordinator-ep") - .short('p') - .long("endpoint") - .required(true) - .help("Communication endpoint of the coordinator to connect to") - ) - .arg( - Arg::new("electrum-ep") - .short('e') - .long("electrum") - .required(true) - .help("URL of the electrum endpoint") - ) - ) - .arg_required_else_help(true) - .get_matches() - .parse_into_enum() -} diff --git a/taptrade-cli-demo/coordinator/src/communication/mod.rs b/taptrade-cli-demo/coordinator/src/communication/mod.rs index 086d0ec..9526af3 100755 --- a/taptrade-cli-demo/coordinator/src/communication/mod.rs +++ b/taptrade-cli-demo/coordinator/src/communication/mod.rs @@ -1,83 +1,97 @@ -pub mod api; +mod api; -use verify_bond::verify_psbt; +use reqwest::StatusCode; use axum::{routing::post, Json, Router, response::{IntoResponse, Response}, }; use serde::{Deserialize, Serialize}; use std::net::SocketAddr; use tokio::net::TcpListener; -use api::{ - BondRequirementResponse, BondSubmissionRequest, OrderActivatedResponse, OrderRequest, -}; - +// use super::*; +// use api::{BondRequirementResponse, BondSubmissionRequest, OrderActivatedResponse, OrderRequest}; +// use axum::{ +// http::StatusCode, response::IntoResponse, response::Response, routing::post, Extension, Json, +// Router, +// }; +// use sqlx::sqlite::SqliteLockingMode; +use crate::verify_bond::verify_psbt; // Handler function to process the received data -async fn receive_order(Json(order): Json)-> Json { - // Print the received data to the console - println!("Received order: {:?}", order); +async fn receive_order( + Extension(state): Extension>, + Json(order): Json, +) -> Result, AppError> { + // Connecting to SQLite database + let db_pool = state.db_pool.clone(); + let mut conn = db_pool.acquire().await.unwrap(); - // Access individual fields - // let robohash = &order.robohash_hex; - let amount = order.amount_satoshi; - // let order_type = &order.is_buy_order; - let bond_ratio = order.bond_ratio; - // let offer_duration= order.offer_duration_ts; + // sqlx::query!( + // "INSERT INTO orders (field1, field2) VALUES (?, ?)", + // order.field1, + // order.field2 + // ) - // Create a response struct - let response = BondRequirementResponse { - bond_address: "Order received successfully".to_string(), - // Add any other fields you want to include in your response - locking_amount_sat: (amount * bond_ratio as u64 / 100), - }; - - // Return the response as JSON - Json(response) + // insert offer into sql database + // generate locking address for bond + println!("Coordinator received new offer: {:?}", order); + Ok(Json(BondRequirementResponse { + bond_address: bond_address, + locking_amount_sat: order.amount_satoshi * order.bond_ratio as u64 / 100, + })) } -async fn submit_maker_bond( - Json(payload): Json, -) -> Json { - // Process the payload - // For now, we'll just return a dummy success response - let response = OrderActivatedResponse { - bond_locked_until_timestamp: 0 as u128, - order_id_hex: "Bond submitted successfully".to_string(), - }; +// async fn submit_maker_bond( +// Json(payload): Json, +// ) -> Result, AppError> { +// // Process the payload +// // For now, we'll just return a dummy success response +// let response = OrderActivatedResponse { +// bond_locked_until_timestamp: 0 as u128, +// order_id_hex: "Bond submitted successfully".to_string(), +// }; - // Create the JSON response - Json(response) -} +// // Create the JSON response +// Json(response) +// } -#[tokio::main] -pub async fn webserver() { - // Build our application with a single route +pub async fn api_server(coordinator: Coordinator) -> Result<()> { let app = Router::new() .route("/create-offer", post(receive_order)) - .route("/submit-maker-bond", post(submit_maker_bond)); + // .route("/submit-maker-bond", post(submit_maker_bond)); + .layer(Extension(coordinator)); + // add other routes here - // Run the server on localhost:3000 - let addr = SocketAddr::from(([127, 0, 0, 1], 3000)); - println!("Listening on {}", addr); - // axum::Server::bind(&addr) - // .serve(app.into_make_service()) - // .await - // .unwrap(); + // Run the server on localhost:9999 + let addr = SocketAddr::from(([127, 0, 0, 1], 9999)); let tcp = TcpListener::bind(&addr).await.unwrap(); - axum::serve(tcp, app).await.unwrap(); + axum::serve(tcp, app).await?; + println!("Listening on {}", addr); + + Ok(()) } -// // use axum +// ANYHOW ERROR HANDLING +// -------------- +// Make our own error that wraps `anyhow::Error`. +struct AppError(anyhow::Error); -// #[get("/")] -// fn index() -> &'static str { -// "Hello, world!" -// } +// Tell axum how to convert `AppError` into a response. +impl IntoResponse for AppError { + fn into_response(self) -> Response { + ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("Something went wrong: {}", self.0), + ) + .into_response() + } +} -// #[launch] -// pub fn webserver() -> Rocket { -// rocket::build().mount("/", routes![index]) -// } - -// // serde to parse json -// // https://www.youtube.com/watch?v=md-ecvXBGzI BDK + Webserver video -// // https://github.com/tokio-rs/axum +// This enables using `?` on functions that return `Result<_, anyhow::Error>` to turn them into +// `Result<_, AppError>`. That way you don't need to do that manually. +impl From for AppError +where + E: Into, +{ + fn from(err: E) -> Self { + Self(err.into()) + } +} diff --git a/taptrade-cli-demo/coordinator/src/main.rs b/taptrade-cli-demo/coordinator/src/main.rs index e5a2939..bbb64f7 100755 --- a/taptrade-cli-demo/coordinator/src/main.rs +++ b/taptrade-cli-demo/coordinator/src/main.rs @@ -1,14 +1,38 @@ -mod coordinator; -mod cli; mod communication; +mod coordinator; -use cli::parse_cli_args; -use communication::webserver; +use anyhow::{anyhow, Error, Result}; +use bdk::database::MemoryDatabase; +use bdk::Wallet; +use communication::api_server; +use dotenv::dotenv; +use serde::{Deserialize, Serialize}; +use sqlx::{sqlite::SqlitePoolOptions, Pool, Sqlite}; +use std::env; +use std::sync::Arc; -fn main() { - webserver(); - let mode = parse_cli_args(); - dbg!(mode); +#[derive(Clone, Debug)] +pub struct Coordinator { + pub db_pool: Arc>, + pub wallet: Arc>, // using sqlite for Wallet? } -// test with cargo run -- trader --maker --endpoint "taptrade-coordinator.com:5432" --electrum "electrum-server.com:50002" +// populate .env with values before starting +#[tokio::main] +async fn main() -> Result<()> { + dotenv().ok(); + // Initialize the database pool + let db_pool = SqlitePoolOptions::new() + .connect("sqlite:./db/trades.db") + .await + .unwrap(); + let shared_db_pool: Arc> = Arc::new(db_pool); + + let coordinator = Coordinator { + db_pool: shared_db_pool, + wallet: // impl wallet + }; + + api_server(coordinator).await?; + Ok(()) +} diff --git a/taptrade-cli-demo/trader/Cargo.toml b/taptrade-cli-demo/trader/Cargo.toml index 41f664e..ff92e94 100644 --- a/taptrade-cli-demo/trader/Cargo.toml +++ b/taptrade-cli-demo/trader/Cargo.toml @@ -15,3 +15,8 @@ rand_core = "0.6.4" reqwest = { version = "0.12.4", features = ["blocking", "json"] } serde = "1.0.203" sha2 = "0.10.8" + +[profile.release] +lto = true +opt-level = "z" +strip = true diff --git a/taptrade-cli-demo/trader/src/cli/mod.rs b/taptrade-cli-demo/trader/src/cli/mod.rs index 91ae4a2..6ef54fc 100755 --- a/taptrade-cli-demo/trader/src/cli/mod.rs +++ b/taptrade-cli-demo/trader/src/cli/mod.rs @@ -1,7 +1,6 @@ use crate::wallet::get_wallet_xprv; use anyhow::{anyhow, Result}; use bdk::bitcoin::bip32::ExtendedPrivKey; -use hex; use sha2::{Digest, Sha256}; use std::{ env, @@ -90,7 +89,7 @@ impl CliSettings { } // parses the hours input string and returns the unix timestamp + the trade duration in seconds - fn hours_to_ts(hours: &String) -> Result { + fn hours_to_ts(hours: &str) -> Result { let duration: u64 = hours.parse()?; Ok(SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() + duration * 3600) } @@ -98,7 +97,7 @@ impl CliSettings { fn get_trader_settings() -> Result { let electrum_endpoint = Self::get_user_input("Enter electrum endpoint: "); let coordinator_endpoint = Self::get_user_input("Enter coordinator endpoint: "); - let robosats_robohash_hex = hex::encode(&hash256(&Self::get_user_input( + let robosats_robohash_hex = hex::encode(hash256(&Self::get_user_input( "Enter your robosats robot key: ", // just for testing purposes, to be improved to the real robohash spec ))); let trade_type: OfferType = Self::get_trade_type(None); diff --git a/taptrade-cli-demo/trader/src/communication/api.rs b/taptrade-cli-demo/trader/src/communication/api.rs index 2f61dd2..ee31cce 100644 --- a/taptrade-cli-demo/trader/src/communication/api.rs +++ b/taptrade-cli-demo/trader/src/communication/api.rs @@ -22,7 +22,7 @@ pub struct BondRequirementResponse { // maker step 2 // (submission of signed bond and other data neccessary to coordinate the trade) #[derive(Serialize, Debug)] -pub struct BondSubmissionRequest { +pub struct BondSubmissionRequest { pub robohash_hex: String, pub signed_bond_hex: String, // signed bond transaction, hex encoded pub payout_address: String, // does this make sense here? @@ -93,3 +93,15 @@ pub struct IsOfferReadyRequest { pub robohash_hex: String, pub offer_id_hex: String, } + +// request posted by both parties when the trade obligations +#[derive(Debug, Serialize)] +pub struct TradeObligationsSatisfied { + pub robohash_hex: String, + pub offer_id_hex: String, +} + +#[derive(Debug, Deserialize)] +pub struct PayoutPsbtResponse { + pub payout_psbt_hex: String, +} diff --git a/taptrade-cli-demo/trader/src/communication/mod.rs b/taptrade-cli-demo/trader/src/communication/mod.rs index c20659c..f464f99 100644 --- a/taptrade-cli-demo/trader/src/communication/mod.rs +++ b/taptrade-cli-demo/trader/src/communication/mod.rs @@ -8,8 +8,9 @@ use crate::{ }; use anyhow::{anyhow, Result}; use api::{ - BondRequirementResponse, BondSubmissionRequest, OfferTakenRequest, OfferTakenResponse, - OrderActivatedResponse, OrderRequest, PsbtSubmissionRequest, + BondRequirementResponse, BondSubmissionRequest, IsOfferReadyRequest, OfferTakenRequest, + OfferTakenResponse, OrderActivatedResponse, OrderRequest, PayoutPsbtResponse, + PsbtSubmissionRequest, TradeObligationsSatisfied, }; use bdk::bitcoin::consensus::encode::serialize_hex; use bdk::{ @@ -17,7 +18,7 @@ use bdk::{ wallet::AddressInfo, }; use serde::{Deserialize, Serialize}; -use std::{thread::sleep, time::Duration}; +use std::{str::FromStr, thread::sleep, time::Duration}; impl BondRequirementResponse { fn _format_request(trader_setup: &TraderSettings) -> OrderRequest { @@ -78,7 +79,7 @@ impl BondSubmissionRequest { } pub fn send_maker( - robohash_hex: &String, + robohash_hex: &str, bond: &PartiallySignedTransaction, musig_data: &mut MuSigData, payout_address: &AddressInfo, @@ -106,7 +107,6 @@ impl OfferTakenResponse { trader_setup: &TraderSettings, ) -> Result> { let request = OfferTakenRequest { - // maybe can be made a bit more efficient (less clone) robohash_hex: trader_setup.robosats_robohash_hex.clone(), order_id_hex: offer.offer_id_hex.clone(), }; @@ -156,3 +156,105 @@ impl PsbtSubmissionRequest { Ok(()) } } + +impl TradeObligationsSatisfied { + // if the trader is satisfied he can submit this to signal the coordinator readiness to close the trade + // if the other party also submits this the coordinator can initiate the closing transaction, otherwise + // escrow has to be initiated + pub fn submit(offer_id_hex: &String, trader_config: &TraderSettings) -> Result<()> { + let request = TradeObligationsSatisfied { + robohash_hex: trader_config.robosats_robohash_hex.clone(), + offer_id_hex: offer_id_hex.clone(), + }; + + let client = reqwest::blocking::Client::new(); + let res = client + .post(format!( + "{}{}", + trader_config.coordinator_endpoint, "/submit-obligation-confirmation" + )) + .json(&request) + .send()?; + if res.status() != 200 { + return Err(anyhow!( + "Submitting trade obligations confirmation failed. Status: {}", + res.status() + )); + } + Ok(()) + } +} + +impl IsOfferReadyRequest { + pub fn poll(taker_config: &TraderSettings, offer: &ActiveOffer) -> Result<()> { + let request = IsOfferReadyRequest { + robohash_hex: taker_config.robosats_robohash_hex.clone(), + offer_id_hex: offer.offer_id_hex.clone(), + }; + let client = reqwest::blocking::Client::new(); + loop { + let res = client + .post(format!( + "{}{}", + taker_config.coordinator_endpoint, "/poll-offer-status" + )) + .json(&request) + .send()?; + if res.status() == 200 { + return Ok(()); + } else if res.status() != 204 { + return Err(anyhow!( + "Requesting offer status when waiting on other party failed: {}", + res.status() + )); + } + // Sleep for 10 sec and poll again + sleep(Duration::from_secs(10)); + } + } + + pub fn poll_payout( + trader_config: &TraderSettings, + offer: &ActiveOffer, + ) -> Result> { + let request = IsOfferReadyRequest { + robohash_hex: trader_config.robosats_robohash_hex.clone(), + offer_id_hex: offer.offer_id_hex.clone(), + }; + let client = reqwest::blocking::Client::new(); + let mut res: reqwest::blocking::Response; + + loop { + // Sleep for 10 sec and poll + sleep(Duration::from_secs(10)); + + res = client + .post(format!( + "{}{}", + trader_config.coordinator_endpoint, "/poll-final-payout" + )) + .json(&request) + .send()?; + if res.status() == 200 { + // good case, psbt is returned + break; + } else if res.status() == 204 { + // still waiting, retry + continue; + } else if res.status() == 201 { + // other party initiated escrow + return Ok(None); + } else { + // unintended response + return Err(anyhow!( + "Requesting final payout when waiting on other party failed: {}", + res.status() + )); + } + } + let final_psbt = PartiallySignedTransaction::from_str( + &res.json::()?.payout_psbt_hex, + )?; + Ok(Some(final_psbt)) + } +} diff --git a/taptrade-cli-demo/trader/src/communication/taker_requests.rs b/taptrade-cli-demo/trader/src/communication/taker_requests.rs index d964cf2..0e903ba 100644 --- a/taptrade-cli-demo/trader/src/communication/taker_requests.rs +++ b/taptrade-cli-demo/trader/src/communication/taker_requests.rs @@ -83,32 +83,3 @@ impl OfferPsbtRequest { Ok(psbt) } } - -impl IsOfferReadyRequest { - pub fn poll(taker_config: &TraderSettings, offer: &ActiveOffer) -> Result<()> { - let request = IsOfferReadyRequest { - robohash_hex: taker_config.robosats_robohash_hex.clone(), - offer_id_hex: offer.offer_id_hex.clone(), - }; - let client = reqwest::blocking::Client::new(); - loop { - let res = client - .post(format!( - "{}{}", - taker_config.coordinator_endpoint, "/poll-offer-status-taker" - )) - .json(&request) - .send()?; - if res.status() == 200 { - return Ok(()); - } else if res.status() != 201 { - return Err(anyhow!( - "Submitting taker psbt failed. Status: {}", - res.status() - )); - } - // Sleep for 10 sec and poll again - sleep(Duration::from_secs(10)); - } - } -} diff --git a/taptrade-cli-demo/trader/src/trading/mod.rs b/taptrade-cli-demo/trader/src/trading/mod.rs index f96e6a9..3e4d5e3 100644 --- a/taptrade-cli-demo/trader/src/trading/mod.rs +++ b/taptrade-cli-demo/trader/src/trading/mod.rs @@ -6,8 +6,9 @@ use self::utils::ActiveOffer; use crate::{ cli::TraderSettings, communication::api::{ - BondRequirementResponse, BondSubmissionRequest, OfferTakenRequest, OfferTakenResponse, - PsbtSubmissionRequest, PublicOffer, PublicOffers, + BondRequirementResponse, BondSubmissionRequest, IsOfferReadyRequest, OfferTakenRequest, + OfferTakenResponse, PsbtSubmissionRequest, PublicOffer, PublicOffers, + TradeObligationsSatisfied, }, wallet::{ bond::Bond, @@ -28,8 +29,8 @@ pub fn run_maker(maker_config: &TraderSettings) -> Result<()> { let offer = ActiveOffer::create(&wallet, maker_config)?; dbg!(&offer); - let mut escrow_contract_psbt = offer.wait_until_taken(maker_config)?; + let mut escrow_contract_psbt = offer.wait_until_taken(maker_config)?; wallet .validate_maker_psbt(&escrow_contract_psbt)? .sign_escrow_psbt(&mut escrow_contract_psbt)?; @@ -40,8 +41,18 @@ pub fn run_maker(maker_config: &TraderSettings) -> Result<()> { offer.offer_id_hex.clone(), maker_config, )?; - // wait for confirmation + // wait for confirmation + offer.wait_on_trade_ready_confirmation(maker_config)?; + if offer.fiat_confirmation_cli_input(maker_config)? { + // this represents the "confirm payment" / "confirm fiat recieved" button + TradeObligationsSatisfied::submit(&offer.offer_id_hex, maker_config)?; + println!("Waiting for other party to confirm the trade."); + let payout_keyspend_psbt = IsOfferReadyRequest::poll_payout(maker_config, &offer)?; + } else { + println!("Trade failed."); + panic!("Escrow to be implemented!"); + } Ok(()) } @@ -49,18 +60,27 @@ pub fn run_taker(taker_config: &TraderSettings) -> Result<()> { let wallet = TradingWallet::load_wallet(taker_config)?; let mut available_offers = PublicOffers::fetch(taker_config)?; - while let None = available_offers.offers { - println!("No offers available, trying again in 10 sec."); + while available_offers.offers.is_none() { + println!("No offers available, fetching again in 10 sec."); thread::sleep(Duration::from_secs(10)); available_offers = PublicOffers::fetch(taker_config)?; } let selected_offer: &PublicOffer = available_offers.ask_user_to_select()?; // take selected offer and wait for maker to sign his input to the ecrow transaction - let accepted_offer = - ActiveOffer::take(&wallet, taker_config, selected_offer)?.wait_on_maker(taker_config)?; - - accepted_offer.wait_on_fiat_confirmation()?; + let accepted_offer = ActiveOffer::take(&wallet, taker_config, selected_offer)?; + accepted_offer.wait_on_trade_ready_confirmation(taker_config)?; + if accepted_offer.fiat_confirmation_cli_input(taker_config)? { + // this represents the "confirm payment" / "confirm fiat recieved" button + TradeObligationsSatisfied::submit(&accepted_offer.offer_id_hex, taker_config)?; + println!("Waiting for other party to confirm the trade."); + // pull for other parties confirmation, then receive the transaction to create MuSig signature for (keyspend) to payout address + let payout_keyspend_psbt = IsOfferReadyRequest::poll_payout(taker_config, &accepted_offer)?; + // here we need to handle if the other party is not cooperating + } else { + println!("Trade failed."); + panic!("Escrow to be implemented!"); + } Ok(()) } diff --git a/taptrade-cli-demo/trader/src/trading/taker_utils.rs b/taptrade-cli-demo/trader/src/trading/taker_utils.rs index ddd9533..b267186 100644 --- a/taptrade-cli-demo/trader/src/trading/taker_utils.rs +++ b/taptrade-cli-demo/trader/src/trading/taker_utils.rs @@ -49,22 +49,4 @@ impl ActiveOffer { escrow_psbt: Some(escrow_contract_psbt), }) } - - pub fn wait_on_maker(self, taker_config: &TraderSettings) -> Result { - IsOfferReadyRequest::poll(taker_config, &self)?; - Ok(self) - } - - pub fn wait_on_fiat_confirmation(&self) -> Result<&Self> { - // let user confirm in CLI that the fiat payment has been sent/receivec - loop { - println!("Please confirm that the fiat payment has been sent/received. (y/N)"); - let mut input = String::new(); - std::io::stdin().read_line(&mut input)?; - if input.trim().to_lowercase() == "y" { - break; - } - } - Ok(self) - } } diff --git a/taptrade-cli-demo/trader/src/trading/utils.rs b/taptrade-cli-demo/trader/src/trading/utils.rs index 3d4ca35..eb483a3 100644 --- a/taptrade-cli-demo/trader/src/trading/utils.rs +++ b/taptrade-cli-demo/trader/src/trading/utils.rs @@ -1,4 +1,3 @@ -use super::maker_utils::*; use super::*; #[derive(Debug)] @@ -9,3 +8,34 @@ pub struct ActiveOffer { pub expected_payout_address: AddressInfo, pub escrow_psbt: Option, } + +impl ActiveOffer { + // polls till the other party signed the trade transaction and it got confirmed. + // once the coordinator signals OfferReady the fiat exchange can begin + pub fn wait_on_trade_ready_confirmation( + &self, + trader_config: &TraderSettings, + ) -> Result<&Self> { + IsOfferReadyRequest::poll(trader_config, &self)?; + Ok(&self) + } + + pub fn fiat_confirmation_cli_input(&self, trade_settings: &TraderSettings) -> Result { + // let user confirm in CLI that the fiat payment has been sent/received + println!("The escrow is now locked and the fiat exchange can begin safely."); + if trade_settings.trade_type.is_buy_order() { + println!("Please confirm that the fiat payment has been sent or go into mediation in case of problems. (y/M)"); + } else { + println!("Please confirm that the fiat payment has been received or go into mediation in case of problems. (y/M)"); + } + loop { + let mut input = String::new(); + std::io::stdin().read_line(&mut input)?; + if input.trim().to_lowercase() == "y" { + return Ok(true); + } else if input.trim() == "M" { + return Ok(false); + } + } + } +} diff --git a/taptrade-cli-demo/trader/src/wallet/mod.rs b/taptrade-cli-demo/trader/src/wallet/mod.rs index dfd1186..0bfa599 100644 --- a/taptrade-cli-demo/trader/src/wallet/mod.rs +++ b/taptrade-cli-demo/trader/src/wallet/mod.rs @@ -43,11 +43,8 @@ impl TradingWallet { pub fn load_wallet(trader_config: &TraderSettings) -> Result { let backend = ElectrumBlockchain::from(Client::new(&trader_config.electrum_endpoint)?); let wallet = Wallet::new( - Bip86(trader_config.wallet_xprv.clone(), KeychainKind::External), - Some(Bip86( - trader_config.wallet_xprv.clone(), - KeychainKind::Internal, - )), + Bip86(trader_config.wallet_xprv, KeychainKind::External), + Some(Bip86(trader_config.wallet_xprv, KeychainKind::Internal)), bitcoin::Network::Testnet, MemoryDatabase::default(), // non-permanent storage )?; @@ -64,7 +61,7 @@ impl TradingWallet { trader_config: &TraderSettings, ) -> Result<(PartiallySignedTransaction, MuSigData, AddressInfo)> { let trading_wallet = &self.wallet; - let bond = Bond::assemble(&self.wallet, &offer_conditions, trader_config)?; + let bond = Bond::assemble(&self.wallet, offer_conditions, trader_config)?; let payout_address: AddressInfo = trading_wallet.get_address(bdk::wallet::AddressIndex::LastUnused)?; let musig_data = MuSigData::create(&trader_config.wallet_xprv, trading_wallet.secp_ctx())?; diff --git a/taptrade-cli-demo/trader/todos.md b/taptrade-cli-demo/trader/todos.md index 0601a09..6dd43f0 100644 --- a/taptrade-cli-demo/trader/todos.md +++ b/taptrade-cli-demo/trader/todos.md @@ -1 +1,2 @@ -tbd +Thinks to improve when implementing the production ready library: +* make api more generic (smaller)