Skip to content

Commit 2070c5a

Browse files
committed
refactor: convert to long flag --hex-file <file> option, #6193
1 parent a438687 commit 2070c5a

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
1111

1212
- Added a new RPC endpoint `/v3/health` to query the node's health status. The endpoint returns a 200 status code with relevant synchronization information (including the node's current Stacks tip height, the maximum Stacks tip height among its neighbors, and the difference between these two). A user can use the `difference_from_max_peer` value to decide what is a good threshold for them before considering the node out of sync. The endpoint returns a 500 status code if the query cannot retrieve viable data.
1313

14-
- Added a new option `-xf <file_path>` to `blockstack-cli contract-call` command, that allows to pass a serialized Clarity value by file.
14+
- Added a new option `--hex-file <file_path>` to `blockstack-cli contract-call` command, that allows to pass a serialized Clarity value by file.
1515

1616
## [3.1.0.0.12]
1717

stackslib/src/blockstack_cli.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ Arguments are supplied in one of two ways: through script evaluation or via hex
108108
of the value serialization format. The method for supplying arguments is chosen by
109109
prefacing each argument with a flag:
110110
111-
-e indicates the argument should be _evaluated_
112-
-x indicates the argument that a serialized Clarity value is being passed (hex-serialized)
113-
-xf <file_path> same as `-x`, but reads the serialized Clarity value from a file
111+
-e indicates the argument should be _evaluated_
112+
-x indicates the argument that a serialized Clarity value is being passed (hex-serialized)
113+
--hex-file <file_path> same as `-x`, but reads the serialized Clarity value from a file
114114
115115
e.g.,
116116
@@ -119,7 +119,7 @@ e.g.,
119119
-e \"(+ 1 2)\" \\
120120
-x 0000000000000000000000000000000001 \\
121121
-x 050011deadbeef11ababffff11deadbeef11ababffff \\
122-
-xf /path/to/value.hex
122+
--hex-file /path/to/value.hex
123123
";
124124

125125
const TOKEN_TRANSFER_USAGE: &str = "blockstack-cli (options) token-transfer [origin-secret-key-hex] [fee-rate] [nonce] [recipient-address] [amount] [memo] [args...]
@@ -455,7 +455,7 @@ fn handle_contract_call(
455455

456456
if val_args.len() % 2 != 0 {
457457
return Err(
458-
"contract-call arguments must be supplied as a list of `-e ...` or `-x 0000...` pairs"
458+
"contract-call arguments must be supplied as a list of `-e ...` or `-x 0000...` or `--hex-file <file_path>` pairs"
459459
.into(),
460460
);
461461
}
@@ -473,7 +473,7 @@ fn handle_contract_call(
473473
vm_execute(input, clarity_version)?
474474
.ok_or("Supplied argument did not evaluate to a Value")?
475475
},
476-
"-xf" => {
476+
"--hex-file" => {
477477
let content = fs::read_to_string(input)
478478
.map_err(|e| {
479479
let err_msg = format!("Cannot read file: {input}. Reason: {e}");
@@ -482,7 +482,7 @@ fn handle_contract_call(
482482
Value::try_deserialize_hex_untyped(&content)?
483483
}
484484
_ => {
485-
return Err("contract-call arguments must be supplied as a list of `-e ...` or `-x 0000...` pairs".into())
485+
return Err("contract-call arguments must be supplied as a list of `-e ...` or `-x 0000...` or `--hex-file <file_path>` pairs".into())
486486
}
487487
};
488488

@@ -1209,7 +1209,7 @@ mod test {
12091209
"SPJT598WY1RJN792HRKRHRQYFB7RJ5ZCG6J6GEZ4",
12101210
"foo-contract",
12111211
"transfer-fookens",
1212-
"-xf",
1212+
"--hex-file",
12131213
file_path,
12141214
];
12151215

@@ -1231,7 +1231,7 @@ mod test {
12311231
"SPJT598WY1RJN792HRKRHRQYFB7RJ5ZCG6J6GEZ4",
12321232
"foo-contract",
12331233
"transfer-fookens",
1234-
"-xf",
1234+
"--hex-file",
12351235
file_path,
12361236
];
12371237

@@ -1257,7 +1257,7 @@ mod test {
12571257
"SPJT598WY1RJN792HRKRHRQYFB7RJ5ZCG6J6GEZ4",
12581258
"foo-contract",
12591259
"transfer-fookens",
1260-
"-xf",
1260+
"--hex-file",
12611261
&file_path,
12621262
];
12631263

@@ -1280,7 +1280,7 @@ mod test {
12801280
"SPJT598WY1RJN792HRKRHRQYFB7RJ5ZCG6J6GEZ4",
12811281
"foo-contract",
12821282
"transfer-fookens",
1283-
"-xf",
1283+
"--hex-file",
12841284
&file_path,
12851285
];
12861286

0 commit comments

Comments
 (0)