fix(connect): allow staking-postcondition and pox-postcondition in serializeParams#503
Open
werner-stacks wants to merge 3 commits into
Open
fix(connect): allow staking-postcondition and pox-postcondition in serializeParams#503werner-stacks wants to merge 3 commits into
werner-stacks wants to merge 3 commits into
Conversation
jannik-stacks
previously approved these changes
Jul 22, 2026
fix(connect): allow staking-postcondition and pox-postcondition in serializeParams
`serializeParams` only treats `stx`/`ft`/`nft` post-conditions as post-conditions.
The `staking-postcondition` and `pox-postcondition` types (added to
`@stacks/transactions` alongside `Pc.ustxToLock()` / `Pc.willPerformPox()`) are
missing from the `POST_CONDITIONS` allow-list, so they fall through the object
branch and are passed to `Cl.serialize()` as if they were Clarity values.
Calling `request('stx_callContract', { postConditions: [...] })` with a
`staking-postcondition` or `pox-postcondition` throws:
rafa-stacks
approved these changes
Jul 22, 2026
edgar-stacks
approved these changes
Jul 22, 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.
Description
As a Stacks app developer, I want to attach
staking-postconditionandpox-postconditionpost-conditions to astx_callContract/stx_deployContractrequest via
@stacks/connect, so that I can build PoX-5 stacking flows withdeny-mode post-conditions. This is needed because PoX-5
stakelocks STX (it isnot sent), so a
stx-postconditioncan never satisfy it — the protocol requiresthe newer
staking-postcondition(locked amount) andpox-postcondition(will-perform) types. These types already exist in
@stacks/transactions(with the
Pc.…ustxToLock()andPc.willPerformPox()builders), but@stacks/connectdoes not recognize them and crashes before the request reaches the wallet.
1. Motivation for change
Passing a
staking-postconditionorpox-postconditiontorequest(...)throws:In
serializeParams(packages/connect/src/request.ts), each object with atypefield is routed as
POST_CONDITIONS.includes(type) ? postConditionToHex(o) : Cl.serialize(o).The
POST_CONDITIONSallow-list only containsstx/ft/nft, so the two stakingtypes fall through to
Cl.serialize()and fail — a post-condition object is not aClarity value.
2. What was changed
Added
'staking-postcondition'and'pox-postcondition'to thePOST_CONDITIONSallow-list so they are serialized with
postConditionToHex:PostCondition['type'](from@stacks/transactions) already includes both, so thesatisfiesconstraint still holds — no type changes required.3. How does this impact application developers
Developers can now pass staking/pox post-conditions as objects (or via the
Pcbuilder) to
stx_callContract/stx_deployContractwithout a manualpostConditionToHexworkaround. No change to existing stx/ft/nft behavior.4. Link to relevant issues and documentation
@stacks/transactionspost-condition types:StakingPostCondition,PoxPostCondition,and the
Pc.…ustxToLock()/Pc.willPerformPox()builders.5. Examples of use cases with code samples and acceptance criteria
Which produce these post-condition objects:
{ "type": "staking-postcondition", "address": "SP…", "condition": "eq", "amount": "50000000000" } { "type": "pox-postcondition", "address": "SP…", "condition": "will-perform" }Acceptance criteria:
"Unable to serialize. Invalid Clarity Value."
postConditionToHexand forwarded to thewallet (verifiable in the request payload).
Type of Change
Does this introduce a breaking change?
No. Existing post-condition types and all other params are serialized exactly as before;
this only adds two previously-erroring types to the allow-list.
Are documentation updates required?
Optional: post-condition docs could mention staking/pox types are supported via
request.Testing information
serializeParams.request('stx_callContract', { … postConditions: [Pc.principal(a).willSendEq(n).ustxToLock()] })on
main→ throws "Unable to serialize. Invalid Clarity Value."serializeParamsinpackages/connect/src/request.ts(thePOST_CONDITIONSallow-list branch).@stacks/connectfor PoX-5 stacking(e.g. signer-manager
stake).@stacks/transactionspostConditionToHex/ wire deserialization, and that thetarget wallet supports signing these post-condition types.
Checklist