feat(sdk): add high-level balance/transaction manager interfaces#314
feat(sdk): add high-level balance/transaction manager interfaces#314
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2ccc430995
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| String reason = 'Activation cancelled by caller', | ||
| }) { | ||
| if (_isDisposed) return; | ||
| _cancelledActivations[assetId] = reason; |
There was a problem hiding this comment.
Ignore stale cancel requests when no activation is running
cancelActivation stores a cancellation token unconditionally, even if the asset has no in-flight activation. If a caller invokes cancel slightly after completion (or before a future retry), the next activateAssets call will hit the pre-check and emit ACTIVATION_CANCELLED immediately, cancelling a brand-new activation unexpectedly. This contradicts the in-flight-only contract and creates hard-to-reproduce false failures on later retries.
Useful? React with 👍 / 👎.
| _firstSeenAtByInternalId.putIfAbsent( | ||
| tx.internalId, | ||
| () => tx.timestamp.millisecondsSinceEpoch != 0 | ||
| ? tx.timestamp | ||
| : DateTime.now(), |
There was a problem hiding this comment.
Preserve pending first-seen order before merging replacement
The reconciler records incoming.internalId in _firstSeenAtByInternalId before it knows whether this incoming transaction replaces a pending one with a different internal ID. In the replacement path, _mergeInPlace then tries to move pendingFirstSeen with putIfAbsent, but that key is already populated, so the original first-seen timestamp is lost. This breaks the intended stable ordering for pending→confirmed transitions (especially when timestamps are zero and ordering relies on firstSeen).
Useful? React with 👍 / 👎.
|
Addressed both review comments in commit cb1e623.
Please re-review. |
|
Visit the preview URL for this PR (updated for commit cb1e623): https://komodo-playground--pr314-codex-fix-open-findi-h7o77ks8.web.app (expires Thu, 19 Mar 2026 15:57:41 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 2bfedd77fdea45b25ba7c784416e81f177aa5c47 |
* feat(sdk): add high-level balance and tx manager interfaces * fix(sdk): address pr review cancellation and ordering bugs
Summary
IBalanceManagerwatcher-coverage helpers for per-asset polling decisionswatchTransactionHistoryMerged)cancelActivation,cancelAllActivations) throughAssetManagerWhy
This moves balance/transaction lifecycle complexity into SDK manager-level interfaces so app-layer blocs can stay high-level.
Validation
dart formaton touched SDK filesflutter analyzeon touched SDK files (info-level lint noise only, no new errors)