Skip to content

Commit d9679eb

Browse files
committed
add deprecation warning for public input/output deploy-related functions
1 parent 0a9a5f1 commit d9679eb

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

lib/cli/deploy.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub async fn speculative_put_deploy(
5353
let rpc_id = parse::rpc_id(maybe_rpc_id);
5454
let verbosity = parse::verbosity(verbosity_level);
5555
let deploy = with_payment_and_session(deploy_params, payment_params, session_params, false)?;
56+
#[allow(deprecated)]
5657
crate::speculative_exec(rpc_id, node_address, verbosity, deploy)
5758
.await
5859
.map_err(CliError::from)
@@ -79,6 +80,7 @@ pub fn make_deploy(
7980
#[cfg(feature = "std-fs-io")]
8081
{
8182
let output = parse::output_kind(maybe_output_path, force);
83+
#[allow(deprecated)]
8284
crate::output_deploy(output, &deploy).map_err(CliError::from)?;
8385
}
8486
Ok(deploy)
@@ -100,6 +102,7 @@ pub fn sign_deploy_file(
100102
) -> Result<(), CliError> {
101103
let secret_key = parse::secret_key_from_file(secret_key_path)?;
102104
let output = parse::output_kind(maybe_output_path, force);
105+
#[allow(deprecated)]
103106
crate::sign_deploy_file(input_path, &secret_key, output).map_err(CliError::from)
104107
}
105108

@@ -115,6 +118,7 @@ pub async fn send_deploy_file(
115118
) -> Result<SuccessResponse<PutDeployResult>, CliError> {
116119
let rpc_id = parse::rpc_id(maybe_rpc_id);
117120
let verbosity = parse::verbosity(verbosity_level);
121+
#[allow(deprecated)]
118122
let deploy = crate::read_deploy_file(input_path)?;
119123
#[allow(deprecated)]
120124
crate::put_deploy(rpc_id, node_address, verbosity, deploy)
@@ -134,7 +138,9 @@ pub async fn speculative_send_deploy_file(
134138
) -> Result<SuccessResponse<SpeculativeExecResult>, CliError> {
135139
let rpc_id = parse::rpc_id(maybe_rpc_id);
136140
let verbosity = parse::verbosity(verbosity_level);
141+
#[allow(deprecated)]
137142
let deploy = crate::read_deploy_file(input_path)?;
143+
#[allow(deprecated)]
138144
crate::speculative_exec(rpc_id, node_address, verbosity, deploy)
139145
.await
140146
.map_err(CliError::from)
@@ -211,6 +217,7 @@ pub async fn speculative_transfer(
211217
payment_params,
212218
false,
213219
)?;
220+
#[allow(deprecated)]
214221
crate::speculative_exec(rpc_id, node_address, verbosity, deploy)
215222
.await
216223
.map_err(CliError::from)
@@ -248,6 +255,7 @@ pub fn make_transfer(
248255
#[cfg(feature = "std-fs-io")]
249256
{
250257
let output = parse::output_kind(maybe_output_path, force);
258+
#[allow(deprecated)]
251259
crate::output_deploy(output, &deploy).map_err(CliError::from)?;
252260
}
253261
Ok(deploy)

lib/cli/tests.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,13 @@ fn should_sign_deploy() {
208208
let tempdir = tempfile::tempdir().unwrap();
209209
let path = tempdir.path().join("deploy.json");
210210

211+
#[allow(deprecated)]
211212
crate::output_deploy(OutputKind::file(&path, false), &deploy).unwrap();
212213

213214
let secret_key = SecretKey::generate_ed25519().unwrap();
215+
#[allow(deprecated)]
214216
crate::sign_deploy_file(&path, &secret_key, OutputKind::file(&path, true)).unwrap();
217+
#[allow(deprecated)]
215218
let signed_deploy = crate::read_deploy_file(&path).unwrap();
216219

217220
assert_eq!(

lib/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ pub async fn put_transaction(
170170
/// Sends a JSON-RPC `speculative_exec` request to the specified node.
171171
///
172172
/// For details of the parameters, see [the module docs](crate#common-parameters).
173+
#[deprecated(since = "3.0.0", note = "use `speculative_exec_txn` instead")]
173174
pub async fn speculative_exec(
174175
rpc_id: JsonRpcId,
175176
node_address: &str,
@@ -211,6 +212,7 @@ pub async fn speculative_exec_txn(
211212
///
212213
/// `output` specifies the output file and corresponding overwrite behaviour, or if
213214
/// `OutputKind::Stdout`, causes the `Deploy` to be printed `stdout`.
215+
#[deprecated(since = "3.0.0", note = "use `output_transaction` instead")]
214216
#[cfg(any(feature = "std-fs-io", test))]
215217
pub fn output_deploy(output: OutputKind, deploy: &Deploy) -> Result<(), Error> {
216218
write_deploy(deploy, output.get()?)?;
@@ -232,6 +234,7 @@ pub fn output_transaction(output: OutputKind, transaction: &Transaction) -> Resu
232234
}
233235

234236
/// Reads a previously-saved [`Deploy`] from a file.
237+
#[deprecated(since = "3.0.0", note = "use `read_transaction_file` instead")]
235238
#[cfg(any(feature = "std-fs-io", test))]
236239
pub fn read_deploy_file<P: AsRef<Path>>(deploy_path: P) -> Result<Deploy, Error> {
237240
let input = fs::read(deploy_path.as_ref()).map_err(|error| Error::IoError {
@@ -265,12 +268,14 @@ pub fn read_transaction_file<P: AsRef<Path>>(transaction_path: P) -> Result<Tran
265268
///
266269
/// The same path can be specified for input and output, and if the operation fails, the original
267270
/// input file will be left unmodified.
271+
#[deprecated(since = "3.0.0", note = "use `sign_transaction_file` instead")]
268272
#[cfg(any(feature = "std-fs-io", test))]
269273
pub fn sign_deploy_file<P: AsRef<Path>>(
270274
input_path: P,
271275
secret_key: &SecretKey,
272276
output: OutputKind,
273277
) -> Result<(), Error> {
278+
#[allow(deprecated)]
274279
let mut deploy = read_deploy_file(input_path)?;
275280

276281
deploy.sign(secret_key);

0 commit comments

Comments
 (0)