Skip to content

Conversation

ERoydev
Copy link
Collaborator

@ERoydev ERoydev commented Sep 10, 2025

What

I found that in dart language there are no integer types like u8, u16, i32, ...., instead dart supports only int and BigInt so i needed a way to store the actually rust type in order to provide correct borsh methods to serialize/deserialize the exact bytes that the anchor program expects for a certain number type.

Key Changes

  • Added format support in readers/writers (intFormatUtil) for all numeric types.
  • Extended recursive reader/writer macros to handle both size and format.
  • Updated TypeManifestField to include format and fixed-size info.
  • Improved regex parsing in extractFieldsFromTypeManifest to capture type and length from comments.
  • Updated getTypeManifestVisitor to annotate numeric types with inline /* type: ... */ comments.

@ERoydev ERoydev requested a review from failfmi September 10, 2025 13:11
@ERoydev ERoydev merged commit 97e4718 into fix/deserialization-field-sizes Sep 16, 2025
ERoydev added a commit that referenced this pull request Sep 16, 2025
* refactor(typeManifest): Handle fixed-sized fields when extracting fields for template rendering

* fix(): Handle fixed-sized optional fields in optionTypeNode Visitor

* ref(sharedTemplate): Added deserializing functions and one reusable to handle fixed arrays

* add(): Applied discriminator functions instead of array used ones

* fix(macros): Nesting depth for recursive borsh and sizes passed to borsh methods

* fix(templates): Use snakeCase and reuse broshMethods for serializing

* Dart numbers borsh support (#4)

* add(typeManifest): Regex handler added for number formats

* add(): NumberTypeNodes return int type with exact rust integer type as a comment

* add(macros): Added formats handling in macros
@failfmi failfmi deleted the fix/dart-numbers-borsh branch September 16, 2025 10:15
@ERoydev ERoydev restored the fix/dart-numbers-borsh branch September 17, 2025 13:30
@ERoydev ERoydev deleted the fix/dart-numbers-borsh branch September 17, 2025 13:31
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