Skip to content

CLI: Add --export-encoding instruction-list mode#53

Open
aoikurokawa wants to merge 3 commits intosolana-program:mainfrom
aoikurokawa:ak/log1
Open

CLI: Add --export-encoding instruction-list mode#53
aoikurokawa wants to merge 3 commits intosolana-program:mainfrom
aoikurokawa:ak/log1

Conversation

@aoikurokawa
Copy link
Copy Markdown

@aoikurokawa aoikurokawa commented May 9, 2026

Summary

  • Adds instruction-list as a new value for the --export-encoding CLI option, alongside the existing none|utf8|base58|base64 choices.
  • When selected, the CLI prints a human-readable view of each transaction (program address, accounts with writable/signer flags, and base58-encoded instruction data) instead of the raw encoded transaction bytes.
  • Default behavior is unchanged: without --export-encoding instruction-list, output remains exactly the raw encoded transaction so downstream tooling that consumes the bytes is not affected.

Motivation

Per review feedback, the instruction-list view is useful for humans inspecting what a --exported transaction will do, but it pollutes output for users who only need the raw transaction bytes (e.g. piping into another tool). Making it a separate export mode lets each use case stay clean.

Changes

  • clients/js/src/cli/options.ts: introduce ExportEncoding = Encoding | 'instruction-list', add instruction-list to --export-encoding choices, and update the parser.
  • clients/js/src/cli/utils.ts: branch in exportTransactionPlan — print the instruction list when instruction-list is selected, otherwise print only the encoded transaction (no instruction list).
  • clients/js/src/cli/logs.ts: logExports accepts the new ExportEncoding type and renders "... as an instruction list" vs. "... in <encoding>".
node bin/cli.cjs write \
    idl ... \
    --buffer ... \
    --export ... \
    --export-encoding instruction-list \
    --close-buffer ...

@aoikurokawa aoikurokawa marked this pull request as ready for review May 9, 2026 17:31
@aoikurokawa aoikurokawa changed the title CLI: add --export-encoding instruction-list mode CLI: Add --export-encoding instruction-list mode May 9, 2026
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

Successfully merging this pull request may close these issues.

1 participant