Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions forc-plugins/forc-client/src/cmd/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ pub struct Command {
#[clap(long, short = 'o', default_value = "default", help_heading = "OUTPUT")]
pub output: OutputFormat,

/// Contract call variable output count
#[clap(long, alias = "variable-output", help_heading = "VARIABLE OUTPUT")]
pub variable_output: Option<usize>,

/// Set verbosity levels; currently only supports max 2 levels
/// - `-v=1`: Print decoded logs
/// - `-v=2`: Additionally print receipts and script json
Expand Down
6 changes: 5 additions & 1 deletion forc-plugins/forc-client/src/op/call/call_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub async fn call_function(
mut output,
external_contracts,
contract_abis,
variable_output,
..
} = cmd;

Expand Down Expand Up @@ -88,7 +89,9 @@ pub async fn call_function(
};

// Setup variable output policy and log decoder
let variable_output_policy = VariableOutputPolicy::Exactly(call_parameters.amount as usize);
let variable_output_policy = variable_output
.map(VariableOutputPolicy::Exactly)
.unwrap_or(VariableOutputPolicy::EstimateMinimum);
let error_codes = abi
.unified
.error_codes
Expand Down Expand Up @@ -493,6 +496,7 @@ pub mod tests {
label: None,
output: cmd::call::OutputFormat::Raw,
list_functions: false,
variable_output: None,
verbosity: 0,
debug: false,
}
Expand Down
3 changes: 3 additions & 0 deletions forc-plugins/forc-mcp/src/forc_call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ fn build_call_command(
gas,
external_contracts: None,
output: OutputFormat::Json,
variable_output: None,
verbosity,
debug: false,
})
Expand Down Expand Up @@ -582,6 +583,7 @@ fn build_list_command(contract_id: &str, abi: &str) -> anyhow::Result<forc_clien
gas: None,
external_contracts: None,
output: OutputFormat::Default,
variable_output: None,
verbosity: 0,
debug: false,
})
Expand Down Expand Up @@ -641,6 +643,7 @@ fn build_transfer_command(
gas: None,
external_contracts: None,
output: OutputFormat::Json,
variable_output: None,
verbosity,
debug: false,
})
Expand Down
Loading