diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index c008cc7b4..d913cf23d 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -132,12 +132,13 @@ jobs: $Env:Path += ";C:\Users\$Env:UserName\AppData\Local\Programs\Inno Setup 6" $Env:STELLAR_CLI_VERSION = "${{ env.VERSION }}" ISCC.exe installer.iss + mv Output/stellar-installer.exe ${{ env.STELLAR_CLI_INSTALLER }} - name: Upload Artifact uses: actions/upload-artifact@v4 with: name: ${{ env.STELLAR_CLI_INSTALLER }} - path: Output/stellar-installer.exe + path: ${{ env.STELLAR_CLI_INSTALLER }} - name: Build provenance for attestation (release only) if: github.event_name == 'release' diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 595e6e817..f3c9b1920 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -36,7 +36,7 @@ jobs: fail-fast: false matrix: check: [advisories, bans, licenses, sources] - continue-on-error: ${{ matrix.check == 'advisories' || matrix.check == 'bans' || matrix.check == 'licenses' }} + continue-on-error: ${{ matrix.check == 'advisories' }} steps: - uses: actions/checkout@v3 - uses: EmbarkStudios/cargo-deny-action@b01e7a8cfb1f496c52d77361e84c1840d8246393 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 21b38392b..7c54767c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,7 @@ changes quickly. ## Setting up development environment -There are 2 ways to being developing stellar-cli: +There are 2 ways to begin developing stellar-cli: ### Installing all required dependencies diff --git a/Cargo.lock b/Cargo.lock index 1bca3bf77..663f6d8e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1636,9 +1636,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1646,9 +1646,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" @@ -1663,9 +1663,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" @@ -1697,9 +1697,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -1708,21 +1708,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -2951,11 +2951,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.55" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -2983,9 +2983,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -4288,7 +4288,7 @@ dependencies = [ [[package]] name = "soroban-cli" -version = "22.0.0" +version = "22.0.1" dependencies = [ "assert_cmd", "assert_fs", @@ -4455,7 +4455,7 @@ dependencies = [ [[package]] name = "soroban-hello" -version = "0.0.0" +version = "22.0.1" [[package]] name = "soroban-ledger-snapshot" @@ -4526,7 +4526,7 @@ dependencies = [ [[package]] name = "soroban-spec-json" -version = "22.0.0" +version = "22.0.1" dependencies = [ "pretty_assertions", "serde", @@ -4556,7 +4556,7 @@ dependencies = [ [[package]] name = "soroban-spec-tools" -version = "22.0.0" +version = "22.0.1" dependencies = [ "base64 0.21.7", "ethnum", @@ -4574,7 +4574,7 @@ dependencies = [ [[package]] name = "soroban-spec-typescript" -version = "22.0.0" +version = "22.0.1" dependencies = [ "base64 0.21.7", "heck 0.4.1", @@ -4595,7 +4595,7 @@ dependencies = [ [[package]] name = "soroban-test" -version = "22.0.0" +version = "22.0.1" dependencies = [ "assert_cmd", "assert_fs", @@ -4669,18 +4669,18 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stellar-bye" -version = "0.0.0" +version = "22.0.1" [[package]] name = "stellar-cli" -version = "22.0.0" +version = "22.0.1" dependencies = [ "soroban-cli", ] [[package]] name = "stellar-ledger" -version = "22.0.0" +version = "22.0.1" dependencies = [ "async-trait", "bollard", @@ -5023,42 +5023,42 @@ dependencies = [ [[package]] name = "test_constructor" -version = "0.0.0" +version = "22.0.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_custom_account" -version = "0.0.0" +version = "22.0.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_custom_types" -version = "0.0.0" +version = "22.0.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_hello_world" -version = "0.0.0" +version = "22.0.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_swap" -version = "0.0.0" +version = "22.0.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_token" -version = "0.0.0" +version = "22.0.1" dependencies = [ "soroban-sdk", "soroban-token-sdk", @@ -5066,7 +5066,7 @@ dependencies = [ [[package]] name = "test_udt" -version = "22.0.0" +version = "22.0.1" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 12222e851..54730b138 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,24 +19,24 @@ exclude = [ ] [workspace.package] -version = "22.0.0" +version = "22.0.1" rust-version = "1.81.0" # Dependencies located in this repo: [workspace.dependencies.soroban-cli] -version = "=22.0.0" +version = "=22.0.1" path = "cmd/soroban-cli" [workspace.dependencies.soroban-spec-json] -version = "=22.0.0" +version = "=22.0.1" path = "./cmd/crates/soroban-spec-json" [workspace.dependencies.soroban-spec-typescript] -version = "22.0.0" +version = "22.0.1" path = "./cmd/crates/soroban-spec-typescript" [workspace.dependencies.soroban-spec-tools] -version = "22.0.0" +version = "22.0.1" path = "./cmd/crates/soroban-spec-tools" # Dependencies from the rs-stellar-xdr repo: @@ -66,7 +66,7 @@ package = "stellar-rpc-client" version = "=22.0.0-rc.1" [workspace.dependencies.stellar-ledger] -version = "=22.0.0" +version = "=22.0.1" path = "cmd/crates/stellar-ledger" # Dependencies from elsewhere shared by crates: diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md index bde44a963..b8a00217c 100644 --- a/FULL_HELP_DOCS.md +++ b/FULL_HELP_DOCS.md @@ -258,6 +258,7 @@ Generate code client bindings for a contract * `json` — Generate Json Bindings * `rust` — Generate Rust bindings * `typescript` — Generate a TypeScript / JavaScript package +* `python` — Generate Python bindings @@ -306,6 +307,14 @@ Generate a TypeScript / JavaScript package +## `stellar contract bindings python` + +Generate Python bindings + +**Usage:** `stellar contract bindings python` + + + ## `stellar contract build` Build a contract from source @@ -1625,7 +1634,7 @@ Creates, updates, or deletes a trustline Learn more about trustlines https://dev * `--line ` * `--limit ` — Limit for the trust line, 0 to remove the trust line - Default value: `18446744073709551615` + Default value: `9223372036854775807` @@ -1655,7 +1664,7 @@ Creates and funds a new account with the specified starting balance * `--destination ` — Account Id to create, e.g. `GBX...` * `--starting-balance ` — Initial balance in stroops of the account, default 1 XLM - Default value: `10000000` + Default value: `10_000_000` @@ -1682,7 +1691,7 @@ Sets, modifies, or deletes a data entry (name/value pair) that is attached to an * `--hd-path ` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0` * `--global` — Use global config * `--config-dir ` — Location of config directory, default is "." -* `--data-name ` — Line to change, either 4 or 12 alphanumeric characters, or "native" if not specified +* `--data-name ` — String up to 64 bytes long. If this is a new Name it will add the given name/value pair to the account. If this Name is already present then the associated value will be modified * `--data-value ` — Up to 64 bytes long hex string If not present then the existing Name will be deleted. If present then this value will be set in the `DataEntry` @@ -1714,7 +1723,7 @@ Sends an amount in a specific asset to a destination account * `--asset ` — Asset to send, default native, e.i. XLM Default value: `native` -* `--amount ` — Amount of the aforementioned asset to send +* `--amount ` — Amount of the aforementioned asset to send. e.g. `10_000_000` (1 XLM) diff --git a/README.md b/README.md index f8ba1f052..e60d71813 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Stellar CLI (stellar-cli) -![Apache 2.0 licensed](https://img.shields.io/badge/license-apache%202.0-blue.svg) +[![Apache 2.0 licensed](https://img.shields.io/badge/license-apache%202.0-blue.svg)](LICENSE) [![Crates.io Version](https://img.shields.io/crates/v/stellar-cli?label=version&color=04ac5b)](https://crates.io/crates/stellar-cli) This repo is home to the Stellar CLI, the command-line multi-tool for running and deploying Stellar contracts on the Stellar network. diff --git a/cmd/crates/soroban-test/tests/fixtures/bye/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/bye/Cargo.toml index deccb9c75..4756225d2 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 = "0.0.0" +version = "22.0.1" 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 fe7eb636a..a2fb7b15c 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 = "0.0.0" +version = "22.0.1" 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 69d8a6430..9ccbb23d0 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,6 +1,6 @@ [package] name = "test_constructor" -version = "0.0.0" +version = "22.0.1" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" 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 765f671c6..e69dd96c9 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,6 +1,6 @@ [package] name = "test_custom_account" -version = "0.0.0" +version = "22.0.1" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" 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 b5a17c6a5..50b6d8a72 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test_custom_types" -version = "0.0.0" +version = "22.0.1" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml index a13c98a39..a91a6ca62 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test_hello_world" -version = "0.0.0" +version = "22.0.1" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" 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 495a52d71..15c45c98e 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,6 +1,6 @@ [package] name = "test_swap" -version = "0.0.0" +version = "22.0.1" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" 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 6456983e8..d4e7e7436 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,6 +1,6 @@ [package] name = "test_token" -version = "0.0.0" +version = "22.0.1" description = "Soroban standard token contract" authors = ["Stellar Development Foundation "] license = "Apache-2.0" diff --git a/cmd/crates/soroban-test/tests/fixtures/workspace/Cargo.lock b/cmd/crates/soroban-test/tests/fixtures/workspace/Cargo.lock index cc4bfbb58..ec70d9ccb 100644 --- a/cmd/crates/soroban-test/tests/fixtures/workspace/Cargo.lock +++ b/cmd/crates/soroban-test/tests/fixtures/workspace/Cargo.lock @@ -355,7 +355,6 @@ dependencies = [ "elliptic-curve", "rfc6979", "signature", - "spki", ] [[package]] @@ -370,15 +369,16 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", "rand_core", "serde", "sha2", + "subtle", "zeroize", ] @@ -400,7 +400,6 @@ dependencies = [ "ff", "generic-array", "group", - "pkcs8", "rand_core", "sec1", "subtle", @@ -614,9 +613,7 @@ dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", - "once_cell", "sha2", - "signature", ] [[package]] @@ -717,6 +714,18 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + [[package]] name = "paste" version = "1.0.14" @@ -761,6 +770,15 @@ dependencies = [ "syn", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro2" version = "1.0.69" @@ -849,7 +867,6 @@ dependencies = [ "base16ct", "der", "generic-array", - "pkcs8", "subtle", "zeroize", ] @@ -959,9 +976,9 @@ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "soroban-builtin-sdk-macros" -version = "20.3.0" +version = "21.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc32c6e817f3ca269764ec0d7d14da6210b74a5bf14d4e745aa3ee860558900" +checksum = "2f57a68ef8777e28e274de0f3a88ad9a5a41d9a2eb461b4dd800b086f0e83b80" dependencies = [ "itertools", "proc-macro2", @@ -971,9 +988,9 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "20.3.0" +version = "21.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c14e18d879c520ff82612eaae0590acaf6a7f3b977407e1abb1c9e31f94c7814" +checksum = "2fd1c89463835fe6da996318156d39f424b4f167c725ec692e5a7a2d4e694b3d" dependencies = [ "arbitrary", "crate-git-revision", @@ -985,13 +1002,14 @@ dependencies = [ "soroban-wasmi", "static_assertions", "stellar-xdr", + "wasmparser", ] [[package]] name = "soroban-env-guest" -version = "20.3.0" +version = "21.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5122ca2abd5ebcc1e876a96b9b44f87ce0a0e06df8f7c09772ddb58b159b7454" +checksum = "6bfb2536811045d5cd0c656a324cbe9ce4467eb734c7946b74410d90dea5d0ce" dependencies = [ "soroban-env-common", "static_assertions", @@ -999,13 +1017,16 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "20.3.0" +version = "21.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "114a0fa0d0cc39d0be16b1ee35b6e5f4ee0592ddcf459bde69391c02b03cf520" +checksum = "2b7a32c28f281c423189f1298960194f0e0fc4eeb72378028171e556d8cd6160" dependencies = [ "backtrace", "curve25519-dalek", + "ecdsa", "ed25519-dalek", + "elliptic-curve", + "generic-array", "getrandom", "hex-literal", "hmac", @@ -1013,8 +1034,10 @@ dependencies = [ "num-derive", "num-integer", "num-traits", + "p256", "rand", "rand_chacha", + "sec1", "sha2", "sha3", "soroban-builtin-sdk-macros", @@ -1022,13 +1045,14 @@ dependencies = [ "soroban-wasmi", "static_assertions", "stellar-strkey", + "wasmparser", ] [[package]] name = "soroban-env-macros" -version = "20.3.0" +version = "21.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13e3f8c86f812e0669e78fcb3eae40c385c6a9dd1a4886a1de733230b4fcf27" +checksum = "242926fe5e0d922f12d3796cd7cd02dd824e5ef1caa088f45fce20b618309f64" dependencies = [ "itertools", "proc-macro2", @@ -1041,9 +1065,9 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "20.5.0" +version = "21.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a54708f44890e0546180db6b4f530e2a88d83b05a9b38a131caa21d005e25a" +checksum = "43793d5deb5fc27c3e14e036e24cb3afcf7d1e2a172d9166e37f3d174b928749" dependencies = [ "serde", "serde_json", @@ -1055,9 +1079,9 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "20.5.0" +version = "21.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84fc8be9068dd4e0212d8b13ad61089ea87e69ac212c262914503a961c8dc3a3" +checksum = "69e39bf9e8ab05579c836e8e5be5f2f4c5ba75e7337ece20e975e82fc3a9d41e" dependencies = [ "arbitrary", "bytes-lit", @@ -1075,9 +1099,9 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "20.5.0" +version = "21.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db20def4ead836663633f58d817d0ed8e1af052c9650a04adf730525af85b964" +checksum = "a9ad528a770ec7adb524635d855b424ae2fd4fef04fb702bb0ab466a4c354d78" dependencies = [ "crate-git-revision", "darling", @@ -1095,9 +1119,9 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "20.5.0" +version = "21.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eefeb5d373b43f6828145d00f0c5cc35e96db56a6671ae9614f84beb2711cab" +checksum = "5b262c82d840552f71ee9254f2e928622fd803bd4df4815e65f73f73efc2fa9c" dependencies = [ "base64 0.13.1", "stellar-xdr", @@ -1107,9 +1131,9 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "20.5.0" +version = "21.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3152bca4737ef734ac37fe47b225ee58765c9095970c481a18516a2b287c7a33" +checksum = "85a061820c2dd0bd3ece9411e0dd3aeb6ed9ca2b7d64270eda9e798c3b6dec5f" dependencies = [ "prettyplease", "proc-macro2", @@ -1169,9 +1193,9 @@ dependencies = [ [[package]] name = "stellar-xdr" -version = "20.1.0" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e59cdf3eb4467fb5a4b00b52e7de6dca72f67fac6f9b700f55c95a5d86f09c9d" +checksum = "2675a71212ed39a806e415b0dbf4702879ff288ec7f5ee996dda42a135512b50" dependencies = [ "arbitrary", "base64 0.13.1", @@ -1353,11 +1377,12 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.88.0" +version = "0.116.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb8cf7dd82407fe68161bedcd57fde15596f32ebf6e9b3bdbf3ae1da20e38e5e" +checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" dependencies = [ - "indexmap 1.9.3", + "indexmap 2.1.0", + "semver", ] [[package]] diff --git a/cmd/crates/soroban-test/tests/it/build.rs b/cmd/crates/soroban-test/tests/it/build.rs index 925d88df1..cb63ae907 100644 --- a/cmd/crates/soroban-test/tests/it/build.rs +++ b/cmd/crates/soroban-test/tests/it/build.rs @@ -1,5 +1,8 @@ use predicates::prelude::predicate; +use soroban_cli::xdr::{Limited, Limits, ReadXdr, ScMetaEntry, ScMetaV0}; +use soroban_spec_tools::contract::Spec; use soroban_test::TestEnv; +use std::io::Cursor; #[test] fn build_all() { @@ -135,18 +138,50 @@ fn build_with_metadata() { .assert() .success(); - // verify that the metadata added in the contract code via contractmetadata! macro is present - // as well as the meta that is included on build - let wasm_path = fixture_path.join(&outdir).join("add.wasm"); sandbox .new_assert_cmd("contract") .current_dir(&fixture_path) - .arg("info") - .arg("meta") - .arg("--wasm") - .arg(wasm_path) + .arg("build") + .arg("--meta") + .arg("meta_replaced=some_new_meta") + .arg("--out-dir") + .arg(&outdir) .assert() - .success() - .stdout(predicate::str::contains("Description: A test add contract")) - .stdout(predicate::str::contains("contract meta: added on build")); + .success(); + + // verify that the metadata added in the contract code via contractmetadata! macro is present + // as well as the meta that is included on build + let wasm_path = fixture_path.join(&outdir).join("add.wasm"); + let wasm = std::fs::read(wasm_path).unwrap(); + let spec = Spec::new(&wasm).unwrap(); + let meta = spec.meta_base64.unwrap(); + let entries = ScMetaEntry::read_xdr_base64_iter(&mut Limited::new( + Cursor::new(meta.as_bytes()), + Limits::none(), + )) + .filter(|entry| match entry { + // Ignore the meta entries that the SDK embeds that capture the SDK and + // Rust version, since these will change often and are not really + // relevant to this test. + Ok(ScMetaEntry::ScMetaV0(ScMetaV0 { key, .. })) => { + let key = key.to_string(); + !matches!(key.as_str(), "rsver" | "rssdkver") + } + _ => true, + }) + .collect::, _>>() + .unwrap(); + + let expected_entries = vec![ + ScMetaEntry::ScMetaV0(ScMetaV0 { + key: "Description".try_into().unwrap(), + val: "A test add contract".try_into().unwrap(), + }), + ScMetaEntry::ScMetaV0(ScMetaV0 { + key: "meta_replaced".try_into().unwrap(), + val: "some_new_meta".try_into().unwrap(), + }), + ]; + + assert_eq!(entries, expected_entries); } diff --git a/cmd/crates/soroban-test/tests/it/integration/tx/operations.rs b/cmd/crates/soroban-test/tests/it/integration/tx/operations.rs index 0a0a103e8..9988b2cdd 100644 --- a/cmd/crates/soroban-test/tests/it/integration/tx/operations.rs +++ b/cmd/crates/soroban-test/tests/it/integration/tx/operations.rs @@ -93,7 +93,7 @@ async fn payment() { "--destination", test1.as_str(), "--amount", - ONE_XLM.to_string().as_str(), + "10_000_000", ]) .assert() .success(); diff --git a/cmd/soroban-cli/src/commands/contract/bindings.rs b/cmd/soroban-cli/src/commands/contract/bindings.rs index 1da946979..a91c966aa 100644 --- a/cmd/soroban-cli/src/commands/contract/bindings.rs +++ b/cmd/soroban-cli/src/commands/contract/bindings.rs @@ -1,4 +1,5 @@ pub mod json; +pub mod python; pub mod rust; pub mod typescript; @@ -12,6 +13,9 @@ pub enum Cmd { /// Generate a TypeScript / JavaScript package Typescript(typescript::Cmd), + + /// Generate Python bindings + Python(python::Cmd), } #[derive(thiserror::Error, Debug)] @@ -24,6 +28,9 @@ pub enum Error { #[error(transparent)] Typescript(#[from] typescript::Error), + + #[error(transparent)] + Python(#[from] python::Error), } impl Cmd { @@ -32,6 +39,7 @@ impl Cmd { Cmd::Json(json) => json.run()?, Cmd::Rust(rust) => rust.run()?, Cmd::Typescript(ts) => ts.run().await?, + Cmd::Python(python) => python.run()?, } Ok(()) } diff --git a/cmd/soroban-cli/src/commands/contract/bindings/python.rs b/cmd/soroban-cli/src/commands/contract/bindings/python.rs new file mode 100644 index 000000000..60a3e8dcb --- /dev/null +++ b/cmd/soroban-cli/src/commands/contract/bindings/python.rs @@ -0,0 +1,19 @@ +use std::fmt::Debug; + +use clap::Parser; + +#[derive(Parser, Debug, Clone)] +#[group(skip)] +pub struct Cmd {} + +#[derive(thiserror::Error, Debug)] +pub enum Error { + #[error("python binding generation is not implemented in the stellar-cli, but is available via the tool located here: https://github.com/lightsail-network/stellar-contract-bindings")] + NotImplemented, +} + +impl Cmd { + pub fn run(&self) -> Result<(), Error> { + Err(Error::NotImplemented) + } +} diff --git a/cmd/soroban-cli/src/commands/tx/new/change_trust.rs b/cmd/soroban-cli/src/commands/tx/new/change_trust.rs index 1ea4e737e..da9acc8cf 100644 --- a/cmd/soroban-cli/src/commands/tx/new/change_trust.rs +++ b/cmd/soroban-cli/src/commands/tx/new/change_trust.rs @@ -10,7 +10,7 @@ pub struct Cmd { #[arg(long)] pub line: builder::Asset, /// Limit for the trust line, 0 to remove the trust line - #[arg(long, default_value = u64::MAX.to_string())] + #[arg(long, default_value = i64::MAX.to_string())] pub limit: i64, } diff --git a/cmd/soroban-cli/src/commands/tx/new/create_account.rs b/cmd/soroban-cli/src/commands/tx/new/create_account.rs index 9cc3a62ff..2826439e9 100644 --- a/cmd/soroban-cli/src/commands/tx/new/create_account.rs +++ b/cmd/soroban-cli/src/commands/tx/new/create_account.rs @@ -1,6 +1,6 @@ use clap::{command, Parser}; -use crate::{commands::tx, xdr}; +use crate::{commands::tx, tx::builder, xdr}; #[derive(Parser, Debug, Clone)] #[group(skip)] @@ -11,15 +11,15 @@ pub struct Cmd { #[arg(long)] pub destination: xdr::AccountId, /// Initial balance in stroops of the account, default 1 XLM - #[arg(long, default_value = "10000000")] - pub starting_balance: i64, + #[arg(long, default_value = "10_000_000")] + pub starting_balance: builder::Amount, } impl From<&Cmd> for xdr::OperationBody { fn from(cmd: &Cmd) -> Self { xdr::OperationBody::CreateAccount(xdr::CreateAccountOp { destination: cmd.destination.clone(), - starting_balance: cmd.starting_balance, + starting_balance: cmd.starting_balance.into(), }) } } diff --git a/cmd/soroban-cli/src/commands/tx/new/manage_data.rs b/cmd/soroban-cli/src/commands/tx/new/manage_data.rs index e0a029f02..4f4ab480d 100644 --- a/cmd/soroban-cli/src/commands/tx/new/manage_data.rs +++ b/cmd/soroban-cli/src/commands/tx/new/manage_data.rs @@ -7,7 +7,9 @@ use crate::{commands::tx, xdr}; pub struct Cmd { #[command(flatten)] pub tx: tx::Args, - /// Line to change, either 4 or 12 alphanumeric characters, or "native" if not specified + /// String up to 64 bytes long. + /// If this is a new Name it will add the given name/value pair to the account. + /// If this Name is already present then the associated value will be modified. #[arg(long)] pub data_name: xdr::StringM<64>, /// Up to 64 bytes long hex string diff --git a/cmd/soroban-cli/src/commands/tx/new/payment.rs b/cmd/soroban-cli/src/commands/tx/new/payment.rs index c626d9ca8..3cebfa532 100644 --- a/cmd/soroban-cli/src/commands/tx/new/payment.rs +++ b/cmd/soroban-cli/src/commands/tx/new/payment.rs @@ -13,9 +13,9 @@ pub struct Cmd { /// Asset to send, default native, e.i. XLM #[arg(long, default_value = "native")] pub asset: builder::Asset, - /// Amount of the aforementioned asset to send. + /// Amount of the aforementioned asset to send. e.g. `10_000_000` (1 XLM) #[arg(long)] - pub amount: i64, + pub amount: builder::Amount, } impl From<&Cmd> for xdr::OperationBody { @@ -23,7 +23,7 @@ impl From<&Cmd> for xdr::OperationBody { xdr::OperationBody::Payment(xdr::PaymentOp { destination: cmd.destination.clone(), asset: cmd.asset.clone().into(), - amount: cmd.amount, + amount: cmd.amount.into(), }) } } diff --git a/cmd/soroban-cli/src/commands/tx/send.rs b/cmd/soroban-cli/src/commands/tx/send.rs index 22fbc860a..1e542eb6f 100644 --- a/cmd/soroban-cli/src/commands/tx/send.rs +++ b/cmd/soroban-cli/src/commands/tx/send.rs @@ -1,3 +1,4 @@ +use crate::{print::Print, utils::transaction_hash}; use async_trait::async_trait; use soroban_rpc::GetTransactionResponse; @@ -46,7 +47,7 @@ impl NetworkRunnable for Cmd { type Result = GetTransactionResponse; async fn run_against_rpc_server( &self, - _: Option<&global::Args>, + globals: Option<&global::Args>, config: Option<&config::Args>, ) -> Result { let network = if let Some(config) = config { @@ -56,6 +57,14 @@ impl NetworkRunnable for Cmd { }; let client = network.rpc_client()?; let tx_env = super::xdr::tx_envelope_from_stdin()?; + + if let Ok(Ok(hash)) = super::xdr::unwrap_envelope_v1(tx_env.clone()) + .map(|tx| transaction_hash(&tx, &network.network_passphrase)) + { + let print = Print::new(globals.map_or(false, |g| g.quiet)); + print.infoln(format!("Transaction Hash: {}", hex::encode(hash))); + } + Ok(client.send_transaction_polling(&tx_env).await?) } } diff --git a/cmd/soroban-cli/src/tx/builder.rs b/cmd/soroban-cli/src/tx/builder.rs index ad22737ea..c84bb7124 100644 --- a/cmd/soroban-cli/src/tx/builder.rs +++ b/cmd/soroban-cli/src/tx/builder.rs @@ -1,6 +1,8 @@ +pub mod amount; pub mod asset; pub mod transaction; +pub use amount::Amount; pub use asset::Asset; pub use transaction::TxExt; diff --git a/cmd/soroban-cli/src/tx/builder/amount.rs b/cmd/soroban-cli/src/tx/builder/amount.rs new file mode 100644 index 000000000..d3c204f50 --- /dev/null +++ b/cmd/soroban-cli/src/tx/builder/amount.rs @@ -0,0 +1,35 @@ +use std::str::FromStr; + +#[derive(Clone, Debug, Copy)] +pub struct Amount(i64); + +#[derive(thiserror::Error, Debug)] +pub enum Error { + #[error("cannot start or end with `_`: {0}")] + CannotStartOrEndWithUnderscore(String), + #[error(transparent)] + IntParse(#[from] std::num::ParseIntError), +} + +impl FromStr for Amount { + type Err = Error; + + fn from_str(value: &str) -> Result { + if value.starts_with('_') || value.ends_with('_') { + return Err(Error::CannotStartOrEndWithUnderscore(value.to_string())); + } + Ok(Self(value.replace('_', "").parse::()?)) + } +} + +impl From for i64 { + fn from(builder: Amount) -> Self { + builder.0 + } +} + +impl From<&Amount> for i64 { + fn from(builder: &Amount) -> Self { + (*builder).into() + } +} diff --git a/deny.toml b/deny.toml index 238e91a14..9817c3e79 100644 --- a/deny.toml +++ b/deny.toml @@ -75,7 +75,7 @@ notice = "warn" # A list of advisory IDs to ignore. Note that ignored advisories will still # output a note when they are encountered. ignore = [ - #"RUSTSEC-0000-0000", + "RUSTSEC-2024-0388", # derivative is no longer maintained, but that has no known material impact on the this repo ] # Threshold for security vulnerabilities, any vulnerability with a CVSS score # lower than the range specified will be ignored. Note that ignored advisories @@ -308,9 +308,7 @@ skip = [ # testcontainers { crate = "idna", reason = "temp", version = "0.5.0" }, - - # { name = "hashbrown", version = "=0.13.2" }, - # { name = "syn", version = "=1.0.109" }, + { crate = "bitflags", reason = "too many", version = "=1.3.2" }, ] # Similarly to `skip` allows you to skip certain crates during duplicate # detection. Unlike skip, it also includes the entire tree of transitive diff --git a/flake.nix b/flake.nix index 0a30ea556..8e5ace887 100644 --- a/flake.nix +++ b/flake.nix @@ -36,8 +36,8 @@ }; cargoLock.outputHashes = { - # The only git+https dependency in Cargo.lock - "stellar-rpc-client-21.4.0" = "sha256-ue7Ynux9YaDP3f/XkHz2OPd2g0iCX5R0yS5SaVHEYxQ"; + # This is needed for any git+https dependency in Cargo.lock + # "somepackage-1.2.3" = "sha256-somehash"; }; doCheck = false;