Skip to content

feat(encoding): export convertPrecision and add round-trip tests (fixes #27) - #30

Open
Mannerless wants to merge 1 commit into
ASCTP:mainfrom
Mannerless:feat/export-convert-precision
Open

Mannerless wants to merge 1 commit into
ASCTP:mainfrom
Mannerless:feat/export-convert-precision

Conversation

@Mannerless

Copy link
Copy Markdown

Fixes #27

Summary of Changes

  • Re-exports convertPrecision from src/index.ts so integrators can access decimal scaling directly without reimplementing bigint math.
  • Preserves the existing doc comments on convertPrecision.
  • Adds tests in tests/encoding.test.ts verifying:
    • Direct import from the root package entrypoint
    • 6->7 upscale exactness
    • 7->6 downscale truncation
    • Zero handling across all decimal targets
    • Identity preservation when source and destination decimals match
    • 6->7->6 round-trip identity preservation
    • 7->6->7 sub-micro precision truncation loss with exact differential assertions (9 units / 0.0000009 USDC)
  • All 117 tests pass with zero compiler warnings and successful tsup clean build.

Settlement wallet (Base USDC): 0x459B90ea0C111ae7750EE67f5B4a5d2D506651D0

@vercel

vercel Bot commented Oct 15, 2026

Copy link
Copy Markdown

@Mannerless is attempting to deploy a commit to the Collins' projects Team on Vercel.

A member of the Team first needs to authorize it.

@Mannerless
Mannerless force-pushed the feat/export-convert-precision branch from 08346e5 to b54e5c3 Compare October 16, 2026 00:48

This branch has not been deployed

No deployments
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