What version are you using?
25.1.0
What did you do?
Given a contract with both a required and an optional parameter:
#![no_std]
use soroban_sdk::{contract, contractimpl};
#[contract]
pub struct Contract;
#[contractimpl]
impl Contract {
pub fn req(i: u32) -> u32 {
i
}
pub fn opt(i: Option<u32>) -> u32 {
i.unwrap_or(123)
}
}
Invoked both functions using --arg-file-path.
What did you expect to see?
Both invocations should return 127, since the file contains 127 and both functions are given the value via --i-file-path.
Expected for the opt function:
What did you see instead?
The function with the required parameter accepts the --arg-file-path as expected:
$ stellar contract invoke --id c -- req --i-file-path =(echo 127)
127
The function with the optional parameter ignores the --arg-file-path:
$ stellar contract invoke --id c -- opt --i-file-path =(echo 127)
123
Note that passing the value directly on the command line works as expected:
$ stellar contract invoke --id c -- opt --i 127
127