Feat/sdk decode events - #284
Open
Opulencechuks wants to merge 6 commits into
Open
Conversation
Draining a nested split tree currently needs one distribute call per node. This change introduces a `distribute_cascade` function that distributes a parent split and recursively distributes any freshly-credited direct children (and their children, etc.) in a single call. The cascade is bounded by a `max_depth` parameter up to `MAX_CASCADE_DEPTH` (5) to protect against Soroban gas limit exhaustion. A private helper `distribute_node` is extracted to reuse the balance-draining logic. Unit tests cover a two-level tree, depth bounds, and maximum depth limits.
Contributor
|
Heads up: this looks like the same feature as #275 (both titled "implement bounded cascade distribution helper"), and equivalent functionality ( |
4 tasks
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.
Closes #61
Pull Request Description
What this changes
SplitCreatedEvent,SplitPaidEvent,SplitUpdatedEvent,SplitClosedEvent,ControlTransferredEvent,DepositedEvent,DistributedEvent, and a union typeContractEvent).decodeEventutility in the SDK (index.ts) to automatically parse raw events. This utility robustly handles rawxdr.ScValobjects, base64-encoded XDR strings,{ xdr: string }wrapped objects, or pre-converted native values."test"script in the SDKpackage.jsonto facilitate test execution.Why
Checklist
cargo fmt --allandcargo clippy --all-targets -- -D warningspass (Formatting checks passed locally; full compiler runs on CI)cargo testpasses (No Rust contract changes were made)