fix: improve lock vs vesting classification#344
Merged
dperdic-streamflow merged 3 commits intomasterfrom Mar 9, 2026
Merged
Conversation
… prevent misleading unlock time display
|
Alpha versions of packages are published 📦 PR: #344 |
miljanstreamflow
approved these changes
Mar 9, 2026
Yolley
approved these changes
Mar 9, 2026
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.
The root cause was that
isTokenLockin the SDK only checked the cliff amount (if it is close to the deposited amount) but never checked the cliff time (if it is close to the end date). So a contract that unlocks 100% of tokens at creation but has an end date a year later still passed the lock check.The fix adds a time based validation to
isTokenLockandbuildStreamTypeinpackages/stream/solana/contractUtils.ts. When a contract is identified as a lock via the cliff-amount path, it now also verifies that the gap between the cliff timestamp and end timestamp is no more than 1 second. Legitimate locks created through our app have a gap of 1 second, so this threshold has wide margin. If the gap exceeds 1 second, the contract is reclassified as vesting - which means the UI will show the correct unlock schedule instead of a misleading lock date.The
cliffandendfields were added as optional parameters to keep backward compatibility - external callers that don't pass them get the same behavior as before. Dynamic locks (classified via the price/percentage path) are completely unaffected.