feat(dynamic-client): types generation split#1002
Conversation
🦋 Changeset detectedLatest commit: f696e45 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
| }); | ||
|
|
||
| test('should match the structural shape of the runtime ResolverFn', () => { | ||
| type EmittedResolverFn<TArgs, TAccs> = (argumentsInput: TArgs, accountsInput: TAccs) => Promise<unknown>; |
There was a problem hiding this comment.
This tests describes this type, do I get it correct?
https://github.com/codama-idl/codama/pull/1002/changes#diff-5dfc0f859cdeec27dc82baf5989aa624af82fb012533312eaa233ab57703b45eR21-R23
If yes, i think it is worth to import it and test it directly as this might potentially degrade at some point
There was a problem hiding this comment.
Yes, added a separate toMatchInlineSnapshot test that pins the RESOLVER_FN_DECLARATION string verbatim — so if the emitted declaration ever changes, that test fails.
* 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
378a1bb to
f696e45
Compare
|
Rebased onto main. |
lorisleiva
left a comment
There was a problem hiding this comment.
Thanks! I trust you on these dynamic clients. 🫡
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-clientcomposes them.Change
/codegenpath.@codama/dynamic-address-resolution/codegen— Address input types${Name}Args/Accounts/Resolvers(the resolution input contracts), types helpers, sharedgenerateTypesFromFileIO helper (keep it here for now, known inconsistency).@codama/dynamic-instructions/codegen—${Name}Signersaliases +${Program}InstructionBuildersmap.@codama/dynamic-clientbecomes a composer that reuses those primitives and emits the program-level ${Program}Methods / ${Program}Client shapes.Commands:
dynamic-address-resolution:
dynamic-instructions:
dynamic-client:
Unchanged.