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

Unable to serialize Option<address> in CLI PTB #5141

Closed
Thoralf-M opened this issue Jan 31, 2025 · 0 comments · Fixed by #5143
Closed

Unable to serialize Option<address> in CLI PTB #5141

Thoralf-M opened this issue Jan 31, 2025 · 0 comments · Fixed by #5143
Assignees
Labels
dev-tools Issues related to the Developer Tools Team

Comments

@Thoralf-M
Copy link
Member

Bug description

In the CLI it's not possible to provide an option with an address as parameter to call a move function

For example calling this function in the testnet

iota client ptb \
--assign addr "some(@0xa5657935a0698bf654ce4ceb66b5a6d6a371a934a6afcfd1e191aa2ee460c8cc)" \
--move-call 0xf5097105292df26739f5d2ca10d5011e6bc54245ef7f1e0c708de3aa7f946544::example::optional_address_param addr \
--dry-run

fails with

Encountered error when building PTB:
  × Error when processing PTB
   ╭─[1:15]
 1 │ --assign addr some(@0xa5657935a0698bf654ce4ceb66b5a6d6a371a934a6afcfd1e191aa2ee460c8cc)
   ·               ────────────────────────────────────┬────────────────────────────────────
   ·                                                   ╰── Unable to serialize 'some(@0xA5657935A0698BF654CE4CEB66B5A6D6A371A934A6AFCFD1E191AA2EE460C8CC)' as a vector<address> value
 2 │ --move-call 0xf5097105292df26739f5d2ca10d5011e6bc54245ef7f1e0c708de3aa7f946544::example::optional_address_param addr
   ╰────

Could not build PTB due to previous error

Steps To reproduce the bug

  1. Have a function that accepts option<address>, for example
    public fun optional_address_param(
        address_option: Option<address>,
    ): bool {
        option::is_some(&address_option)
    }
  1. Try to call it in the CLI with a PTB

Since the error mentions vector<address> I also tried to provide a vector instead, but this also doesn't work:

iota client ptb \
--make-move-vec "<address>" "[@0xa5657935a0698bf654ce4ceb66b5a6d6a371a934a6afcfd1e191aa2ee460c8cc]" \
--assign addr \
--move-call 0xf5097105292df26739f5d2ca10d5011e6bc54245ef7f1e0c708de3aa7f946544::example::optional_address_param addr \
--dry-run

-> CommandArgumentError { arg_idx: 0, kind: TypeMismatch } in command 1

@Thoralf-M Thoralf-M added the dev-tools Issues related to the Developer Tools Team label Jan 31, 2025
@Thoralf-M Thoralf-M self-assigned this Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-tools Issues related to the Developer Tools Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant