diff --git a/Cargo.lock b/Cargo.lock index f858cf0..6aa57b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,6 +26,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "0.6.18" @@ -78,9 +87,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.99" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "arrayvec" @@ -88,6 +97,39 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "atomic-waker" version = "1.1.2" @@ -100,6 +142,51 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "axum" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5" +dependencies = [ + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", +] + [[package]] name = "backtrace" version = "0.3.75" @@ -115,12 +202,31 @@ dependencies = [ "windows-targets 0.52.6", ] +[[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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "bigdecimal" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a22f228ab7a1b23027ccc6c350b72868017af7ea8356fbdf19f8d991c690013" +dependencies = [ + "autocfg", + "libm", + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "bitcoin-io" version = "0.1.3" @@ -137,12 +243,94 @@ dependencies = [ "hex-conservative", ] +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" +[[package]] +name = "bollard" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899ca34eb6924d6ec2a77c6f7f5c7339e60fd68235eaf91edd5a15f12958bb06" +dependencies = [ + "async-stream", + "base64 0.22.1", + "bitflags 2.9.4", + "bollard-buildkit-proto", + "bollard-stubs", + "bytes", + "chrono", + "futures-core", + "futures-util", + "hex", + "home", + "http", + "http-body-util", + "hyper", + "hyper-named-pipe", + "hyper-rustls", + "hyper-util", + "hyperlocal", + "log", + "num", + "pin-project-lite", + "rand 0.9.2", + "rustls", + "rustls-native-certs", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_derive", + "serde_json", + "serde_repr", + "serde_urlencoded", + "thiserror", + "tokio", + "tokio-stream", + "tokio-util", + "tonic", + "tower-service", + "url", + "winapi", +] + +[[package]] +name = "bollard-buildkit-proto" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40b3e79f8bd0f25f32660e3402afca46fd91bebaf135af017326d905651f8107" +dependencies = [ + "prost", + "prost-types", + "tonic", + "ureq", +] + +[[package]] +name = "bollard-stubs" +version = "1.48.3-rc.28.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ea257e555d16a2c01e5593f40b73865cdf12efbceda33c6d14a2d8d1490368" +dependencies = [ + "base64 0.22.1", + "bollard-buildkit-proto", + "bytes", + "chrono", + "prost", + "serde", + "serde_json", + "serde_repr", + "serde_with", +] + [[package]] name = "bumpalo" version = "3.19.0" @@ -177,6 +365,18 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +[[package]] +name = "chrono" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link 0.2.0", +] + [[package]] name = "clap" version = "4.5.27" @@ -245,12 +445,67 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "deranged" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d630bccd429a5bb5a64b5e94f693bfc48c9f8566418fda4c494cc94f911f87cc" +dependencies = [ + "powerfmt", + "serde", +] + [[package]] name = "displaydoc" version = "0.2.5" @@ -262,6 +517,29 @@ dependencies = [ "syn", ] +[[package]] +name = "docker_credential" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d89dfcba45b4afad7450a99b39e751590463e45c04728cf555d36bb66940de8" +dependencies = [ + "base64 0.21.7", + "serde", + "serde_json", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + [[package]] name = "encode_unicode" version = "1.0.0" @@ -293,12 +571,35 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "etcetera" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26c7b13d0780cb82722fd59f6f57f925e143427e4a75313a6c77243bf5326ae6" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.59.0", +] + [[package]] name = "fastrand" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +[[package]] +name = "filetime" +version = "0.2.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed" +dependencies = [ + "cfg-if", + "libc", + "libredox", + "windows-sys 0.60.2", +] + [[package]] name = "find-msvc-tools" version = "0.1.1" @@ -335,6 +636,21 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.31" @@ -342,6 +658,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -350,6 +667,34 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "futures-sink" version = "0.3.31" @@ -368,10 +713,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ + "futures-channel", "futures-core", + "futures-io", + "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", + "slab", ] [[package]] @@ -415,13 +766,19 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap", + "indexmap 2.11.4", "slab", "tokio", "tokio-util", "tracing", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.15.4" @@ -449,6 +806,15 @@ dependencies = [ "arrayvec", ] +[[package]] +name = "home" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "http" version = "1.3.1" @@ -489,6 +855,12 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + [[package]] name = "hyper" version = "1.6.0" @@ -502,6 +874,7 @@ dependencies = [ "http", "http-body", "httparse", + "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -509,6 +882,21 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-named-pipe" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b7d8abf35697b81a825e386fc151e0d503e8cb5fcb93cc8669c376dfd6f278" +dependencies = [ + "hex", + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", + "winapi", +] + [[package]] name = "hyper-rustls" version = "0.27.7" @@ -525,6 +913,19 @@ dependencies = [ "tower-service", ] +[[package]] +name = "hyper-timeout" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +dependencies = [ + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -547,7 +948,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d9b05277c7e8da2c93a568989bb6207bef0112e8d17df7a6eda4a3cf143bc5e" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "futures-channel", "futures-core", @@ -559,7 +960,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2", + "socket2 0.6.0", "system-configuration", "tokio", "tower-service", @@ -567,6 +968,45 @@ dependencies = [ "windows-registry", ] +[[package]] +name = "hyperlocal" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "986c5ce3b994526b3cd75578e62554abd09f0899d6206de48b3e96ab34ccc8c7" +dependencies = [ + "hex", + "http-body-util", + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "icu_collections" version = "2.0.0" @@ -653,6 +1093,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "1.0.3" @@ -676,12 +1122,25 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.10.0" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.4", + "serde", + "serde_core", ] [[package]] @@ -714,7 +1173,7 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" dependencies = [ - "bitflags", + "bitflags 2.9.4", "cfg-if", "libc", ] @@ -741,6 +1200,15 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.15" @@ -762,6 +1230,7 @@ name = "kermit" version = "0.1.0" dependencies = [ "anyhow", + "bigdecimal", "clap", "hex", "insta", @@ -772,6 +1241,7 @@ dependencies = [ "serde", "serde_json", "strum", + "testcontainers", "tokio", ] @@ -781,6 +1251,23 @@ version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "libredox" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4488594b9328dee448adb906d8b126d9b7deb7cf5c22161ee591610bb1be83c0" +dependencies = [ + "bitflags 2.9.4", + "libc", + "redox_syscall 0.5.13", +] + [[package]] name = "linux-raw-sys" version = "0.9.4" @@ -809,6 +1296,12 @@ version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + [[package]] name = "memchr" version = "2.7.5" @@ -853,11 +1346,90 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework", + "security-framework 2.11.1", "security-framework-sys", "tempfile", ] +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[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-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "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", +] + [[package]] name = "object" version = "0.36.7" @@ -879,7 +1451,7 @@ version = "0.10.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" dependencies = [ - "bitflags", + "bitflags 2.9.4", "cfg-if", "foreign-types", "libc", @@ -935,17 +1507,62 @@ checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.13", "smallvec", "windows-targets 0.52.6", ] +[[package]] +name = "parse-display" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914a1c2265c98e2446911282c6ac86d8524f495792c38c5bd884f80499c7538a" +dependencies = [ + "parse-display-derive", + "regex", + "regex-syntax", +] + +[[package]] +name = "parse-display-derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ae7800a4c974efd12df917266338e79a7a74415173caf7e70aa0a0707345281" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "regex-syntax", + "structmeta", + "syn", +] + [[package]] name = "percent-encoding" version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "pin-project" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -973,6 +1590,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.20" @@ -991,6 +1614,38 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "prost" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "prost-types" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16" +dependencies = [ + "prost", +] + [[package]] name = "quote" version = "1.0.40" @@ -1013,8 +1668,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", ] [[package]] @@ -1024,7 +1689,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", ] [[package]] @@ -1036,13 +1711,51 @@ dependencies = [ "getrandom 0.2.16", ] +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" dependencies = [ - "bitflags", + "bitflags 2.9.4", +] + +[[package]] +name = "ref-cast" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1080,7 +1793,7 @@ version = "0.12.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "encoding_rs", "futures-core", @@ -1140,7 +1853,7 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ - "bitflags", + "bitflags 2.9.4", "errno", "libc", "linux-raw-sys", @@ -1153,13 +1866,36 @@ version = "0.23.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2491382039b29b9b11ff08b76ff6c97cf287671dbb74f0be44bda389fffe9bd1" dependencies = [ + "log", "once_cell", + "ring", "rustls-pki-types", "rustls-webpki", "subtle", "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework 3.4.0", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "rustls-pki-types" version = "1.12.0" @@ -1190,15 +1926,39 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" name = "ryu" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] [[package]] -name = "schannel" -version = "0.1.27" +name = "schemars" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" dependencies = [ - "windows-sys 0.59.0", + "dyn-clone", + "ref-cast", + "serde", + "serde_json", ] [[package]] @@ -1214,7 +1974,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b50c5943d326858130af85e049f2661ba3c78b26589b8ab98e65e80ae44a1252" dependencies = [ "bitcoin_hashes", - "rand", + "rand 0.8.5", "secp256k1-sys", ] @@ -1233,8 +1993,21 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags", - "core-foundation", + "bitflags 2.9.4", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b369d18893388b345804dc0007963c99b7d665ae71d275812d828c6f089640" +dependencies = [ + "bitflags 2.9.4", + "core-foundation 0.10.1", "core-foundation-sys", "libc", "security-framework-sys", @@ -1242,9 +2015,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.14.0" +version = "2.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" dependencies = [ "core-foundation-sys", "libc", @@ -1252,18 +2025,28 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.219" +version = "1.0.226" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dca6411025b24b60bfa7ec1fe1f8e710ac09782dca409ee8237ba74b51295fd" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.226" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "ba2ba63999edb9dac981fb34b3e5c0d111a69b0924e253ed29d83f7c99e966a4" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.226" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "8db53ae22f34573731bafa1db20f04027b2d25e02d8205921b569171699cdb33" dependencies = [ "proc-macro2", "quote", @@ -1272,14 +2055,26 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.143" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ "itoa", "memchr", "ryu", "serde", + "serde_core", +] + +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1294,6 +2089,38 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.11.4", + "schemars 0.9.0", + "schemars 1.0.4", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1330,6 +2157,16 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "socket2" version = "0.6.0" @@ -1352,6 +2189,29 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "structmeta" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e1575d8d40908d70f6fd05537266b90ae71b15dbbe7a8b7dffa2b759306d329" +dependencies = [ + "proc-macro2", + "quote", + "structmeta-derive", + "syn", +] + +[[package]] +name = "structmeta-derive" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "strum" version = "0.26.3" @@ -1417,8 +2277,8 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags", - "core-foundation", + "bitflags 2.9.4", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -1445,6 +2305,86 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "testcontainers" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b92bce247dc9260a19808321e11b51ea6a0293d02b48ab1c6578960610cfa2a7" +dependencies = [ + "async-trait", + "bollard", + "bollard-stubs", + "bytes", + "docker_credential", + "either", + "etcetera", + "futures", + "log", + "memchr", + "parse-display", + "pin-project-lite", + "serde", + "serde_json", + "serde_with", + "thiserror", + "tokio", + "tokio-stream", + "tokio-tar", + "tokio-util", + "ulid", + "url", +] + +[[package]] +name = "thiserror" +version = "2.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.3.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83bde6f1ec10e72d583d91623c939f623002284ef622b87de38cfd546cbf2031" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" + +[[package]] +name = "time-macros" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinystr" version = "0.8.1" @@ -1470,7 +2410,7 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "slab", - "socket2", + "socket2 0.6.0", "tokio-macros", "windows-sys 0.59.0", ] @@ -1506,6 +2446,32 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-tar" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5714c010ca3e5c27114c1cdeb9d14641ace49874aa5626d7149e47aedace75" +dependencies = [ + "filetime", + "futures-core", + "libc", + "redox_syscall 0.3.5", + "tokio", + "tokio-stream", + "xattr", +] + [[package]] name = "tokio-util" version = "0.7.15" @@ -1519,6 +2485,35 @@ dependencies = [ "tokio", ] +[[package]] +name = "tonic" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e581ba15a835f4d9ea06c55ab1bd4dce26fc53752c69a04aac00703bfb49ba9" +dependencies = [ + "async-trait", + "axum", + "base64 0.22.1", + "bytes", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-timeout", + "hyper-util", + "percent-encoding", + "pin-project", + "prost", + "socket2 0.5.10", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower" version = "0.5.2" @@ -1527,11 +2522,15 @@ checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", + "indexmap 2.11.4", "pin-project-lite", + "slab", "sync_wrapper", "tokio", + "tokio-util", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -1540,7 +2539,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" dependencies = [ - "bitflags", + "bitflags 2.9.4", "bytes", "futures-util", "http", @@ -1571,9 +2570,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tracing-core" version = "0.1.34" @@ -1589,11 +2600,21 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "ulid" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "470dbf6591da1b39d43c14523b2b469c86879a53e8b758c8e090a470fe7b1fbe" +dependencies = [ + "rand 0.9.2", + "web-time", +] + [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" [[package]] name = "untrusted" @@ -1601,6 +2622,21 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "ureq" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d" +dependencies = [ + "base64 0.22.1", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "url", + "webpki-roots 0.26.11", +] + [[package]] name = "url" version = "2.5.4" @@ -1610,6 +2646,7 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] [[package]] @@ -1735,21 +2772,112 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.2", +] + +[[package]] +name = "webpki-roots" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.62.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57fe7168f7de578d2d8a05b07fd61870d2e73b4020e9f49aa00da8471723497c" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.0", + "windows-result 0.4.0", + "windows-strings 0.5.0", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "windows-link" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" + [[package]] name = "windows-registry" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e" dependencies = [ - "windows-link", - "windows-result", - "windows-strings", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", ] [[package]] @@ -1758,7 +2886,16 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7084dcc306f89883455a206237404d3eaf961e5bd7e0f312f7c91f57eb44167f" +dependencies = [ + "windows-link 0.2.0", ] [[package]] @@ -1767,7 +2904,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7218c655a553b0bed4426cf54b20d7ba363ef543b52d515b3e48d7fd55318dda" +dependencies = [ + "windows-link 0.2.0", ] [[package]] @@ -1931,7 +3077,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags", + "bitflags 2.9.4", ] [[package]] @@ -1940,6 +3086,16 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" +[[package]] +name = "xattr" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3a19837351dc82ba89f8a125e22a3c475f05aba604acc023d62b2739ae2909" +dependencies = [ + "libc", + "rustix", +] + [[package]] name = "yoke" version = "0.8.0" diff --git a/Cargo.toml b/Cargo.toml index ea4893a..d64f032 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,13 +3,45 @@ name = "kermit" version = "0.1.0" edition = "2021" +[lints.rust] +missing-debug-implementations = "warn" +unused-must-use = "deny" +unnameable-types = "warn" + +[lints.clippy] +all = { level = "warn", priority = -1 } +explicit-into-iter-loop = "warn" +if-not-else = "warn" +ignored-unit-patterns = "warn" +inconsistent-struct-constructor = "warn" +large-enum-variant = "allow" +match-bool = "warn" +missing-const-for-fn = "warn" +missing-fields-in-debug = "warn" +needless-for-each = "warn" +needless-pass-by-value = "warn" +needless-raw-string-hashes = "warn" +non-std-lazy-statics = "warn" +option-if-let-else = "warn" +redundant-clone = "warn" +redundant-closure-for-method-calls = "warn" +ref-option = "warn" +semicolon-if-nothing-returned = "warn" +single-char-pattern = "warn" +uninlined-format-args = "warn" +unnecessary-semicolon = "warn" +unnecessary-wraps = "warn" +unused-self = "warn" +use-self = "warn" + [dependencies] -anyhow = "1.0.99" +anyhow = "1.0.100" +bigdecimal = "0.4.8" clap = { version = "4", features = ["derive", "env"] } regex = "1.11.2" reqwest = { version = "0.12.23", features = ["json"] } -serde = {version = "1.0.219", features = ["derive"] } -serde_json = "1.0.143" +serde = {version = "1.0.226", features = ["derive"] } +serde_json = "1.0.145" strum = { version = "0.26.3", features = ["derive"] } hex = "0.4.3" secp256k1 = "0.30.0" @@ -18,3 +50,4 @@ tokio = { version = "1.47.1", features = ["full"] } [dev-dependencies] insta = { version = "1", features = ["filters"] } insta-cmd = "0.6.0" +testcontainers = "0.25.0" diff --git a/src/address.rs b/src/address.rs deleted file mode 100644 index 45e771e..0000000 --- a/src/address.rs +++ /dev/null @@ -1,39 +0,0 @@ -use anyhow::Result; -use clap::Parser; - -use crate::utils::{get, print_output}; - -#[derive(Parser)] -pub enum AddressSubcommands { - #[command(visible_alias = "b")] - Balance { - address: String, - #[arg(short, long, default_value_t = false)] - mem_pool: bool, - }, - #[command(visible_alias = "u")] - Utxos { address: String }, - #[command(visible_alias = "g")] - Group { address: String }, -} - -impl AddressSubcommands { - pub async fn run(self, url: String) -> Result<()> { - let endpoint = match self { - Self::Balance { address, mem_pool } => { - format!("/addresses/{address}/balance?mempool={mem_pool}") - }, - Self::Utxos { address } => { - format!("/addresses/{address}/utxos") - }, - Self::Group { address } => { - format!("/addresses/{address}/group") - }, - }; - - let output = get(&url, &endpoint).await?; - print_output(output)?; - - Ok(()) - } -} diff --git a/src/addresses.rs b/src/addresses.rs new file mode 100644 index 0000000..4df310c --- /dev/null +++ b/src/addresses.rs @@ -0,0 +1,55 @@ +use anyhow::Result; +use clap::Parser; + +use crate::common::{get, print_output}; + +/// CLI arguments for `kermit addresses`. +#[derive(Parser)] +pub(crate) enum AddressesSubcommands { + /// Get the balance of an address. + #[command(visible_alias = "b")] + Balance { + address: String, + #[arg(short, long, default_value_t = false)] + mem_pool: bool, + }, + + /// Get the UTXOs of an address. + #[command(visible_alias = "u")] + Utxos { + address: String, + #[arg(short, long, default_value_t = false)] + error_if_exceed_max_utxos: bool, + }, + + /// Get the group of an address. + #[command(visible_alias = "g")] + Group { address: String }, +} + +impl AddressesSubcommands { + pub(crate) async fn run(self, url: String) -> Result<()> { + let endpoint = match self { + Self::Balance { address, mem_pool } => { + format!("/addresses/{address}/balance?mempool={mem_pool}") + }, + Self::Utxos { + address, + error_if_exceed_max_utxos, + } => { + format!( + "/addresses/{address}/utxos?\ + error_if_exceed_max_utxos={error_if_exceed_max_utxos}" + ) + }, + Self::Group { address } => { + format!("/addresses/{address}/group") + }, + }; + + let output = get(&url, &endpoint).await?; + print_output(output)?; + + Ok(()) + } +} diff --git a/src/args.rs b/src/args.rs index 5df2f1d..e5f2f2d 100644 --- a/src/args.rs +++ b/src/args.rs @@ -1,13 +1,14 @@ use clap::{Parser, Subcommand, ValueHint}; use crate::{ - address::AddressSubcommands, contracts::ContractsSubcommands, events::EventsSubcommands, - infos::InfosSubcommands, transactions::TransactionsSubcommands, wallet::WalletsSubcommands, + addresses::AddressesSubcommands, blockflow::BlockflowSubcommands, + contracts::ContractsSubcommands, infos::InfosSubcommands, miners::MinersSubcommands, + transactions::TransactionsSubcommands, utils::UtilsSubcommands, wallets::WalletsSubcommands, }; #[derive(Parser)] #[command(version)] -pub struct Kermit { +pub(crate) struct Kermit { #[clap(long, short, env, value_hint = ValueHint::Url, default_value = "http://localhost:22973")] pub url: String, @@ -17,12 +18,26 @@ pub struct Kermit { } #[derive(Subcommand)] -pub enum KermitSubcommand { - /// Event for contract, block and hash. - #[command(visible_alias = "e")] - Events { +pub(crate) enum KermitSubcommand { + /// Address management utilities. + #[command(visible_alias = "a")] + Addresses { + #[command(subcommand)] + command: AddressesSubcommands, + }, + + /// Blockflow data retrieval utilities. + #[command(visible_alias = "b")] + Blockflow { #[command(subcommand)] - command: EventsSubcommands, + command: BlockflowSubcommands, + }, + + /// Contract management utilities. + #[command(visible_alias = "c")] + Contracts { + #[command(subcommand)] + command: ContractsSubcommands, }, /// Infos about node and hashrate. @@ -32,6 +47,20 @@ pub enum KermitSubcommand { command: InfosSubcommands, }, + /// Miners management utilities. + #[command(visible_alias = "m")] + Miners { + #[command(subcommand)] + command: MinersSubcommands, + }, + + /// Utilities (Address zero, Hash zero, Conversion atto). + #[command(visible_alias = "u")] + Utils { + #[command(subcommand)] + command: UtilsSubcommands, + }, + /// Transactions management utilities #[command(visible_alias = "tx")] Transactions { @@ -45,18 +74,4 @@ pub enum KermitSubcommand { #[command(subcommand)] command: WalletsSubcommands, }, - - /// Address management utilities. - #[command(visible_alias = "a")] - Address { - #[command(subcommand)] - command: AddressSubcommands, - }, - - /// Contract management utilities. - #[command(visible_alias = "c")] - Contracts { - #[command(subcommand)] - command: ContractsSubcommands, - }, } diff --git a/src/blockflow.rs b/src/blockflow.rs new file mode 100644 index 0000000..5799f3c --- /dev/null +++ b/src/blockflow.rs @@ -0,0 +1,134 @@ +use anyhow::Result; +use clap::Parser; + +use crate::common::{get, print_output}; + +/// CLI arguments for `kermit blockflow`. +#[derive(Parser)] +pub(crate) enum BlockflowSubcommands { + /// List blocks on the given time interval. + #[command(visible_alias = "bs")] + Blocks { from_ts: i64, to_ts: Option }, + + /// List blocks with events on the given time interval. + #[command(visible_alias = "bswe")] + BlocksWithEvents { from_ts: i64, to_ts: Option }, + + /// Given a time interval, list blocks containing events and transactions + /// with enriched input information when node indexes are enabled. + #[command(visible_alias = "rbs")] + RichBlocks { from_ts: i64, to_ts: Option }, + + /// Get a block with hash? + #[command(visible_alias = "b")] + Block { block_hash: String }, + + /// Get a mainchain block by ghost uncle hash. + #[command(visible_alias = "mcbbgu")] + MainChainBlockByGhostUncle { ghost_uncle_hash: String }, + + /// Get a block and events with hash. + #[command(visible_alias = "bwe")] + BlockWithEvents { block_hash: String }, + + /// Get a block containing events and transactions with enriched input + /// information when node indexes are enabled. + #[command(visible_alias = "rb")] + RichBlock { block_hash: String }, + + /// Check if the block is in main chain. + #[command(visible_alias = "ibimc")] + IsBlockInMainChain { block_hash: String }, + + /// Get all block's hashes at given height for given groups. + #[command(visible_alias = "hs")] + Hashes { + from_group: i64, + to_group: i64, + height: i64, + }, + + /// Get infos about the chain from the given groups. + #[command(visible_alias = "ci")] + ChainInfo { from_group: i64, to_group: i64 }, + + /// Get infos about the chain from the given groups. + #[command(visible_alias = "h")] + Header { block_hash: String }, + + /// Get raw block in hex format. + #[command(visible_alias = "rawb")] + RawBlock { block_hash: String }, +} + +impl BlockflowSubcommands { + pub(crate) async fn run(self, url: &str) -> Result<()> { + let endpoint = match self { + Self::Blocks { from_ts, to_ts } => { + let mut endpoint = format!("/blockflow/blocks?fromTs={from_ts}"); + if let Some(to_ts) = to_ts { + endpoint.push_str(&format!("&toTs={to_ts}")); + } + + endpoint + }, + Self::BlocksWithEvents { from_ts, to_ts } => { + let mut endpoint = format!("/blockflow/blocks-with-events?fromTs={from_ts}"); + if let Some(to_ts) = to_ts { + endpoint.push_str(&format!("&toTs={to_ts}")); + } + + endpoint + }, + Self::RichBlocks { from_ts, to_ts } => { + let mut endpoint = format!("/blockflow/rich-blocks?fromTs={from_ts}"); + if let Some(to_ts) = to_ts { + endpoint.push_str(&format!("&toTs={to_ts}")); + } + + endpoint + }, + Self::Block { block_hash } => { + format!("/blockflow/blocks/{block_hash}") + }, + Self::MainChainBlockByGhostUncle { ghost_uncle_hash } => { + format!("/blockflow/main-chain-block-by-ghost-uncle/{ghost_uncle_hash}") + }, + Self::BlockWithEvents { block_hash } => { + format!("/blockflow/blocks-with-events/{block_hash}") + }, + Self::RichBlock { block_hash } => { + format!("/blockflow/rich-blocks/{block_hash}") + }, + Self::IsBlockInMainChain { block_hash } => { + format!("/blockflow/is-block-in-main-chain?blockHash={block_hash}") + }, + Self::Hashes { + from_group, + to_group, + height, + } => { + format!( + "/blockflow/hashes?fromGroup={from_group}&toGroup={to_group}&height={height}", + ) + }, + Self::ChainInfo { + from_group, + to_group, + } => { + format!("/blockflow/chain-info?fromGroup={from_group}&toGroup={to_group}") + }, + Self::Header { block_hash } => { + format!("/blockflow/headers/{block_hash}") + }, + Self::RawBlock { block_hash } => { + format!("/blockflow/raw-blocks/{block_hash}") + }, + }; + + let output = get(url, &endpoint).await?; + print_output(output)?; + + Ok(()) + } +} diff --git a/src/common/mod.rs b/src/common/mod.rs new file mode 100644 index 0000000..6d781ec --- /dev/null +++ b/src/common/mod.rs @@ -0,0 +1,5 @@ +mod reqwest; +pub(crate) use reqwest::*; + +mod print; +pub(crate) use print::*; diff --git a/src/utils/print.rs b/src/common/print.rs similarity index 77% rename from src/utils/print.rs rename to src/common/print.rs index cad29f7..444fdcc 100644 --- a/src/utils/print.rs +++ b/src/common/print.rs @@ -1,7 +1,7 @@ use anyhow::Result; use serde_json::Value; -pub fn print_output(output: Option) -> Result<()> { +pub(crate) fn print_output(output: Option) -> Result<()> { if let Some(output) = output { serde_json::to_writer_pretty(std::io::stdout(), &output)?; println!(); diff --git a/src/utils/reqwest.rs b/src/common/reqwest.rs similarity index 68% rename from src/utils/reqwest.rs rename to src/common/reqwest.rs index 7670fb7..6fa12c8 100644 --- a/src/utils/reqwest.rs +++ b/src/common/reqwest.rs @@ -8,7 +8,7 @@ struct Error { } /// Perform a GET request to the given URL -pub async fn get(url: &str, endpoint: &str) -> Result> { +pub(crate) async fn get(url: &str, endpoint: &str) -> Result> { let client = Client::new(); let url = format!("{url}{endpoint}"); @@ -20,8 +20,11 @@ pub async fn get(url: &str, endpoint: &str) -> Result().await { + bail!(err.detail); + } + bail!(status); } let data = if res.content_length() > Some(0) { @@ -34,7 +37,7 @@ pub async fn get(url: &str, endpoint: &str) -> Result( +pub(crate) async fn post( url: &str, endpoint: &str, body: U, @@ -51,8 +54,11 @@ pub async fn post( .await?; if !res.status().is_success() { - let err: Error = res.json().await?; - bail!(err.detail); + let status = res.status(); + if let Ok(err) = res.json::().await { + bail!(err.detail); + } + bail!(status); } let data = if res.content_length() > Some(0) { @@ -65,7 +71,7 @@ pub async fn post( } /// Perform a PUT request to the given URL -pub async fn put( +pub(crate) async fn put( url: &str, endpoint: &str, body: U, @@ -82,8 +88,11 @@ pub async fn put( .await?; if !res.status().is_success() { - let err: Error = res.json().await?; - bail!(err.detail); + let status = res.status(); + if let Ok(err) = res.json::().await { + bail!(err.detail); + } + bail!(status); } let data = if res.content_length() > Some(0) { @@ -96,7 +105,7 @@ pub async fn put( } /// Perform a DELETE request to the given URL -pub async fn delete(url: &str, endpoint: &str) -> Result> { +pub(crate) async fn delete(url: &str, endpoint: &str) -> Result> { let client = Client::new(); let url = format!("{url}{endpoint}"); @@ -108,8 +117,11 @@ pub async fn delete(url: &str, endpoint: &str) -> Result().await { + bail!(err.detail); + } + bail!(status); } let data = if res.content_length() > Some(0) { diff --git a/src/events.rs b/src/events.rs deleted file mode 100644 index d2b9ca7..0000000 --- a/src/events.rs +++ /dev/null @@ -1,76 +0,0 @@ -use anyhow::Result; -use clap::Parser; - -use crate::utils::{get, print_output}; - -/// CLI arguments for `kermit events`. -#[derive(Parser)] -pub enum EventsSubcommands { - /// Get events for a contract within a counter range. - #[command(visible_alias = "ce")] - ContractEvents { - contract_address: String, - start: i32, - limit: Option, - group: Option, - }, - - /// Get the current value of the events counter for a contract. - #[command(visible_alias = "ccc")] - ContractCurrentCount { contract_address: String }, - - /// Get contract events for a transaction. - #[command(visible_alias = "tce")] - TxContractEvents { tx_id: String, group: Option }, - - /// Get contract events for a block. - #[command(visible_alias = "bce")] - BlockContractEvents { - block_hash: String, - group: Option, - }, -} - -impl EventsSubcommands { - pub async fn run(self, url: &str) -> Result<()> { - let output = match self { - Self::ContractEvents { - contract_address, - start, - limit, - group, - } => { - let mut endpoint = format!("/events/contract/{}?start={}", contract_address, start); - if let Some(limit) = limit { - endpoint.push_str(&format!("&limit={}", limit)); - } - if let Some(group) = group { - endpoint.push_str(&format!("&group={}", group)); - } - get(url, &endpoint).await? - }, - Self::ContractCurrentCount { contract_address } => { - let endpoint = format!("/events/contract/{}/current-count", contract_address); - get(url, &endpoint).await? - }, - Self::TxContractEvents { tx_id, group } => { - let mut endpoint = format!("/events/tx-id/{}", tx_id); - if let Some(group) = group { - endpoint.push_str(&format!("&group={}", group)); - } - get(url, &endpoint).await? - }, - Self::BlockContractEvents { block_hash, group } => { - let mut endpoint = format!("/events/block-hash/{}", block_hash); - if let Some(group) = group { - endpoint.push_str(&format!("&group={}", group)); - } - get(url, &endpoint).await? - }, - }; - - print_output(output)?; - - Ok(()) - } -} diff --git a/src/infos.rs b/src/infos.rs index d48fb8e..95f521a 100644 --- a/src/infos.rs +++ b/src/infos.rs @@ -2,11 +2,11 @@ use anyhow::Result; use clap::Parser; use serde_json::json; -use crate::utils::{get, post, print_output}; +use crate::common::{get, post, print_output}; /// CLI arguments for `kermit infos`. #[derive(Parser)] -pub enum InfosSubcommands { +pub(crate) enum InfosSubcommands { /// Get info about that node. #[command(visible_alias = "n")] Node, @@ -61,7 +61,7 @@ pub enum InfosSubcommands { } impl InfosSubcommands { - pub async fn run(self, url: &str) -> Result<()> { + pub(crate) async fn run(self, url: &str) -> Result<()> { let output = match self { Self::Node => get(url, "/infos/node").await?, Self::Version => get(url, "/infos/version").await?, diff --git a/src/main.rs b/src/main.rs index 5903db6..26b1853 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,14 @@ -mod address; +mod addresses; mod args; +mod blockflow; +mod common; mod contract_encoding; mod contracts; -mod events; mod infos; +mod miners; mod transactions; mod utils; -mod wallet; +mod wallets; use anyhow::Result; use args::{Kermit, KermitSubcommand}; @@ -24,11 +26,13 @@ async fn run() -> Result<()> { let kermit = Kermit::parse(); match kermit.cmd { - KermitSubcommand::Address { command } => command.run(kermit.url).await?, + KermitSubcommand::Addresses { command } => command.run(kermit.url).await?, + KermitSubcommand::Blockflow { command } => command.run(&kermit.url).await?, KermitSubcommand::Contracts { command } => command.run(kermit.url).await?, - KermitSubcommand::Events { command } => command.run(&kermit.url).await?, KermitSubcommand::Infos { command } => command.run(&kermit.url).await?, + KermitSubcommand::Miners { command } => command.run(&kermit.url).await?, KermitSubcommand::Transactions { command } => command.run(&kermit.url).await?, + KermitSubcommand::Utils { command } => command.run().await?, KermitSubcommand::Wallets { command } => command.run(&kermit.url).await?, } diff --git a/src/miners.rs b/src/miners.rs new file mode 100644 index 0000000..fd5dec4 --- /dev/null +++ b/src/miners.rs @@ -0,0 +1,77 @@ +use anyhow::Result; +use clap::Parser; +use serde_json::{Value, json}; + +use crate::common::{get, post, print_output, put}; + +/// CLI arguments for `kermit miners`. +#[derive(Parser)] +pub(crate) enum MinersSubcommands { + /// Execute an action on CPU miner. !!! for test only !!! + #[command(visible_alias = "cm")] + CpuMining { action: String }, + + /// Mine a block on CPU miner. !!! for test only !!! + #[command(visible_alias = "mob")] + MineOneBlock { from_group: i64, to_group: i64 }, + + /// List miner's addresses. + #[command(visible_alias = "a")] + Addresses, + + /// Update miner's addresses, but better to use user.conf instead. + #[command(visible_alias = "ua")] + UpdateAddresses { new_addresses: Vec }, +} + +impl MinersSubcommands { + pub(crate) async fn run(self, url: &str) -> Result<()> { + let output = match self { + Self::CpuMining { action } => { + if !url.contains("localhost") && !url.contains("127.0.0.1") { + eprintln!("Warning: CpuMining command only works on devnet network."); + } + + post( + url, + &format!("/miners/cpu-mining?action={action}"), + Value::Null, + ) + .await? + }, + Self::MineOneBlock { + from_group, + to_group, + } => { + if !url.contains("localhost") && !url.contains("127.0.0.1") { + eprintln!("Warning: MineOneBlock command only works on devnet network."); + } + + post( + url, + &format!( + "/miners/cpu-mining/mine-one-block?fromGroup={from_group}&\ + toGroup={to_group}", + ), + Value::Null, + ) + .await? + }, + Self::Addresses => get(url, "/miners/addresses").await?, + Self::UpdateAddresses { new_addresses } => { + put( + url, + "/miners/addresses", + json!({ + "addresses": new_addresses + }), + ) + .await? + }, + }; + + print_output(output)?; + + Ok(()) + } +} diff --git a/src/transactions.rs b/src/transactions.rs index 41812f2..2be6bc1 100644 --- a/src/transactions.rs +++ b/src/transactions.rs @@ -4,28 +4,22 @@ use secp256k1::{Message, Secp256k1, SecretKey}; use serde::{Deserialize, de::DeserializeOwned}; use serde_json::{Value, json}; -use crate::utils::{get, post, print_output}; +use crate::common::{get, post, print_output}; /// CLI arguments for `kermit transactions`. #[derive(Parser)] -pub enum TransactionsSubcommands { +pub(crate) enum TransactionsSubcommands { /// Build a new transaction. #[command(visible_alias = "b")] Build { /// Public key of the sender. - #[arg(env)] public_key: String, /// Address of the recipient. to_addr: String, /// Amount to send. amount: String, - /// Gas amount. - #[arg(long)] - gas_amount: Option, - /// Gas price. - #[arg(long)] - gas_price: Option, }, + /// Submit a transaction. #[command(visible_alias = "sub")] Submit { @@ -37,32 +31,68 @@ pub enum TransactionsSubcommands { #[arg(long, env)] private_key: String, }, + /// Create a transaction. #[command(visible_alias = "c")] Create { /// Public key of the sender. - #[arg(env)] public_key: String, /// Address of the recipient. to_addr: String, /// Amount to send. amount: String, - /// Gas amount. - #[arg(long)] - gas_amount: Option, - /// Gas price. - #[arg(long)] - gas_price: Option, /// Private key of the sender. #[arg(long, env)] private_key: String, }, + /// Decode an unsigned transaction. - #[command(visible_alias = "d")] + #[command(visible_alias = "dec")] Decode { unsigned_tx: String }, + + /// Get transaction details. + #[command(visible_alias = "d")] + Details { + tx_id: String, + #[arg(short, long)] + from_group: Option, + #[arg(short, long)] + to_group: Option, + }, + + /// Get transaction with enriched input information when node indexes are enabled. + #[command(visible_alias = "rd")] + RichDetails { + tx_id: String, + #[arg(short, long)] + from_group: Option, + #[arg(short, long)] + to_group: Option, + }, + + /// Get raw transaction in hex format. + #[command(visible_alias = "r")] + Raw { + tx_id: String, + #[arg(short, long)] + from_group: Option, + #[arg(short, long)] + to_group: Option, + }, + + /// Get tx status. #[command(visible_alias = "s")] - /// Get transaction status - Status { tx_id: String }, + Status { + tx_id: String, + #[arg(short, long)] + from_group: Option, + #[arg(short, long)] + to_group: Option, + }, + + /// Get transaction id from transaction output ref. + #[command(visible_alias = "tifo")] + TxIdFromOutputref { hint: i64, key: String }, } #[derive(Deserialize)] @@ -77,8 +107,6 @@ async fn build( public_key: String, to_addr: String, amount: String, - gas_amount: Option, - gas_price: Option, ) -> Result> { post( url, @@ -88,9 +116,7 @@ async fn build( "destinations": vec![json!({ "address": to_addr, "attoAlphAmount": amount, - })], - "gas_amount": gas_amount, - "gas_price": gas_price + })] }), ) .await @@ -98,14 +124,15 @@ async fn build( fn sign(tx_id: &str, private_key: &str) -> Result { let secp = Secp256k1::new(); - let private_key_bytes = hex::decode(private_key)?; - let secret_key = SecretKey::from_slice(&private_key_bytes)?; + let private_key_bytes = hex::decode(private_key).map_err(|_| anyhow!("Invalid private key"))?; + let secret_key = + SecretKey::from_slice(&private_key_bytes).map_err(|_| anyhow!("Invalid private key"))?; let tx_id_bytes = hex::decode(tx_id)?; let message = Message::from_digest( tx_id_bytes .try_into() - .map_err(|_| anyhow!("Invalid hash length"))?, + .map_err(|_| anyhow!("Invalid transaction id"))?, ); let signature = secp.sign_ecdsa(&message, &secret_key); @@ -127,16 +154,29 @@ async fn submit(url: &str, unsigned_tx: &str, signature: &str) -> Result, to_group: Option) { + match (from_group, to_group) { + (Some(fg), Some(tg)) => { + endpoint.push_str(&format!("?fromGroup={fg}&toGroup={tg}")); + }, + (Some(fg), None) => { + endpoint.push_str(&format!("?fromGroup={fg}")); + }, + (None, Some(tg)) => { + endpoint.push_str(&format!("?toGroup={tg}")); + }, + (None, None) => {}, + } +} + impl TransactionsSubcommands { - pub async fn run(self, url: &str) -> Result<()> { + pub(crate) async fn run(self, url: &str) -> Result<()> { let output = match self { Self::Build { public_key, to_addr, amount, - gas_amount, - gas_price, - } => build(url, public_key, to_addr, amount, gas_amount, gas_price).await?, + } => build(url, public_key, to_addr, amount).await?, Self::Submit { tx_id, unsigned_tx, @@ -149,12 +189,10 @@ impl TransactionsSubcommands { public_key, to_addr, amount, - gas_amount, - gas_price, private_key, } => { let Some(BuildTransactionResponse { tx_id, unsigned_tx }) = - build(url, public_key, to_addr, amount, gas_amount, gas_price).await? + build(url, public_key, to_addr, amount).await? else { bail!("Failed to build transaction"); }; @@ -170,8 +208,57 @@ impl TransactionsSubcommands { ) .await? }, - Self::Status { tx_id } => { - get(url, &format!("/transactions/status?txId={}", tx_id)).await? + Self::Details { + tx_id, + from_group, + to_group, + } => { + let mut endpoint = format!("/transactions/details/{tx_id}"); + append_groups(&mut endpoint, from_group, to_group); + + get(url, &endpoint).await? + }, + Self::RichDetails { + tx_id, + from_group, + to_group, + } => { + let mut endpoint = format!("/transactions/rich-details/{tx_id}"); + append_groups(&mut endpoint, from_group, to_group); + + get(url, &endpoint).await? + }, + Self::Raw { + tx_id, + from_group, + to_group, + } => { + let mut endpoint = format!("/transactions/raw/{tx_id}"); + append_groups(&mut endpoint, from_group, to_group); + + get(url, &endpoint).await? + }, + Self::Status { + tx_id, + from_group, + to_group, + } => { + let mut endpoint = format!("/transactions/status?txId={tx_id}"); + if let Some(from_group) = from_group { + endpoint.push_str(&format!("&fromGroup={from_group}")); + } + if let Some(to_group) = to_group { + endpoint.push_str(&format!("&toGroup={to_group}")); + } + + get(url, &endpoint).await? + }, + Self::TxIdFromOutputref { hint, key } => { + get( + url, + &format!("/transactions/tx-id-from-outputref?hint={hint}&key={key}"), + ) + .await? }, }; diff --git a/src/utils.rs b/src/utils.rs new file mode 100644 index 0000000..a4f194b --- /dev/null +++ b/src/utils.rs @@ -0,0 +1,79 @@ +use anyhow::Result; +use bigdecimal::BigDecimal; +use clap::{Parser, ValueEnum}; + +const ADDRESS_ZERO: &str = "111111111111111111111111111111111"; +const HASH_ZERO: &str = "0000000000000000000000000000000000000000000000000000000000000000"; + +/// CLI arguments for `kermit utils`. +#[derive(Parser)] +pub(crate) enum UtilsSubcommands { + /// Get the Alephium zero address. + #[command(visible_alias = "az")] + AddressZero, + + /// Get the Alephium hash zero. + #[command(visible_alias = "hz")] + HashZero, + + /// Convert amount between different Alephium units (atto, gatto, alph). + #[command(visible_alias = "c")] + Convert { + amount: BigDecimal, + unit: AlephiumUnit, + }, +} + +#[derive(Clone, ValueEnum)] +#[clap(rename_all = "lowercase")] +pub(crate) enum AlephiumUnit { + Alph, + Gatto, + Atto, +} + +fn convert_amount(amount: BigDecimal, unit: AlephiumUnit) -> (BigDecimal, BigDecimal, BigDecimal) { + let atto_in_alph = BigDecimal::from(10u64.pow(18)); + let atto_in_gatto = BigDecimal::from(10u64.pow(9)); + + match unit { + AlephiumUnit::Alph => { + let atto = &amount * atto_in_alph; + let gatto = &amount * atto_in_gatto; + (atto, gatto, amount) + }, + AlephiumUnit::Gatto => { + let atto = &amount * &atto_in_gatto; + let alph = &amount / atto_in_gatto; + (atto, amount, alph) + }, + AlephiumUnit::Atto => { + let gatto = &amount / atto_in_gatto; + let alph = &amount / atto_in_alph; + (amount, gatto, alph) + }, + } +} + +impl UtilsSubcommands { + pub(crate) async fn run(self) -> Result<()> { + let output = match self { + Self::AddressZero => ADDRESS_ZERO, + Self::HashZero => HASH_ZERO, + Self::Convert { amount, unit } => { + let (atto, gatto, eth) = convert_amount(amount, unit); + + &format!( + "atto:\t{}\ngatto:\t{}\nalph:\t{}", + atto.to_plain_string(), + gatto.to_plain_string(), + eth.to_plain_string() + ) + }, + }; + + println!("{output}"); + + Ok(()) + } +} diff --git a/src/utils/mod.rs b/src/utils/mod.rs deleted file mode 100644 index a2a2039..0000000 --- a/src/utils/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod reqwest; -pub use reqwest::*; - -mod print; -pub use print::*; diff --git a/src/wallet.rs b/src/wallets.rs similarity index 63% rename from src/wallet.rs rename to src/wallets.rs index 4ff5e1f..f56f6da 100644 --- a/src/wallet.rs +++ b/src/wallets.rs @@ -1,25 +1,33 @@ -use anyhow::{Result, anyhow}; +use anyhow::Result; use clap::Parser; use serde_json::{Value, json}; -use crate::utils::{delete, get, post, print_output, put}; +use crate::common::{delete, get, post, print_output, put}; /// CLI arguments for `kermit wallets`. #[derive(Parser)] -pub enum WalletsSubcommands { +pub(crate) enum WalletsSubcommands { /// List available wallets. #[command(visible_alias = "l")] List, /// Restore a wallet from your mnemonic. #[command(visible_alias = "r")] - Restore { mnemonic: String }, + Restore { + wallet_name: String, + password: String, + mnemonic: String, + #[arg(short, long, default_value_t = false)] + is_miner: bool, + }, /// Create a new wallet. #[command(visible_alias = "c")] Create { wallet_name: String, password: String, + #[arg(short, long, default_value_t = false)] + is_miner: bool, }, /// Get wallet's status. @@ -49,7 +57,7 @@ pub enum WalletsSubcommands { Balances { wallet_name: String }, /// Reveal your mnemonic. !!! Use it with caution !!! - #[command(visible_alias = "rm")] + #[command(visible_alias = "re")] RevealMnemonic { wallet_name: String, password: String, @@ -64,6 +72,7 @@ pub enum WalletsSubcommands { }, /// Transfer all unlocked ALPH from the active address to another address. + #[command(visible_alias = "saa")] SweepActiveAddress { wallet_name: String, to_address: String, @@ -71,6 +80,7 @@ pub enum WalletsSubcommands { /// Transfer unlocked ALPH from all addresses (including mining addresses) /// to another address. + #[command(visible_alias = "saas")] SweepAllAddresses { wallet_name: String, to_address: String, @@ -95,7 +105,8 @@ pub enum WalletsSubcommands { #[command(visible_alias = "dna")] DeriveNextAddress { wallet_name: String, - group: Option, + #[arg(short, long)] + group: Option, }, /// Choose the active address. @@ -104,48 +115,65 @@ pub enum WalletsSubcommands { wallet_name: String, address: String, }, + + /// List all miner addresses per group. + #[command(visible_alias = "ma")] + MinerAddresses { wallet_name: String }, + + /// Derive your next miner addresses for each group. + #[command(visible_alias = "dnma")] + DeriveNextMinerAddresses { wallet_name: String }, } impl WalletsSubcommands { - pub async fn run(self, url: &str) -> Result<()> { - if url == "https://node.mainnet.alephium.org" { - eprintln!("You need to use a devnet adress (-u [ADDRESS]) to use Wallet commands"); - return Err(anyhow!( - "Invalid URL: Mainnet node is not allowed for wallet operations." - )); + pub(crate) async fn run(self, url: &str) -> Result<()> { + if !url.contains("localhost") && !url.contains("127.0.0.1") { + eprintln!("Warning: Wallets commands only work on devnet network."); } + let output = match self { Self::List => get(url, "/wallets").await?, - Self::Restore { mnemonic } => { - put(url, "/wallets", json!({ "mnemonic": mnemonic })).await? - }, - Self::Create { + Self::Restore { wallet_name, password, + mnemonic, + is_miner, } => { - post( + put( url, "/wallets", - json!({ + json!( + { "walletName": wallet_name, "password": password, - "walletName": wallet_name + "mnemonic": mnemonic, + "isMiner": is_miner }), ) .await? }, - Self::Status { wallet_name } => get(url, &format!("/wallets/{}", wallet_name)).await?, - Self::Delete { + Self::Create { wallet_name, password, + is_miner, } => { - delete( + post( url, - &format!("/wallets/{}?password={}", wallet_name, password), + "/wallets", + json!({ + "password": password, + "walletName": wallet_name, + "isMiner": is_miner + }), ) .await? }, + Self::Status { wallet_name } => get(url, &format!("/wallets/{wallet_name}")).await?, + Self::Delete { + wallet_name, + password, + } => delete(url, &format!("/wallets/{wallet_name}?password={password}")).await?, Self::Lock { wallet_name } => { - post(url, &format!("/wallets/{}/lock", wallet_name), Value::Null).await? + post(url, &format!("/wallets/{wallet_name}/lock"), Value::Null).await? }, Self::Unlock { wallet_name, @@ -153,13 +181,13 @@ impl WalletsSubcommands { } => { post( url, - &format!("/wallets/{}/unlock", wallet_name), + &format!("/wallets/{wallet_name}/unlock"), json!({ "password": password }), ) .await? }, Self::Balances { wallet_name } => { - get(url, &format!("/wallets/{}/balances", wallet_name)).await? + get(url, &format!("/wallets/{wallet_name}/balances")).await? }, Self::RevealMnemonic { wallet_name, @@ -167,7 +195,7 @@ impl WalletsSubcommands { } => { post( url, - &format!("/wallets/{}/reveal-mnemonic", wallet_name), + &format!("/wallets/{wallet_name}/reveal-mnemonic"), json!({ "password": password }), ) .await? @@ -179,15 +207,12 @@ impl WalletsSubcommands { } => { post( url, - &format!("/wallets/{}/transfer", wallet_name), + &format!("/wallets/{wallet_name}/transfer"), json!({ - "destinations": [ - { - "address": to_address, - "attoAlphAmount": amount - } - ] - + "destinations": [{ + "address": to_address, + "attoAlphAmount": amount + }] }), ) .await? @@ -198,7 +223,7 @@ impl WalletsSubcommands { } => { post( url, - &format!("/wallets/{}/sweep-active-address", wallet_name), + &format!("/wallets/{wallet_name}/sweep-active-address"), json!({ "toAddress": to_address }), ) .await? @@ -209,7 +234,7 @@ impl WalletsSubcommands { } => { post( url, - &format!("/wallets/{}/sweep-all-addresses", wallet_name), + &format!("/wallets/{wallet_name}/sweep-all-addresses"), json!({ "toAddress": to_address }), ) .await? @@ -217,30 +242,25 @@ impl WalletsSubcommands { Self::Sign { wallet_name, data } => { post( url, - &format!("/wallets/{}/sign", wallet_name), + &format!("/wallets/{wallet_name}/sign"), json!({ "data": data }), ) .await? }, Self::Addresses { wallet_name } => { - get(url, &format!("/wallets/{}/addresses", wallet_name)).await? + get(url, &format!("/wallets/{wallet_name}/addresses")).await? }, Self::AddressInfo { wallet_name, address, - } => { - get( - url, - &format!("/wallets/{}/addresses/{}", wallet_name, address), - ) - .await? - }, + } => get(url, &format!("/wallets/{wallet_name}/addresses/{address}")).await?, Self::DeriveNextAddress { wallet_name, group } => { - let mut endpoint = format!("/wallets/{}/derive-next-address", wallet_name); + let mut endpoint = format!("/wallets/{wallet_name}/derive-next-address"); if let Some(group) = group { - endpoint.push_str(&format!("&toTs={}", group)); + endpoint.push_str(&format!("?group={group}")); } - post(url, &endpoint, json!({})).await? + + post(url, &endpoint, Value::Null).await? }, Self::ChangeActiveAddress { wallet_name, @@ -248,11 +268,22 @@ impl WalletsSubcommands { } => { post( url, - &format!("/wallets/{}/change-active-address", wallet_name), + &format!("/wallets/{wallet_name}/change-active-address"), json!({ "address": address }), ) .await? }, + Self::MinerAddresses { wallet_name } => { + get(url, &format!("/wallets/{wallet_name}/miner-addresses")).await? + }, + Self::DeriveNextMinerAddresses { wallet_name } => { + post( + url, + &format!("/wallets/{wallet_name}/derive-next-miner-addresses"), + Value::Null, + ) + .await? + }, }; print_output(output)?; diff --git a/tests/addresses.rs b/tests/addresses.rs new file mode 100644 index 0000000..3c9a7a6 --- /dev/null +++ b/tests/addresses.rs @@ -0,0 +1,126 @@ +mod common; + +mod balance { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "one_param", + &url, + &[ + "addresses", + "balance", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH" + ] + ); + } + + #[tokio::test] + async fn test_two_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "two_params", + &url, + &[ + "addresses", + "balance", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH", + "--mem-pool" + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["addresses", "balance"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("bad_param", &url, &["addresses", "balance", "foo"]); + } +} + +mod utxos { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "one_param", + &url, + &[ + "addresses", + "utxos", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH" + ] + ); + } + + #[tokio::test] + async fn test_two_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "two_params", + &url, + &[ + "addresses", + "utxos", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH", + "--error-if-exceed-max-utxos" + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["addresses", "utxos"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("bad_param", &url, &["addresses", "utxos", "foo"]); + } +} + +mod group { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "one_param", + &url, + &[ + "addresses", + "group", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH" + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["addresses", "group"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("bad_param", &url, &["addresses", "group", "foo"]); + } +} diff --git a/tests/blockflow.rs b/tests/blockflow.rs new file mode 100644 index 0000000..2ca732f --- /dev/null +++ b/tests/blockflow.rs @@ -0,0 +1,390 @@ +mod common; + +mod blocks { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("one_param", &url, &["blockflow", "blocks", "100"]); + } + + #[tokio::test] + async fn test_two_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("two_params", &url, &["blockflow", "blocks", "100", "200"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["blockflow", "blocks"]); + } + + #[test] + fn test_bad_param() { + perform_cmd_test!("bad_param", &["blockflow", "blocks", "foo"]); + } +} + +mod blocks_with_events { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "one_param", + &url, + &["blockflow", "blocks-with-events", "100"] + ); + } + + #[tokio::test] + async fn test_two_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "two_params", + &url, + &["blockflow", "blocks-with-events", "100", "200"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["blockflow", "blocks-with-events"]); + } + + #[test] + fn test_bad_param() { + perform_cmd_test!("bad_param", &["blockflow", "blocks-with-events", "foo"]); + } +} + +mod rich_blocks { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("one_param", &url, &["blockflow", "rich-blocks", "100"]); + } + + #[tokio::test] + async fn test_two_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "two_params", + &url, + &["blockflow", "rich-blocks", "100", "200"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["blockflow", "rich-blocks"]); + } + + #[test] + fn test_bad_param() { + perform_cmd_test!("bad_param", &["blockflow", "rich-blocks", "foo"]); + } +} + +mod block { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "one_param", + &url, + &[ + "blockflow", + "block", + "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["blockflow", "block"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("bad_param", &url, &["blockflow", "block", "foo"]); + } +} + +mod main_chain_block_by_ghost_uncle { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "blockflow", + "main-chain-block-by-ghost-uncle", + "bdaf9dc514ce7d34b6474b8ca10a3dfb93ba997cb9d5ff1ea724ebe2af48abe5", + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!( + "no_params", + &["blockflow", "main-chain-block-by-ghost-uncle"] + ); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_param", + &url, + &["blockflow", "main-chain-block-by-ghost-uncle", "foo"] + ); + } +} + +mod block_with_events { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "one_param", + &url, + &[ + "blockflow", + "block-with-events", + "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["blockflow", "block-with-events"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_param", + &url, + &["blockflow", "block-with-events", "foo"] + ); + } +} + +mod rich_block { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "one_param", + &url, + &[ + "blockflow", + "rich-block", + "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["blockflow", "rich-block"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("bad_param", &url, &["blockflow", "rich-block", "foo"]); + } +} + +mod is_block_in_main_chain { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "one_param", + &url, + &[ + "blockflow", + "is-block-in-main-chain", + "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["blockflow", "is-block-in-main-chain"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_param", + &url, + &["blockflow", "is-block-in-main-chain", "foo"] + ); + } +} + +mod hashes { + use crate::{common::setup_node, perform_cmd_test}; + + #[test] + fn test_one_param() { + perform_cmd_test!("one_param", &["blockflow", "hashes", "1"]); + } + + #[test] + fn test_two_params() { + perform_cmd_test!("two_params", &["blockflow", "hashes", "1", "1"]); + } + + #[tokio::test] + async fn test_three_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "three_params", + &url, + &["blockflow", "hashes", "1", "1", "0"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["blockflow", "hashes"]); + } + + #[test] + fn test_bad_param() { + perform_cmd_test!("bad_param", &["blockflow", "hashes", "foo", "1", "0"]); + } +} + +mod chain_info { + use crate::{common::setup_node, perform_cmd_test}; + + #[test] + fn test_one_param() { + perform_cmd_test!("one_param", &["blockflow", "chain-info", "1"]); + } + + #[tokio::test] + async fn test_two_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("two_params", &url, &["blockflow", "chain-info", "1", "1"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["blockflow", "chain-info"]); + } + + #[test] + fn test_bad_param() { + perform_cmd_test!("bad_param", &["blockflow", "chain-info", "foo", "1"]); + } +} + +mod header { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "one_param", + &url, + &[ + "blockflow", + "header", + "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["blockflow", "header"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("bad_param", &url, &["blockflow", "header", "foo"]); + } +} + +mod raw_block { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "one_param", + &url, + &[ + "blockflow", + "raw-block", + "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["blockflow", "raw-block"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("bad_param", &url, &["blockflow", "raw-block", "foo"]); + } +} diff --git a/tests/common/mod.rs b/tests/common/mod.rs new file mode 100644 index 0000000..491fc16 --- /dev/null +++ b/tests/common/mod.rs @@ -0,0 +1,10 @@ +#![allow(unused)] + +mod node; +pub use node::*; + +mod perform_cmd; +pub use perform_cmd::*; + +mod reqwest; +pub use reqwest::*; diff --git a/tests/common/node.rs b/tests/common/node.rs new file mode 100644 index 0000000..03c4826 --- /dev/null +++ b/tests/common/node.rs @@ -0,0 +1,61 @@ +use std::env::current_dir; + +use testcontainers::{ + ContainerAsync, Image, + core::{ContainerPort, IntoContainerPort, Mount, WaitFor}, + runners::AsyncRunner, +}; + +const CONTAINER_MOUNT_PATH: &str = "/alephium-home/.alephium/user.conf"; +const EXPOSED_PORT: u16 = 22973; + +pub struct AlephiumNodeImage { + mounts: Vec, + ports: Vec, +} + +impl AlephiumNodeImage { + fn new(conf_path: impl Into) -> Self { + Self { + mounts: vec![Mount::bind_mount(conf_path, CONTAINER_MOUNT_PATH)], + ports: vec![EXPOSED_PORT.tcp()], + } + } +} + +impl Image for AlephiumNodeImage { + fn name(&self) -> &str { + "alephium/alephium" + } + + fn tag(&self) -> &str { + "latest" + } + + fn ready_conditions(&self) -> Vec { + vec![WaitFor::message_on_stdout("Listening http request on")] + } + + fn mounts(&self) -> impl IntoIterator { + &self.mounts + } + + fn expose_ports(&self) -> &[ContainerPort] { + &self.ports + } +} + +pub async fn setup_node() -> (ContainerAsync, String) { + let conf = format!("{}/devnet.conf", current_dir().unwrap().display()); + + let container = AlephiumNodeImage::new(&conf).start().await.unwrap(); + + let host = container.get_host().await.unwrap(); + let port = container + .get_host_port_ipv4(EXPOSED_PORT.tcp()) + .await + .unwrap(); + let url = format!("http://{host}:{port}"); + + (container, url) +} diff --git a/tests/common/perform_cmd.rs b/tests/common/perform_cmd.rs new file mode 100644 index 0000000..dda0394 --- /dev/null +++ b/tests/common/perform_cmd.rs @@ -0,0 +1,71 @@ +use std::process::Command; + +use anyhow::Result; +use insta::with_settings; +use insta_cmd::{assert_cmd_snapshot, get_cargo_bin}; + +const BIN_NAME: &str = "kermit"; + +fn build_cmd(url: Option<&str>, args: &[&str]) -> Command { + let mut cmd = Command::new(get_cargo_bin(BIN_NAME)); + + if let Some(url) = url { + cmd.arg(format!("--url={url}")); + } + cmd.args(args); + + cmd +} + +pub fn perform_cmd(url: &str, args: &[&str]) -> Result<()> { + build_cmd(Some(url), args).spawn()?.wait()?; + + Ok(()) +} + +pub fn perform_cmd_test( + name: &str, + path: &str, + url: Option<&str>, + args: &[&str], + filters: &[(&str, &str)], +) { + with_settings!({ + prepend_module_to_snapshot => false, + snapshot_path => format!("../snapshots/{path}"), + filters => filters.to_vec(), + }, { + assert_cmd_snapshot!(name, build_cmd(url, args)); + }); +} + +#[macro_export] +macro_rules! perform_cmd_test { + ($name:expr, $args:expr) => { + use $crate::common::perform_cmd_test; + + perform_cmd_test($name, &module_path!().replace("::", "/"), None, $args, &[]); + }; + ($name:expr, $url:expr, $args:expr) => { + use $crate::common::perform_cmd_test; + + perform_cmd_test( + $name, + &module_path!().replace("::", "/"), + Some($url), + $args, + &[], + ); + }; + ($name:expr, $url:expr, $args:expr, $filters:expr) => { + use $crate::common::perform_cmd_test; + + perform_cmd_test( + $name, + &module_path!().replace("::", "/"), + Some($url), + $args, + $filters, + ); + }; +} diff --git a/tests/common/reqwest.rs b/tests/common/reqwest.rs new file mode 100644 index 0000000..c12790e --- /dev/null +++ b/tests/common/reqwest.rs @@ -0,0 +1,32 @@ +use anyhow::{Result, bail}; +use reqwest::Client; +use serde::{Serialize, de::DeserializeOwned}; + +pub async fn post( + url: &str, + endpoint: &str, + body: U, +) -> Result> { + let client = Client::new(); + + let url = format!("{url}{endpoint}"); + + let res = client + .post(url) + .header("Content-Type", "application/json") + .json(&body) + .send() + .await?; + + if !res.status().is_success() { + bail!("Error: {}", res.status()); + } + + let data = if res.content_length() > Some(0) { + Some(res.json().await?) + } else { + None + }; + + Ok(data) +} diff --git a/tests/import/jor.ral b/tests/contracts/jor.ral similarity index 100% rename from tests/import/jor.ral rename to tests/contracts/jor.ral diff --git a/tests/sub_contract.ral b/tests/contracts/sub_contract.ral similarity index 100% rename from tests/sub_contract.ral rename to tests/contracts/sub_contract.ral diff --git a/tests/infos.rs b/tests/infos.rs index 8f78680..32e89f6 100644 --- a/tests/infos.rs +++ b/tests/infos.rs @@ -1,132 +1,332 @@ -mod utils; +mod common; -use crate::utils::perform_cmd_test; +use crate::common::{perform_cmd, setup_node}; -#[test] -fn test_node() { - perform_cmd_test("node", &["infos", "node"]); -} +#[tokio::test] +async fn test_node() { + let (_container, url) = setup_node().await; -#[test] -fn test_version() { - perform_cmd_test("version", &["infos", "version"]); + perform_cmd_test!("node", &url, &["infos", "node"]); } -#[test] -fn test_chain_params() { - perform_cmd_test("chain_params", &["infos", "chain-params"]); -} +#[tokio::test] +async fn test_version() { + let (_container, url) = setup_node().await; -#[test] -fn test_self_clique() { - perform_cmd_test("self_clique", &["infos", "self-clique"]); + perform_cmd_test!("version", &url, &["infos", "version"]); } -#[test] -fn test_inter_clique_peer_info() { - perform_cmd_test( - "inter_clique_peer_info", - &["infos", "inter-clique-peer-info"], - ); -} +#[tokio::test] +async fn test_chain_params() { + let (_container, url) = setup_node().await; -#[test] -fn test_discovered_neighbors() { - perform_cmd_test("discovered_neighbors", &["infos", "discovered-neighbors"]); + perform_cmd_test!("chain_params", &url, &["infos", "chain-params"]); } -#[test] -fn test_misbehaviors() { - perform_cmd_test("misbehaviors", &["infos", "misbehaviors"]); -} +#[tokio::test] +async fn test_self_clique() { + let (_container, url) = setup_node().await; -#[test] -fn test_misbehaviors_ban_unban() { - perform_cmd_test( - "misbehaviors_ban_unban", - &["infos", "misbehaviors-ban-unban", "Unban", "1.2.3.4"], + perform_cmd_test!( + "self_clique", + &url, + &["infos", "self-clique"], + &[( + r#""cliqueId":\s*"[0-9a-f]+""#, + r#""cliqueId": """#, + )] ); } -#[test] -fn test_misbehaviors_ban_unban_no_params() { - perform_cmd_test( - "misbehaviors_ban_unban_no_params", - &["infos", "misbehaviors-ban-unban"], - ); -} +#[tokio::test] +async fn test_inter_clique_peer_info() { + let (_container, url) = setup_node().await; -#[test] -fn test_misbehaviors_ban_unban_bad_param() { - perform_cmd_test( - "misbehaviors_ban_unban_bad_param", - &["infos", "misbehaviors-ban-unban", "UnknownType", "1.2.3.4"], + perform_cmd_test!( + "inter_clique_peer_info", + &url, + &["infos", "inter-clique-peer-info"] ); } -#[test] -fn test_unreachable_brokers() { - perform_cmd_test("unreachable_brokers", &["infos", "unreachable-brokers"]); -} +#[tokio::test] +async fn test_discovered_neighbors() { + let (_container, url) = setup_node().await; -#[test] -fn test_discovery() { - perform_cmd_test("discovery", &["infos", "discovery", "Reachable", "1.2.3.4"]); + perform_cmd_test!( + "discovered_neighbors", + &url, + &["infos", "discovered-neighbors"] + ); } -#[test] -fn test_discovery_no_params() { - perform_cmd_test("discovery_no_params", &["infos", "discovery"]); -} +#[tokio::test] +async fn test_misbehaviors() { + let (_container, url) = setup_node().await; -#[test] -fn test_discovery_bad_param() { - perform_cmd_test( - "discovery_bad_param", - &["infos", "discovery", "UnknownType", "1.2.3.4"], + perform_cmd(&url, &["infos", "misbehaviors-ban-unban", "Ban", "1.2.3.4"]).unwrap(); + perform_cmd_test!( + "misbehaviors", + &url, + &["infos", "misbehaviors"], + &[(r#""until":\s*[0-9]+"#, r#""until": """#)] ); } -#[test] -fn test_history_hashrate() { - perform_cmd_test( - "history_hashrate", - &["infos", "history-hashrate", "100", "200"], - ); -} +mod misbehaviors_ban_unban { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_ban() { + let (_container, url) = setup_node().await; -#[test] -fn test_history_hashrate_no_params() { - perform_cmd_test("history_hashrate_no_params", &["infos", "history-hashrate"]); + perform_cmd_test!( + "ban", + &url, + &["infos", "misbehaviors-ban-unban", "Ban", "1.2.3.4"] + ); + } + + #[tokio::test] + async fn test_unban() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "unban", + &url, + &["infos", "misbehaviors-ban-unban", "Unban", "1.2.3.4"] + ); + } + + #[tokio::test] + async fn test_ban_several_peers() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "ban_several_peers", + &url, + &[ + "infos", + "misbehaviors-ban-unban", + "Ban", + "1.2.3.4", + "5.6.7.8" + ] + ); + } + + #[tokio::test] + async fn test_unban_several_peers() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "unban_several_peers", + &url, + &[ + "infos", + "misbehaviors-ban-unban", + "Unban", + "1.2.3.4", + "5.6.7.8" + ] + ); + } + + #[tokio::test] + async fn test_ban_no_peers() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "ban_no_peers", + &url, + &["infos", "misbehaviors-ban-unban", "Ban"] + ); + } + + #[tokio::test] + async fn test_unban_no_peers() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "unban_no_peers", + &url, + &["infos", "misbehaviors-ban-unban", "Unban"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["infos", "misbehaviors-ban-unban"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_param", + &url, + &["infos", "misbehaviors-ban-unban", "UnknownType", "1.2.3.4"] + ); + } } -#[test] -fn test_history_hashrate_bad_param() { - perform_cmd_test( - "history_hashrate_bad_param", - &["infos", "history-hashrate", "foo"], +#[tokio::test] +async fn test_unreachable_brokers() { + let (_container, url) = setup_node().await; + + perform_cmd(&url, &["infos", "discovery", "Unreachable", "1.2.3.4"]).unwrap(); + perform_cmd_test!( + "unreachable_brokers", + &url, + &["infos", "unreachable-brokers"] ); } -#[test] -fn test_current_hashrate() { - perform_cmd_test("current_hashrate", &["infos", "current-hashrate", "100"]); +mod discovery { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_reachable() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "reachable", + &url, + &["infos", "discovery", "Reachable", "1.2.3.4"] + ); + } + + #[tokio::test] + async fn test_unreachable() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "unreachable", + &url, + &["infos", "discovery", "Unreachable", "1.2.3.4"] + ); + } + + #[tokio::test] + async fn test_reachable_several_peers() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "reachable_several_peers", + &url, + &["infos", "discovery", "Reachable", "1.2.3.4", "5.6.7.8"] + ); + } + + #[tokio::test] + async fn test_unreachable_several_peers() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "unreachable_several_peers", + &url, + &["infos", "discovery", "Unreachable", "1.2.3.4", "5.6.7.8"] + ); + } + + #[tokio::test] + async fn test_reachable_no_peers() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "reachable_no_peers", + &url, + &["infos", "discovery", "Reachable"] + ); + } + + #[tokio::test] + async fn test_unreachable_no_peers() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "unreachable_no_peers", + &url, + &["infos", "discovery", "Unreachable"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["infos", "discovery"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_param", + &url, + &["infos", "discovery", "UnknownType", "1.2.3.4"] + ); + } } -#[test] -fn test_current_hashrate_no_params() { - perform_cmd_test("current_hashrate_no_params", &["infos", "current-hashrate"]); +mod history_hashrate { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("one_param", &url, &["infos", "history-hashrate", "100"]); + } + + #[tokio::test] + async fn test_two_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "two_params", + &url, + &["infos", "history-hashrate", "100", "200"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["infos", "history-hashrate"]); + } + + #[test] + fn test_bad_param() { + perform_cmd_test!("bad_param", &["infos", "history-hashrate", "foo"]); + } } -#[test] -fn test_current_hashrate_bad_param() { - perform_cmd_test( - "current_hashrate_bad_param", - &["infos", "current-hashrate", "foo"], - ); +mod current_hashrate { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("one_param", &url, &["infos", "current-hashrate", "100"]); + } + + #[tokio::test] + async fn test_no_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("no_params", &url, &["infos", "current-hashrate"]); + } + + #[test] + fn test_bad_param() { + perform_cmd_test!("bad_param", &["infos", "current-hashrate", "foo"]); + } } -#[test] -fn test_current_difficulty() { - perform_cmd_test("current_difficulty", &["infos", "current-difficulty"]); +#[tokio::test] +async fn test_current_difficulty() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("current_difficulty", &url, &["infos", "current-difficulty"]); } diff --git a/tests/main.rs b/tests/main.rs index 644e366..150bbc9 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -1,21 +1,19 @@ -mod utils; - -use crate::utils::perform_cmd_test; +mod common; #[test] fn test_help() { - perform_cmd_test("help", &["--help"]); + perform_cmd_test!("help", &["--help"]); } #[test] fn test_bad_command() { - perform_cmd_test("bad_command", &["invalid-command"]); + perform_cmd_test!("bad_command", &["bad-command"]); } #[test] fn test_bad_url() { - perform_cmd_test( + perform_cmd_test!( "bad_url", - &["--url", "http://invalid-url", "infos", "version"], + &["--url", "http://invalid-url", "infos", "version"] ); } diff --git a/tests/miners.rs b/tests/miners.rs new file mode 100644 index 0000000..56d52c1 --- /dev/null +++ b/tests/miners.rs @@ -0,0 +1,125 @@ +mod common; + +use crate::common::setup_node; + +mod cpu_mining { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_start_mining() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "start_mining", + &url, + &["miners", "cpu-mining", "start-mining"] + ); + } + + #[tokio::test] + async fn test_stop_mining() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "stop_mining", + &url, + &["miners", "cpu-mining", "stop-mining"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["miners", "cpu-mining"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("bad_param", &url, &["miners", "cpu-mining", "foo"]); + } +} + +mod mine_one_block { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + perform_cmd_test!("one_param", &["miners", "mine-one-block", "1"]); + } + + #[tokio::test] + async fn test_two_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("two_params", &url, &["miners", "mine-one-block", "1", "1"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["miners", "mine-one-block"]); + } + + #[test] + fn test_bad_param() { + perform_cmd_test!("bad_param", &["miners", "mine-one-block", "foo", "1"]); + } +} + +#[tokio::test] +async fn test_addresses() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("addresses", &url, &["miners", "addresses"]); +} + +mod update_addresses { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "one_param", + &url, + &[ + "miners", + "update-addresses", + "1FsroWmeJPBhcPiUr37pWXdojRBe6jdey9uukEXk1TheA" + ] + ); + } + + #[tokio::test] + async fn test_four_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "four_params", + &url, + &[ + "miners", + "update-addresses", + "1FsroWmeJPBhcPiUr37pWXdojRBe6jdey9uukEXk1TheA", + "1CQvSXsmM5BMFKguKDPpNUfw1idiut8UifLtT8748JdHc", + "193maApeJWrz9GFwWCfa982ccLARVE9Y1WgKSJaUs7UAx", + "16fZKYPCZJv2TP3FArA9FLUQceTS9U8xVnSjxFG9MBKyY" + ] + ); + } + + #[tokio::test] + async fn test_no_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("no_params", &url, &["miners", "update-addresses"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("bad_param", &url, &["miners", "update-addresses", "foo"]); + } +} diff --git a/tests/snapshots/addresses/balance/bad_param.snap b/tests/snapshots/addresses/balance/bad_param.snap new file mode 100644 index 0000000..0015b74 --- /dev/null +++ b/tests/snapshots/addresses/balance/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - addresses + - balance + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: path parameter address (Invalid address foo: foo) diff --git a/tests/snapshots/addresses/balance/no_params.snap b/tests/snapshots/addresses/balance/no_params.snap new file mode 100644 index 0000000..450ebb1 --- /dev/null +++ b/tests/snapshots/addresses/balance/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - addresses + - balance +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: +
+ +Usage: kermit addresses balance
+ +For more information, try '--help'. diff --git a/tests/snapshots/addresses/balance/one_param.snap b/tests/snapshots/addresses/balance/one_param.snap new file mode 100644 index 0000000..f398c19 --- /dev/null +++ b/tests/snapshots/addresses/balance/one_param.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - addresses + - balance + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "balance": "1000000000000000000000000", + "balanceHint": "1000000 ALPH", + "lockedBalance": "0", + "lockedBalanceHint": "0 ALPH", + "utxoNum": 1 +} + +----- stderr ----- diff --git a/tests/snapshots/addresses/balance/two_params.snap b/tests/snapshots/addresses/balance/two_params.snap new file mode 100644 index 0000000..7d90dfc --- /dev/null +++ b/tests/snapshots/addresses/balance/two_params.snap @@ -0,0 +1,23 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - addresses + - balance + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH + - "--mem-pool" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "balance": "1000000000000000000000000", + "balanceHint": "1000000 ALPH", + "lockedBalance": "0", + "lockedBalanceHint": "0 ALPH", + "utxoNum": 1 +} + +----- stderr ----- diff --git a/tests/snapshots/addresses/group/bad_param.snap b/tests/snapshots/addresses/group/bad_param.snap new file mode 100644 index 0000000..95838c4 --- /dev/null +++ b/tests/snapshots/addresses/group/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - addresses + - group + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: path parameter address (Invalid address foo: foo) diff --git a/tests/snapshots/addresses/group/no_params.snap b/tests/snapshots/addresses/group/no_params.snap new file mode 100644 index 0000000..1d109d9 --- /dev/null +++ b/tests/snapshots/addresses/group/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - addresses + - group +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: +
+ +Usage: kermit addresses group
+ +For more information, try '--help'. diff --git a/tests/snapshots/addresses/group/one_param.snap b/tests/snapshots/addresses/group/one_param.snap new file mode 100644 index 0000000..ebdeccc --- /dev/null +++ b/tests/snapshots/addresses/group/one_param.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - addresses + - group + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "group": 0 +} + +----- stderr ----- diff --git a/tests/snapshots/addresses/utxos/bad_param.snap b/tests/snapshots/addresses/utxos/bad_param.snap new file mode 100644 index 0000000..5d1a8ce --- /dev/null +++ b/tests/snapshots/addresses/utxos/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - addresses + - utxos + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: path parameter address (Invalid address foo: foo) diff --git a/tests/snapshots/addresses/utxos/no_params.snap b/tests/snapshots/addresses/utxos/no_params.snap new file mode 100644 index 0000000..9123a14 --- /dev/null +++ b/tests/snapshots/addresses/utxos/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - addresses + - utxos +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: +
+ +Usage: kermit addresses utxos
+ +For more information, try '--help'. diff --git a/tests/snapshots/addresses/utxos/one_param.snap b/tests/snapshots/addresses/utxos/one_param.snap new file mode 100644 index 0000000..2f356f6 --- /dev/null +++ b/tests/snapshots/addresses/utxos/one_param.snap @@ -0,0 +1,28 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - addresses + - utxos + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "utxos": [ + { + "additionalData": "d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df48", + "amount": "1000000000000000000000000", + "lockTime": 1636379973000, + "ref": { + "hint": 933512263, + "key": "9fa782e8b88d4f95e28b3b2417e5bc30d33a5ae8486d4a8885b82b224259c1e6" + } + } + ] +} + +----- stderr ----- diff --git a/tests/snapshots/addresses/utxos/two_params.snap b/tests/snapshots/addresses/utxos/two_params.snap new file mode 100644 index 0000000..4b4e197 --- /dev/null +++ b/tests/snapshots/addresses/utxos/two_params.snap @@ -0,0 +1,29 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - addresses + - utxos + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH + - "--error-if-exceed-max-utxos" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "utxos": [ + { + "additionalData": "d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df48", + "amount": "1000000000000000000000000", + "lockTime": 1636379973000, + "ref": { + "hint": 933512263, + "key": "9fa782e8b88d4f95e28b3b2417e5bc30d33a5ae8486d4a8885b82b224259c1e6" + } + } + ] +} + +----- stderr ----- diff --git a/tests/snapshots/blockflow/block/bad_param.snap b/tests/snapshots/blockflow/block/bad_param.snap new file mode 100644 index 0000000..dba86e8 --- /dev/null +++ b/tests/snapshots/blockflow/block/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - block + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: path parameter block_hash (Invalid hex string: foo: foo) diff --git a/tests/snapshots/blockflow/block/no_params.snap b/tests/snapshots/blockflow/block/no_params.snap new file mode 100644 index 0000000..29c6b39 --- /dev/null +++ b/tests/snapshots/blockflow/block/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - block +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow block + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/block/one_param.snap b/tests/snapshots/blockflow/block/one_param.snap new file mode 100644 index 0000000..f12faf0 --- /dev/null +++ b/tests/snapshots/blockflow/block/one_param.snap @@ -0,0 +1,65 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - block + - f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "chainFrom": 3, + "chainTo": 3, + "depStateHash": "0000000000000000000000000000000000000000000000000000000000000000", + "deps": [ + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "ghostUncles": [], + "hash": "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + "height": 0, + "nonce": "000000000000000000000000000000000000000000000011", + "target": "20ffffff", + "timestamp": 1231006505000, + "transactions": [ + { + "contractInputs": [], + "generatedOutputs": [], + "inputSignatures": [], + "scriptExecutionOk": true, + "scriptSignatures": [], + "unsigned": { + "fixedOutputs": [ + { + "address": "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "attoAlphAmount": "1000000000000000000000000", + "hint": 1022114513, + "key": "5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab47", + "lockTime": 1636379973000, + "message": "d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df48", + "tokens": [] + } + ], + "gasAmount": 20000, + "gasPrice": "100000000000", + "inputs": [], + "networkId": 4, + "txId": "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "version": 0 + } + } + ], + "txsHash": "f0467c2593e149510c08e9544544e8e66743500cbeef0cc27f315ff20f806a66", + "version": 0 +} + +----- stderr ----- diff --git a/tests/snapshots/blockflow/block_with_events/bad_param.snap b/tests/snapshots/blockflow/block_with_events/bad_param.snap new file mode 100644 index 0000000..391b532 --- /dev/null +++ b/tests/snapshots/blockflow/block_with_events/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - block-with-events + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: path parameter block_hash (Invalid hex string: foo: foo) diff --git a/tests/snapshots/blockflow/block_with_events/no_params.snap b/tests/snapshots/blockflow/block_with_events/no_params.snap new file mode 100644 index 0000000..ac4a4af --- /dev/null +++ b/tests/snapshots/blockflow/block_with_events/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - block-with-events +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow block-with-events + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/block_with_events/one_param.snap b/tests/snapshots/blockflow/block_with_events/one_param.snap new file mode 100644 index 0000000..304fc0b --- /dev/null +++ b/tests/snapshots/blockflow/block_with_events/one_param.snap @@ -0,0 +1,68 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - block-with-events + - f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "block": { + "chainFrom": 3, + "chainTo": 3, + "depStateHash": "0000000000000000000000000000000000000000000000000000000000000000", + "deps": [ + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "ghostUncles": [], + "hash": "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + "height": 0, + "nonce": "000000000000000000000000000000000000000000000011", + "target": "20ffffff", + "timestamp": 1231006505000, + "transactions": [ + { + "contractInputs": [], + "generatedOutputs": [], + "inputSignatures": [], + "scriptExecutionOk": true, + "scriptSignatures": [], + "unsigned": { + "fixedOutputs": [ + { + "address": "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "attoAlphAmount": "1000000000000000000000000", + "hint": 1022114513, + "key": "5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab47", + "lockTime": 1636379973000, + "message": "d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df48", + "tokens": [] + } + ], + "gasAmount": 20000, + "gasPrice": "100000000000", + "inputs": [], + "networkId": 4, + "txId": "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "version": 0 + } + } + ], + "txsHash": "f0467c2593e149510c08e9544544e8e66743500cbeef0cc27f315ff20f806a66", + "version": 0 + }, + "events": [] +} + +----- stderr ----- diff --git a/tests/snapshots/blockflow/blocks/bad_param.snap b/tests/snapshots/blockflow/blocks/bad_param.snap new file mode 100644 index 0000000..576d597 --- /dev/null +++ b/tests/snapshots/blockflow/blocks/bad_param.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - blocks + - foo +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: invalid value 'foo' for '': invalid digit found in string + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/blocks/no_params.snap b/tests/snapshots/blockflow/blocks/no_params.snap new file mode 100644 index 0000000..72d0489 --- /dev/null +++ b/tests/snapshots/blockflow/blocks/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - blocks +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow blocks [TO_TS] + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/blocks/one_param.snap b/tests/snapshots/blockflow/blocks/one_param.snap new file mode 100644 index 0000000..2fb7731 --- /dev/null +++ b/tests/snapshots/blockflow/blocks/one_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - blocks + - "100" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Time span cannot be greater than Duration(1800000ms) diff --git a/tests/snapshots/blockflow/blocks/two_params.snap b/tests/snapshots/blockflow/blocks/two_params.snap new file mode 100644 index 0000000..0ea2e1e --- /dev/null +++ b/tests/snapshots/blockflow/blocks/two_params.snap @@ -0,0 +1,36 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - blocks + - "100" + - "200" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "blocks": [ + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [] + ] +} + +----- stderr ----- diff --git a/tests/snapshots/blockflow/blocks_with_events/bad_param.snap b/tests/snapshots/blockflow/blocks_with_events/bad_param.snap new file mode 100644 index 0000000..d718825 --- /dev/null +++ b/tests/snapshots/blockflow/blocks_with_events/bad_param.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - blocks-with-events + - foo +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: invalid value 'foo' for '': invalid digit found in string + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/blocks_with_events/no_params.snap b/tests/snapshots/blockflow/blocks_with_events/no_params.snap new file mode 100644 index 0000000..436cb23 --- /dev/null +++ b/tests/snapshots/blockflow/blocks_with_events/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - blocks-with-events +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow blocks-with-events [TO_TS] + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/blocks_with_events/one_param.snap b/tests/snapshots/blockflow/blocks_with_events/one_param.snap new file mode 100644 index 0000000..d0a896d --- /dev/null +++ b/tests/snapshots/blockflow/blocks_with_events/one_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - blocks-with-events + - "100" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Time span cannot be greater than Duration(1800000ms) diff --git a/tests/snapshots/blockflow/blocks_with_events/two_params.snap b/tests/snapshots/blockflow/blocks_with_events/two_params.snap new file mode 100644 index 0000000..1d2cd7a --- /dev/null +++ b/tests/snapshots/blockflow/blocks_with_events/two_params.snap @@ -0,0 +1,36 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - blocks-with-events + - "100" + - "200" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "blocksAndEvents": [ + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [] + ] +} + +----- stderr ----- diff --git a/tests/snapshots/blockflow/chain_info/bad_param.snap b/tests/snapshots/blockflow/chain_info/bad_param.snap new file mode 100644 index 0000000..54b7431 --- /dev/null +++ b/tests/snapshots/blockflow/chain_info/bad_param.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - chain-info + - foo + - "1" +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: invalid value 'foo' for '': invalid digit found in string + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/chain_info/no_params.snap b/tests/snapshots/blockflow/chain_info/no_params.snap new file mode 100644 index 0000000..aab3291 --- /dev/null +++ b/tests/snapshots/blockflow/chain_info/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - chain-info +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit blockflow chain-info + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/chain_info/one_param.snap b/tests/snapshots/blockflow/chain_info/one_param.snap new file mode 100644 index 0000000..55a5d99 --- /dev/null +++ b/tests/snapshots/blockflow/chain_info/one_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - chain-info + - "1" +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow chain-info + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/chain_info/two_params.snap b/tests/snapshots/blockflow/chain_info/two_params.snap new file mode 100644 index 0000000..209b950 --- /dev/null +++ b/tests/snapshots/blockflow/chain_info/two_params.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - chain-info + - "1" + - "1" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "currentHeight": 0 +} + +----- stderr ----- diff --git a/tests/snapshots/blockflow/hashes/bad_param.snap b/tests/snapshots/blockflow/hashes/bad_param.snap new file mode 100644 index 0000000..7c207bc --- /dev/null +++ b/tests/snapshots/blockflow/hashes/bad_param.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - hashes + - foo + - "1" + - "0" +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: invalid value 'foo' for '': invalid digit found in string + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/hashes/no_params.snap b/tests/snapshots/blockflow/hashes/no_params.snap new file mode 100644 index 0000000..d559753 --- /dev/null +++ b/tests/snapshots/blockflow/hashes/no_params.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - hashes +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + + +Usage: kermit blockflow hashes + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/hashes/one_param.snap b/tests/snapshots/blockflow/hashes/one_param.snap new file mode 100644 index 0000000..f474b8f --- /dev/null +++ b/tests/snapshots/blockflow/hashes/one_param.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - hashes + - "1" +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit blockflow hashes + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/hashes/three_params.snap b/tests/snapshots/blockflow/hashes/three_params.snap new file mode 100644 index 0000000..de74a6b --- /dev/null +++ b/tests/snapshots/blockflow/hashes/three_params.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - hashes + - "1" + - "1" + - "0" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "headers": [ + "d464261ba4c3b40d96ecd4f2e291c60b6ad1962b800cf2368dacdc7c53072ec5" + ] +} + +----- stderr ----- diff --git a/tests/snapshots/blockflow/hashes/two_params.snap b/tests/snapshots/blockflow/hashes/two_params.snap new file mode 100644 index 0000000..cbf89a8 --- /dev/null +++ b/tests/snapshots/blockflow/hashes/two_params.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - hashes + - "1" + - "1" +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow hashes + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/header/bad_param.snap b/tests/snapshots/blockflow/header/bad_param.snap new file mode 100644 index 0000000..d09e2b5 --- /dev/null +++ b/tests/snapshots/blockflow/header/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - header + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: path parameter block_hash (Invalid hex string: foo: foo) diff --git a/tests/snapshots/blockflow/header/no_params.snap b/tests/snapshots/blockflow/header/no_params.snap new file mode 100644 index 0000000..8a25948 --- /dev/null +++ b/tests/snapshots/blockflow/header/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - header +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow header + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/header/one_param.snap b/tests/snapshots/blockflow/header/one_param.snap new file mode 100644 index 0000000..24971d6 --- /dev/null +++ b/tests/snapshots/blockflow/header/one_param.snap @@ -0,0 +1,31 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - header + - f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "chainFrom": 3, + "chainTo": 3, + "deps": [ + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "hash": "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + "height": 0, + "timestamp": 1231006505000 +} + +----- stderr ----- diff --git a/tests/snapshots/blockflow/is_block_in_main_chain/bad_param.snap b/tests/snapshots/blockflow/is_block_in_main_chain/bad_param.snap new file mode 100644 index 0000000..58db26a --- /dev/null +++ b/tests/snapshots/blockflow/is_block_in_main_chain/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - is-block-in-main-chain + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: query parameter blockHash (Invalid hex string: foo: foo) diff --git a/tests/snapshots/blockflow/is_block_in_main_chain/no_params.snap b/tests/snapshots/blockflow/is_block_in_main_chain/no_params.snap new file mode 100644 index 0000000..2db8cf4 --- /dev/null +++ b/tests/snapshots/blockflow/is_block_in_main_chain/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - is-block-in-main-chain +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow is-block-in-main-chain + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/is_block_in_main_chain/one_param.snap b/tests/snapshots/blockflow/is_block_in_main_chain/one_param.snap new file mode 100644 index 0000000..9b603c5 --- /dev/null +++ b/tests/snapshots/blockflow/is_block_in_main_chain/one_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - is-block-in-main-chain + - f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f +--- +success: true +exit_code: 0 +----- stdout ----- +true + +----- stderr ----- diff --git a/tests/snapshots/blockflow/main_chain_block_by_ghost_uncle/bad_param.snap b/tests/snapshots/blockflow/main_chain_block_by_ghost_uncle/bad_param.snap new file mode 100644 index 0000000..3721c7f --- /dev/null +++ b/tests/snapshots/blockflow/main_chain_block_by_ghost_uncle/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - main-chain-block-by-ghost-uncle + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: path parameter ghost_uncle_hash (Invalid hex string: foo: foo) diff --git a/tests/snapshots/blockflow/main_chain_block_by_ghost_uncle/no_params.snap b/tests/snapshots/blockflow/main_chain_block_by_ghost_uncle/no_params.snap new file mode 100644 index 0000000..f34f47d --- /dev/null +++ b/tests/snapshots/blockflow/main_chain_block_by_ghost_uncle/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - main-chain-block-by-ghost-uncle +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow main-chain-block-by-ghost-uncle + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/main_chain_block_by_ghost_uncle/not_exists.snap b/tests/snapshots/blockflow/main_chain_block_by_ghost_uncle/not_exists.snap new file mode 100644 index 0000000..0499a45 --- /dev/null +++ b/tests/snapshots/blockflow/main_chain_block_by_ghost_uncle/not_exists.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - main-chain-block-by-ghost-uncle + - bdaf9dc514ce7d34b6474b8ca10a3dfb93ba997cb9d5ff1ea724ebe2af48abe5 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: The block bdaf9dc514ce7d34b6474b8ca10a3dfb93ba997cb9d5ff1ea724ebe2af48abe5 does not exist, please check if your full node synced diff --git a/tests/snapshots/blockflow/raw_block/bad_param.snap b/tests/snapshots/blockflow/raw_block/bad_param.snap new file mode 100644 index 0000000..a13276a --- /dev/null +++ b/tests/snapshots/blockflow/raw_block/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - raw-block + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: path parameter block_hash (Invalid hex string: foo: foo) diff --git a/tests/snapshots/blockflow/raw_block/no_params.snap b/tests/snapshots/blockflow/raw_block/no_params.snap new file mode 100644 index 0000000..a0f33af --- /dev/null +++ b/tests/snapshots/blockflow/raw_block/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - raw-block +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow raw-block + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/raw_block/one_param.snap b/tests/snapshots/blockflow/raw_block/one_param.snap new file mode 100644 index 0000000..c7dc728 --- /dev/null +++ b/tests/snapshots/blockflow/raw_block/one_param.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - raw-block + - f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "value": "000000000000000000000000000000000000000000000011000700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f0467c2593e149510c08e9544544e8e66743500cbeef0cc27f315ff20f806a660000011e9db4982820ffffff0100040080004e20c1174876e8000001c6d3c21bcecceda100000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a785efc9273a0000017cffd8d588004020d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df480100000000" +} + +----- stderr ----- diff --git a/tests/snapshots/blockflow/rich_block/bad_param.snap b/tests/snapshots/blockflow/rich_block/bad_param.snap new file mode 100644 index 0000000..f6d0092 --- /dev/null +++ b/tests/snapshots/blockflow/rich_block/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - rich-block + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: path parameter block_hash (Invalid hex string: foo: foo) diff --git a/tests/snapshots/blockflow/rich_block/no_params.snap b/tests/snapshots/blockflow/rich_block/no_params.snap new file mode 100644 index 0000000..a0c045d --- /dev/null +++ b/tests/snapshots/blockflow/rich_block/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - rich-block +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow rich-block + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/rich_block/one_param.snap b/tests/snapshots/blockflow/rich_block/one_param.snap new file mode 100644 index 0000000..d66d442 --- /dev/null +++ b/tests/snapshots/blockflow/rich_block/one_param.snap @@ -0,0 +1,69 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - rich-block + - f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "block": { + "chainFrom": 3, + "chainTo": 3, + "depStateHash": "0000000000000000000000000000000000000000000000000000000000000000", + "deps": [ + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000" + ], + "ghostUncles": [], + "hash": "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + "height": 0, + "nonce": "000000000000000000000000000000000000000000000011", + "target": "20ffffff", + "timestamp": 1231006505000, + "transactions": [ + { + "contractInputs": [], + "generatedOutputs": [], + "inputSignatures": [], + "scriptExecutionOk": true, + "scriptSignatures": [], + "unsigned": { + "fixedOutputs": [ + { + "address": "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "attoAlphAmount": "1000000000000000000000000", + "hint": 1022114513, + "key": "5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab47", + "lockTime": 1636379973000, + "message": "d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df48", + "tokens": [] + } + ], + "gasAmount": 20000, + "gasPrice": "100000000000", + "inputs": [], + "networkId": 4, + "scriptOpt": null, + "txId": "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "version": 0 + } + } + ], + "txsHash": "f0467c2593e149510c08e9544544e8e66743500cbeef0cc27f315ff20f806a66", + "version": 0 + }, + "events": [] +} + +----- stderr ----- diff --git a/tests/snapshots/blockflow/rich_blocks/bad_param.snap b/tests/snapshots/blockflow/rich_blocks/bad_param.snap new file mode 100644 index 0000000..2904fde --- /dev/null +++ b/tests/snapshots/blockflow/rich_blocks/bad_param.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - rich-blocks + - foo +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: invalid value 'foo' for '': invalid digit found in string + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/rich_blocks/no_params.snap b/tests/snapshots/blockflow/rich_blocks/no_params.snap new file mode 100644 index 0000000..fd08b8b --- /dev/null +++ b/tests/snapshots/blockflow/rich_blocks/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - rich-blocks +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit blockflow rich-blocks [TO_TS] + +For more information, try '--help'. diff --git a/tests/snapshots/blockflow/rich_blocks/one_param.snap b/tests/snapshots/blockflow/rich_blocks/one_param.snap new file mode 100644 index 0000000..36a3e3a --- /dev/null +++ b/tests/snapshots/blockflow/rich_blocks/one_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - rich-blocks + - "100" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Time span cannot be greater than Duration(1800000ms) diff --git a/tests/snapshots/blockflow/rich_blocks/two_params.snap b/tests/snapshots/blockflow/rich_blocks/two_params.snap new file mode 100644 index 0000000..27aa29e --- /dev/null +++ b/tests/snapshots/blockflow/rich_blocks/two_params.snap @@ -0,0 +1,36 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - blockflow + - rich-blocks + - "100" + - "200" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "blocksAndEvents": [ + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [], + [] + ] +} + +----- stderr ----- diff --git a/tests/snapshots/infos/chain_params.snap b/tests/snapshots/infos/chain_params.snap index 61e0ede..a97a26a 100644 --- a/tests/snapshots/infos/chain_params.snap +++ b/tests/snapshots/infos/chain_params.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/current_difficulty.snap b/tests/snapshots/infos/current_difficulty.snap index cdd8121..b9cf539 100644 --- a/tests/snapshots/infos/current_difficulty.snap +++ b/tests/snapshots/infos/current_difficulty.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/current_hashrate_bad_param.snap b/tests/snapshots/infos/current_hashrate/bad_param.snap similarity index 82% rename from tests/snapshots/infos/current_hashrate_bad_param.snap rename to tests/snapshots/infos/current_hashrate/bad_param.snap index 7484cf3..5a0b270 100644 --- a/tests/snapshots/infos/current_hashrate_bad_param.snap +++ b/tests/snapshots/infos/current_hashrate/bad_param.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 18 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/current_hashrate_no_params.snap b/tests/snapshots/infos/current_hashrate/no_params.snap similarity index 75% rename from tests/snapshots/infos/current_hashrate_no_params.snap rename to tests/snapshots/infos/current_hashrate/no_params.snap index 48b1e31..c0dab8c 100644 --- a/tests/snapshots/infos/current_hashrate_no_params.snap +++ b/tests/snapshots/infos/current_hashrate/no_params.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 18 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/current_hashrate.snap b/tests/snapshots/infos/current_hashrate/one_param.snap similarity index 76% rename from tests/snapshots/infos/current_hashrate.snap rename to tests/snapshots/infos/current_hashrate/one_param.snap index 1de6a39..779c48c 100644 --- a/tests/snapshots/infos/current_hashrate.snap +++ b/tests/snapshots/infos/current_hashrate/one_param.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 18 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/discovered_neighbors.snap b/tests/snapshots/infos/discovered_neighbors.snap index d977ec4..9b0d4c0 100644 --- a/tests/snapshots/infos/discovered_neighbors.snap +++ b/tests/snapshots/infos/discovered_neighbors.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/discovery_bad_param.snap b/tests/snapshots/infos/discovery/bad_param.snap similarity index 83% rename from tests/snapshots/infos/discovery_bad_param.snap rename to tests/snapshots/infos/discovery/bad_param.snap index b271ebc..487fa48 100644 --- a/tests/snapshots/infos/discovery_bad_param.snap +++ b/tests/snapshots/infos/discovery/bad_param.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/discovery_no_params.snap b/tests/snapshots/infos/discovery/no_params.snap similarity index 84% rename from tests/snapshots/infos/discovery_no_params.snap rename to tests/snapshots/infos/discovery/no_params.snap index d029079..496174c 100644 --- a/tests/snapshots/infos/discovery_no_params.snap +++ b/tests/snapshots/infos/discovery/no_params.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/discovery/reachable.snap b/tests/snapshots/infos/discovery/reachable.snap new file mode 100644 index 0000000..dfe5978 --- /dev/null +++ b/tests/snapshots/infos/discovery/reachable.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - infos + - discovery + - Reachable + - 1.2.3.4 +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/infos/discovery/reachable_no_peers.snap b/tests/snapshots/infos/discovery/reachable_no_peers.snap new file mode 100644 index 0000000..9482765 --- /dev/null +++ b/tests/snapshots/infos/discovery/reachable_no_peers.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - infos + - discovery + - Reachable +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/infos/discovery/reachable_several_peers.snap b/tests/snapshots/infos/discovery/reachable_several_peers.snap new file mode 100644 index 0000000..f18a067 --- /dev/null +++ b/tests/snapshots/infos/discovery/reachable_several_peers.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - infos + - discovery + - Reachable + - 1.2.3.4 + - 5.6.7.8 +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/infos/discovery.snap b/tests/snapshots/infos/discovery/unreachable.snap similarity index 76% rename from tests/snapshots/infos/discovery.snap rename to tests/snapshots/infos/discovery/unreachable.snap index 3e6fd34..cd9059f 100644 --- a/tests/snapshots/infos/discovery.snap +++ b/tests/snapshots/infos/discovery/unreachable.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/discovery/unreachable_no_peers.snap b/tests/snapshots/infos/discovery/unreachable_no_peers.snap new file mode 100644 index 0000000..95edda2 --- /dev/null +++ b/tests/snapshots/infos/discovery/unreachable_no_peers.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - infos + - discovery + - Unreachable +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/infos/discovery/unreachable_several_peers.snap b/tests/snapshots/infos/discovery/unreachable_several_peers.snap new file mode 100644 index 0000000..fbacf16 --- /dev/null +++ b/tests/snapshots/infos/discovery/unreachable_several_peers.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - infos + - discovery + - Unreachable + - 1.2.3.4 + - 5.6.7.8 +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/infos/history_hashrate_bad_param.snap b/tests/snapshots/infos/history_hashrate/bad_param.snap similarity index 82% rename from tests/snapshots/infos/history_hashrate_bad_param.snap rename to tests/snapshots/infos/history_hashrate/bad_param.snap index 5bb9afd..c16cd24 100644 --- a/tests/snapshots/infos/history_hashrate_bad_param.snap +++ b/tests/snapshots/infos/history_hashrate/bad_param.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 18 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/history_hashrate_no_params.snap b/tests/snapshots/infos/history_hashrate/no_params.snap similarity index 84% rename from tests/snapshots/infos/history_hashrate_no_params.snap rename to tests/snapshots/infos/history_hashrate/no_params.snap index 654ad2a..1f5ce9b 100644 --- a/tests/snapshots/infos/history_hashrate_no_params.snap +++ b/tests/snapshots/infos/history_hashrate/no_params.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 18 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/history_hashrate/one_param.snap b/tests/snapshots/infos/history_hashrate/one_param.snap new file mode 100644 index 0000000..cbf97b1 --- /dev/null +++ b/tests/snapshots/infos/history_hashrate/one_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - infos + - history-hashrate + - "100" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Time span cannot be greater than Duration(1800000ms) diff --git a/tests/snapshots/infos/history_hashrate.snap b/tests/snapshots/infos/history_hashrate/two_params.snap similarity index 77% rename from tests/snapshots/infos/history_hashrate.snap rename to tests/snapshots/infos/history_hashrate/two_params.snap index 5d943cf..b4e6816 100644 --- a/tests/snapshots/infos/history_hashrate.snap +++ b/tests/snapshots/infos/history_hashrate/two_params.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 18 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/inter_clique_peer_info.snap b/tests/snapshots/infos/inter_clique_peer_info.snap index 59cd0ed..f0fd635 100644 --- a/tests/snapshots/infos/inter_clique_peer_info.snap +++ b/tests/snapshots/infos/inter_clique_peer_info.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/misbehaviors.snap b/tests/snapshots/infos/misbehaviors.snap index 4d04976..62794ea 100644 --- a/tests/snapshots/infos/misbehaviors.snap +++ b/tests/snapshots/infos/misbehaviors.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: @@ -10,6 +10,14 @@ info: success: true exit_code: 0 ----- stdout ----- -[] +[ + { + "peer": "1.2.3.4", + "status": { + "type": "Banned", + "until": "" + } + } +] ----- stderr ----- diff --git a/tests/snapshots/infos/misbehaviors_ban_unban_bad_param.snap b/tests/snapshots/infos/misbehaviors_ban_unban/bad_param.snap similarity index 83% rename from tests/snapshots/infos/misbehaviors_ban_unban_bad_param.snap rename to tests/snapshots/infos/misbehaviors_ban_unban/bad_param.snap index 9e8487b..c9a99c1 100644 --- a/tests/snapshots/infos/misbehaviors_ban_unban_bad_param.snap +++ b/tests/snapshots/infos/misbehaviors_ban_unban/bad_param.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/misbehaviors_ban_unban/ban.snap b/tests/snapshots/infos/misbehaviors_ban_unban/ban.snap new file mode 100644 index 0000000..bc52d5d --- /dev/null +++ b/tests/snapshots/infos/misbehaviors_ban_unban/ban.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - infos + - misbehaviors-ban-unban + - Ban + - 1.2.3.4 +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/infos/misbehaviors_ban_unban/ban_no_peers.snap b/tests/snapshots/infos/misbehaviors_ban_unban/ban_no_peers.snap new file mode 100644 index 0000000..6a55ed7 --- /dev/null +++ b/tests/snapshots/infos/misbehaviors_ban_unban/ban_no_peers.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - infos + - misbehaviors-ban-unban + - Ban +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/infos/misbehaviors_ban_unban/ban_several_peers.snap b/tests/snapshots/infos/misbehaviors_ban_unban/ban_several_peers.snap new file mode 100644 index 0000000..19296c4 --- /dev/null +++ b/tests/snapshots/infos/misbehaviors_ban_unban/ban_several_peers.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - infos + - misbehaviors-ban-unban + - Ban + - 1.2.3.4 + - 5.6.7.8 +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/infos/misbehaviors_ban_unban_no_params.snap b/tests/snapshots/infos/misbehaviors_ban_unban/no_params.snap similarity index 85% rename from tests/snapshots/infos/misbehaviors_ban_unban_no_params.snap rename to tests/snapshots/infos/misbehaviors_ban_unban/no_params.snap index 7e1ecc9..9f6b0bd 100644 --- a/tests/snapshots/infos/misbehaviors_ban_unban_no_params.snap +++ b/tests/snapshots/infos/misbehaviors_ban_unban/no_params.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/misbehaviors_ban_unban.snap b/tests/snapshots/infos/misbehaviors_ban_unban/unban.snap similarity index 76% rename from tests/snapshots/infos/misbehaviors_ban_unban.snap rename to tests/snapshots/infos/misbehaviors_ban_unban/unban.snap index bdd4e36..e0eda07 100644 --- a/tests/snapshots/infos/misbehaviors_ban_unban.snap +++ b/tests/snapshots/infos/misbehaviors_ban_unban/unban.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/misbehaviors_ban_unban/unban_no_peers.snap b/tests/snapshots/infos/misbehaviors_ban_unban/unban_no_peers.snap new file mode 100644 index 0000000..a0e202c --- /dev/null +++ b/tests/snapshots/infos/misbehaviors_ban_unban/unban_no_peers.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - infos + - misbehaviors-ban-unban + - Unban +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/infos/misbehaviors_ban_unban/unban_several_peers.snap b/tests/snapshots/infos/misbehaviors_ban_unban/unban_several_peers.snap new file mode 100644 index 0000000..42d0250 --- /dev/null +++ b/tests/snapshots/infos/misbehaviors_ban_unban/unban_several_peers.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - infos + - misbehaviors-ban-unban + - Unban + - 1.2.3.4 + - 5.6.7.8 +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/infos/node.snap b/tests/snapshots/infos/node.snap index 0c9b7ca..1dfa6e9 100644 --- a/tests/snapshots/infos/node.snap +++ b/tests/snapshots/infos/node.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/self_clique.snap b/tests/snapshots/infos/self_clique.snap index f8973dc..d9b98db 100644 --- a/tests/snapshots/infos/self_clique.snap +++ b/tests/snapshots/infos/self_clique.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 14 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/infos/unreachable_brokers.snap b/tests/snapshots/infos/unreachable_brokers.snap index 22937e2..1fee980 100644 --- a/tests/snapshots/infos/unreachable_brokers.snap +++ b/tests/snapshots/infos/unreachable_brokers.snap @@ -1,6 +1,6 @@ --- source: tests/utils.rs -assertion_line: 13 +assertion_line: 38 info: program: kermit args: @@ -10,6 +10,8 @@ info: success: true exit_code: 0 ----- stdout ----- -[] +[ + "1.2.3.4" +] ----- stderr ----- diff --git a/tests/snapshots/infos/version.snap b/tests/snapshots/infos/version.snap index 84b3c6a..0c65d0f 100644 --- a/tests/snapshots/infos/version.snap +++ b/tests/snapshots/infos/version.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/main/bad_command.snap b/tests/snapshots/main/bad_command.snap index 4f8432f..2d03b69 100644 --- a/tests/snapshots/main/bad_command.snap +++ b/tests/snapshots/main/bad_command.snap @@ -1,17 +1,17 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: - - invalid-command + - bad-command --- success: false exit_code: 2 ----- stdout ----- ----- stderr ----- -error: unrecognized subcommand 'invalid-command' +error: unrecognized subcommand 'bad-command' Usage: kermit [OPTIONS] diff --git a/tests/snapshots/main/bad_url.snap b/tests/snapshots/main/bad_url.snap index e791524..dfb2e28 100644 --- a/tests/snapshots/main/bad_url.snap +++ b/tests/snapshots/main/bad_url.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: diff --git a/tests/snapshots/main/help.snap b/tests/snapshots/main/help.snap index 875362a..acf78b8 100644 --- a/tests/snapshots/main/help.snap +++ b/tests/snapshots/main/help.snap @@ -1,6 +1,6 @@ --- -source: tests/utils.rs -assertion_line: 13 +source: tests/common/perform_cmd.rs +assertion_line: 38 info: program: kermit args: @@ -12,12 +12,14 @@ exit_code: 0 Usage: kermit [OPTIONS] Commands: - events Event for contract, block and hash [aliases: e] + addresses Address management utilities [aliases: a] + blockflow Blockflow data retrieval utilities [aliases: b] + contracts Contract management utilities [aliases: c] infos Infos about node and hashrate [aliases: i] + miners Miners management utilities [aliases: m] + utils Utilities (Address zero, Hash zero, Conversion atto) [aliases: u] transactions Transactions management utilities [aliases: tx] wallets Wallet management utilities [aliases: w] - address Address management utilities [aliases: a] - contracts Contract management utilities [aliases: c] help Print this message or the help of the given subcommand(s) Options: diff --git a/tests/snapshots/miners/addresses.snap b/tests/snapshots/miners/addresses.snap new file mode 100644 index 0000000..152c2e0 --- /dev/null +++ b/tests/snapshots/miners/addresses.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - addresses +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "addresses": [ + "1FsroWmeJPBhcPiUr37pWXdojRBe6jdey9uukEXk1TheA", + "1CQvSXsmM5BMFKguKDPpNUfw1idiut8UifLtT8748JdHc", + "193maApeJWrz9GFwWCfa982ccLARVE9Y1WgKSJaUs7UAx", + "16fZKYPCZJv2TP3FArA9FLUQceTS9U8xVnSjxFG9MBKyY" + ] +} + +----- stderr ----- diff --git a/tests/snapshots/miners/cpu_mining/bad_param.snap b/tests/snapshots/miners/cpu_mining/bad_param.snap new file mode 100644 index 0000000..f0969a9 --- /dev/null +++ b/tests/snapshots/miners/cpu_mining/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - cpu-mining + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: query parameter action (Invalid miner action: foo: foo) diff --git a/tests/snapshots/miners/cpu_mining/no_params.snap b/tests/snapshots/miners/cpu_mining/no_params.snap new file mode 100644 index 0000000..9dcfcab --- /dev/null +++ b/tests/snapshots/miners/cpu_mining/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - cpu-mining +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit miners cpu-mining + +For more information, try '--help'. diff --git a/tests/snapshots/miners/cpu_mining/start_mining.snap b/tests/snapshots/miners/cpu_mining/start_mining.snap new file mode 100644 index 0000000..dcd798d --- /dev/null +++ b/tests/snapshots/miners/cpu_mining/start_mining.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - cpu-mining + - start-mining +--- +success: true +exit_code: 0 +----- stdout ----- +true + +----- stderr ----- diff --git a/tests/snapshots/miners/cpu_mining/stop_mining.snap b/tests/snapshots/miners/cpu_mining/stop_mining.snap new file mode 100644 index 0000000..6d4ba5a --- /dev/null +++ b/tests/snapshots/miners/cpu_mining/stop_mining.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - cpu-mining + - stop-mining +--- +success: true +exit_code: 0 +----- stdout ----- +true + +----- stderr ----- diff --git a/tests/snapshots/miners/mine_one_block/bad_param.snap b/tests/snapshots/miners/mine_one_block/bad_param.snap new file mode 100644 index 0000000..7c5e6ef --- /dev/null +++ b/tests/snapshots/miners/mine_one_block/bad_param.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - mine-one-block + - foo + - "1" +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: invalid value 'foo' for '': invalid digit found in string + +For more information, try '--help'. diff --git a/tests/snapshots/miners/mine_one_block/no_params.snap b/tests/snapshots/miners/mine_one_block/no_params.snap new file mode 100644 index 0000000..9458b17 --- /dev/null +++ b/tests/snapshots/miners/mine_one_block/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - mine-one-block +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit miners mine-one-block + +For more information, try '--help'. diff --git a/tests/snapshots/miners/mine_one_block/one_param.snap b/tests/snapshots/miners/mine_one_block/one_param.snap new file mode 100644 index 0000000..7d50465 --- /dev/null +++ b/tests/snapshots/miners/mine_one_block/one_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - mine-one-block + - "1" +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit miners mine-one-block + +For more information, try '--help'. diff --git a/tests/snapshots/miners/mine_one_block/two_params.snap b/tests/snapshots/miners/mine_one_block/two_params.snap new file mode 100644 index 0000000..d164a5c --- /dev/null +++ b/tests/snapshots/miners/mine_one_block/two_params.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - mine-one-block + - "1" + - "1" +--- +success: true +exit_code: 0 +----- stdout ----- +true + +----- stderr ----- diff --git a/tests/snapshots/miners/update_addresses/bad_param.snap b/tests/snapshots/miners/update_addresses/bad_param.snap new file mode 100644 index 0000000..d306ee8 --- /dev/null +++ b/tests/snapshots/miners/update_addresses/bad_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - update-addresses + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: body (Invalid address foo at index 14: decoding failure) diff --git a/tests/snapshots/miners/update_addresses/four_params.snap b/tests/snapshots/miners/update_addresses/four_params.snap new file mode 100644 index 0000000..7ae43ba --- /dev/null +++ b/tests/snapshots/miners/update_addresses/four_params.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - update-addresses + - 1FsroWmeJPBhcPiUr37pWXdojRBe6jdey9uukEXk1TheA + - 1CQvSXsmM5BMFKguKDPpNUfw1idiut8UifLtT8748JdHc + - 193maApeJWrz9GFwWCfa982ccLARVE9Y1WgKSJaUs7UAx + - 16fZKYPCZJv2TP3FArA9FLUQceTS9U8xVnSjxFG9MBKyY +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/miners/update_addresses/no_params.snap b/tests/snapshots/miners/update_addresses/no_params.snap new file mode 100644 index 0000000..90b29e7 --- /dev/null +++ b/tests/snapshots/miners/update_addresses/no_params.snap @@ -0,0 +1,15 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - update-addresses +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Wrong number of addresses, expected 4, got 0 diff --git a/tests/snapshots/miners/update_addresses/one_param.snap b/tests/snapshots/miners/update_addresses/one_param.snap new file mode 100644 index 0000000..b9a2230 --- /dev/null +++ b/tests/snapshots/miners/update_addresses/one_param.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - miners + - update-addresses + - 1FsroWmeJPBhcPiUr37pWXdojRBe6jdey9uukEXk1TheA +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Wrong number of addresses, expected 4, got 1 diff --git a/tests/snapshots/transactions/build/bad_address.snap b/tests/snapshots/transactions/build/bad_address.snap new file mode 100644 index 0000000..5e30046 --- /dev/null +++ b/tests/snapshots/transactions/build/bad_address.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - build + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P + - "1000000000000000000" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: body (Invalid address 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P at index 28: decoding failure) diff --git a/tests/snapshots/transactions/build/bad_public_key.snap b/tests/snapshots/transactions/build/bad_public_key.snap new file mode 100644 index 0000000..e737370 --- /dev/null +++ b/tests/snapshots/transactions/build/bad_public_key.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - build + - 15hLd3PdALjHe9RmFsjpRiMGYrCchZSjdyRufMjyfFSCB + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R + - "1000000000000000000" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: body (Invalid hex string: 15hLd3PdALjHe9RmFsjpRiMGYrCchZSjdyRufMjyfFSCB at index 133: decoding failure) diff --git a/tests/snapshots/transactions/build/no_params.snap b/tests/snapshots/transactions/build/no_params.snap new file mode 100644 index 0000000..e31fc1a --- /dev/null +++ b/tests/snapshots/transactions/build/no_params.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - build +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + + +Usage: kermit transactions build + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/build/one_param.snap b/tests/snapshots/transactions/build/one_param.snap new file mode 100644 index 0000000..0f3719c --- /dev/null +++ b/tests/snapshots/transactions/build/one_param.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - build + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit transactions build + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/build/three_params.snap b/tests/snapshots/transactions/build/three_params.snap new file mode 100644 index 0000000..87a6a73 --- /dev/null +++ b/tests/snapshots/transactions/build/three_params.snap @@ -0,0 +1,26 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - build + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R + - "1000000000000000000" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "fromGroup": 1, + "gasAmount": 20000, + "gasPrice": "100000000000", + "toGroup": 3, + "txId": "ac3acfcb932a7c91b870ee7d8e012f06dd1b1986620fddc5e4d6ff72e3d6d265", + "type": "BuildSimpleTransferTxResult", + "unsignedTx": "00040080004e20c1174876e80001ccb4a237975e960d767ce9b550bc481fe3a883d142bc4454539223a135756a371f5f67720002ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff8810602c40de0b6b3a764000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a785efc9273a00000000000000000000c6d3c20de6fb3cb00f00000045c42a82aa01b2b7399c26ee6450d44f04e017aa3c44af5e6b451f32aa458b1c00000000000000000000" +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/build/too_small_value.snap b/tests/snapshots/transactions/build/too_small_value.snap new file mode 100644 index 0000000..b1c0027 --- /dev/null +++ b/tests/snapshots/transactions/build/too_small_value.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - build + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R + - "100" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Tx output value is too small, avoid spreading dust diff --git a/tests/snapshots/transactions/build/two_params.snap b/tests/snapshots/transactions/build/two_params.snap new file mode 100644 index 0000000..77ee9a4 --- /dev/null +++ b/tests/snapshots/transactions/build/two_params.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - build + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit transactions build + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/create/bad_address.snap b/tests/snapshots/transactions/create/bad_address.snap new file mode 100644 index 0000000..7521ac8 --- /dev/null +++ b/tests/snapshots/transactions/create/bad_address.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - create + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P + - "1000000000000000000" + - "--private-key" + - 609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: body (Invalid address 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P at index 28: decoding failure) diff --git a/tests/snapshots/transactions/create/bad_private_key.snap b/tests/snapshots/transactions/create/bad_private_key.snap new file mode 100644 index 0000000..08934c7 --- /dev/null +++ b/tests/snapshots/transactions/create/bad_private_key.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - create + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R + - "1000000000000000000" + - "--private-key" + - 609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid private key diff --git a/tests/snapshots/transactions/create/bad_public_key.snap b/tests/snapshots/transactions/create/bad_public_key.snap new file mode 100644 index 0000000..78ff863 --- /dev/null +++ b/tests/snapshots/transactions/create/bad_public_key.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - create + - 15hLd3PdALjHe9RmFsjpRiMGYrCchZSjdyRufMjyfFSCB + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R + - "1000000000000000000" + - "--private-key" + - 609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: body (Invalid hex string: 15hLd3PdALjHe9RmFsjpRiMGYrCchZSjdyRufMjyfFSCB at index 133: decoding failure) diff --git a/tests/snapshots/transactions/create/four_params.snap b/tests/snapshots/transactions/create/four_params.snap new file mode 100644 index 0000000..ebbbde2 --- /dev/null +++ b/tests/snapshots/transactions/create/four_params.snap @@ -0,0 +1,24 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - create + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R + - "1000000000000000000" + - "--private-key" + - 609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76 +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "fromGroup": 1, + "toGroup": 3, + "txId": "ac3acfcb932a7c91b870ee7d8e012f06dd1b1986620fddc5e4d6ff72e3d6d265" +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/create/no_params.snap b/tests/snapshots/transactions/create/no_params.snap new file mode 100644 index 0000000..caa84e7 --- /dev/null +++ b/tests/snapshots/transactions/create/no_params.snap @@ -0,0 +1,23 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - create +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + --private-key + + + + +Usage: kermit transactions create --private-key + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/create/one_param.snap b/tests/snapshots/transactions/create/one_param.snap new file mode 100644 index 0000000..01c0e87 --- /dev/null +++ b/tests/snapshots/transactions/create/one_param.snap @@ -0,0 +1,23 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - create + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + --private-key + + + +Usage: kermit transactions create --private-key + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/create/three_params.snap b/tests/snapshots/transactions/create/three_params.snap new file mode 100644 index 0000000..d630b2a --- /dev/null +++ b/tests/snapshots/transactions/create/three_params.snap @@ -0,0 +1,23 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - create + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R + - "1000000000000000000" +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + --private-key + +Usage: kermit transactions create --private-key + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/create/too_small_value.snap b/tests/snapshots/transactions/create/too_small_value.snap new file mode 100644 index 0000000..e9d681e --- /dev/null +++ b/tests/snapshots/transactions/create/too_small_value.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - create + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R + - "100" + - "--private-key" + - 609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Tx output value is too small, avoid spreading dust diff --git a/tests/snapshots/transactions/create/two_params.snap b/tests/snapshots/transactions/create/two_params.snap new file mode 100644 index 0000000..b513b6a --- /dev/null +++ b/tests/snapshots/transactions/create/two_params.snap @@ -0,0 +1,23 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - create + - 02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106 + - 17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + --private-key + + +Usage: kermit transactions create --private-key + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/details/exists.snap b/tests/snapshots/transactions/details/exists.snap new file mode 100644 index 0000000..61b3585 --- /dev/null +++ b/tests/snapshots/transactions/details/exists.snap @@ -0,0 +1,41 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - details + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "contractInputs": [], + "generatedOutputs": [], + "inputSignatures": [], + "scriptExecutionOk": true, + "scriptSignatures": [], + "unsigned": { + "fixedOutputs": [ + { + "address": "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "attoAlphAmount": "1000000000000000000000000", + "hint": 1022114513, + "key": "5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab47", + "lockTime": 1636379973000, + "message": "d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df48", + "tokens": [] + } + ], + "gasAmount": 20000, + "gasPrice": "100000000000", + "inputs": [], + "networkId": 4, + "txId": "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "version": 0 + } +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/details/exists_with_groups.snap b/tests/snapshots/transactions/details/exists_with_groups.snap new file mode 100644 index 0000000..f014240 --- /dev/null +++ b/tests/snapshots/transactions/details/exists_with_groups.snap @@ -0,0 +1,45 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - details + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 + - "--from-group" + - "3" + - "--to-group" + - "3" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "contractInputs": [], + "generatedOutputs": [], + "inputSignatures": [], + "scriptExecutionOk": true, + "scriptSignatures": [], + "unsigned": { + "fixedOutputs": [ + { + "address": "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "attoAlphAmount": "1000000000000000000000000", + "hint": 1022114513, + "key": "5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab47", + "lockTime": 1636379973000, + "message": "d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df48", + "tokens": [] + } + ], + "gasAmount": 20000, + "gasPrice": "100000000000", + "inputs": [], + "networkId": 4, + "txId": "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "version": 0 + } +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/details/no_params.snap b/tests/snapshots/transactions/details/no_params.snap new file mode 100644 index 0000000..6f851c1 --- /dev/null +++ b/tests/snapshots/transactions/details/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - details +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit transactions details + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/details/not_exists.snap b/tests/snapshots/transactions/details/not_exists.snap new file mode 100644 index 0000000..165f422 --- /dev/null +++ b/tests/snapshots/transactions/details/not_exists.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - details + - b2dcb7c16a2846a857568547b775db5217f243102285b73a7c1852f4495e7a36 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Transaction b2dcb7c16a2846a857568547b775db5217f243102285b73a7c1852f4495e7a36 not found diff --git a/tests/snapshots/transactions/details/not_exists_with_groups.snap b/tests/snapshots/transactions/details/not_exists_with_groups.snap new file mode 100644 index 0000000..e05a868 --- /dev/null +++ b/tests/snapshots/transactions/details/not_exists_with_groups.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - details + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 + - "--from-group" + - "1" + - "--to-group" + - "1" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Transaction 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 not found diff --git a/tests/snapshots/transactions/raw/exists.snap b/tests/snapshots/transactions/raw/exists.snap new file mode 100644 index 0000000..5e7f330 --- /dev/null +++ b/tests/snapshots/transactions/raw/exists.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - raw + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "value": "00040080004e20c1174876e8000001c6d3c21bcecceda100000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a785efc9273a0000017cffd8d588004020d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df480100000000" +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/raw/exists_with_groups.snap b/tests/snapshots/transactions/raw/exists_with_groups.snap new file mode 100644 index 0000000..47ecef5 --- /dev/null +++ b/tests/snapshots/transactions/raw/exists_with_groups.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - raw + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 + - "--from-group" + - "3" + - "--to-group" + - "3" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "value": "00040080004e20c1174876e8000001c6d3c21bcecceda100000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a785efc9273a0000017cffd8d588004020d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df480100000000" +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/raw/no_params.snap b/tests/snapshots/transactions/raw/no_params.snap new file mode 100644 index 0000000..b15b257 --- /dev/null +++ b/tests/snapshots/transactions/raw/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - raw +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit transactions raw + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/raw/not_exists.snap b/tests/snapshots/transactions/raw/not_exists.snap new file mode 100644 index 0000000..5215d5d --- /dev/null +++ b/tests/snapshots/transactions/raw/not_exists.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - raw + - b2dcb7c16a2846a857568547b775db5217f243102285b73a7c1852f4495e7a36 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Transaction b2dcb7c16a2846a857568547b775db5217f243102285b73a7c1852f4495e7a36 not found diff --git a/tests/snapshots/transactions/raw/not_exists_with_groups.snap b/tests/snapshots/transactions/raw/not_exists_with_groups.snap new file mode 100644 index 0000000..21967d7 --- /dev/null +++ b/tests/snapshots/transactions/raw/not_exists_with_groups.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - raw + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 + - "--from-group" + - "1" + - "--to-group" + - "1" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Transaction 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 not found diff --git a/tests/snapshots/transactions/rich_details/exists.snap b/tests/snapshots/transactions/rich_details/exists.snap new file mode 100644 index 0000000..67b5cfa --- /dev/null +++ b/tests/snapshots/transactions/rich_details/exists.snap @@ -0,0 +1,42 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - rich-details + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "contractInputs": [], + "generatedOutputs": [], + "inputSignatures": [], + "scriptExecutionOk": true, + "scriptSignatures": [], + "unsigned": { + "fixedOutputs": [ + { + "address": "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "attoAlphAmount": "1000000000000000000000000", + "hint": 1022114513, + "key": "5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab47", + "lockTime": 1636379973000, + "message": "d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df48", + "tokens": [] + } + ], + "gasAmount": 20000, + "gasPrice": "100000000000", + "inputs": [], + "networkId": 4, + "scriptOpt": null, + "txId": "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "version": 0 + } +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/rich_details/exists_with_groups.snap b/tests/snapshots/transactions/rich_details/exists_with_groups.snap new file mode 100644 index 0000000..b1fb7a2 --- /dev/null +++ b/tests/snapshots/transactions/rich_details/exists_with_groups.snap @@ -0,0 +1,46 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - rich-details + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 + - "--from-group" + - "3" + - "--to-group" + - "3" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "contractInputs": [], + "generatedOutputs": [], + "inputSignatures": [], + "scriptExecutionOk": true, + "scriptSignatures": [], + "unsigned": { + "fixedOutputs": [ + { + "address": "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "attoAlphAmount": "1000000000000000000000000", + "hint": 1022114513, + "key": "5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab47", + "lockTime": 1636379973000, + "message": "d55dedab77b982ade743516f96d9c4fe85f19cc85e64d02b81b67532ce72df48", + "tokens": [] + } + ], + "gasAmount": 20000, + "gasPrice": "100000000000", + "inputs": [], + "networkId": 4, + "scriptOpt": null, + "txId": "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "version": 0 + } +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/rich_details/no_params.snap b/tests/snapshots/transactions/rich_details/no_params.snap new file mode 100644 index 0000000..a91940e --- /dev/null +++ b/tests/snapshots/transactions/rich_details/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - rich-details +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit transactions rich-details + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/rich_details/not_exists.snap b/tests/snapshots/transactions/rich_details/not_exists.snap new file mode 100644 index 0000000..51c5e0a --- /dev/null +++ b/tests/snapshots/transactions/rich_details/not_exists.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - rich-details + - b2dcb7c16a2846a857568547b775db5217f243102285b73a7c1852f4495e7a36 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Transaction b2dcb7c16a2846a857568547b775db5217f243102285b73a7c1852f4495e7a36 not found diff --git a/tests/snapshots/transactions/rich_details/not_exists_with_groups.snap b/tests/snapshots/transactions/rich_details/not_exists_with_groups.snap new file mode 100644 index 0000000..bfbd687 --- /dev/null +++ b/tests/snapshots/transactions/rich_details/not_exists_with_groups.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - rich-details + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 + - "--from-group" + - "1" + - "--to-group" + - "1" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Transaction 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 not found diff --git a/tests/snapshots/transactions/status/exists.snap b/tests/snapshots/transactions/status/exists.snap new file mode 100644 index 0000000..df86fb4 --- /dev/null +++ b/tests/snapshots/transactions/status/exists.snap @@ -0,0 +1,23 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - status + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "blockHash": "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + "chainConfirmations": 1, + "fromGroupConfirmations": 1, + "toGroupConfirmations": 1, + "txIndex": 0, + "type": "Confirmed" +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/status/exists_with_groups.snap b/tests/snapshots/transactions/status/exists_with_groups.snap new file mode 100644 index 0000000..2f00dd2 --- /dev/null +++ b/tests/snapshots/transactions/status/exists_with_groups.snap @@ -0,0 +1,27 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - status + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 + - "--from-group" + - "3" + - "--to-group" + - "3" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "blockHash": "f344b3dd45f39d62cfd200cfa3312c080018102908787c5565b8c8af3647368f", + "chainConfirmations": 1, + "fromGroupConfirmations": 1, + "toGroupConfirmations": 1, + "txIndex": 0, + "type": "Confirmed" +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/status/no_params.snap b/tests/snapshots/transactions/status/no_params.snap new file mode 100644 index 0000000..62e2ce5 --- /dev/null +++ b/tests/snapshots/transactions/status/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - status +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit transactions status + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/status/not_exists.snap b/tests/snapshots/transactions/status/not_exists.snap new file mode 100644 index 0000000..cee143c --- /dev/null +++ b/tests/snapshots/transactions/status/not_exists.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - status + - b2dcb7c16a2846a857568547b775db5217f243102285b73a7c1852f4495e7a36 +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "type": "TxNotFound" +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/status/not_exists_with_groups.snap b/tests/snapshots/transactions/status/not_exists_with_groups.snap new file mode 100644 index 0000000..90496a2 --- /dev/null +++ b/tests/snapshots/transactions/status/not_exists_with_groups.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - status + - 482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66 + - "--from-group" + - "1" + - "--to-group" + - "1" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "type": "TxNotFound" +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/submit/bad_private_key.snap b/tests/snapshots/transactions/submit/bad_private_key.snap new file mode 100644 index 0000000..af970b5 --- /dev/null +++ b/tests/snapshots/transactions/submit/bad_private_key.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - submit + - a46f5fb14ae87d3d776d5a76823b238e0ddad43d8e6f6f8f40299ba0ec85e230 + - 00040080004e20c1174876e80001ccb4a237b769377b8ebe2326104daf6ee211daada428ee5e21c50c8b63be65c1072555980002ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff8810602c40de0b6b3a764000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a785efc9273a00000000000000000000c6d3c1d647b478e + - "--private-key" + - 609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid private key diff --git a/tests/snapshots/transactions/submit/bad_tx_id.snap b/tests/snapshots/transactions/submit/bad_tx_id.snap new file mode 100644 index 0000000..96ebacf --- /dev/null +++ b/tests/snapshots/transactions/submit/bad_tx_id.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - submit + - a46f5fb14ae87d3d776d5a76823b238e0ddad43d8e6f6f8f40299ba0ec85 + - 00040080004e20c1174876e80001ccb4a237b769377b8ebe2326104daf6ee211daada428ee5e21c50c8b63be65c1072555980002ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff8810602c40de0b6b3a764000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a785efc9273a00000000000000000000c6d3c1d647b478ec4b00000045c42a82aa01b2b7399c26ee6450d44f04e017aa3c44af5e6b451f32aa458b1c00000000000000000000 + - "--private-key" + - 609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid transaction id diff --git a/tests/snapshots/transactions/submit/bad_unsigned_tx.snap b/tests/snapshots/transactions/submit/bad_unsigned_tx.snap new file mode 100644 index 0000000..882af79 --- /dev/null +++ b/tests/snapshots/transactions/submit/bad_unsigned_tx.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - submit + - a46f5fb14ae87d3d776d5a76823b238e0ddad43d8e6f6f8f40299ba0ec85e230 + - 00040080004e20c1174876e80001ccb4a237b769377b8ebe2326104daf6ee211daada428ee5e21c50c8b63be65c1072555980002ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff8810602c40de0b6b3a764000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a785efc9273a00000000000000000000c6d3c1d647b478ec + - "--private-key" + - 609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Too few bytes: expected 11, got 8 diff --git a/tests/snapshots/transactions/submit/no_params.snap b/tests/snapshots/transactions/submit/no_params.snap new file mode 100644 index 0000000..c606bd8 --- /dev/null +++ b/tests/snapshots/transactions/submit/no_params.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - submit +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + --private-key + + + +Usage: kermit transactions submit --private-key + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/submit/one_param.snap b/tests/snapshots/transactions/submit/one_param.snap new file mode 100644 index 0000000..e0b417e --- /dev/null +++ b/tests/snapshots/transactions/submit/one_param.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - submit + - a46f5fb14ae87d3d776d5a76823b238e0ddad43d8e6f6f8f40299ba0ec85e230 +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + --private-key + + +Usage: kermit transactions submit --private-key + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/submit/three_params.snap b/tests/snapshots/transactions/submit/three_params.snap new file mode 100644 index 0000000..10fc0f0 --- /dev/null +++ b/tests/snapshots/transactions/submit/three_params.snap @@ -0,0 +1,23 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - submit + - ac3acfcb932a7c91b870ee7d8e012f06dd1b1986620fddc5e4d6ff72e3d6d265 + - 00040080004e20c1174876e80001ccb4a237975e960d767ce9b550bc481fe3a883d142bc4454539223a135756a371f5f67720002ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff8810602c40de0b6b3a764000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a785efc9273a00000000000000000000c6d3c20de6fb3cb00f00000045c42a82aa01b2b7399c26ee6450d44f04e017aa3c44af5e6b451f32aa458b1c00000000000000000000 + - "--private-key" + - 609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76 +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "fromGroup": 1, + "toGroup": 3, + "txId": "ac3acfcb932a7c91b870ee7d8e012f06dd1b1986620fddc5e4d6ff72e3d6d265" +} + +----- stderr ----- diff --git a/tests/snapshots/transactions/submit/two_params.snap b/tests/snapshots/transactions/submit/two_params.snap new file mode 100644 index 0000000..baf1130 --- /dev/null +++ b/tests/snapshots/transactions/submit/two_params.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - submit + - a46f5fb14ae87d3d776d5a76823b238e0ddad43d8e6f6f8f40299ba0ec85e230 + - 00040080004e20c1174876e80001ccb4a237b769377b8ebe2326104daf6ee211daada428ee5e21c50c8b63be65c1072555980002ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff8810602c40de0b6b3a764000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a785efc9273a00000000000000000000c6d3c1d647b478ec4b00000045c42a82aa01b2b7399c26ee6450d44f04e017aa3c44af5e6b451f32aa458b1c00000000000000000000 +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + --private-key + +Usage: kermit transactions submit --private-key + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/tx_id_from_outputref/bad_param.snap b/tests/snapshots/transactions/tx_id_from_outputref/bad_param.snap new file mode 100644 index 0000000..8e73408 --- /dev/null +++ b/tests/snapshots/transactions/tx_id_from_outputref/bad_param.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - tx-id-from-outputref + - foo + - 91079afe4f5d56d09fab2fa60a9369dcf145eb982aece94bf81d00c537e03231 +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: invalid value 'foo' for '': invalid digit found in string + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/tx_id_from_outputref/exists.snap b/tests/snapshots/transactions/tx_id_from_outputref/exists.snap new file mode 100644 index 0000000..59f25e4 --- /dev/null +++ b/tests/snapshots/transactions/tx_id_from_outputref/exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - tx-id-from-outputref + - "1022114513" + - 5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab47 +--- +success: true +exit_code: 0 +----- stdout ----- +"482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66" + +----- stderr ----- diff --git a/tests/snapshots/transactions/tx_id_from_outputref/missing_param.snap b/tests/snapshots/transactions/tx_id_from_outputref/missing_param.snap new file mode 100644 index 0000000..95a4ca5 --- /dev/null +++ b/tests/snapshots/transactions/tx_id_from_outputref/missing_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - tx-id-from-outputref + - "1900212619" +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit transactions tx-id-from-outputref + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/tx_id_from_outputref/no_params.snap b/tests/snapshots/transactions/tx_id_from_outputref/no_params.snap new file mode 100644 index 0000000..333b614 --- /dev/null +++ b/tests/snapshots/transactions/tx_id_from_outputref/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - tx-id-from-outputref +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit transactions tx-id-from-outputref + +For more information, try '--help'. diff --git a/tests/snapshots/transactions/tx_id_from_outputref/not_exists.snap b/tests/snapshots/transactions/tx_id_from_outputref/not_exists.snap new file mode 100644 index 0000000..d5e301a --- /dev/null +++ b/tests/snapshots/transactions/tx_id_from_outputref/not_exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - transactions + - tx-id-from-outputref + - "1022114513" + - 5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab46 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Transaction id for output ref 5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab46 not found diff --git a/tests/snapshots/utils/address_zero.snap b/tests/snapshots/utils/address_zero.snap new file mode 100644 index 0000000..9cda69a --- /dev/null +++ b/tests/snapshots/utils/address_zero.snap @@ -0,0 +1,15 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - utils + - address-zero +--- +success: true +exit_code: 0 +----- stdout ----- +111111111111111111111111111111111 + +----- stderr ----- diff --git a/tests/snapshots/utils/convert/bad_param.snap b/tests/snapshots/utils/convert/bad_param.snap new file mode 100644 index 0000000..887c7b9 --- /dev/null +++ b/tests/snapshots/utils/convert/bad_param.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - utils + - convert + - "100" + - foo +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: invalid value 'foo' for '' + [possible values: alph, gatto, atto] + +For more information, try '--help'. diff --git a/tests/snapshots/utils/convert/from_alph.snap b/tests/snapshots/utils/convert/from_alph.snap new file mode 100644 index 0000000..76d10ab --- /dev/null +++ b/tests/snapshots/utils/convert/from_alph.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - utils + - convert + - "1" + - alph +--- +success: true +exit_code: 0 +----- stdout ----- +atto: 1000000000000000000 +gatto: 1000000000 +alph: 1 + +----- stderr ----- diff --git a/tests/snapshots/utils/convert/from_atto.snap b/tests/snapshots/utils/convert/from_atto.snap new file mode 100644 index 0000000..da5c82a --- /dev/null +++ b/tests/snapshots/utils/convert/from_atto.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - utils + - convert + - "1" + - atto +--- +success: true +exit_code: 0 +----- stdout ----- +atto: 1 +gatto: 0.000000001 +alph: 0.000000000000000001 + +----- stderr ----- diff --git a/tests/snapshots/utils/convert/from_gatto.snap b/tests/snapshots/utils/convert/from_gatto.snap new file mode 100644 index 0000000..989ba7f --- /dev/null +++ b/tests/snapshots/utils/convert/from_gatto.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - utils + - convert + - "1" + - gatto +--- +success: true +exit_code: 0 +----- stdout ----- +atto: 1000000000 +gatto: 1 +alph: 0.000000001 + +----- stderr ----- diff --git a/tests/snapshots/utils/convert/missing_param.snap b/tests/snapshots/utils/convert/missing_param.snap new file mode 100644 index 0000000..e6735cf --- /dev/null +++ b/tests/snapshots/utils/convert/missing_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - utils + - convert + - "100" +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit utils convert + +For more information, try '--help'. diff --git a/tests/snapshots/utils/convert/no_params.snap b/tests/snapshots/utils/convert/no_params.snap new file mode 100644 index 0000000..a8ee314 --- /dev/null +++ b/tests/snapshots/utils/convert/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - utils + - convert +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit utils convert + +For more information, try '--help'. diff --git a/tests/snapshots/utils/hash_zero.snap b/tests/snapshots/utils/hash_zero.snap new file mode 100644 index 0000000..a15d2a5 --- /dev/null +++ b/tests/snapshots/utils/hash_zero.snap @@ -0,0 +1,15 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - utils + - hash-zero +--- +success: true +exit_code: 0 +----- stdout ----- +0000000000000000000000000000000000000000000000000000000000000000 + +----- stderr ----- diff --git a/tests/snapshots/wallets/address_info/exists.snap b/tests/snapshots/wallets/address_info/exists.snap new file mode 100644 index 0000000..66fc90c --- /dev/null +++ b/tests/snapshots/wallets/address_info/exists.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - address-info + - wallet + - 1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "address": "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP", + "group": 2, + "path": "m/44'/1234'/0'/0/0", + "publicKey": "038a6fed523a2c907cfb3ed08a8ddb0ed1ae081f8169f0683709892c47f9a70f16" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/address_info/missing_param.snap b/tests/snapshots/wallets/address_info/missing_param.snap new file mode 100644 index 0000000..7e623ae --- /dev/null +++ b/tests/snapshots/wallets/address_info/missing_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - address-info + - wallet +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: +
+ +Usage: kermit wallets address-info
+ +For more information, try '--help'. diff --git a/tests/snapshots/wallets/address_info/no_params.snap b/tests/snapshots/wallets/address_info/no_params.snap new file mode 100644 index 0000000..4a802b4 --- /dev/null +++ b/tests/snapshots/wallets/address_info/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - address-info +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + +
+ +Usage: kermit wallets address-info
+ +For more information, try '--help'. diff --git a/tests/snapshots/wallets/address_info/not_exists.snap b/tests/snapshots/wallets/address_info/not_exists.snap new file mode 100644 index 0000000..9f24f8e --- /dev/null +++ b/tests/snapshots/wallets/address_info/not_exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - address-info + - foo + - 15EvQxuTu5qdgEfPY9555FKv6Ev4cRLxwEJfbm4pcoEm9 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/addresses/exists.snap b/tests/snapshots/wallets/addresses/exists.snap new file mode 100644 index 0000000..e18b7b5 --- /dev/null +++ b/tests/snapshots/wallets/addresses/exists.snap @@ -0,0 +1,26 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - addresses + - wallet +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "activeAddress": "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP", + "addresses": [ + { + "address": "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP", + "group": 2, + "path": "m/44'/1234'/0'/0/0", + "publicKey": "038a6fed523a2c907cfb3ed08a8ddb0ed1ae081f8169f0683709892c47f9a70f16" + } + ] +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/addresses/no_params.snap b/tests/snapshots/wallets/addresses/no_params.snap new file mode 100644 index 0000000..1a0ecef --- /dev/null +++ b/tests/snapshots/wallets/addresses/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - addresses +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets addresses + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/addresses/not_exists.snap b/tests/snapshots/wallets/addresses/not_exists.snap new file mode 100644 index 0000000..610c6b3 --- /dev/null +++ b/tests/snapshots/wallets/addresses/not_exists.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - addresses + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/balances/exists.snap b/tests/snapshots/wallets/balances/exists.snap new file mode 100644 index 0000000..14892f7 --- /dev/null +++ b/tests/snapshots/wallets/balances/exists.snap @@ -0,0 +1,28 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - balances + - wallet +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "balances": [ + { + "address": "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP", + "balance": "0", + "balanceHint": "0 ALPH", + "lockedBalance": "0", + "lockedBalanceHint": "0 ALPH" + } + ], + "totalBalance": "0", + "totalBalanceHint": "0 ALPH" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/balances/no_params.snap b/tests/snapshots/wallets/balances/no_params.snap new file mode 100644 index 0000000..eb21f6e --- /dev/null +++ b/tests/snapshots/wallets/balances/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - balances +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets balances + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/balances/not_exists.snap b/tests/snapshots/wallets/balances/not_exists.snap new file mode 100644 index 0000000..fd3f57d --- /dev/null +++ b/tests/snapshots/wallets/balances/not_exists.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - balances + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/change_active_address/exists.snap b/tests/snapshots/wallets/change_active_address/exists.snap new file mode 100644 index 0000000..832c6b2 --- /dev/null +++ b/tests/snapshots/wallets/change_active_address/exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - change-active-address + - wallet + - 1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/wallets/change_active_address/missing_param.snap b/tests/snapshots/wallets/change_active_address/missing_param.snap new file mode 100644 index 0000000..480e1cb --- /dev/null +++ b/tests/snapshots/wallets/change_active_address/missing_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - change-active-address + - wallet +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: +
+ +Usage: kermit wallets change-active-address
+ +For more information, try '--help'. diff --git a/tests/snapshots/wallets/change_active_address/no_params.snap b/tests/snapshots/wallets/change_active_address/no_params.snap new file mode 100644 index 0000000..0f8b713 --- /dev/null +++ b/tests/snapshots/wallets/change_active_address/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - change-active-address +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + +
+ +Usage: kermit wallets change-active-address
+ +For more information, try '--help'. diff --git a/tests/snapshots/wallets/change_active_address/not_exists.snap b/tests/snapshots/wallets/change_active_address/not_exists.snap new file mode 100644 index 0000000..8cc3201 --- /dev/null +++ b/tests/snapshots/wallets/change_active_address/not_exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - change-active-address + - foo + - 15EvQxuTu5qdgEfPY9555FKv6Ev4cRLxwEJfbm4pcoEm9 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/create/already_exists.snap b/tests/snapshots/wallets/create/already_exists.snap new file mode 100644 index 0000000..89f4ff2 --- /dev/null +++ b/tests/snapshots/wallets/create/already_exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - create + - wallet + - "1234" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Cannot create encrypted file at /alephium-home/.alephium-wallets diff --git a/tests/snapshots/wallets/create/create.snap b/tests/snapshots/wallets/create/create.snap new file mode 100644 index 0000000..90a7efd --- /dev/null +++ b/tests/snapshots/wallets/create/create.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - create + - wallet + - "1234" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "mnemonic": "", + "walletName": "wallet" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/create/create_with_miner.snap b/tests/snapshots/wallets/create/create_with_miner.snap new file mode 100644 index 0000000..a3d5350 --- /dev/null +++ b/tests/snapshots/wallets/create/create_with_miner.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - create + - wallet + - "1234" + - "--is-miner" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "mnemonic": "", + "walletName": "wallet" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/create/missing_param.snap b/tests/snapshots/wallets/create/missing_param.snap new file mode 100644 index 0000000..e949127 --- /dev/null +++ b/tests/snapshots/wallets/create/missing_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - create + - wallet +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets create + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/create/no_params.snap b/tests/snapshots/wallets/create/no_params.snap new file mode 100644 index 0000000..0e2b0f8 --- /dev/null +++ b/tests/snapshots/wallets/create/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - create +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit wallets create + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/delete/exists.snap b/tests/snapshots/wallets/delete/exists.snap new file mode 100644 index 0000000..c35a4b7 --- /dev/null +++ b/tests/snapshots/wallets/delete/exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - delete + - wallet + - "1234" +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/wallets/delete/missing_param.snap b/tests/snapshots/wallets/delete/missing_param.snap new file mode 100644 index 0000000..027fd60 --- /dev/null +++ b/tests/snapshots/wallets/delete/missing_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - delete + - wallet +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets delete + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/delete/no_params.snap b/tests/snapshots/wallets/delete/no_params.snap new file mode 100644 index 0000000..41569b7 --- /dev/null +++ b/tests/snapshots/wallets/delete/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - delete +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit wallets delete + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/delete/not_exists.snap b/tests/snapshots/wallets/delete/not_exists.snap new file mode 100644 index 0000000..f03b49b --- /dev/null +++ b/tests/snapshots/wallets/delete/not_exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - delete + - foo + - "1234" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/derive_next_address/exists.snap b/tests/snapshots/wallets/derive_next_address/exists.snap new file mode 100644 index 0000000..b5f4129 --- /dev/null +++ b/tests/snapshots/wallets/derive_next_address/exists.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - derive-next-address + - wallet +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "address": "15LmMkBiK2QXyWfsbMQB5gSmCXzuJsdwoCBhmrNwDfrQ9", + "group": 3, + "path": "m/44'/1234'/0'/0/1", + "publicKey": "0331d2937ced5de208b4d442406c8e61165545ee4d11ee6091d96653397f3b9987" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/derive_next_address/exists_with_group.snap b/tests/snapshots/wallets/derive_next_address/exists_with_group.snap new file mode 100644 index 0000000..c8deade --- /dev/null +++ b/tests/snapshots/wallets/derive_next_address/exists_with_group.snap @@ -0,0 +1,23 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - derive-next-address + - wallet + - "--group" + - "2" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "address": "18SXMRxnPzRowARbUosxLCgvFLjdNiJCJepKydXGrQjSL", + "group": 2, + "path": "m/44'/1234'/0'/0/3", + "publicKey": "034c9ecc1755b568215bc8dc49e374171f7f06dba7d424c2b99a86b21fdb0592d7" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/derive_next_address/no_params.snap b/tests/snapshots/wallets/derive_next_address/no_params.snap new file mode 100644 index 0000000..23e439d --- /dev/null +++ b/tests/snapshots/wallets/derive_next_address/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - derive-next-address +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets derive-next-address + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/derive_next_address/not_exists.snap b/tests/snapshots/wallets/derive_next_address/not_exists.snap new file mode 100644 index 0000000..8b3976d --- /dev/null +++ b/tests/snapshots/wallets/derive_next_address/not_exists.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - derive-next-address + - foo + - "--group" + - "2" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/derive_next_address/not_exists_with_group.snap b/tests/snapshots/wallets/derive_next_address/not_exists_with_group.snap new file mode 100644 index 0000000..8b3976d --- /dev/null +++ b/tests/snapshots/wallets/derive_next_address/not_exists_with_group.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - derive-next-address + - foo + - "--group" + - "2" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/derive_next_miner_addresses/exists.snap b/tests/snapshots/wallets/derive_next_miner_addresses/exists.snap new file mode 100644 index 0000000..6796c6c --- /dev/null +++ b/tests/snapshots/wallets/derive_next_miner_addresses/exists.snap @@ -0,0 +1,41 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - derive-next-miner-addresses + - wallet +--- +success: true +exit_code: 0 +----- stdout ----- +[ + { + "address": "1CB4nJ4dfWei2NDrAQowhvwmrbinxtp3Z9vsWDBQ6xpTv", + "group": 0, + "path": "m/44'/1234'/0'/0/13", + "publicKey": "0322c22774fede76eca24874ecde20206ed48bf763365bcc571fecb37a3fd69161" + }, + { + "address": "15g5MK4VsX9b5qasgzKGrHEsHzjq2K7cjdiPk69TJsGiS", + "group": 1, + "path": "m/44'/1234'/0'/0/6", + "publicKey": "02b4a131071c66f85f7138d66e7d1a18eaab3eca240abc13f6e473bf9ac16147e5" + }, + { + "address": "18SXMRxnPzRowARbUosxLCgvFLjdNiJCJepKydXGrQjSL", + "group": 2, + "path": "m/44'/1234'/0'/0/3", + "publicKey": "034c9ecc1755b568215bc8dc49e374171f7f06dba7d424c2b99a86b21fdb0592d7" + }, + { + "address": "179Hu6XcSBg6MmxKQoa74bFJZeScRvuYGTtHRbPaVAU9R", + "group": 3, + "path": "m/44'/1234'/0'/0/4", + "publicKey": "02c0deafe824a8d5d0993e7a7ef8f3cb783ba18207000fa486dfaa06621bbc612d" + } +] + +----- stderr ----- diff --git a/tests/snapshots/wallets/derive_next_miner_addresses/no_params.snap b/tests/snapshots/wallets/derive_next_miner_addresses/no_params.snap new file mode 100644 index 0000000..6baa8f6 --- /dev/null +++ b/tests/snapshots/wallets/derive_next_miner_addresses/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - derive-next-miner-addresses +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets derive-next-miner-addresses + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/derive_next_miner_addresses/not_exists.snap b/tests/snapshots/wallets/derive_next_miner_addresses/not_exists.snap new file mode 100644 index 0000000..cadaa54 --- /dev/null +++ b/tests/snapshots/wallets/derive_next_miner_addresses/not_exists.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - derive-next-miner-addresses + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/list.snap b/tests/snapshots/wallets/list.snap new file mode 100644 index 0000000..6cdf2da --- /dev/null +++ b/tests/snapshots/wallets/list.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - list +--- +success: true +exit_code: 0 +----- stdout ----- +[ + { + "locked": false, + "walletName": "wallet" + } +] + +----- stderr ----- diff --git a/tests/snapshots/wallets/lock/exists.snap b/tests/snapshots/wallets/lock/exists.snap new file mode 100644 index 0000000..e63ed94 --- /dev/null +++ b/tests/snapshots/wallets/lock/exists.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - lock + - wallet +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/wallets/lock/no_params.snap b/tests/snapshots/wallets/lock/no_params.snap new file mode 100644 index 0000000..a6c0f87 --- /dev/null +++ b/tests/snapshots/wallets/lock/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - lock +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets lock + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/miner_addresses/exists.snap b/tests/snapshots/wallets/miner_addresses/exists.snap new file mode 100644 index 0000000..8c1b307 --- /dev/null +++ b/tests/snapshots/wallets/miner_addresses/exists.snap @@ -0,0 +1,45 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - miner-addresses + - wallet +--- +success: true +exit_code: 0 +----- stdout ----- +[ + { + "addresses": [ + { + "address": "15DKFiZ1oaVWCDbvQBxv5tPGU9C2Zb62iSPKMYcXXFhjg", + "group": 0, + "path": "m/44'/1234'/0'/0/2", + "publicKey": "02c72862952c0f90802780a6fe56794a5cc0afd2ff266909389814da6e079f6e2c" + }, + { + "address": "1Fx6yWbFSCSKgH3jRthQHKrGLs5A9tvJee84iGuX4civP", + "group": 1, + "path": "m/44'/1234'/0'/0/5", + "publicKey": "0355bb5ebabcb5ccd0bd13919073e78e1cc0a19e0cbb143153777b0a71007d1c65" + }, + { + "address": "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP", + "group": 2, + "path": "m/44'/1234'/0'/0/0", + "publicKey": "038a6fed523a2c907cfb3ed08a8ddb0ed1ae081f8169f0683709892c47f9a70f16" + }, + { + "address": "15LmMkBiK2QXyWfsbMQB5gSmCXzuJsdwoCBhmrNwDfrQ9", + "group": 3, + "path": "m/44'/1234'/0'/0/1", + "publicKey": "0331d2937ced5de208b4d442406c8e61165545ee4d11ee6091d96653397f3b9987" + } + ] + } +] + +----- stderr ----- diff --git a/tests/snapshots/wallets/miner_addresses/no_params.snap b/tests/snapshots/wallets/miner_addresses/no_params.snap new file mode 100644 index 0000000..4d29b32 --- /dev/null +++ b/tests/snapshots/wallets/miner_addresses/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - miner-addresses +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets miner-addresses + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/miner_addresses/not_exists.snap b/tests/snapshots/wallets/miner_addresses/not_exists.snap new file mode 100644 index 0000000..0c04239 --- /dev/null +++ b/tests/snapshots/wallets/miner_addresses/not_exists.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - miner-addresses + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/restore/bad_param.snap b/tests/snapshots/wallets/restore/bad_param.snap new file mode 100644 index 0000000..6190fc5 --- /dev/null +++ b/tests/snapshots/wallets/restore/bad_param.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - restore + - wallet + - "1234" + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: body (Cannot validate mnemonic: foo at index 28: decoding failure) diff --git a/tests/snapshots/wallets/restore/four_params.snap b/tests/snapshots/wallets/restore/four_params.snap new file mode 100644 index 0000000..2400ff5 --- /dev/null +++ b/tests/snapshots/wallets/restore/four_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - restore + - wallet + - "1234" + - history smoke among improve cruise kidney brief jealous carbon office will gallery amateur kit motion ethics attack dignity example huge thought depth funny this + - "--is-miner" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "walletName": "wallet" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/restore/no_params.snap b/tests/snapshots/wallets/restore/no_params.snap new file mode 100644 index 0000000..226dfe5 --- /dev/null +++ b/tests/snapshots/wallets/restore/no_params.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - restore +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + + +Usage: kermit wallets restore + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/restore/one_param.snap b/tests/snapshots/wallets/restore/one_param.snap new file mode 100644 index 0000000..b7b1b93 --- /dev/null +++ b/tests/snapshots/wallets/restore/one_param.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - restore + - wallet +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit wallets restore + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/restore/three_params.snap b/tests/snapshots/wallets/restore/three_params.snap new file mode 100644 index 0000000..8acb10f --- /dev/null +++ b/tests/snapshots/wallets/restore/three_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - restore + - wallet + - "1234" + - vault alarm sad mass witness property virus style good flower rice alpha viable evidence run glare pretty scout evil judge enroll refuse another lava +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "walletName": "wallet" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/restore/two_params.snap b/tests/snapshots/wallets/restore/two_params.snap new file mode 100644 index 0000000..18cc464 --- /dev/null +++ b/tests/snapshots/wallets/restore/two_params.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - restore + - wallet + - "1234" +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets restore + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/reveal_mnemonic/exists.snap b/tests/snapshots/wallets/reveal_mnemonic/exists.snap new file mode 100644 index 0000000..be81d3b --- /dev/null +++ b/tests/snapshots/wallets/reveal_mnemonic/exists.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - reveal-mnemonic + - wallet + - "1234" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "mnemonic": "history smoke among improve cruise kidney brief jealous carbon office will gallery amateur kit motion ethics attack dignity example huge thought depth funny this" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/reveal_mnemonic/missing_param.snap b/tests/snapshots/wallets/reveal_mnemonic/missing_param.snap new file mode 100644 index 0000000..76bf0fb --- /dev/null +++ b/tests/snapshots/wallets/reveal_mnemonic/missing_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - reveal-mnemonic + - wallet +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets reveal-mnemonic + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/reveal_mnemonic/no_params.snap b/tests/snapshots/wallets/reveal_mnemonic/no_params.snap new file mode 100644 index 0000000..5cd7752 --- /dev/null +++ b/tests/snapshots/wallets/reveal_mnemonic/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - reveal-mnemonic +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit wallets reveal-mnemonic + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/reveal_mnemonic/not_exists.snap b/tests/snapshots/wallets/reveal_mnemonic/not_exists.snap new file mode 100644 index 0000000..5aa0ca2 --- /dev/null +++ b/tests/snapshots/wallets/reveal_mnemonic/not_exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - reveal-mnemonic + - foo + - "1234" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/sign/exists.snap b/tests/snapshots/wallets/sign/exists.snap new file mode 100644 index 0000000..c8e4168 --- /dev/null +++ b/tests/snapshots/wallets/sign/exists.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sign + - wallet + - bdaf9dc514ce7d34b6474b8ca10a3dfb93ba997cb9d5ff1ea724ebe2af48abe5 +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "signature": "806a96f93c060562cfd49795e7ea6d6718abca5e01748e326d97b9ee1a8d83465056281cb6d12679e5711a74270684f7cf8c3e49ddb22919baf26963822d70e3" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/sign/missing_param.snap b/tests/snapshots/wallets/sign/missing_param.snap new file mode 100644 index 0000000..9ddf6de --- /dev/null +++ b/tests/snapshots/wallets/sign/missing_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sign + - wallet +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets sign + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/sign/no_params.snap b/tests/snapshots/wallets/sign/no_params.snap new file mode 100644 index 0000000..06c2d38 --- /dev/null +++ b/tests/snapshots/wallets/sign/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sign +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit wallets sign + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/sign/not_exists.snap b/tests/snapshots/wallets/sign/not_exists.snap new file mode 100644 index 0000000..c43974a --- /dev/null +++ b/tests/snapshots/wallets/sign/not_exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sign + - foo + - bdaf9dc514ce7d34b6474b8ca10a3dfb93ba997cb9d5ff1ea724ebe2af48abe5 +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/status/exists.snap b/tests/snapshots/wallets/status/exists.snap new file mode 100644 index 0000000..1076959 --- /dev/null +++ b/tests/snapshots/wallets/status/exists.snap @@ -0,0 +1,19 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - status + - wallet +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "locked": false, + "walletName": "wallet" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/status/no_params.snap b/tests/snapshots/wallets/status/no_params.snap new file mode 100644 index 0000000..effe562 --- /dev/null +++ b/tests/snapshots/wallets/status/no_params.snap @@ -0,0 +1,20 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - status +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets status + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/status/not_exists.snap b/tests/snapshots/wallets/status/not_exists.snap new file mode 100644 index 0000000..c5c8f34 --- /dev/null +++ b/tests/snapshots/wallets/status/not_exists.snap @@ -0,0 +1,16 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - status + - foo +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/sweep_active_address/exists.snap b/tests/snapshots/wallets/sweep_active_address/exists.snap new file mode 100644 index 0000000..ddc913e --- /dev/null +++ b/tests/snapshots/wallets/sweep_active_address/exists.snap @@ -0,0 +1,25 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sweep-active-address + - wallet + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "results": [ + { + "fromGroup": 2, + "toGroup": 0, + "txId": "76777423c638363fffbace407eb80f74f7b4de6c0e9485fe57f47e8655688d20" + } + ] +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/sweep_active_address/missing_param.snap b/tests/snapshots/wallets/sweep_active_address/missing_param.snap new file mode 100644 index 0000000..7c41e3f --- /dev/null +++ b/tests/snapshots/wallets/sweep_active_address/missing_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sweep-active-address + - wallet +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets sweep-active-address + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/sweep_active_address/no_params.snap b/tests/snapshots/wallets/sweep_active_address/no_params.snap new file mode 100644 index 0000000..c3ec95b --- /dev/null +++ b/tests/snapshots/wallets/sweep_active_address/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sweep-active-address +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit wallets sweep-active-address + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/sweep_active_address/not_exists.snap b/tests/snapshots/wallets/sweep_active_address/not_exists.snap new file mode 100644 index 0000000..ca8baf5 --- /dev/null +++ b/tests/snapshots/wallets/sweep_active_address/not_exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sweep-active-address + - foo + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/sweep_all_addresses/exists.snap b/tests/snapshots/wallets/sweep_all_addresses/exists.snap new file mode 100644 index 0000000..665c2ff --- /dev/null +++ b/tests/snapshots/wallets/sweep_all_addresses/exists.snap @@ -0,0 +1,30 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sweep-all-addresses + - wallet + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "results": [ + { + "fromGroup": 3, + "toGroup": 0, + "txId": "a30d68e42287be8d01424644c8199aac31552701b7f9764fdb529d3a4432e948" + }, + { + "fromGroup": 2, + "toGroup": 0, + "txId": "76777423c638363fffbace407eb80f74f7b4de6c0e9485fe57f47e8655688d20" + } + ] +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/sweep_all_addresses/missing_param.snap b/tests/snapshots/wallets/sweep_all_addresses/missing_param.snap new file mode 100644 index 0000000..6d47cd4 --- /dev/null +++ b/tests/snapshots/wallets/sweep_all_addresses/missing_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sweep-all-addresses + - wallet +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets sweep-all-addresses + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/sweep_all_addresses/no_params.snap b/tests/snapshots/wallets/sweep_all_addresses/no_params.snap new file mode 100644 index 0000000..cefeb66 --- /dev/null +++ b/tests/snapshots/wallets/sweep_all_addresses/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sweep-all-addresses +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit wallets sweep-all-addresses + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/sweep_all_addresses/not_exists.snap b/tests/snapshots/wallets/sweep_all_addresses/not_exists.snap new file mode 100644 index 0000000..a5322ec --- /dev/null +++ b/tests/snapshots/wallets/sweep_all_addresses/not_exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - sweep-all-addresses + - foo + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/transfer/bad_address.snap b/tests/snapshots/wallets/transfer/bad_address.snap new file mode 100644 index 0000000..f618207 --- /dev/null +++ b/tests/snapshots/wallets/transfer/bad_address.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - transfer + - wallet + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfM + - "1000000000000000000" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Invalid value for: body (Invalid address 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfM at index 28: decoding failure) diff --git a/tests/snapshots/wallets/transfer/exists.snap b/tests/snapshots/wallets/transfer/exists.snap new file mode 100644 index 0000000..3771281 --- /dev/null +++ b/tests/snapshots/wallets/transfer/exists.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - transfer + - wallet + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH + - "500000000000000000" +--- +success: true +exit_code: 0 +----- stdout ----- +{ + "fromGroup": 2, + "toGroup": 0, + "txId": "3ef8db21e99e5e5c052e1e6308520457c34e016cebccb69e8f5ba9a8dcf041b4" +} + +----- stderr ----- diff --git a/tests/snapshots/wallets/transfer/missing_one_param.snap b/tests/snapshots/wallets/transfer/missing_one_param.snap new file mode 100644 index 0000000..5c2e8ff --- /dev/null +++ b/tests/snapshots/wallets/transfer/missing_one_param.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - transfer + - wallet + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets transfer + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/transfer/missing_two_params.snap b/tests/snapshots/wallets/transfer/missing_two_params.snap new file mode 100644 index 0000000..ee69210 --- /dev/null +++ b/tests/snapshots/wallets/transfer/missing_two_params.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - transfer + - wallet +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit wallets transfer + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/transfer/no_params.snap b/tests/snapshots/wallets/transfer/no_params.snap new file mode 100644 index 0000000..74be2e0 --- /dev/null +++ b/tests/snapshots/wallets/transfer/no_params.snap @@ -0,0 +1,22 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - transfer +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + + +Usage: kermit wallets transfer + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/transfer/not_exists.snap b/tests/snapshots/wallets/transfer/not_exists.snap new file mode 100644 index 0000000..c3f83b2 --- /dev/null +++ b/tests/snapshots/wallets/transfer/not_exists.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - transfer + - foo + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH + - "1000000000000000000" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/snapshots/wallets/transfer/too_small_value.snap b/tests/snapshots/wallets/transfer/too_small_value.snap new file mode 100644 index 0000000..dab0b8d --- /dev/null +++ b/tests/snapshots/wallets/transfer/too_small_value.snap @@ -0,0 +1,18 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - transfer + - wallet + - 1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH + - "100" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: Tx output value is too small, avoid spreading dust diff --git a/tests/snapshots/wallets/unlock/exists.snap b/tests/snapshots/wallets/unlock/exists.snap new file mode 100644 index 0000000..74f21c9 --- /dev/null +++ b/tests/snapshots/wallets/unlock/exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - unlock + - wallet + - "1234" +--- +success: true +exit_code: 0 +----- stdout ----- +Success! + +----- stderr ----- diff --git a/tests/snapshots/wallets/unlock/missing_param.snap b/tests/snapshots/wallets/unlock/missing_param.snap new file mode 100644 index 0000000..b7e03f7 --- /dev/null +++ b/tests/snapshots/wallets/unlock/missing_param.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - unlock + - wallet +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + +Usage: kermit wallets unlock + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/unlock/no_params.snap b/tests/snapshots/wallets/unlock/no_params.snap new file mode 100644 index 0000000..a053a3c --- /dev/null +++ b/tests/snapshots/wallets/unlock/no_params.snap @@ -0,0 +1,21 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - unlock +--- +success: false +exit_code: 2 +----- stdout ----- + +----- stderr ----- +error: the following required arguments were not provided: + + + +Usage: kermit wallets unlock + +For more information, try '--help'. diff --git a/tests/snapshots/wallets/unlock/not_exists.snap b/tests/snapshots/wallets/unlock/not_exists.snap new file mode 100644 index 0000000..d52477f --- /dev/null +++ b/tests/snapshots/wallets/unlock/not_exists.snap @@ -0,0 +1,17 @@ +--- +source: tests/common/perform_cmd.rs +assertion_line: 38 +info: + program: kermit + args: + - wallets + - unlock + - foo + - "1234" +--- +success: false +exit_code: 1 +----- stdout ----- + +----- stderr ----- +Error: foo not found diff --git a/tests/transactions.rs b/tests/transactions.rs new file mode 100644 index 0000000..86400e3 --- /dev/null +++ b/tests/transactions.rs @@ -0,0 +1,744 @@ +mod common; + +mod build { + use crate::{common::setup_node, perform_cmd_test}; + + #[test] + fn test_one_param() { + perform_cmd_test!( + "one_param", + &[ + "transactions", + "build", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106" + ] + ); + } + + #[test] + fn test_two_params() { + perform_cmd_test!( + "two_params", + &[ + "transactions", + "build", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + ] + ); + } + + #[tokio::test] + async fn test_three_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "three_params", + &url, + &[ + "transactions", + "build", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "1000000000000000000" + ] + ); + } + + #[tokio::test] + async fn test_bad_public_key() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_public_key", + &url, + &[ + "transactions", + "build", + "15hLd3PdALjHe9RmFsjpRiMGYrCchZSjdyRufMjyfFSCB", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "1000000000000000000" + ] + ); + } + + #[tokio::test] + async fn test_bad_address() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_address", + &url, + &[ + "transactions", + "build", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P", + "1000000000000000000" + ] + ); + } + + #[tokio::test] + async fn test_too_small_value() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "too_small_value", + &url, + &[ + "transactions", + "build", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "100" + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["transactions", "build"]); + } +} + +mod submit { + use serde_json::{Value, json}; + + use crate::{ + common::{post, setup_node}, + perform_cmd_test, + }; + + #[test] + fn test_one_param() { + perform_cmd_test!( + "one_param", + &[ + "transactions", + "submit", + "a46f5fb14ae87d3d776d5a76823b238e0ddad43d8e6f6f8f40299ba0ec85e230" + ] + ); + } + + #[test] + fn test_two_params() { + perform_cmd_test!( + "two_params", + &[ + "transactions", + "submit", + "a46f5fb14ae87d3d776d5a76823b238e0ddad43d8e6f6f8f40299ba0ec85e230", + "00040080004e20c1174876e80001ccb4a237b769377b8ebe2326104daf6ee211daada428ee5e21c50\ + c8b63be65c1072555980002ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff\ + 8810602c40de0b6b3a764000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a78\ + 5efc9273a00000000000000000000c6d3c1d647b478ec4b00000045c42a82aa01b2b7399c26ee6450d\ + 44f04e017aa3c44af5e6b451f32aa458b1c00000000000000000000" + ] + ); + } + + #[tokio::test] + async fn test_three_params() { + let (_container, url) = setup_node().await; + + let result: Value = post( + &url, + "/transactions/build", + json!({ + "fromPublicKey": "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "destinations": vec![json!({ + "address": "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "attoAlphAmount": "1000000000000000000", + })] + }), + ) + .await.unwrap().unwrap(); + + perform_cmd_test!( + "three_params", + &url, + &[ + "transactions", + "submit", + result["txId"].as_str().unwrap(), + result["unsignedTx"].as_str().unwrap(), + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76" + ] + ); + } + + #[test] + fn test_bad_tx_id() { + perform_cmd_test!( + "bad_tx_id", + &[ + "transactions", + "submit", + "a46f5fb14ae87d3d776d5a76823b238e0ddad43d8e6f6f8f40299ba0ec85", + "00040080004e20c1174876e80001ccb4a237975e960d767ce9b550bc481fe3a883d142bc4454539223a135756a371f5f67720002ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff8810602c40de0b6b3a764000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a785efc9273a00000000000000000000c6d3c20de6fb3cb00f00000045c42a82aa01b2b7399c26ee6450d44f04e017aa3c44af5e6b451f32aa458b1c00000000000000000000", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76" + ] + ); + } + + #[tokio::test] + async fn test_bad_unsigned_tx() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_unsigned_tx", + &url, + &[ + "transactions", + "submit", + "a46f5fb14ae87d3d776d5a76823b238e0ddad43d8e6f6f8f40299ba0ec85e230", + "00040080004e20c1174876e80001ccb4a237b769377b8ebe2326104daf6ee211daada428ee5e21c50\ + c8b63be65c1072555980002ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff\ + 8810602c40de0b6b3a764000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a78\ + 5efc9273a00000000000000000000c6d3c1d647b478ec", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76" + ] + ); + } + + #[test] + fn test_bad_private_key() { + perform_cmd_test!( + "bad_private_key", + &[ + "transactions", + "submit", + "a46f5fb14ae87d3d776d5a76823b238e0ddad43d8e6f6f8f40299ba0ec85e230", + "00040080004e20c1174876e80001ccb4a237b769377b8ebe2326104daf6ee211daada428ee5e21c50\ + c8b63be65c1072555980002ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff\ + 8810602c40de0b6b3a764000000622990ad7be0a3d163562c10fd7985ef40a3e41857e7a1583406a78\ + 5efc9273a00000000000000000000c6d3c1d647b478e", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d" + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["transactions", "submit"]); + } +} + +mod create { + use crate::{common::setup_node, perform_cmd_test}; + + #[test] + fn test_one_param() { + perform_cmd_test!( + "one_param", + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106" + ] + ); + } + + #[test] + fn test_two_params() { + perform_cmd_test!( + "two_params", + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + ] + ); + } + + #[test] + fn test_three_params() { + perform_cmd_test!( + "three_params", + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "1000000000000000000" + ] + ); + } + + #[tokio::test] + async fn test_four_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "four_params", + &url, + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "1000000000000000000", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76" + ] + ); + } + + #[tokio::test] + async fn test_bad_public_key() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_public_key", + &url, + &[ + "transactions", + "create", + "15hLd3PdALjHe9RmFsjpRiMGYrCchZSjdyRufMjyfFSCB", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "1000000000000000000", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76" + ] + ); + } + + #[tokio::test] + async fn test_bad_address() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_address", + &url, + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P", + "1000000000000000000", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76" + ] + ); + } + + #[tokio::test] + async fn test_too_small_value() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "too_small_value", + &url, + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "100", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76" + ] + ); + } + + #[tokio::test] + async fn test_bad_private_key() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_private_key", + &url, + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "17cBiTcWhung3WDLuc9ja5Y7BMus5Q7CD9wYBxS1r1P2R", + "1000000000000000000", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d" + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["transactions", "create"]); + } +} + +mod details { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "exists", + &url, + &[ + "transactions", + "details", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66" + ] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "transactions", + "details", + "b2dcb7c16a2846a857568547b775db5217f243102285b73a7c1852f4495e7a36" + ] + ); + } + + #[tokio::test] + async fn test_exists_with_groups() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "exists_with_groups", + &url, + &[ + "transactions", + "details", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "--from-group", + "3", + "--to-group", + "3" + ] + ); + } + + #[tokio::test] + async fn test_not_exists_with_groups() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists_with_groups", + &url, + &[ + "transactions", + "details", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "--from-group", + "1", + "--to-group", + "1" + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["transactions", "details"]); + } +} + +mod rich_details { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "exists", + &url, + &[ + "transactions", + "rich-details", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66" + ] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "transactions", + "rich-details", + "b2dcb7c16a2846a857568547b775db5217f243102285b73a7c1852f4495e7a36" + ] + ); + } + + #[tokio::test] + async fn test_exists_with_groups() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "exists_with_groups", + &url, + &[ + "transactions", + "rich-details", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "--from-group", + "3", + "--to-group", + "3" + ] + ); + } + + #[tokio::test] + async fn test_not_exists_with_groups() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists_with_groups", + &url, + &[ + "transactions", + "rich-details", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "--from-group", + "1", + "--to-group", + "1" + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["transactions", "rich-details"]); + } +} + +mod raw { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "exists", + &url, + &[ + "transactions", + "raw", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66" + ] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "transactions", + "raw", + "b2dcb7c16a2846a857568547b775db5217f243102285b73a7c1852f4495e7a36" + ] + ); + } + + #[tokio::test] + async fn test_exists_with_groups() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "exists_with_groups", + &url, + &[ + "transactions", + "raw", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "--from-group", + "3", + "--to-group", + "3" + ] + ); + } + + #[tokio::test] + async fn test_not_exists_with_groups() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists_with_groups", + &url, + &[ + "transactions", + "raw", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "--from-group", + "1", + "--to-group", + "1" + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["transactions", "raw"]); + } +} + +mod status { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "exists", + &url, + &[ + "transactions", + "status", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66" + ] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "transactions", + "status", + "b2dcb7c16a2846a857568547b775db5217f243102285b73a7c1852f4495e7a36" + ] + ); + } + + #[tokio::test] + async fn test_exists_with_groups() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "exists_with_groups", + &url, + &[ + "transactions", + "status", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "--from-group", + "3", + "--to-group", + "3" + ] + ); + } + + #[tokio::test] + async fn test_not_exists_with_groups() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists_with_groups", + &url, + &[ + "transactions", + "status", + "482784abee65d18a09f457b8125f045580c12bfc462318b3f98337a8c77d2c66", + "--from-group", + "1", + "--to-group", + "1" + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["transactions", "status"]); + } +} + +mod tx_id_from_outputref { + use crate::{common::setup_node, perform_cmd_test}; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "exists", + &url, + &[ + "transactions", + "tx-id-from-outputref", + "1022114513", + "5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab47" + ] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "transactions", + "tx-id-from-outputref", + "1022114513", + "5d892f71e43b262733eaa99188a14f017fe006188f76cc0cc6ff8a0eb1ebab46" + ] + ); + } + + #[test] + fn test_missing_param() { + perform_cmd_test!( + "missing_param", + &["transactions", "tx-id-from-outputref", "1900212619"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["transactions", "tx-id-from-outputref"]); + } + + #[test] + fn test_bad_param() { + perform_cmd_test!( + "bad_param", + &[ + "transactions", + "tx-id-from-outputref", + "foo", + "91079afe4f5d56d09fab2fa60a9369dcf145eb982aece94bf81d00c537e03231" + ] + ); + } +} diff --git a/tests/utils.rs b/tests/utils.rs index 49d79b5..dd23d01 100644 --- a/tests/utils.rs +++ b/tests/utils.rs @@ -1,20 +1,45 @@ -use std::process::Command; - -use insta::with_settings; -use insta_cmd::{assert_cmd_snapshot, get_cargo_bin}; - -const BIN_NAME: &str = "kermit"; -const FILTERS: [(&str, &str); 1] = [( - r#""cliqueId":\s*"[0-9a-f]+""#, - r#""cliqueId": """#, -)]; - -pub fn perform_cmd_test(name: &str, args: &[&str]) { - with_settings!({ - prepend_module_to_snapshot => false, - snapshot_path => format!("snapshots/{}", module_path!().split("::").next().unwrap()), - filters => FILTERS, - }, { - assert_cmd_snapshot!(name, Command::new(get_cargo_bin(BIN_NAME)).args(args)); - }); +mod common; + +#[test] +fn test_address_zero() { + perform_cmd_test!("address_zero", &["utils", "address-zero"]); +} + +#[test] +fn test_hash_zero() { + perform_cmd_test!("hash_zero", &["utils", "hash-zero"]); +} + +mod convert { + use crate::perform_cmd_test; + + #[test] + fn test_from_atto() { + perform_cmd_test!("from_atto", &["utils", "convert", "1", "atto"]); + } + + #[test] + fn test_from_gatto() { + perform_cmd_test!("from_gatto", &["utils", "convert", "1", "gatto"]); + } + + #[test] + fn test_from_alph() { + perform_cmd_test!("from_alph", &["utils", "convert", "1", "alph"]); + } + + #[test] + fn test_missing_param() { + perform_cmd_test!("missing_param", &["utils", "convert", "100"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["utils", "convert"]); + } + + #[test] + fn test_bad_param() { + perform_cmd_test!("bad_param", &["utils", "convert", "100", "foo"]); + } } diff --git a/tests/wallets.rs b/tests/wallets.rs new file mode 100644 index 0000000..b3208f5 --- /dev/null +++ b/tests/wallets.rs @@ -0,0 +1,1086 @@ +mod common; + +use crate::common::{perform_cmd, setup_node}; + +#[tokio::test] +async fn test_list() { + let (_container, url) = setup_node().await; + + perform_cmd(&url, &["wallets", "create", "wallet", "1234"]).unwrap(); + perform_cmd_test!("list", &url, &["wallets", "list"]); +} + +mod restore { + use crate::{common::setup_node, perform_cmd_test}; + + #[test] + fn test_one_param() { + perform_cmd_test!("one_param", &["wallets", "restore", "wallet"]); + } + + #[test] + fn test_two_params() { + perform_cmd_test!("two_params", &["wallets", "restore", "wallet", "1234"]); + } + + #[tokio::test] + async fn test_three_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "three_params", + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this" + ] + ); + } + + #[tokio::test] + async fn test_four_params() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "four_params", + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + "--is-miner", + ] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "restore"]); + } + + #[tokio::test] + async fn test_bad_param() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "bad_param", + &url, + &["wallets", "restore", "wallet", "1234", "foo"] + ); + } +} + +mod create { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_create() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "create", + &url, + &["wallets", "create", "wallet", "1234"], + &[( + r#"mnemonic":\s*"(?:[a-z]+(?: [a-z]+){23})"#, + r#"mnemonic": ""# + )] + ); + } + + #[tokio::test] + async fn test_create_with_miner() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "create_with_miner", + &url, + &["wallets", "create", "wallet", "1234", "--is-miner"], + &[( + r#"mnemonic":\s*"(?:[a-z]+(?: [a-z]+){23})"#, + r#"mnemonic": ""# + )] + ); + } + + #[tokio::test] + async fn test_already_exists() { + let (_container, url) = setup_node().await; + + perform_cmd(&url, &["wallets", "create", "wallet", "1234"]).unwrap(); + perform_cmd_test!( + "already_exists", + &url, + &["wallets", "create", "wallet", "1234"] + ); + } + + #[test] + fn test_missing_param() { + perform_cmd_test!("missing_param", &["wallets", "create", "wallet"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "create"]); + } +} + +mod status { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd(&url, &["wallets", "create", "wallet", "1234"]).unwrap(); + perform_cmd_test!("exists", &url, &["wallets", "status", "wallet"]); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("not_exists", &url, &["wallets", "status", "foo"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "status"]); + } +} + +mod delete { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd(&url, &["wallets", "create", "wallet", "1234"]).unwrap(); + perform_cmd_test!("exists", &url, &["wallets", "delete", "wallet", "1234"]); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("not_exists", &url, &["wallets", "delete", "foo", "1234"]); + } + + #[test] + fn test_missing_param() { + perform_cmd_test!("missing_param", &["wallets", "delete", "wallet"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "delete"]); + } +} + +mod lock { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_one_param() { + let (_container, url) = setup_node().await; + + perform_cmd(&url, &["wallets", "create", "wallet", "1234"]).unwrap(); + perform_cmd_test!("exists", &url, &["wallets", "lock", "wallet"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "lock"]); + } +} + +mod unlock { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd(&url, &["wallets", "create", "wallet", "1234"]).unwrap(); + perform_cmd(&url, &["wallets", "lock", "wallet"]).unwrap(); + perform_cmd_test!("exists", &url, &["wallets", "unlock", "wallet", "1234"]); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("not_exists", &url, &["wallets", "unlock", "foo", "1234"]); + } + + #[test] + fn test_missing_param() { + perform_cmd_test!("missing_param", &["wallets", "unlock", "wallet"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "unlock"]); + } +} + +mod balances { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd_test!("exists", &url, &["wallets", "balances", "wallet"]); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("not_exists", &url, &["wallets", "balances", "foo"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "balances"]); + } +} + +mod reveal_mnemonic { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd_test!( + "exists", + &url, + &["wallets", "reveal-mnemonic", "wallet", "1234"] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &["wallets", "reveal-mnemonic", "foo", "1234"] + ); + } + + #[test] + fn test_missing_param() { + perform_cmd_test!("missing_param", &["wallets", "reveal-mnemonic", "wallet"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "reveal-mnemonic"]); + } +} + +mod transfer { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd( + &url, + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP", + "1000000000000000000", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76", + ], + ) + .unwrap(); + perform_cmd_test!( + "exists", + &url, + &[ + "wallets", + "transfer", + "wallet", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH", + "500000000000000000" + ] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "wallets", + "transfer", + "foo", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH", + "1000000000000000000" + ] + ); + } + + #[tokio::test] + async fn test_bad_address() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd( + &url, + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP", + "1000000000000000000", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76", + ], + ) + .unwrap(); + perform_cmd_test!( + "bad_address", + &url, + &[ + "wallets", + "transfer", + "wallet", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfM", + "1000000000000000000" + ] + ); + } + + #[tokio::test] + async fn test_too_small_value() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd( + &url, + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP", + "1000000000000000000", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76", + ], + ) + .unwrap(); + perform_cmd_test!( + "too_small_value", + &url, + &[ + "wallets", + "transfer", + "wallet", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH", + "100" + ] + ); + } + + #[test] + fn test_missing_one_param() { + perform_cmd_test!( + "missing_one_param", + &[ + "wallets", + "transfer", + "wallet", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH" + ] + ); + } + + #[test] + fn test_missing_two_params() { + perform_cmd_test!("missing_two_params", &["wallets", "transfer", "wallet"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "transfer"]); + } +} + +mod sweep_active_address { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd( + &url, + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP", + "1000000000000000000", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76", + ], + ) + .unwrap(); + perform_cmd_test!( + "exists", + &url, + &[ + "wallets", + "sweep-active-address", + "wallet", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH" + ] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "wallets", + "sweep-active-address", + "foo", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH" + ] + ); + } + + #[test] + fn test_missing_param() { + perform_cmd_test!( + "missing_param", + &["wallets", "sweep-active-address", "wallet"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "sweep-active-address"]); + } +} + +mod sweep_all_addresses { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd(&url, &["wallets", "derive-next-address", "wallet"]).unwrap(); + perform_cmd( + &url, + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP", + "1000000000000000000", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76", + ], + ) + .unwrap(); + perform_cmd( + &url, + &[ + "transactions", + "create", + "02ff46d897b529927bd1006cf75fb9e005d4f47181ec37db9dc82548218ff88106", + "15LmMkBiK2QXyWfsbMQB5gSmCXzuJsdwoCBhmrNwDfrQ9", + "1000000000000000000", + "--private-key", + "609abeb3455aef1b832da331d168e13dd8f565f6c053e6f00cbd15e50e0d6b76", + ], + ) + .unwrap(); + perform_cmd_test!( + "exists", + &url, + &[ + "wallets", + "sweep-all-addresses", + "wallet", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH" + ] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "wallets", + "sweep-all-addresses", + "foo", + "1DrDyTr9RpRsQnDnXo2YRiPzPW4ooHX5LLoqXrqfMrpQH" + ] + ); + } + + #[test] + fn test_missing_param() { + perform_cmd_test!( + "missing_param", + &["wallets", "sweep-all-addresses", "wallet"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "sweep-all-addresses"]); + } +} + +mod sign { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd_test!( + "exists", + &url, + &[ + "wallets", + "sign", + "wallet", + "bdaf9dc514ce7d34b6474b8ca10a3dfb93ba997cb9d5ff1ea724ebe2af48abe5" + ] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "wallets", + "sign", + "foo", + "bdaf9dc514ce7d34b6474b8ca10a3dfb93ba997cb9d5ff1ea724ebe2af48abe5" + ] + ); + } + + #[test] + fn test_missing_param() { + perform_cmd_test!("missing_param", &["wallets", "sign", "wallet"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "sign"]); + } +} + +mod addresses { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd_test!("exists", &url, &["wallets", "addresses", "wallet"]); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("not_exists", &url, &["wallets", "addresses", "foo"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "addresses"]); + } +} + +mod address_info { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd_test!( + "exists", + &url, + &[ + "wallets", + "address-info", + "wallet", + "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP" + ] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "wallets", + "address-info", + "foo", + "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP" + ] + ); + } + + #[test] + fn test_missing_param() { + perform_cmd_test!("missing_param", &["wallets", "address-info", "wallet"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "address-info"]); + } +} + +mod derive_next_address { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd_test!( + "exists", + &url, + &["wallets", "derive-next-address", "wallet"] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &["wallets", "derive-next-address", "foo"] + ); + } + + #[tokio::test] + async fn test_exists_with_group() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd_test!( + "exists_with_group", + &url, + &["wallets", "derive-next-address", "wallet", "--group", "2"] + ); + } + + #[tokio::test] + async fn test_not_exists_with_group() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists_with_group", + &url, + &["wallets", "derive-next-address", "foo", "--group", "2"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "derive-next-address"]); + } +} + +mod change_active_address { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + ], + ) + .unwrap(); + perform_cmd_test!( + "exists", + &url, + &[ + "wallets", + "change-active-address", + "wallet", + "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP" + ] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &[ + "wallets", + "change-active-address", + "foo", + "1F8hPMrEHKhKqpScWJjeJGiQSaBJE6VnqEBAHb5rVFfoP" + ] + ); + } + + #[test] + fn test_missing_param() { + perform_cmd_test!( + "missing_param", + &["wallets", "change-active-address", "wallet"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "change-active-address"]); + } +} + +mod miner_addresses { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + "--is-miner", + ], + ) + .unwrap(); + perform_cmd_test!("exists", &url, &["wallets", "miner-addresses", "wallet"]); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!("not_exists", &url, &["wallets", "miner-addresses", "foo"]); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "miner-addresses"]); + } +} + +mod derive_next_miner_addresses { + use crate::{ + common::{perform_cmd, setup_node}, + perform_cmd_test, + }; + + #[tokio::test] + async fn test_exists() { + let (_container, url) = setup_node().await; + + perform_cmd( + &url, + &[ + "wallets", + "restore", + "wallet", + "1234", + "history smoke among improve cruise kidney brief jealous carbon office will \ + gallery amateur kit motion ethics attack dignity example huge thought depth \ + funny this", + "--is-miner", + ], + ) + .unwrap(); + perform_cmd_test!( + "exists", + &url, + &["wallets", "derive-next-miner-addresses", "wallet"] + ); + } + + #[tokio::test] + async fn test_not_exists() { + let (_container, url) = setup_node().await; + + perform_cmd_test!( + "not_exists", + &url, + &["wallets", "derive-next-miner-addresses", "foo"] + ); + } + + #[test] + fn test_no_params() { + perform_cmd_test!("no_params", &["wallets", "derive-next-miner-addresses"]); + } +}