Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: accept strings as arguments from command line without having to use Some() #319

Open
brunopgalvao opened this issue Oct 10, 2024 · 0 comments

Comments

@brunopgalvao
Copy link
Collaborator

When instantiating a contract that expects String's as arguments, Pop CLI fails:

For example, instantiating the PSP22 contract:

#[ink(constructor)]
pub fn new(
    supply: u128,
    name: Option<String>,
    symbol: Option<String>,
    decimals: u8,
) -> Self {
    let (data, events) = PSP22Data::new(supply, Self::env().caller()); // (2)
    let contract = Self {
        data,
        name,
        symbol,
        decimals,
    };
    contract.emit_events(events);
    contract
}
pop up contract --constructor new --args 10000000, "AWESOME", "AWE", 10

The following error is emitted:

┌   Pop CLI : Deploy a smart contract
│
■  An error occurred instantiating the contract: No variant 'AWESOME' found

For it to work, I need to wrap the strings in Some() with '' around so that zsh does not complain:

pop up contract --constructor new --args 10000000, 'Some("AWESOME")', 'Some("AWE")', 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant