Skip to content

feat: redesign TransactionIntent as high-level business intents#200

Open
lcovar wants to merge 1 commit intomasterfrom
BTC-3120.dot-wasm-high-level-intents
Open

feat: redesign TransactionIntent as high-level business intents#200
lcovar wants to merge 1 commit intomasterfrom
BTC-3120.dot-wasm-high-level-intents

Conversation

@lcovar
Copy link
Contributor

@lcovar lcovar commented Mar 10, 2026

Redesign TransactionIntent from low-level call intents (Transfer, Bond,
Unbond, AddProxy, etc.) to high-level business intents (Payment, Consolidate,
Stake, Unstake, Claim, FillNonce). The crate now handles intent-to-call
composition internally, including automatic batching for multi-call operations.

Old call-level types become internal CallIntent (not public). This matches
the pattern established by wasm-solana, where buildFromIntent accepts
business-level intents and handles instruction composition in Rust.

Composition logic

Intent Condition Produces
Payment transferKeepAlive or transferAllowDeath
Consolidate transferAll
Stake proxyAddress present batchAll(bond, addProxy)
Stake proxyAddress absent bondExtra
Unstake stopStaking=true batchAll(removeProxy, chill, unbond)
Unstake stopStaking=false unbond
Claim withdrawUnbonded
FillNonce transferKeepAlive(sender, 0)

Also adds the previously missing bondExtra call encoding.

47 tests pass (18 new composition + deserialization tests).

Ticket: BTC-3120

@lcovar lcovar requested a review from a team as a code owner March 10, 2026 03:43
Replace low-level call intents (Transfer, Bond, Unbond, AddProxy, etc.)
with business-level intents (Payment, Consolidate, Stake, Unstake, Claim,
FillNonce). The crate now handles intent-to-call composition internally,
including automatic batching for multi-call operations.

Composition logic:
- Payment → transfer or transferKeepAlive
- Consolidate → transferAll
- Stake with proxyAddress → batchAll(bond, addProxy)
- Stake without proxyAddress → bondExtra (top-up)
- Unstake with stopStaking → batchAll(removeProxy, chill, unbond)
- Unstake without stopStaking → unbond
- Claim → withdrawUnbonded
- FillNonce → zero-value transferKeepAlive to self

Old call-level types are now internal CallIntent (not public).
Includes bondExtra encoding (previously missing).
47 tests pass (18 new composition + deserialization tests).

Ticket: BTC-3120
@lcovar lcovar force-pushed the BTC-3120.dot-wasm-high-level-intents branch from ea2d340 to 5a24cee Compare March 10, 2026 05:09
@lcovar lcovar enabled auto-merge March 10, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant