Skip to content

feat(dynamic-client): types generation split#1002

Merged
mikhd merged 3 commits into
codama-idl:mainfrom
hoodieshq:feat/pr3-typesgen-split
Jun 18, 2026
Merged

feat(dynamic-client): types generation split#1002
mikhd merged 3 commits into
codama-idl:mainfrom
hoodieshq:feat/pr3-typesgen-split

Conversation

@mikhd

@mikhd mikhd commented May 28, 2026

Copy link
Copy Markdown
Contributor

Description

This PR [3] splits types generation between dynamic-instructions, dynamic-address-resolution, dynamic-client. Each package now owns the types for the concepts it implements, dynamic-client composes them.

Change

  • Moved type generation methods into corresponding package. Exported by separate /codegen path.
  • @codama/dynamic-address-resolution/codegen — Address input types ${Name}Args/Accounts/Resolvers (the resolution input contracts), types helpers, shared generateTypesFromFile IO helper (keep it here for now, known inconsistency).
  • @codama/dynamic-instructions/codegen${Name}Signers aliases + ${Program}InstructionBuilders map.
  • Both new packages get their own commander CLI (generate-types) plus a /codegen subpath export.
  • @codama/dynamic-client becomes a composer that reuses those primitives and emits the program-level ${Program}Methods / ${Program}Client shapes.
  • Known overhead - commander cli scaffolding duplication with few test helpers.

Commands:

dynamic-address-resolution:

npx @codama/dynamic-address-resolution generate-types <path/to/idl.json> <output-dir>

dynamic-instructions:

npx @codama/dynamic-instructions generate-types <path/to/idl.json> <output-dir>

dynamic-client:

Unchanged.

@changeset-bot

changeset-bot Bot commented May 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a5e65d3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@codama/dynamic-address-resolution Minor
@codama/dynamic-instructions Minor
@codama/dynamic-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mikhd mikhd force-pushed the feat/pr3-typesgen-split branch from 378a1bb to f696e45 Compare June 5, 2026 07:27
@mikhd

mikhd commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main.

@lorisleiva lorisleiva left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! I trust you on these dynamic clients. 🫡

@mikhd mikhd force-pushed the feat/pr3-typesgen-split branch from f696e45 to 362549f Compare June 15, 2026 06:59
@mikhd

mikhd commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Rebased branch.

mikhd added 3 commits June 17, 2026 14:38
* feat(dynamic-address-resolution): extract type generation

* feat(dynamic-instructions): extract type generation

* feat(dynamic-client): adjust type generation

* feat: refactor generateTypesFromFile

* chore: add tests

* fix: cleanup

* fix: improve codegen

* chore: add minimum tests

* fix: rebasing issues

* fix(dynamic-instructions): types generation in readme

* fix: remove generateInstructionBuildersMap from public api

* fix: refactor codegen helpers

  - Add getResolutionRefs (DAR) with hasRequiredArgs/hasRequiredRemainingAccounts so dynamic-client stops re-deriving args optionality.
  - Extract collectEitherSignerNames (DI) and rename DAR's instruction-types files to generate-resolution-input-types / get-resolution-refs.
  - Emit a local non-exported ResolverFn declaration inside generated files.
  - Pre-compute PDA seed entries to remove the duplicate variableSeeds filter.
  - README update

* chore: add comments

* fix: tighten accounts ref

- keep widened ref with withData suffix

* fix: redundant nullish operator

* fix: add space to unknown comments
@mikhd mikhd force-pushed the feat/pr3-typesgen-split branch from 362549f to a5e65d3 Compare June 17, 2026 11:38
@mikhd

mikhd commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Rebased again.

@mikhd mikhd merged commit 506e7f1 into codama-idl:main Jun 18, 2026
4 checks passed
@mikhd mikhd deleted the feat/pr3-typesgen-split branch June 18, 2026 09:57
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.

3 participants