Skip to content

fix(sdk): enforce native asset decimal precision (#259) - #348

Merged
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
emrekayat:fix/assigned-259
Sep 8, 2026
Merged

fix(sdk): enforce native asset decimal precision (#259)#348
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
emrekayat:fix/assigned-259

Conversation

@emrekayat

Copy link
Copy Markdown
Contributor

Closes #259.

Uses the existing seven-decimal native limit and retains the 18-decimal SAC limit. Adds lower/upper boundary coverage for both asset types and a SAC-above-seven control.

Validation: SDK suite: 197 tests pass; SDK typecheck passes on the combined verification branch.

Copilot AI lite review requested due to automatic review settings September 8, 2026 17:13
@karagozemin
karagozemin merged commit f535c1a into Sub-Rosa-Issue:main Sep 8, 2026
2 of 3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is narrowly scoped to the reported bug, matches the acceptance criteria, and is backed by targeted boundary/regression tests.

Pull request overview

This PR fixes asset decimal validation in the SDK by applying the existing 7-decimal precision limit to native assets while preserving the 18-decimal limit for SAC assets, and adds regression coverage for the boundary conditions.

Changes:

  • Use a type-specific maximum decimal precision (MAX_STROOPS_DECIMALS for native, MAX_TOKEN_DECIMALS for SAC) during decimals validation.
  • Update the thrown validation error message to reflect the correct maximum per asset type.
  • Add tests covering lower/upper bounds for both asset types plus a SAC “above native limit” control.
File summaries
File Description
packages/sdk/src/asset-config.ts Applies per-asset-type decimal precision caps during validation and reports the correct allowed range in errors.
packages/sdk/src/asset-config.test.ts Adds boundary and regression tests to ensure native and SAC decimal limits are enforced as intended.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

fix(sdk): enforce the native asset decimal limit

3 participants