diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index 25cea7366..c008cc7b4 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -34,7 +34,7 @@ jobs: target: aarch64-unknown-linux-gnu - os: macos-14 target: aarch64-apple-darwin - - os: macos-12 + - os: macos-14 target: x86_64-apple-darwin - os: windows-latest target: x86_64-pc-windows-msvc @@ -44,41 +44,50 @@ jobs: - uses: actions/checkout@v4 - run: rustup update - run: rustup target add ${{ matrix.sys.target }} + - if: matrix.sys.target == 'aarch64-unknown-linux-gnu' run: sudo apt-get update && sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libudev-dev + - name: Setup vars run: | version="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "stellar-cli") | .version')" echo "VERSION=${version}" >> $GITHUB_ENV echo "NAME=${{ matrix.crate.name }}-${version}-${{ matrix.sys.target }}" >> $GITHUB_ENV + - name: Package (release only) if: github.event_name == 'release' run: cargo package --no-verify --package ${{ matrix.crate.name }} + - name: Package Extract (release only) if: github.event_name == 'release' run: | cd target/package tar xvfz ${{ matrix.crate.name }}-$VERSION.crate echo "BUILD_WORKING_DIR=target/package/${{ matrix.crate.name }}-$VERSION" >> $GITHUB_ENV + - name: Build env: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc working-directory: ${{ env.BUILD_WORKING_DIR }} run: cargo build --target-dir="$GITHUB_WORKSPACE/target" --package ${{ matrix.crate.name }} --features opt --release --target ${{ matrix.sys.target }} + - name: Build provenance for attestation (release only) if: github.event_name == 'release' uses: actions/attest-build-provenance@v1 with: subject-path: target/${{ matrix.sys.target }}/release/${{ matrix.crate.binary }}${{ matrix.sys.ext }} + - name: Compress run: | cd target/${{ matrix.sys.target }}/release tar czvf $NAME.tar.gz ${{ matrix.crate.binary }}${{ matrix.sys.ext }} + - name: Upload to Artifacts uses: actions/upload-artifact@v4 with: - name: ${{ env.NAME }} + name: ${{ env.NAME }}.tar.gz path: 'target/${{ matrix.sys.target }}/release/${{ env.NAME }}.tar.gz' + - name: Upload to Release (release only) if: github.event_name == 'release' uses: actions/github-script@v7 @@ -92,3 +101,61 @@ jobs: name: '${{ env.NAME }}.tar.gz', data: fs.readFileSync('target/${{ matrix.sys.target }}/release/${{ env.NAME }}.tar.gz'), }); + + installer: + needs: build + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup vars + run: | + version="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "stellar-cli") | .version')" + installer_basename="stellar-cli-installer-${version}-x86_64-pc-windows-msvc" + echo "VERSION=${version}" >> $GITHUB_ENV + echo "STELLAR_CLI_INSTALLER_BASENAME=${installer_basename}" >> $GITHUB_ENV + echo "STELLAR_CLI_INSTALLER=${installer_basename}.exe" >> $GITHUB_ENV + echo "ARTIFACT_NAME=stellar-cli-${version}-x86_64-pc-windows-msvc.tar.gz" >> $GITHUB_ENV + + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: ${{ env.ARTIFACT_NAME }} + + - name: Uncompress Artifact + run: tar xvf ${{ env.ARTIFACT_NAME }} + + - name: Build Installer + shell: powershell + run: | + $Env:Path += ";C:\Users\$Env:UserName\AppData\Local\Programs\Inno Setup 6" + $Env:STELLAR_CLI_VERSION = "${{ env.VERSION }}" + ISCC.exe installer.iss + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.STELLAR_CLI_INSTALLER }} + path: Output/stellar-installer.exe + + - name: Build provenance for attestation (release only) + if: github.event_name == 'release' + uses: actions/attest-build-provenance@v1 + with: + subject-path: ${{ env.STELLAR_CLI_INSTALLER }} + + - name: Upload to Release (release only) + if: github.event_name == 'release' + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + await github.rest.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: ${{ github.event.release.id }}, + name: '${{ env.STELLAR_CLI_INSTALLER }}', + data: fs.readFileSync('Output/stellar-installer.exe'), + }); + diff --git a/Cargo.lock b/Cargo.lock index 0b92dcd22..89cb82cdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,7 +270,7 @@ dependencies = [ "bstr", "doc-comment", "libc", - "predicates 3.1.2", + "predicates", "predicates-core", "predicates-tree", "wait-timeout", @@ -285,7 +285,7 @@ dependencies = [ "anstyle", "doc-comment", "globwalk", - "predicates 3.1.2", + "predicates", "predicates-core", "predicates-tree", "tempfile", @@ -848,7 +848,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.1", + "strsim", ] [[package]] @@ -944,17 +944,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crate-git-revision" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f998aef136a4e7833b0e4f0fc0939a59c40140b28e0ffbf524ad84fb2cc568c8" -dependencies = [ - "serde", - "serde_derive", - "serde_json", -] - [[package]] name = "crate-git-revision" version = "0.0.6" @@ -1169,7 +1158,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim 0.11.1", + "strsim", "syn 2.0.77", ] @@ -1271,16 +1260,7 @@ version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" dependencies = [ - "dirs-sys 0.4.1", -] - -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys 0.3.7", + "dirs-sys", ] [[package]] @@ -1289,7 +1269,7 @@ version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" dependencies = [ - "dirs-sys 0.4.1", + "dirs-sys", ] [[package]] @@ -1302,17 +1282,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "dirs-sys" version = "0.4.1" @@ -1667,9 +1636,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1677,9 +1646,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" @@ -1694,9 +1663,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" @@ -1728,9 +1697,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", @@ -1739,21 +1708,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -2271,15 +2240,18 @@ dependencies = [ [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", - "hyper 0.14.30", + "http-body-util", + "hyper 1.4.1", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", ] [[package]] @@ -2979,11 +2951,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.68" +version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ - "bitflags 2.6.0", + "bitflags 1.3.2", "cfg-if", "foreign-types", "libc", @@ -3011,9 +2983,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.104" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -3304,20 +3276,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -[[package]] -name = "predicates" -version = "2.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" -dependencies = [ - "difflib", - "float-cmp", - "itertools 0.10.5", - "normalize-line-endings", - "predicates-core", - "regex", -] - [[package]] name = "predicates" version = "3.1.2" @@ -3326,7 +3284,10 @@ checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97" dependencies = [ "anstyle", "difflib", + "float-cmp", + "normalize-line-endings", "predicates-core", + "regex", ] [[package]] @@ -3540,46 +3501,6 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" -[[package]] -name = "reqwest" -version = "0.11.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" -dependencies = [ - "base64 0.21.7", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.30", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls-pemfile 1.0.4", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper 0.1.2", - "system-configuration", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - [[package]] name = "reqwest" version = "0.12.7" @@ -3599,11 +3520,13 @@ dependencies = [ "http-body-util", "hyper 1.4.1", "hyper-rustls 0.27.3", + "hyper-tls", "hyper-util", "ipnet", "js-sys", "log", "mime", + "native-tls", "once_cell", "percent-encoding", "pin-project-lite", @@ -3615,8 +3538,10 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper", + "system-configuration", "tokio", + "tokio-native-tls", "tokio-rustls 0.26.0", "tokio-util", "tower-service", @@ -4349,18 +4274,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "soroban-builtin-sdk-macros" -version = "21.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f57a68ef8777e28e274de0f3a88ad9a5a41d9a2eb461b4dd800b086f0e83b80" -dependencies = [ - "itertools 0.11.0", - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "soroban-builtin-sdk-macros" version = "22.0.0-rc.3" @@ -4375,7 +4288,7 @@ dependencies = [ [[package]] name = "soroban-cli" -version = "22.0.0-rc.1" +version = "22.0.0" dependencies = [ "assert_cmd", "assert_fs", @@ -4389,10 +4302,9 @@ dependencies = [ "clap", "clap-markdown", "clap_complete", - "crate-git-revision 0.0.4", + "crate-git-revision", "csv", "directories", - "dirs 4.0.0", "dotenvy", "ed25519-dalek", "ethnum", @@ -4413,10 +4325,10 @@ dependencies = [ "open", "pathdiff", "phf", - "predicates 2.1.5", + "predicates", "rand", "regex", - "reqwest 0.12.7", + "reqwest", "rpassword", "rust-embed", "semver", @@ -4427,17 +4339,17 @@ dependencies = [ "sha2 0.10.8", "shell-escape", "shlex", - "soroban-ledger-snapshot 22.0.0-rc.3", - "soroban-sdk 22.0.0-rc.3", - "soroban-spec 22.0.0-rc.3", + "soroban-ledger-snapshot", + "soroban-sdk", + "soroban-spec", "soroban-spec-json", - "soroban-spec-rust 22.0.0-rc.3", + "soroban-spec-rust", "soroban-spec-tools", "soroban-spec-typescript", "stellar-rpc-client", "stellar-strkey 0.0.11", - "stellar-xdr 22.0.0-rc.1.1", - "strsim 0.10.0", + "stellar-xdr", + "strsim", "strum 0.17.1", "strum_macros 0.17.1", "tempfile", @@ -4446,8 +4358,8 @@ dependencies = [ "thiserror", "tokio", "tokio-util", - "toml 0.5.11", - "toml_edit 0.21.1", + "toml", + "toml_edit", "tracing", "tracing-appender", "tracing-subscriber", @@ -4456,29 +4368,10 @@ dependencies = [ "walkdir", "wasm-gen", "wasm-opt", - "wasmparser 0.90.0", + "wasmparser", "which", ] -[[package]] -name = "soroban-env-common" -version = "21.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1c89463835fe6da996318156d39f424b4f167c725ec692e5a7a2d4e694b3d" -dependencies = [ - "arbitrary", - "crate-git-revision 0.0.6", - "ethnum", - "num-derive", - "num-traits", - "serde", - "soroban-env-macros 21.2.1", - "soroban-wasmi", - "static_assertions", - "stellar-xdr 21.2.0", - "wasmparser 0.116.1", -] - [[package]] name = "soroban-env-common" version = "22.0.0-rc.3" @@ -4486,26 +4379,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39b6d2ec8955243394278e1fae88be3b367fcfed9cf74e5044799a90786a8642" dependencies = [ "arbitrary", - "crate-git-revision 0.0.6", + "crate-git-revision", "ethnum", "num-derive", "num-traits", "serde", - "soroban-env-macros 22.0.0-rc.3", + "soroban-env-macros", "soroban-wasmi", "static_assertions", - "stellar-xdr 22.0.0-rc.1.1", - "wasmparser 0.116.1", -] - -[[package]] -name = "soroban-env-guest" -version = "21.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bfb2536811045d5cd0c656a324cbe9ce4467eb734c7946b74410d90dea5d0ce" -dependencies = [ - "soroban-env-common 21.2.1", - "static_assertions", + "stellar-xdr", + "wasmparser", ] [[package]] @@ -4514,41 +4397,8 @@ version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4002fc582cd20cc9b9fbb73959bc5d6b5b15feda11485cbfab0c28e78ecbab3e" dependencies = [ - "soroban-env-common 22.0.0-rc.3", - "static_assertions", -] - -[[package]] -name = "soroban-env-host" -version = "21.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b7a32c28f281c423189f1298960194f0e0fc4eeb72378028171e556d8cd6160" -dependencies = [ - "backtrace", - "curve25519-dalek", - "ecdsa", - "ed25519-dalek", - "elliptic-curve", - "generic-array", - "getrandom", - "hex-literal", - "hmac 0.12.1", - "k256", - "num-derive", - "num-integer", - "num-traits", - "p256", - "rand", - "rand_chacha", - "sec1", - "sha2 0.10.8", - "sha3", - "soroban-builtin-sdk-macros 21.2.1", - "soroban-env-common 21.2.1", - "soroban-wasmi", + "soroban-env-common", "static_assertions", - "stellar-strkey 0.0.8", - "wasmparser 0.116.1", ] [[package]] @@ -4579,27 +4429,12 @@ dependencies = [ "sec1", "sha2 0.10.8", "sha3", - "soroban-builtin-sdk-macros 22.0.0-rc.3", - "soroban-env-common 22.0.0-rc.3", + "soroban-builtin-sdk-macros", + "soroban-env-common", "soroban-wasmi", "static_assertions", "stellar-strkey 0.0.9", - "wasmparser 0.116.1", -] - -[[package]] -name = "soroban-env-macros" -version = "21.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "242926fe5e0d922f12d3796cd7cd02dd824e5ef1caa088f45fce20b618309f64" -dependencies = [ - "itertools 0.11.0", - "proc-macro2", - "quote", - "serde", - "serde_json", - "stellar-xdr 21.2.0", - "syn 2.0.77", + "wasmparser", ] [[package]] @@ -4613,27 +4448,13 @@ dependencies = [ "quote", "serde", "serde_json", - "stellar-xdr 22.0.0-rc.1.1", + "stellar-xdr", "syn 2.0.77", ] [[package]] name = "soroban-hello" -version = "22.0.0-rc.1" - -[[package]] -name = "soroban-ledger-snapshot" -version = "21.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84589856911dfd6731695c9b51c858aed6d4540118c0a1e5c4c858ea13bc744c" -dependencies = [ - "serde", - "serde_json", - "serde_with", - "soroban-env-common 21.2.1", - "soroban-env-host 21.2.1", - "thiserror", -] +version = "0.0.0" [[package]] name = "soroban-ledger-snapshot" @@ -4644,31 +4465,11 @@ dependencies = [ "serde", "serde_json", "serde_with", - "soroban-env-common 22.0.0-rc.3", - "soroban-env-host 22.0.0-rc.3", + "soroban-env-common", + "soroban-env-host", "thiserror", ] -[[package]] -name = "soroban-sdk" -version = "21.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e39bf9e8ab05579c836e8e5be5f2f4c5ba75e7337ece20e975e82fc3a9d41e" -dependencies = [ - "arbitrary", - "bytes-lit", - "ctor", - "ed25519-dalek", - "rand", - "serde", - "serde_json", - "soroban-env-guest 21.2.1", - "soroban-env-host 21.2.1", - "soroban-ledger-snapshot 21.7.3", - "soroban-sdk-macros 21.7.3", - "stellar-strkey 0.0.8", -] - [[package]] name = "soroban-sdk" version = "22.0.0-rc.3" @@ -4683,65 +4484,33 @@ dependencies = [ "rustc_version", "serde", "serde_json", - "soroban-env-guest 22.0.0-rc.3", - "soroban-env-host 22.0.0-rc.3", - "soroban-ledger-snapshot 22.0.0-rc.3", - "soroban-sdk-macros 22.0.0-rc.3", + "soroban-env-guest", + "soroban-env-host", + "soroban-ledger-snapshot", + "soroban-sdk-macros", "stellar-strkey 0.0.9", ] -[[package]] -name = "soroban-sdk-macros" -version = "21.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63c2173f1aacd56b4405eed71cb2a9694dff99d51ba72d4f0cbc5e4961fdabf4" -dependencies = [ - "crate-git-revision 0.0.6", - "darling", - "itertools 0.11.0", - "proc-macro2", - "quote", - "rustc_version", - "sha2 0.10.8", - "soroban-env-common 21.2.1", - "soroban-spec 21.7.3", - "soroban-spec-rust 21.7.3", - "stellar-xdr 21.2.0", - "syn 2.0.77", -] - [[package]] name = "soroban-sdk-macros" version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "508c9d819a05109120664aab86c371e1b72c5bea20b1a13158b4ef7948d9f673" dependencies = [ - "crate-git-revision 0.0.6", + "crate-git-revision", "darling", "itertools 0.10.5", "proc-macro2", "quote", "rustc_version", "sha2 0.10.8", - "soroban-env-common 22.0.0-rc.3", - "soroban-spec 22.0.0-rc.3", - "soroban-spec-rust 22.0.0-rc.3", - "stellar-xdr 22.0.0-rc.1.1", + "soroban-env-common", + "soroban-spec", + "soroban-spec-rust", + "stellar-xdr", "syn 2.0.77", ] -[[package]] -name = "soroban-spec" -version = "21.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7705bffbcc747c08e81698b87b4a787f8b268c25d88f777160091dc1ee8121cb" -dependencies = [ - "base64 0.13.1", - "stellar-xdr 21.2.0", - "thiserror", - "wasmparser 0.116.1", -] - [[package]] name = "soroban-spec" version = "22.0.0-rc.3" @@ -4749,38 +4518,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69001c97783ed3ce197eac2404e7beeabedd16e40e6f0aa210d1bc6a13063c33" dependencies = [ "base64 0.13.1", - "stellar-xdr 22.0.0-rc.1.1", + "stellar-xdr", "thiserror", - "wasmparser 0.116.1", + "wasmparser", ] [[package]] name = "soroban-spec-json" -version = "22.0.0-rc.1" +version = "22.0.0" dependencies = [ "pretty_assertions", "serde", "serde_derive", "serde_json", "sha2 0.9.9", - "soroban-spec 22.0.0-rc.3", - "stellar-xdr 22.0.0-rc.1.1", - "thiserror", -] - -[[package]] -name = "soroban-spec-rust" -version = "21.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48207ebc8616c2804a17203d1d86c53c3d3c804b682cbab011a135893db1cf78" -dependencies = [ - "prettyplease", - "proc-macro2", - "quote", - "sha2 0.10.8", - "soroban-spec 21.7.3", - "stellar-xdr 21.2.0", - "syn 2.0.77", + "soroban-spec", + "stellar-xdr", "thiserror", ] @@ -4794,33 +4547,33 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "soroban-spec 22.0.0-rc.3", - "stellar-xdr 22.0.0-rc.1.1", + "soroban-spec", + "stellar-xdr", "syn 2.0.77", "thiserror", ] [[package]] name = "soroban-spec-tools" -version = "22.0.0-rc.1" +version = "22.0.0" dependencies = [ "base64 0.21.7", "ethnum", "hex", "itertools 0.10.5", "serde_json", - "soroban-spec 22.0.0-rc.3", + "soroban-spec", "stellar-strkey 0.0.11", - "stellar-xdr 22.0.0-rc.1.1", + "stellar-xdr", "thiserror", "tokio", - "wasmparser 0.90.0", + "wasmparser", "which", ] [[package]] name = "soroban-spec-typescript" -version = "22.0.0-rc.1" +version = "22.0.0" dependencies = [ "base64 0.21.7", "heck 0.4.1", @@ -4832,8 +4585,8 @@ dependencies = [ "serde_derive", "serde_json", "sha2 0.9.9", - "soroban-spec 22.0.0-rc.3", - "stellar-xdr 22.0.0-rc.1.1", + "soroban-spec", + "stellar-xdr", "temp-dir", "thiserror", "walkdir", @@ -4841,26 +4594,26 @@ dependencies = [ [[package]] name = "soroban-test" -version = "22.0.0-rc.1" +version = "22.0.0" dependencies = [ "assert_cmd", "assert_fs", "ed25519-dalek", "fs_extra", "hex", - "predicates 2.1.5", + "predicates", "sep5", "serde_json", "sha2 0.10.8", "soroban-cli", - "soroban-ledger-snapshot 22.0.0-rc.3", - "soroban-spec 22.0.0-rc.3", + "soroban-ledger-snapshot", + "soroban-spec", "soroban-spec-tools", "stellar-rpc-client", "stellar-strkey 0.0.11", "thiserror", "tokio", - "toml 0.8.19", + "toml", "ulid", "walkdir", "which", @@ -4868,11 +4621,11 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "21.7.2" +version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6ede0da76646037f3ea5db9ccd37830865444bb24f137cb8f0af8282c784f5" +checksum = "17bb933a3dcf41d234f6d669b077eb755663773630c6899a1c8a30dddf950f52" dependencies = [ - "soroban-sdk 21.7.2", + "soroban-sdk", ] [[package]] @@ -4912,18 +4665,18 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stellar-bye" -version = "22.0.0-rc.1" +version = "0.0.0" [[package]] name = "stellar-cli" -version = "22.0.0-rc.1" +version = "22.0.0" dependencies = [ "soroban-cli", ] [[package]] name = "stellar-ledger" -version = "22.0.0-rc.1" +version = "22.0.0" dependencies = [ "async-trait", "bollard", @@ -4940,18 +4693,18 @@ dependencies = [ "once_cell", "phf", "pretty_assertions", - "reqwest 0.11.27", + "reqwest", "sep5", "serde", "serde_derive", "serde_json", "serial_test", - "sha2 0.9.9", + "sha2 0.10.8", "slipped10", - "soroban-spec 22.0.0-rc.3", + "soroban-spec", "stellar-rpc-client", "stellar-strkey 0.0.11", - "stellar-xdr 22.0.0-rc.1.1", + "stellar-xdr", "test-case", "testcontainers", "thiserror", @@ -4977,7 +4730,7 @@ dependencies = [ "serde_with", "sha2 0.10.8", "stellar-strkey 0.0.9", - "stellar-xdr 22.0.0-rc.1.1", + "stellar-xdr", "termcolor", "termcolor_output", "thiserror", @@ -4992,7 +4745,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12d2bf45e114117ea91d820a846fd1afbe3ba7d717988fee094ce8227a3bf8bd" dependencies = [ "base32", - "crate-git-revision 0.0.6", + "crate-git-revision", "thiserror", ] @@ -5002,7 +4755,7 @@ version = "0.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e3aa3ed00e70082cb43febc1c2afa5056b9bb3e348bbb43d0cd0aa88a611144" dependencies = [ - "crate-git-revision 0.0.6", + "crate-git-revision", "data-encoding", "thiserror", ] @@ -5013,26 +4766,10 @@ version = "0.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0989c9a05eccbd08b60e603a1c7e3ed3ec92c0de73b8681fc964d272ab2b2697" dependencies = [ - "crate-git-revision 0.0.6", + "crate-git-revision", "data-encoding", ] -[[package]] -name = "stellar-xdr" -version = "21.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2675a71212ed39a806e415b0dbf4702879ff288ec7f5ee996dda42a135512b50" -dependencies = [ - "arbitrary", - "base64 0.13.1", - "crate-git-revision 0.0.6", - "escape-bytes", - "hex", - "serde", - "serde_with", - "stellar-strkey 0.0.8", -] - [[package]] name = "stellar-xdr" version = "22.0.0-rc.1.1" @@ -5042,7 +4779,7 @@ dependencies = [ "arbitrary", "base64 0.13.1", "clap", - "crate-git-revision 0.0.6", + "crate-git-revision", "escape-bytes", "hex", "schemars", @@ -5066,12 +4803,6 @@ dependencies = [ "precomputed-hash", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -5166,12 +4897,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "sync_wrapper" version = "1.0.1" @@ -5183,20 +4908,20 @@ dependencies = [ [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", @@ -5298,52 +5023,52 @@ dependencies = [ [[package]] name = "test_constructor" -version = "22.0.0-rc.1" +version = "0.0.0" dependencies = [ - "soroban-sdk 22.0.0-rc.3", + "soroban-sdk", ] [[package]] name = "test_custom_account" -version = "22.0.0-rc.1" +version = "0.0.0" dependencies = [ - "soroban-sdk 21.7.2", + "soroban-sdk", ] [[package]] name = "test_custom_types" -version = "22.0.0-rc.1" +version = "0.0.0" dependencies = [ - "soroban-sdk 21.7.2", + "soroban-sdk", ] [[package]] name = "test_hello_world" -version = "22.0.0-rc.1" +version = "0.0.0" dependencies = [ - "soroban-sdk 21.7.2", + "soroban-sdk", ] [[package]] name = "test_swap" -version = "22.0.0-rc.1" +version = "0.0.0" dependencies = [ - "soroban-sdk 21.7.2", + "soroban-sdk", ] [[package]] name = "test_token" -version = "22.0.0-rc.1" +version = "0.0.0" dependencies = [ - "soroban-sdk 21.7.2", + "soroban-sdk", "soroban-token-sdk", ] [[package]] name = "test_udt" -version = "22.0.0-rc.1" +version = "22.0.0" dependencies = [ - "soroban-sdk 21.7.2", + "soroban-sdk", ] [[package]] @@ -5356,7 +5081,7 @@ dependencies = [ "bollard", "bollard-stubs", "bytes", - "dirs 5.0.1", + "dirs", "docker_credential", "either", "futures", @@ -5364,7 +5089,7 @@ dependencies = [ "memchr", "parse-display", "pin-project-lite", - "reqwest 0.12.7", + "reqwest", "serde", "serde_json", "serde_with", @@ -5575,15 +5300,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "toml" version = "0.8.19" @@ -5593,7 +5309,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.20", + "toml_edit", ] [[package]] @@ -5605,17 +5321,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap 2.3.0", - "toml_datetime", - "winnow 0.5.40", -] - [[package]] name = "toml_edit" version = "0.22.20" @@ -5626,7 +5331,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.18", + "winnow", ] [[package]] @@ -5960,9 +5665,9 @@ dependencies = [ [[package]] name = "wasm-opt" -version = "0.114.2" +version = "0.116.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effbef3bd1dde18acb401f73e740a6f3d4a1bc651e9773bddc512fe4d8d68f67" +checksum = "2fd87a4c135535ffed86123b6fb0f0a5a0bc89e50416c942c5f0662c645f679c" dependencies = [ "anyhow", "libc", @@ -5976,9 +5681,9 @@ dependencies = [ [[package]] name = "wasm-opt-cxx-sys" -version = "0.114.2" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c09e24eb283919ace2ed5733bda4842a59ce4c8de110ef5c6d98859513d17047" +checksum = "8c57b28207aa724318fcec6575fe74803c23f6f266fce10cbc9f3f116762f12e" dependencies = [ "anyhow", "cxx", @@ -5988,9 +5693,9 @@ dependencies = [ [[package]] name = "wasm-opt-sys" -version = "0.114.2" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f2f817bed2e8d65eb779fa37317e74de15585751f903c9118342d1970703a4" +checksum = "8a1cce564dc768dacbdb718fc29df2dba80bd21cb47d8f77ae7e3d95ceb98cbe" dependencies = [ "anyhow", "cc", @@ -6029,15 +5734,6 @@ dependencies = [ "paste", ] -[[package]] -name = "wasmparser" -version = "0.90.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62c8d843f4423efee314dc75a1049886deba3214f7e7f9ff0e4e58b4d618581" -dependencies = [ - "indexmap 1.9.3", -] - [[package]] name = "wasmparser" version = "0.116.1" @@ -6323,15 +6019,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - [[package]] name = "winnow" version = "0.6.18" diff --git a/Cargo.toml b/Cargo.toml index 31e92e40b..d2572e9c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,24 +19,24 @@ exclude = [ ] [workspace.package] -version = "22.0.0-rc.1" +version = "22.0.0" rust-version = "1.81.0" # Dependencies located in this repo: [workspace.dependencies.soroban-cli] -version = "=22.0.0-rc.1" +version = "=22.0.0" path = "cmd/soroban-cli" [workspace.dependencies.soroban-spec-json] -version = "=22.0.0-rc.1" +version = "=22.0.0" path = "./cmd/crates/soroban-spec-json" [workspace.dependencies.soroban-spec-typescript] -version = "22.0.0-rc.1" +version = "22.0.0" path = "./cmd/crates/soroban-spec-typescript" [workspace.dependencies.soroban-spec-tools] -version = "22.0.0-rc.1" +version = "22.0.0" path = "./cmd/crates/soroban-spec-tools" # Dependencies from the rs-stellar-xdr repo: @@ -91,7 +91,7 @@ tracing = "0.1.37" tracing-subscriber = "0.3.16" tracing-appender = "0.2.2" which = "4.4.0" -wasmparser = "0.90.0" +wasmparser = "0.116.1" directories = "5.0.1" ulid = "1.1" termcolor = "1.1.3" @@ -100,7 +100,11 @@ ed25519-dalek = ">= 2.1.1" http = "1.0.0" jsonrpsee-http-client = "0.20.1" jsonrpsee-core = "0.20.1" -tokio = "1.28.1" +walkdir = "2.5.0" +toml_edit = "0.22.20" +toml = "0.8.19" +reqwest = "0.12.7" +predicates = "3.1.2" [profile.test-wasms] inherits = "release" diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md index c7cd9c56c..f007d0bf4 100644 --- a/FULL_HELP_DOCS.md +++ b/FULL_HELP_DOCS.md @@ -198,7 +198,7 @@ Add contract alias ###### **Arguments:** -* `` — The contract alias that will be removed +* `` — The contract alias that will be used ###### **Options:** @@ -522,7 +522,7 @@ Outputs no data when no data is present in the contract. * `--wasm ` — Wasm file to extract the data from * `--wasm-hash ` — Wasm hash to get the data for -* `--id ` — Contract id to get the data for +* `--id ` — Contract id or contract alias to get the data for * `--rpc-url ` — RPC server endpoint * `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -562,7 +562,7 @@ Outputs no data when no data is present in the contract. * `--wasm ` — Wasm file to extract the data from * `--wasm-hash ` — Wasm hash to get the data for -* `--id ` — Contract id to get the data for +* `--id ` — Contract id or contract alias to get the data for * `--rpc-url ` — RPC server endpoint * `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -602,7 +602,7 @@ Outputs no data when no data is present in the contract. * `--wasm ` — Wasm file to extract the data from * `--wasm-hash ` — Wasm hash to get the data for -* `--id ` — Contract id to get the data for +* `--id ` — Contract id or contract alias to get the data for * `--rpc-url ` — RPC server endpoint * `--rpc-header ` — RPC Header(s) to include in requests to the RPC provider * `--network-passphrase ` — Network passphrase to sign the transaction sent to the rpc server @@ -1749,9 +1749,9 @@ Set option for an account such as flags, inflation destination, signers, home do * `--signer ` — Add, update, or remove a signer from an account * `--signer-weight ` — Signer weight is a number from 0-255 (inclusive). The signer is deleted if the weight is 0 * `--set-required` — When enabled, an issuer must approve an account before that account can hold its asset. https://developers.stellar.org/docs/tokens/control-asset-access#authorization-required-0x1 -* `--set-revocable` — When enabled, an issuer can revoke an existing trustline’s authorization, thereby freezing the asset held by an account. https://developers.stellar.org/docs/tokens/control-asset-access#authorization-revocable-0x2 +* `--set-revocable` — When enabled, an issuer can revoke an existing trustline's authorization, thereby freezing the asset held by an account. https://developers.stellar.org/docs/tokens/control-asset-access#authorization-revocable-0x2 * `--set-clawback-enabled` — Enables the issuing account to take back (burning) all of the asset. https://developers.stellar.org/docs/tokens/control-asset-access#clawback-enabled-0x8 -* `--set-immutable` — With this setting, none of the other authorization flags (`AUTH_REQUIRED_FLAG`, `AUTH_REVOCABLE_FLAG`) can be set, and the issuing account can’t be merged. https://developers.stellar.org/docs/tokens/control-asset-access#authorization-immutable-0x4 +* `--set-immutable` — With this setting, none of the other authorization flags (`AUTH_REQUIRED_FLAG`, `AUTH_REVOCABLE_FLAG`) can be set, and the issuing account can't be merged. https://developers.stellar.org/docs/tokens/control-asset-access#authorization-immutable-0x4 * `--clear-required` * `--clear-revocable` * `--clear-immutable` diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json index 454c8b964..a4e3759e2 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json @@ -8,7 +8,7 @@ "name": "test_custom_types", "version": "0.0.0", "dependencies": { - "@stellar/stellar-sdk": "12.3.0", + "@stellar/stellar-sdk": "13.0.0", "buffer": "6.0.3" }, "devDependencies": { @@ -22,9 +22,9 @@ "license": "Apache-2.0" }, "node_modules/@stellar/stellar-base": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@stellar/stellar-base/-/stellar-base-12.1.1.tgz", - "integrity": "sha512-gOBSOFDepihslcInlqnxKZdIW9dMUO1tpOm3AtJR33K2OvpXG6SaVHCzAmCFArcCqI9zXTEiSoh70T48TmiHJA==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/@stellar/stellar-base/-/stellar-base-13.0.1.tgz", + "integrity": "sha512-Xbd12mc9Oj/130Tv0URmm3wXG77XMshZtZ2yNCjqX5ZbMD5IYpbBs3DVCteLU/4SLj/Fnmhh1dzhrQXnk4r+pQ==", "license": "Apache-2.0", "dependencies": { "@stellar/js-xdr": "^3.1.2", @@ -35,19 +35,20 @@ "tweetnacl": "^1.0.3" }, "optionalDependencies": { - "sodium-native": "^4.1.1" + "sodium-native": "^4.3.0" } }, "node_modules/@stellar/stellar-sdk": { - "version": "12.3.0", - "resolved": "https://registry.npmjs.org/@stellar/stellar-sdk/-/stellar-sdk-12.3.0.tgz", - "integrity": "sha512-F2DYFop/M5ffXF0lvV5Ezjk+VWNKg0QDX8gNhwehVU3y5LYA3WAY6VcCarMGPaG9Wdgoeh1IXXzOautpqpsltw==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@stellar/stellar-sdk/-/stellar-sdk-13.0.0.tgz", + "integrity": "sha512-+wvmKi+XWwu27nLYTM17EgBdpbKohEkOfCIK4XKfsI4WpMXAqvnqSm98i9h5dAblNB+w8BJqzGs1JY0PtTGm4A==", "license": "Apache-2.0", "dependencies": { - "@stellar/stellar-base": "^12.1.1", + "@stellar/stellar-base": "^13.0.1", "axios": "^1.7.7", "bignumber.js": "^9.1.2", "eventsource": "^2.0.2", + "feaxios": "^0.0.20", "randombytes": "^2.1.0", "toml": "^3.0.0", "urijs": "^1.19.1" @@ -156,6 +157,15 @@ "node": ">=12.0.0" } }, + "node_modules/feaxios": { + "version": "0.0.20", + "resolved": "https://registry.npmjs.org/feaxios/-/feaxios-0.0.20.tgz", + "integrity": "sha512-g3hm2YDNffNxA3Re3Hd8ahbpmDee9Fv1Pb1C/NoWsjY7mtD8nyNeJytUzn+DK0Hyl9o6HppeWOrtnqgmhOYfWA==", + "license": "MIT", + "dependencies": { + "is-retry-allowed": "^3.0.0" + } + }, "node_modules/follow-redirects": { "version": "1.15.9", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", @@ -214,6 +224,18 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "license": "ISC" }, + "node_modules/is-retry-allowed": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-3.0.0.tgz", + "integrity": "sha512-9xH0xvoggby+u0uGF7cZXdrutWiBiaFG8ZT4YFPXL8NzkyAwX3AKGLeFQLvzDpM430+nDFBZ1LHkie/8ocL06A==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -236,9 +258,9 @@ } }, "node_modules/node-gyp-build": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.2.tgz", - "integrity": "sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==", + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.3.tgz", + "integrity": "sha512-EMS95CMJzdoSKoIiXo8pxKoL8DYxwIZXYlLmgPb8KUv794abpnLK6ynsCAWNliOjREKruYKdzbh76HHYUHX7nw==", "license": "MIT", "optional": true, "bin": { @@ -292,9 +314,9 @@ } }, "node_modules/sodium-native": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.3.0.tgz", - "integrity": "sha512-OcMgoS0NJx+4yVUlhvL9uZsVZfmyHZ2RpSXkiIoOHMglqvJDeGwn1rUigPrvcNTq3m9hPXtt6syxQbF3vvwmRQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.3.1.tgz", + "integrity": "sha512-YdP64gAdpIKHfL4ttuX4aIfjeunh9f+hNeQJpE9C8UMndB3zkgZ7YmmGT4J2+v6Ibyp6Wem8D1TcSrtdW0bqtg==", "license": "MIT", "optional": true, "dependencies": { diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json index a52979626..8c3762b91 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json @@ -8,7 +8,7 @@ "build": "tsc" }, "dependencies": { - "@stellar/stellar-sdk": "12.3.0", + "@stellar/stellar-sdk": "13.0.0", "buffer": "6.0.3" }, "devDependencies": { diff --git a/cmd/crates/soroban-spec-typescript/src/project_template/package.json b/cmd/crates/soroban-spec-typescript/src/project_template/package.json index 1d7d48793..b5c6459e4 100644 --- a/cmd/crates/soroban-spec-typescript/src/project_template/package.json +++ b/cmd/crates/soroban-spec-typescript/src/project_template/package.json @@ -8,7 +8,7 @@ "build": "tsc" }, "dependencies": { - "@stellar/stellar-sdk": "12.3.0", + "@stellar/stellar-sdk": "13.0.0", "buffer": "6.0.3" }, "devDependencies": { diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/initialize.sh b/cmd/crates/soroban-spec-typescript/ts-tests/initialize.sh index d85eff115..031061cca 100755 --- a/cmd/crates/soroban-spec-typescript/ts-tests/initialize.sh +++ b/cmd/crates/soroban-spec-typescript/ts-tests/initialize.sh @@ -37,6 +37,7 @@ function deploy_all() { } function bind() { exe eval "./soroban contract bindings typescript --contract-id $(cat $1) --output-dir ./node_modules/$2 --overwrite" + exe eval "sh -c \"cd ./node_modules/$2 && npm install && npm run build\"" } function bind_all() { bind contract-id-custom-types.txt test-custom-types diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json b/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json index dec6997a7..45cc97a67 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json +++ b/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json @@ -7,7 +7,7 @@ "hasInstallScript": true, "devDependencies": { "@ava/typescript": "^4.1.0", - "@stellar/stellar-sdk": "12.3.0", + "@stellar/stellar-sdk": "13.0.0", "@types/node": "^20.4.9", "@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/parser": "^6.10.0", @@ -206,9 +206,9 @@ "license": "Apache-2.0" }, "node_modules/@stellar/stellar-base": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/@stellar/stellar-base/-/stellar-base-12.1.1.tgz", - "integrity": "sha512-gOBSOFDepihslcInlqnxKZdIW9dMUO1tpOm3AtJR33K2OvpXG6SaVHCzAmCFArcCqI9zXTEiSoh70T48TmiHJA==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/@stellar/stellar-base/-/stellar-base-13.0.1.tgz", + "integrity": "sha512-Xbd12mc9Oj/130Tv0URmm3wXG77XMshZtZ2yNCjqX5ZbMD5IYpbBs3DVCteLU/4SLj/Fnmhh1dzhrQXnk4r+pQ==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -220,20 +220,21 @@ "tweetnacl": "^1.0.3" }, "optionalDependencies": { - "sodium-native": "^4.1.1" + "sodium-native": "^4.3.0" } }, "node_modules/@stellar/stellar-sdk": { - "version": "12.3.0", - "resolved": "https://registry.npmjs.org/@stellar/stellar-sdk/-/stellar-sdk-12.3.0.tgz", - "integrity": "sha512-F2DYFop/M5ffXF0lvV5Ezjk+VWNKg0QDX8gNhwehVU3y5LYA3WAY6VcCarMGPaG9Wdgoeh1IXXzOautpqpsltw==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@stellar/stellar-sdk/-/stellar-sdk-13.0.0.tgz", + "integrity": "sha512-+wvmKi+XWwu27nLYTM17EgBdpbKohEkOfCIK4XKfsI4WpMXAqvnqSm98i9h5dAblNB+w8BJqzGs1JY0PtTGm4A==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@stellar/stellar-base": "^12.1.1", + "@stellar/stellar-base": "^13.0.1", "axios": "^1.7.7", "bignumber.js": "^9.1.2", "eventsource": "^2.0.2", + "feaxios": "^0.0.20", "randombytes": "^2.1.0", "toml": "^3.0.0", "urijs": "^1.19.1" @@ -1590,6 +1591,16 @@ "reusify": "^1.0.4" } }, + "node_modules/feaxios": { + "version": "0.0.20", + "resolved": "https://registry.npmjs.org/feaxios/-/feaxios-0.0.20.tgz", + "integrity": "sha512-g3hm2YDNffNxA3Re3Hd8ahbpmDee9Fv1Pb1C/NoWsjY7mtD8nyNeJytUzn+DK0Hyl9o6HppeWOrtnqgmhOYfWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-retry-allowed": "^3.0.0" + } + }, "node_modules/figures": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", @@ -2040,6 +2051,19 @@ "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", "dev": true }, + "node_modules/is-retry-allowed": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-3.0.0.tgz", + "integrity": "sha512-9xH0xvoggby+u0uGF7cZXdrutWiBiaFG8ZT4YFPXL8NzkyAwX3AKGLeFQLvzDpM430+nDFBZ1LHkie/8ocL06A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", @@ -2316,9 +2340,9 @@ "dev": true }, "node_modules/node-gyp-build": { - "version": "4.8.2", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.2.tgz", - "integrity": "sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==", + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.3.tgz", + "integrity": "sha512-EMS95CMJzdoSKoIiXo8pxKoL8DYxwIZXYlLmgPb8KUv794abpnLK6ynsCAWNliOjREKruYKdzbh76HHYUHX7nw==", "dev": true, "license": "MIT", "optional": true, @@ -2983,11 +3007,10 @@ } }, "node_modules/sodium-native": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.2.0.tgz", - "integrity": "sha512-rdJRAf/RE/IRFUUoUsz10slNAQDTGz5ChpIeR1Ti0BtGYstl6Uok4hHALPBdnFcLml6qXJ2pDd0/De09mPa6mg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.3.1.tgz", + "integrity": "sha512-YdP64gAdpIKHfL4ttuX4aIfjeunh9f+hNeQJpE9C8UMndB3zkgZ7YmmGT4J2+v6Ibyp6Wem8D1TcSrtdW0bqtg==", "dev": true, - "hasInstallScript": true, "license": "MIT", "optional": true, "dependencies": { diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/package.json b/cmd/crates/soroban-spec-typescript/ts-tests/package.json index 69a17eb5c..a8bb3c1ff 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/package.json +++ b/cmd/crates/soroban-spec-typescript/ts-tests/package.json @@ -8,7 +8,7 @@ }, "devDependencies": { "@ava/typescript": "^4.1.0", - "@stellar/stellar-sdk": "12.3.0", + "@stellar/stellar-sdk": "13.0.0", "@types/node": "^20.4.9", "@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/parser": "^6.10.0", diff --git a/cmd/crates/soroban-test/Cargo.toml b/cmd/crates/soroban-test/Cargo.toml index d9eb31bdd..d035652d1 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 = "22.0.0-rc.1" +version.workspace = true edition = "2021" rust-version.workspace = true autobins = false @@ -29,9 +29,9 @@ thiserror = "1.0.31" sha2 = "0.10.6" assert_cmd = "2.0.4" assert_fs = "1.0.7" -predicates = "2.1.5" +predicates = { workspace = true } fs_extra = "1.3.0" -toml = "0.8.10" +toml = { workspace = true } [dev-dependencies] diff --git a/cmd/crates/soroban-test/tests/fixtures/bye/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/bye/Cargo.toml index acee77f4b..deccb9c75 100644 --- a/cmd/crates/soroban-test/tests/fixtures/bye/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/bye/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stellar-bye" -version = "22.0.0-rc.1" +version = "0.0.0" edition = "2021" publish = false diff --git a/cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml index 2a212a532..fe7eb636a 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 = "22.0.0-rc.1" +version = "0.0.0" edition = "2021" publish = false diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/constructor/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/constructor/Cargo.toml index 8c38fecb4..69d8a6430 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/constructor/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/constructor/Cargo.toml @@ -1,11 +1,10 @@ [package] name = "test_constructor" -version = "22.0.0-rc.1" +version = "0.0.0" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" publish = false -rust-version.workspace = true [lib] crate-type = ["cdylib"] diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_account/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_account/Cargo.toml index 9be386b69..765f671c6 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_account/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_account/Cargo.toml @@ -1,18 +1,17 @@ [package] name = "test_custom_account" -version = "22.0.0-rc.1" +version = "0.0.0" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" publish = false -rust-version.workspace = true [lib] crate-type = ["cdylib"] doctest = false [dependencies] -soroban-sdk = { version = "=21.7.2" } +soroban-sdk = { workspace = true } [dev-dependencies] -soroban-sdk = { version = "=21.7.2", features = ["testutils"]} +soroban-sdk = { workspace = true, features = ["testutils"]} diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_account/src/lib.rs b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_account/src/lib.rs index c71324110..ed924322b 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_account/src/lib.rs +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_account/src/lib.rs @@ -115,7 +115,9 @@ impl CustomAccountInterface for Contract { return Err(Error::NotPermitted); } } - Context::CreateContractHostFn(_) => return Err(Error::InvalidContext), + Context::CreateContractWithCtorHostFn(_) | Context::CreateContractHostFn(_) => { + return Err(Error::InvalidContext) + } }; } 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 7c4ca5828..b5a17c6a5 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,18 +1,17 @@ [package] name = "test_custom_types" -version = "22.0.0-rc.1" +version = "0.0.0" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" publish = false -rust-version.workspace = true [lib] crate-type = ["cdylib", "rlib"] doctest = false [dependencies] -soroban-sdk = { version = "=21.7.2" } +soroban-sdk = { workspace = true } [dev-dependencies] -soroban-sdk = { version = "=21.7.2", features = ["testutils"]} +soroban-sdk = { workspace = true, features = ["testutils"]} 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 19b7353ca..a13c98a39 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,18 +1,17 @@ [package] name = "test_hello_world" -version = "22.0.0-rc.1" +version = "0.0.0" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" publish = false -rust-version.workspace = true [lib] crate-type = ["cdylib", "rlib"] doctest = false [dependencies] -soroban-sdk = { version = "=21.7.2" } +soroban-sdk = { workspace = true } [dev-dependencies] -soroban-sdk = { version = "=21.7.2", features = ["testutils"]} +soroban-sdk = { workspace = true, features = ["testutils"]} diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/src/lib.rs b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/src/lib.rs index 40006a1b7..b4b53c237 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/src/lib.rs +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/src/lib.rs @@ -77,7 +77,7 @@ mod test { #[test] fn test_hello() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let client = ContractClient::new(&env, &contract_id); let world = symbol_short!("world"); let res = client.hello(&world); diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/Cargo.toml index 509483408..495a52d71 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/Cargo.toml @@ -1,18 +1,17 @@ [package] name = "test_swap" -version.workspace = true +version = "0.0.0" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" publish = false -rust-version.workspace = true [lib] crate-type = ["cdylib"] doctest = false [dependencies] -soroban-sdk = { version = "=21.7.2" } +soroban-sdk = { workspace = true } [dev-dependencies] -soroban-sdk = { version = "=21.7.2", features = ["testutils"] } +soroban-sdk = { workspace = true, features = ["testutils"] } diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/src/test.rs b/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/src/test.rs index 5c973880e..a60615162 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/src/test.rs +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/src/test.rs @@ -21,7 +21,7 @@ fn create_token_contract<'a>(e: &Env, admin: &Address) -> (TokenClient<'a>, Toke } fn create_atomic_swap_contract(e: &Env) -> AtomicSwapContractClient { - AtomicSwapContractClient::new(e, &e.register_contract(None, AtomicSwapContract {})) + AtomicSwapContractClient::new(e, &e.register(AtomicSwapContract {}, ())) } #[test] diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/Cargo.toml index 03055f2b7..6456983e8 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/Cargo.toml @@ -1,19 +1,18 @@ [package] name = "test_token" -version.workspace = true +version = "0.0.0" description = "Soroban standard token contract" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" publish = false -rust-version.workspace = true [lib] crate-type = ["cdylib"] [dependencies] -soroban-sdk = { version = "=21.7.2" } -soroban-token-sdk = { version = "=21.7.2" } +soroban-sdk = { workspace = true } +soroban-token-sdk = { workspace = true } [dev-dependencies] -soroban-sdk = { version = "=21.7.2", features = ["testutils"] } +soroban-sdk = { workspace = true, features = ["testutils"] } diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/src/test.rs b/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/src/test.rs index 08be5f9ef..cd892a646 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/src/test.rs +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/src/test.rs @@ -9,7 +9,7 @@ use soroban_sdk::{ }; fn create_token<'a>(e: &Env, admin: &Address) -> TokenClient<'a> { - let token = TokenClient::new(e, &e.register_contract(None, Token {})); + let token = TokenClient::new(e, &e.register(Token {}, ())); token.initialize(admin, &7, &"name".into_val(e), &"symbol".into_val(e)); token } @@ -247,7 +247,7 @@ fn initialize_already_initialized() { fn decimal_is_over_max() { let e = Env::default(); let admin = Address::generate(&e); - let token = TokenClient::new(&e, &e.register_contract(None, Token {})); + let token = TokenClient::new(&e, &e.register(Token {}, ())); token.initialize( &admin, &(u32::from(u8::MAX) + 1), diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/udt/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/udt/Cargo.toml index aea356447..206284802 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/udt/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/udt/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["cdylib"] doctest = false [dependencies] -soroban-sdk = { version = "=21.7.2" } +soroban-sdk = { workspace = true } [dev-dependencies] -soroban-sdk = { version = "=21.7.2" , features = ["testutils"]} +soroban-sdk = { workspace = true , features = ["testutils"]} diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/udt/src/lib.rs b/cmd/crates/soroban-test/tests/fixtures/test-wasms/udt/src/lib.rs index 695d8a7a3..efb3cf480 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/udt/src/lib.rs +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/udt/src/lib.rs @@ -80,7 +80,7 @@ mod test { #[test] fn test_add() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let udt = UdtStruct { 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 12963b1f4..fd38c2012 100644 --- a/cmd/crates/soroban-test/tests/it/integration/hello_world.rs +++ b/cmd/crates/soroban-test/tests/it/integration/hello_world.rs @@ -96,7 +96,7 @@ async fn invoke() { .arg("--id") .arg(id) .assert() - .stdout(predicates::str::contains(id).not()) + .stdout(predicates::str::contains(id)) .success(); invoke_hello_world_with_lib(sandbox, id).await; let config_locator = locator::Args { @@ -159,7 +159,7 @@ pub(crate) fn invoke_hello_world(sandbox: &TestEnv, id: &str) { fn hello_world_cmd(id: &str, arg: &str) -> contract::invoke::Cmd { contract::invoke::Cmd { - contract_id: id.to_string(), + contract_id: id.parse().unwrap(), slop: vec!["hello".into(), format!("--world={arg}").into()], ..Default::default() } diff --git a/cmd/crates/stellar-ledger/Cargo.toml b/cmd/crates/stellar-ledger/Cargo.toml index 24b9ebef4..b3d6318a4 100644 --- a/cmd/crates/stellar-ledger/Cargo.toml +++ b/cmd/crates/stellar-ledger/Cargo.toml @@ -21,7 +21,7 @@ thiserror = "1.0.32" serde = "1.0.82" serde_derive = "1.0.82" serde_json = "1.0.82" -sha2 = "0.9.9" +sha2 = { workspace = true } ed25519-dalek = { workspace = true } stellar-strkey = { workspace = true } ledger-transport-hid = "0.10.0" @@ -34,7 +34,7 @@ byteorder = "1.5.0" bollard = { workspace = true } home = "0.5.9" tokio = { version = "1", features = ["full"] } -reqwest = { version = "0.11", features = ["json"] } +reqwest = { workspace = true, features = ["json"] } soroban-rpc.workspace = true phf = { version = "0.11.2", features = ["macros"] } futures = "0.3.30" diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml index d2a53e6f2..2f2a26255 100644 --- a/cmd/soroban-cli/Cargo.toml +++ b/cmd/soroban-cli/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/stellar/stellar-cli" authors = ["Stellar Development Foundation "] license = "Apache-2.0" readme = "README.md" -version = "22.0.0-rc.1" +version.workspace = true edition = "2021" rust-version.workspace = true autobins = false @@ -83,18 +83,17 @@ reqwest = { version = "0.12.7", default-features = false, features = [ jsonrpsee-http-client = "0.20.1" jsonrpsee-core = "0.20.1" regex = "1.6.0" -wasm-opt = { version = "0.114.0", optional = true } +wasm-opt = { version = "0.116.1", optional = true } chrono = { version = "0.4.27", features = ["serde"] } rpassword = "7.2.0" -dirs = "4.0.0" -toml = "0.5.9" +toml = { workspace = true } itertools = "0.10.5" shlex = "1.1.0" sep5 = { workspace = true } ethnum = { workspace = true } clap-markdown = { version = "0.1.4", optional = true } which = { workspace = true, features = ["regex"] } -strsim = "0.10.0" +strsim = "0.11.1" heck = "0.5.0" tracing = { workspace = true } tracing-appender = { workspace = true } @@ -109,7 +108,7 @@ strum_macros = "0.17.1" async-compression = { version = "0.4.12", features = ["tokio", "gzip"] } shell-escape = "0.1.5" tempfile = "3.8.1" -toml_edit = "0.21.0" +toml_edit = { workspace = true } rust-embed = { version = "8.2.0", features = ["debug-embed"] } bollard = { workspace = true } futures-util = "0.3.30" @@ -127,7 +126,7 @@ url = "2.5.2" wasm-gen = "0.1.4" [build-dependencies] -crate-git-revision = "0.0.4" +crate-git-revision = "0.0.6" serde.workspace = true thiserror.workspace = true @@ -135,6 +134,6 @@ thiserror.workspace = true [dev-dependencies] assert_cmd = "2.0.4" assert_fs = "1.0.7" -predicates = "2.1.5" +predicates = { workspace = true } walkdir = "2.5.0" mockito = "1.5.0" diff --git a/cmd/soroban-cli/src/commands/contract/alias/add.rs b/cmd/soroban-cli/src/commands/contract/alias/add.rs index 5a7a17ddb..923ead5e9 100644 --- a/cmd/soroban-cli/src/commands/contract/alias/add.rs +++ b/cmd/soroban-cli/src/commands/contract/alias/add.rs @@ -13,9 +13,9 @@ pub struct Cmd { pub config_locator: locator::Args, #[command(flatten)] - network: network::Args, + pub network: network::Args, - /// The contract alias that will be removed. + /// The contract alias that will be used. pub alias: String, /// Overwrite the contract alias if it already exists. @@ -41,7 +41,7 @@ pub enum Error { AlreadyExist { alias: String, network_passphrase: String, - contract: String, + contract: stellar_strkey::Contract, }, } @@ -57,7 +57,7 @@ impl Cmd { .get_contract_id(&self.alias, network_passphrase)?; if let Some(contract) = contract { - if contract != self.contract_id.to_string() && !self.overwrite { + if contract != self.contract_id && !self.overwrite { return Err(Error::AlreadyExist { alias: alias.to_string(), network_passphrase: network_passphrase.to_string(), diff --git a/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs b/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs index 84e2b1762..679e757f4 100644 --- a/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs +++ b/cmd/soroban-cli/src/commands/contract/bindings/typescript.rs @@ -5,14 +5,13 @@ use soroban_spec_tools::contract as contract_spec; use soroban_spec_typescript::{self as typescript, boilerplate::Project}; use stellar_strkey::DecodeError; +use crate::print::Print; use crate::wasm; use crate::{ commands::{contract::fetch, global, NetworkRunnable}, - config::{ - self, locator, - network::{self, Network}, - }, + config::{self, locator, network}, get_spec::{self, get_remote_contract_spec}, + xdr::{Hash, ScAddress}, }; #[derive(Parser, Debug, Clone)] @@ -83,20 +82,27 @@ impl NetworkRunnable for Cmd { global_args: Option<&global::Args>, config: Option<&config::Args>, ) -> Result<(), Error> { + let print = Print::new(global_args.is_some_and(|a| a.quiet)); + + let network = self.network.get(&self.locator).ok().unwrap_or_else(|| { + network::DEFAULTS + .get("testnet") + .expect("no network specified and testnet network not found") + .into() + }); + + let contract_id = self + .locator + .resolve_contract_id(&self.contract_id, &network.network_passphrase)? + .0; + let contract_address = ScAddress::Contract(Hash(contract_id)); + let spec = if let Some(wasm) = &self.wasm { + print.infoln("Loading contract spec from file..."); let wasm: wasm::Args = wasm.into(); wasm.parse()?.spec } else { - let network = config.map_or_else( - || self.network.get(&self.locator).map_err(Error::from), - |c| c.get_network().map_err(Error::from), - )?; - - let contract_id = self - .locator - .resolve_contract_id(&self.contract_id, &network.network_passphrase)? - .0; - + print.globeln(format!("Downloading contract spec: {contract_address}")); get_remote_contract_spec( &contract_id, &self.locator, @@ -119,16 +125,7 @@ impl NetworkRunnable for Cmd { } std::fs::create_dir_all(&self.output_dir)?; let p: Project = self.output_dir.clone().try_into()?; - let Network { - rpc_url, - network_passphrase, - .. - } = self.network.get(&self.locator).ok().unwrap_or_else(|| { - network::DEFAULTS - .get("futurenet") - .expect("why did we remove the default futurenet network?") - .into() - }); + print.infoln(format!("Network: {}", network.network_passphrase)); let absolute_path = self.output_dir.canonicalize()?; let file_name = absolute_path .file_name() @@ -136,24 +133,19 @@ impl NetworkRunnable for Cmd { let contract_name = &file_name .to_str() .ok_or_else(|| Error::NotUtf8(file_name.to_os_string()))?; + print.infoln(format!("Embedding contract address: {contract_address}")); p.init( contract_name, - &self.contract_id, - &rpc_url, - &network_passphrase, + &contract_address.to_string(), + &network.rpc_url, + &network.network_passphrase, &spec, )?; - std::process::Command::new("npm") - .arg("install") - .current_dir(&self.output_dir) - .spawn()? - .wait()?; - std::process::Command::new("npm") - .arg("run") - .arg("build") - .current_dir(&self.output_dir) - .spawn()? - .wait()?; + print.checkln("Generated!"); + print.infoln(format!( + "Run \"npm install && npm run build\" in {:?} to build the JavaScript NPM package.", + self.output_dir + )); Ok(()) } } diff --git a/cmd/soroban-cli/src/commands/contract/deploy/asset.rs b/cmd/soroban-cli/src/commands/contract/deploy/asset.rs index 169c0109a..04a0380ed 100644 --- a/cmd/soroban-cli/src/commands/contract/deploy/asset.rs +++ b/cmd/soroban-cli/src/commands/contract/deploy/asset.rs @@ -110,12 +110,12 @@ impl NetworkRunnable for Cmd { source_account, )?; if self.fee.build_only { - return Ok(TxnResult::Txn(tx)); + return Ok(TxnResult::Txn(Box::new(tx))); } let txn = simulate_and_assemble_transaction(&client, &tx).await?; let txn = self.fee.apply_to_assembled_txn(txn).transaction().clone(); if self.fee.sim_only { - return Ok(TxnResult::Txn(txn)); + return Ok(TxnResult::Txn(Box::new(txn))); } let get_txn_resp = client .send_transaction_polling(&self.config.sign_with_local_key(txn).await?) diff --git a/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs b/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs index 9bf63802c..1d85832b0 100644 --- a/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs +++ b/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs @@ -265,14 +265,14 @@ impl NetworkRunnable for Cmd { // Get the account sequence number let account_details = client.get_account(&source_account.to_string()).await?; let sequence: i64 = account_details.seq_num.into(); - let txn = build_create_contract_tx( + let txn = Box::new(build_create_contract_tx( wasm_hash, sequence + 1, self.fee.fee, source_account, contract_id_preimage, constructor_params.as_ref(), - )?; + )?); if self.fee.build_only { print.checkln("Transaction built!"); @@ -282,7 +282,7 @@ impl NetworkRunnable for Cmd { print.infoln("Simulating deploy transaction…"); let txn = simulate_and_assemble_transaction(&client, &txn).await?; - let txn = self.fee.apply_to_assembled_txn(txn).transaction().clone(); + let txn = Box::new(self.fee.apply_to_assembled_txn(txn).transaction().clone()); if self.fee.sim_only { print.checkln("Done!"); @@ -293,7 +293,7 @@ impl NetworkRunnable for Cmd { print.log_transaction(&txn, &network, true)?; let get_txn_resp = client - .send_transaction_polling(&config.sign_with_local_key(txn).await?) + .send_transaction_polling(&config.sign_with_local_key(*txn).await?) .await? .try_into()?; diff --git a/cmd/soroban-cli/src/commands/contract/extend.rs b/cmd/soroban-cli/src/commands/contract/extend.rs index 6ec8ebdb1..e56cbe166 100644 --- a/cmd/soroban-cli/src/commands/contract/extend.rs +++ b/cmd/soroban-cli/src/commands/contract/extend.rs @@ -140,7 +140,7 @@ impl NetworkRunnable for Cmd { .await?; let sequence: i64 = account_details.seq_num.into(); - let tx = Transaction { + let tx = Box::new(Transaction { source_account, fee: self.fee.fee, seq_num: SequenceNumber(sequence + 1), @@ -167,7 +167,7 @@ impl NetworkRunnable for Cmd { }, resource_fee: 0, }), - }; + }); if self.fee.build_only { return Ok(TxnResult::Txn(tx)); } diff --git a/cmd/soroban-cli/src/commands/contract/fetch.rs b/cmd/soroban-cli/src/commands/contract/fetch.rs index 2714b1f07..31ed191ff 100644 --- a/cmd/soroban-cli/src/commands/contract/fetch.rs +++ b/cmd/soroban-cli/src/commands/contract/fetch.rs @@ -22,7 +22,7 @@ use crate::{ pub struct Cmd { /// Contract ID to fetch #[arg(long = "id", env = "STELLAR_CONTRACT_ID")] - pub contract_id: String, + pub contract_id: config::ContractAddress, /// Where to write output otherwise stdout is used #[arg(long, short = 'o')] pub out_file: Option, @@ -111,6 +111,12 @@ impl NetworkRunnable for Cmd { config: Option<&config::Args>, ) -> Result, Error> { let network = config.map_or_else(|| self.network(), |c| Ok(c.get_network()?))?; - return Ok(wasm::fetch_from_contract(&self.contract_id, &network, &self.locator).await?); + Ok(wasm::fetch_from_contract( + &self + .contract_id + .resolve_contract_id(&self.locator, &network.network_passphrase)?, + &network, + ) + .await?) } } diff --git a/cmd/soroban-cli/src/commands/contract/info/shared.rs b/cmd/soroban-cli/src/commands/contract/info/shared.rs index b34ec7da8..33a95b607 100644 --- a/cmd/soroban-cli/src/commands/contract/info/shared.rs +++ b/cmd/soroban-cli/src/commands/contract/info/shared.rs @@ -1,13 +1,13 @@ use std::path::PathBuf; -use crate::xdr; use clap::arg; use crate::{ commands::contract::info::shared::Error::InvalidWasmHash, - config::{locator, network}, + config::{self, locator, network}, utils::rpc::get_remote_wasm_from_hash, wasm::{self, Error::ContractIsStellarAsset}, + xdr, }; #[derive(Debug, clap::Args, Clone, Default)] @@ -24,9 +24,9 @@ pub struct Args { /// Wasm hash to get the data for #[arg(long = "wasm-hash", group = "Source")] pub wasm_hash: Option, - /// Contract id to get the data for + /// Contract id or contract alias to get the data for #[arg(long = "id", env = "STELLAR_CONTRACT_ID", group = "Source")] - pub contract_id: Option, + pub contract_id: Option, #[command(flatten)] pub network: network::Args, #[command(flatten)] @@ -56,6 +56,8 @@ pub enum Error { InvalidWasmHash(String), #[error(transparent)] Rpc(#[from] soroban_rpc::Error), + #[error(transparent)] + Locator(#[from] locator::Error), } pub async fn fetch_wasm(args: &Args) -> Result>, Error> { @@ -84,7 +86,9 @@ pub async fn fetch_wasm(args: &Args) -> Result>, Error> { get_remote_wasm_from_hash(&client, &hash).await? } else if let Some(contract_id) = &args.contract_id { - let res = wasm::fetch_from_contract(contract_id, network, &args.locator).await; + let contract_id = + contract_id.resolve_contract_id(&args.locator, &network.network_passphrase)?; + let res = wasm::fetch_from_contract(&contract_id, network).await; if let Some(ContractIsStellarAsset) = res.as_ref().err() { return Ok(None); } diff --git a/cmd/soroban-cli/src/commands/contract/init.rs b/cmd/soroban-cli/src/commands/contract/init.rs index 96f28c64e..9147bacf0 100644 --- a/cmd/soroban-cli/src/commands/contract/init.rs +++ b/cmd/soroban-cli/src/commands/contract/init.rs @@ -275,7 +275,7 @@ mod tests { 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.clone()).unwrap(); - let doc = cargo_toml_str.parse::().unwrap(); + let doc: toml_edit::DocumentMut = cargo_toml_str.parse().unwrap(); assert!( doc.get("dependencies") .unwrap() diff --git a/cmd/soroban-cli/src/commands/contract/install.rs b/cmd/soroban-cli/src/commands/contract/install.rs index a215a987d..0a9ec856d 100644 --- a/cmd/soroban-cli/src/commands/contract/install.rs +++ b/cmd/soroban-cli/src/commands/contract/install.rs @@ -146,7 +146,7 @@ impl NetworkRunnable for Cmd { build_install_contract_code_tx(&contract, sequence + 1, self.fee.fee, &source_account)?; if self.fee.build_only { - return Ok(TxnResult::Txn(tx_without_preflight)); + return Ok(TxnResult::Txn(Box::new(tx_without_preflight))); } // Don't check whether the contract is already installed when the user @@ -186,7 +186,7 @@ impl NetworkRunnable for Cmd { print.infoln("Simulating install transaction…"); let txn = simulate_and_assemble_transaction(&client, &tx_without_preflight).await?; - let txn = self.fee.apply_to_assembled_txn(txn).transaction().clone(); + let txn = Box::new(self.fee.apply_to_assembled_txn(txn).transaction().clone()); if self.fee.sim_only { return Ok(TxnResult::Txn(txn)); @@ -195,7 +195,7 @@ impl NetworkRunnable for Cmd { print.globeln("Submitting install transaction…"); let txn_resp = client - .send_transaction_polling(&self.config.sign_with_local_key(txn).await?) + .send_transaction_polling(&self.config.sign_with_local_key(*txn).await?) .await?; if args.map_or(true, |a| !a.no_cache) { diff --git a/cmd/soroban-cli/src/commands/contract/invoke.rs b/cmd/soroban-cli/src/commands/contract/invoke.rs index 47e2699fc..c7b631343 100644 --- a/cmd/soroban-cli/src/commands/contract/invoke.rs +++ b/cmd/soroban-cli/src/commands/contract/invoke.rs @@ -25,10 +25,10 @@ use crate::{ print, rpc, xdr::{ self, AccountEntry, AccountEntryExt, AccountId, ContractEvent, ContractEventType, - DiagnosticEvent, HostFunction, InvokeContractArgs, InvokeHostFunctionOp, LedgerEntryData, - Limits, Memo, MuxedAccount, Operation, OperationBody, Preconditions, PublicKey, - ScSpecEntry, SequenceNumber, String32, StringM, Thresholds, Transaction, TransactionExt, - Uint256, VecM, WriteXdr, + DiagnosticEvent, HostFunction, InvokeContractArgs, InvokeHostFunctionOp, Limits, Memo, + MuxedAccount, Operation, OperationBody, Preconditions, PublicKey, ScSpecEntry, + SequenceNumber, String32, StringM, Thresholds, Transaction, TransactionExt, Uint256, VecM, + WriteXdr, }, Pwd, }; @@ -40,7 +40,7 @@ use soroban_spec_tools::contract; pub struct Cmd { /// Contract ID to invoke #[arg(long = "id", env = "STELLAR_CONTRACT_ID")] - pub contract_id: String, + pub contract_id: config::ContractAddress, // For testing only #[arg(skip)] pub wasm: Option, @@ -93,8 +93,6 @@ pub enum Error { ParseIntError(#[from] ParseIntError), #[error(transparent)] Rpc(#[from] rpc::Error), - #[error("unexpected contract code data type: {0:?}")] - UnexpectedContractCodeDataType(LedgerEntryData), #[error("missing operation result")] MissingOperationResult, #[error("error loading signing key: {0}")] @@ -217,9 +215,8 @@ impl NetworkRunnable for Cmd { let network = config.get_network()?; tracing::trace!(?network); let contract_id = self - .config - .locator - .resolve_contract_id(&self.contract_id, &network.network_passphrase)?; + .contract_id + .resolve_contract_id(&config.locator, &network.network_passphrase)?; let spec_entries = self.spec_entries()?; if let Some(spec_entries) = &spec_entries { @@ -259,21 +256,22 @@ impl NetworkRunnable for Cmd { let sequence: i64 = account_details.seq_num.into(); let AccountId(PublicKey::PublicKeyTypeEd25519(account_id)) = account_details.account_id; - let tx = build_invoke_contract_tx( + let tx = Box::new(build_invoke_contract_tx( host_function_params.clone(), sequence + 1, self.fee.fee, account_id, - )?; + )?); if self.fee.build_only { return Ok(TxnResult::Txn(tx)); } let txn = simulate_and_assemble_transaction(&client, &tx).await?; - let txn = self.fee.apply_to_assembled_txn(txn); + let assembled = self.fee.apply_to_assembled_txn(txn); + let mut txn = Box::new(assembled.transaction().clone()); if self.fee.sim_only { - return Ok(TxnResult::Txn(txn.transaction().clone())); + return Ok(TxnResult::Txn(txn)); } - let sim_res = txn.sim_response(); + let sim_res = assembled.sim_response(); if global_args.map_or(true, |a| !a.no_cache) { data::write(sim_res.clone().into(), &network.rpc_uri()?)?; } @@ -282,12 +280,11 @@ impl NetworkRunnable for Cmd { ShouldSend::Yes => { let global::Args { no_cache, .. } = global_args.cloned().unwrap_or_default(); // Need to sign all auth entries - let mut txn = txn.transaction().clone(); if let Some(tx) = config.sign_soroban_authorizations(&txn, &signers).await? { - txn = tx; + txn = Box::new(tx); } let res = client - .send_transaction_polling(&config.sign_with_local_key(txn).await?) + .send_transaction_polling(&config.sign_with_local_key(*txn).await?) .await?; if !no_cache { data::write(res.clone().try_into()?, &network.rpc_uri()?)?; diff --git a/cmd/soroban-cli/src/commands/contract/restore.rs b/cmd/soroban-cli/src/commands/contract/restore.rs index 92fc4b41d..cb35e6304 100644 --- a/cmd/soroban-cli/src/commands/contract/restore.rs +++ b/cmd/soroban-cli/src/commands/contract/restore.rs @@ -141,7 +141,7 @@ impl NetworkRunnable for Cmd { .await?; let sequence: i64 = account_details.seq_num.into(); - let tx = Transaction { + let tx = Box::new(Transaction { source_account, fee: self.fee.fee, seq_num: SequenceNumber(sequence + 1), @@ -167,12 +167,12 @@ impl NetworkRunnable for Cmd { }, resource_fee: 0, }), - }; + }); if self.fee.build_only { return Ok(TxnResult::Txn(tx)); } let res = client - .send_transaction_polling(&config.sign_with_local_key(tx).await?) + .send_transaction_polling(&config.sign_with_local_key(*tx).await?) .await?; if args.map_or(true, |a| !a.no_cache) { data::write(res.clone().try_into()?, &network.rpc_uri()?)?; diff --git a/cmd/soroban-cli/src/commands/events.rs b/cmd/soroban-cli/src/commands/events.rs index a1f5de921..48d79c1b7 100644 --- a/cmd/soroban-cli/src/commands/events.rs +++ b/cmd/soroban-cli/src/commands/events.rs @@ -42,7 +42,7 @@ pub struct Cmd { num_args = 1..=6, help_heading = "FILTERS" )] - contract_ids: Vec, + contract_ids: Vec, /// A set of (up to 4) topic filters to filter event topics on. A single /// topic filter can contain 1-4 different segment filters, separated by /// commas, with an asterisk (`*` character) indicating a wildcard segment. @@ -218,9 +218,8 @@ impl NetworkRunnable for Cmd { .contract_ids .iter() .map(|id| { - Ok(self - .locator - .resolve_contract_id(id, &network.network_passphrase)? + Ok(id + .resolve_contract_id(&self.locator, &network.network_passphrase)? .to_string()) }) .collect::, Error>>()?; diff --git a/cmd/soroban-cli/src/commands/tx/args.rs b/cmd/soroban-cli/src/commands/tx/args.rs index fc99b9591..1da1f230a 100644 --- a/cmd/soroban-cli/src/commands/tx/args.rs +++ b/cmd/soroban-cli/src/commands/tx/args.rs @@ -87,7 +87,7 @@ impl Args { let network = self.config.get_network()?; let client = Client::new(&network.rpc_url)?; if self.fee.build_only { - return Ok(TxnEnvelopeResult::TxnEnvelope(tx.into())); + return Ok(TxnEnvelopeResult::TxnEnvelope(Box::new(tx.into()))); } let txn_resp = client diff --git a/cmd/soroban-cli/src/commands/tx/new/set_options.rs b/cmd/soroban-cli/src/commands/tx/new/set_options.rs index 3410b69e8..69cd10745 100644 --- a/cmd/soroban-cli/src/commands/tx/new/set_options.rs +++ b/cmd/soroban-cli/src/commands/tx/new/set_options.rs @@ -40,7 +40,7 @@ pub struct Cmd { /// https://developers.stellar.org/docs/tokens/control-asset-access#authorization-required-0x1 pub set_required: bool, #[arg(long, conflicts_with = "clear_revocable")] - /// When enabled, an issuer can revoke an existing trustline’s authorization, thereby freezing the asset held by an account. + /// When enabled, an issuer can revoke an existing trustline's authorization, thereby freezing the asset held by an account. /// https://developers.stellar.org/docs/tokens/control-asset-access#authorization-revocable-0x2 pub set_revocable: bool, #[arg(long, conflicts_with = "clear_clawback_enabled")] @@ -48,7 +48,7 @@ pub struct Cmd { /// https://developers.stellar.org/docs/tokens/control-asset-access#clawback-enabled-0x8 pub set_clawback_enabled: bool, #[arg(long, conflicts_with = "clear_immutable")] - /// With this setting, none of the other authorization flags (`AUTH_REQUIRED_FLAG`, `AUTH_REVOCABLE_FLAG`) can be set, and the issuing account can’t be merged. + /// With this setting, none of the other authorization flags (`AUTH_REQUIRED_FLAG`, `AUTH_REVOCABLE_FLAG`) can be set, and the issuing account can't be merged. /// https://developers.stellar.org/docs/tokens/control-asset-access#authorization-immutable-0x4 pub set_immutable: bool, #[arg(long)] diff --git a/cmd/soroban-cli/src/commands/txn_result.rs b/cmd/soroban-cli/src/commands/txn_result.rs index d6b308b3a..568fd79d2 100644 --- a/cmd/soroban-cli/src/commands/txn_result.rs +++ b/cmd/soroban-cli/src/commands/txn_result.rs @@ -2,7 +2,7 @@ use crate::xdr::{Transaction, TransactionEnvelope, TransactionV1Envelope, VecM}; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub enum TxnResult { - Txn(Transaction), + Txn(Box), Res(R), } @@ -16,12 +16,12 @@ impl TxnResult { pub fn to_envelope(self) -> TxnEnvelopeResult { match self { - TxnResult::Txn(tx) => { - TxnEnvelopeResult::TxnEnvelope(TransactionEnvelope::Tx(TransactionV1Envelope { - tx, + TxnResult::Txn(tx) => TxnEnvelopeResult::TxnEnvelope(Box::new( + TransactionEnvelope::Tx(TransactionV1Envelope { + tx: *tx, signatures: VecM::default(), - })) - } + }), + )), TxnResult::Res(res) => TxnEnvelopeResult::Res(res), } } @@ -29,6 +29,6 @@ impl TxnResult { #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub enum TxnEnvelopeResult { - TxnEnvelope(TransactionEnvelope), + TxnEnvelope(Box), Res(R), } diff --git a/cmd/soroban-cli/src/config/alias.rs b/cmd/soroban-cli/src/config/alias.rs index 68ad556d6..9d1d8c11b 100644 --- a/cmd/soroban-cli/src/config/alias.rs +++ b/cmd/soroban-cli/src/config/alias.rs @@ -1,8 +1,49 @@ -use std::collections::HashMap; +use std::{collections::HashMap, convert::Infallible, str::FromStr}; use serde::{Deserialize, Serialize}; +use super::locator; + #[derive(Serialize, Deserialize, Default)] pub struct Data { pub ids: HashMap, } + +/// Address can be either a contract address, C.. or eventually an alias of a contract address. +#[derive(Clone, Debug)] +pub enum ContractAddress { + ContractId(stellar_strkey::Contract), + Alias(String), +} + +impl Default for ContractAddress { + fn default() -> Self { + ContractAddress::Alias(String::default()) + } +} + +impl FromStr for ContractAddress { + type Err = Infallible; + + fn from_str(value: &str) -> Result { + Ok(stellar_strkey::Contract::from_str(value).map_or_else( + |_| ContractAddress::Alias(value.to_string()), + ContractAddress::ContractId, + )) + } +} + +impl ContractAddress { + pub fn resolve_contract_id( + &self, + locator: &locator::Args, + network_passphrase: &str, + ) -> Result { + match self { + ContractAddress::ContractId(muxed_account) => Ok(*muxed_account), + ContractAddress::Alias(alias) => locator + .get_contract_id(alias, network_passphrase)? + .ok_or_else(|| locator::Error::ContractNotFound(alias.to_owned())), + } + } +} diff --git a/cmd/soroban-cli/src/config/locator.rs b/cmd/soroban-cli/src/config/locator.rs index 60b7856a6..b6f5c75c1 100644 --- a/cmd/soroban-cli/src/config/locator.rs +++ b/cmd/soroban-cli/src/config/locator.rs @@ -1,4 +1,5 @@ use clap::arg; +use directories::UserDirs; use itertools::Itertools; use serde::de::DeserializeOwned; use std::{ @@ -76,6 +77,8 @@ pub enum Error { CannotAccessAliasConfigFile, #[error("cannot parse contract ID {0}: {1}")] CannotParseContractId(String, DecodeError), + #[error("contract not found: {0}")] + ContractNotFound(String), #[error("Failed to read upgrade check file: {path}: {error}")] UpgradeCheckReadFailed { path: PathBuf, error: io::Error }, #[error("Failed to write upgrade check file: {path}: {error}")] @@ -332,12 +335,17 @@ impl Args { &self, alias: &str, network_passphrase: &str, - ) -> Result, Error> { + ) -> Result, Error> { let Some(alias_data) = self.load_contract_from_alias(alias)? else { return Ok(None); }; - Ok(alias_data.ids.get(network_passphrase).cloned()) + alias_data + .ids + .get(network_passphrase) + .map(|id| id.parse()) + .transpose() + .map_err(|e| Error::CannotParseContractId(alias.to_owned(), e)) } pub fn resolve_contract_id( @@ -345,14 +353,12 @@ impl Args { alias_or_contract_id: &str, network_passphrase: &str, ) -> Result { - let contract_id = self - .get_contract_id(alias_or_contract_id, network_passphrase)? - .unwrap_or_else(|| alias_or_contract_id.to_string()); - - Ok(Contract( - soroban_spec_tools::utils::contract_id_from_str(&contract_id) - .map_err(|e| Error::CannotParseContractId(contract_id.clone(), e))?, - )) + let Some(contract) = self.get_contract_id(alias_or_contract_id, network_passphrase)? else { + return alias_or_contract_id + .parse() + .map_err(|e| Error::CannotParseContractId(alias_or_contract_id.to_owned(), e)); + }; + Ok(contract) } } @@ -414,11 +420,10 @@ impl KeyType { } pub fn read_from_path(path: &Path) -> Result { - let data = fs::read(path).map_err(|_| Error::NetworkFileRead { + let data = fs::read_to_string(path).map_err(|_| Error::NetworkFileRead { path: path.to_path_buf(), })?; - let res = toml::from_slice(data.as_slice()); - Ok(res?) + Ok(toml::from_str(&data)?) } pub fn read_with_global(&self, key: &str, pwd: &Path) -> Result { @@ -489,8 +494,9 @@ pub fn global_config_path() -> Result { let config_dir = if let Ok(config_home) = std::env::var("XDG_CONFIG_HOME") { PathBuf::from_str(&config_home).map_err(|_| Error::XdgConfigHome(config_home))? } else { - dirs::home_dir() + UserDirs::new() .ok_or(Error::HomeDirNotFound)? + .home_dir() .join(".config") }; diff --git a/cmd/soroban-cli/src/config/mod.rs b/cmd/soroban-cli/src/config/mod.rs index 11eb179ee..a429ff434 100644 --- a/cmd/soroban-cli/src/config/mod.rs +++ b/cmd/soroban-cli/src/config/mod.rs @@ -23,6 +23,8 @@ pub mod secret; pub mod sign_with; pub mod upgrade_check; +pub use alias::ContractAddress; + #[derive(thiserror::Error, Debug)] pub enum Error { #[error(transparent)] @@ -169,9 +171,8 @@ impl Config { let path = locator::config_file()?; if path.exists() { - let data = fs::read(&path).map_err(|_| locator::Error::FileRead { path })?; - - Ok(toml::from_slice(&data)?) + let data = fs::read_to_string(&path).map_err(|_| locator::Error::FileRead { path })?; + Ok(toml::from_str(&data)?) } else { Ok(Config::default()) } diff --git a/cmd/soroban-cli/src/key.rs b/cmd/soroban-cli/src/key.rs index 3f4dcaf7c..b704541c4 100644 --- a/cmd/soroban-cli/src/key.rs +++ b/cmd/soroban-cli/src/key.rs @@ -4,7 +4,7 @@ use crate::xdr::{ }; use crate::{ commands::contract::Durability, - config::{locator, network::Network}, + config::{alias, locator, network::Network}, wasm, }; use clap::arg; @@ -34,7 +34,7 @@ pub struct Args { required_unless_present = "wasm", required_unless_present = "wasm_hash" )] - pub contract_id: Option, + pub contract_id: Option, /// Storage key (symbols only) #[arg(long = "key", conflicts_with = "key_xdr")] pub key: Option>, @@ -97,8 +97,11 @@ impl Args { } else { vec![ScVal::LedgerKeyContractInstance] }; - let contract = - locator.resolve_contract_id(self.contract_id.as_ref().unwrap(), network_passphrase)?; + let contract = self + .contract_id + .as_ref() + .unwrap() + .resolve_contract_id(locator, network_passphrase)?; Ok(keys .into_iter() diff --git a/cmd/soroban-cli/src/utils/contract-template/src/test.rs b/cmd/soroban-cli/src/utils/contract-template/src/test.rs index af69a7ecb..0bdcba082 100644 --- a/cmd/soroban-cli/src/utils/contract-template/src/test.rs +++ b/cmd/soroban-cli/src/utils/contract-template/src/test.rs @@ -6,7 +6,7 @@ use soroban_sdk::{vec, Env, String}; #[test] fn test() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let client = ContractClient::new(&env, &contract_id); let words = client.hello(&String::from_str(&env, "Dev")); diff --git a/cmd/soroban-cli/src/wasm.rs b/cmd/soroban-cli/src/wasm.rs index 5f0ed3b5c..30f7a3e4a 100644 --- a/cmd/soroban-cli/src/wasm.rs +++ b/cmd/soroban-cli/src/wasm.rs @@ -42,7 +42,7 @@ pub enum Error { #[error(transparent)] Rpc(#[from] soroban_rpc::Error), #[error("unexpected contract data {0:?}")] - UnexpectedContractToken(ContractDataEntry), + UnexpectedContractToken(Box), #[error( "cannot fetch wasm for contract because the contract is \ a network built-in asset contract that does not have a downloadable code binary" @@ -121,16 +121,10 @@ pub fn len(p: &Path) -> Result { } pub async fn fetch_from_contract( - contract_id: &str, + stellar_strkey::Contract(contract_id): &stellar_strkey::Contract, network: &Network, - locator: &locator::Args, ) -> Result, Error> { tracing::trace!(?network); - - let contract_id = &locator - .resolve_contract_id(contract_id, &network.network_passphrase)? - .0; - let client = network.rpc_client()?; client .verify_network_passphrase(Some(&network.network_passphrase)) @@ -142,5 +136,5 @@ pub async fn fetch_from_contract( ContractExecutable::StellarAsset => Err(ContractIsStellarAsset), }; } - Err(UnexpectedContractToken(data_entry)) + Err(UnexpectedContractToken(Box::new(data_entry))) } diff --git a/cmd/stellar-cli/Cargo.toml b/cmd/stellar-cli/Cargo.toml index 21e7e307b..e1f1dce6b 100644 --- a/cmd/stellar-cli/Cargo.toml +++ b/cmd/stellar-cli/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/stellar/stellar-cli" authors = ["Stellar Development Foundation "] license = "Apache-2.0" readme = "README.md" -version = "22.0.0-rc.1" +version.workspace = true edition = "2021" rust-version.workspace = true autobins = false diff --git a/deny.toml b/deny.toml index 7588e71f1..238e91a14 100644 --- a/deny.toml +++ b/deny.toml @@ -252,6 +252,63 @@ deny = [ # Certain crates/versions that will be skipped when doing duplicate detection. skip = [ + + # Requires updating slipped10 to newest sha2 others are dependents that will be updated + { crate = "sha2", reason = "temporary duplicate until upstream updates" }, + { crate = "digest", reason = "temporary duplicate until upstream updates" }, + { crate = "block-buffer", reason = "temporary duplicate until upstream updates" }, + # slipped again 0.12.1 + { crate = "hmac", reason = "temp" }, + + # update rpassword, hidapi (then ledger-transport-hid), and dirs-sys (then directories) to 0.52 + # { crate = "window-sys", reason = "temp" }, + + # syn is too large of a surface to check + { crate = "syn", reason = "Too many crates haven't updated to v2" }, + + # Need to release new version and update all stellar crates + { crate = "stellar-strkey", reason = "Temp until new release and updates upstream", version = "0.0.8" }, + + # Need to update jsonrpsee in stellar-rpc-client + { crate = "rustls-pemfile", reason = "Temp until new release and updates upstream" }, + { crate = "rustls-webpki", reason = "Temp until new release and updates upstream" }, + { crate = "rustls-native-certs", reason = "Temp until new release and updates upstream", version = "0.7.3" }, + { crate = "rustls", reason = "Temp until new release and updates upstream" }, + { crate = "hyper", reason = "temporary duplicate until upstream updates" }, + { crate = "hyper-rustls", reason = "temporary duplicate until upstream updates", version = "0.27.3" }, + { crate = "http-body", reason = "temporary duplicate until upstream updates" }, + { crate = "http", reason = "temporary duplicate until upstream updates" }, + { crate = "h2", reason = "temporary duplicate until upstream updates", version = "0.3.26" }, + { crate = "base64", reason = "temporary duplicate until upstream updates", version = "0.22.1" }, + # Upgrade stellar-rpc-client to use 0.26.0 + { crate = "tokio-rustls", reason = "temporary duplicate until upstream updates" }, + + # wasm-opt + { crate = "heck", reason = "wasm-opt needs to update to 0.5", version = "0.5.0"}, + { crate = "strum", reason = "wasm-opt needs to update", version = "0.26.3" }, + { crate = "strum_macros", reason = "wasm-opt needs to update", version = "0.26.4" }, + + + # soroban-env-host must upgrade ark-* to 0.14.5 + { crate = "hashbrown", reason = "temp", version = "13.2"}, + + { crate = "windows-sys", reason = "temp", version = "0.59.0"}, + { crate = "windows-targets", reason = "temp", version = "0.52.6"}, + { crate = "windows_x86_64_gnu", reason = "temp", version = "0.52.6"}, + { crate = "windows_x86_64_msvc", reason = "temp", version = "0.52.6"}, + # { crate = "dir-sys", reason = "temp", version } + # + # update tracing-subscriber + { crate = "regex-syntax", reason = "temp", version = "0.8.4" }, + { crate = "regex-automata", reason = "temp", version = "0.4.7" }, + + # wasm-gen update + { crate = "byteorder", reason = "temp", version = "1.5.0" }, + + # testcontainers + { crate = "idna", reason = "temp", version = "0.5.0" }, + + # { name = "hashbrown", version = "=0.13.2" }, # { name = "syn", version = "=1.0.109" }, ] diff --git a/installer.iss b/installer.iss new file mode 100644 index 000000000..895740ccb --- /dev/null +++ b/installer.iss @@ -0,0 +1,94 @@ +#define STELLAR_CLI_VERSION GetEnv("STELLAR_CLI_VERSION") +#define STELLAR_CLI_INSTALLER GetEnv("STELLAR_CLI_INSTALLER") + +[Setup] +AppName=Stellar CLI +AppVersion={#STELLAR_CLI_VERSION} +DefaultDirName={commonpf}\Stellar CLI +DefaultGroupName=Stellar CLI +OutputBaseFilename=stellar-installer +PrivilegesRequired=admin +LicenseFile=LICENSE +UninstallDisplayIcon={app}\stellar.ico +Compression=lzma +SolidCompression=yes +ChangesEnvironment=yes + +[Files] +Source: "stellar.exe"; DestDir: "{app}" +Source: "stellar.ico"; DestDir: "{app}" +Source: "LICENSE"; DestDir: "{app}"; Flags: ignoreversion + +[Icons] +; Windows optimizes start menu, and removes the uninstall entry. Unless we +; specify it twice. 🫠 +Name: "{group}\Uninstall Stellar CLI"; Filename: "{uninstallexe}" +Name: "{group}\Uninstall Stellar CLI"; Filename: "{uninstallexe}" +Name: "{group}\Stellar Developer Docs"; Filename: "https://stellar.org/docs" + +[Code] +const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'; + +procedure EnvAddPath(Path: string); +var + Paths: string; +begin + { Retrieve current path (use empty string if entry not exists) } + if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) + then Paths := ''; + + { Skip if string already found in path } + if Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';') > 0 then exit; + + { App string to the end of the path variable } + Paths := Paths + ';'+ Path +';' + + { Overwrite (or create if missing) path environment variable } + if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) + then Log(Format('The [%s] added to PATH: [%s]', [Path, Paths])) + else Log(Format('Error while adding the [%s] to PATH: [%s]', [Path, Paths])); +end; + +procedure EnvRemovePath(Path: string); +var + Paths: string; + P: Integer; +begin + { Skip if registry entry not exists } + if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then + exit; + + { Skip if string not found in path } + P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';'); + if P = 0 then exit; + + { Update path variable } + Delete(Paths, P - 1, Length(Path) + 1); + + { Overwrite path environment variable } + if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) + then Log(Format('The [%s] removed from PATH: [%s]', [Path, Paths])) + else Log(Format('Error while removing the [%s] from PATH: [%s]', [Path, Paths])); +end; + +procedure CurStepChanged(CurStep: TSetupStep); +begin + if CurStep = ssPostInstall + then EnvAddPath(ExpandConstant('{app}')); +end; + +procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); +begin + if CurUninstallStep = usPostUninstall + then EnvRemovePath(ExpandConstant('{app}')); +end; + +[UninstallDelete] +; Remove the Start Menu group +Type: filesandordirs; Name: "{group}" + +; Remove installed files and directory +Type: files; Name: "{app}\stellar.exe" +Type: files; Name: "{uninstallexe}" +Type: files; Name: "{app}\stellar.ico" +Type: dirifempty; Name: "{app}" diff --git a/stellar.ico b/stellar.ico new file mode 100644 index 000000000..4bbfa5f04 Binary files /dev/null and b/stellar.ico differ