Skip to content

refactor(codegen): declare params with the tx3c declarations helper - #40

Closed
scarmuega wants to merge 1 commit into
mainfrom
codegen/unified-declarations
Closed

scarmuega wants to merge 1 commit into
mainfrom
codegen/unified-declarations

Conversation

@scarmuega

Copy link
Copy Markdown
Contributor

Summary

Migrates the client-lib template to the unified tx3c codegen helpers from tx3-lang/tx3#359.

  • {{{declarations tii "typescript"}}} replaces the componentTypes block and the per-transaction params loop. The renderer now declares component and params types from one shared planner.
  • paramsTypeName supplies params type names, and identifier ... "param" supplies field references. Template references therefore always match the declarations.

Generated output is unchanged apart from the section comment and blank lines.

Dependency

This stays a draft until a tx3c release includes tx3-lang/tx3#359. CI installs the released toolchain through tx3-lang/actions/setup@v1, so the codegen check fails until then. The stack is tx3-lang/tx3#357, then #358, then #359.

Verification

Run locally with tx3c built from the #359 branch:

  • .github/scripts/codegen-check.sh passed, including tsc against tx3-sdk@latest.
  • The complex fixture's protocol.ts was diffed against the output of the current template. Only the comment and blank lines differ.

🤖 Generated with Claude Code

Replace the template's componentTypes block and per-transaction params
loop with `declarations`, which renders component and params
declarations from the shared tx3c planner. Params type names come from
`paramsTypeName`, and field references from `identifier ... "param"`,
so they always match what the renderer declared.

Generated output is unchanged apart from the section comment and blank
lines. Requires a tx3c release that includes tx3-lang/tx3#359.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@scarmuega

Copy link
Copy Markdown
Contributor Author

Superseded. First-party client templates now live in tx3c and are rendered with tx3c codegen --language (tx3-lang/tx3#360). trix's built-in plugins call it directly (tx3-lang/trix#132). The migrated template from this PR was copied into tx3c unchanged, so this repo no longer needs to update .trix/client-lib. Removing that directory and switching the codegen check to --language is follow-up work, once a tx3c release with #360 is out.

@scarmuega scarmuega closed this Sep 26, 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