diff --git a/Cargo.lock b/Cargo.lock index 3b44b80..cea585d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,15 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" -dependencies = [ - "gimli", -] - [[package]] name = "adler" version = "1.0.2" @@ -206,12 +197,6 @@ dependencies = [ "strict_encoding", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "autocfg" version = "1.3.0" @@ -245,21 +230,6 @@ dependencies = [ "paste", ] -[[package]] -name = "backtrace" -version = "0.3.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "baid64" version = "0.2.2" @@ -424,27 +394,12 @@ dependencies = [ [[package]] name = "bp-derive" version = "0.11.0-beta.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0feca5f56441ef824fe6238c7718f28a21c74ab945e7ac1d1cc191a6b221e241" -dependencies = [ - "amplify", - "bitcoin_hashes", - "bp-consensus", - "bp-invoice 0.11.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)", - "commit_verify", - "indexmap 2.2.6", - "serde", -] - -[[package]] -name = "bp-derive" -version = "0.11.0-beta.6" -source = "git+https://github.com/will-bitlight/bp-std.git?branch=testnet4#cbadb4ded90ffa26ed68c8b97d5c6018f3828520" +source = "git+https://github.com/BP-WG/bp-std.git?branch=master#c291e0b54e21482e432f6836c02474c10d6b014e" dependencies = [ "amplify", "bitcoin_hashes", "bp-consensus", - "bp-invoice 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "bp-invoice", "commit_verify", "indexmap 2.2.6", "serde", @@ -457,7 +412,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21146e28b615c9b6f55b4af2240818ff218d823c6525b0572c673d1f3f0273fe" dependencies = [ "amplify", - "bp-std 0.11.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)", + "bp-std", "byteorder", "libc", "log", @@ -476,7 +431,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ffba40457f99cf5e7715858cdc743e05925686d23798b6b21221a4bb50b118" dependencies = [ "amplify", - "bp-std 0.11.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)", + "bp-std", "log", "serde", "serde_with", @@ -487,20 +442,7 @@ dependencies = [ [[package]] name = "bp-invoice" version = "0.11.0-beta.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f051e70a99388097774781b109fc7dd4f4e9b17820be777c2655c37175981b9" -dependencies = [ - "amplify", - "bech32", - "bitcoin_hashes", - "bp-consensus", - "serde", -] - -[[package]] -name = "bp-invoice" -version = "0.11.0-beta.6" -source = "git+https://github.com/will-bitlight/bp-std.git?branch=testnet4#cbadb4ded90ffa26ed68c8b97d5c6018f3828520" +source = "git+https://github.com/BP-WG/bp-std.git?branch=master#c291e0b54e21482e432f6836c02474c10d6b014e" dependencies = [ "amplify", "bech32", @@ -529,48 +471,32 @@ dependencies = [ [[package]] name = "bp-std" version = "0.11.0-beta.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573dcef793e4058c1a8c3632eb10d0486eff4979a2d753b51e8a06017922d8d7" -dependencies = [ - "amplify", - "bp-consensus", - "bp-derive 0.11.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)", - "bp-invoice 0.11.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)", - "descriptors 0.11.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)", - "psbt 0.11.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde", -] - -[[package]] -name = "bp-std" -version = "0.11.0-beta.6" -source = "git+https://github.com/will-bitlight/bp-std.git?branch=testnet4#cbadb4ded90ffa26ed68c8b97d5c6018f3828520" +source = "git+https://github.com/BP-WG/bp-std.git?branch=master#c291e0b54e21482e432f6836c02474c10d6b014e" dependencies = [ "amplify", "bp-consensus", - "bp-derive 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", - "bp-invoice 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", - "descriptors 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", - "psbt 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "bp-derive", + "bp-invoice", + "descriptors", + "psbt", "serde", ] [[package]] name = "bp-wallet" version = "0.11.0-beta.6.1" -source = "git+https://github.com/will-bitlight/bp-wallet.git?rev=bcba0d4#bcba0d49671731f2643ac34936e0d96048385ada" +source = "git+https://github.com/BP-WG/bp-wallet?branch=master#b63b7ac79771d9dc79d17d9de11c9e2ef53e4eac" dependencies = [ "amplify", "base64", "bp-electrum", "bp-esplora", - "bp-std 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "bp-std", "clap", - "descriptors 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "descriptors", "env_logger", "log", - "psbt 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", - "reqwest", + "psbt", "serde", "serde_json", "serde_yaml", @@ -591,12 +517,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "bytes" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" - [[package]] name = "cc" version = "1.0.99" @@ -750,16 +670,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation-sys" version = "0.8.6" @@ -848,22 +758,10 @@ dependencies = [ [[package]] name = "descriptors" version = "0.11.0-beta.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca5af8b4d31550689f92ccb34142b13b635d8e4316cc4a73a0c7254cf8170d16" -dependencies = [ - "amplify", - "bp-derive 0.11.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)", - "indexmap 2.2.6", - "serde", -] - -[[package]] -name = "descriptors" -version = "0.11.0-beta.6" -source = "git+https://github.com/will-bitlight/bp-std.git?branch=testnet4#cbadb4ded90ffa26ed68c8b97d5c6018f3828520" +source = "git+https://github.com/BP-WG/bp-std.git?branch=master#c291e0b54e21482e432f6836c02474c10d6b014e" dependencies = [ "amplify", - "bp-derive 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "bp-derive", "indexmap 2.2.6", "serde", ] @@ -911,15 +809,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if", -] - [[package]] name = "env_filter" version = "0.1.0" @@ -965,12 +854,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27ea9bdb2356e5a92403cf23ac493f9b43bd71e4ffd0f800862b841dd723994c" -[[package]] -name = "fastrand" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" - [[package]] name = "flate2" version = "1.0.30" @@ -996,21 +879,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1026,56 +894,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -1099,37 +917,12 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gimli" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" - [[package]] name = "glob" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "h2" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap 2.2.6", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "half" version = "2.4.1" @@ -1188,125 +981,12 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "http" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" -dependencies = [ - "bytes", - "futures-util", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" - [[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" -[[package]] -name = "hyper" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "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.9", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", -] - -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - -[[package]] -name = "hyper-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper", - "pin-project-lite", - "socket2", - "tokio", - "tower", - "tower-service", - "tracing", -] - [[package]] name = "iana-time-zone" version = "0.1.60" @@ -1368,12 +1048,6 @@ dependencies = [ "serde", ] -[[package]] -name = "ipnet" -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" @@ -1490,17 +1164,6 @@ dependencies = [ "adler", ] -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "wasi", - "windows-sys 0.48.0", -] - [[package]] name = "mirai-annotations" version = "1.12.0" @@ -1513,23 +1176,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2b8f3a258db515d5e91a904ce4ae3f73e091149b90cadbdb93d210bee07f63b" -[[package]] -name = "native-tls" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nom" version = "7.1.3" @@ -1555,65 +1201,12 @@ dependencies = [ "autocfg", ] -[[package]] -name = "object" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "openssl" -version = "0.10.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" -dependencies = [ - "bitflags 2.5.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.102" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "option-ext" version = "0.2.0" @@ -1632,44 +1225,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - [[package]] name = "powerfmt" version = "0.2.0" @@ -1704,30 +1259,15 @@ dependencies = [ [[package]] name = "psbt" version = "0.11.0-beta.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500d928c69d44b90fa22f3209fb8d349b436ef8973754ccfa085a8db8392e422" -dependencies = [ - "amplify", - "base64", - "bp-derive 0.11.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono", - "descriptors 0.11.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)", - "indexmap 2.2.6", - "serde", -] - -[[package]] -name = "psbt" -version = "0.11.0-beta.6" -source = "git+https://github.com/will-bitlight/bp-std.git?branch=testnet4#cbadb4ded90ffa26ed68c8b97d5c6018f3828520" +source = "git+https://github.com/BP-WG/bp-std.git?branch=master#c291e0b54e21482e432f6836c02474c10d6b014e" dependencies = [ "amplify", "base64", "bp-core", - "bp-derive 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "bp-derive", "chrono", "commit_verify", - "descriptors 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "descriptors", "indexmap 2.2.6", "serde", "strict_encoding", @@ -1812,50 +1352,6 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" -[[package]] -name = "reqwest" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-tls", - "hyper-util", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "system-configuration", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - [[package]] name = "rgb-core" version = "0.11.0-beta.6" @@ -1880,7 +1376,7 @@ dependencies = [ [[package]] name = "rgb-interfaces" version = "0.11.0-beta.6" -source = "git+https://github.com/will-bitlight/rgb-interfaces.git?rev=19526d5#19526d587e97b40f0880796cdde240447290b6ba" +source = "git+https://github.com/RGB-WG/rgb-interfaces.git?branch=master#05166e951f9b4b0663114d1e248f840ffbfe8f23" dependencies = [ "aluvm", "amplify", @@ -1896,12 +1392,12 @@ dependencies = [ [[package]] name = "rgb-invoice" version = "0.11.0-beta.6" -source = "git+https://github.com/will-bitlight/rgb-std.git?rev=78a4951#78a4951e5d029ce81f4f5794df2db6effee18b28" +source = "git+https://github.com/RGB-WG/rgb-std?branch=master#48bb105d8b99d2c88dfbb574cee9ecb2021c439b" dependencies = [ "amplify", "baid64", "bp-core", - "bp-invoice 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "bp-invoice", "fast32", "fluent-uri", "indexmap 2.2.6", @@ -1920,10 +1416,10 @@ dependencies = [ "amplify", "baid64", "bp-core", - "bp-std 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "bp-std", "commit_verify", "getrandom", - "psbt 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "psbt", "rand", "rgb-std", "strict_encoding", @@ -1940,14 +1436,13 @@ dependencies = [ "bp-core", "bp-electrum", "bp-esplora", - "bp-std 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "bp-std", "bp-wallet", "chrono", "commit_verify", - "descriptors 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "descriptors", "indexmap 2.2.6", "log", - "reqwest", "rgb-interfaces", "rgb-psbt", "rgb-std", @@ -1959,7 +1454,7 @@ dependencies = [ [[package]] name = "rgb-std" version = "0.11.0-beta.6" -source = "git+https://github.com/will-bitlight/rgb-std.git?rev=78a4951#78a4951e5d029ce81f4f5794df2db6effee18b28" +source = "git+https://github.com/RGB-WG/rgb-std?branch=master#48bb105d8b99d2c88dfbb574cee9ecb2021c439b" dependencies = [ "aluvm", "amplify", @@ -1987,13 +1482,13 @@ dependencies = [ "amplify", "baid64", "bp-seals", - "bp-std 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "bp-std", "bp-wallet", "clap", "commit_verify", "env_logger", "log", - "psbt 0.11.0-beta.6 (git+https://github.com/will-bitlight/bp-std.git?branch=testnet4)", + "psbt", "rgb-interfaces", "rgb-runtime", "rgb-std", @@ -2029,12 +1524,6 @@ dependencies = [ "digest", ] -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - [[package]] name = "rustc-hash" version = "1.1.0" @@ -2083,16 +1572,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustls-pemfile" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" -dependencies = [ - "base64", - "rustls-pki-types", -] - [[package]] name = "rustls-pki-types" version = "1.7.0" @@ -2117,15 +1596,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" -[[package]] -name = "schannel" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "scoped-tls" version = "1.0.1" @@ -2195,29 +1665,6 @@ dependencies = [ "secp256k1-sys 0.9.2", ] -[[package]] -name = "security-framework" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" -dependencies = [ - "bitflags 2.5.0", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "serde" version = "1.0.203" @@ -2268,18 +1715,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "serde_with" version = "3.8.1" @@ -2358,31 +1793,6 @@ dependencies = [ "amplify_derive", ] -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "socket2" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "socks" version = "0.3.4" @@ -2489,45 +1899,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" - -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tempfile" -version = "3.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" -dependencies = [ - "cfg-if", - "fastrand", - "rustix", - "windows-sys 0.52.0", -] - [[package]] name = "thiserror" version = "1.0.61" @@ -2594,55 +1965,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" -[[package]] -name = "tokio" -version = "1.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "pin-project-lite", - "socket2", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "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.9", - "rustls-pki-types", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - [[package]] name = "toml" version = "0.8.14" @@ -2677,58 +1999,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "typenum" version = "1.17.0" @@ -2805,12 +2075,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" @@ -2827,15 +2091,6 @@ dependencies = [ "strict_encoding", ] -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3149,16 +2404,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "zeroize" version = "1.8.1" @@ -3178,13 +2423,3 @@ dependencies = [ "quote", "syn 2.0.66", ] - -[[patch.unused]] -name = "bp-wallet" -version = "0.11.0-beta.6.1" -source = "git+https://github.com/BP-WG/bp-wallet?branch=master#783d977240ab1e8e0f5edfe0befba9a561971d8d" - -[[patch.unused]] -name = "rgb-std" -version = "0.11.0-beta.6" -source = "git+https://github.com/RGB-WG/rgb-std?branch=master#7ac337b3d84204e43f3818d298f7fc46b24341c2" diff --git a/Cargo.toml b/Cargo.toml index cdc5109..9b09f21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,15 +28,12 @@ strict_types = "2.7.0-beta.4" commit_verify = "0.11.0-beta.6" bp-core = "0.11.0-beta.6" bp-seals = "0.11.0-beta.6" -# TODO: To test testnet4 upstream and downstream, -# git dependencies were used temporarily during development -bp-std = { git = "https://github.com/will-bitlight/bp-std.git", branch = "testnet4"} -descriptors = { git = "https://github.com/will-bitlight/bp-std.git", branch = "testnet4"} -psbt = { git = "https://github.com/will-bitlight/bp-std.git", branch = "testnet4", features = ["client-side-validation"]} -bp-wallet = { git = "https://github.com/will-bitlight/bp-wallet.git", rev = "bcba0d4", features = ["cli"]} -rgb-std = { git = "https://github.com/will-bitlight/rgb-std.git", rev = "78a4951", features = ["fs"]} -rgb-interfaces = { git = "https://github.com/will-bitlight/rgb-interfaces.git", rev = "19526d5"} - +bp-std = "0.11.0-beta.6" +descriptors = "0.11.0-beta.6" +psbt = { version = "0.11.0-beta.6", features = ["client-side-validation"] } +bp-wallet = { version = "0.11.0-beta.6.1", features = ["cli"] } +rgb-std = { version = "0.11.0-beta.6", features = ["fs"] } +rgb-interfaces = "0.11.0-beta.6" bp-electrum = "0.11.0-beta.6" bp-esplora = { version = "0.11.0-beta.6", default-features = false, features = ["blocking"] } rgb-psbt = { version = "0.11.0-beta.6", path = "psbt" } @@ -45,7 +42,6 @@ chrono = "0.4.31" serde_crate = { package = "serde", version = "1", features = ["derive"] } serde_yaml = "0.9.19" log = { version = "0.4", features = ["max_level_trace", "release_max_level_debug"] } -reqwest = { version = "0.12", features = ["json", "blocking"] } [package] name = "rgb-runtime" @@ -84,7 +80,6 @@ chrono = { workspace = true } serde_crate = { workspace = true, optional = true } serde_yaml = { workspace = true, optional = true } log = { workspace = true, optional = true } -reqwest = { workspace = true, optional = true } [features] default = ["esplora_blocking", "mempool_blocking"] @@ -94,12 +89,17 @@ cli = ["fs"] esplora_blocking = ["bp-esplora"] electrum_blocking = ["bp-electrum"] serde = ["serde_crate", "serde_yaml", "bp-std/serde", "descriptors/serde", "rgb-psbt/serde"] -mempool_blocking = ["reqwest"] +mempool_blocking = ["esplora_blocking"] [package.metadata.docs.rs] features = ["all"] [patch.crates-io] -bp-wallet = { git = "https://github.com/BP-WG/bp-wallet", branch = "master" } +bp-wallet = { git = "https://github.com/BP-WG/bp-wallet", branch = "master", features = ["cli"] } rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "master" } rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "master" } +bp-std = { git = "https://github.com/BP-WG/bp-std.git", branch = "master" } +bp-invoice = { git = "https://github.com/BP-WG/bp-std.git", branch = "master"} +psbt = { git = "https://github.com/BP-WG/bp-std.git", branch = "master" } +descriptors = { git = "https://github.com/BP-WG/bp-std.git", branch = "master" } +rgb-interfaces = { git = "https://github.com/RGB-WG/rgb-interfaces.git", branch = "master" } diff --git a/cli/src/args.rs b/cli/src/args.rs index 8b87ddb..eb81257 100644 --- a/cli/src/args.rs +++ b/cli/src/args.rs @@ -135,14 +135,15 @@ impl RgbArgs { } pub fn resolver(&self) -> Result { - let resolver = match (&self.resolver.esplora, &self.resolver.electrum, &self.resolver.mempool) { - (None, Some(url), None) => AnyResolver::electrum_blocking(url, None), - (Some(url), None, None) => AnyResolver::esplora_blocking(url, None), - (None, None, Some(url)) => AnyResolver::mempool_blocking(url, None), - _ => Err(s!(" - error: no transaction resolver is specified; use either --esplora \ - or --electrum argument")), - } - .map_err(WalletError::Resolver)?; + let resolver = + match (&self.resolver.esplora, &self.resolver.electrum, &self.resolver.mempool) { + (None, Some(url), None) => AnyResolver::electrum_blocking(url, None), + (Some(url), None, None) => AnyResolver::esplora_blocking(url, None), + (None, None, Some(url)) => AnyResolver::mempool_blocking(url, None), + _ => Err(s!(" - error: no transaction resolver is specified; use either \ + --esplora --mempool or --electrum argument")), + } + .map_err(WalletError::Resolver)?; resolver.check(self.general.network)?; Ok(resolver) } diff --git a/src/indexers/any.rs b/src/indexers/any.rs index 5dfe0c4..e73eb5c 100644 --- a/src/indexers/any.rs +++ b/src/indexers/any.rs @@ -70,11 +70,12 @@ impl AnyResolver { } #[cfg(feature = "mempool_blocking")] - pub fn mempool_blocking(url: &str, _: Option<()>) -> Result { + pub fn mempool_blocking(url: &str, config: Option) -> Result { Ok(AnyResolver { - inner: Box::new( - super::mempool_blocking::MemPoolClient::new(url), - ), + inner: Box::new(super::mempool_blocking::MemPoolClient::new( + url, + config.unwrap_or_default(), + )?), terminal_txes: Default::default(), }) } diff --git a/src/indexers/mempool_blocking.rs b/src/indexers/mempool_blocking.rs index 185ae3b..3a1e440 100644 --- a/src/indexers/mempool_blocking.rs +++ b/src/indexers/mempool_blocking.rs @@ -19,182 +19,110 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::io::Cursor; - -use bp::{ConsensusDecode, Tx}; +use bp::Tx; use bpstd::{Network, Txid}; -use esplora::{Error, TxStatus}; -use rgbstd::{WitnessAnchor, WitnessOrd, WitnessPos}; +use esplora::{BlockingClient, Config, Error}; +use rgbstd::WitnessAnchor; use super::RgbResolver; -use crate::XWitnessId; #[derive(Clone, Debug)] /// Represents a client for interacting with a mempool. +// Currently, this client is wrapping an `esplora::BlockingClient` instance. +// If the mempool service changes in the future and is not compatible with +// esplora::BlockingClient, Only the internal implementation needs to be +// modified pub struct MemPoolClient { - url: String, + inner: BlockingClient, } -/// Represents a client for interacting with a mempool. impl MemPoolClient { - /// Creates a new instance of `MemPoolClient` with the specified URL. + /// Creates a new `MemPoolClient` instance. /// /// # Arguments /// - /// * `url` - The URL of the mempool. + /// * `url` - The URL of the mempool server. + /// * `config` - The configuration for the mempool client. /// /// # Returns /// - /// A new instance of `MemPoolClient`. - pub fn new(url: &str) -> Self { - MemPoolClient { - url: url.to_string(), - } + /// Returns a `Result` containing the `MemPoolClient` instance if + /// successful, or an `Error` if an error occurred. + pub fn new(url: &str, config: Config) -> Result { + let inner = BlockingClient::from_config(url, config)?; + Ok(MemPoolClient { inner }) } } impl RgbResolver for MemPoolClient { - fn check(&self, _network: Network, expected_block_hash: String) -> Result<(), String> { - // check the mempool server is for the correct network - let block_hash = self.block_hash(0)?; - if expected_block_hash != block_hash { - return Err(s!("resolver is for a network different from the wallet's one")); - } - Ok(()) + fn check(&self, network: Network, expected_block_hash: String) -> Result<(), String> { + self.inner.check(network, expected_block_hash) } fn resolve_height(&mut self, txid: Txid) -> Result { - let status = self.tx_status(&txid)?; - let ord = match status - .block_height - .and_then(|h| status.block_time.map(|t| (h, t))) - { - Some((h, t)) => { - WitnessOrd::OnChain(WitnessPos::new(h, t as i64).ok_or(Error::InvalidServerData)?) - } - None => WitnessOrd::OffChain, - }; - Ok(WitnessAnchor { - witness_ord: ord, - witness_id: XWitnessId::Bitcoin(txid), - }) + self.inner.resolve_height(txid) } fn resolve_pub_witness(&self, txid: Txid) -> Result> { - self.tx(&txid).map_err(|e| { - if e.contains("Transaction not found") { - None - } else { - Some(e) - } - }) - } -} - -/// Implementation of a MemPoolClient struct. -impl MemPoolClient { - /// Retrieves the block hash for a given height from mempool.space. - /// - /// # Arguments - /// - /// * `height` - The height of the block. - /// - /// # Returns - /// - /// Returns a Result containing the block hash as a String if successful, or an error message as a String if unsuccessful. - fn block_hash(&self, height: u32) -> Result { - let url = self.url.as_str(); - let http_response = reqwest::blocking::get(format!("{url}/block-height/{height}")) - .map_err(|err| format!("Failed to get block-hash from mempool.space: {}", err))?; - let response = http_response - .text() - .map_err(|err| format!("Failed to get block-hash from mempool.space: {}", err))?; - Ok(response) - } - - /// Retrieves the transaction status for a given transaction ID from mempool.space. - /// - /// # Arguments - /// - /// * `txid` - The transaction ID. - /// - /// # Returns - /// - /// Returns a Result containing the transaction status as a TxStatus enum if successful, or an error message as a String if unsuccessful. - fn tx_status(&self, txid: &Txid) -> Result { - let url = self.url.as_str(); - let http_response = reqwest::blocking::get(format!("{url}/tx/{txid}/status")) - .map_err(|err| format!("Failed to get tx status from mempool.space: {}", err))?; - let response = http_response - .json::() - .map_err(|err| format!("Failed to get tx status from mempool.space: {}", err))?; - Ok(response) - } - - /// Retrieves the transaction for a given transaction ID from mempool.space. - /// - /// # Arguments - /// - /// * `txid` - The transaction ID. - /// - /// # Returns - /// - /// Returns a Result containing the transaction as a Tx struct if successful, or an error message as a String if unsuccessful. - fn tx(&self, txid: &Txid) -> Result { - let url = self.url.as_str(); - let http_response = reqwest::blocking::get(format!("{url}/tx/{txid}/raw")) - .map_err(|err| format!("Failed to get tx from mempool.space: {}", err))?; - let bytes = http_response - .bytes() - .map_err(|err| format!("Failed to get tx from mempool.space: {}", err))?; - let tx = Tx::consensus_decode(&mut Cursor::new(bytes)) - .map_err(|err| format!("Failed to get tx from mempool.space: {}", err))?; - Ok(tx) + self.inner.resolve_pub_witness(txid) } } #[cfg(test)] mod test { + use esplora::Config; #[test] fn test_mempool_client_mainnet_tx() { - let client = super::MemPoolClient::new("https://mempool.space/api"); + let client = super::MemPoolClient::new("https://mempool.space/api", Config::default()) + .expect("Failed to create client"); let txid = "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" .parse() .unwrap(); - let status = client.tx_status(&txid).unwrap(); + let status = client.inner.tx_status(&txid).unwrap(); assert_eq!(status.block_height, Some(0)); assert_eq!(status.block_time, Some(1231006505)); } #[test] fn test_mempool_client_testnet_tx() { - let client = super::MemPoolClient::new("https://mempool.space/testnet/api"); + let client = + super::MemPoolClient::new("https://mempool.space/testnet/api", Config::default()) + .expect("Failed to create client"); + let txid = "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" .parse() .unwrap(); - let status = client.tx_status(&txid).unwrap(); + let status = client.inner.tx_status(&txid).unwrap(); assert_eq!(status.block_height, Some(0)); assert_eq!(status.block_time, Some(1296688602)); } #[test] fn test_mempool_client_testnet4_tx() { - let client = super::MemPoolClient::new("https://mempool.space/testnet4/api"); + let client = + super::MemPoolClient::new("https://mempool.space/testnet4/api", Config::default()) + .expect("Failed to create client"); let txid = "7aa0a7ae1e223414cb807e40cd57e667b718e42aaf9306db9102fe28912b7b4e" .parse() .unwrap(); - let status = client.tx_status(&txid).unwrap(); + let status = client.inner.tx_status(&txid).unwrap(); assert_eq!(status.block_height, Some(0)); assert_eq!(status.block_time, Some(1714777860)); } #[test] fn test_mempool_client_testnet4_tx_detail() { - let client = super::MemPoolClient::new("https://mempool.space/testnet4/api"); + let client = + super::MemPoolClient::new("https://mempool.space/testnet4/api", Config::default()) + .expect("Failed to create client"); let txid = "7aa0a7ae1e223414cb807e40cd57e667b718e42aaf9306db9102fe28912b7b4e" .parse() .unwrap(); - let tx = client.tx(&txid).expect("Failed to get tx"); + let tx = client + .inner + .tx(&txid) + .expect("Failed to get tx") + .expect("Tx not found"); assert!(tx.inputs.len() > 0); assert!(tx.outputs.len() > 0); assert_eq!(tx.outputs[0].value, 5_000_000_000);