Skip to content

Commit

Permalink
Feat(CLI): add key::Args and FullLedgerEntry/FullLedgerEntries (#…
Browse files Browse the repository at this point in the history
…981)

* fix: Upgrade jsonprsee

fixes #976

* feat: add expiration_ledger_only for bump and add test for contract bump

* feat: add key::Args and FullLedgerEntry

* fix: add max bump and return current expiration if bump is too small

* fix: parseInt

* fix: update tests with new read output and add durability arg
  • Loading branch information
willemneal authored Sep 22, 2023
1 parent 7cc2f46 commit 3e201ad
Show file tree
Hide file tree
Showing 14 changed files with 522 additions and 428 deletions.
97 changes: 70 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion cmd/crates/soroban-spec-tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ pub fn to_string(v: &ScVal) -> Result<String, Error> {
ScVal::Symbol(v) => std::str::from_utf8(v.as_slice())
.map_err(|_| Error::InvalidValue(Some(ScType::Symbol)))?
.to_string(),
ScVal::LedgerKeyContractInstance => "LedgerKeyContractInstance".to_string(),
_ => serde_json::to_string(&to_json(v)?)?,
})
}
Expand All @@ -918,7 +919,7 @@ pub fn to_json(v: &ScVal) -> Result<Value, Error> {
let val: Value = match v {
ScVal::Bool(b) => Value::Bool(*b),
ScVal::Void => Value::Null,
ScVal::LedgerKeyContractInstance => return Err(Error::InvalidValue(None)),
ScVal::LedgerKeyContractInstance => Value::String("LedgerKeyContractInstance".to_string()),
ScVal::U64(v) => Value::Number(serde_json::Number::from(*v)),
ScVal::Timepoint(tp) => Value::Number(serde_json::Number::from(tp.0)),
ScVal::Duration(d) => Value::Number(serde_json::Number::from(d.0)),
Expand Down
7 changes: 5 additions & 2 deletions cmd/crates/soroban-test/tests/it/contract_sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ fn contract_data_read_failure() {
.arg("read")
.arg("--id=1")
.arg("--key=COUNTER")
.arg("--durability=persistent")
.assert()
.failure()
.stderr(
Expand Down Expand Up @@ -315,9 +316,10 @@ fn contract_data_read() {
.arg("read")
.arg("--id=1")
.arg("--key=COUNTER")
.arg("--durability=persistent")
.assert()
.success()
.stdout("COUNTER,1\n");
.stdout("COUNTER,1,4096\n");

sandbox
.new_assert_cmd("contract")
Expand All @@ -333,9 +335,10 @@ fn contract_data_read() {
.arg("read")
.arg("--id=1")
.arg("--key=COUNTER")
.arg("--durability=persistent")
.assert()
.success()
.stdout("COUNTER,2\n");
.stdout("COUNTER,2,4096\n");
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions cmd/soroban-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ wasmparser = { workspace = true }
sha2 = { workspace = true }
csv = "1.1.6"
ed25519-dalek = "1.0.1"
jsonrpsee-http-client = "0.18.1"
jsonrpsee-core = "0.18.1"
jsonrpsee-http-client = "0.20.1"
jsonrpsee-core = "0.20.1"
hyper = "0.14.27"
hyper-tls = "0.5"
http = "0.2.9"
Expand Down
Loading

0 comments on commit 3e201ad

Please sign in to comment.