Skip to content

Commit

Permalink
Add missing flags to show-config (#1309)
Browse files Browse the repository at this point in the history
<!-- Reference any GitHub issues resolved by this PR -->

## Introduced changes

<!-- A brief description of the changes -->

- add missing properties to show-config command

## Checklist

<!-- Make sure all of these are complete -->

- [X] Linked relevant issue
- [X] Updated relevant documentation
- [X] Added relevant tests
- [X] Performed self-review of the code
- [X] Added changes to `CHANGELOG.md`
  • Loading branch information
THenry14 authored Dec 6, 2023
1 parent 7823d25 commit e465589
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
2 changes: 2 additions & 0 deletions crates/cast/src/helpers/response_structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ pub struct ShowConfigResponse {
pub scarb_path: Option<Utf8PathBuf>,
pub accounts_file_path: Option<Utf8PathBuf>,
pub keystore: Option<Utf8PathBuf>,
pub wait_timeout: Option<u16>,
pub wait_retry_interval: Option<u8>,
}

#[derive(Serialize)]
Expand Down
4 changes: 4 additions & 0 deletions crates/cast/src/starknet_commands/show_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub async fn show_config(
if keystore.is_some() {
accounts_file_path = None;
}
let wait_timeout = Some(cast_config.wait_timeout);
let wait_retry_interval = Some(cast_config.wait_retry_interval);

Ok(ShowConfigResponse {
profile,
Expand All @@ -38,5 +40,7 @@ pub async fn show_config(
scarb_path,
accounts_file_path,
keystore,
wait_timeout,
wait_retry_interval,
})
}
24 changes: 24 additions & 0 deletions crates/cast/tests/data/show_config/wait_Scarb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "correct"
version = "0.1.0"

[dependencies]
starknet = ">=1.1.1"

[[target.starknet-contract]]
casm = true

[lib]
sierra = false

[tool.sncast]
url = "http://127.0.0.1:5055/rpc"
account = "/path/to/account.json"
keystore = "../keystore"

[tool.sncast.profile1]
url = "http://127.0.0.1:5055/rpc"
account = "user1"
accounts-file = "../account-file"
wait-timeout = 123
wait-retry-interval = 12
18 changes: 16 additions & 2 deletions crates/cast/tests/e2e/show_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use indoc::indoc;
async fn test_show_config_from_scarb_toml() {
let args = vec![
"--path-to-scarb-toml",
"tests/data/show_config/all_Scarb.toml",
"tests/data/show_config/wait_Scarb.toml",
"--profile",
"profile1",
"show-config",
Expand All @@ -20,7 +20,9 @@ async fn test_show_config_from_scarb_toml() {
chain_id: alpha-goerli
profile: profile1
rpc_url: http://127.0.0.1:5055/rpc
scarb_path: tests/data/show_config/all_Scarb.toml
scarb_path: tests/data/show_config/wait_Scarb.toml
wait_retry_interval: 12
wait_timeout: 123
"});
}

Expand All @@ -33,6 +35,10 @@ async fn test_show_config_from_cli() {
"http://127.0.0.1:5055/rpc",
"--keystore",
"../keystore",
"--wait-timeout",
"2",
"--wait-retry-interval",
"1",
"show-config",
];

Expand All @@ -44,6 +50,8 @@ async fn test_show_config_from_cli() {
chain_id: alpha-goerli
keystore: ../keystore
rpc_url: http://127.0.0.1:5055/rpc
wait_retry_interval: 1
wait_timeout: 2
"});
}

Expand All @@ -69,6 +77,8 @@ async fn test_show_config_from_cli_and_scarb() {
profile: profile1
rpc_url: http://127.0.0.1:5055/rpc
scarb_path: tests/data/show_config/all_Scarb.toml
wait_retry_interval: 5
wait_timeout: 300
"});
}

Expand All @@ -92,6 +102,8 @@ async fn test_show_config_when_no_keystore() {
profile: profile1
rpc_url: http://127.0.0.1:5055/rpc
scarb_path: tests/data/show_config/all_Scarb.toml
wait_retry_interval: 5
wait_timeout: 300
"});
}

Expand All @@ -112,5 +124,7 @@ async fn test_show_config_when_keystore() {
keystore: ../keystore
rpc_url: http://127.0.0.1:5055/rpc
scarb_path: tests/data/show_config/all_Scarb.toml
wait_retry_interval: 5
wait_timeout: 300
"});
}
2 changes: 1 addition & 1 deletion docs/src/appendix/cast-library/invoke.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
nonce: Option<felt252>
) -> InvokeResult`

Deploys a contract and returns `InvokeResult`.
Invokes a contract and returns `InvokeResult`.

```rust
#[derive(Drop, Clone)]
Expand Down

0 comments on commit e465589

Please sign in to comment.