From 4ecada20c497a9d7ff1925a6b7c198cf1d8406c0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 5 Feb 2024 19:10:09 +0000 Subject: [PATCH 1/5] Bump version to 20.3.0 --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- cmd/crates/soroban-test/Cargo.toml | 2 +- .../soroban-test/tests/fixtures/hello/Cargo.toml | 2 +- .../tests/fixtures/test-wasms/custom_type/Cargo.toml | 2 +- .../tests/fixtures/test-wasms/hello_world/Cargo.toml | 2 +- cmd/soroban-cli/Cargo.toml | 2 +- cmd/soroban-rpc/lib/preflight/Cargo.toml | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8456daacc..2b993d172 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2879,7 +2879,7 @@ dependencies = [ [[package]] name = "preflight" -version = "20.2.0" +version = "20.3.0" dependencies = [ "base64 0.21.5", "libc", @@ -3543,7 +3543,7 @@ dependencies = [ [[package]] name = "soroban-cli" -version = "20.2.0" +version = "20.3.0" dependencies = [ "assert_cmd", "assert_fs", @@ -3676,7 +3676,7 @@ dependencies = [ [[package]] name = "soroban-hello" -version = "20.2.0" +version = "20.3.0" [[package]] name = "soroban-ledger-snapshot" @@ -3822,7 +3822,7 @@ dependencies = [ [[package]] name = "soroban-test" -version = "20.2.0" +version = "20.3.0" dependencies = [ "assert_cmd", "assert_fs", @@ -4051,14 +4051,14 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "test_custom_types" -version = "20.2.0" +version = "20.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_hello_world" -version = "20.2.0" +version = "20.3.0" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 8ba86ea28..036b714b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ git = "https://github.com/stellar/rs-soroban-sdk" rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" [workspace.dependencies.soroban-cli] -version = "20.2.0" +version = "20.3.0" path = "cmd/soroban-cli" [workspace.dependencies.stellar-xdr] diff --git a/cmd/crates/soroban-test/Cargo.toml b/cmd/crates/soroban-test/Cargo.toml index 649a37e57..786be1b35 100644 --- a/cmd/crates/soroban-test/Cargo.toml +++ b/cmd/crates/soroban-test/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/stellar/soroban-test" authors = ["Stellar Development Foundation "] license = "Apache-2.0" readme = "README.md" -version = "20.2.0" +version = "20.3.0" edition = "2021" rust-version.workspace = true autobins = false diff --git a/cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml index 01b80b0f6..faf33ea6a 100644 --- a/cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "soroban-hello" -version = "20.2.0" +version = "20.3.0" edition = "2021" publish = false diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml index 67df45b69..c9f237136 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test_custom_types" -version = "20.2.0" +version = "20.3.0" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml index e5ced55fa..36652fd23 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test_hello_world" -version = "20.2.0" +version = "20.3.0" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml index f402b5ba3..bd68ae2bb 100644 --- a/cmd/soroban-cli/Cargo.toml +++ b/cmd/soroban-cli/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/stellar/soroban-cli" authors = ["Stellar Development Foundation "] license = "Apache-2.0" readme = "README.md" -version = "20.2.0" +version = "20.3.0" edition = "2021" rust-version.workspace = true autobins = false diff --git a/cmd/soroban-rpc/lib/preflight/Cargo.toml b/cmd/soroban-rpc/lib/preflight/Cargo.toml index 7b1f0e488..418f8c190 100644 --- a/cmd/soroban-rpc/lib/preflight/Cargo.toml +++ b/cmd/soroban-rpc/lib/preflight/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "preflight" -version = "20.2.0" +version = "20.3.0" publish = false [lib] From a59f5f421a27bab71472041fc619dd8b0d1cf902 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Tue, 6 Feb 2024 09:09:23 -0800 Subject: [PATCH 2/5] Bump and pin soroban Rust dependencies --- Cargo.lock | 71 +++++++++++++++++++++++++++++++++--------------------- Cargo.toml | 42 ++++++++++++++++---------------- 2 files changed, 64 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b993d172..7bda24ae8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3532,8 +3532,9 @@ dependencies = [ [[package]] name = "soroban-builtin-sdk-macros" -version = "20.2.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e#1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" +version = "20.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "319fbfbf8a7fcaf9c69425d79d59819eedded4b3e56633fee10a4de1af833d51" dependencies = [ "itertools 0.11.0", "proc-macro2", @@ -3610,8 +3611,9 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "20.2.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e#1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" +version = "20.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d609330abbcc2d7fe185304de0c10ef1a95e64eb8effb6ee4faeea97668e0a" dependencies = [ "arbitrary", "crate-git-revision 0.0.6", @@ -3627,8 +3629,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "20.2.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e#1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" +version = "20.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "280d73550935d482534abf3f897e89b40461b3401c3209163b3d0038f0b8b201" dependencies = [ "soroban-env-common", "static_assertions", @@ -3636,8 +3639,9 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "20.2.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e#1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" +version = "20.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd99f4e075f62e0faec118c568fbc70373793fb921148115d5f3f2563945c02d" dependencies = [ "backtrace", "curve25519-dalek 4.1.1", @@ -3662,8 +3666,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "20.2.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e#1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" +version = "20.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c277d3828c200fef887ecd16bd24b2f16b7fc87207a23a94571ab909f2113d8" dependencies = [ "itertools 0.11.0", "proc-macro2", @@ -3680,8 +3685,9 @@ version = "20.3.0" [[package]] name = "soroban-ledger-snapshot" -version = "20.3.0" -source = "git+https://github.com/stellar/rs-soroban-sdk?rev=4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de#4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" +version = "20.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a9cfeb46db19d0fb2e2c97d4e8aa102d660e0c80dc5412409a22dfd14241ca7" dependencies = [ "serde", "serde_json", @@ -3693,8 +3699,9 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "20.3.0" -source = "git+https://github.com/stellar/rs-soroban-sdk?rev=4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de#4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" +version = "20.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "842c20c8503b137f8a8a5981009eb1f5841b96516f1485d7e1bf9c02afb227d1" dependencies = [ "arbitrary", "bytes-lit", @@ -3712,8 +3719,9 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "20.3.0" -source = "git+https://github.com/stellar/rs-soroban-sdk?rev=4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de#4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" +version = "20.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0afc8337fadde3047fb774fa2abc3877a4a260b8e531868b65d5a1debc60b3b9" dependencies = [ "crate-git-revision 0.0.6", "darling", @@ -3731,8 +3739,9 @@ dependencies = [ [[package]] name = "soroban-simulation" -version = "20.2.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e#1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" +version = "20.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "210b093c6d08b8e85ef5f4e4a231d5fa25d1d2787d4fecd50e11040849f259ba" dependencies = [ "anyhow", "rand", @@ -3743,8 +3752,9 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "20.3.0" -source = "git+https://github.com/stellar/rs-soroban-sdk?rev=4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de#4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" +version = "20.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01f31b81de71543d314ef9252e11f2194606d6a4c8c350fbc701eeaa45a8e2d9" dependencies = [ "base64 0.13.1", "stellar-xdr", @@ -3768,8 +3778,9 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "20.3.0" -source = "git+https://github.com/stellar/rs-soroban-sdk?rev=4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de#4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" +version = "20.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1468c9f0025166fc5e8853ba47cbd97d93c877757a5a600fcf71529e5b3b398c" dependencies = [ "prettyplease", "proc-macro2", @@ -3845,8 +3856,9 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "20.3.0" -source = "git+https://github.com/stellar/rs-soroban-sdk?rev=4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de#4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" +version = "20.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "867bd2927e092f2bbf65d1e3cda9f89fa1d1eea935776416bf3ead47fccc82ef" dependencies = [ "soroban-sdk", ] @@ -3854,7 +3866,8 @@ dependencies = [ [[package]] name = "soroban-wasmi" version = "0.31.1-soroban.20.0.1" -source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" dependencies = [ "smallvec", "spin", @@ -4645,13 +4658,15 @@ dependencies = [ [[package]] name = "wasmi_arena" -version = "0.4.0" -source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" [[package]] name = "wasmi_core" version = "0.13.0" -source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" dependencies = [ "downcast-rs", "libm", diff --git a/Cargo.toml b/Cargo.toml index 036b714b3..8758b42ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,27 +15,27 @@ version = "20.3.0" rust-version = "1.74.0" [workspace.dependencies.soroban-env-host] -version = "=20.2.0" -git = "https://github.com/stellar/rs-soroban-env" -rev = "1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" +version = "=20.2.1" +# git = "https://github.com/stellar/rs-soroban-env" +# rev = "1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" # path = "../rs-soroban-env/soroban-env-host" [workspace.dependencies.soroban-simulation] -version = "=20.2.0" -git = "https://github.com/stellar/rs-soroban-env" -rev = "1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" +version = "=20.2.1" +# git = "https://github.com/stellar/rs-soroban-env" +# rev = "1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" # path = "../rs-soroban-env/soroban-simulation" [workspace.dependencies.soroban-spec] -version = "=20.3.0" -git = "https://github.com/stellar/rs-soroban-sdk" -rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" +version = "=20.3.1" +# git = "https://github.com/stellar/rs-soroban-sdk" +# rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" # path = "../rs-soroban-sdk/soroban-spec" [workspace.dependencies.soroban-spec-rust] -version = "=20.3.0" -git = "https://github.com/stellar/rs-soroban-sdk" -rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" +version = "=20.3.1" +# git = "https://github.com/stellar/rs-soroban-sdk" +# rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" # path = "../rs-soroban-sdk/soroban-spec-rust" [workspace.dependencies.soroban-spec-json] @@ -51,19 +51,19 @@ version = "20.2.0" path = "./cmd/crates/soroban-spec-tools" [workspace.dependencies.soroban-sdk] -version = "=20.3.0" -git = "https://github.com/stellar/rs-soroban-sdk" -rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" +version = "=20.3.1" +# git = "https://github.com/stellar/rs-soroban-sdk" +# rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" [workspace.dependencies.soroban-token-sdk] -version = "=20.3.0" -git = "https://github.com/stellar/rs-soroban-sdk" -rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" +version = "=20.3.1" +# git = "https://github.com/stellar/rs-soroban-sdk" +# rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" [workspace.dependencies.soroban-ledger-snapshot] -version = "=20.3.0" -git = "https://github.com/stellar/rs-soroban-sdk" -rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" +version = "=20.3.1" +# git = "https://github.com/stellar/rs-soroban-sdk" +# rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" [workspace.dependencies.soroban-cli] version = "20.3.0" From 2581f6298fbf3c5399354032d809ec0fd43735e5 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Tue, 6 Feb 2024 12:56:36 -0500 Subject: [PATCH 3/5] [Epic] Separating soroban-rpc to prepare for repo change (#1174) * feat: move ContractSpec to spec tools crate * feat: add methods to GetTransaction and break up sending transaction * feat: make persistent the default storage type * feat: create soroban-rpc crate (#21) * feat: create soroban-rpc crate * fix: add event test * fix: switch to --is-view so e2e tests will pass and no breaking changes --- Cargo.lock | 497 +++++++++--------- Cargo.toml | 28 +- cmd/crates/soroban-rpc/Cargo.toml | 51 ++ cmd/crates/soroban-rpc/README.md | 3 + .../src}/fixtures/event_response.json | 0 .../mod.rs => crates/soroban-rpc/src/lib.rs} | 170 +++++- cmd/crates/soroban-rpc/src/log.rs | 2 + .../soroban-rpc/src/log/diagnostic_events.rs | 11 + .../src/rpc => crates/soroban-rpc/src}/txn.rs | 166 +++++- cmd/crates/soroban-spec-tools/Cargo.toml | 2 + .../soroban-spec-tools/src/contract.rs} | 8 +- cmd/crates/soroban-spec-tools/src/lib.rs | 1 + cmd/crates/soroban-test/tests/it/help.rs | 4 +- .../tests/it/integration/dotenv.rs | 7 +- .../tests/it/integration/hello_world.rs | 18 + cmd/crates/soroban-test/tests/it/util.rs | 2 + cmd/soroban-cli/Cargo.toml | 15 +- .../commands/contract/bindings/typescript.rs | 16 +- .../src/commands/contract/extend.rs | 9 +- .../src/commands/contract/inspect.rs | 3 +- .../src/commands/contract/install.rs | 16 +- .../src/commands/contract/invoke.rs | 63 +-- cmd/soroban-cli/src/commands/contract/read.rs | 2 +- .../src/commands/contract/restore.rs | 10 +- cmd/soroban-cli/src/key.rs | 4 +- cmd/soroban-cli/src/lib.rs | 6 +- cmd/soroban-cli/src/utils.rs | 57 +- cmd/soroban-cli/src/wasm.rs | 9 +- docs/soroban-cli-full-docs.md | 203 +++++++ 29 files changed, 948 insertions(+), 435 deletions(-) create mode 100644 cmd/crates/soroban-rpc/Cargo.toml create mode 100644 cmd/crates/soroban-rpc/README.md rename cmd/{soroban-cli/src/rpc => crates/soroban-rpc/src}/fixtures/event_response.json (100%) rename cmd/{soroban-cli/src/rpc/mod.rs => crates/soroban-rpc/src/lib.rs} (92%) create mode 100644 cmd/crates/soroban-rpc/src/log.rs create mode 100644 cmd/crates/soroban-rpc/src/log/diagnostic_events.rs rename cmd/{soroban-cli/src/rpc => crates/soroban-rpc/src}/txn.rs (82%) rename cmd/{soroban-cli/src/utils/contract_spec.rs => crates/soroban-spec-tools/src/contract.rs} (98%) diff --git a/Cargo.lock b/Cargo.lock index 8456daacc..54a37d370 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,9 +43,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -91,9 +91,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "arbitrary" @@ -112,14 +112,14 @@ checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" [[package]] name = "assert_cmd" -version = "2.0.12" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88903cb14723e4d4003335bb7f8a14f27691649105346a0f0957466c096adfe6" +checksum = "00ad3f3a942eee60335ab4342358c161ee296829e0d16ff42fc1d6cb07815467" dependencies = [ "anstyle", "bstr", "doc-comment", - "predicates 3.0.4", + "predicates 3.1.0", "predicates-core", "predicates-tree", "wait-timeout", @@ -127,14 +127,14 @@ dependencies = [ [[package]] name = "assert_fs" -version = "1.0.13" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f070617a68e5c2ed5d06ee8dd620ee18fb72b99f6c094bed34cf8ab07c875b48" +checksum = "2cd762e110c8ed629b11b6cde59458cc1c71de78ebbcc30099fc8e0403a2a2ec" dependencies = [ "anstyle", "doc-comment", "globwalk", - "predicates 3.0.4", + "predicates 3.1.0", "predicates-core", "predicates-tree", "tempfile", @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "531b97fb4cd3dfdce92c35dedbfdc1f0b9d8091c8ca943d6dae340ef5012d514" dependencies = [ "proc-macro2", "quote", @@ -192,9 +192,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -219,9 +219,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block-buffer" @@ -243,12 +243,12 @@ dependencies = [ [[package]] name = "bstr" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" +checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" dependencies = [ "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "serde", ] @@ -302,9 +302,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" dependencies = [ "serde", ] @@ -341,9 +341,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" dependencies = [ "android-tzdata", "iana-time-zone", @@ -351,14 +351,14 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] name = "clap" -version = "4.4.11" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -375,9 +375,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -387,9 +387,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.4.4" +version = "4.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae" +checksum = "df631ae429f6613fcd3a7c1adbdb65f637271e561b03680adaa6573015dfb106" dependencies = [ "clap", ] @@ -436,9 +436,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation" @@ -458,9 +458,9 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -498,45 +498,37 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.16" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", ] [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-bigint" @@ -644,9 +636,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.110" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7129e341034ecb940c9072817cd9007974ea696844fc4dd582dc1653a7fbe2e8" +checksum = "58ab30434ea0ff6aa640a08dda5284026a366d47565496fd40b6cbfbdd7e31a2" dependencies = [ "cc", "cxxbridge-flags", @@ -656,9 +648,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.110" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a24f3f5f8eed71936f21e570436f024f5c2e25628f7496aa7ccd03b90109d5" +checksum = "b649d7dfae8268450d53d109388b337b9352c7cba1fc10db4a1bc23c3dc189fb" dependencies = [ "cc", "codespan-reporting", @@ -671,15 +663,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.110" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06fdd177fc61050d63f67f5bd6351fac6ab5526694ea8e359cd9cd3b75857f44" +checksum = "42281b20eba5218c539295c667c18e2f50211bb11902419194c6ed1ae808e547" [[package]] name = "cxxbridge-macro" -version = "1.0.110" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "587663dd5fb3d10932c8aecfe7c844db1bcf0aee93eeab08fac13dc1212c2e7f" +checksum = "b45506e3c66512b0a65d291a6b452128b7b1dd9841e20d1e151addbd2c00ea50" dependencies = [ "proc-macro2", "quote", @@ -739,9 +731,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -1077,18 +1069,18 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-io" @@ -1098,21 +1090,21 @@ checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-io", @@ -1277,7 +1269,7 @@ dependencies = [ "gix-chunk", "gix-features", "gix-hash", - "memmap2 0.9.3", + "memmap2 0.9.4", "thiserror", ] @@ -1304,11 +1296,11 @@ dependencies = [ [[package]] name = "gix-config-value" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e0be46f4cf1f8f9e88d0e3eb7b29718aff23889563249f379119bd1ab6910e" +checksum = "5b8a1e7bfb37a46ed0b8468db37a6d8a0a61d56bdbe4603ae492cb322e5f3958" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bstr", "gix-path", "libc", @@ -1423,7 +1415,7 @@ version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5db19298c5eeea2961e5b3bf190767a2d1f09b8802aeb5f258e42276350aff19" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bstr", "gix-features", "gix-path", @@ -1468,7 +1460,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c83a4fcc121b2f2e109088f677f89f85e7a8ebf39e8e6659c0ae54d4283b1650" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bstr", "btoi", "filetime", @@ -1513,7 +1505,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a5cdcf491ecc9ce39dcc227216c540355fe0024ae7c38e94557752ca5ebb67f" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "gix-commitgraph", "gix-date", "gix-hash", @@ -1605,9 +1597,9 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dd0998ab245f33d40ca2267e58d542fe54185ebd1dc41923346cf28d179fb6" +checksum = "97e9ad649bf5e109562d6acba657ca428661ec08e77eaf3a755d8fa55485be9c" dependencies = [ "bstr", "gix-trace", @@ -1622,7 +1614,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dbbb92f75a38ef043c8bb830b339b38d0698d7f3746968b5fcbade7a880494d" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bstr", "gix-attributes", "gix-config-value", @@ -1741,14 +1733,14 @@ dependencies = [ [[package]] name = "gix-sec" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f6dce0c6683e2219e8169aac4b1c29e89540a8262fef7056b31d80d969408c" +checksum = "f8d9bf462feaf05f2121cba7399dbc6c34d88a9cad58fc1e95027791d6a3c6d2" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "gix-path", "libc", - "windows", + "windows-sys 0.52.0", ] [[package]] @@ -1781,9 +1773,9 @@ dependencies = [ [[package]] name = "gix-trace" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e1127ede0475b58f4fe9c0aaa0d9bb0bad2af90bbd93ccd307c8632b863d89" +checksum = "02b202d766a7fefc596e2cc6a89cda8ad8ad733aed82da635ac120691112a9b1" [[package]] name = "gix-transport" @@ -1791,7 +1783,7 @@ version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f209a93364e24f20319751bc11092272e2f3fe82bb72592b2822679cf5be752" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bstr", "gix-command", "gix-credentials", @@ -1836,11 +1828,12 @@ dependencies = [ [[package]] name = "gix-utils" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de6225e2de30b6e9bca2d9f1cc4731640fcef0fb3cabddceee366e7e85d3e94f" +checksum = "56e839f3d0798b296411263da6bee780a176ef8008a5dfc31287f7eda9266ab8" dependencies = [ "fastrand", + "unicode-normalization", ] [[package]] @@ -1906,17 +1899,17 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] [[package]] name = "globwalk" -version = "0.8.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" +checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "ignore", "walkdir", ] @@ -1934,16 +1927,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.11", "indexmap 2.1.0", "slab", "tokio", @@ -1971,9 +1964,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "hex" @@ -2011,11 +2004,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2040,6 +2033,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -2047,7 +2051,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.11", "pin-project-lite", ] @@ -2065,22 +2069,22 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", "h2", - "http", + "http 0.2.11", "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2", "tokio", "tower-service", "tracing", @@ -2094,7 +2098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", + "http 0.2.11", "hyper", "log", "rustls", @@ -2118,16 +2122,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core 0.51.1", + "windows-core", ] [[package]] @@ -2167,15 +2171,15 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747ad1b4ae841a78e8aba0d63adbfbeaea26b517b63705d47856b73015d27060" +checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" dependencies = [ "crossbeam-deque", "globset", "log", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "same-file", "walkdir", "winapi-util", @@ -2245,7 +2249,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2 0.5.5", + "socket2", "widestring", "windows-sys 0.48.0", "winreg", @@ -2292,9 +2296,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] @@ -2368,9 +2372,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] @@ -2392,9 +2396,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libm" @@ -2408,7 +2412,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "libc", "redox_syscall", ] @@ -2430,9 +2434,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -2487,9 +2491,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memmap2" @@ -2502,22 +2506,13 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" dependencies = [ "libc", ] -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - [[package]] name = "mime" version = "0.3.17" @@ -2640,9 +2635,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -2661,11 +2656,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.61" +version = "0.10.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" +checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cfg-if", "foreign-types", "libc", @@ -2702,9 +2697,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.97" +version = "0.9.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", @@ -2771,18 +2766,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", @@ -2813,15 +2808,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platforms" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" +checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" [[package]] name = "powerfmt" @@ -2851,13 +2846,12 @@ dependencies = [ [[package]] name = "predicates" -version = "3.0.4" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dfc28575c2e3f19cb3c73b93af36460ae898d426eba6fc15b9bd2a5220758a0" +checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" dependencies = [ "anstyle", "difflib", - "itertools 0.11.0", "predicates-core", ] @@ -2881,7 +2875,7 @@ dependencies = [ name = "preflight" version = "20.2.0" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "libc", "sha2 0.10.8", "soroban-env-host", @@ -2996,13 +2990,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] @@ -3017,9 +3011,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -3044,13 +3038,13 @@ version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", "futures-util", "h2", - "http", + "http 0.2.11", "http-body", "hyper", "hyper-rustls", @@ -3157,11 +3151,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", @@ -3198,7 +3192,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", ] [[package]] @@ -3234,11 +3228,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3332,9 +3326,9 @@ dependencies = [ [[package]] name = "serde-aux" -version = "4.3.1" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "184eba62ebddb71658697c8b08822edee89970bf318c5362189f0de27f85b498" +checksum = "a86348501c129f3ad50c2f4635a01971f76974cd8a3f335988a0f1581c082765" dependencies = [ "chrono", "serde", @@ -3377,11 +3371,11 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.4.0" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "f5c9fdb6b00a489875b22efd4b78fe2b363b72265cc5f6eb2e2b9ee270e6140c" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", @@ -3394,9 +3388,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "dbff351eb4b33600a2e138dfa0b10b65a238ea8ff8fb2387c422c5022a3e8298" dependencies = [ "darling", "proc-macro2", @@ -3455,9 +3449,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" @@ -3506,19 +3500,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" @@ -3547,7 +3531,7 @@ version = "20.2.0" dependencies = [ "assert_cmd", "assert_fs", - "base64 0.21.5", + "base64 0.21.7", "cargo_metadata", "chrono", "clap", @@ -3562,7 +3546,7 @@ dependencies = [ "gix", "heck", "hex", - "http", + "http 0.2.11", "hyper", "hyper-tls", "itertools 0.10.5", @@ -3584,6 +3568,7 @@ dependencies = [ "shlex", "soroban-env-host", "soroban-ledger-snapshot", + "soroban-rpc", "soroban-sdk", "soroban-spec", "soroban-spec-json", @@ -3691,6 +3676,38 @@ dependencies = [ "thiserror", ] +[[package]] +name = "soroban-rpc" +version = "20.3.0" +dependencies = [ + "base64 0.21.7", + "clap", + "ed25519-dalek 2.0.0", + "ethnum", + "hex", + "http 1.0.0", + "itertools 0.10.5", + "jsonrpsee-core", + "jsonrpsee-http-client", + "serde", + "serde-aux", + "serde_json", + "sha2 0.10.8", + "soroban-env-host", + "soroban-sdk", + "soroban-spec", + "soroban-spec-tools", + "stellar-strkey 0.0.7", + "stellar-xdr", + "termcolor", + "termcolor_output", + "thiserror", + "tokio", + "tracing", + "wasmparser 0.90.0", + "which", +] + [[package]] name = "soroban-sdk" version = "20.3.0" @@ -3785,11 +3802,12 @@ dependencies = [ name = "soroban-spec-tools" version = "20.3.0" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "ethnum", "hex", "itertools 0.10.5", "serde_json", + "soroban-env-host", "soroban-spec", "stellar-strkey 0.0.7", "stellar-xdr", @@ -3803,7 +3821,7 @@ dependencies = [ name = "soroban-spec-typescript" version = "20.3.0" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "heck", "include_dir", "itertools 0.10.5", @@ -4001,28 +4019,28 @@ dependencies = [ [[package]] name = "temp-dir" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af547b166dd1ea4b472165569fc456cfb6818116f854690b0ff205e636523dab" +checksum = "dd16aa9ffe15fe021c6ee3766772132c6e98dfa395a167e16864f61a9cfb71d6" [[package]] name = "tempfile" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand", "redox_syscall", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -4087,18 +4105,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "6e3de26b0965292219b4287ff031fcba86837900fe9cd2b34ea8ad893c0953d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "268026685b2be38d7103e9e507c938a1fcb3d7e6eb15e87870b617bf37b6d581" dependencies = [ "proc-macro2", "quote", @@ -4117,9 +4135,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", "itoa", @@ -4139,9 +4157,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -4182,9 +4200,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", @@ -4194,7 +4212,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.5", + "socket2", "tokio-macros", "windows-sys 0.48.0", ] @@ -4431,9 +4449,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-bom" @@ -4539,9 +4557,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4549,9 +4567,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", @@ -4564,9 +4582,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" dependencies = [ "cfg-if", "js-sys", @@ -4576,9 +4594,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4586,9 +4604,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", @@ -4599,9 +4617,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "wasm-opt" @@ -4688,9 +4706,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ "js-sys", "wasm-bindgen", @@ -4752,25 +4770,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" -dependencies = [ - "windows-core 0.52.0", - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-core" -version = "0.51.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows-core" version = "0.52.0" @@ -4914,9 +4913,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.34" +version = "0.5.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" +checksum = "1931d78a9c73861da0134f453bb1f790ce49b2e30eba8410b4b79bac72b46a2d" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 8ba86ea28..aa19bda95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,27 +69,49 @@ rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" version = "20.2.0" path = "cmd/soroban-cli" +[workspace.dependencies.soroban-rpc] +version = "20.2.0" +path = "cmd/crates/soroban-rpc" + [workspace.dependencies.stellar-xdr] version = "=20.1.0" default-features = true [workspace.dependencies] +stellar-strkey = "0.0.7" +sep5 = "0.0.2" base64 = "0.21.2" thiserror = "1.0.46" sha2 = "0.10.7" ethnum = "1.3.2" hex = "0.4.3" itertools = "0.10.0" -sep5 = "0.0.2" + +serde-aux = "4.1.2" serde_json = "1.0.82" serde = "1.0.82" -stellar-strkey = "0.0.7" + +clap = { version = "4.1.8", features = [ + "derive", + "env", + "deprecated", + "string", +] } +clap_complete = "4.1.4" tracing = "0.1.37" tracing-subscriber = "0.3.16" tracing-appender = "0.2.2" which = "4.4.0" wasmparser = "0.90.0" - +termcolor = "1.1.3" +termcolor_output = "1.0.1" +ed25519-dalek = "2.0.0" + +# networking +http = "1.0.0" +jsonrpsee-http-client = "0.20.1" +jsonrpsee-core = "0.20.1" +tokio = "1.28.1" # [patch."https://github.com/stellar/rs-soroban-env"] # soroban-env-host = { path = "../rs-soroban-env/soroban-env-host/" } diff --git a/cmd/crates/soroban-rpc/Cargo.toml b/cmd/crates/soroban-rpc/Cargo.toml new file mode 100644 index 000000000..966597a22 --- /dev/null +++ b/cmd/crates/soroban-rpc/Cargo.toml @@ -0,0 +1,51 @@ +[package] +name = "soroban-rpc" +description = "Soroban RPC client for rust" +homepage = "https://github.com/stellar/soroban-tools" +repository = "https://github.com/stellar/soroban-tools" +authors = ["Stellar Development Foundation "] +license = "Apache-2.0" +readme = "README.md" +version.workspace = true +edition = "2021" +rust-version.workspace = true +autobins = false + + +[lib] +crate-type = ["rlib"] + + +[dependencies] +soroban-sdk = { version = "=20.3.0", git = "https://github.com/stellar/rs-soroban-sdk", rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" } +soroban-spec-tools = { version = "20.2.0", path = "../soroban-spec-tools" } +soroban-env-host = { version = "=20.2.0", git = "https://github.com/stellar/rs-soroban-env", rev = "1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" } +stellar-strkey = "0.0.7" +stellar-xdr = { version = "=20.1.0", default-features = true, features = ["curr", "std", "serde"] } +soroban-spec = { version = "=20.3.0", git = "https://github.com/stellar/rs-soroban-sdk", rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" } + +termcolor = "1.1.3" +termcolor_output = "1.0.1" +clap = { version = "4.1.8", features = ["derive", "env", "deprecated", "string"] } +serde_json = "1.0.82" +serde-aux = "4.1.2" +itertools = "0.10.0" +ethnum = "1.3.2" +hex = "0.4.3" +wasmparser = "0.90.0" +base64 = "0.21.2" +thiserror = "1.0.46" +serde = "1.0.82" +tokio = "1.28.1" +sha2 = "0.10.7" +ed25519-dalek = "2.0.0" +tracing = "0.1.40" + +# networking +jsonrpsee-http-client = "0.20.1" +jsonrpsee-core = "0.20.1" +http = "1.0.0" + + +[dev-dependencies] +which = "4.4.0" diff --git a/cmd/crates/soroban-rpc/README.md b/cmd/crates/soroban-rpc/README.md new file mode 100644 index 000000000..9185b7fd0 --- /dev/null +++ b/cmd/crates/soroban-rpc/README.md @@ -0,0 +1,3 @@ +# soroban-rpc + +Tools and utilities for soroban rpc. diff --git a/cmd/soroban-cli/src/rpc/fixtures/event_response.json b/cmd/crates/soroban-rpc/src/fixtures/event_response.json similarity index 100% rename from cmd/soroban-cli/src/rpc/fixtures/event_response.json rename to cmd/crates/soroban-rpc/src/fixtures/event_response.json diff --git a/cmd/soroban-cli/src/rpc/mod.rs b/cmd/crates/soroban-rpc/src/lib.rs similarity index 92% rename from cmd/soroban-cli/src/rpc/mod.rs rename to cmd/crates/soroban-rpc/src/lib.rs index 535426292..95c3692e1 100644 --- a/cmd/soroban-cli/src/rpc/mod.rs +++ b/cmd/crates/soroban-rpc/src/lib.rs @@ -21,15 +21,20 @@ use std::{ str::FromStr, time::{Duration, Instant}, }; +use stellar_xdr::curr::ContractEventType; use termcolor::{Color, ColorChoice, StandardStream, WriteColor}; use termcolor_output::colored; use tokio::time::sleep; -use crate::utils::contract_spec; - +pub mod log; mod txn; +pub use txn::Assembled; + +use soroban_spec_tools::contract; + const VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION"); +pub(crate) const DEFAULT_TRANSACTION_FEES: u32 = 100; pub type LogEvents = fn( footprint: &LedgerFootprint, @@ -88,7 +93,7 @@ pub enum Error { #[error("unexpected contract code data type: {0:?}")] UnexpectedContractCodeDataType(LedgerEntryData), #[error(transparent)] - CouldNotParseContractSpec(#[from] contract_spec::Error), + CouldNotParseContractSpec(#[from] contract::Error), #[error("unexpected contract code got token")] UnexpectedToken(ContractDataEntry), #[error(transparent)] @@ -99,6 +104,9 @@ pub enum Error { LargeFee(u64), #[error("Cannot authorize raw transactions")] CannotAuthorizeRawTransaction, + + #[error("Missing result for tnx")] + MissingOp, } #[derive(serde::Deserialize, serde::Serialize, Debug)] @@ -170,6 +178,41 @@ impl TryInto for GetTransactionResponseRaw { } } +impl GetTransactionResponse { + /// + /// # Errors + pub fn return_value(&self) -> Result { + if let Some(xdr::TransactionMeta::V3(xdr::TransactionMetaV3 { + soroban_meta: Some(xdr::SorobanTransactionMeta { return_value, .. }), + .. + })) = &self.result_meta + { + Ok(return_value.clone()) + } else { + Err(Error::MissingOp) + } + } + + /// + /// # Errors + pub fn events(&self) -> Result, Error> { + self.result_meta + .as_ref() + .map(extract_events) + .ok_or(Error::MissingOp) + } + + /// + /// # Errors + pub fn contract_events(&self) -> Result, Error> { + Ok(self + .events()? + .into_iter() + .filter(|e| matches!(e.event.type_, ContractEventType::Contract)) + .collect::>()) + } +} + #[derive(serde::Deserialize, serde::Serialize, Debug)] pub struct LedgerEntryResult { pub key: String, @@ -273,6 +316,8 @@ pub struct SimulateTransactionResponse { } impl SimulateTransactionResponse { + /// + /// # Errors pub fn results(&self) -> Result, Error> { self.results .iter() @@ -294,6 +339,8 @@ impl SimulateTransactionResponse { .collect() } + /// + /// # Errors pub fn events(&self) -> Result, Error> { self.events .iter() @@ -301,6 +348,8 @@ impl SimulateTransactionResponse { .collect() } + /// + /// # Errors pub fn transaction_data(&self) -> Result { Ok(SorobanTransactionData::from_xdr_base64( &self.transaction_data, @@ -343,6 +392,7 @@ pub struct GetEventsResponse { // Reference](https://docs.google.com/document/d/1TZUDgo_3zPz7TiPMMHVW_mtogjLyPL0plvzGMsxSz6A/edit#bookmark=id.35t97rnag3tx) // [Code // Reference](https://github.com/stellar/soroban-tools/blob/bac1be79e8c2590c9c35ad8a0168aab0ae2b4171/cmd/soroban-rpc/internal/methods/get_events.go#L182-L203) +#[must_use] pub fn does_topic_match(topic: &[String], filter: &[String]) -> bool { filter.len() == topic.len() && filter @@ -397,10 +447,13 @@ impl Display for Event { } impl Event { + /// + /// # Errors pub fn parse_cursor(&self) -> Result<(u64, i32), Error> { parse_cursor(&self.id) } - + /// + /// # Errors pub fn pretty_print(&self) -> Result<(), Box> { let mut stdout = StandardStream::stdout(ColorChoice::Auto); if !stdout.supports_color() { @@ -502,6 +555,8 @@ pub struct Client { } impl Client { + /// + /// # Errors pub fn new(base_url: &str) -> Result { // Add the port to the base URL if there is no port explicitly included // in the URL and the scheme allows us to infer a default port. @@ -532,6 +587,8 @@ impl Client { }) } + /// + /// # Errors fn client(&self) -> Result { let url = self.base_url.clone(); let mut headers = HeaderMap::new(); @@ -543,6 +600,8 @@ impl Client { .build(url)?) } + /// + /// # Errors pub async fn friendbot_url(&self) -> Result { let network = self.get_network().await?; tracing::trace!("{network:#?}"); @@ -553,7 +612,8 @@ impl Client { ) }) } - + /// + /// # Errors pub async fn verify_network_passphrase(&self, expected: Option<&str>) -> Result { let server = self.get_network().await?.passphrase; if let Some(expected) = expected { @@ -567,11 +627,15 @@ impl Client { Ok(server) } + /// + /// # Errors pub async fn get_network(&self) -> Result { tracing::trace!("Getting network"); Ok(self.client()?.request("getNetwork", rpc_params![]).await?) } + /// + /// # Errors pub async fn get_latest_ledger(&self) -> Result { tracing::trace!("Getting latest ledger"); Ok(self @@ -580,6 +644,8 @@ impl Client { .await?) } + /// + /// # Errors pub async fn get_account(&self, address: &str) -> Result { tracing::trace!("Getting address {}", address); let key = LedgerKey::Account(LedgerKeyAccount { @@ -611,10 +677,12 @@ soroban config identity fund {address} --helper-url "# } } + /// + /// # Errors pub async fn send_transaction( &self, tx: &TransactionEnvelope, - ) -> Result<(TransactionResult, TransactionMeta, Vec), Error> { + ) -> Result { let client = self.client()?; tracing::trace!("Sending:\n{tx:#?}"); let SendTransactionResponse { @@ -656,14 +724,8 @@ soroban config identity fund {address} --helper-url "# "SUCCESS" => { // TODO: the caller should probably be printing this tracing::trace!("{response:#?}"); - let GetTransactionResponse { - result, - result_meta, - .. - } = response; - let meta = result_meta.ok_or(Error::MissingResult)?; - let events = extract_events(&meta); - return Ok((result.ok_or(Error::MissingResult)?, meta, events)); + + return Ok(response); } "FAILED" => { tracing::error!("{response:#?}"); @@ -687,6 +749,8 @@ soroban config identity fund {address} --helper-url "# } } + /// + /// # Errors pub async fn simulate_transaction( &self, tx: &TransactionEnvelope, @@ -703,33 +767,69 @@ soroban config identity fund {address} --helper-url "# match response.error { None => Ok(response), Some(e) => { - crate::log::diagnostic_events(&response.events, tracing::Level::ERROR); + log::diagnostic_events(&response.events, tracing::Level::ERROR); Err(Error::TransactionSimulationFailed(e)) } } } - pub async fn prepare_and_send_transaction( + /// + /// # Errors + pub async fn send_assembled_transaction( &self, - tx_without_preflight: &Transaction, + txn: txn::Assembled, source_key: &ed25519_dalek::SigningKey, signers: &[ed25519_dalek::SigningKey], network_passphrase: &str, log_events: Option, log_resources: Option, - ) -> Result<(TransactionResult, TransactionMeta, Vec), Error> { - let txn = txn::Assembled::new(tx_without_preflight, self).await?; - let seq_num = txn.sim_res().latest_ledger + 60; //5 min; + ) -> Result { + let seq_num = txn.sim_response().latest_ledger + 60; //5 min; let authorized = txn .handle_restore(self, source_key, network_passphrase) .await? .authorize(self, source_key, signers, seq_num, network_passphrase) .await?; authorized.log(log_events, log_resources)?; + let tx = authorized.sign(source_key, network_passphrase)?; self.send_transaction(&tx).await } + /// + /// # Errors + pub async fn prepare_and_send_transaction( + &self, + tx_without_preflight: &Transaction, + source_key: &ed25519_dalek::SigningKey, + signers: &[ed25519_dalek::SigningKey], + network_passphrase: &str, + log_events: Option, + log_resources: Option, + ) -> Result { + let txn = txn::Assembled::new(tx_without_preflight, self).await?; + self.send_assembled_transaction( + txn, + source_key, + signers, + network_passphrase, + log_events, + log_resources, + ) + .await + } + + /// + /// # Errors + pub async fn create_assembled_transaction( + &self, + txn: &Transaction, + ) -> Result { + txn::Assembled::new(txn, self).await + } + + /// + /// # Errors pub async fn get_transaction(&self, tx_id: &str) -> Result { Ok(self .client()? @@ -737,6 +837,8 @@ soroban config identity fund {address} --helper-url "# .await?) } + /// + /// # Errors pub async fn get_ledger_entries( &self, keys: &[LedgerKey], @@ -747,7 +849,7 @@ soroban config identity fund {address} --helper-url "# if base64_result.is_err() { return Err(Error::Xdr(XdrError::Invalid)); } - base64_keys.push(k.to_xdr_base64(Limits::none()).unwrap()); + base64_keys.push(k.to_xdr_base64(Limits::none())?); } Ok(self .client()? @@ -755,6 +857,8 @@ soroban config identity fund {address} --helper-url "# .await?) } + /// + /// # Errors pub async fn get_full_ledger_entries( &self, ledger_keys: &[LedgerKey], @@ -795,7 +899,8 @@ soroban config identity fund {address} --helper-url "# latest_ledger, }) } - + /// + /// # Errors pub async fn get_events( &self, start: EventStart, @@ -835,6 +940,8 @@ soroban config identity fund {address} --helper-url "# Ok(self.client()?.request("getEvents", oparams).await?) } + /// + /// # Errors pub async fn get_contract_data( &self, contract_id: &[u8; 32], @@ -858,6 +965,8 @@ soroban config identity fund {address} --helper-url "# } } + /// + /// # Errors pub async fn get_remote_wasm(&self, contract_id: &[u8; 32]) -> Result, Error> { match self.get_contract_data(contract_id).await? { xdr::ContractDataEntry { @@ -872,6 +981,8 @@ soroban config identity fund {address} --helper-url "# } } + /// + /// # Errors pub async fn get_remote_wasm_from_hash(&self, hash: xdr::Hash) -> Result, Error> { let code_key = LedgerKey::ContractCode(xdr::LedgerKeyContractCode { hash: hash.clone() }); let contract_data = self.get_ledger_entries(&[code_key]).await?; @@ -888,7 +999,8 @@ soroban config identity fund {address} --helper-url "# scval => Err(Error::UnexpectedContractCodeDataType(scval)), } } - + /// + /// # Errors pub async fn get_remote_contract_spec( &self, contract_id: &[u8; 32], @@ -898,11 +1010,11 @@ soroban config identity fund {address} --helper-url "# xdr::ScVal::ContractInstance(xdr::ScContractInstance { executable: xdr::ContractExecutable::Wasm(hash), .. - }) => Ok(contract_spec::ContractSpec::new( - &self.get_remote_wasm_from_hash(hash).await?, - ) - .map_err(Error::CouldNotParseContractSpec)? - .spec), + }) => Ok( + contract::Spec::new(&self.get_remote_wasm_from_hash(hash).await?) + .map_err(Error::CouldNotParseContractSpec)? + .spec, + ), xdr::ScVal::ContractInstance(xdr::ScContractInstance { executable: xdr::ContractExecutable::StellarAsset, .. @@ -939,7 +1051,7 @@ fn extract_events(tx_meta: &TransactionMeta) -> Vec { } } -pub fn parse_cursor(c: &str) -> Result<(u64, i32), Error> { +pub(crate) fn parse_cursor(c: &str) -> Result<(u64, i32), Error> { let (toid_part, event_index) = c.split('-').collect_tuple().ok_or(Error::InvalidCursor)?; let toid_part: u64 = toid_part.parse().map_err(|_| Error::InvalidCursor)?; let start_index: i32 = event_index.parse().map_err(|_| Error::InvalidCursor)?; diff --git a/cmd/crates/soroban-rpc/src/log.rs b/cmd/crates/soroban-rpc/src/log.rs new file mode 100644 index 000000000..361268148 --- /dev/null +++ b/cmd/crates/soroban-rpc/src/log.rs @@ -0,0 +1,2 @@ +pub mod diagnostic_events; +pub use diagnostic_events::*; diff --git a/cmd/crates/soroban-rpc/src/log/diagnostic_events.rs b/cmd/crates/soroban-rpc/src/log/diagnostic_events.rs new file mode 100644 index 000000000..68af67a4e --- /dev/null +++ b/cmd/crates/soroban-rpc/src/log/diagnostic_events.rs @@ -0,0 +1,11 @@ +pub fn diagnostic_events(events: &[impl std::fmt::Debug], level: tracing::Level) { + for (i, event) in events.iter().enumerate() { + if level == tracing::Level::TRACE { + tracing::trace!("{i}: {event:#?}"); + } else if level == tracing::Level::INFO { + tracing::info!("{i}: {event:#?}"); + } else if level == tracing::Level::ERROR { + tracing::error!("{i}: {event:#?}"); + } + } +} diff --git a/cmd/soroban-cli/src/rpc/txn.rs b/cmd/crates/soroban-rpc/src/txn.rs similarity index 82% rename from cmd/soroban-cli/src/rpc/txn.rs rename to cmd/crates/soroban-rpc/src/txn.rs index 9e36938dd..35b0c7192 100644 --- a/cmd/soroban-cli/src/rpc/txn.rs +++ b/cmd/crates/soroban-rpc/src/txn.rs @@ -2,16 +2,16 @@ use ed25519_dalek::Signer; use sha2::{Digest, Sha256}; use soroban_env_host::xdr::{ self, AccountId, DecoratedSignature, ExtensionPoint, Hash, HashIdPreimage, - HashIdPreimageSorobanAuthorization, InvokeHostFunctionOp, Limits, Memo, Operation, - OperationBody, Preconditions, PublicKey, ReadXdr, RestoreFootprintOp, ScAddress, ScMap, - ScSymbol, ScVal, Signature, SignatureHint, SorobanAddressCredentials, + HashIdPreimageSorobanAuthorization, InvokeHostFunctionOp, LedgerFootprint, Limits, Memo, + Operation, OperationBody, Preconditions, PublicKey, ReadXdr, RestoreFootprintOp, ScAddress, + ScMap, ScSymbol, ScVal, Signature, SignatureHint, SorobanAddressCredentials, SorobanAuthorizationEntry, SorobanAuthorizedFunction, SorobanCredentials, SorobanResources, SorobanTransactionData, Transaction, TransactionEnvelope, TransactionExt, TransactionSignaturePayload, TransactionSignaturePayloadTaggedTransaction, TransactionV1Envelope, Uint256, VecM, WriteXdr, }; -use crate::rpc::{Client, Error, RestorePreamble, SimulateTransactionResponse}; +use super::{Client, Error, RestorePreamble, SimulateTransactionResponse}; use super::{LogEvents, LogResources}; @@ -20,13 +20,35 @@ pub struct Assembled { sim_res: SimulateTransactionResponse, } +/// Represents an assembled transaction ready to be signed and submitted to the network. impl Assembled { + /// + /// Creates a new `Assembled` transaction. + /// + /// # Arguments + /// + /// * `txn` - The original transaction. + /// * `client` - The client used for simulation and submission. + /// + /// # Errors + /// + /// Returns an error if simulation fails or if assembling the transaction fails. pub async fn new(txn: &Transaction, client: &Client) -> Result { let sim_res = Self::simulate(txn, client).await?; let txn = assemble(txn, &sim_res)?; Ok(Self { txn, sim_res }) } + /// + /// Calculates the hash of the assembled transaction. + /// + /// # Arguments + /// + /// * `network_passphrase` - The network passphrase. + /// + /// # Errors + /// + /// Returns an error if generating the hash fails. pub fn hash(&self, network_passphrase: &str) -> Result<[u8; 32], xdr::Error> { let signature_payload = TransactionSignaturePayload { network_id: Hash(Sha256::digest(network_passphrase).into()), @@ -35,12 +57,23 @@ impl Assembled { Ok(Sha256::digest(signature_payload.to_xdr(Limits::none())?).into()) } + /// + /// Signs the assembled transaction. + /// + /// # Arguments + /// + /// * `key` - The signing key. + /// * `network_passphrase` - The network passphrase. + /// + /// # Errors + /// + /// Returns an error if signing the transaction fails. pub fn sign( self, key: &ed25519_dalek::SigningKey, network_passphrase: &str, ) -> Result { - let tx = self.txn(); + let tx = self.transaction(); let tx_hash = self.hash(network_passphrase)?; let tx_signature = key.sign(&tx_hash); @@ -55,6 +88,17 @@ impl Assembled { })) } + /// + /// Simulates the assembled transaction. + /// + /// # Arguments + /// + /// * `tx` - The original transaction. + /// * `client` - The client used for simulation. + /// + /// # Errors + /// + /// Returns an error if simulation fails. pub async fn simulate( tx: &Transaction, client: &Client, @@ -67,6 +111,18 @@ impl Assembled { .await } + /// + /// Handles the restore process for the assembled transaction. + /// + /// # Arguments + /// + /// * `client` - The client used for submission. + /// * `source_key` - The signing key of the source account. + /// * `network_passphrase` - The network passphrase. + /// + /// # Errors + /// + /// Returns an error if the restore process fails. pub async fn handle_restore( self, client: &Client, @@ -77,7 +133,7 @@ impl Assembled { // Build and submit the restore transaction client .send_transaction( - &Assembled::new(&restore(self.txn(), restore_preamble)?, client) + &Assembled::new(&restore(self.transaction(), restore_preamble)?, client) .await? .sign(source_key, network_passphrase)?, ) @@ -88,14 +144,20 @@ impl Assembled { } } - pub fn txn(&self) -> &Transaction { + /// Returns a reference to the original transaction. + #[must_use] + pub fn transaction(&self) -> &Transaction { &self.txn } - pub fn sim_res(&self) -> &SimulateTransactionResponse { + /// Returns a reference to the simulation response. + #[must_use] + pub fn sim_response(&self) -> &SimulateTransactionResponse { &self.sim_res } + /// + /// # Errors pub async fn authorize( self, client: &Client, @@ -105,7 +167,7 @@ impl Assembled { network_passphrase: &str, ) -> Result { if let Some(txn) = sign_soroban_authorizations( - self.txn(), + self.transaction(), source_key, signers, seq_num, @@ -117,12 +179,16 @@ impl Assembled { } } + #[must_use] pub fn bump_seq_num(mut self) -> Self { self.txn.seq_num.0 += 1; self } - pub fn auth(&self) -> VecM { + /// + /// # Errors + #[must_use] + pub fn auth_entries(&self) -> VecM { self.txn .operations .first() @@ -137,6 +203,8 @@ impl Assembled { .unwrap_or_default() } + /// + /// # Errors pub fn log( &self, log_events: Option, @@ -151,15 +219,55 @@ impl Assembled { log(resources); } if let Some(log) = log_events { - log(footprint, &[self.auth()], &self.sim_res.events()?); + log(footprint, &[self.auth_entries()], &self.sim_res.events()?); }; } Ok(()) } + + #[must_use] + pub fn requires_auth(&self) -> bool { + requires_auth(&self.txn).is_some() + } + + #[must_use] + pub fn is_view(&self) -> bool { + let TransactionExt::V1(SorobanTransactionData { + resources: + SorobanResources { + footprint: LedgerFootprint { read_write, .. }, + .. + }, + .. + }) = &self.txn.ext + else { + return false; + }; + read_write.is_empty() + } + + #[must_use] + pub fn set_max_instructions(mut self, instructions: u32) -> Self { + if let TransactionExt::V1(SorobanTransactionData { + resources: + SorobanResources { + instructions: ref mut i, + .. + }, + .. + }) = &mut self.txn.ext + { + tracing::trace!("setting max instructions to {instructions} from {i}"); + *i = instructions; + } + self + } } // Apply the result of a simulateTransaction onto a transaction envelope, preparing it for // submission to the network. +/// +/// # Errors pub fn assemble( raw: &Transaction, simulation: &SimulateTransactionResponse, @@ -206,7 +314,7 @@ pub fn assemble( } // update the fees of the actual transaction to meet the minimum resource fees. - let classic_transaction_fees = crate::fee::Args::default().fee; + let classic_transaction_fees = crate::DEFAULT_TRANSACTION_FEES; // Pad the fees up by 15% for a bit of wiggle room. tx.fee = (tx.fee.max( classic_transaction_fees @@ -220,6 +328,21 @@ pub fn assemble( Ok(tx) } +fn requires_auth(txn: &Transaction) -> Option { + let [op @ Operation { + body: OperationBody::InvokeHostFunction(InvokeHostFunctionOp { auth, .. }), + .. + }] = txn.operations.as_slice() + else { + return None; + }; + matches!( + auth.first().map(|x| &x.root_invocation.function), + Some(&SorobanAuthorizedFunction::ContractFn(_)) + ) + .then(move || op.clone()) +} + // Use the given source_key and signers, to sign all SorobanAuthorizationEntry's in the given // transaction. If unable to sign, return an error. fn sign_soroban_authorizations( @@ -230,18 +353,8 @@ fn sign_soroban_authorizations( network_passphrase: &str, ) -> Result, Error> { let mut tx = raw.clone(); - let mut op = match tx.operations.as_slice() { - [op @ Operation { - body: OperationBody::InvokeHostFunction(InvokeHostFunctionOp { auth, .. }), - .. - }] if matches!( - auth.first().map(|x| &x.root_invocation.function), - Some(&SorobanAuthorizedFunction::ContractFn(_)) - ) => - { - op.clone() - } - _ => return Ok(None), + let Some(mut op) = requires_auth(&tx) else { + return Ok(None); }; let Operation { @@ -378,6 +491,8 @@ fn sign_soroban_authorization_entry( Ok(auth) } +/// +/// # Errors pub fn restore(parent: &Transaction, restore: &RestorePreamble) -> Result { let transaction_data = SorobanTransactionData::from_xdr_base64(&restore.transaction_data, Limits::none())?; @@ -398,8 +513,7 @@ pub fn restore(parent: &Transaction, restore: &RestorePreamble) -> Result, pub env_meta: Vec, pub meta_base64: Option, @@ -38,7 +38,7 @@ pub enum Error { Parser(#[from] wasmparser::BinaryReaderError), } -impl ContractSpec { +impl Spec { pub fn new(bytes: &[u8]) -> Result { let mut env_meta: Option<&[u8]> = None; let mut meta: Option<&[u8]> = None; @@ -87,7 +87,7 @@ impl ContractSpec { vec![] }; - Ok(ContractSpec { + Ok(Spec { env_meta_base64, env_meta, meta_base64, @@ -108,7 +108,7 @@ impl ContractSpec { } } -impl Display for ContractSpec { +impl Display for Spec { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { if let Some(env_meta) = &self.env_meta_base64 { writeln!(f, "Env Meta: {env_meta}")?; diff --git a/cmd/crates/soroban-spec-tools/src/lib.rs b/cmd/crates/soroban-spec-tools/src/lib.rs index 7f310fd99..bc3c2a386 100644 --- a/cmd/crates/soroban-spec-tools/src/lib.rs +++ b/cmd/crates/soroban-spec-tools/src/lib.rs @@ -13,6 +13,7 @@ use stellar_xdr::curr::{ UInt128Parts, UInt256Parts, Uint256, VecM, }; +pub mod contract; pub mod utils; #[derive(thiserror::Error, Debug)] diff --git a/cmd/crates/soroban-test/tests/it/help.rs b/cmd/crates/soroban-test/tests/it/help.rs index 6d4680e77..a66c449ed 100644 --- a/cmd/crates/soroban-test/tests/it/help.rs +++ b/cmd/crates/soroban-test/tests/it/help.rs @@ -1,11 +1,11 @@ use soroban_cli::commands::contract; use soroban_test::TestEnv; -use crate::util::{invoke_custom as invoke, CUSTOM_TYPES}; +use crate::util::{invoke_custom as invoke, CUSTOM_TYPES, DEFAULT_CONTRACT_ID}; async fn invoke_custom(func: &str, args: &str) -> Result { let e = &TestEnv::default(); - invoke(e, "1", func, args, &CUSTOM_TYPES.path()).await + invoke(e, DEFAULT_CONTRACT_ID, func, args, &CUSTOM_TYPES.path()).await } #[tokio::test] diff --git a/cmd/crates/soroban-test/tests/it/integration/dotenv.rs b/cmd/crates/soroban-test/tests/it/integration/dotenv.rs index d7d56aaf3..7c0f25b3f 100644 --- a/cmd/crates/soroban-test/tests/it/integration/dotenv.rs +++ b/cmd/crates/soroban-test/tests/it/integration/dotenv.rs @@ -35,7 +35,7 @@ fn current_env_not_overwritten() { write_env_file(e, &contract_id()); e.new_assert_cmd("contract") - .env("SOROBAN_CONTRACT_ID", "2") + .env("SOROBAN_CONTRACT_ID", "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4") .arg("invoke") .arg("--") .arg("hello") @@ -51,7 +51,10 @@ fn cli_args_have_priority() { deploy_hello(e); write_env_file(e, &contract_id()); e.new_assert_cmd("contract") - .env("SOROBAN_CONTRACT_ID", "2") + .env( + "SOROBAN_CONTRACT_ID", + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + ) .arg("invoke") .arg("--id") .arg(TEST_CONTRACT_ID) diff --git a/cmd/crates/soroban-test/tests/it/integration/hello_world.rs b/cmd/crates/soroban-test/tests/it/integration/hello_world.rs index 7714f70dd..7bd8d596a 100644 --- a/cmd/crates/soroban-test/tests/it/integration/hello_world.rs +++ b/cmd/crates/soroban-test/tests/it/integration/hello_world.rs @@ -1,3 +1,4 @@ +use predicates::boolean::PredicateBooleanExt; use soroban_cli::commands::{ contract::{self, fetch}, keys, @@ -19,7 +20,23 @@ async fn invoke() { extend_contract(sandbox, id, HELLO_WORLD).await; // Note that all functions tested here have no state invoke_hello_world(sandbox, id); + sandbox + .new_assert_cmd("events") + .arg("--start-ledger=20") + .arg("--id") + .arg(id) + .assert() + .stdout(predicates::str::contains(id).not()) + .success(); invoke_hello_world_with_lib(sandbox, id).await; + sandbox + .new_assert_cmd("events") + .arg("--start-ledger=20") + .arg("--id") + .arg(id) + .assert() + .stdout(predicates::str::contains(id)) + .success(); invoke_hello_world_with_lib_two(sandbox, id).await; invoke_auth(sandbox, id); invoke_auth_with_identity(sandbox, id).await; @@ -39,6 +56,7 @@ fn invoke_hello_world(sandbox: &TestEnv, id: &str) { sandbox .new_assert_cmd("contract") .arg("invoke") + .arg("--is-view") .arg("--id") .arg(id) .arg("--") diff --git a/cmd/crates/soroban-test/tests/it/util.rs b/cmd/crates/soroban-test/tests/it/util.rs index 6d6251012..112d5f841 100644 --- a/cmd/crates/soroban-test/tests/it/util.rs +++ b/cmd/crates/soroban-test/tests/it/util.rs @@ -68,3 +68,5 @@ pub async fn invoke_custom( i.invoke(&soroban_cli::commands::global::Args::default()) .await } + +pub const DEFAULT_CONTRACT_ID: &str = "CDR6QKTWZQYW6YUJ7UP7XXZRLWQPFRV6SWBLQS4ZQOSAF4BOUD77OO5Z"; diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml index f402b5ba3..ea936d941 100644 --- a/cmd/soroban-cli/Cargo.toml +++ b/cmd/soroban-cli/Cargo.toml @@ -45,24 +45,27 @@ soroban-spec-typescript = { workspace = true } soroban-ledger-snapshot = { workspace = true } stellar-strkey = { workspace = true } soroban-sdk = { workspace = true } -clap = { version = "4.1.8", features = [ +soroban-rpc = { workspace = true } + +clap = { workspace = true, features = [ "derive", "env", "deprecated", "string", ] } +clap_complete = {workspace = true} + base64 = { workspace = true } thiserror = { workspace = true } serde = "1.0.82" serde_derive = "1.0.82" serde_json = "1.0.82" -serde-aux = "4.1.2" +serde-aux = { workspace = true } hex = { workspace = true } num-bigint = "0.4" tokio = { version = "1", features = ["full"] } -termcolor = "1.1.3" -termcolor_output = "1.0.1" -clap_complete = "4.1.4" +termcolor = { workspace = true } +termcolor_output = { workspace = true } rand = "0.8.5" wasmparser = { workspace = true } sha2 = { workspace = true } @@ -70,7 +73,7 @@ csv = "1.1.6" ed25519-dalek = "=2.0.0" jsonrpsee-http-client = "0.20.1" jsonrpsee-core = "0.20.1" -hyper = "0.14.27" +hyper = "0.14.27" hyper-tls = "0.5" http = "0.2.9" regex = "1.6.0" diff --git a/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs b/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs index 19c7eecd6..091f8255a 100644 --- a/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs +++ b/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs @@ -1,17 +1,15 @@ use std::{ffi::OsString, fmt::Debug, path::PathBuf}; use clap::{command, Parser}; +use soroban_spec_tools::contract as contract_spec; use soroban_spec_typescript::{self as typescript, boilerplate::Project}; -use crate::wasm; -use crate::{ - commands::{ - config::locator, - contract::{self, fetch}, - network::{self, Network}, - }, - utils::contract_spec::{self, ContractSpec}, +use crate::commands::{ + config::locator, + contract::{self, fetch}, + network::{self, Network}, }; +use crate::wasm; #[derive(Parser, Debug, Clone)] #[group(skip)] @@ -78,7 +76,7 @@ impl Cmd { network: self.network.clone(), }; let bytes = fetch.get_bytes().await?; - ContractSpec::new(&bytes)?.spec + contract_spec::Spec::new(&bytes)?.spec }; if self.output_dir.is_file() { return Err(Error::IsFile(self.output_dir.clone())); diff --git a/cmd/soroban-cli/src/commands/contract/extend.rs b/cmd/soroban-cli/src/commands/contract/extend.rs index 7e9f1e98c..86ea23b55 100644 --- a/cmd/soroban-cli/src/commands/contract/extend.rs +++ b/cmd/soroban-cli/src/commands/contract/extend.rs @@ -144,15 +144,18 @@ impl Cmd { }), }; - let (result, meta, events) = client + let res = client .prepare_and_send_transaction(&tx, &key, &[], &network.network_passphrase, None, None) .await?; - tracing::trace!(?result); - tracing::trace!(?meta); + let events = res.events()?; if !events.is_empty() { tracing::info!("Events:\n {events:#?}"); } + let meta = res + .result_meta + .as_ref() + .ok_or(Error::MissingOperationResult)?; // The transaction from core will succeed regardless of whether it actually found & extended // the entry, so we have to inspect the result meta to tell if it worked or not. diff --git a/cmd/soroban-cli/src/commands/contract/inspect.rs b/cmd/soroban-cli/src/commands/contract/inspect.rs index 355c18ca8..e66bf83fd 100644 --- a/cmd/soroban-cli/src/commands/contract/inspect.rs +++ b/cmd/soroban-cli/src/commands/contract/inspect.rs @@ -1,5 +1,6 @@ use clap::{command, Parser}; use soroban_env_host::xdr; +use soroban_spec_tools::contract; use std::{fmt::Debug, path::PathBuf}; use tracing::debug; @@ -28,7 +29,7 @@ pub enum Error { #[error(transparent)] Xdr(#[from] xdr::Error), #[error(transparent)] - Spec(#[from] crate::utils::contract_spec::Error), + Spec(#[from] contract::Error), } impl Cmd { diff --git a/cmd/soroban-cli/src/commands/contract/install.rs b/cmd/soroban-cli/src/commands/contract/install.rs index 905775298..c2fa6d889 100644 --- a/cmd/soroban-cli/src/commands/contract/install.rs +++ b/cmd/soroban-cli/src/commands/contract/install.rs @@ -112,14 +112,10 @@ impl Cmd { build_install_contract_code_tx(contract, sequence + 1, self.fee.fee, &key)?; // Currently internal errors are not returned if the contract code is expired - if let ( - TransactionResult { - result: TransactionResultResult::TxInternalError, - .. - }, - _, - _, - ) = client + if let Some(TransactionResult { + result: TransactionResultResult::TxInternalError, + .. + }) = client .prepare_and_send_transaction( &tx_without_preflight, &key, @@ -129,6 +125,8 @@ impl Cmd { None, ) .await? + .result + .as_ref() { // Now just need to restore it and don't have to install again restore::Cmd { @@ -153,7 +151,7 @@ impl Cmd { } } -fn get_contract_meta_sdk_version(wasm_spec: &utils::contract_spec::ContractSpec) -> Option { +fn get_contract_meta_sdk_version(wasm_spec: &soroban_spec_tools::contract::Spec) -> Option { let rs_sdk_version_option = if let Some(_meta) = &wasm_spec.meta_base64 { wasm_spec.meta.iter().find(|entry| match entry { ScMetaEntry::ScMetaV0(ScMetaV0 { key, .. }) => { diff --git a/cmd/soroban-cli/src/commands/contract/invoke.rs b/cmd/soroban-cli/src/commands/contract/invoke.rs index 669342b06..720c3c6f8 100644 --- a/cmd/soroban-cli/src/commands/contract/invoke.rs +++ b/cmd/soroban-cli/src/commands/contract/invoke.rs @@ -28,13 +28,8 @@ use super::super::{ config::{self, locator}, events, }; -use crate::{ - commands::global, - rpc::{self, Client}, - utils::{self, contract_spec}, - Pwd, -}; -use soroban_spec_tools::Spec; +use crate::{commands::global, rpc, Pwd}; +use soroban_spec_tools::{contract, Spec}; #[derive(Parser, Debug, Default, Clone)] #[allow(clippy::struct_excessive_bools)] @@ -49,6 +44,12 @@ pub struct Cmd { /// Output the cost execution to stderr #[arg(long = "cost")] pub cost: bool, + /// Number of instructions to simulate + #[arg(long)] + pub instructions: Option, + /// Do not sign and submit transaction + #[arg(long, env = "SOROBAN_INVOKE_SIGN", env = "SYSTEM_TEST_VERBOSE_OUTPUT")] + pub is_view: bool, /// Function name as subcommand, then arguments for that function as `--arg-name value` #[arg(last = true, id = "CONTRACT_FN_AND_ARGS")] pub slop: Vec, @@ -140,7 +141,7 @@ pub enum Error { #[error(transparent)] StrKey(#[from] stellar_strkey::DecodeError), #[error(transparent)] - ContractSpec(#[from] contract_spec::Error), + ContractSpec(#[from] contract::Error), #[error("")] MissingFileArg(PathBuf), } @@ -275,7 +276,7 @@ impl Cmd { // For testing wasm arg parsing let _ = self.build_host_function_parameters(contract_id, spec_entries)?; } - let client = Client::new(&network.rpc_url)?; + let client = rpc::Client::new(&network.rpc_url)?; client .verify_network_passphrase(Some(&network.network_passphrase)) .await?; @@ -299,29 +300,31 @@ impl Cmd { self.fee.fee, &key, )?; - - let (result, meta, events) = client - .prepare_and_send_transaction( - &tx, - &key, - &signers, - &network.network_passphrase, - Some(log_events), - (global_args.verbose || global_args.very_verbose || self.cost) - .then_some(log_resources), + let mut txn = client.create_assembled_transaction(&tx).await?; + if let Some(instructions) = self.instructions { + txn = txn.set_max_instructions(instructions); + } + let (return_value, events) = if self.is_view { + ( + txn.sim_response().results()?[0].xdr.clone(), + txn.sim_response().events()?, ) - .await?; - - tracing::debug!(?result); - crate::log::diagnostic_events(&events, tracing::Level::INFO); - let xdr::TransactionMeta::V3(xdr::TransactionMetaV3 { - soroban_meta: Some(xdr::SorobanTransactionMeta { return_value, .. }), - .. - }) = meta - else { - return Err(Error::MissingOperationResult); + } else { + let res = client + .send_assembled_transaction( + txn, + &key, + &signers, + &network.network_passphrase, + Some(log_events), + (global_args.verbose || global_args.very_verbose || self.cost) + .then_some(log_resources), + ) + .await?; + (res.return_value()?, res.contract_events()?) }; + crate::log::diagnostic_events(&events, tracing::Level::INFO); output_to_string(&spec, &return_value, &function) } @@ -344,7 +347,7 @@ impl Cmd { impl Cmd { fn contract_id(&self) -> Result<[u8; 32], Error> { - utils::contract_id_from_str(&self.contract_id) + soroban_spec_tools::utils::contract_id_from_str(&self.contract_id) .map_err(|e| Error::CannotParseContractId(self.contract_id.clone(), e)) } } diff --git a/cmd/soroban-cli/src/commands/contract/read.rs b/cmd/soroban-cli/src/commands/contract/read.rs index 842832d5f..f25b6c2c0 100644 --- a/cmd/soroban-cli/src/commands/contract/read.rs +++ b/cmd/soroban-cli/src/commands/contract/read.rs @@ -120,7 +120,7 @@ impl Cmd { let ( LedgerKey::ContractData(LedgerKeyContractData { key, .. }), LedgerEntryData::ContractData(ContractDataEntry { val, .. }), - ) = (key, val) + ) = &(key, val) else { return Err(Error::OnlyDataAllowed); }; diff --git a/cmd/soroban-cli/src/commands/contract/restore.rs b/cmd/soroban-cli/src/commands/contract/restore.rs index 38b8a84a1..6ed39f892 100644 --- a/cmd/soroban-cli/src/commands/contract/restore.rs +++ b/cmd/soroban-cli/src/commands/contract/restore.rs @@ -148,11 +148,15 @@ impl Cmd { }), }; - let (result, meta, events) = client + let res = client .prepare_and_send_transaction(&tx, &key, &[], &network.network_passphrase, None, None) .await?; - tracing::trace!(?result); + let meta = res + .result_meta + .as_ref() + .ok_or(Error::MissingOperationResult)?; + let events = res.events()?; tracing::trace!(?meta); if !events.is_empty() { tracing::info!("Events:\n {events:#?}"); @@ -177,7 +181,7 @@ impl Cmd { operations[0].changes.len() ); } - parse_operations(&operations).ok_or(Error::MissingOperationResult) + parse_operations(operations).ok_or(Error::MissingOperationResult) } } diff --git a/cmd/soroban-cli/src/key.rs b/cmd/soroban-cli/src/key.rs index e9901abd2..2290e857e 100644 --- a/cmd/soroban-cli/src/key.rs +++ b/cmd/soroban-cli/src/key.rs @@ -59,7 +59,7 @@ pub struct Args { )] pub wasm_hash: Option, /// Storage entry durability - #[arg(long, value_enum, required = true)] + #[arg(long, value_enum, required = true, default_value = "persistent")] pub durability: Durability, } @@ -83,7 +83,7 @@ impl Args { } else if let Some(wasm_hash) = &self.wasm_hash { return Ok(vec![LedgerKey::ContractCode(LedgerKeyContractCode { hash: xdr::Hash( - utils::contract_id_from_str(wasm_hash) + soroban_spec_tools::utils::contract_id_from_str(wasm_hash) .map_err(|e| Error::CannotParseContractId(wasm_hash.clone(), e))?, ), })]); diff --git a/cmd/soroban-cli/src/lib.rs b/cmd/soroban-cli/src/lib.rs index 3aad487c8..ef443853b 100644 --- a/cmd/soroban-cli/src/lib.rs +++ b/cmd/soroban-cli/src/lib.rs @@ -3,17 +3,17 @@ clippy::must_use_candidate, clippy::missing_panics_doc )] +pub(crate) use soroban_rpc as rpc; +use std::path::Path; + pub mod commands; pub mod fee; pub mod key; pub mod log; -pub mod rpc; pub mod toid; pub mod utils; pub mod wasm; -use std::path::Path; - pub use commands::Root; pub fn parse_cmd(s: &str) -> Result diff --git a/cmd/soroban-cli/src/utils.rs b/cmd/soroban-cli/src/utils.rs index ff0018a94..97fc9bfcc 100644 --- a/cmd/soroban-cli/src/utils.rs +++ b/cmd/soroban-cli/src/utils.rs @@ -9,7 +9,7 @@ use soroban_env_host::xdr::{ TransactionV1Envelope, WriteXdr, }; -pub mod contract_spec; +pub use soroban_spec_tools::contract as contract_spec; /// # Errors /// @@ -55,16 +55,17 @@ pub fn sign_transaction( /// /// Might return an error pub fn contract_id_from_str(contract_id: &str) -> Result<[u8; 32], stellar_strkey::DecodeError> { - stellar_strkey::Contract::from_string(contract_id) - .map(|strkey| strkey.0) - .or_else(|_| { + Ok( + if let Ok(strkey) = stellar_strkey::Contract::from_string(contract_id) { + strkey.0 + } else { // strkey failed, try to parse it as a hex string, for backwards compatibility. soroban_spec_tools::utils::padded_hex_from_str(contract_id, 32) .map_err(|_| stellar_strkey::DecodeError::Invalid)? .try_into() - .map_err(|_| stellar_strkey::DecodeError::Invalid) - }) - .map_err(|_| stellar_strkey::DecodeError::Invalid) + .map_err(|_| stellar_strkey::DecodeError::Invalid)? + }, + ) } /// # Errors @@ -198,47 +199,5 @@ mod tests { ), Err(err) => panic!("Failed to parse contract id: {err}"), } - - // hex - match contract_id_from_str( - "363eaa3867841fbad0f4ed88c779e4fe66e56a2470dc98c0ec9c073d05c7b103", - ) { - Ok(contract_id) => assert_eq!( - contract_id, - [ - 0x36, 0x3e, 0xaa, 0x38, 0x67, 0x84, 0x1f, 0xba, 0xd0, 0xf4, 0xed, 0x88, 0xc7, - 0x79, 0xe4, 0xfe, 0x66, 0xe5, 0x6a, 0x24, 0x70, 0xdc, 0x98, 0xc0, 0xec, 0x9c, - 0x07, 0x3d, 0x05, 0xc7, 0xb1, 0x03, - ] - ), - Err(err) => panic!("Failed to parse contract id: {err}"), - } - - // unpadded-hex - match contract_id_from_str("1") { - Ok(contract_id) => assert_eq!( - contract_id, - [ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - ] - ), - Err(err) => panic!("Failed to parse contract id: {err}"), - } - - // invalid hex - match contract_id_from_str("foobar") { - Ok(_) => panic!("Expected parsing to fail"), - Err(err) => assert_eq!(err, stellar_strkey::DecodeError::Invalid), - } - - // hex too long (33 bytes) - match contract_id_from_str( - "000000000000000000000000000000000000000000000000000000000000000000", - ) { - Ok(_) => panic!("Expected parsing to fail"), - Err(err) => assert_eq!(err, stellar_strkey::DecodeError::Invalid), - } } } diff --git a/cmd/soroban-cli/src/wasm.rs b/cmd/soroban-cli/src/wasm.rs index fce44c7c5..4b8a7f8ca 100644 --- a/cmd/soroban-cli/src/wasm.rs +++ b/cmd/soroban-cli/src/wasm.rs @@ -1,11 +1,12 @@ use clap::arg; use soroban_env_host::xdr::{self, LedgerKey, LedgerKeyContractCode}; +use soroban_spec_tools::contract::{self, Spec}; use std::{ fs, io, path::{Path, PathBuf}, }; -use crate::utils::{self, contract_spec::ContractSpec}; +use crate::utils::{self}; #[derive(thiserror::Error, Debug)] pub enum Error { @@ -25,7 +26,7 @@ pub enum Error { #[error(transparent)] Parser(#[from] wasmparser::BinaryReaderError), #[error(transparent)] - ContractSpec(#[from] crate::utils::contract_spec::Error), + ContractSpec(#[from] contract::Error), } #[derive(Debug, clap::Args, Clone)] @@ -60,9 +61,9 @@ impl Args { /// # Errors /// May fail to read wasm file or parse xdr section - pub fn parse(&self) -> Result { + pub fn parse(&self) -> Result { let contents = self.read()?; - Ok(ContractSpec::new(&contents)?) + Ok(Spec::new(&contents)?) } } diff --git a/docs/soroban-cli-full-docs.md b/docs/soroban-cli-full-docs.md index 34ab0caa2..e33794a22 100644 --- a/docs/soroban-cli-full-docs.md +++ b/docs/soroban-cli-full-docs.md @@ -110,13 +110,28 @@ Full CLI reference: https://github.com/stellar/soroban-tools/tree/main/docs/soro ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `-f`, `--filter-logs ` — Filter logs output. To turn on "soroban_cli::log::footprint=debug" or off "=off". Can also use env var `RUST_LOG` * `-q`, `--quiet` — Do not write logs to stderr including `INFO` + + Possible values: `true`, `false` + * `-v`, `--verbose` — Log DEBUG events + + Possible values: `true`, `false` + * `--very-verbose` — Log DEBUG and TRACE events + + Possible values: `true`, `false` + * `--list` — List installed plugins. E.g. `soroban-hello` + Possible values: `true`, `false` + + ## `soroban completion` @@ -185,6 +200,9 @@ Add a new network * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -202,6 +220,9 @@ Remove a network ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -215,9 +236,15 @@ List networks ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` — Get more info about the networks + Possible values: `true`, `false` + + ## `soroban config identity` @@ -251,8 +278,17 @@ Add a new identity (keypair, ledger, macOS keychain) ###### **Options:** * `--secret-key` — Add using secret_key Can provide with SOROBAN_SECRET_KEY + + Possible values: `true`, `false` + * `--seed-phrase` — Add using 12 word seed phrase to generate secret_key + + Possible values: `true`, `false` + * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -271,6 +307,9 @@ Given an identity return its address (public key) * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -292,6 +331,9 @@ Fund an identity on a test network * `--network ` — Name of network to use from config * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -309,12 +351,24 @@ Generate a new identity with a seed phrase, currently 12 words ###### **Options:** * `--no-fund` — Do not fund address + + Possible values: `true`, `false` + * `--seed ` — Optional seed to use when generating seed phrase. Random otherwise * `-s`, `--as-secret` — Output the generated identity as a secret key + + Possible values: `true`, `false` + * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--hd-path ` — When generating a secret key, which hd_path should be used from the original seed_phrase * `-d`, `--default-seed` — Generate the default seed phrase. Useful for testing. Equivalent to --seed 0000000000000000 + + Possible values: `true`, `false` + * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config @@ -330,9 +384,15 @@ List identities ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` + Possible values: `true`, `false` + + ## `soroban config identity rm` @@ -348,6 +408,9 @@ Remove an identity ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -366,6 +429,9 @@ Given an identity return its private key * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -423,6 +489,9 @@ Get Id of builtin Soroban Asset Contract. Deprecated, use `soroban contract id a * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -442,6 +511,9 @@ Deploy builtin Soroban Asset Contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -498,8 +570,14 @@ Generate a TypeScript / JavaScript package * `--wasm ` — Path to optional wasm binary * `--output-dir ` — Where to place generated project * `--overwrite` — Whether to overwrite output directory if it already exists + + Possible values: `true`, `false` + * `--contract-id ` — The contract ID/address on the network * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -528,10 +606,19 @@ To view the commands that will be executed, without executing them, use the --pr Default value: `release` * `--features ` — Build with the list of features activated, space or comma separated * `--all-features` — Build with the all features activated + + Possible values: `true`, `false` + * `--no-default-features` — Build with the default feature not activated + + Possible values: `true`, `false` + * `--out-dir ` — Directory to copy wasm files to * `--print-commands-only` — Print commands to build without executing them + Possible values: `true`, `false` + + ## `soroban contract extend` @@ -546,6 +633,9 @@ If no keys are specified the contract itself is extended. * `--ledgers-to-extend ` — Number of ledgers to extend the entries * `--ttl-ledger-only` — Only print the new Time To Live ledger + + Possible values: `true`, `false` + * `--id ` — Contract ID to which owns the data entries. If no keys provided the Contract's instance will be extended * `--key ` — Storage key (symbols only) * `--key-xdr ` — Storage key (base64-encoded XDR) @@ -553,6 +643,8 @@ If no keys are specified the contract itself is extended. * `--wasm-hash ` — Path to Wasm file of contract code to extend * `--durability ` — Storage entry durability + Default value: `persistent` + Possible values: - `persistent`: Persistent @@ -565,6 +657,9 @@ If no keys are specified the contract itself is extended. * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -589,6 +684,9 @@ Deploy a wasm contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -597,6 +695,9 @@ Deploy a wasm contract Default value: `false` + Possible values: `true`, `false` + + ## `soroban contract fetch` @@ -610,6 +711,9 @@ Fetch a contract's Wasm binary * `--id ` — Contract ID to fetch * `-o`, `--out-file ` — Where to write output otherwise stdout is used * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -645,6 +749,9 @@ Deploy builtin Soroban Asset Contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -664,6 +771,9 @@ Deploy normal Wasm Contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -709,6 +819,9 @@ Inspect a WASM file listing contract functions, meta, etc Pretty print of contract spec entries * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -727,6 +840,9 @@ Install a WASM file to the ledger without creating a contract instance * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -736,6 +852,9 @@ Install a WASM file to the ledger without creating a contract instance Default value: `false` + Possible values: `true`, `false` + + ## `soroban contract invoke` @@ -756,12 +875,23 @@ soroban contract invoke ... -- --help * `--id ` — Contract ID to invoke * `--cost` — Output the cost execution to stderr + + Possible values: `true`, `false` + +* `--instructions ` — Number of instructions to simulate +* `--is-view` — Do not sign and submit transaction + + Possible values: `true`, `false` + * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -809,6 +939,8 @@ Print the current value of a contract-data ledger entry * `--wasm-hash ` — Path to Wasm file of contract code to extend * `--durability ` — Storage entry durability + Default value: `persistent` + Possible values: - `persistent`: Persistent @@ -821,6 +953,9 @@ Print the current value of a contract-data ledger entry * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -842,6 +977,8 @@ If no keys are specificed the contract itself is restored. * `--wasm-hash ` — Path to Wasm file of contract code to extend * `--durability ` — Storage entry durability + Default value: `persistent` + Possible values: - `persistent`: Persistent @@ -850,12 +987,18 @@ If no keys are specificed the contract itself is restored. * `--ledgers-to-extend ` — Number of ledgers to extend the entry * `--ttl-ledger-only` — Only print the new Time To Live ledger + + Possible values: `true`, `false` + * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -897,6 +1040,9 @@ Watch the network for contract events Possible values: `all`, `contract`, `system` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -935,8 +1081,17 @@ Add a new identity (keypair, ledger, macOS keychain) ###### **Options:** * `--secret-key` — Add using secret_key Can provide with SOROBAN_SECRET_KEY + + Possible values: `true`, `false` + * `--seed-phrase` — Add using 12 word seed phrase to generate secret_key + + Possible values: `true`, `false` + * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -955,6 +1110,9 @@ Given an identity return its address (public key) * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -976,6 +1134,9 @@ Fund an identity on a test network * `--network ` — Name of network to use from config * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -993,12 +1154,24 @@ Generate a new identity with a seed phrase, currently 12 words ###### **Options:** * `--no-fund` — Do not fund address + + Possible values: `true`, `false` + * `--seed ` — Optional seed to use when generating seed phrase. Random otherwise * `-s`, `--as-secret` — Output the generated identity as a secret key + + Possible values: `true`, `false` + * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--hd-path ` — When generating a secret key, which hd_path should be used from the original seed_phrase * `-d`, `--default-seed` — Generate the default seed phrase. Useful for testing. Equivalent to --seed 0000000000000000 + + Possible values: `true`, `false` + * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config @@ -1014,9 +1187,15 @@ List identities ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` + Possible values: `true`, `false` + + ## `soroban keys rm` @@ -1032,6 +1211,9 @@ Remove an identity ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -1050,6 +1232,9 @@ Given an identity return its private key * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -1095,6 +1280,9 @@ Deploy a token contract to wrap an existing Stellar classic asset for smart cont * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -1117,6 +1305,9 @@ Compute the expected contract id for the given asset Deprecated, use `soroban co * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -1296,6 +1487,9 @@ Add a new network * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -1313,6 +1507,9 @@ Remove a network ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." @@ -1326,9 +1523,15 @@ List networks ###### **Options:** * `--global` — Use global config + + Possible values: `true`, `false` + * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` — Get more info about the networks + Possible values: `true`, `false` + + ## `soroban version` From f3a653d25374676ed113a5f9983050f7b808800e Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Tue, 6 Feb 2024 12:01:43 -0800 Subject: [PATCH 4/5] Revert "[Epic] Separating soroban-rpc to prepare for repo change (#1174)" (#1193) This reverts commit 2581f6298fbf3c5399354032d809ec0fd43735e5. --- Cargo.lock | 497 +++++++++--------- Cargo.toml | 28 +- cmd/crates/soroban-rpc/Cargo.toml | 51 -- cmd/crates/soroban-rpc/README.md | 3 - cmd/crates/soroban-rpc/src/log.rs | 2 - .../soroban-rpc/src/log/diagnostic_events.rs | 11 - cmd/crates/soroban-spec-tools/Cargo.toml | 2 - cmd/crates/soroban-spec-tools/src/lib.rs | 1 - cmd/crates/soroban-test/tests/it/help.rs | 4 +- .../tests/it/integration/dotenv.rs | 7 +- .../tests/it/integration/hello_world.rs | 18 - cmd/crates/soroban-test/tests/it/util.rs | 2 - cmd/soroban-cli/Cargo.toml | 15 +- .../commands/contract/bindings/typescript.rs | 16 +- .../src/commands/contract/extend.rs | 9 +- .../src/commands/contract/inspect.rs | 3 +- .../src/commands/contract/install.rs | 16 +- .../src/commands/contract/invoke.rs | 63 ++- cmd/soroban-cli/src/commands/contract/read.rs | 2 +- .../src/commands/contract/restore.rs | 10 +- cmd/soroban-cli/src/key.rs | 4 +- cmd/soroban-cli/src/lib.rs | 6 +- .../src/rpc}/fixtures/event_response.json | 0 .../src/lib.rs => soroban-cli/src/rpc/mod.rs} | 170 +----- .../src => soroban-cli/src/rpc}/txn.rs | 166 +----- cmd/soroban-cli/src/utils.rs | 57 +- .../src/utils/contract_spec.rs} | 8 +- cmd/soroban-cli/src/wasm.rs | 9 +- docs/soroban-cli-full-docs.md | 203 ------- 29 files changed, 435 insertions(+), 948 deletions(-) delete mode 100644 cmd/crates/soroban-rpc/Cargo.toml delete mode 100644 cmd/crates/soroban-rpc/README.md delete mode 100644 cmd/crates/soroban-rpc/src/log.rs delete mode 100644 cmd/crates/soroban-rpc/src/log/diagnostic_events.rs rename cmd/{crates/soroban-rpc/src => soroban-cli/src/rpc}/fixtures/event_response.json (100%) rename cmd/{crates/soroban-rpc/src/lib.rs => soroban-cli/src/rpc/mod.rs} (92%) rename cmd/{crates/soroban-rpc/src => soroban-cli/src/rpc}/txn.rs (82%) rename cmd/{crates/soroban-spec-tools/src/contract.rs => soroban-cli/src/utils/contract_spec.rs} (98%) diff --git a/Cargo.lock b/Cargo.lock index 54a37d370..8456daacc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,9 +43,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.11" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" dependencies = [ "anstyle", "anstyle-parse", @@ -91,9 +91,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "arbitrary" @@ -112,14 +112,14 @@ checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" [[package]] name = "assert_cmd" -version = "2.0.13" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00ad3f3a942eee60335ab4342358c161ee296829e0d16ff42fc1d6cb07815467" +checksum = "88903cb14723e4d4003335bb7f8a14f27691649105346a0f0957466c096adfe6" dependencies = [ "anstyle", "bstr", "doc-comment", - "predicates 3.1.0", + "predicates 3.0.4", "predicates-core", "predicates-tree", "wait-timeout", @@ -127,14 +127,14 @@ dependencies = [ [[package]] name = "assert_fs" -version = "1.1.1" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cd762e110c8ed629b11b6cde59458cc1c71de78ebbcc30099fc8e0403a2a2ec" +checksum = "f070617a68e5c2ed5d06ee8dd620ee18fb72b99f6c094bed34cf8ab07c875b48" dependencies = [ "anstyle", "doc-comment", "globwalk", - "predicates 3.1.0", + "predicates 3.0.4", "predicates-core", "predicates-tree", "tempfile", @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.76" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "531b97fb4cd3dfdce92c35dedbfdc1f0b9d8091c8ca943d6dae340ef5012d514" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", @@ -192,9 +192,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.7" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -219,9 +219,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "block-buffer" @@ -243,12 +243,12 @@ dependencies = [ [[package]] name = "bstr" -version = "1.9.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" +checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" dependencies = [ "memchr", - "regex-automata 0.4.5", + "regex-automata 0.4.3", "serde", ] @@ -302,9 +302,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.6" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" +checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" dependencies = [ "serde", ] @@ -341,9 +341,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", @@ -351,14 +351,14 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.0", + "windows-targets 0.48.5", ] [[package]] name = "clap" -version = "4.4.18" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" dependencies = [ "clap_builder", "clap_derive", @@ -375,9 +375,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" dependencies = [ "anstream", "anstyle", @@ -387,9 +387,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.4.9" +version = "4.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df631ae429f6613fcd3a7c1adbdb65f637271e561b03680adaa6573015dfb106" +checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae" dependencies = [ "clap", ] @@ -436,9 +436,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "const-oid" -version = "0.9.6" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "core-foundation" @@ -458,9 +458,9 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -498,37 +498,45 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.11" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" dependencies = [ + "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" dependencies = [ + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.18" +version = "0.9.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" dependencies = [ + "autocfg", + "cfg-if", "crossbeam-utils", + "memoffset", ] [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" +dependencies = [ + "cfg-if", +] [[package]] name = "crypto-bigint" @@ -636,9 +644,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.112" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ab30434ea0ff6aa640a08dda5284026a366d47565496fd40b6cbfbdd7e31a2" +checksum = "7129e341034ecb940c9072817cd9007974ea696844fc4dd582dc1653a7fbe2e8" dependencies = [ "cc", "cxxbridge-flags", @@ -648,9 +656,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.112" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b649d7dfae8268450d53d109388b337b9352c7cba1fc10db4a1bc23c3dc189fb" +checksum = "a2a24f3f5f8eed71936f21e570436f024f5c2e25628f7496aa7ccd03b90109d5" dependencies = [ "cc", "codespan-reporting", @@ -663,15 +671,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.112" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42281b20eba5218c539295c667c18e2f50211bb11902419194c6ed1ae808e547" +checksum = "06fdd177fc61050d63f67f5bd6351fac6ab5526694ea8e359cd9cd3b75857f44" [[package]] name = "cxxbridge-macro" -version = "1.0.112" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45506e3c66512b0a65d291a6b452128b7b1dd9841e20d1e151addbd2c00ea50" +checksum = "587663dd5fb3d10932c8aecfe7c844db1bcf0aee93eeab08fac13dc1212c2e7f" dependencies = [ "proc-macro2", "quote", @@ -731,9 +739,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.11" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" dependencies = [ "powerfmt", "serde", @@ -1069,18 +1077,18 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-io" @@ -1090,21 +1098,21 @@ checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-core", "futures-io", @@ -1269,7 +1277,7 @@ dependencies = [ "gix-chunk", "gix-features", "gix-hash", - "memmap2 0.9.4", + "memmap2 0.9.3", "thiserror", ] @@ -1296,11 +1304,11 @@ dependencies = [ [[package]] name = "gix-config-value" -version = "0.14.4" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e7bfb37a46ed0b8468db37a6d8a0a61d56bdbe4603ae492cb322e5f3958" +checksum = "52e0be46f4cf1f8f9e88d0e3eb7b29718aff23889563249f379119bd1ab6910e" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.4.1", "bstr", "gix-path", "libc", @@ -1415,7 +1423,7 @@ version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5db19298c5eeea2961e5b3bf190767a2d1f09b8802aeb5f258e42276350aff19" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.4.1", "bstr", "gix-features", "gix-path", @@ -1460,7 +1468,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c83a4fcc121b2f2e109088f677f89f85e7a8ebf39e8e6659c0ae54d4283b1650" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.4.1", "bstr", "btoi", "filetime", @@ -1505,7 +1513,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a5cdcf491ecc9ce39dcc227216c540355fe0024ae7c38e94557752ca5ebb67f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.4.1", "gix-commitgraph", "gix-date", "gix-hash", @@ -1597,9 +1605,9 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.10.5" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97e9ad649bf5e109562d6acba657ca428661ec08e77eaf3a755d8fa55485be9c" +checksum = "b8dd0998ab245f33d40ca2267e58d542fe54185ebd1dc41923346cf28d179fb6" dependencies = [ "bstr", "gix-trace", @@ -1614,7 +1622,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dbbb92f75a38ef043c8bb830b339b38d0698d7f3746968b5fcbade7a880494d" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.4.1", "bstr", "gix-attributes", "gix-config-value", @@ -1733,14 +1741,14 @@ dependencies = [ [[package]] name = "gix-sec" -version = "0.10.4" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8d9bf462feaf05f2121cba7399dbc6c34d88a9cad58fc1e95027791d6a3c6d2" +checksum = "78f6dce0c6683e2219e8169aac4b1c29e89540a8262fef7056b31d80d969408c" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.4.1", "gix-path", "libc", - "windows-sys 0.52.0", + "windows", ] [[package]] @@ -1773,9 +1781,9 @@ dependencies = [ [[package]] name = "gix-trace" -version = "0.1.7" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b202d766a7fefc596e2cc6a89cda8ad8ad733aed82da635ac120691112a9b1" +checksum = "e8e1127ede0475b58f4fe9c0aaa0d9bb0bad2af90bbd93ccd307c8632b863d89" [[package]] name = "gix-transport" @@ -1783,7 +1791,7 @@ version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f209a93364e24f20319751bc11092272e2f3fe82bb72592b2822679cf5be752" dependencies = [ - "base64 0.21.7", + "base64 0.21.5", "bstr", "gix-command", "gix-credentials", @@ -1828,12 +1836,11 @@ dependencies = [ [[package]] name = "gix-utils" -version = "0.1.9" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e839f3d0798b296411263da6bee780a176ef8008a5dfc31287f7eda9266ab8" +checksum = "de6225e2de30b6e9bca2d9f1cc4731640fcef0fb3cabddceee366e7e85d3e94f" dependencies = [ "fastrand", - "unicode-normalization", ] [[package]] @@ -1899,17 +1906,17 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.5", + "regex-automata 0.4.3", "regex-syntax 0.8.2", ] [[package]] name = "globwalk" -version = "0.9.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" +checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" dependencies = [ - "bitflags 2.4.2", + "bitflags 1.3.2", "ignore", "walkdir", ] @@ -1927,16 +1934,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.11", + "http", "indexmap 2.1.0", "slab", "tokio", @@ -1964,9 +1971,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -2004,11 +2011,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.9" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] @@ -2033,17 +2040,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http-body" version = "0.4.6" @@ -2051,7 +2047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http 0.2.11", + "http", "pin-project-lite", ] @@ -2069,22 +2065,22 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", "h2", - "http 0.2.11", + "http", "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -2098,7 +2094,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http 0.2.11", + "http", "hyper", "log", "rustls", @@ -2122,16 +2118,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.59" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.51.1", ] [[package]] @@ -2171,15 +2167,15 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.22" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +checksum = "747ad1b4ae841a78e8aba0d63adbfbeaea26b517b63705d47856b73015d27060" dependencies = [ "crossbeam-deque", "globset", "log", "memchr", - "regex-automata 0.4.5", + "regex-automata 0.4.3", "same-file", "walkdir", "winapi-util", @@ -2249,7 +2245,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2", + "socket2 0.5.5", "widestring", "windows-sys 0.48.0", "winreg", @@ -2296,9 +2292,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" dependencies = [ "wasm-bindgen", ] @@ -2372,9 +2368,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.5" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" dependencies = [ "cpufeatures", ] @@ -2396,9 +2392,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "libm" @@ -2412,7 +2408,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.4.1", "libc", "redox_syscall", ] @@ -2434,9 +2430,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "lock_api" @@ -2491,9 +2487,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memmap2" @@ -2506,13 +2502,22 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.9.4" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" +checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92" dependencies = [ "libc", ] +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "mime" version = "0.3.17" @@ -2635,9 +2640,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -2656,11 +2661,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.63" +version = "0.10.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" +checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.4.1", "cfg-if", "foreign-types", "libc", @@ -2697,9 +2702,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.99" +version = "0.9.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" +checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" dependencies = [ "cc", "libc", @@ -2766,18 +2771,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.4" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.4" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", @@ -2808,15 +2813,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "platforms" -version = "3.3.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" +checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" [[package]] name = "powerfmt" @@ -2846,12 +2851,13 @@ dependencies = [ [[package]] name = "predicates" -version = "3.1.0" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" +checksum = "6dfc28575c2e3f19cb3c73b93af36460ae898d426eba6fc15b9bd2a5220758a0" dependencies = [ "anstyle", "difflib", + "itertools 0.11.0", "predicates-core", ] @@ -2875,7 +2881,7 @@ dependencies = [ name = "preflight" version = "20.2.0" dependencies = [ - "base64 0.21.7", + "base64 0.21.5", "libc", "sha2 0.10.8", "soroban-env-host", @@ -2990,13 +2996,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.5", + "regex-automata 0.4.3", "regex-syntax 0.8.2", ] @@ -3011,9 +3017,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -3038,13 +3044,13 @@ version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ - "base64 0.21.7", + "base64 0.21.5", "bytes", "encoding_rs", "futures-core", "futures-util", "h2", - "http 0.2.11", + "http", "http-body", "hyper", "hyper-rustls", @@ -3151,11 +3157,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.30" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -3192,7 +3198,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.7", + "base64 0.21.5", ] [[package]] @@ -3228,11 +3234,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] @@ -3326,9 +3332,9 @@ dependencies = [ [[package]] name = "serde-aux" -version = "4.4.0" +version = "4.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a86348501c129f3ad50c2f4635a01971f76974cd8a3f335988a0f1581c082765" +checksum = "184eba62ebddb71658697c8b08822edee89970bf318c5362189f0de27f85b498" dependencies = [ "chrono", "serde", @@ -3371,11 +3377,11 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.5.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5c9fdb6b00a489875b22efd4b78fe2b363b72265cc5f6eb2e2b9ee270e6140c" +checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" dependencies = [ - "base64 0.21.7", + "base64 0.21.5", "chrono", "hex", "indexmap 1.9.3", @@ -3388,9 +3394,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.5.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbff351eb4b33600a2e138dfa0b10b65a238ea8ff8fb2387c422c5022a3e8298" +checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" dependencies = [ "darling", "proc-macro2", @@ -3449,9 +3455,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.3.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" [[package]] name = "signal-hook-registry" @@ -3500,9 +3506,19 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" + +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] [[package]] name = "socket2" @@ -3531,7 +3547,7 @@ version = "20.2.0" dependencies = [ "assert_cmd", "assert_fs", - "base64 0.21.7", + "base64 0.21.5", "cargo_metadata", "chrono", "clap", @@ -3546,7 +3562,7 @@ dependencies = [ "gix", "heck", "hex", - "http 0.2.11", + "http", "hyper", "hyper-tls", "itertools 0.10.5", @@ -3568,7 +3584,6 @@ dependencies = [ "shlex", "soroban-env-host", "soroban-ledger-snapshot", - "soroban-rpc", "soroban-sdk", "soroban-spec", "soroban-spec-json", @@ -3676,38 +3691,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "soroban-rpc" -version = "20.3.0" -dependencies = [ - "base64 0.21.7", - "clap", - "ed25519-dalek 2.0.0", - "ethnum", - "hex", - "http 1.0.0", - "itertools 0.10.5", - "jsonrpsee-core", - "jsonrpsee-http-client", - "serde", - "serde-aux", - "serde_json", - "sha2 0.10.8", - "soroban-env-host", - "soroban-sdk", - "soroban-spec", - "soroban-spec-tools", - "stellar-strkey 0.0.7", - "stellar-xdr", - "termcolor", - "termcolor_output", - "thiserror", - "tokio", - "tracing", - "wasmparser 0.90.0", - "which", -] - [[package]] name = "soroban-sdk" version = "20.3.0" @@ -3802,12 +3785,11 @@ dependencies = [ name = "soroban-spec-tools" version = "20.3.0" dependencies = [ - "base64 0.21.7", + "base64 0.21.5", "ethnum", "hex", "itertools 0.10.5", "serde_json", - "soroban-env-host", "soroban-spec", "stellar-strkey 0.0.7", "stellar-xdr", @@ -3821,7 +3803,7 @@ dependencies = [ name = "soroban-spec-typescript" version = "20.3.0" dependencies = [ - "base64 0.21.7", + "base64 0.21.5", "heck", "include_dir", "itertools 0.10.5", @@ -4019,28 +4001,28 @@ dependencies = [ [[package]] name = "temp-dir" -version = "0.1.12" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd16aa9ffe15fe021c6ee3766772132c6e98dfa395a167e16864f61a9cfb71d6" +checksum = "af547b166dd1ea4b472165569fc456cfb6818116f854690b0ff205e636523dab" [[package]] name = "tempfile" -version = "3.9.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", "redox_syscall", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] name = "termcolor" -version = "1.4.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] @@ -4105,18 +4087,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.55" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3de26b0965292219b4287ff031fcba86837900fe9cd2b34ea8ad893c0953d2" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.55" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "268026685b2be38d7103e9e507c938a1fcb3d7e6eb15e87870b617bf37b6d581" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", @@ -4135,9 +4117,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", "itoa", @@ -4157,9 +4139,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -4200,9 +4182,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" dependencies = [ "backtrace", "bytes", @@ -4212,7 +4194,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] @@ -4449,9 +4431,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-bom" @@ -4557,9 +4539,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4567,9 +4549,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ "bumpalo", "log", @@ -4582,9 +4564,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" dependencies = [ "cfg-if", "js-sys", @@ -4594,9 +4576,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4604,9 +4586,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", @@ -4617,9 +4599,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] name = "wasm-opt" @@ -4706,9 +4688,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" dependencies = [ "js-sys", "wasm-bindgen", @@ -4770,6 +4752,25 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core 0.52.0", + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -4913,9 +4914,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.35" +version = "0.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1931d78a9c73861da0134f453bb1f790ce49b2e30eba8410b4b79bac72b46a2d" +checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index aa19bda95..8ba86ea28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,49 +69,27 @@ rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" version = "20.2.0" path = "cmd/soroban-cli" -[workspace.dependencies.soroban-rpc] -version = "20.2.0" -path = "cmd/crates/soroban-rpc" - [workspace.dependencies.stellar-xdr] version = "=20.1.0" default-features = true [workspace.dependencies] -stellar-strkey = "0.0.7" -sep5 = "0.0.2" base64 = "0.21.2" thiserror = "1.0.46" sha2 = "0.10.7" ethnum = "1.3.2" hex = "0.4.3" itertools = "0.10.0" - -serde-aux = "4.1.2" +sep5 = "0.0.2" serde_json = "1.0.82" serde = "1.0.82" - -clap = { version = "4.1.8", features = [ - "derive", - "env", - "deprecated", - "string", -] } -clap_complete = "4.1.4" +stellar-strkey = "0.0.7" tracing = "0.1.37" tracing-subscriber = "0.3.16" tracing-appender = "0.2.2" which = "4.4.0" wasmparser = "0.90.0" -termcolor = "1.1.3" -termcolor_output = "1.0.1" -ed25519-dalek = "2.0.0" - -# networking -http = "1.0.0" -jsonrpsee-http-client = "0.20.1" -jsonrpsee-core = "0.20.1" -tokio = "1.28.1" + # [patch."https://github.com/stellar/rs-soroban-env"] # soroban-env-host = { path = "../rs-soroban-env/soroban-env-host/" } diff --git a/cmd/crates/soroban-rpc/Cargo.toml b/cmd/crates/soroban-rpc/Cargo.toml deleted file mode 100644 index 966597a22..000000000 --- a/cmd/crates/soroban-rpc/Cargo.toml +++ /dev/null @@ -1,51 +0,0 @@ -[package] -name = "soroban-rpc" -description = "Soroban RPC client for rust" -homepage = "https://github.com/stellar/soroban-tools" -repository = "https://github.com/stellar/soroban-tools" -authors = ["Stellar Development Foundation "] -license = "Apache-2.0" -readme = "README.md" -version.workspace = true -edition = "2021" -rust-version.workspace = true -autobins = false - - -[lib] -crate-type = ["rlib"] - - -[dependencies] -soroban-sdk = { version = "=20.3.0", git = "https://github.com/stellar/rs-soroban-sdk", rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" } -soroban-spec-tools = { version = "20.2.0", path = "../soroban-spec-tools" } -soroban-env-host = { version = "=20.2.0", git = "https://github.com/stellar/rs-soroban-env", rev = "1bfc0f2a2ee134efc1e1b0d5270281d0cba61c2e" } -stellar-strkey = "0.0.7" -stellar-xdr = { version = "=20.1.0", default-features = true, features = ["curr", "std", "serde"] } -soroban-spec = { version = "=20.3.0", git = "https://github.com/stellar/rs-soroban-sdk", rev = "4aef54ff9295c2fca4c5b9fbd2c92d0ff99f67de" } - -termcolor = "1.1.3" -termcolor_output = "1.0.1" -clap = { version = "4.1.8", features = ["derive", "env", "deprecated", "string"] } -serde_json = "1.0.82" -serde-aux = "4.1.2" -itertools = "0.10.0" -ethnum = "1.3.2" -hex = "0.4.3" -wasmparser = "0.90.0" -base64 = "0.21.2" -thiserror = "1.0.46" -serde = "1.0.82" -tokio = "1.28.1" -sha2 = "0.10.7" -ed25519-dalek = "2.0.0" -tracing = "0.1.40" - -# networking -jsonrpsee-http-client = "0.20.1" -jsonrpsee-core = "0.20.1" -http = "1.0.0" - - -[dev-dependencies] -which = "4.4.0" diff --git a/cmd/crates/soroban-rpc/README.md b/cmd/crates/soroban-rpc/README.md deleted file mode 100644 index 9185b7fd0..000000000 --- a/cmd/crates/soroban-rpc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# soroban-rpc - -Tools and utilities for soroban rpc. diff --git a/cmd/crates/soroban-rpc/src/log.rs b/cmd/crates/soroban-rpc/src/log.rs deleted file mode 100644 index 361268148..000000000 --- a/cmd/crates/soroban-rpc/src/log.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod diagnostic_events; -pub use diagnostic_events::*; diff --git a/cmd/crates/soroban-rpc/src/log/diagnostic_events.rs b/cmd/crates/soroban-rpc/src/log/diagnostic_events.rs deleted file mode 100644 index 68af67a4e..000000000 --- a/cmd/crates/soroban-rpc/src/log/diagnostic_events.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub fn diagnostic_events(events: &[impl std::fmt::Debug], level: tracing::Level) { - for (i, event) in events.iter().enumerate() { - if level == tracing::Level::TRACE { - tracing::trace!("{i}: {event:#?}"); - } else if level == tracing::Level::INFO { - tracing::info!("{i}: {event:#?}"); - } else if level == tracing::Level::ERROR { - tracing::error!("{i}: {event:#?}"); - } - } -} diff --git a/cmd/crates/soroban-spec-tools/Cargo.toml b/cmd/crates/soroban-spec-tools/Cargo.toml index 514b82924..61a32c137 100644 --- a/cmd/crates/soroban-spec-tools/Cargo.toml +++ b/cmd/crates/soroban-spec-tools/Cargo.toml @@ -20,8 +20,6 @@ crate-type = ["rlib"] soroban-spec = { workspace = true } stellar-strkey = { workspace = true } stellar-xdr = { workspace = true, features = ["curr", "std", "serde"] } -soroban-env-host = { workspace = true } - serde_json = { workspace = true } itertools = { workspace = true } ethnum = { workspace = true } diff --git a/cmd/crates/soroban-spec-tools/src/lib.rs b/cmd/crates/soroban-spec-tools/src/lib.rs index bc3c2a386..7f310fd99 100644 --- a/cmd/crates/soroban-spec-tools/src/lib.rs +++ b/cmd/crates/soroban-spec-tools/src/lib.rs @@ -13,7 +13,6 @@ use stellar_xdr::curr::{ UInt128Parts, UInt256Parts, Uint256, VecM, }; -pub mod contract; pub mod utils; #[derive(thiserror::Error, Debug)] diff --git a/cmd/crates/soroban-test/tests/it/help.rs b/cmd/crates/soroban-test/tests/it/help.rs index a66c449ed..6d4680e77 100644 --- a/cmd/crates/soroban-test/tests/it/help.rs +++ b/cmd/crates/soroban-test/tests/it/help.rs @@ -1,11 +1,11 @@ use soroban_cli::commands::contract; use soroban_test::TestEnv; -use crate::util::{invoke_custom as invoke, CUSTOM_TYPES, DEFAULT_CONTRACT_ID}; +use crate::util::{invoke_custom as invoke, CUSTOM_TYPES}; async fn invoke_custom(func: &str, args: &str) -> Result { let e = &TestEnv::default(); - invoke(e, DEFAULT_CONTRACT_ID, func, args, &CUSTOM_TYPES.path()).await + invoke(e, "1", func, args, &CUSTOM_TYPES.path()).await } #[tokio::test] diff --git a/cmd/crates/soroban-test/tests/it/integration/dotenv.rs b/cmd/crates/soroban-test/tests/it/integration/dotenv.rs index 7c0f25b3f..d7d56aaf3 100644 --- a/cmd/crates/soroban-test/tests/it/integration/dotenv.rs +++ b/cmd/crates/soroban-test/tests/it/integration/dotenv.rs @@ -35,7 +35,7 @@ fn current_env_not_overwritten() { write_env_file(e, &contract_id()); e.new_assert_cmd("contract") - .env("SOROBAN_CONTRACT_ID", "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4") + .env("SOROBAN_CONTRACT_ID", "2") .arg("invoke") .arg("--") .arg("hello") @@ -51,10 +51,7 @@ fn cli_args_have_priority() { deploy_hello(e); write_env_file(e, &contract_id()); e.new_assert_cmd("contract") - .env( - "SOROBAN_CONTRACT_ID", - "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - ) + .env("SOROBAN_CONTRACT_ID", "2") .arg("invoke") .arg("--id") .arg(TEST_CONTRACT_ID) diff --git a/cmd/crates/soroban-test/tests/it/integration/hello_world.rs b/cmd/crates/soroban-test/tests/it/integration/hello_world.rs index 7bd8d596a..7714f70dd 100644 --- a/cmd/crates/soroban-test/tests/it/integration/hello_world.rs +++ b/cmd/crates/soroban-test/tests/it/integration/hello_world.rs @@ -1,4 +1,3 @@ -use predicates::boolean::PredicateBooleanExt; use soroban_cli::commands::{ contract::{self, fetch}, keys, @@ -20,23 +19,7 @@ async fn invoke() { extend_contract(sandbox, id, HELLO_WORLD).await; // Note that all functions tested here have no state invoke_hello_world(sandbox, id); - sandbox - .new_assert_cmd("events") - .arg("--start-ledger=20") - .arg("--id") - .arg(id) - .assert() - .stdout(predicates::str::contains(id).not()) - .success(); invoke_hello_world_with_lib(sandbox, id).await; - sandbox - .new_assert_cmd("events") - .arg("--start-ledger=20") - .arg("--id") - .arg(id) - .assert() - .stdout(predicates::str::contains(id)) - .success(); invoke_hello_world_with_lib_two(sandbox, id).await; invoke_auth(sandbox, id); invoke_auth_with_identity(sandbox, id).await; @@ -56,7 +39,6 @@ fn invoke_hello_world(sandbox: &TestEnv, id: &str) { sandbox .new_assert_cmd("contract") .arg("invoke") - .arg("--is-view") .arg("--id") .arg(id) .arg("--") diff --git a/cmd/crates/soroban-test/tests/it/util.rs b/cmd/crates/soroban-test/tests/it/util.rs index 112d5f841..6d6251012 100644 --- a/cmd/crates/soroban-test/tests/it/util.rs +++ b/cmd/crates/soroban-test/tests/it/util.rs @@ -68,5 +68,3 @@ pub async fn invoke_custom( i.invoke(&soroban_cli::commands::global::Args::default()) .await } - -pub const DEFAULT_CONTRACT_ID: &str = "CDR6QKTWZQYW6YUJ7UP7XXZRLWQPFRV6SWBLQS4ZQOSAF4BOUD77OO5Z"; diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml index ea936d941..f402b5ba3 100644 --- a/cmd/soroban-cli/Cargo.toml +++ b/cmd/soroban-cli/Cargo.toml @@ -45,27 +45,24 @@ soroban-spec-typescript = { workspace = true } soroban-ledger-snapshot = { workspace = true } stellar-strkey = { workspace = true } soroban-sdk = { workspace = true } -soroban-rpc = { workspace = true } - -clap = { workspace = true, features = [ +clap = { version = "4.1.8", features = [ "derive", "env", "deprecated", "string", ] } -clap_complete = {workspace = true} - base64 = { workspace = true } thiserror = { workspace = true } serde = "1.0.82" serde_derive = "1.0.82" serde_json = "1.0.82" -serde-aux = { workspace = true } +serde-aux = "4.1.2" hex = { workspace = true } num-bigint = "0.4" tokio = { version = "1", features = ["full"] } -termcolor = { workspace = true } -termcolor_output = { workspace = true } +termcolor = "1.1.3" +termcolor_output = "1.0.1" +clap_complete = "4.1.4" rand = "0.8.5" wasmparser = { workspace = true } sha2 = { workspace = true } @@ -73,7 +70,7 @@ csv = "1.1.6" ed25519-dalek = "=2.0.0" jsonrpsee-http-client = "0.20.1" jsonrpsee-core = "0.20.1" -hyper = "0.14.27" +hyper = "0.14.27" hyper-tls = "0.5" http = "0.2.9" regex = "1.6.0" diff --git a/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs b/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs index 091f8255a..19c7eecd6 100644 --- a/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs +++ b/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs @@ -1,15 +1,17 @@ use std::{ffi::OsString, fmt::Debug, path::PathBuf}; use clap::{command, Parser}; -use soroban_spec_tools::contract as contract_spec; use soroban_spec_typescript::{self as typescript, boilerplate::Project}; -use crate::commands::{ - config::locator, - contract::{self, fetch}, - network::{self, Network}, -}; use crate::wasm; +use crate::{ + commands::{ + config::locator, + contract::{self, fetch}, + network::{self, Network}, + }, + utils::contract_spec::{self, ContractSpec}, +}; #[derive(Parser, Debug, Clone)] #[group(skip)] @@ -76,7 +78,7 @@ impl Cmd { network: self.network.clone(), }; let bytes = fetch.get_bytes().await?; - contract_spec::Spec::new(&bytes)?.spec + ContractSpec::new(&bytes)?.spec }; if self.output_dir.is_file() { return Err(Error::IsFile(self.output_dir.clone())); diff --git a/cmd/soroban-cli/src/commands/contract/extend.rs b/cmd/soroban-cli/src/commands/contract/extend.rs index 86ea23b55..7e9f1e98c 100644 --- a/cmd/soroban-cli/src/commands/contract/extend.rs +++ b/cmd/soroban-cli/src/commands/contract/extend.rs @@ -144,18 +144,15 @@ impl Cmd { }), }; - let res = client + let (result, meta, events) = client .prepare_and_send_transaction(&tx, &key, &[], &network.network_passphrase, None, None) .await?; - let events = res.events()?; + tracing::trace!(?result); + tracing::trace!(?meta); if !events.is_empty() { tracing::info!("Events:\n {events:#?}"); } - let meta = res - .result_meta - .as_ref() - .ok_or(Error::MissingOperationResult)?; // The transaction from core will succeed regardless of whether it actually found & extended // the entry, so we have to inspect the result meta to tell if it worked or not. diff --git a/cmd/soroban-cli/src/commands/contract/inspect.rs b/cmd/soroban-cli/src/commands/contract/inspect.rs index e66bf83fd..355c18ca8 100644 --- a/cmd/soroban-cli/src/commands/contract/inspect.rs +++ b/cmd/soroban-cli/src/commands/contract/inspect.rs @@ -1,6 +1,5 @@ use clap::{command, Parser}; use soroban_env_host::xdr; -use soroban_spec_tools::contract; use std::{fmt::Debug, path::PathBuf}; use tracing::debug; @@ -29,7 +28,7 @@ pub enum Error { #[error(transparent)] Xdr(#[from] xdr::Error), #[error(transparent)] - Spec(#[from] contract::Error), + Spec(#[from] crate::utils::contract_spec::Error), } impl Cmd { diff --git a/cmd/soroban-cli/src/commands/contract/install.rs b/cmd/soroban-cli/src/commands/contract/install.rs index c2fa6d889..905775298 100644 --- a/cmd/soroban-cli/src/commands/contract/install.rs +++ b/cmd/soroban-cli/src/commands/contract/install.rs @@ -112,10 +112,14 @@ impl Cmd { build_install_contract_code_tx(contract, sequence + 1, self.fee.fee, &key)?; // Currently internal errors are not returned if the contract code is expired - if let Some(TransactionResult { - result: TransactionResultResult::TxInternalError, - .. - }) = client + if let ( + TransactionResult { + result: TransactionResultResult::TxInternalError, + .. + }, + _, + _, + ) = client .prepare_and_send_transaction( &tx_without_preflight, &key, @@ -125,8 +129,6 @@ impl Cmd { None, ) .await? - .result - .as_ref() { // Now just need to restore it and don't have to install again restore::Cmd { @@ -151,7 +153,7 @@ impl Cmd { } } -fn get_contract_meta_sdk_version(wasm_spec: &soroban_spec_tools::contract::Spec) -> Option { +fn get_contract_meta_sdk_version(wasm_spec: &utils::contract_spec::ContractSpec) -> Option { let rs_sdk_version_option = if let Some(_meta) = &wasm_spec.meta_base64 { wasm_spec.meta.iter().find(|entry| match entry { ScMetaEntry::ScMetaV0(ScMetaV0 { key, .. }) => { diff --git a/cmd/soroban-cli/src/commands/contract/invoke.rs b/cmd/soroban-cli/src/commands/contract/invoke.rs index 720c3c6f8..669342b06 100644 --- a/cmd/soroban-cli/src/commands/contract/invoke.rs +++ b/cmd/soroban-cli/src/commands/contract/invoke.rs @@ -28,8 +28,13 @@ use super::super::{ config::{self, locator}, events, }; -use crate::{commands::global, rpc, Pwd}; -use soroban_spec_tools::{contract, Spec}; +use crate::{ + commands::global, + rpc::{self, Client}, + utils::{self, contract_spec}, + Pwd, +}; +use soroban_spec_tools::Spec; #[derive(Parser, Debug, Default, Clone)] #[allow(clippy::struct_excessive_bools)] @@ -44,12 +49,6 @@ pub struct Cmd { /// Output the cost execution to stderr #[arg(long = "cost")] pub cost: bool, - /// Number of instructions to simulate - #[arg(long)] - pub instructions: Option, - /// Do not sign and submit transaction - #[arg(long, env = "SOROBAN_INVOKE_SIGN", env = "SYSTEM_TEST_VERBOSE_OUTPUT")] - pub is_view: bool, /// Function name as subcommand, then arguments for that function as `--arg-name value` #[arg(last = true, id = "CONTRACT_FN_AND_ARGS")] pub slop: Vec, @@ -141,7 +140,7 @@ pub enum Error { #[error(transparent)] StrKey(#[from] stellar_strkey::DecodeError), #[error(transparent)] - ContractSpec(#[from] contract::Error), + ContractSpec(#[from] contract_spec::Error), #[error("")] MissingFileArg(PathBuf), } @@ -276,7 +275,7 @@ impl Cmd { // For testing wasm arg parsing let _ = self.build_host_function_parameters(contract_id, spec_entries)?; } - let client = rpc::Client::new(&network.rpc_url)?; + let client = Client::new(&network.rpc_url)?; client .verify_network_passphrase(Some(&network.network_passphrase)) .await?; @@ -300,31 +299,29 @@ impl Cmd { self.fee.fee, &key, )?; - let mut txn = client.create_assembled_transaction(&tx).await?; - if let Some(instructions) = self.instructions { - txn = txn.set_max_instructions(instructions); - } - let (return_value, events) = if self.is_view { - ( - txn.sim_response().results()?[0].xdr.clone(), - txn.sim_response().events()?, + + let (result, meta, events) = client + .prepare_and_send_transaction( + &tx, + &key, + &signers, + &network.network_passphrase, + Some(log_events), + (global_args.verbose || global_args.very_verbose || self.cost) + .then_some(log_resources), ) - } else { - let res = client - .send_assembled_transaction( - txn, - &key, - &signers, - &network.network_passphrase, - Some(log_events), - (global_args.verbose || global_args.very_verbose || self.cost) - .then_some(log_resources), - ) - .await?; - (res.return_value()?, res.contract_events()?) - }; + .await?; + tracing::debug!(?result); crate::log::diagnostic_events(&events, tracing::Level::INFO); + let xdr::TransactionMeta::V3(xdr::TransactionMetaV3 { + soroban_meta: Some(xdr::SorobanTransactionMeta { return_value, .. }), + .. + }) = meta + else { + return Err(Error::MissingOperationResult); + }; + output_to_string(&spec, &return_value, &function) } @@ -347,7 +344,7 @@ impl Cmd { impl Cmd { fn contract_id(&self) -> Result<[u8; 32], Error> { - soroban_spec_tools::utils::contract_id_from_str(&self.contract_id) + utils::contract_id_from_str(&self.contract_id) .map_err(|e| Error::CannotParseContractId(self.contract_id.clone(), e)) } } diff --git a/cmd/soroban-cli/src/commands/contract/read.rs b/cmd/soroban-cli/src/commands/contract/read.rs index f25b6c2c0..842832d5f 100644 --- a/cmd/soroban-cli/src/commands/contract/read.rs +++ b/cmd/soroban-cli/src/commands/contract/read.rs @@ -120,7 +120,7 @@ impl Cmd { let ( LedgerKey::ContractData(LedgerKeyContractData { key, .. }), LedgerEntryData::ContractData(ContractDataEntry { val, .. }), - ) = &(key, val) + ) = (key, val) else { return Err(Error::OnlyDataAllowed); }; diff --git a/cmd/soroban-cli/src/commands/contract/restore.rs b/cmd/soroban-cli/src/commands/contract/restore.rs index 6ed39f892..38b8a84a1 100644 --- a/cmd/soroban-cli/src/commands/contract/restore.rs +++ b/cmd/soroban-cli/src/commands/contract/restore.rs @@ -148,15 +148,11 @@ impl Cmd { }), }; - let res = client + let (result, meta, events) = client .prepare_and_send_transaction(&tx, &key, &[], &network.network_passphrase, None, None) .await?; - let meta = res - .result_meta - .as_ref() - .ok_or(Error::MissingOperationResult)?; - let events = res.events()?; + tracing::trace!(?result); tracing::trace!(?meta); if !events.is_empty() { tracing::info!("Events:\n {events:#?}"); @@ -181,7 +177,7 @@ impl Cmd { operations[0].changes.len() ); } - parse_operations(operations).ok_or(Error::MissingOperationResult) + parse_operations(&operations).ok_or(Error::MissingOperationResult) } } diff --git a/cmd/soroban-cli/src/key.rs b/cmd/soroban-cli/src/key.rs index 2290e857e..e9901abd2 100644 --- a/cmd/soroban-cli/src/key.rs +++ b/cmd/soroban-cli/src/key.rs @@ -59,7 +59,7 @@ pub struct Args { )] pub wasm_hash: Option, /// Storage entry durability - #[arg(long, value_enum, required = true, default_value = "persistent")] + #[arg(long, value_enum, required = true)] pub durability: Durability, } @@ -83,7 +83,7 @@ impl Args { } else if let Some(wasm_hash) = &self.wasm_hash { return Ok(vec![LedgerKey::ContractCode(LedgerKeyContractCode { hash: xdr::Hash( - soroban_spec_tools::utils::contract_id_from_str(wasm_hash) + utils::contract_id_from_str(wasm_hash) .map_err(|e| Error::CannotParseContractId(wasm_hash.clone(), e))?, ), })]); diff --git a/cmd/soroban-cli/src/lib.rs b/cmd/soroban-cli/src/lib.rs index ef443853b..3aad487c8 100644 --- a/cmd/soroban-cli/src/lib.rs +++ b/cmd/soroban-cli/src/lib.rs @@ -3,17 +3,17 @@ clippy::must_use_candidate, clippy::missing_panics_doc )] -pub(crate) use soroban_rpc as rpc; -use std::path::Path; - pub mod commands; pub mod fee; pub mod key; pub mod log; +pub mod rpc; pub mod toid; pub mod utils; pub mod wasm; +use std::path::Path; + pub use commands::Root; pub fn parse_cmd(s: &str) -> Result diff --git a/cmd/crates/soroban-rpc/src/fixtures/event_response.json b/cmd/soroban-cli/src/rpc/fixtures/event_response.json similarity index 100% rename from cmd/crates/soroban-rpc/src/fixtures/event_response.json rename to cmd/soroban-cli/src/rpc/fixtures/event_response.json diff --git a/cmd/crates/soroban-rpc/src/lib.rs b/cmd/soroban-cli/src/rpc/mod.rs similarity index 92% rename from cmd/crates/soroban-rpc/src/lib.rs rename to cmd/soroban-cli/src/rpc/mod.rs index 95c3692e1..535426292 100644 --- a/cmd/crates/soroban-rpc/src/lib.rs +++ b/cmd/soroban-cli/src/rpc/mod.rs @@ -21,20 +21,15 @@ use std::{ str::FromStr, time::{Duration, Instant}, }; -use stellar_xdr::curr::ContractEventType; use termcolor::{Color, ColorChoice, StandardStream, WriteColor}; use termcolor_output::colored; use tokio::time::sleep; -pub mod log; -mod txn; - -pub use txn::Assembled; +use crate::utils::contract_spec; -use soroban_spec_tools::contract; +mod txn; const VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION"); -pub(crate) const DEFAULT_TRANSACTION_FEES: u32 = 100; pub type LogEvents = fn( footprint: &LedgerFootprint, @@ -93,7 +88,7 @@ pub enum Error { #[error("unexpected contract code data type: {0:?}")] UnexpectedContractCodeDataType(LedgerEntryData), #[error(transparent)] - CouldNotParseContractSpec(#[from] contract::Error), + CouldNotParseContractSpec(#[from] contract_spec::Error), #[error("unexpected contract code got token")] UnexpectedToken(ContractDataEntry), #[error(transparent)] @@ -104,9 +99,6 @@ pub enum Error { LargeFee(u64), #[error("Cannot authorize raw transactions")] CannotAuthorizeRawTransaction, - - #[error("Missing result for tnx")] - MissingOp, } #[derive(serde::Deserialize, serde::Serialize, Debug)] @@ -178,41 +170,6 @@ impl TryInto for GetTransactionResponseRaw { } } -impl GetTransactionResponse { - /// - /// # Errors - pub fn return_value(&self) -> Result { - if let Some(xdr::TransactionMeta::V3(xdr::TransactionMetaV3 { - soroban_meta: Some(xdr::SorobanTransactionMeta { return_value, .. }), - .. - })) = &self.result_meta - { - Ok(return_value.clone()) - } else { - Err(Error::MissingOp) - } - } - - /// - /// # Errors - pub fn events(&self) -> Result, Error> { - self.result_meta - .as_ref() - .map(extract_events) - .ok_or(Error::MissingOp) - } - - /// - /// # Errors - pub fn contract_events(&self) -> Result, Error> { - Ok(self - .events()? - .into_iter() - .filter(|e| matches!(e.event.type_, ContractEventType::Contract)) - .collect::>()) - } -} - #[derive(serde::Deserialize, serde::Serialize, Debug)] pub struct LedgerEntryResult { pub key: String, @@ -316,8 +273,6 @@ pub struct SimulateTransactionResponse { } impl SimulateTransactionResponse { - /// - /// # Errors pub fn results(&self) -> Result, Error> { self.results .iter() @@ -339,8 +294,6 @@ impl SimulateTransactionResponse { .collect() } - /// - /// # Errors pub fn events(&self) -> Result, Error> { self.events .iter() @@ -348,8 +301,6 @@ impl SimulateTransactionResponse { .collect() } - /// - /// # Errors pub fn transaction_data(&self) -> Result { Ok(SorobanTransactionData::from_xdr_base64( &self.transaction_data, @@ -392,7 +343,6 @@ pub struct GetEventsResponse { // Reference](https://docs.google.com/document/d/1TZUDgo_3zPz7TiPMMHVW_mtogjLyPL0plvzGMsxSz6A/edit#bookmark=id.35t97rnag3tx) // [Code // Reference](https://github.com/stellar/soroban-tools/blob/bac1be79e8c2590c9c35ad8a0168aab0ae2b4171/cmd/soroban-rpc/internal/methods/get_events.go#L182-L203) -#[must_use] pub fn does_topic_match(topic: &[String], filter: &[String]) -> bool { filter.len() == topic.len() && filter @@ -447,13 +397,10 @@ impl Display for Event { } impl Event { - /// - /// # Errors pub fn parse_cursor(&self) -> Result<(u64, i32), Error> { parse_cursor(&self.id) } - /// - /// # Errors + pub fn pretty_print(&self) -> Result<(), Box> { let mut stdout = StandardStream::stdout(ColorChoice::Auto); if !stdout.supports_color() { @@ -555,8 +502,6 @@ pub struct Client { } impl Client { - /// - /// # Errors pub fn new(base_url: &str) -> Result { // Add the port to the base URL if there is no port explicitly included // in the URL and the scheme allows us to infer a default port. @@ -587,8 +532,6 @@ impl Client { }) } - /// - /// # Errors fn client(&self) -> Result { let url = self.base_url.clone(); let mut headers = HeaderMap::new(); @@ -600,8 +543,6 @@ impl Client { .build(url)?) } - /// - /// # Errors pub async fn friendbot_url(&self) -> Result { let network = self.get_network().await?; tracing::trace!("{network:#?}"); @@ -612,8 +553,7 @@ impl Client { ) }) } - /// - /// # Errors + pub async fn verify_network_passphrase(&self, expected: Option<&str>) -> Result { let server = self.get_network().await?.passphrase; if let Some(expected) = expected { @@ -627,15 +567,11 @@ impl Client { Ok(server) } - /// - /// # Errors pub async fn get_network(&self) -> Result { tracing::trace!("Getting network"); Ok(self.client()?.request("getNetwork", rpc_params![]).await?) } - /// - /// # Errors pub async fn get_latest_ledger(&self) -> Result { tracing::trace!("Getting latest ledger"); Ok(self @@ -644,8 +580,6 @@ impl Client { .await?) } - /// - /// # Errors pub async fn get_account(&self, address: &str) -> Result { tracing::trace!("Getting address {}", address); let key = LedgerKey::Account(LedgerKeyAccount { @@ -677,12 +611,10 @@ soroban config identity fund {address} --helper-url "# } } - /// - /// # Errors pub async fn send_transaction( &self, tx: &TransactionEnvelope, - ) -> Result { + ) -> Result<(TransactionResult, TransactionMeta, Vec), Error> { let client = self.client()?; tracing::trace!("Sending:\n{tx:#?}"); let SendTransactionResponse { @@ -724,8 +656,14 @@ soroban config identity fund {address} --helper-url "# "SUCCESS" => { // TODO: the caller should probably be printing this tracing::trace!("{response:#?}"); - - return Ok(response); + let GetTransactionResponse { + result, + result_meta, + .. + } = response; + let meta = result_meta.ok_or(Error::MissingResult)?; + let events = extract_events(&meta); + return Ok((result.ok_or(Error::MissingResult)?, meta, events)); } "FAILED" => { tracing::error!("{response:#?}"); @@ -749,8 +687,6 @@ soroban config identity fund {address} --helper-url "# } } - /// - /// # Errors pub async fn simulate_transaction( &self, tx: &TransactionEnvelope, @@ -767,69 +703,33 @@ soroban config identity fund {address} --helper-url "# match response.error { None => Ok(response), Some(e) => { - log::diagnostic_events(&response.events, tracing::Level::ERROR); + crate::log::diagnostic_events(&response.events, tracing::Level::ERROR); Err(Error::TransactionSimulationFailed(e)) } } } - /// - /// # Errors - pub async fn send_assembled_transaction( + pub async fn prepare_and_send_transaction( &self, - txn: txn::Assembled, + tx_without_preflight: &Transaction, source_key: &ed25519_dalek::SigningKey, signers: &[ed25519_dalek::SigningKey], network_passphrase: &str, log_events: Option, log_resources: Option, - ) -> Result { - let seq_num = txn.sim_response().latest_ledger + 60; //5 min; + ) -> Result<(TransactionResult, TransactionMeta, Vec), Error> { + let txn = txn::Assembled::new(tx_without_preflight, self).await?; + let seq_num = txn.sim_res().latest_ledger + 60; //5 min; let authorized = txn .handle_restore(self, source_key, network_passphrase) .await? .authorize(self, source_key, signers, seq_num, network_passphrase) .await?; authorized.log(log_events, log_resources)?; - let tx = authorized.sign(source_key, network_passphrase)?; self.send_transaction(&tx).await } - /// - /// # Errors - pub async fn prepare_and_send_transaction( - &self, - tx_without_preflight: &Transaction, - source_key: &ed25519_dalek::SigningKey, - signers: &[ed25519_dalek::SigningKey], - network_passphrase: &str, - log_events: Option, - log_resources: Option, - ) -> Result { - let txn = txn::Assembled::new(tx_without_preflight, self).await?; - self.send_assembled_transaction( - txn, - source_key, - signers, - network_passphrase, - log_events, - log_resources, - ) - .await - } - - /// - /// # Errors - pub async fn create_assembled_transaction( - &self, - txn: &Transaction, - ) -> Result { - txn::Assembled::new(txn, self).await - } - - /// - /// # Errors pub async fn get_transaction(&self, tx_id: &str) -> Result { Ok(self .client()? @@ -837,8 +737,6 @@ soroban config identity fund {address} --helper-url "# .await?) } - /// - /// # Errors pub async fn get_ledger_entries( &self, keys: &[LedgerKey], @@ -849,7 +747,7 @@ soroban config identity fund {address} --helper-url "# if base64_result.is_err() { return Err(Error::Xdr(XdrError::Invalid)); } - base64_keys.push(k.to_xdr_base64(Limits::none())?); + base64_keys.push(k.to_xdr_base64(Limits::none()).unwrap()); } Ok(self .client()? @@ -857,8 +755,6 @@ soroban config identity fund {address} --helper-url "# .await?) } - /// - /// # Errors pub async fn get_full_ledger_entries( &self, ledger_keys: &[LedgerKey], @@ -899,8 +795,7 @@ soroban config identity fund {address} --helper-url "# latest_ledger, }) } - /// - /// # Errors + pub async fn get_events( &self, start: EventStart, @@ -940,8 +835,6 @@ soroban config identity fund {address} --helper-url "# Ok(self.client()?.request("getEvents", oparams).await?) } - /// - /// # Errors pub async fn get_contract_data( &self, contract_id: &[u8; 32], @@ -965,8 +858,6 @@ soroban config identity fund {address} --helper-url "# } } - /// - /// # Errors pub async fn get_remote_wasm(&self, contract_id: &[u8; 32]) -> Result, Error> { match self.get_contract_data(contract_id).await? { xdr::ContractDataEntry { @@ -981,8 +872,6 @@ soroban config identity fund {address} --helper-url "# } } - /// - /// # Errors pub async fn get_remote_wasm_from_hash(&self, hash: xdr::Hash) -> Result, Error> { let code_key = LedgerKey::ContractCode(xdr::LedgerKeyContractCode { hash: hash.clone() }); let contract_data = self.get_ledger_entries(&[code_key]).await?; @@ -999,8 +888,7 @@ soroban config identity fund {address} --helper-url "# scval => Err(Error::UnexpectedContractCodeDataType(scval)), } } - /// - /// # Errors + pub async fn get_remote_contract_spec( &self, contract_id: &[u8; 32], @@ -1010,11 +898,11 @@ soroban config identity fund {address} --helper-url "# xdr::ScVal::ContractInstance(xdr::ScContractInstance { executable: xdr::ContractExecutable::Wasm(hash), .. - }) => Ok( - contract::Spec::new(&self.get_remote_wasm_from_hash(hash).await?) - .map_err(Error::CouldNotParseContractSpec)? - .spec, - ), + }) => Ok(contract_spec::ContractSpec::new( + &self.get_remote_wasm_from_hash(hash).await?, + ) + .map_err(Error::CouldNotParseContractSpec)? + .spec), xdr::ScVal::ContractInstance(xdr::ScContractInstance { executable: xdr::ContractExecutable::StellarAsset, .. @@ -1051,7 +939,7 @@ fn extract_events(tx_meta: &TransactionMeta) -> Vec { } } -pub(crate) fn parse_cursor(c: &str) -> Result<(u64, i32), Error> { +pub fn parse_cursor(c: &str) -> Result<(u64, i32), Error> { let (toid_part, event_index) = c.split('-').collect_tuple().ok_or(Error::InvalidCursor)?; let toid_part: u64 = toid_part.parse().map_err(|_| Error::InvalidCursor)?; let start_index: i32 = event_index.parse().map_err(|_| Error::InvalidCursor)?; diff --git a/cmd/crates/soroban-rpc/src/txn.rs b/cmd/soroban-cli/src/rpc/txn.rs similarity index 82% rename from cmd/crates/soroban-rpc/src/txn.rs rename to cmd/soroban-cli/src/rpc/txn.rs index 35b0c7192..9e36938dd 100644 --- a/cmd/crates/soroban-rpc/src/txn.rs +++ b/cmd/soroban-cli/src/rpc/txn.rs @@ -2,16 +2,16 @@ use ed25519_dalek::Signer; use sha2::{Digest, Sha256}; use soroban_env_host::xdr::{ self, AccountId, DecoratedSignature, ExtensionPoint, Hash, HashIdPreimage, - HashIdPreimageSorobanAuthorization, InvokeHostFunctionOp, LedgerFootprint, Limits, Memo, - Operation, OperationBody, Preconditions, PublicKey, ReadXdr, RestoreFootprintOp, ScAddress, - ScMap, ScSymbol, ScVal, Signature, SignatureHint, SorobanAddressCredentials, + HashIdPreimageSorobanAuthorization, InvokeHostFunctionOp, Limits, Memo, Operation, + OperationBody, Preconditions, PublicKey, ReadXdr, RestoreFootprintOp, ScAddress, ScMap, + ScSymbol, ScVal, Signature, SignatureHint, SorobanAddressCredentials, SorobanAuthorizationEntry, SorobanAuthorizedFunction, SorobanCredentials, SorobanResources, SorobanTransactionData, Transaction, TransactionEnvelope, TransactionExt, TransactionSignaturePayload, TransactionSignaturePayloadTaggedTransaction, TransactionV1Envelope, Uint256, VecM, WriteXdr, }; -use super::{Client, Error, RestorePreamble, SimulateTransactionResponse}; +use crate::rpc::{Client, Error, RestorePreamble, SimulateTransactionResponse}; use super::{LogEvents, LogResources}; @@ -20,35 +20,13 @@ pub struct Assembled { sim_res: SimulateTransactionResponse, } -/// Represents an assembled transaction ready to be signed and submitted to the network. impl Assembled { - /// - /// Creates a new `Assembled` transaction. - /// - /// # Arguments - /// - /// * `txn` - The original transaction. - /// * `client` - The client used for simulation and submission. - /// - /// # Errors - /// - /// Returns an error if simulation fails or if assembling the transaction fails. pub async fn new(txn: &Transaction, client: &Client) -> Result { let sim_res = Self::simulate(txn, client).await?; let txn = assemble(txn, &sim_res)?; Ok(Self { txn, sim_res }) } - /// - /// Calculates the hash of the assembled transaction. - /// - /// # Arguments - /// - /// * `network_passphrase` - The network passphrase. - /// - /// # Errors - /// - /// Returns an error if generating the hash fails. pub fn hash(&self, network_passphrase: &str) -> Result<[u8; 32], xdr::Error> { let signature_payload = TransactionSignaturePayload { network_id: Hash(Sha256::digest(network_passphrase).into()), @@ -57,23 +35,12 @@ impl Assembled { Ok(Sha256::digest(signature_payload.to_xdr(Limits::none())?).into()) } - /// - /// Signs the assembled transaction. - /// - /// # Arguments - /// - /// * `key` - The signing key. - /// * `network_passphrase` - The network passphrase. - /// - /// # Errors - /// - /// Returns an error if signing the transaction fails. pub fn sign( self, key: &ed25519_dalek::SigningKey, network_passphrase: &str, ) -> Result { - let tx = self.transaction(); + let tx = self.txn(); let tx_hash = self.hash(network_passphrase)?; let tx_signature = key.sign(&tx_hash); @@ -88,17 +55,6 @@ impl Assembled { })) } - /// - /// Simulates the assembled transaction. - /// - /// # Arguments - /// - /// * `tx` - The original transaction. - /// * `client` - The client used for simulation. - /// - /// # Errors - /// - /// Returns an error if simulation fails. pub async fn simulate( tx: &Transaction, client: &Client, @@ -111,18 +67,6 @@ impl Assembled { .await } - /// - /// Handles the restore process for the assembled transaction. - /// - /// # Arguments - /// - /// * `client` - The client used for submission. - /// * `source_key` - The signing key of the source account. - /// * `network_passphrase` - The network passphrase. - /// - /// # Errors - /// - /// Returns an error if the restore process fails. pub async fn handle_restore( self, client: &Client, @@ -133,7 +77,7 @@ impl Assembled { // Build and submit the restore transaction client .send_transaction( - &Assembled::new(&restore(self.transaction(), restore_preamble)?, client) + &Assembled::new(&restore(self.txn(), restore_preamble)?, client) .await? .sign(source_key, network_passphrase)?, ) @@ -144,20 +88,14 @@ impl Assembled { } } - /// Returns a reference to the original transaction. - #[must_use] - pub fn transaction(&self) -> &Transaction { + pub fn txn(&self) -> &Transaction { &self.txn } - /// Returns a reference to the simulation response. - #[must_use] - pub fn sim_response(&self) -> &SimulateTransactionResponse { + pub fn sim_res(&self) -> &SimulateTransactionResponse { &self.sim_res } - /// - /// # Errors pub async fn authorize( self, client: &Client, @@ -167,7 +105,7 @@ impl Assembled { network_passphrase: &str, ) -> Result { if let Some(txn) = sign_soroban_authorizations( - self.transaction(), + self.txn(), source_key, signers, seq_num, @@ -179,16 +117,12 @@ impl Assembled { } } - #[must_use] pub fn bump_seq_num(mut self) -> Self { self.txn.seq_num.0 += 1; self } - /// - /// # Errors - #[must_use] - pub fn auth_entries(&self) -> VecM { + pub fn auth(&self) -> VecM { self.txn .operations .first() @@ -203,8 +137,6 @@ impl Assembled { .unwrap_or_default() } - /// - /// # Errors pub fn log( &self, log_events: Option, @@ -219,55 +151,15 @@ impl Assembled { log(resources); } if let Some(log) = log_events { - log(footprint, &[self.auth_entries()], &self.sim_res.events()?); + log(footprint, &[self.auth()], &self.sim_res.events()?); }; } Ok(()) } - - #[must_use] - pub fn requires_auth(&self) -> bool { - requires_auth(&self.txn).is_some() - } - - #[must_use] - pub fn is_view(&self) -> bool { - let TransactionExt::V1(SorobanTransactionData { - resources: - SorobanResources { - footprint: LedgerFootprint { read_write, .. }, - .. - }, - .. - }) = &self.txn.ext - else { - return false; - }; - read_write.is_empty() - } - - #[must_use] - pub fn set_max_instructions(mut self, instructions: u32) -> Self { - if let TransactionExt::V1(SorobanTransactionData { - resources: - SorobanResources { - instructions: ref mut i, - .. - }, - .. - }) = &mut self.txn.ext - { - tracing::trace!("setting max instructions to {instructions} from {i}"); - *i = instructions; - } - self - } } // Apply the result of a simulateTransaction onto a transaction envelope, preparing it for // submission to the network. -/// -/// # Errors pub fn assemble( raw: &Transaction, simulation: &SimulateTransactionResponse, @@ -314,7 +206,7 @@ pub fn assemble( } // update the fees of the actual transaction to meet the minimum resource fees. - let classic_transaction_fees = crate::DEFAULT_TRANSACTION_FEES; + let classic_transaction_fees = crate::fee::Args::default().fee; // Pad the fees up by 15% for a bit of wiggle room. tx.fee = (tx.fee.max( classic_transaction_fees @@ -328,21 +220,6 @@ pub fn assemble( Ok(tx) } -fn requires_auth(txn: &Transaction) -> Option { - let [op @ Operation { - body: OperationBody::InvokeHostFunction(InvokeHostFunctionOp { auth, .. }), - .. - }] = txn.operations.as_slice() - else { - return None; - }; - matches!( - auth.first().map(|x| &x.root_invocation.function), - Some(&SorobanAuthorizedFunction::ContractFn(_)) - ) - .then(move || op.clone()) -} - // Use the given source_key and signers, to sign all SorobanAuthorizationEntry's in the given // transaction. If unable to sign, return an error. fn sign_soroban_authorizations( @@ -353,8 +230,18 @@ fn sign_soroban_authorizations( network_passphrase: &str, ) -> Result, Error> { let mut tx = raw.clone(); - let Some(mut op) = requires_auth(&tx) else { - return Ok(None); + let mut op = match tx.operations.as_slice() { + [op @ Operation { + body: OperationBody::InvokeHostFunction(InvokeHostFunctionOp { auth, .. }), + .. + }] if matches!( + auth.first().map(|x| &x.root_invocation.function), + Some(&SorobanAuthorizedFunction::ContractFn(_)) + ) => + { + op.clone() + } + _ => return Ok(None), }; let Operation { @@ -491,8 +378,6 @@ fn sign_soroban_authorization_entry( Ok(auth) } -/// -/// # Errors pub fn restore(parent: &Transaction, restore: &RestorePreamble) -> Result { let transaction_data = SorobanTransactionData::from_xdr_base64(&restore.transaction_data, Limits::none())?; @@ -513,7 +398,8 @@ pub fn restore(parent: &Transaction, restore: &RestorePreamble) -> Result Result<[u8; 32], stellar_strkey::DecodeError> { - Ok( - if let Ok(strkey) = stellar_strkey::Contract::from_string(contract_id) { - strkey.0 - } else { + stellar_strkey::Contract::from_string(contract_id) + .map(|strkey| strkey.0) + .or_else(|_| { // strkey failed, try to parse it as a hex string, for backwards compatibility. soroban_spec_tools::utils::padded_hex_from_str(contract_id, 32) .map_err(|_| stellar_strkey::DecodeError::Invalid)? .try_into() - .map_err(|_| stellar_strkey::DecodeError::Invalid)? - }, - ) + .map_err(|_| stellar_strkey::DecodeError::Invalid) + }) + .map_err(|_| stellar_strkey::DecodeError::Invalid) } /// # Errors @@ -199,5 +198,47 @@ mod tests { ), Err(err) => panic!("Failed to parse contract id: {err}"), } + + // hex + match contract_id_from_str( + "363eaa3867841fbad0f4ed88c779e4fe66e56a2470dc98c0ec9c073d05c7b103", + ) { + Ok(contract_id) => assert_eq!( + contract_id, + [ + 0x36, 0x3e, 0xaa, 0x38, 0x67, 0x84, 0x1f, 0xba, 0xd0, 0xf4, 0xed, 0x88, 0xc7, + 0x79, 0xe4, 0xfe, 0x66, 0xe5, 0x6a, 0x24, 0x70, 0xdc, 0x98, 0xc0, 0xec, 0x9c, + 0x07, 0x3d, 0x05, 0xc7, 0xb1, 0x03, + ] + ), + Err(err) => panic!("Failed to parse contract id: {err}"), + } + + // unpadded-hex + match contract_id_from_str("1") { + Ok(contract_id) => assert_eq!( + contract_id, + [ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + ] + ), + Err(err) => panic!("Failed to parse contract id: {err}"), + } + + // invalid hex + match contract_id_from_str("foobar") { + Ok(_) => panic!("Expected parsing to fail"), + Err(err) => assert_eq!(err, stellar_strkey::DecodeError::Invalid), + } + + // hex too long (33 bytes) + match contract_id_from_str( + "000000000000000000000000000000000000000000000000000000000000000000", + ) { + Ok(_) => panic!("Expected parsing to fail"), + Err(err) => assert_eq!(err, stellar_strkey::DecodeError::Invalid), + } } } diff --git a/cmd/crates/soroban-spec-tools/src/contract.rs b/cmd/soroban-cli/src/utils/contract_spec.rs similarity index 98% rename from cmd/crates/soroban-spec-tools/src/contract.rs rename to cmd/soroban-cli/src/utils/contract_spec.rs index 2d0d857cd..b4f24abec 100644 --- a/cmd/crates/soroban-spec-tools/src/contract.rs +++ b/cmd/soroban-cli/src/utils/contract_spec.rs @@ -10,7 +10,7 @@ use soroban_env_host::xdr::{ StringM, WriteXdr, }; -pub struct Spec { +pub struct ContractSpec { pub env_meta_base64: Option, pub env_meta: Vec, pub meta_base64: Option, @@ -38,7 +38,7 @@ pub enum Error { Parser(#[from] wasmparser::BinaryReaderError), } -impl Spec { +impl ContractSpec { pub fn new(bytes: &[u8]) -> Result { let mut env_meta: Option<&[u8]> = None; let mut meta: Option<&[u8]> = None; @@ -87,7 +87,7 @@ impl Spec { vec![] }; - Ok(Spec { + Ok(ContractSpec { env_meta_base64, env_meta, meta_base64, @@ -108,7 +108,7 @@ impl Spec { } } -impl Display for Spec { +impl Display for ContractSpec { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { if let Some(env_meta) = &self.env_meta_base64 { writeln!(f, "Env Meta: {env_meta}")?; diff --git a/cmd/soroban-cli/src/wasm.rs b/cmd/soroban-cli/src/wasm.rs index 4b8a7f8ca..fce44c7c5 100644 --- a/cmd/soroban-cli/src/wasm.rs +++ b/cmd/soroban-cli/src/wasm.rs @@ -1,12 +1,11 @@ use clap::arg; use soroban_env_host::xdr::{self, LedgerKey, LedgerKeyContractCode}; -use soroban_spec_tools::contract::{self, Spec}; use std::{ fs, io, path::{Path, PathBuf}, }; -use crate::utils::{self}; +use crate::utils::{self, contract_spec::ContractSpec}; #[derive(thiserror::Error, Debug)] pub enum Error { @@ -26,7 +25,7 @@ pub enum Error { #[error(transparent)] Parser(#[from] wasmparser::BinaryReaderError), #[error(transparent)] - ContractSpec(#[from] contract::Error), + ContractSpec(#[from] crate::utils::contract_spec::Error), } #[derive(Debug, clap::Args, Clone)] @@ -61,9 +60,9 @@ impl Args { /// # Errors /// May fail to read wasm file or parse xdr section - pub fn parse(&self) -> Result { + pub fn parse(&self) -> Result { let contents = self.read()?; - Ok(Spec::new(&contents)?) + Ok(ContractSpec::new(&contents)?) } } diff --git a/docs/soroban-cli-full-docs.md b/docs/soroban-cli-full-docs.md index e33794a22..34ab0caa2 100644 --- a/docs/soroban-cli-full-docs.md +++ b/docs/soroban-cli-full-docs.md @@ -110,28 +110,13 @@ Full CLI reference: https://github.com/stellar/soroban-tools/tree/main/docs/soro ###### **Options:** * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `-f`, `--filter-logs ` — Filter logs output. To turn on "soroban_cli::log::footprint=debug" or off "=off". Can also use env var `RUST_LOG` * `-q`, `--quiet` — Do not write logs to stderr including `INFO` - - Possible values: `true`, `false` - * `-v`, `--verbose` — Log DEBUG events - - Possible values: `true`, `false` - * `--very-verbose` — Log DEBUG and TRACE events - - Possible values: `true`, `false` - * `--list` — List installed plugins. E.g. `soroban-hello` - Possible values: `true`, `false` - - ## `soroban completion` @@ -200,9 +185,6 @@ Add a new network * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -220,9 +202,6 @@ Remove a network ###### **Options:** * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -236,15 +215,9 @@ List networks ###### **Options:** * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` — Get more info about the networks - Possible values: `true`, `false` - - ## `soroban config identity` @@ -278,17 +251,8 @@ Add a new identity (keypair, ledger, macOS keychain) ###### **Options:** * `--secret-key` — Add using secret_key Can provide with SOROBAN_SECRET_KEY - - Possible values: `true`, `false` - * `--seed-phrase` — Add using 12 word seed phrase to generate secret_key - - Possible values: `true`, `false` - * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -307,9 +271,6 @@ Given an identity return its address (public key) * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -331,9 +292,6 @@ Fund an identity on a test network * `--network ` — Name of network to use from config * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -351,24 +309,12 @@ Generate a new identity with a seed phrase, currently 12 words ###### **Options:** * `--no-fund` — Do not fund address - - Possible values: `true`, `false` - * `--seed ` — Optional seed to use when generating seed phrase. Random otherwise * `-s`, `--as-secret` — Output the generated identity as a secret key - - Possible values: `true`, `false` - * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--hd-path ` — When generating a secret key, which hd_path should be used from the original seed_phrase * `-d`, `--default-seed` — Generate the default seed phrase. Useful for testing. Equivalent to --seed 0000000000000000 - - Possible values: `true`, `false` - * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config @@ -384,15 +330,9 @@ List identities ###### **Options:** * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` - Possible values: `true`, `false` - - ## `soroban config identity rm` @@ -408,9 +348,6 @@ Remove an identity ###### **Options:** * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -429,9 +366,6 @@ Given an identity return its private key * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -489,9 +423,6 @@ Get Id of builtin Soroban Asset Contract. Deprecated, use `soroban contract id a * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -511,9 +442,6 @@ Deploy builtin Soroban Asset Contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -570,14 +498,8 @@ Generate a TypeScript / JavaScript package * `--wasm ` — Path to optional wasm binary * `--output-dir ` — Where to place generated project * `--overwrite` — Whether to overwrite output directory if it already exists - - Possible values: `true`, `false` - * `--contract-id ` — The contract ID/address on the network * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -606,19 +528,10 @@ To view the commands that will be executed, without executing them, use the --pr Default value: `release` * `--features ` — Build with the list of features activated, space or comma separated * `--all-features` — Build with the all features activated - - Possible values: `true`, `false` - * `--no-default-features` — Build with the default feature not activated - - Possible values: `true`, `false` - * `--out-dir ` — Directory to copy wasm files to * `--print-commands-only` — Print commands to build without executing them - Possible values: `true`, `false` - - ## `soroban contract extend` @@ -633,9 +546,6 @@ If no keys are specified the contract itself is extended. * `--ledgers-to-extend ` — Number of ledgers to extend the entries * `--ttl-ledger-only` — Only print the new Time To Live ledger - - Possible values: `true`, `false` - * `--id ` — Contract ID to which owns the data entries. If no keys provided the Contract's instance will be extended * `--key ` — Storage key (symbols only) * `--key-xdr ` — Storage key (base64-encoded XDR) @@ -643,8 +553,6 @@ If no keys are specified the contract itself is extended. * `--wasm-hash ` — Path to Wasm file of contract code to extend * `--durability ` — Storage entry durability - Default value: `persistent` - Possible values: - `persistent`: Persistent @@ -657,9 +565,6 @@ If no keys are specified the contract itself is extended. * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -684,9 +589,6 @@ Deploy a wasm contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -695,9 +597,6 @@ Deploy a wasm contract Default value: `false` - Possible values: `true`, `false` - - ## `soroban contract fetch` @@ -711,9 +610,6 @@ Fetch a contract's Wasm binary * `--id ` — Contract ID to fetch * `-o`, `--out-file ` — Where to write output otherwise stdout is used * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -749,9 +645,6 @@ Deploy builtin Soroban Asset Contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -771,9 +664,6 @@ Deploy normal Wasm Contract * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -819,9 +709,6 @@ Inspect a WASM file listing contract functions, meta, etc Pretty print of contract spec entries * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -840,9 +727,6 @@ Install a WASM file to the ledger without creating a contract instance * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -852,9 +736,6 @@ Install a WASM file to the ledger without creating a contract instance Default value: `false` - Possible values: `true`, `false` - - ## `soroban contract invoke` @@ -875,23 +756,12 @@ soroban contract invoke ... -- --help * `--id ` — Contract ID to invoke * `--cost` — Output the cost execution to stderr - - Possible values: `true`, `false` - -* `--instructions ` — Number of instructions to simulate -* `--is-view` — Do not sign and submit transaction - - Possible values: `true`, `false` - * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -939,8 +809,6 @@ Print the current value of a contract-data ledger entry * `--wasm-hash ` — Path to Wasm file of contract code to extend * `--durability ` — Storage entry durability - Default value: `persistent` - Possible values: - `persistent`: Persistent @@ -953,9 +821,6 @@ Print the current value of a contract-data ledger entry * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -977,8 +842,6 @@ If no keys are specificed the contract itself is restored. * `--wasm-hash ` — Path to Wasm file of contract code to extend * `--durability ` — Storage entry durability - Default value: `persistent` - Possible values: - `persistent`: Persistent @@ -987,18 +850,12 @@ If no keys are specificed the contract itself is restored. * `--ledgers-to-extend ` — Number of ledgers to extend the entry * `--ttl-ledger-only` — Only print the new Time To Live ledger - - Possible values: `true`, `false` - * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -1040,9 +897,6 @@ Watch the network for contract events Possible values: `all`, `contract`, `system` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -1081,17 +935,8 @@ Add a new identity (keypair, ledger, macOS keychain) ###### **Options:** * `--secret-key` — Add using secret_key Can provide with SOROBAN_SECRET_KEY - - Possible values: `true`, `false` - * `--seed-phrase` — Add using 12 word seed phrase to generate secret_key - - Possible values: `true`, `false` - * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -1110,9 +955,6 @@ Given an identity return its address (public key) * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -1134,9 +976,6 @@ Fund an identity on a test network * `--network ` — Name of network to use from config * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -1154,24 +993,12 @@ Generate a new identity with a seed phrase, currently 12 words ###### **Options:** * `--no-fund` — Do not fund address - - Possible values: `true`, `false` - * `--seed ` — Optional seed to use when generating seed phrase. Random otherwise * `-s`, `--as-secret` — Output the generated identity as a secret key - - Possible values: `true`, `false` - * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--hd-path ` — When generating a secret key, which hd_path should be used from the original seed_phrase * `-d`, `--default-seed` — Generate the default seed phrase. Useful for testing. Equivalent to --seed 0000000000000000 - - Possible values: `true`, `false` - * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--network ` — Name of network to use from config @@ -1187,15 +1014,9 @@ List identities ###### **Options:** * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` - Possible values: `true`, `false` - - ## `soroban keys rm` @@ -1211,9 +1032,6 @@ Remove an identity ###### **Options:** * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -1232,9 +1050,6 @@ Given an identity return its private key * `--hd-path ` — If identity is a seed phrase use this hd path, default is 0 * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -1280,9 +1095,6 @@ Deploy a token contract to wrap an existing Stellar classic asset for smart cont * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `--fee ` — fee amount for transaction, in stroops. 1 stroop = 0.0000001 xlm @@ -1305,9 +1117,6 @@ Compute the expected contract id for the given asset Deprecated, use `soroban co * `--source-account ` — Account that signs the final transaction. Alias `source`. Can be an identity (--source alice), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). Default: `identity generate --default-seed` * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -1487,9 +1296,6 @@ Add a new network * `--rpc-url ` — RPC server endpoint * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -1507,9 +1313,6 @@ Remove a network ###### **Options:** * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." @@ -1523,15 +1326,9 @@ List networks ###### **Options:** * `--global` — Use global config - - Possible values: `true`, `false` - * `--config-dir ` — Location of config directory, default is "." * `-l`, `--long` — Get more info about the networks - Possible values: `true`, `false` - - ## `soroban version` From 9bcf8e22bd7a30400b55993399f8c04389249bac Mon Sep 17 00:00:00 2001 From: Elizabeth Engelman <4752801+elizabethengelman@users.noreply.github.com> Date: Wed, 7 Feb 2024 11:50:15 -0500 Subject: [PATCH 5/5] Soroban contract init followup (#1176) * Upgrade gix version to 0.58.0 * Add frontend template option * Use a custom value_parser for with_examples * Pull possible example contracts from soroban-examples repo * Check if there is an internet connection and handle if not --------- Co-authored-by: Chad Ostrowski <221614+chadoh@users.noreply.github.com> --- Cargo.lock | 466 +++++++----------- cmd/soroban-cli/Cargo.toml | 11 +- cmd/soroban-cli/src/commands/contract/init.rs | 458 +++++++++++------ .../utils/contract-init-template/README.md | 22 +- docs/soroban-cli-full-docs.md | 7 +- 5 files changed, 526 insertions(+), 438 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7bda24ae8..b71023a6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -400,7 +400,7 @@ version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 2.0.39", @@ -721,12 +721,6 @@ dependencies = [ "syn 2.0.39", ] -[[package]] -name = "data-encoding" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" - [[package]] name = "der" version = "0.7.8" @@ -928,18 +922,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "enum-as-inner" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.39", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -968,15 +950,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" -[[package]] -name = "faster-hex" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239f7bfb930f820ab16a9cd95afc26f88264cf6905c960b340a615384aa3338a" -dependencies = [ - "serde", -] - [[package]] name = "faster-hex" version = "0.9.0" @@ -1156,12 +1129,13 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "gix" -version = "0.55.2" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "002667cd1ebb789313d0d0afe3d23b2821cf3b0e91605095f0e6d8751f0ceeea" +checksum = "31887c304d9a935f3e5494fb5d6a0106c34e965168ec0db9b457424eedd0c741" dependencies = [ "gix-actor", "gix-attributes", + "gix-command", "gix-commitgraph", "gix-config", "gix-credentials", @@ -1206,14 +1180,13 @@ dependencies = [ "reqwest", "smallvec", "thiserror", - "unicode-normalization", ] [[package]] name = "gix-actor" -version = "0.28.1" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eadca029ef716b4378f7afb19f7ee101fde9e58ba1f1445971315ac866db417" +checksum = "0a7bb9fad6125c81372987c06469601d37e1a2d421511adb69971b9083517a8a" dependencies = [ "bstr", "btoi", @@ -1225,9 +1198,9 @@ dependencies = [ [[package]] name = "gix-attributes" -version = "0.20.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f395469d38c76ec47cd1a6c5a53fbc3f13f737b96eaf7535f4e6b367e643381" +checksum = "214ee3792e504ee1ce206b36dcafa4f328ca313d1e2ac0b41433d68ef4e14260" dependencies = [ "bstr", "gix-glob", @@ -1260,32 +1233,35 @@ dependencies = [ [[package]] name = "gix-command" -version = "0.2.10" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c576cfbf577f72c097b5f88aedea502cd62952bdc1fb3adcab4531d5525a4c7" +checksum = "ce1ffc7db3fb50b7dae6ecd937a3527cb725f444614df2ad8988d81806f13f09" dependencies = [ "bstr", + "gix-path", + "gix-trace", + "shell-words", ] [[package]] name = "gix-commitgraph" -version = "0.22.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a7007ba021f059803afaf6f8a48872422abc20550ac12ede6ddea2936cec36" +checksum = "82dbd7fb959862e3df2583331f0ad032ac93533e8a52f1b0694bc517f5d292bc" dependencies = [ "bstr", "gix-chunk", "gix-features", "gix-hash", - "memmap2 0.9.3", + "memmap2", "thiserror", ] [[package]] name = "gix-config" -version = "0.31.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cae98c6b4c66c09379bc35274b172587d6b0ac369a416c39128ad8c6454f9bb" +checksum = "e62bf2073b6ce3921ffa6d8326f645f30eec5fc4a8e8a4bc0fcb721a2f3f69dc" dependencies = [ "bstr", "gix-config-value", @@ -1304,9 +1280,9 @@ dependencies = [ [[package]] name = "gix-config-value" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e0be46f4cf1f8f9e88d0e3eb7b29718aff23889563249f379119bd1ab6910e" +checksum = "5b8a1e7bfb37a46ed0b8468db37a6d8a0a61d56bdbe4603ae492cb322e5f3958" dependencies = [ "bitflags 2.4.1", "bstr", @@ -1317,9 +1293,9 @@ dependencies = [ [[package]] name = "gix-credentials" -version = "0.21.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c5c5d74069b842a1861e581027ac6b7ad9ff66f5911c89b9f45484d7ebda6a4" +checksum = "206ede3fe433abba3c8b0174179d5bbac65ae3f0d9187e2ea96c0494db6a139f" dependencies = [ "bstr", "gix-command", @@ -1327,6 +1303,7 @@ dependencies = [ "gix-path", "gix-prompt", "gix-sec", + "gix-trace", "gix-url", "thiserror", ] @@ -1345,10 +1322,11 @@ dependencies = [ [[package]] name = "gix-diff" -version = "0.37.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931394f69fb8c9ed6afc0aae3487bd869e936339bcc13ed8884472af072e0554" +checksum = "cbdcb5e49c4b9729dd1c361040ae5c3cd7c497b2260b18c954f62db3a63e98cf" dependencies = [ + "bstr", "gix-hash", "gix-object", "thiserror", @@ -1356,12 +1334,13 @@ dependencies = [ [[package]] name = "gix-discover" -version = "0.26.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a45d5cf0321178883e38705ab2b098f625d609a7d4c391b33ac952eff2c490f2" +checksum = "b4669218f3ec0cbbf8f16857b32200890f8ca585f36f5817242e4115fe4551af" dependencies = [ "bstr", "dunce", + "gix-fs", "gix-hash", "gix-path", "gix-ref", @@ -1371,15 +1350,16 @@ dependencies = [ [[package]] name = "gix-features" -version = "0.36.1" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d46a4a5c6bb5bebec9c0d18b65ada20e6517dbd7cf855b87dd4bbdce3a771b2" +checksum = "184f7f7d4e45db0e2a362aeaf12c06c5e84817d0ef91d08e8e90170dad9f0b07" dependencies = [ "bytes", "crc32fast", "flate2", "gix-hash", "gix-trace", + "gix-utils", "libc", "once_cell", "prodash", @@ -1390,9 +1370,9 @@ dependencies = [ [[package]] name = "gix-filter" -version = "0.6.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92f674d3fdb6b1987b04521ec9a5b7be8650671f2c4bbd17c3c81e2a364242ff" +checksum = "9240862840fb740d209422937195e129e4ed3da49af212383260134bea8f6c1a" dependencies = [ "bstr", "encoding_rs", @@ -1404,24 +1384,26 @@ dependencies = [ "gix-path", "gix-quote", "gix-trace", + "gix-utils", "smallvec", "thiserror", ] [[package]] name = "gix-fs" -version = "0.8.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20e86eb040f5776a5ade092282e51cdcad398adb77d948b88d17583c2ae4e107" +checksum = "4436e883d5769f9fb18677b8712b49228357815f9e4104174a6fc2d8461a437b" dependencies = [ "gix-features", + "gix-utils", ] [[package]] name = "gix-glob" -version = "0.14.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db19298c5eeea2961e5b3bf190767a2d1f09b8802aeb5f258e42276350aff19" +checksum = "4965a1d06d0ab84a29d4a67697a97352ab14ae1da821084e5afb1fd6d8191ca0" dependencies = [ "bitflags 2.4.1", "bstr", @@ -1431,19 +1413,19 @@ dependencies = [ [[package]] name = "gix-hash" -version = "0.13.3" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f8cf8c2266f63e582b7eb206799b63aa5fa68ee510ad349f637dfe2d0653de0" +checksum = "b0ed89cdc1dce26685c80271c4287077901de3c3dd90234d5fa47c22b2268653" dependencies = [ - "faster-hex 0.9.0", + "faster-hex", "thiserror", ] [[package]] name = "gix-hashtable" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feb61880816d7ec4f0b20606b498147d480860ddd9133ba542628df2f548d3ca" +checksum = "ebe47d8c0887f82355e2e9e16b6cecaa4d5e5346a7a474ca78ff94de1db35a5b" dependencies = [ "gix-hash", "hashbrown 0.14.3", @@ -1452,21 +1434,22 @@ dependencies = [ [[package]] name = "gix-ignore" -version = "0.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a215cc8cf21645bca131fcf6329d3ebd46299c47dbbe27df71bb1ca9e328b879" +checksum = "1f7069aaca4a05784c4cb44e392f0eaf627c6e57e05d3100c0e2386a37a682f0" dependencies = [ "bstr", "gix-glob", "gix-path", + "gix-trace", "unicode-bom", ] [[package]] name = "gix-index" -version = "0.26.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83a4fcc121b2f2e109088f677f89f85e7a8ebf39e8e6659c0ae54d4283b1650" +checksum = "1d7152181ba8f0a3addc5075dd612cea31fc3e252b29c8be8c45f4892bf87426" dependencies = [ "bitflags 2.4.1", "bstr", @@ -1480,16 +1463,18 @@ dependencies = [ "gix-object", "gix-traverse", "itoa", - "memmap2 0.7.1", + "libc", + "memmap2", + "rustix", "smallvec", "thiserror", ] [[package]] name = "gix-lock" -version = "11.0.1" +version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e5c65e6a29830a435664891ced3f3c1af010f14900226019590ee0971a22f37" +checksum = "651e46174dc5e7d18b7b809d31937b6de3681b1debd78618c99162cc30fcf3e1" dependencies = [ "gix-tempfile", "gix-utils", @@ -1509,9 +1494,9 @@ dependencies = [ [[package]] name = "gix-negotiate" -version = "0.9.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a5cdcf491ecc9ce39dcc227216c540355fe0024ae7c38e94557752ca5ebb67f" +checksum = "a163adb84149e522e991cbe27250a6e01de56f98cd05b174614ce3f8a4e8b140" dependencies = [ "bitflags 2.4.1", "gix-commitgraph", @@ -1525,9 +1510,9 @@ dependencies = [ [[package]] name = "gix-object" -version = "0.38.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740f2a44267f58770a1cb3a3d01d14e67b089c7136c48d4bddbb3cfd2bf86a51" +checksum = "693ce9d30741506cb082ef2d8b797415b48e032cce0ab23eff894c19a7e4777b" dependencies = [ "bstr", "btoi", @@ -1544,13 +1529,14 @@ dependencies = [ [[package]] name = "gix-odb" -version = "0.54.0" +version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8630b56cb80d8fa684d383dad006a66401ee8314e12fbf0e566ddad8c115143b" +checksum = "8ba2fa9e81f2461b78b4d81a807867667326c84cdab48e0aed7b73a593aa1be4" dependencies = [ "arc-swap", "gix-date", "gix-features", + "gix-fs", "gix-hash", "gix-object", "gix-pack", @@ -1563,9 +1549,9 @@ dependencies = [ [[package]] name = "gix-pack" -version = "0.44.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1431ba2e30deff1405920693d54ab231c88d7c240dd6ccc936ee223d8f8697c3" +checksum = "8da5f3e78c96b76c4e6fe5e8e06b76221e4a0ee9a255aa935ed1fdf68988dfd8" dependencies = [ "clru", "gix-chunk", @@ -1575,7 +1561,7 @@ dependencies = [ "gix-object", "gix-path", "gix-tempfile", - "memmap2 0.7.1", + "memmap2", "parking_lot", "smallvec", "thiserror", @@ -1583,31 +1569,33 @@ dependencies = [ [[package]] name = "gix-packetline" -version = "0.16.7" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a8384b1e964151aff0d5632dd9b191059d07dff358b96bd940f1b452600d7ab" +checksum = "09ff45eef7747bde4986429a3e813478d50c2688b8f239e57bd3aa81065b285f" dependencies = [ "bstr", - "faster-hex 0.8.1", + "faster-hex", + "gix-trace", "thiserror", ] [[package]] name = "gix-packetline-blocking" -version = "0.16.6" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d8395f7501c84d6a1fe902035fdfd8cd86d89e2dd6be0200ec1a72fd3c92d39" +checksum = "ca8ef6dd3ea50e26f3bf572e90c034d033c804d340cd1eb386392f184a9ba2f7" dependencies = [ "bstr", - "faster-hex 0.8.1", + "faster-hex", + "gix-trace", "thiserror", ] [[package]] name = "gix-path" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dd0998ab245f33d40ca2267e58d542fe54185ebd1dc41923346cf28d179fb6" +checksum = "97e9ad649bf5e109562d6acba657ca428661ec08e77eaf3a755d8fa55485be9c" dependencies = [ "bstr", "gix-trace", @@ -1618,9 +1606,9 @@ dependencies = [ [[package]] name = "gix-pathspec" -version = "0.4.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dbbb92f75a38ef043c8bb830b339b38d0698d7f3746968b5fcbade7a880494d" +checksum = "9cbd49750edb26b0a691e5246fc635fa554d344da825cd20fa9ee0da9c1b761f" dependencies = [ "bitflags 2.4.1", "bstr", @@ -1633,9 +1621,9 @@ dependencies = [ [[package]] name = "gix-prompt" -version = "0.7.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c9a913769516f5e9d937afac206fb76428e3d7238e538845842887fda584678" +checksum = "02bd89d058258e53e0fd6c57f13ee16c5673a83066a68e11f88626fc8cfda5f6" dependencies = [ "gix-command", "gix-config-value", @@ -1646,9 +1634,9 @@ dependencies = [ [[package]] name = "gix-protocol" -version = "0.41.1" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391e3feabdfa5f90dad6673ce59e3291ac28901b2ff248d86c5a7fbde0391e0e" +checksum = "84af465436787ff423a1b4d5bd0c1979200e7165ed04324fa03ba2235485eebc" dependencies = [ "bstr", "btoi", @@ -1675,9 +1663,9 @@ dependencies = [ [[package]] name = "gix-ref" -version = "0.38.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec2f6d07ac88d2fb8007ee3fa3e801856fb9d82e7366ec0ca332eb2c9d74a52" +checksum = "5818958994ad7879fa566f5441ebcc48f0926aa027b28948e6fbf6578894dc31" dependencies = [ "gix-actor", "gix-date", @@ -1688,17 +1676,18 @@ dependencies = [ "gix-object", "gix-path", "gix-tempfile", + "gix-utils", "gix-validate", - "memmap2 0.7.1", + "memmap2", "thiserror", "winnow", ] [[package]] name = "gix-refspec" -version = "0.19.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb0974cc41dbdb43a180c7f67aa481e1c1e160fcfa8f4a55291fd1126c1a6e7" +checksum = "613aa4d93034c5791d13bdc635e530f4ddab1412ddfb4a8215f76213177b61c7" dependencies = [ "bstr", "gix-hash", @@ -1710,9 +1699,9 @@ dependencies = [ [[package]] name = "gix-revision" -version = "0.23.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ca97ac73459a7f3766aa4a5638a6e37d56d4c7962bc1986fbaf4883d0772588" +checksum = "288f6549d7666db74dc3f169a9a333694fc28ecd2f5aa7b2c979c89eb556751a" dependencies = [ "bstr", "gix-date", @@ -1726,9 +1715,9 @@ dependencies = [ [[package]] name = "gix-revwalk" -version = "0.9.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a16d8c892e4cd676d86f0265bf9d40cefd73d8d94f86b213b8b77d50e77efae0" +checksum = "5b9b4d91dfc5c14fee61a28c65113ded720403b65a0f46169c0460f731a5d03c" dependencies = [ "gix-commitgraph", "gix-date", @@ -1741,21 +1730,21 @@ dependencies = [ [[package]] name = "gix-sec" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f6dce0c6683e2219e8169aac4b1c29e89540a8262fef7056b31d80d969408c" +checksum = "f8d9bf462feaf05f2121cba7399dbc6c34d88a9cad58fc1e95027791d6a3c6d2" dependencies = [ "bitflags 2.4.1", "gix-path", "libc", - "windows", + "windows-sys 0.52.0", ] [[package]] name = "gix-submodule" -version = "0.5.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bba78c8d12aa24370178453ec3a472ff08dfaa657d116229f57f2c9cd469a1c2" +checksum = "73182f6c1f5ed1ed94ba16581ac62593d5e29cd1c028b2af618f836283b8f8d4" dependencies = [ "bstr", "gix-config", @@ -1768,9 +1757,9 @@ dependencies = [ [[package]] name = "gix-tempfile" -version = "11.0.1" +version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388dd29114a86ec69b28d1e26d6d63a662300ecf61ab3f4cc578f7d7dc9e7e23" +checksum = "2d337955b7af00fb87120d053d87cdfb422a80b9ff7a3aa4057a99c79422dc30" dependencies = [ "gix-fs", "libc", @@ -1781,15 +1770,15 @@ dependencies = [ [[package]] name = "gix-trace" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e1127ede0475b58f4fe9c0aaa0d9bb0bad2af90bbd93ccd307c8632b863d89" +checksum = "02b202d766a7fefc596e2cc6a89cda8ad8ad733aed82da635ac120691112a9b1" [[package]] name = "gix-transport" -version = "0.38.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f209a93364e24f20319751bc11092272e2f3fe82bb72592b2822679cf5be752" +checksum = "58aba2869cc38937bc834b068c93e09e2ab1119bac626f0464d100c1438b799a" dependencies = [ "base64 0.21.5", "bstr", @@ -1806,9 +1795,9 @@ dependencies = [ [[package]] name = "gix-traverse" -version = "0.34.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d050ec7d4e1bb76abf0636cf4104fb915b70e54e3ced9a4427c999100ff38a" +checksum = "bfc30c5b5e4e838683b59e1b0574ce6bc1c35916df9709aaab32bb7751daf08b" dependencies = [ "gix-commitgraph", "gix-date", @@ -1822,9 +1811,9 @@ dependencies = [ [[package]] name = "gix-url" -version = "0.25.2" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c427a1a11ccfa53a4a2da47d9442c2241deee63a154bc15cc14b8312fbc4005" +checksum = "26f1981ecc700f4fd73ae62b9ca2da7c8816c8fd267f0185e3f8c21e967984ac" dependencies = [ "bstr", "gix-features", @@ -1836,11 +1825,12 @@ dependencies = [ [[package]] name = "gix-utils" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de6225e2de30b6e9bca2d9f1cc4731640fcef0fb3cabddceee366e7e85d3e94f" +checksum = "56e839f3d0798b296411263da6bee780a176ef8008a5dfc31287f7eda9266ab8" dependencies = [ "fastrand", + "unicode-normalization", ] [[package]] @@ -1855,9 +1845,9 @@ dependencies = [ [[package]] name = "gix-worktree" -version = "0.27.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddaf79e721dba64fe726a42f297a3c8ed42e55cdc0d81ca68452f2def3c2d7fd" +checksum = "ca36bb3dc54038c66507dc75c4d8edbee2d6d5cc45227b4eb508ad13dd60a006" dependencies = [ "bstr", "gix-attributes", @@ -1873,9 +1863,9 @@ dependencies = [ [[package]] name = "gix-worktree-state" -version = "0.4.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34a2fcccdcaf3c71c00a03df31c9aa459d444cabbec4ed9ca1fa64e43406bed4" +checksum = "8ae178614b70bdb0c7f6f21b8c9fb711ab78bd7e8e1866f565fcf28876747f1d" dependencies = [ "bstr", "gix-features", @@ -1963,6 +1953,15 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "heck" version = "0.4.1" @@ -2018,17 +2017,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "hostname" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -dependencies = [ - "libc", - "match_cfg", - "winapi", -] - [[package]] name = "http" version = "0.2.11" @@ -2127,7 +2115,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core 0.51.1", + "windows-core", ] [[package]] @@ -2145,16 +2133,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.5.0" @@ -2239,18 +2217,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "ipconfig" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" -dependencies = [ - "socket2 0.5.5", - "widestring", - "windows-sys 0.48.0", - "winreg", -] - [[package]] name = "ipnet" version = "2.9.0" @@ -2422,12 +2388,6 @@ dependencies = [ "cc", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.4.12" @@ -2450,21 +2410,6 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - -[[package]] -name = "match_cfg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" - [[package]] name = "matchers" version = "0.1.0" @@ -2491,15 +2436,6 @@ version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" -[[package]] -name = "memmap2" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" -dependencies = [ - "libc", -] - [[package]] name = "memmap2" version = "0.9.3" @@ -2919,15 +2855,9 @@ dependencies = [ [[package]] name = "prodash" -version = "26.2.2" +version = "28.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794b5bf8e2d19b53dcdcec3e4bba628e20f5b6062503ba89281fa7037dd7bbcf" - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +checksum = "744a264d26b88a6a7e37cbad97953fa233b94d585236310bcbc88474b4092d79" [[package]] name = "quote" @@ -3070,7 +3000,6 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", - "trust-dns-resolver", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -3079,16 +3008,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "resolv-conf" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" -dependencies = [ - "hostname", - "quick-error", -] - [[package]] name = "rfc6979" version = "0.4.0" @@ -3453,6 +3372,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shell-words" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" + [[package]] name = "shlex" version = "1.2.0" @@ -3561,7 +3486,7 @@ dependencies = [ "ed25519-dalek 2.0.0", "ethnum", "gix", - "heck", + "heck 0.4.1", "hex", "http", "hyper", @@ -3579,7 +3504,6 @@ dependencies = [ "sep5", "serde", "serde-aux", - "serde_derive", "serde_json", "sha2 0.10.8", "shlex", @@ -3594,6 +3518,8 @@ dependencies = [ "stellar-strkey 0.0.7", "stellar-xdr", "strsim", + "strum 0.17.1", + "strum_macros 0.17.1", "tempfile", "termcolor", "termcolor_output", @@ -3604,6 +3530,7 @@ dependencies = [ "tracing", "tracing-appender", "tracing-subscriber", + "ureq", "wasm-opt", "wasmparser 0.90.0", "which", @@ -3815,7 +3742,7 @@ name = "soroban-spec-typescript" version = "20.3.0" dependencies = [ "base64 0.21.5", - "heck", + "heck 0.4.1", "include_dir", "itertools 0.10.5", "pretty_assertions", @@ -3944,19 +3871,37 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strum" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "530efb820d53b712f4e347916c5e7ed20deb76a4f0457943b3182fb889b06d2c" + [[package]] name = "strum" version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +[[package]] +name = "strum_macros" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6e163a520367c465f59e0a61a23cfae3b10b6546d78b6f672a382be79f7110" +dependencies = [ + "heck 0.3.3", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "strum_macros" version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", @@ -4384,52 +4329,6 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "trust-dns-proto" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" -dependencies = [ - "async-trait", - "cfg-if", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna 0.4.0", - "ipnet", - "once_cell", - "rand", - "smallvec", - "thiserror", - "tinyvec", - "tokio", - "tracing", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" -dependencies = [ - "cfg-if", - "futures-util", - "ipconfig", - "lru-cache", - "once_cell", - "parking_lot", - "rand", - "resolv-conf", - "smallvec", - "thiserror", - "tokio", - "tracing", - "trust-dns-proto", -] - [[package]] name = "try-lock" version = "0.2.5" @@ -4469,6 +4368,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + [[package]] name = "unicode-width" version = "0.1.11" @@ -4481,6 +4386,24 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "ureq" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97" +dependencies = [ + "base64 0.21.5", + "flate2", + "log", + "once_cell", + "rustls", + "rustls-webpki", + "serde", + "serde_json", + "url", + "webpki-roots", +] + [[package]] name = "url" version = "2.5.0" @@ -4488,7 +4411,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna", "percent-encoding", ] @@ -4624,8 +4547,8 @@ checksum = "effbef3bd1dde18acb401f73e740a6f3d4a1bc651e9773bddc512fe4d8d68f67" dependencies = [ "anyhow", "libc", - "strum", - "strum_macros", + "strum 0.24.1", + "strum_macros 0.24.3", "tempfile", "thiserror", "wasm-opt-cxx-sys", @@ -4730,12 +4653,6 @@ dependencies = [ "rustix", ] -[[package]] -name = "widestring" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" - [[package]] name = "winapi" version = "0.3.9" @@ -4767,16 +4684,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" -dependencies = [ - "windows-core 0.52.0", - "windows-targets 0.52.0", -] - [[package]] name = "windows-core" version = "0.51.1" @@ -4786,15 +4693,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.0", -] - [[package]] name = "windows-sys" version = "0.48.0" diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml index bd68ae2bb..c37ad0d7b 100644 --- a/cmd/soroban-cli/Cargo.toml +++ b/cmd/soroban-cli/Cargo.toml @@ -53,9 +53,8 @@ clap = { version = "4.1.8", features = [ ] } base64 = { workspace = true } thiserror = { workspace = true } -serde = "1.0.82" -serde_derive = "1.0.82" -serde_json = "1.0.82" +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } serde-aux = "4.1.2" hex = { workspace = true } num-bigint = "0.4" @@ -93,10 +92,14 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] } cargo_metadata = "0.15.4" pathdiff = "0.2.1" dotenvy = "0.15.7" -gix = { version = "0.55.2", default-features = false, features = [ +strum = "0.17.1" +strum_macros = "0.17.1" +gix = { version = "0.58.0", default-features = false, features = [ "blocking-http-transport-reqwest-rust-tls", "worktree-mutation", ] } +ureq = {version = "2.9.1", features = ["json"]} + tempfile = "3.8.1" toml_edit = "0.21.0" # For hyper-tls diff --git a/cmd/soroban-cli/src/commands/contract/init.rs b/cmd/soroban-cli/src/commands/contract/init.rs index 435ea20e2..5db62f81b 100644 --- a/cmd/soroban-cli/src/commands/contract/init.rs +++ b/cmd/soroban-cli/src/commands/contract/init.rs @@ -1,62 +1,23 @@ -use core::fmt; use std::fs::read_to_string; use std::path::Path; use std::{env, fs, io}; -use clap::Parser; +use clap::builder::{PossibleValue, PossibleValuesParser, ValueParser}; +use clap::{Parser, ValueEnum}; +use serde::Deserialize; use std::num::NonZeroU32; use std::sync::atomic::AtomicBool; use toml_edit::{Document, Formatted, InlineTable, TomlError, Value}; -#[derive(Clone, Debug, PartialEq, clap::ValueEnum)] -pub enum ExampleContract { - Account, - Alloc, - AtomicMultiswap, - AtomicSwap, - Auth, - CrossContract, - CustomTypes, - DeepContractAuth, - Deployer, - Errors, - Events, - Fuzzing, - Increment, - LiquidityPool, - Logging, - SimpleAccount, - SingleOffer, - Timelock, - Token, - UpgradeableContract, -} - -impl fmt::Display for ExampleContract { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - ExampleContract::Account => write!(f, "account"), - ExampleContract::Alloc => write!(f, "alloc"), - ExampleContract::AtomicMultiswap => write!(f, "atomic_multiswap"), - ExampleContract::AtomicSwap => write!(f, "atomic_swap"), - ExampleContract::Auth => write!(f, "auth"), - ExampleContract::CrossContract => write!(f, "cross_contract"), - ExampleContract::CustomTypes => write!(f, "custom_types"), - ExampleContract::DeepContractAuth => write!(f, "deep_contract_auth"), - ExampleContract::Deployer => write!(f, "deployer"), - ExampleContract::Errors => write!(f, "errors"), - ExampleContract::Events => write!(f, "events"), - ExampleContract::Fuzzing => write!(f, "fuzzing"), - ExampleContract::Increment => write!(f, "increment"), - ExampleContract::LiquidityPool => write!(f, "liquidity_pool"), - ExampleContract::Logging => write!(f, "logging"), - ExampleContract::SimpleAccount => write!(f, "simple_account"), - ExampleContract::SingleOffer => write!(f, "single_offer"), - ExampleContract::Timelock => write!(f, "timelock"), - ExampleContract::Token => write!(f, "token"), - ExampleContract::UpgradeableContract => write!(f, "upgradeable_contract"), - } - } +const SOROBAN_EXAMPLES_URL: &str = "https://github.com/stellar/soroban-examples.git"; +const GITHUB_URL: &str = "https://github.com"; +const GITHUB_API_URL: &str = + "https://api.github.com/repos/stellar/soroban-examples/git/trees/main?recursive=1"; + +#[derive(Clone, Debug, ValueEnum, PartialEq)] +pub enum FrontendTemplate { + Astro, + None, } #[derive(Parser, Debug, Clone)] @@ -64,9 +25,68 @@ impl fmt::Display for ExampleContract { pub struct Cmd { pub project_path: String, - /// An optional flag to specify Soroban example contracts to include. A hello-world contract will be included by default. - #[arg(short, long, num_args = 1..=20)] - pub with_example: Vec, + #[arg(short, long, num_args = 1.., value_parser=possible_example_values(), long_help=with_example_help())] + pub with_example: Vec, + + #[arg( + short, + long, + default_value = "", + long_help = "An optional flag to pass in a url for a frontend template repository." + )] + pub frontend_template: String, +} + +fn possible_example_values() -> ValueParser { + // If fetching the example contracts from the soroban-examples repo succeeds, return a parser with the example contracts. + if let Ok(examples) = get_valid_examples() { + let parser = PossibleValuesParser::new(examples.iter().map(PossibleValue::new)); + return parser.into(); + } + + // If fetching with example contracts fails, return a string parser that will allow for any value. It will be ignored in `init`. + ValueParser::string() +} + +fn with_example_help() -> String { + if check_internet_connection() { + "An optional flag to specify Soroban example contracts to include. A hello-world contract will be included by default.".to_owned() + } else { + "⚠️ Failed to fetch additional example contracts from soroban-examples repo. You can continue with initializing - the default hello_world contract will still be included".to_owned() + } +} + +#[derive(Deserialize, Debug)] +struct RepoPath { + path: String, + #[serde(rename = "type")] + type_field: String, +} + +#[derive(Deserialize, Debug)] +struct ReqBody { + tree: Vec, +} + +fn get_valid_examples() -> Result, Error> { + let body: ReqBody = ureq::get(GITHUB_API_URL) + .call() + .map_err(Box::new)? + .into_json()?; + let mut valid_examples = Vec::new(); + for item in body.tree { + if item.type_field == "blob" + || item.path.starts_with('.') + || item.path.contains('/') + || item.path == "hello_world" + { + continue; + } + + valid_examples.push(item.path); + } + + Ok(valid_examples) } #[derive(thiserror::Error, Debug)] @@ -87,9 +107,13 @@ pub enum Error { #[error("Failed to parse Cargo.toml: {0}")] TomlParseError(#[from] TomlError), -} -const SOROBAN_EXAMPLES_URL: &str = "https://github.com/stellar/soroban-examples.git"; + #[error("Failed to fetch example contracts")] + ExampleContractFetchError(#[from] Box), + + #[error("Failed to parse package.json file: {0}")] + JsonParseError(#[from] serde_json::Error), +} impl Cmd { #[allow(clippy::unused_self)] @@ -97,28 +121,49 @@ impl Cmd { println!("ℹ️ Initializing project at {}", self.project_path); let project_path = Path::new(&self.project_path); - init(project_path, &self.with_example)?; + init(project_path, &self.frontend_template, &self.with_example)?; Ok(()) } } -fn init(project_path: &Path, with_examples: &[ExampleContract]) -> Result<(), Error> { +fn init( + project_path: &Path, + frontend_template: &String, + with_examples: &[String], +) -> Result<(), Error> { let cli_cmd_root = env!("CARGO_MANIFEST_DIR"); let template_dir_path = Path::new(cli_cmd_root) .join("src") .join("utils") .join("contract-init-template"); + // create a project dir, and copy the contents of the base template (contract-init-template) into it std::fs::create_dir_all(project_path)?; copy_contents(template_dir_path.as_path(), project_path)?; - // if there are with-contract flags, include the example contracts + if !check_internet_connection() { + println!("⚠️ It doesn't look like you're connected to the internet. We're still able to initialize a new project, but additional examples and the frontend template will not be included."); + return Ok(()); + } + + if !frontend_template.is_empty() { + // create a temp dir for the template repo + let fe_template_dir = tempfile::tempdir()?; + + // clone the template repo into the temp dir + clone_repo(frontend_template, fe_template_dir.path())?; + + // copy the frontend template files into the project + copy_frontend_files(fe_template_dir.path(), project_path); + } + + // if there are --with-example flags, include the example contracts if include_example_contracts(with_examples) { - // create an examples temp dir in the temp dir + // create an examples temp dir let examples_dir = tempfile::tempdir()?; - // clone the soroban-examples repo into temp dir + // clone the soroban-examples repo into the temp dir clone_repo(SOROBAN_EXAMPLES_URL, examples_dir.path())?; // copy the example contracts into the project @@ -152,6 +197,12 @@ fn copy_contents(from: &Path, to: &Path) -> Result<(), Error> { copy_contents(&path, &new_path)?; } else { if file_exists(&new_path.to_string_lossy()) { + //if file is .gitignore, overwrite the file with a new .gitignore file + if path.to_string_lossy().contains(".gitignore") { + std::fs::copy(&path, &new_path)?; + continue; + } + println!( "ℹ️ Skipped creating {} as it already exists", &new_path.to_string_lossy() @@ -175,12 +226,12 @@ fn file_exists(file_path: &str) -> bool { } } -fn include_example_contracts(contracts: &[ExampleContract]) -> bool { +fn include_example_contracts(contracts: &[String]) -> bool { !contracts.is_empty() } fn clone_repo(from_url: &str, to_path: &Path) -> Result<(), Error> { - let mut fetch = gix::clone::PrepareFetch::new( + let mut prepare = gix::clone::PrepareFetch::new( from_url, to_path, gix::create::Kind::WithWorktree, @@ -195,21 +246,17 @@ fn clone_repo(from_url: &str, to_path: &Path) -> Result<(), Error> { NonZeroU32::new(1).unwrap(), )); - let (mut prepare, _outcome) = fetch + let (mut checkout, _outcome) = prepare .fetch_then_checkout(gix::progress::Discard, &AtomicBool::new(false)) .map_err(Box::new)?; let (_repo, _outcome) = - prepare.main_worktree(gix::progress::Discard, &AtomicBool::new(false))?; + checkout.main_worktree(gix::progress::Discard, &AtomicBool::new(false))?; Ok(()) } -fn copy_example_contracts( - from: &Path, - to: &Path, - contracts: &[ExampleContract], -) -> Result<(), Error> { +fn copy_example_contracts(from: &Path, to: &Path, contracts: &[String]) -> Result<(), Error> { let project_contracts_path = to.join("contracts"); for contract in contracts { println!("ℹ️ Initializing example contract: {contract}"); @@ -246,43 +293,66 @@ fn edit_contract_cargo_file(contract_path: &Path) -> Result<(), Error> { Ok(()) } +fn copy_frontend_files(from: &Path, to: &Path) { + println!("ℹ️ Initializing with frontend template"); + let _ = copy_contents(from, to); + let _ = edit_package_json_files(to); +} + +fn edit_package_json_files(project_path: &Path) -> Result<(), Error> { + let package_name = project_path.file_name().unwrap(); + edit_package_name(project_path, package_name, "package.json")?; + edit_package_name(project_path, package_name, "package-lock.json") +} + +fn edit_package_name( + project_path: &Path, + package_name: &std::ffi::OsStr, + file_name: &str, +) -> Result<(), Error> { + let file_path = project_path.join(file_name); + let file_contents = read_to_string(&file_path)?; + + let mut doc: serde_json::Value = serde_json::from_str(&file_contents)?; + + doc["name"] = serde_json::json!(package_name.to_string_lossy()); + + std::fs::write(&file_path, doc.to_string())?; + + Ok(()) +} + +fn check_internet_connection() -> bool { + if let Ok(_req) = ureq::get(GITHUB_URL).call() { + return true; + } + + false +} + #[cfg(test)] mod tests { use std::fs::read_to_string; use super::*; + const TEST_PROJECT_NAME: &str = "test-project"; + #[test] fn test_init() { let temp_dir = tempfile::tempdir().unwrap(); - let project_dir = temp_dir.path().join("project"); + let project_dir = temp_dir.path().join(TEST_PROJECT_NAME); let with_examples = vec![]; - init(project_dir.as_path(), &with_examples).unwrap(); - - assert!(project_dir.as_path().join("README.md").exists()); - assert!(project_dir.as_path().join("contracts").exists()); - assert!(project_dir.as_path().join("Cargo.toml").exists()); - - // check that it includes the default hello-world contract - assert!(project_dir - .as_path() - .join("contracts") - .join("hello_world") - .exists()); + init(project_dir.as_path(), &String::new(), &with_examples).unwrap(); + + assert_base_template_files_exist(&project_dir); + assert_default_hello_world_contract_files_exist(&project_dir); + assert_base_excluded_paths_do_not_exist(&project_dir); + // check that the contract's Cargo.toml file uses the workspace for dependencies - let contract_cargo_path = project_dir - .as_path() - .join("contracts") - .join("hello_world") - .join("Cargo.toml"); - let cargo_toml_str = read_to_string(contract_cargo_path).unwrap(); - assert!(cargo_toml_str.contains("soroban-sdk = { workspace = true }")); + assert_contract_cargo_file_uses_workspace(&project_dir, "hello_world"); - // check that it does not include certain template files and directories - assert!(!project_dir.as_path().join(".git").exists()); - assert!(!project_dir.as_path().join(".github").exists()); - assert!(!project_dir.as_path().join("Cargo.lock").exists()); - assert!(!project_dir.as_path().join(".vscode").exists()); + assert_base_excluded_paths_do_not_exist(&project_dir); temp_dir.close().unwrap(); } @@ -290,45 +360,22 @@ mod tests { #[test] fn test_init_including_example_contract() { let temp_dir = tempfile::tempdir().unwrap(); - let project_dir = temp_dir.path().join("project"); - let with_examples = vec![ExampleContract::Alloc]; - init(project_dir.as_path(), &with_examples).unwrap(); - - assert!(project_dir.as_path().join("README.md").exists()); - assert!(project_dir - .as_path() - .join("contracts") - .join("alloc") - .exists()); - - // check that it does not include certain template files and directories - assert!(!project_dir.as_path().join(".git").exists()); - assert!(!project_dir.as_path().join(".github").exists()); - assert!(!project_dir.as_path().join("Cargo.lock").exists()); - assert!(!project_dir.as_path().join(".vscode").exists()); - - // check that it does not include certain contract files - assert!(!project_dir - .as_path() - .join("contracts") - .join("alloc") - .join("Makefile") - .exists()); - assert!(!project_dir - .as_path() - .join("contracts") - .join("alloc") - .join("Cargo.lock") - .exists()); + let project_dir = temp_dir.path().join(TEST_PROJECT_NAME); + let with_examples = ["alloc".to_owned()]; + init(project_dir.as_path(), &String::new(), &with_examples).unwrap(); - // check that the contract's Cargo.toml file uses the workspace for dependencies - let contract_cargo_path = project_dir - .as_path() - .join("contracts") - .join("alloc") - .join("Cargo.toml"); - let cargo_toml_str = read_to_string(contract_cargo_path).unwrap(); - assert!(cargo_toml_str.contains("soroban-sdk = { workspace = true }")); + assert_base_template_files_exist(&project_dir); + assert_default_hello_world_contract_files_exist(&project_dir); + assert_base_excluded_paths_do_not_exist(&project_dir); + + // check that alloc contract files exist + assert_contract_files_exist(&project_dir, "alloc"); + + // check that expected files are excluded from the alloc contract dir + assert_example_contract_excluded_files_do_not_exist(&project_dir, "alloc"); + + // check that the alloc contract's Cargo.toml file uses the workspace for dependencies + assert_contract_cargo_file_uses_workspace(&project_dir, "alloc"); temp_dir.close().unwrap(); } @@ -337,20 +384,139 @@ mod tests { fn test_init_including_multiple_example_contracts() { let temp_dir = tempfile::tempdir().unwrap(); let project_dir = temp_dir.path().join("project"); - let with_examples = vec![ExampleContract::Account, ExampleContract::AtomicSwap]; - init(project_dir.as_path(), &with_examples).unwrap(); - - assert!(project_dir - .as_path() - .join("contracts") - .join("account") - .exists()); - assert!(project_dir - .as_path() - .join("contracts") - .join("atomic_swap") - .exists()); + let with_examples = ["account".to_owned(), "atomic_swap".to_owned()]; + init(project_dir.as_path(), &String::new(), &with_examples).unwrap(); + + assert_base_template_files_exist(&project_dir); + assert_default_hello_world_contract_files_exist(&project_dir); + assert_base_excluded_paths_do_not_exist(&project_dir); + + // check that account contract files exist and that expected files are excluded + assert_contract_files_exist(&project_dir, "account"); + assert_example_contract_excluded_files_do_not_exist(&project_dir, "account"); + assert_contract_cargo_file_uses_workspace(&project_dir, "account"); + + // check that atomic_swap contract files exist and that expected files are excluded + assert_contract_files_exist(&project_dir, "atomic_swap"); + assert_example_contract_excluded_files_do_not_exist(&project_dir, "atomic_swap"); + assert_contract_cargo_file_uses_workspace(&project_dir, "atomic_swap"); + + temp_dir.close().unwrap(); + } + + #[test] + fn test_init_with_invalid_example_contract() { + let temp_dir = tempfile::tempdir().unwrap(); + let project_dir = temp_dir.path().join("project"); + let with_examples = ["invalid_example".to_owned(), "atomic_swap".to_owned()]; + assert!(init(project_dir.as_path(), &String::new(), &with_examples,).is_err()); + + temp_dir.close().unwrap(); + } + + #[test] + fn test_init_with_frontend_template() { + let temp_dir = tempfile::tempdir().unwrap(); + let project_dir = temp_dir.path().join(TEST_PROJECT_NAME); + let with_examples = vec![]; + init( + project_dir.as_path(), + &"https://github.com/AhaLabs/soroban-astro-template".to_string(), + &with_examples, + ) + .unwrap(); + + assert_base_template_files_exist(&project_dir); + assert_default_hello_world_contract_files_exist(&project_dir); + assert_base_excluded_paths_do_not_exist(&project_dir); + + // check that the contract's Cargo.toml file uses the workspace for dependencies + assert_contract_cargo_file_uses_workspace(&project_dir, "hello_world"); + assert_base_excluded_paths_do_not_exist(&project_dir); + + assert_astro_files_exist(&project_dir); + assert_gitignore_includes_astro_paths(&project_dir); + assert_package_json_files_have_correct_name(&project_dir); temp_dir.close().unwrap(); } + + // test helpers + fn assert_base_template_files_exist(project_dir: &Path) { + let expected_paths = ["contracts", "Cargo.toml", "README.md"]; + for path in &expected_paths { + assert!(project_dir.join(path).exists()); + } + } + + fn assert_default_hello_world_contract_files_exist(project_dir: &Path) { + assert_contract_files_exist(project_dir, "hello_world"); + } + + fn assert_contract_files_exist(project_dir: &Path, contract_name: &str) { + let contract_dir = project_dir.join("contracts").join(contract_name); + + assert!(contract_dir.exists()); + assert!(contract_dir.as_path().join("Cargo.toml").exists()); + assert!(contract_dir.as_path().join("src").join("lib.rs").exists()); + assert!(contract_dir.as_path().join("src").join("test.rs").exists()); + } + + fn assert_contract_cargo_file_uses_workspace(project_dir: &Path, contract_name: &str) { + let contract_dir = project_dir.join("contracts").join(contract_name); + let cargo_toml_path = contract_dir.as_path().join("Cargo.toml"); + let cargo_toml_str = read_to_string(cargo_toml_path).unwrap(); + assert!(cargo_toml_str.contains("soroban-sdk = { workspace = true }")); + } + + fn assert_example_contract_excluded_files_do_not_exist( + project_dir: &Path, + contract_name: &str, + ) { + let contract_dir = project_dir.join("contracts").join(contract_name); + assert!(!contract_dir.as_path().join("Makefile").exists()); + assert!(!contract_dir.as_path().join("Cargo.lock").exists()); + } + + fn assert_base_excluded_paths_do_not_exist(project_dir: &Path) { + let excluded_paths = [ + ".git", + ".github", + "Makefile", + "Cargo.lock", + ".vscode", + "target", + ]; + for path in &excluded_paths { + assert!(!project_dir.join(path).exists()); + } + } + + fn assert_gitignore_includes_astro_paths(project_dir: &Path) { + let gitignore_path = project_dir.join(".gitignore"); + let gitignore_str = read_to_string(gitignore_path).unwrap(); + assert!(gitignore_str.contains(".astro/")); + assert!(gitignore_str.contains("node_modules")); + assert!(gitignore_str.contains("npm-debug.log*")); + } + + fn assert_astro_files_exist(project_dir: &Path) { + assert!(project_dir.join("public").exists()); + assert!(project_dir.join("src").exists()); + assert!(project_dir.join("src").join("components").exists()); + assert!(project_dir.join("src").join("layouts").exists()); + assert!(project_dir.join("src").join("pages").exists()); + assert!(project_dir.join("astro.config.mjs").exists()); + assert!(project_dir.join("tsconfig.json").exists()); + } + + fn assert_package_json_files_have_correct_name(project_dir: &Path) { + let package_json_path = project_dir.join("package.json"); + let package_json_str = read_to_string(package_json_path).unwrap(); + assert!(package_json_str.contains(&format!("\"name\":\"{TEST_PROJECT_NAME}\""))); + + let package_lock_json_path = project_dir.join("package-lock.json"); + let package_lock_json_str = read_to_string(package_lock_json_path).unwrap(); + assert!(package_lock_json_str.contains(&format!("\"name\":\"{TEST_PROJECT_NAME}\""))); + } } diff --git a/cmd/soroban-cli/src/utils/contract-init-template/README.md b/cmd/soroban-cli/src/utils/contract-init-template/README.md index d78ed28e5..012e23c44 100644 --- a/cmd/soroban-cli/src/utils/contract-init-template/README.md +++ b/cmd/soroban-cli/src/utils/contract-init-template/README.md @@ -1,3 +1,21 @@ -# Soroban Init Template +# Soroban Project -This repository can be used as a template for creating a Soroban project. You can either clone this repository directly, or soon will be able to use the `soroban init` command from the soroban CLI. This first iteration just creates a bare-bones Rust project setup as a Rust workspace, but in the future it will also include options for creating an frontend that is able to interact with contracts in the `contracts` directory as well. +## Project Structure + +This repository uses the recommended structure for a Soroban project: +```text +. +├── contracts +│   └── hello_world +│   ├── src +│   │   ├── lib.rs +│   │   └── test.rs +│   └── Cargo.toml +├── Cargo.toml +└── README.md +``` + +- New Soroban contracts can be put in `contracts`, each in their own directory. There is already a `hello_world` contract in there to get you started. +- If you initialized this project with any other example contracts via `--with-example`, those contracts will be in the `contracts` directory as well. +- Contracts should have their own `Cargo.toml` files that rely on the top-level `Cargo.toml` workspace for their dependencies. +- Frontend libraries can be added to the top-level directory as well. If you initialized this project with a frontend template via `--frontend-template` you will have those files already included. \ No newline at end of file diff --git a/docs/soroban-cli-full-docs.md b/docs/soroban-cli-full-docs.md index 34ab0caa2..9e9587d29 100644 --- a/docs/soroban-cli-full-docs.md +++ b/docs/soroban-cli-full-docs.md @@ -680,10 +680,13 @@ Initialize a Soroban project with an example contract ###### **Options:** -* `-w`, `--with-example ` — An optional flag to specify Soroban example contracts to include. A hello-world contract will be included by default +* `-w`, `--with-example ` - Possible values: `account`, `alloc`, `atomic-multiswap`, `atomic-swap`, `auth`, `cross-contract`, `custom-types`, `deep-contract-auth`, `deployer`, `errors`, `events`, `fuzzing`, `increment`, `liquidity-pool`, `logging`, `simple-account`, `single-offer`, `timelock`, `token`, `upgradeable-contract` + Possible values: `account`, `alloc`, `atomic_multiswap`, `atomic_swap`, `auth`, `cross_contract`, `custom_types`, `deep_contract_auth`, `deployer`, `errors`, `events`, `fuzzing`, `increment`, `liquidity_pool`, `logging`, `mint-lock`, `simple_account`, `single_offer`, `timelock`, `token`, `upgradeable_contract`, `workspace` +* `-f`, `--frontend-template ` + + Default value: ``