From a13e73aa0b7d86ae69d5dffb67d83ba7d639fbdd Mon Sep 17 00:00:00 2001 From: Liu Chuankai Date: Fri, 30 Dec 2022 20:05:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Update=20depencency?= =?UTF-8?q?=20CKB=20to=20v0.106.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 15 ++ Cargo.lock | 364 +++++++++++++++++++------------------ Cargo.toml | 28 +-- ckb-signer/Cargo.toml | 10 +- plugin-protocol/Cargo.toml | 6 +- test/Cargo.toml | 10 +- 6 files changed, 230 insertions(+), 203 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9bb599c..f95897a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# v1.4.0 +* Update ckb deps from `v0.105.1` to `v0.106.0` +* Update deps + - ckb-sdk to `v2.4.0` + - secp256k1 to `v0.25.0` + +# v1.3.0 +* Add deploy subcommand, this is a more advanced version of `capsule deploy` #515 + - more resonable CKB transaction structure + - support `multisig` lock +* Add `--max-tx-fee` argument to subcommands, so that you can transfer all your CKB to another address more easy #517 + - `wallet transfer` + - `sudt` + - `dao` + # v1.2.0 * Update ckb deps from `v0.104.0` to `v0.105.1` * Update deps diff --git a/Cargo.lock b/Cargo.lock index 22197ca8..335c24a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,9 +53,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] @@ -80,9 +80,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" [[package]] name = "arrayref" @@ -102,7 +102,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi 0.3.9", ] @@ -293,9 +293,9 @@ dependencies = [ [[package]] name = "bytes" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" dependencies = [ "serde", ] @@ -308,9 +308,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" [[package]] name = "cc" -version = "1.0.76" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" [[package]] name = "cfg-if" @@ -354,11 +354,17 @@ version = "0.105.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b27119a63dc1d5deb00ae3a44e4431dd2a0a65ca3283ef2b5e86306d347412fc" +[[package]] +name = "ckb-build-info" +version = "0.106.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875484aae077e761089a7f707590f1ee9ed31e4bb8a330f93c822d2f4f40644b" + [[package]] name = "ckb-chain-spec" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0f0606bce9ccbde520465890486807a0ac2fcba3e60d37df54a2d0be071725" +checksum = "fccca15bb20b37f213bda1ff673fc25af8ee2e97f506ffc70de296d068034d63" dependencies = [ "ckb-constant", "ckb-crypto", @@ -378,16 +384,16 @@ dependencies = [ [[package]] name = "ckb-channel" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0da1f4e474de48b05e30ad603da4da3b410344b619c7cf35d444e406c0bb6e" +checksum = "5e718dfa7098b0bcce95c7fa573d96aad2f4c3ac886b6f35053f40c5e4894156" dependencies = [ "crossbeam-channel", ] [[package]] name = "ckb-cli" -version = "1.3.0" +version = "1.4.0" dependencies = [ "ansi_term", "anyhow", @@ -395,7 +401,8 @@ dependencies = [ "bitcoin", "byteorder", "chrono", - "ckb-build-info", + "ckb-build-info 0.105.1", + "ckb-build-info 0.106.0", "ckb-chain-spec", "ckb-cli-plugin-protocol", "ckb-crypto", @@ -450,7 +457,7 @@ dependencies = [ [[package]] name = "ckb-cli-plugin-protocol" -version = "1.2.0" +version = "1.3.0" dependencies = [ "ckb-jsonrpc-types", "ckb-types", @@ -462,15 +469,15 @@ dependencies = [ [[package]] name = "ckb-constant" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6df9fd997d58f1e5f12a683a00d98158a82c07a422e6f81ff390607f19c493" +checksum = "5ddc317ee0521b2a176f7197bd1922ee5e757b1c454150cf392baec49c8f31f4" [[package]] name = "ckb-crypto" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1650275e0f5a59e8ebbd747d835e10b9179d8ab4941b96100d5b7e48fada695e" +checksum = "105a3a011f3d29070d137ea1336d8761951281b39cb90db07b5b752c741b1d0f" dependencies = [ "ckb-fixed-hash", "faster-hex", @@ -482,9 +489,9 @@ dependencies = [ [[package]] name = "ckb-dao-utils" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b294c46e06c315900c9eb4e5719311902d68fcad6c802f43ebc658902715b5ea" +checksum = "970872ecd2bfe4072051b020b78061c97dfc07e2e8797e73e7b17c238891b91e" dependencies = [ "byteorder", "ckb-error", @@ -493,9 +500,9 @@ dependencies = [ [[package]] name = "ckb-error" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51748ac5e08dce6c685cf4b43e27dcbcfc98e21442c4001c9f06509a04a400ed" +checksum = "fd512b729186e6fa991b588647646e230db7728f71ba16087af21bded12ceb09" dependencies = [ "anyhow", "ckb-occupied-capacity", @@ -505,9 +512,9 @@ dependencies = [ [[package]] name = "ckb-fixed-hash" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d665013dbb8ff2df8e67c4add67db703ae3b642679f1a2962f76399703eee1" +checksum = "8eba8f7006a63ad0945412012c89af6ad09d9b2b02962a869d0158a298fa8eca" dependencies = [ "ckb-fixed-hash-core", "ckb-fixed-hash-macros", @@ -515,9 +522,9 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-core" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd92b9d691bbfd11a900ee17ad1010a553ae0b5d3a120e0c8094afcd30f9b15e" +checksum = "44b15b464d37d8deeb66046011b3e01e642103b27d4752db4e74740ded732c73" dependencies = [ "faster-hex", "serde", @@ -526,9 +533,9 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-macros" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f24e42b82da4d891ac8b5b19de2807cae360c5377138a7cde377b60edc6ec953" +checksum = "61e86358f6eb595a0e6a2a5ef96d54d4c56e0a4bf822934d7b1fe9904b7208e4" dependencies = [ "ckb-fixed-hash-core", "proc-macro2", @@ -538,9 +545,9 @@ dependencies = [ [[package]] name = "ckb-hash" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6b64eff869839aff45741515540e81a0447926d79262a439b5e9d0a5c98ac95" +checksum = "038ad6840c4a89f4cd76b50621c4e6d82ca5f0d09fba707b1025016218d4a2d8" dependencies = [ "blake2b-ref", "blake2b-rs", @@ -548,9 +555,9 @@ dependencies = [ [[package]] name = "ckb-jsonrpc-types" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82268ddea09f95324496d6def1b37d6bdc3a4841fecc185388e7a2bb6451687f" +checksum = "eca123e0b725e487cd49f202097c38c73c2a4d7e1c80d89549c492f058e84f29" dependencies = [ "ckb-types", "faster-hex", @@ -560,9 +567,9 @@ dependencies = [ [[package]] name = "ckb-logger" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a312280df7ba55dc99cf8584ac4d3c9e3b85297a896202c76a21dfd43ffb0ea" +checksum = "fe1d406dd67f086bb64d17af697a4d42c3d7d85e2a677bfd8c04aea4b48510cf" dependencies = [ "log", ] @@ -578,9 +585,9 @@ dependencies = [ [[package]] name = "ckb-mock-tx-types" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c73574949df81ecd84b5366992f1ab61d2a4e8dc905dabb58468b785fa90b22d" +checksum = "67ac724a6c26076ea122129ed8428730e212a2166cbbe149e1b3112a88798401" dependencies = [ "ckb-jsonrpc-types", "ckb-traits", @@ -591,9 +598,9 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a11e010c034a98b734074a79655c738c40501e9113426173132856a35c6e71c6" +checksum = "94f6c146d51b1b7f65511e6f16ef21b0d852aececc4ae87f78c3099c03e246a9" dependencies = [ "ckb-occupied-capacity-core", "ckb-occupied-capacity-macros", @@ -601,18 +608,18 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity-core" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e48f0306a3fe072711e0342b71335898ac6d0a82b897ca3ae13e43770ce0e0" +checksum = "507187824418c845b519c64521b34578570b5851d170ff0101bc477ed0cdee2b" dependencies = [ "serde", ] [[package]] name = "ckb-occupied-capacity-macros" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "656db5615c791b8d7b31a38e024f98fb497be5e2cb120b38be48eb4d9d1d0f6d" +checksum = "17825cb1ec37c5ad2f2c6690aa4cbfeb9a6d2af02463a66b1fa013e4f9e762aa" dependencies = [ "ckb-occupied-capacity-core", "quote", @@ -621,9 +628,9 @@ dependencies = [ [[package]] name = "ckb-pow" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9708f81c8c9058bf3dab834be2be68d14dcd9fa41bd793727428a2cf6b1ddf59" +checksum = "a3ea66fa0ac3dc84cada2d2696903afb28dbea1211d05f04b0ed444874ee8623" dependencies = [ "byteorder", "ckb-hash", @@ -635,9 +642,9 @@ dependencies = [ [[package]] name = "ckb-rational" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444926bc5a9ad789b2b98e75f90330bcfe741bab517ca45d8f084449fe35efd8" +checksum = "fa5edf5377138c9457015a450b1a263996d100a5b6e21566157f410e1a5b95b3" dependencies = [ "numext-fixed-uint", "serde", @@ -645,9 +652,9 @@ dependencies = [ [[package]] name = "ckb-resource" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95464c0e69e20553f34c132789f6275a1e06468362226cf5a986719f6da96161" +checksum = "06cd89bd6c5bafeadc363cf0a479516355f16bd5758af4d7dace464d8756892b" dependencies = [ "ckb-system-scripts", "ckb-types", @@ -660,9 +667,9 @@ dependencies = [ [[package]] name = "ckb-script" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f06c44207d8e90b86f2b29f2341188a6d1a3520f6b657eb2ba662b3a772abfc" +checksum = "b9da7feb35e8997b29f1c987d441a89fb13ba8e429b64e09e1d35dff7b9290a8" dependencies = [ "byteorder", "ckb-chain-spec", @@ -678,19 +685,20 @@ dependencies = [ [[package]] name = "ckb-sdk" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1670b9952a097df45413039bd70a52857aa0b6ae8a7c62f6197eb9932f67c565" +checksum = "cdc90b8f90cc7b15956279677e739da314fded65f133485e6d86dedf3439448d" dependencies = [ "anyhow", "bech32 0.8.1", "bitflags", - "bytes 1.2.1", + "bytes 1.3.0", "ckb-crypto", "ckb-dao-utils", "ckb-hash", "ckb-jsonrpc-types", "ckb-resource", + "ckb-script", "ckb-traits", "ckb-types", "dashmap", @@ -715,7 +723,7 @@ dependencies = [ [[package]] name = "ckb-signer" -version = "0.3.1" +version = "0.4.0" dependencies = [ "aes-ctr", "anyhow", @@ -751,21 +759,21 @@ dependencies = [ [[package]] name = "ckb-traits" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d54a03a03af9857264cc252060f4274e11858956a4985793b04047117828329" +checksum = "4697c0acbf62b2994f1c26868cfc005e0ec4fc506849acfb9dc52f10af2a6df2" dependencies = [ "ckb-types", ] [[package]] name = "ckb-types" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f06812497491fa58cea1c93dda2de074e0c5d51cf7d70d93dd50c862c661494c" +checksum = "8f9f918d7f04fed733c528ec98ba8bdee31a885bd082e6ff263ca21d58e01378" dependencies = [ "bit-vec", - "bytes 1.2.1", + "bytes 1.3.0", "ckb-channel", "ckb-error", "ckb-fixed-hash", @@ -782,9 +790,9 @@ dependencies = [ [[package]] name = "ckb-util" -version = "0.105.1" +version = "0.106.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0f4f5647372cc1c2fdc7122e062984754e062edbcc654436a1af7f5b1382a0" +checksum = "d60a55b4ad918828bdbf700f1b9949d74768b710c927e19f15282a2320a7ec71" dependencies = [ "linked-hash-map", "once_cell", @@ -794,14 +802,14 @@ dependencies = [ [[package]] name = "ckb-vm" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1126bf0240d100234bc06efa7020f0d50ca35fe90e5ac7cac1b7721e1bacb7" +checksum = "d8e8f7ba49aa55d08f8a575b69bc535cad65fdba75fea90856cee1fd3822a7a9" dependencies = [ "byteorder", - "bytes 1.2.1", + "bytes 1.3.0", "cc", - "ckb-vm-definitions 0.22.0", + "ckb-vm-definitions 0.22.1", "derive_more", "goblin 0.2.3", "goblin 0.4.0", @@ -818,9 +826,9 @@ checksum = "7968c559498b68833791364e87182fdd1a3aba803e8a16c34b1aa45fc08add1c" [[package]] name = "ckb-vm-definitions" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14739bf59648c169de9257ec7dd6aba1aeb6a41725d636005f1c91853df58fcc" +checksum = "5445b62604e7ab2bf5abb37bf6cca7ac26b2e4a76fddb27ceb61850f24864d58" [[package]] name = "clap" @@ -895,16 +903,15 @@ dependencies = [ [[package]] name = "console" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c" +checksum = "5556015fe3aad8b968e5d4124980fbe2f6aaee7aeec6b749de1faaa2ca5d0a4c" dependencies = [ "encode_unicode", "lazy_static", "libc", - "terminal_size", "unicode-width", - "winapi 0.3.9", + "windows-sys 0.42.0", ] [[package]] @@ -965,9 +972,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if 1.0.0", ] @@ -1009,12 +1016,12 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.2.3" +version = "3.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d91974fbbe88ec1df0c24a4f00f99583667a7e2e6272b2b92d294d81e462173" +checksum = "1631ca6e3c59112501a9d87fd86f21591ff77acd31331e8a73f8d80a65bbdd71" dependencies = [ - "nix 0.25.0", - "winapi 0.3.9", + "nix 0.26.1", + "windows-sys 0.42.0", ] [[package]] @@ -1025,9 +1032,9 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" [[package]] name = "cxx" -version = "1.0.82" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" +checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" dependencies = [ "cc", "cxxbridge-flags", @@ -1037,9 +1044,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.82" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" +checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" dependencies = [ "cc", "codespan-reporting", @@ -1052,15 +1059,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.82" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" +checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" [[package]] name = "cxxbridge-macro" -version = "1.0.82" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" +checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" dependencies = [ "proc-macro2", "quote", @@ -1077,14 +1084,14 @@ dependencies = [ "hashbrown", "lock_api", "once_cell", - "parking_lot_core 0.9.4", + "parking_lot_core 0.9.5", ] [[package]] name = "data-encoding" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" +checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" [[package]] name = "derive_more" @@ -1237,9 +1244,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", "miniz_oxide", @@ -1470,7 +1477,7 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ - "bytes 1.2.1", + "bytes 1.3.0", "fnv", "futures-core", "futures-sink", @@ -1516,6 +1523,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hmac" version = "0.7.1" @@ -1532,7 +1548,7 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ - "bytes 1.2.1", + "bytes 1.3.0", "fnv", "itoa", ] @@ -1543,7 +1559,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "bytes 1.2.1", + "bytes 1.3.0", "http", "pin-project-lite", ] @@ -1575,7 +1591,7 @@ version = "0.14.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" dependencies = [ - "bytes 1.2.1", + "bytes 1.3.0", "futures-channel", "futures-core", "futures-util", @@ -1599,7 +1615,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.2.1", + "bytes 1.3.0", "hyper", "native-tls", "tokio", @@ -1702,9 +1718,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" +checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" [[package]] name = "ipnetwork" @@ -1726,9 +1742,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "js-sys" @@ -1829,7 +1845,7 @@ version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa4fdea130485b572c39a460d50888beb00afb3e35de23ccd7fad8ff19f0e0d4" dependencies = [ - "bytes 1.2.1", + "bytes 1.3.0", "futures 0.3.25", "globset", "jsonrpc-core", @@ -1868,15 +1884,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.137" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] @@ -1947,9 +1963,9 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] @@ -1972,7 +1988,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edc8276c02a006bddad7d1c28c1a88f30421e1b5f0ba0ca96ceb8077c7d20c01" dependencies = [ - "bytes 1.2.1", + "bytes 1.3.0", "cfg-if 1.0.0", "faster-hex", ] @@ -2029,14 +2045,14 @@ dependencies = [ [[package]] name = "nix" -version = "0.25.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb" +checksum = "46a58d1d356c6597d08cde02c2f09d785b09e28711837b1ed667dc652c08a694" dependencies = [ - "autocfg 1.1.0", "bitflags", "cfg-if 1.0.0", "libc", + "static_assertions", ] [[package]] @@ -2060,11 +2076,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] @@ -2122,9 +2138,9 @@ checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "once_cell" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "opaque-debug" @@ -2140,9 +2156,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.42" +version = "0.10.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -2172,9 +2188,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.77" +version = "0.9.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" dependencies = [ "autocfg 1.1.0", "cc", @@ -2229,7 +2245,7 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", ] [[package]] @@ -2239,14 +2255,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.4", + "parking_lot_core 0.9.5", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if 1.0.0", "instant", @@ -2258,9 +2274,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" dependencies = [ "cfg-if 1.0.0", "libc", @@ -2394,9 +2410,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] @@ -2409,9 +2425,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ "proc-macro2", ] @@ -2684,7 +2700,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ "base64 0.13.1", - "bytes 1.2.1", + "bytes 1.3.0", "encoding_rs", "futures-core", "futures-util", @@ -2781,9 +2797,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "safemem" @@ -2818,9 +2834,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "scroll" @@ -2860,9 +2876,9 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff55dc09d460954e9ef2fa8a7ced735a964be9981fd50e870b2b3b0705e14964" +checksum = "d9512ffd81e3a3503ed401f79c33168b9148c75038956039166cd750eaa037c3" dependencies = [ "bitcoin_hashes", "secp256k1-sys", @@ -2902,24 +2918,24 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" [[package]] name = "serde" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", @@ -2928,9 +2944,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.88" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ "itoa", "ryu", @@ -3056,6 +3072,12 @@ dependencies = [ "cfg-if 0.1.10", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.10.0" @@ -3070,9 +3092,9 @@ checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" [[package]] name = "syn" -version = "1.0.103" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -3102,16 +3124,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "terminal_size" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" -dependencies = [ - "libc", - "winapi 0.3.9", -] - [[package]] name = "termion" version = "1.5.6" @@ -3135,18 +3147,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -3155,9 +3167,9 @@ dependencies = [ [[package]] name = "time" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", @@ -3190,19 +3202,19 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.22.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" +checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" dependencies = [ "autocfg 1.1.0", - "bytes 1.2.1", + "bytes 1.3.0", "libc", "memchr", "mio", "num_cpus", "pin-project-lite", "socket2", - "winapi 0.3.9", + "windows-sys 0.42.0", ] [[package]] @@ -3232,7 +3244,7 @@ version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" dependencies = [ - "bytes 1.2.1", + "bytes 1.3.0", "futures-core", "futures-sink", "log", @@ -3246,7 +3258,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ - "bytes 1.2.1", + "bytes 1.3.0", "futures-core", "futures-sink", "pin-project-lite", @@ -3256,9 +3268,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ "serde", ] @@ -3313,9 +3325,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "unicase" @@ -3334,9 +3346,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-normalization" diff --git a/Cargo.toml b/Cargo.toml index af6f7c2d..b8368c26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,25 +1,25 @@ [package] name = "ckb-cli" -version = "1.3.0" +version = "1.4.0" license = "MIT" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2021" description = "ckb command line interface" [dependencies] -ckb-jsonrpc-types = "=0.105.1" -ckb-hash = "=0.105.1" -ckb-crypto = { version = "=0.105.1", features = ["secp"] } -ckb-build-info = "=0.105.1" -ckb-types = "=0.105.1" -ckb-util = "=0.105.1" -ckb-error = "=0.105.1" -ckb-script = "=0.105.1" -ckb-chain-spec = "=0.105.1" -ckb-mock-tx-types = "0.105.1" -ckb-sdk = "2.3.0" -ckb-signer = { path = "ckb-signer", version = "0.3.1" } -plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol", version = "=1.2.0" } +ckb-jsonrpc-types = "=0.106.0" +ckb-hash = "=0.106.0" +ckb-crypto = { version = "=0.106.0", features = ["secp"] } +ckb-build-info = "=0.106.0" +ckb-types = "=0.106.0" +ckb-util = "=0.106.0" +ckb-error = "=0.106.0" +ckb-script = "=0.106.0" +ckb-chain-spec = "=0.106.0" +ckb-mock-tx-types = "=0.106.0" +ckb-sdk = "2.4.0" +ckb-signer = { path = "ckb-signer", version = "0.4.0" } +plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol", version = "=1.3.0" } jsonrpc-core-client = "18" jsonrpc-core = "18" jsonrpc-derive = "18" diff --git a/ckb-signer/Cargo.toml b/ckb-signer/Cargo.toml index 53f574a4..6dc1d893 100644 --- a/ckb-signer/Cargo.toml +++ b/ckb-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-signer" -version = "0.3.1" +version = "0.4.0" edition = "2021" license = "MIT" description = "Signer SDK for Nervos CKB" @@ -24,7 +24,7 @@ thiserror = "1.0.30" parking_lot = "0.11" anyhow = "1.0.63" -ckb-types = "=0.105.1" -ckb-hash = "=0.105.1" -ckb-crypto = { version = "=0.105.1", features = ["secp"] } -ckb-sdk = "2.3.0" +ckb-types = "=0.106.0" +ckb-hash = "=0.106.0" +ckb-crypto = { version = "=0.106.0", features = ["secp"] } +ckb-sdk = "2.4.0" diff --git a/plugin-protocol/Cargo.toml b/plugin-protocol/Cargo.toml index e0331925..5e108351 100644 --- a/plugin-protocol/Cargo.toml +++ b/plugin-protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-cli-plugin-protocol" -version = "1.2.0" +version = "1.3.0" authors = ["Nervos Core Dev "] edition = "2021" license = "MIT" @@ -9,8 +9,8 @@ description = "ckb-cli plugin protocol" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ckb-types = "=0.105.1" -ckb-jsonrpc-types = "=0.105.1" +ckb-types = "=0.106.0" +ckb-jsonrpc-types = "=0.106.0" serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" serde_json = "1.0" diff --git a/test/Cargo.toml b/test/Cargo.toml index c4cf9636..a0d4682f 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -14,12 +14,12 @@ log = "0.4" env_logger = "0.6" toml = "0.5.0" serde_yaml = "0.8.9" -ckb-sdk = "2.3.0" +ckb-sdk = "2.4.0" serde_json = "1.0" -ckb-types = "=0.105.1" -ckb-jsonrpc-types = "=0.105.1" -ckb-app-config = "=0.105.1" -ckb-chain-spec = "=0.105.1" +ckb-types = "=0.106.0" +ckb-jsonrpc-types = "=0.106.0" +ckb-app-config = "=0.106.0" +ckb-chain-spec = "=0.106.0" regex = "1.1.6" faster-hex = "0.6" From 60856d46605ba67737cbe53c7523c8bdec1c329a Mon Sep 17 00:00:00 2001 From: Liu Chuankai Date: Tue, 3 Jan 2023 12:42:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20Support=20rpc=20chan?= =?UTF-8?q?ges=20in=20v0.106.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/subcommands/rpc.rs | 55 ++++++++++++++++++++++++++++++++++++++++- src/utils/arg_parser.rs | 12 +++++++++ src/utils/rpc/client.rs | 18 ++++++++++++++ src/utils/rpc/types.rs | 36 +++++++++++++++++++++++++++ 4 files changed, 120 insertions(+), 1 deletion(-) diff --git a/src/subcommands/rpc.rs b/src/subcommands/rpc.rs index 7bee0be1..d69a5bb9 100644 --- a/src/subcommands/rpc.rs +++ b/src/subcommands/rpc.rs @@ -12,7 +12,8 @@ use std::time::Duration; use super::{CliSubCommand, Output}; use crate::utils::arg_parser::{ - ArgParser, DurationParser, FilePathParser, FixedHashParser, FromStrParser, HexParser, + ArgParser, DurationParser, FeeRateStaticsTargetParser, FilePathParser, FixedHashParser, + FromStrParser, HexParser, }; use crate::utils::rpc::{ BannedAddr, BlockEconomicState, BlockView, EpochView, HeaderView, HttpRpcClient, @@ -148,6 +149,25 @@ impl<'a> RpcSubCommand<'a> { App::new("get_block_economic_state") .about("Returns increased issuance, miner reward, and the total transaction fee of a block") .arg(arg_hash.clone().about("Specifies the block hash which rewards should be analyzed")), + App::new("estimate_cycles") + .arg( + Arg::with_name("json-path") + .long("json-path") + .takes_value(true) + .required(true) + .validator(|input| FilePathParser::new(true).validate(input)) + .about("Transaction content (json format, see rpc estimate_cycles)") + ) + .about("estimate_cycles run a transaction and return the execution consumed cycles."), + App::new("get_fee_rate_statics") + .arg( + Arg::with_name("target") + .long("target") + .takes_value(true) + .validator(|input| FromStrParser::::default().validate(input)) + .about("Specify the number (1 - 101) of confirmed blocks to be counted. If the number is even, automatically add one. Default is 21.") + ) + .about("estimate_cycles run a transaction and return the execution consumed cycles."), // [Net] App::new("get_banned_addresses").about("Get all banned IPs/Subnets"), App::new("get_peers").about("Get connected peers"), @@ -573,6 +593,39 @@ impl<'a> CliSubCommand for RpcSubCommand<'a> { Ok(Output::new_output(resp)) } } + ("estimate_cycles", Some(m)) => { + let is_raw_data = is_raw_data || m.is_present("raw-data"); + let json_path: PathBuf = FilePathParser::new(true).from_matches(m, "json-path")?; + let content = fs::read_to_string(json_path).map_err(|err| err.to_string())?; + let tx: Transaction = + serde_json::from_str(&content).map_err(|err| err.to_string())?; + if is_raw_data { + let resp = self + .raw_rpc_client + .estimate_cycles(tx) + .map_err(|err| err.to_string())?; + Ok(Output::new_output(resp)) + } else { + let resp = self.rpc_client.estimate_cycles(tx.into())?; + Ok(Output::new_output(resp)) + } + } + ("get_fee_rate_statics", Some(m)) => { + let is_raw_data = is_raw_data || m.is_present("raw-data"); + let target: Option = + FeeRateStaticsTargetParser {}.from_matches_opt(m, "target")?; + + if is_raw_data { + let resp = self + .raw_rpc_client + .get_fee_rate_statics(target.map(|v| v.into())) + .map_err(|err| err.to_string())?; + Ok(Output::new_output(resp)) + } else { + let resp = self.rpc_client.get_fee_rate_statics(target)?; + Ok(Output::new_output(resp)) + } + } // [Net] ("get_banned_addresses", Some(m)) => { let is_raw_data = is_raw_data || m.is_present("raw-data"); diff --git a/src/utils/arg_parser.rs b/src/utils/arg_parser.rs index a1f0deab..8124a052 100644 --- a/src/utils/arg_parser.rs +++ b/src/utils/arg_parser.rs @@ -168,6 +168,18 @@ impl ArgParser> for HexParser { } } +pub struct FeeRateStaticsTargetParser; + +impl ArgParser for FeeRateStaticsTargetParser { + fn parse(&self, input: &str) -> Result { + let target = FromStrParser::::default().parse(input)?; + if target == 0 || target > 101 { + return Err(format!("target ({}) is out of range[1 ~ 101]", target)); + } + Ok(target) + } +} + #[derive(Default)] pub struct FixedHashParser { _h: PhantomData, diff --git a/src/utils/rpc/client.rs b/src/utils/rpc/client.rs index fac90626..1a34d5e4 100644 --- a/src/utils/rpc/client.rs +++ b/src/utils/rpc/client.rs @@ -157,6 +157,24 @@ impl HttpRpcClient { .map_err(|err| err.to_string()) } + pub fn estimate_cycles( + &mut self, + tx: packed::Transaction, + ) -> Result { + self.client + .estimate_cycles(tx.into()) + .map(Into::into) + .map_err(|err| err.to_string()) + } + pub fn get_fee_rate_statics( + &mut self, + target: Option, + ) -> Result { + self.client + .get_fee_rate_statics(target.map(Into::into)) + .map(Into::into) + .map_err(|err| err.to_string()) + } // Net pub fn get_banned_addresses(&mut self) -> Result, String> { self.client diff --git a/src/utils/rpc/types.rs b/src/utils/rpc/types.rs index bfe0366a..e6e17140 100644 --- a/src/utils/rpc/types.rs +++ b/src/utils/rpc/types.rs @@ -358,6 +358,8 @@ pub struct ResponseFormat { pub struct TransactionWithStatus { /// The transaction. pub transaction: Option, + /// The transaction consumed cycles. + pub cycles: Option, /// The Transaction status. pub tx_status: TxStatus, } @@ -383,6 +385,7 @@ impl TryFrom for TransactionWithStatus } }) .transpose()?, + cycles: json.cycles.map(|c| c.into()), tx_status: json.tx_status, }) } @@ -1266,3 +1269,36 @@ impl From for RawTxPool { } } } + +/// Response result of the RPC method `estimate_cycles`. +#[derive(Clone, Default, Serialize, Deserialize, PartialEq, Eq, Hash, Debug)] +pub struct EstimateCycles { + /// The count of cycles that the VM has consumed to verify this transaction. + pub cycles: Cycle, +} + +impl From for EstimateCycles { + fn from(json: rpc_types::EstimateCycles) -> EstimateCycles { + EstimateCycles { + cycles: json.cycles.into(), + } + } +} + +/// The fee_rate statistics information, includes mean and median, unit: shannons per kilo-weight +#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)] +pub struct FeeRateStatics { + /// mean + pub mean: Uint64, + /// median + pub median: Uint64, +} + +impl From for FeeRateStatics { + fn from(json: rpc_types::FeeRateStatics) -> FeeRateStatics { + FeeRateStatics { + mean: json.mean.into(), + median: json.median.into(), + } + } +} From fd1d39d8250856ae95c6e0b2aacf8f7dc83cd4fd Mon Sep 17 00:00:00 2001 From: Liu Chuankai Date: Tue, 3 Jan 2023 12:46:13 +0800 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Fix=20CHANGELOG.MD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f95897a7..625a243a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,6 @@ # v1.4.0 * Update ckb deps from `v0.105.1` to `v0.106.0` -* Update deps - - ckb-sdk to `v2.4.0` - - secp256k1 to `v0.25.0` +* Update dep ckb-sdk to `v2.4.0` # v1.3.0 * Add deploy subcommand, this is a more advanced version of `capsule deploy` #515