Skip to content

Commit

Permalink
Merge branch 'main' into remap-path
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch authored Sep 24, 2024
2 parents 8fa2e26 + ac5cc57 commit c421563
Show file tree
Hide file tree
Showing 31 changed files with 1,084 additions and 316 deletions.
747 changes: 632 additions & 115 deletions Cargo.lock

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,44 @@ default-members = ["cmd/soroban-cli", "cmd/crates/soroban-spec-tools", "cmd/crat
exclude = ["cmd/crates/soroban-test/tests/fixtures/hello"]

[workspace.package]
version = "21.4.1"
version = "21.5.0"
rust-version = "1.79.0"

[workspace.dependencies.soroban-env-host]
version = "=21.2.0"
version = "=21.2.1"

[workspace.dependencies.soroban-simulation]
version = "21.2.0"
version = "=21.2.1"

[workspace.dependencies.soroban-spec]
version = "=21.5.0"
version = "=21.7.2"

[workspace.dependencies.soroban-spec-rust]
version = "=21.5.0"
version = "=21.7.2"

[workspace.dependencies.soroban-spec-json]
version = "=21.4.1"
version = "=21.5.0"
path = "./cmd/crates/soroban-spec-json"

[workspace.dependencies.soroban-spec-typescript]
version = "21.4.1"
version = "21.5.0"
path = "./cmd/crates/soroban-spec-typescript"

[workspace.dependencies.soroban-spec-tools]
version = "21.4.1"
version = "21.5.0"
path = "./cmd/crates/soroban-spec-tools"

[workspace.dependencies.soroban-sdk]
version = "=21.2.0"
version = "=21.7.2"

[workspace.dependencies.soroban-token-sdk]
version = "=21.2.0"
version = "=21.7.2"

[workspace.dependencies.soroban-ledger-snapshot]
version = "=21.2.0"
version = "=21.7.2"

[workspace.dependencies.soroban-cli]
version = "=21.4.1"
version = "=21.5.0"
path = "cmd/soroban-cli"

[workspace.dependencies.soroban-rpc]
Expand All @@ -60,7 +60,7 @@ version = "21.2.0"
default-features = true

[workspace.dependencies]
stellar-strkey = "0.0.8"
stellar-strkey = "0.0.11"
sep5 = "0.0.4"
base64 = "0.21.2"
thiserror = "1.0.46"
Expand Down
36 changes: 36 additions & 0 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,8 @@ Sign, Simulate, and Send transactions

* `simulate` — Simulate a transaction envelope from stdin
* `hash` — Calculate the hash of a transaction envelope from stdin
* `sign` — Sign a transaction envelope appending the signature to the envelope
* `send` — Send a transaction envelope to the network



Expand Down Expand Up @@ -1326,6 +1328,40 @@ Calculate the hash of a transaction envelope from stdin



## `stellar tx sign`

Sign a transaction envelope appending the signature to the envelope

**Usage:** `stellar tx sign [OPTIONS]`

###### **Options:**

* `--sign-with-key <SIGN_WITH_KEY>` — Sign with a local key. Can be an identity (--sign-with-key alice), a secret key (--sign-with-key SC36…), or a seed phrase (--sign-with-key "kite urban…"). If using seed phrase, `--hd-path` defaults to the `0` path
* `--hd-path <HD_PATH>` — If using a seed phrase to sign, sets which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0`
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."



## `stellar tx send`

Send a transaction envelope to the network

**Usage:** `stellar tx send [OPTIONS]`

###### **Options:**

* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."



## `stellar xdr`

Decode and encode XDR
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ endif
REPOSITORY_BRANCH := "$(shell git rev-parse --abbrev-ref HEAD)"
BUILD_TIMESTAMP ?= $(shell date '+%Y-%m-%dT%H:%M:%S')

SOROBAN_PORT?=8000

# The following works around incompatibility between the rust and the go linkers -
# the rust would generate an object file with min-version of 13.0 where-as the go
# compiler would generate a binary compatible with 12.3 and up. To align these
Expand Down Expand Up @@ -53,7 +55,7 @@ test: build-test
cargo test

e2e-test:
cargo test --test it -- --ignored
cargo test --features it --test it -- integration

check:
cargo clippy --all-targets
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Stellar CLI (stellar-cli)

![Apache 2.0 licensed](https://img.shields.io/badge/license-apache%202.0-blue.svg)
[![Crates.io Version](https://img.shields.io/crates/v/stellar-cli?label=version&amp;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.


## Table of Contents

- [Documentation](#documentation)
- [Cookbook](#cookbook)
- [Installation](#installation)
- [Installation with Experimental Features](#installation-with-experimental-features)
- [Autocomplete](#autocomplete)
Expand All @@ -22,6 +24,9 @@ This repo is home to the Stellar CLI, the command-line multi-tool for running an

For installation options see below, for usage instructions [see the full help docs](FULL_HELP_DOCS.md).

## Cookbook
To understand how to get the most of the Stellar CLI, see the [Stellar CLI Cookbook](https://github.com/stellar/stellar-cli/tree/main/cookbook) for recipes and a collection of resources to teach you how to use the CLI. Examples of recipes included in the CLI cookbook include: send payments, manage contract lifecycle, extend contract instance/storage/wasm, and more.

## Installation
Install the latest version from source:
```
Expand Down Expand Up @@ -75,4 +80,5 @@ Find issues to contribute to [here](https://github.com/stellar/stellar-cli/contr

## Additional Developer Resources
- Developer Docs CLI Examples: https://developers.stellar.org/docs/smart-contracts/guides/cli
- Video Tutorial: https://developers.stellar.org/meetings/2024/06/27
- Video Tutorial on `network container`, `keys`, and `contract init`: https://developers.stellar.org/meetings/2024/06/27
- Video Tutorial on `alias` and `snapshot`: https://developers.stellar.org/meetings/2024/09/12
2 changes: 1 addition & 1 deletion cmd/crates/soroban-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repository = "https://github.com/stellar/soroban-test"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
readme = "README.md"
version = "21.4.1"
version = "21.5.0"
edition = "2021"
rust-version.workspace = true
autobins = false
Expand Down
2 changes: 1 addition & 1 deletion cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "soroban-hello"
version = "21.4.1"
version = "21.5.0"
edition = "2021"
publish = false

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "test_custom_account"
version = "21.4.1"
version = "21.5.0"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "test_custom_types"
version = "21.4.1"
version = "21.5.0"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "test_hello_world"
version = "21.4.1"
version = "21.5.0"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion cmd/crates/soroban-test/tests/it/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn build_no_package_found() {
.failure()
.stderr(predicate::eq(
"\
error: package nopkgwiththisname not found
error: package nopkgwiththisname not found
",
));
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/crates/soroban-test/tests/it/integration/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,12 @@ fn invoke_log(sandbox: &TestEnv, id: &str) {
.assert()
.success()
.stderr(predicates::str::contains(
"INFO contract_event: soroban_cli::log::event: 1: DiagnosticEvent {",
"INFO contract_event: soroban_cli::log::event: 1:",
))
.stderr(predicates::str::contains("StringM(hello)"))
.stderr(predicates::str::contains("hello"))
.stderr(predicates::str::contains(
"INFO log_event: soroban_cli::log::event: 2: DiagnosticEvent",
"INFO log_event: soroban_cli::log::event: 2:",
))
.stderr(predicates::str::contains("StringM(hello {})"))
.stderr(predicates::str::contains("StringM(world)"));
.stderr(predicates::str::contains("hello {}"))
.stderr(predicates::str::contains("world"));
}
38 changes: 36 additions & 2 deletions cmd/crates/soroban-test/tests/it/integration/tx.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use soroban_rpc::GetTransactionResponse;
use soroban_sdk::xdr::{Limits, ReadXdr, TransactionEnvelope, WriteXdr};
use soroban_test::{AssertExt, TestEnv};

use crate::integration::util::{deploy_contract, DeployKind, HELLO_WORLD};
use crate::integration::util::{deploy_contract, deploy_hello, DeployKind, HELLO_WORLD};

#[tokio::test]
async fn txn_simulate() {
async fn simulate() {
let sandbox = &TestEnv::new();
let xdr_base64_build_only = deploy_contract(sandbox, HELLO_WORLD, DeployKind::BuildOnly).await;
let xdr_base64_sim_only = deploy_contract(sandbox, HELLO_WORLD, DeployKind::SimOnly).await;
Expand Down Expand Up @@ -49,3 +50,36 @@ async fn txn_hash() {

assert_eq!(hash.trim(), expected_hash);
}

#[tokio::test]
async fn build_simulate_sign_send() {
let sandbox = &TestEnv::new();
sandbox
.new_assert_cmd("contract")
.arg("install")
.args(["--wasm", HELLO_WORLD.path().as_os_str().to_str().unwrap()])
.assert()
.success();

let tx_simulated = deploy_contract(sandbox, HELLO_WORLD, DeployKind::SimOnly).await;
dbg!("{tx_simulated}");

let tx_signed = sandbox
.new_assert_cmd("tx")
.arg("sign")
.arg("--sign-with-key=test")
.write_stdin(tx_simulated.as_bytes())
.assert()
.success()
.stdout_as_str();
dbg!("{tx_signed}");

let output = sandbox
.new_assert_cmd("tx")
.arg("send")
.write_stdin(tx_signed.as_bytes())
.assert()
.success()
.stdout_as_str();
assert_eq!(output, "SUCCESS");
}
4 changes: 2 additions & 2 deletions cmd/crates/stellar-ledger/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "stellar-ledger"
description = ""
description = "Handle Stellar signing with Ledger device"
homepage = "https://github.com/stellar/soroban-tools"
repository = "https://github.com/stellar/soroban-tools"
authors = ["Stellar Development Foundation <[email protected]>"]
Expand Down Expand Up @@ -49,7 +49,7 @@ pretty_assertions = "1.2.1"
serial_test = "3.0.0"
httpmock = "0.7.0-rc.1"
test-case = "*"
testcontainers = { git = "https://github.com/testcontainers/testcontainers-rs.git", rev = "4b3e4f08a2c0bdf521636b03f959f004e6d216aa" }
testcontainers = "0.20.1"


[features]
Expand Down
Loading

0 comments on commit c421563

Please sign in to comment.