feat: Enhancement: Detailed SDK Feature #38 - #419
Merged
Conversation
|
@OkeQueen 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! 🚀 |
bbjiggy
added a commit
to bbjiggy/streamFi-sdk
that referenced
this pull request
Jul 30, 2026
Fourth round — upstream added a FactoryModule.streamAddress() cache (#38/conduit-protocol#419) while the previous merge was being verified. Only CHANGELOG.md conflicted (combined [Unreleased] entries); docs/api.md merged cleanly. Verified post-merge: typecheck clean, lint clean, 702 passed/2 skipped, build succeeds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #372
(placeholder enhancement for #38, whose original content is no longer available on GitHub — issue #38 returns
410 Gone).Since the referenced issue had no recoverable requirements, I audited the SDK for a real, measurable performance issue rather than guessing.
FactoryModule.streamAddress()resolves astreamId → contract addressmapping that is fixed at stream creation and never changes, yet it made a fresh RPC round trip (buildContractCallTx+simulateReadOnly) on every call. This lookup sits on the hot path for nearly every stream operation —get,withdraw,cancel,pause,resume,topUp,clawbackall resolve the address viaStreamsModule._resolveAddr— andlist()fans it out again for every stream on every page.Map<string, string>cache insideFactoryModule, keyed bystreamId.toString().Changes
src/factory.ts— cache resolved addresses instreamAddress(), skip the network call on a cache hit.src/tests/factory.test.ts— added tests for: cache hit avoids a secondsimulateReadOnlycall, separate cache entries perstreamId,bigint/stringid forms sharing one cache key, and not-found (void) results not being cached.docs/api.md— documented the caching behavior underclient.factory.streamAddress.CHANGELOG.md— added a "Performance" entry under[Unreleased].Test plan
npx vitest run— full suite passes (557 passed, 2 skipped)npx vitest run --coverage src/tests/factory.test.ts—factory.tsat ~93% statement / 89% branch coveragenpx tsc -p tsconfig.build.json --noEmit— cleannpx eslint src/factory.ts src/tests/factory.test.ts— clean