Skip to content

Commit

Permalink
fix(CLI): allow not passing deploy args (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal authored Nov 29, 2023
1 parent 75143b5 commit 3bf1ebe
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions crates/smartdeploy-cli/src/commands/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,26 @@ impl Cmd {
let public_strkey =
stellar_strkey::ed25519::PublicKey(key.verifying_key().to_bytes()).to_string();

let (function_symbol_arg, final_args) = build_host_function_parameters(
&self.deployed_name,
&self.spec_entries().await?,
&self.slop,
)?;

let contract_address = contract_address();

let args = if self.slop.is_empty() {
ScVal::Void
} else {
let (function_symbol_arg, final_args) = build_host_function_parameters(
&self.deployed_name,
&self.spec_entries().await?,
&self.slop,
)?;
ScVal::Vec(Some(
vec![
ScVal::Symbol(function_symbol_arg),
ScVal::Vec(Some(final_args.try_into().unwrap())),
]
.try_into()
.unwrap(),
))
};

let invoke_contract_args = InvokeContractArgs {
contract_address: contract_address.clone(),
function_name: "deploy".try_into().unwrap(),
Expand All @@ -124,14 +136,7 @@ impl Cmd {
xdr::PublicKey::PublicKeyTypeEd25519(Uint256(key.verifying_key().to_bytes())),
))),
ScVal::Void,
ScVal::Vec(Some(
vec![
ScVal::Symbol(function_symbol_arg),
ScVal::Vec(Some(final_args.try_into().unwrap())),
]
.try_into()
.unwrap(),
)),
args,
]
.try_into()
.unwrap(),
Expand Down

0 comments on commit 3bf1ebe

Please sign in to comment.