codama-renderers-dart 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +6 -0
  2. package/dist/index.browser.cjs +195 -126
  3. package/dist/index.browser.cjs.map +1 -1
  4. package/dist/index.browser.js +196 -127
  5. package/dist/index.browser.js.map +1 -1
  6. package/dist/index.node.cjs +195 -126
  7. package/dist/index.node.cjs.map +1 -1
  8. package/dist/index.node.js +196 -127
  9. package/dist/index.node.js.map +1 -1
  10. package/dist/index.react-native.js +196 -127
  11. package/dist/index.react-native.js.map +1 -1
  12. package/dist/types/fragments/accountPage.d.ts.map +1 -1
  13. package/dist/types/fragments/errorPage.d.ts.map +1 -1
  14. package/dist/types/fragments/instructionPage.d.ts.map +1 -1
  15. package/dist/types/fragments/pdaPage.d.ts.map +1 -1
  16. package/dist/types/fragments/programPage.d.ts.map +1 -1
  17. package/dist/types/utils/nameTransformers.d.ts.map +1 -1
  18. package/dist/types/utils/valueNodes.d.ts +4 -0
  19. package/dist/types/utils/valueNodes.d.ts.map +1 -1
  20. package/dist/types/visitors/getRenderMapVisitor.d.ts.map +1 -1
  21. package/dist/types/visitors/getTypeManifestVisitor.d.ts.map +1 -1
  22. package/dist/types/visitors/renderVisitor.d.ts.map +1 -1
  23. package/package.json +11 -11
  24. package/src/fragments/accountPage.ts +2 -1
  25. package/src/fragments/errorPage.ts +8 -5
  26. package/src/fragments/instructionPage.ts +51 -21
  27. package/src/fragments/pdaPage.ts +7 -14
  28. package/src/fragments/programPage.ts +3 -2
  29. package/src/utils/formatCode.ts +2 -2
  30. package/src/utils/nameTransformers.ts +11 -0
  31. package/src/utils/valueNodes.ts +24 -1
  32. package/src/visitors/getRenderMapVisitor.ts +30 -5
  33. package/src/visitors/getTypeManifestVisitor.ts +127 -87
  34. package/src/visitors/renderVisitor.ts +11 -13
  35. package/LICENSE +0 -21
package/README.md CHANGED
@@ -6,6 +6,8 @@ A [Codama](https://github.com/codama-idl/codama) renderer that generates Dart co
6
6
 
7
7
  Given a Codama IDL (Interface Description Language) describing a Solana program, this renderer produces a complete Dart package with typed account classes, instruction builders, codec functions, error definitions, PDA helpers, and barrel exports.
8
8
 
9
+ Numeric prefix codecs retain the declared byte order, and pre/post offset types retain their cursor or padding strategy. Constant PDA integer seeds use the matching Dart integer type; malformed hexadecimal seeds and unsupported byte encodings are rejected.
10
+
9
11
  Fixed-size Codama types generate non-truncating encoders. Values within the declared byte capacity are zero-padded, while over-capacity values throw before any malformed bytes can be emitted. For UTF-8 strings, capacity is measured in encoded bytes rather than Dart code units.
10
12
 
11
13
  ## Installation
@@ -39,6 +41,8 @@ visit(root, renderVisitor("lib/src/generated", {
39
41
 
40
42
  `renderVisitor` accepts parsed Codama JSON as well as roots made with Codama constructors. Pina omits empty collections from its serialized IDLs; the renderer restores those structural defaults on an internal copy before traversal, leaving the parsed object unchanged.
41
43
 
44
+ IDL names may contain letters, digits, underscores, hyphens, and spaces; names containing path separators, quotes, or other source syntax are rejected. Documentation and string values are escaped before they enter generated Dart. Rendering resolves all output before clearing the previous generated directory, so invalid IDLs do not delete an existing client. Formatter paths are passed as literal process arguments. Numeric defaults, counts, sizes, and error codes are validated before they are written as source. Duplicate generated paths are rejected, including names reserved for category barrel files, so nodes cannot silently replace one another.
45
+
42
46
  ```ts
43
47
  import { readFile } from "node:fs/promises";
44
48
  import { visit } from "@codama/visitors-core";
@@ -160,6 +164,8 @@ Account and instruction decoders validate every declared constant, field, and si
160
164
 
161
165
  Top-level instruction decoders require exact input consumption. Account decoders always reject truncated data, but accept unread trailing capacity unless the account declares a `sizeDiscriminatorNode`; size-discriminated accounts reject both truncation and suffix bytes.
162
166
 
167
+ Accounts declared with `isSigner: "either"` expose an additional boolean such as `authorityIsSigner`, defaulting to `true`. Set it to `false` when the authority does not sign, including multisig authorities.
168
+
163
169
  Optional instruction accounts use Codama's `programId` strategy by default. When an optional account is absent, the builder emits a readonly program-address placeholder so every later account keeps its declared index. The account slot is removed only when the instruction explicitly selects the legacy `omitted` strategy.
164
170
 
165
171
  ### Scalar enums