Skip to content

fix(sdk): tighten percentageString validator and guard BigInt pct parsing - #275

Closed
devtechedge wants to merge 1 commit into
across-protocol:masterfrom
devtechedge:fix/suggested-fees-pct-bigint
Closed

devtechedge wants to merge 1 commit into
across-protocol:masterfrom
devtechedge:fix/suggested-fees-pct-bigint

Conversation

@devtechedge

Copy link
Copy Markdown

Fixes #266

Summary of Changes

  • Validator schema tightening: Updated percentageString regex in packages/sdk/src/api/validators.ts from /^\d+(\.\d+)?$/ to /^\d+$/ so percentage strings with decimal points are caught and rejected at the validation boundary rather than crashing downstream consumers.
  • Defensive BigInt conversion: In packages/sdk/src/actions/getSuggestedFees.ts, wrapped pct assignments in parseSuggestedFees with safe parsing (toBigIntPct) so unexpected float strings will not throw an uncaught SyntaxError: Cannot convert ... to a BigInt at runtime.
  • Changeset: Added @across-protocol/app-sdk patch changeset via .changeset/fix-suggested-fees-pct-bigint.md.
  • Unit Tests: Added test cases in test/unit/api/suggested-fees.test.ts verifying decimal rejection by percentageString and safe conversion in parseSuggestedFees.

@vercel

vercel Bot commented Sep 11, 2026

Copy link
Copy Markdown

@devtechedge is attempting to deploy a commit to the UMA Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 039a9ba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@across-protocol/app-sdk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@devtechedge

Copy link
Copy Markdown
Author

Hi - light nudge on this suggested-fees parsing harden whenever review time opens up.

percentageString accepted values like 12.5, which later blew up as SyntaxError: Cannot convert ... to a BigInt in parseSuggestedFees (Fixes #266).

The PR tightens the validator regex to /^\d+$/, wraps pct assignments with a safe toBigIntPct helper, and adds unit coverage for decimal rejection plus safe conversion, with a patch changeset for @across-protocol/app-sdk.

Diff is localized to validators.ts, getSuggestedFees.ts, and the suggested-fees tests.

Happy to rebase, expand fixtures, or adjust the error messaging if that helps - no pressure on timing.

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.

getSuggestedFees: decimal pct fields validated with percentageString then passed to BigInt() → SyntaxError

1 participant