Skip to content

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Aug 13, 2025

Changelog

- description: |
    Encode coin as String in JavaScript
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
   - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...
# uncomment at least one main project this PR is associated with
  projects:
  # - cardano-api
  # - cardano-api-gen
   - cardano-rpc
  # - cardano-wasm

Context

Because protobuf-javascript encodes integers in protobuf as number, it can cause precision loss and number in addition to that is a floating point type. To work around that one has to annotate the proto fields with [jstype = JS_BIGINT]. Related issues:

Upstream PRs ported here:

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@carbolymer carbolymer self-assigned this Aug 13, 2025
@carbolymer carbolymer moved this to In Progress in DevTools roadmap Aug 13, 2025
@carbolymer carbolymer force-pushed the mgalazyn/fix/rpc-js-numbers-precision-fix branch from 3b0187a to a66e4a6 Compare September 5, 2025 13:22
@carbolymer
Copy link
Contributor Author

carbolymer commented Sep 5, 2025

Update PR after the design is decided in

and it is merged.

@carbolymer carbolymer force-pushed the mgalazyn/fix/rpc-js-numbers-precision-fix branch from a66e4a6 to 955b8ab Compare October 2, 2025 12:56
@carbolymer carbolymer marked this pull request as ready for review October 2, 2025 13:10
Copy link
Contributor

@palas palas left a comment

Choose a reason for hiding this comment

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

Nice! Looks good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants