fix(create,stream,lib): correct stream rate, recipient guard, stream ID, and deposit total - #379
Open
Akanimoh12 wants to merge 1 commit into
Conversation
…cipient check, surface create_stream's returned stream id, and fix total-deposited calc Fixes four related bugs in the create-stream and stream-detail flows: - conduit-protocol#364: the rate preview used float math (parseFloat(deposit) * 10 ** tokenDecimals / duration) which loses precision for large deposits / high-decimal tokens and rounds where the actual submitted rate (depositStroops / BigInt(durationSeconds)) truncates. The preview now runs the same toStroops + truncating BigInt division pipeline as onSubmit, so the displayed rate always matches what gets signed. - conduit-protocol#363: the submit button was not disabled while recipientStatus === 'checking', so a user could submit within the 600ms debounce + RPC window and bypass the not-found guard entirely. The button is now also disabled while checking, and onSubmit hard-blocks on 'checking' too. - conduit-protocol#362: invokeContract() discarded the confirmed transaction's returnValue, so DripFactory::create_stream's assigned stream_id could never be surfaced to callers. invokeContract() now resolves to { hash, returnValue }, and lib/factory.ts createStream() decodes the u64 stream_id from it and returns { hash, streamId }. The create page now deep-links straight to the new stream when the id is available, falling back to /streams only when it isn't. - conduit-protocol#361: the stream detail page rendered info.withdrawn + withdrawable (the amount already streamed) as 'Total deposited', excluding the not-yet-streamed principal still escrowed in the DripStream contract. For fixed-duration streams this is now computed as ratePerSecond * (endTime - startTime), the actual amount escrowed at creation. Updated unit tests across lib/soroban.ts, lib/factory.ts, lib/stream.ts, and app/create to match the new return shapes and guard behaviour.
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
Fixes four assigned stream-flow bugs:
toStroopsplus truncatingBigIntdivision used during submission, preserving precision and matching the submitted rate.onSubmitwhile the debounced recipient existence check is in flight.invokeContractdiscards the confirmed transaction'sreturnValue, socreateStreamcan't return the new stream ID #362: preserve confirmed Soroban transactionreturnValue, decodeDripFactory::create_stream's returnedstream_id, and deep-link to the created stream with a/streamsfallback.withdrawn + withdrawableas "Total deposited" #361: calculate fixed-duration total deposited fromratePerSecond * durationinstead of the amount already streamed.Tests
Updated the affected Soroban, factory, stream, and create-page tests. Local test execution was unavailable because dependencies were not installed in the workspace.