-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Labels
Description
What problem does your feature solve?
When invoking a contract function that expects a String parameter and passing a number on the command line, the CLI errors instead of converting the number to a string.
Example contract:
#[contract]
pub struct Contract;
#[contractimpl]
impl Contract {
fn test_string(v: String) -> String {
v
}
}Invoking with a number fails:
$ stellar contract invoke --id c -- test_string --v 5
❌ error: Failed to parse argument 'v': invalid type: integer `5`, expected string or map
Context: Expected type string, but received: '5'
Suggestion: For strings, ensure the value is properly quoted (e.g., "hello world")
Passing a non-numeric string works:
$ stellar contract invoke --id c -- test_string --v lk
"lk"
What would you like to see?
Since the contract function signature specifies the parameter type is String, the CLI should automatically convert the integer 5 to the string "5" rather than erroring.
What alternatives are there?
The workaround is to double-quote the value: --v '"5"'
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo (Ready for Dev)