Skip to content

fix: resolve issues #532-#535 - GovernorConfig, scVal parsing, GraphQL variables, and fromStroops - #659

Merged
Jaydbrown merged 1 commit into
conduit-protocol:mainfrom
Levi-Ojukwu:fix/issue-532-533-534-535
Sep 3, 2026
Merged

fix: resolve issues #532-#535 - GovernorConfig, scVal parsing, GraphQL variables, and fromStroops#659
Jaydbrown merged 1 commit into
conduit-protocol:mainfrom
Levi-Ojukwu:fix/issue-532-533-534-535

Conversation

@Levi-Ojukwu

Copy link
Copy Markdown
Contributor

Summary

Resolves four issues in the streamFi SDK:

closes #532 : Add maxDurationSeconds to GovernorConfig

  • Added maxDurationSeconds: number to the GovernorConfig interface in src/types/index.ts
  • Updated parseGovernorConfig in src/governor.ts to parse the max_duration_seconds field from the on-chain response

closes #533 : Use scValToU32 for type-safe parsing

  • Replaced raw .u32() calls with scValToU32() in src/governor.ts for feeBps parsing
  • Updated getTokenDecimals in src/soroban.ts to use scValToU32() instead of raw .u32()
  • Provides clear error messages when the contract returns unexpected numeric widths

closes #534 : Use bigintSafeStringify for GraphQL variables

  • Imported bigintSafeStringify from src/utils.ts in src/indexer.ts
  • Applied bigintSafeStringify to variables before JSON.stringify in both query() and subscribe() methods
  • Prevents TypeError: Do not know how to serialize a BigInt in Node and silent {} serialization in Safari

closes #535 : Fix fromStroops for negative input

  • Updated fromStroops in src/utils.ts to handle the sign separately using absolute value
  • Prevents malformed output like "-1.-0" for negative stroop values

Testing

  • npm run typecheck passes
  • npm run lint passes (only pre-existing warnings)

- conduit-protocol#532: Add maxDurationSeconds to GovernorConfig type and parseGovernorConfig
- conduit-protocol#533: Use scValToU32 for feeBps and getTokenDecimals instead of raw .u32()
- conduit-protocol#534: Use bigintSafeStringify for GraphQL variables in query and subscribe
- conduit-protocol#535: Fix fromStroops for negative input by handling sign separately
@drips-wave

drips-wave Bot commented Sep 3, 2026

Copy link
Copy Markdown

@Levi-Ojukwu Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Jaydbrown
Jaydbrown merged commit e6ea2ef into conduit-protocol:main Sep 3, 2026
4 of 5 checks passed
Jaydbrown added a commit that referenced this pull request Sep 3, 2026
main's Test job had 22 failing tests (7 files) predating the recent
batch merges. Three root causes, two of them real bugs:

- src/builder.ts: StreamBuilder.build() emitted a raw `number` amount when
  given one, but ConduitBatcher's payload validation (added for the
  #532-#535 precision-safety work) rejects numeric amounts — so
  `new StreamBuilder().amount(100).build()` produced output execute()
  refused. Coerce amount to string in build() (same fix already applied to
  ratePerSecond, #459); declared return type corrected to `amount: string`.
- src/relayer/WebSocketRelayer.ts: attemptReconnect() only re-checked
  isDestroyed after the backoff delay, not reconnectEnabled, so a
  disconnect() during the delay window still opened a second socket (#619).
  Also bail on !reconnectEnabled.
- Tests: numeric `amount` literals updated to bigint/string across the
  batcher tests; utils zero-duration test now expects the #536 throw;
  governor test mock gains the `scValToU32` export governor.ts now uses
  (#659).

1021 tests pass, tsc clean, lint clean (6 pre-existing warnings), build ok.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment