Skip to content

feat(streams): add StreamsModule.streamedTotal() wrapper for streamed_total - #464

Closed
YazarAyobami wants to merge 1 commit into
conduit-protocol:mainfrom
YazarAyobami:feat/streamed-total-wrapper
Closed

feat(streams): add StreamsModule.streamedTotal() wrapper for streamed_total#464
YazarAyobami wants to merge 1 commit into
conduit-protocol:mainfrom
YazarAyobami:feat/streamed-total-wrapper

Conversation

@YazarAyobami

Copy link
Copy Markdown
Contributor

Summary

Adds StreamsModule.streamedTotal(streamId) — a read-only wrapper for the DripStream::streamed_total contract method.

Closes #455

Motivation

docs/architecture.md's "What's not wrapped yet" section listed DripStream::streamed_total as an existing contract method with no StreamsModule equivalent.

Unlike withdrawable() (which reflects only the unwithdrawn portion), streamed_total exposes the cumulative amount streamed since the stream started, regardless of withdrawals. This is useful for progress displays that shouldn't reset visually after a withdrawal. Previously a caller had to reconstruct this value client-side from StreamInfo.withdrawn + withdrawableLocal(), duplicating on-chain accounting logic instead of reading it directly.

Changes

  • src/streams.ts — new streamedTotal(streamId: bigint | string): Promise<bigint> method, mirroring the existing withdrawable() read-only pattern (resolve address → build contract call tx → simulate → parse i128 retval). No signing, no transaction, no keypair required.
  • src/tests/streams-success.test.ts — 3 new tests: returns cumulative amount from simulation retval; keeps counting past withdrawals; surfaces ConduitError scoped to 'stream' on simulation failure.
  • docs/api.md — new streamedTotal(streamId) reference section.
  • docs/architecture.md — updated module map line; removed streamed_total from "What's not wrapped yet".
  • README.md — new streamedTotal(streamId) API section.
  • CHANGELOG.md — Added entry under [Unreleased].

Verification

  • npm run typecheck — passes
  • npm run lint (on changed files) — passes
  • npm test — 725 passed, 2 skipped
  • npm run build — ESM + CJS bundles build cleanly

Note

Includes a package-lock.json fix for npm bug #4828: spurious "peer": true markers on optional dependencies left @rolldown/binding-linux-x64-gnu uninstallable, which broke the vitest test suite with "Cannot find native binding". This was a pre-existing failure in the working tree; the corrected lockfile metadata is included so CI can run the tests.

…_total (conduit-protocol#455)

Adds a read-only wrapper for DripStream::streamed_total, exposing the
cumulative amount streamed since start regardless of withdrawals. Unlike
withdrawable(), which reflects only the unwithdrawn portion, this value
does not reset after a withdrawal — useful for progress displays.

Also fixes the npm optional-dependency lockfile metadata (npm bug #4828)
that left @rolldown/binding-linux-x64-gnu uninstallable, which broke the
vitest test suite.

Closes conduit-protocol#455

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 25, 2026

Copy link
Copy Markdown

@YazarAyobami 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

Copy link
Copy Markdown
Contributor

Thanks for the contribution here — squash-merging this now. Any follow-ups we'll track in a fresh issue. 🚀

Jaydbrown added a commit that referenced this pull request Aug 26, 2026
…_total (#464)

Co-authored-by: YazarAyobami <YazarAyobami@users.noreply.github.com>
@Jaydbrown

Copy link
Copy Markdown
Contributor

Merged into main as 6e8f751 (rebased onto current main by hand — this fork didn't have "Allow edits from maintainers" enabled, so I couldn't push the rebased branch back here). Your streamedTotal() wrapper, the test, and the doc updates are all in main now, attributed to you via Co-authored-by. Closing. Thanks, @YazarAyobami! 🙏

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.

Enhancement: StreamsModule has no wrapper for streamed_total()

2 participants