Skip to content

Commit 3bf1ebe

Browse files
authored
fix(CLI): allow not passing deploy args (#33)
1 parent 75143b5 commit 3bf1ebe

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

crates/smartdeploy-cli/src/commands/deploy.rs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,26 @@ impl Cmd {
105105
let public_strkey =
106106
stellar_strkey::ed25519::PublicKey(key.verifying_key().to_bytes()).to_string();
107107

108-
let (function_symbol_arg, final_args) = build_host_function_parameters(
109-
&self.deployed_name,
110-
&self.spec_entries().await?,
111-
&self.slop,
112-
)?;
113-
114108
let contract_address = contract_address();
115109

110+
let args = if self.slop.is_empty() {
111+
ScVal::Void
112+
} else {
113+
let (function_symbol_arg, final_args) = build_host_function_parameters(
114+
&self.deployed_name,
115+
&self.spec_entries().await?,
116+
&self.slop,
117+
)?;
118+
ScVal::Vec(Some(
119+
vec![
120+
ScVal::Symbol(function_symbol_arg),
121+
ScVal::Vec(Some(final_args.try_into().unwrap())),
122+
]
123+
.try_into()
124+
.unwrap(),
125+
))
126+
};
127+
116128
let invoke_contract_args = InvokeContractArgs {
117129
contract_address: contract_address.clone(),
118130
function_name: "deploy".try_into().unwrap(),
@@ -124,14 +136,7 @@ impl Cmd {
124136
xdr::PublicKey::PublicKeyTypeEd25519(Uint256(key.verifying_key().to_bytes())),
125137
))),
126138
ScVal::Void,
127-
ScVal::Vec(Some(
128-
vec![
129-
ScVal::Symbol(function_symbol_arg),
130-
ScVal::Vec(Some(final_args.try_into().unwrap())),
131-
]
132-
.try_into()
133-
.unwrap(),
134-
)),
139+
args,
135140
]
136141
.try_into()
137142
.unwrap(),

0 commit comments

Comments
 (0)