Skip to content

Conversation

@Thoralf-M
Copy link
Member

@Thoralf-M Thoralf-M commented Nov 26, 2025

Description of change

Allow // comments in iota client ptb commands, the comments must be finished with \ to continue with the commands. This is a limitation of bash/zsh and also the reason why # can't be used, as the parts afterwards wouldn't be visible to the iota client ptb command.

This allows

iota client ptb \
// Get the sender address \
--move-call iota::tx_context::sender \
--assign sender \
// Split 1 NANOS from gas coin \
--split-coins gas "[1]" \
--assign coin \
// Transfer the new coin to the sender \
--transfer-objects "[coin]" sender \
--dry-run

# normal comment
iota client ptb \
// another test \
--dry-run

# commented PTB call
iota client ptb \
// another test \
// --split-coins gas "[1]" works as comment \
--dry-run

# commented PTB call, but with text before, still runs
iota client ptb \
// will still run: --split-coins gas "[1]" \
--dry-run

# empty comment, next PTB call will be ignored
iota client ptb \
// \
// --split-coins gas "[1]" \
--dry-run

Links to any relevant issues

Fixes #9432

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)
  • Patch-specific tests (correctness, functionality coverage)
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

Release Notes

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI: Add // comment support in iota client ptb commands
  • Rust SDK:
  • REST API:

@Thoralf-M Thoralf-M requested review from a team as code owners November 26, 2025 09:20
@vercel
Copy link

vercel bot commented Nov 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

6 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
apps-backend Ignored Ignored Preview Dec 7, 2025 7:35am
apps-ui-kit Ignored Ignored Preview Dec 7, 2025 7:35am
iota-evm-bridge Ignored Ignored Preview Dec 7, 2025 7:35am
iota-multisig-toolkit Ignored Ignored Preview Dec 7, 2025 7:35am
rebased-explorer Ignored Ignored Preview Dec 7, 2025 7:35am
wallet-dashboard Ignored Ignored Preview Dec 7, 2025 7:35am

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Nov 26, 2025
@iota-ci iota-ci added dev-tools Issues related to the Developer Tools Team sc-platform Issues related to the Smart Contract Platform group. labels Nov 26, 2025
@github-actions
Copy link
Contributor

✅ Vercel Preview Deployment is ready!

View Preview

@github-actions
Copy link
Contributor

✅ Vercel Preview Deployment is ready!

View Preview

self.buf = "";
}

/// Skip comment tokens until we hit a command (starts with --) or EOF.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I misunderstand but shouldn't we skip until an EOL? Otherwise we can run a commented command?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm good point, the problem is we can't detect end of lines in the parser since the shell removes this information before
What we could do is to ignore -- if it comes directly after //, but if we have an empty line, so just // \ and then a command again, it would also ignore this command

Copy link
Contributor

@DaughterOfMars DaughterOfMars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh I'm not sure I see the utility here

@Thoralf-M
Copy link
Member Author

tbh I'm not sure I see the utility here

Explaining what happens in a PTB could be useful and also commenting out part of a PTB for testing different combinations

@DaughterOfMars
Copy link
Contributor

tbh I'm not sure I see the utility here

Explaining what happens in a PTB could be useful and also commenting out part of a PTB for testing different combinations

The problem I see is that this doesn't allow you to write a shell file and then copy paste it into the command line because of the comments having a different format. So this allows you to write commands instead in, what, a .md file? I suppose this helps for our examples in docs... I just don't know.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2025

✅ Vercel Preview Deployment is ready!

View Preview

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 documentation Improvements or additions to documentation sc-platform Issues related to the Smart Contract Platform group.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iota client ptb fails if there is a # comment

5 participants