Skip to content

SPIKE: Protocol 28 (CAP-0084)#1507

Draft
sisuresh wants to merge 4 commits into
stellar:mainfrom
sisuresh:p28-cap-0084
Draft

SPIKE: Protocol 28 (CAP-0084)#1507
sisuresh wants to merge 4 commits into
stellar:mainfrom
sisuresh:p28-cap-0084

Conversation

@sisuresh

@sisuresh sisuresh commented Jul 3, 2026

Copy link
Copy Markdown

JS SDK support for CAP-0084 (Muxed Contract Addresses).

Changes

  • Implements CAP-0084 muxed contract addresses in the vendored src/base/ module (address parsing/encoding + XDR arm), gated to the next channel. This repo vendors stellar-base rather than depending on @stellar/stellar-base, so there is no external dep to re-point.
  • Makefile: re-pin XDR_BASE_URL_{CURR,NEXT} to stellar-xdr@787382ef (CAP-0084 head) and split feature gates — XDR_FEATURES_CURR=CAP_0083, XDR_FEATURES_NEXT=CAP_0083,CAP_0084_MUXED_CONTRACT — so curr excludes and next includes the muxed-contract arm, mirroring SPIKE: Protocol 28 (CAP-0084) js-stellar-base#981. Drop docker run -it for non-TTY/CI, and wire the xdrgen#152 const-inlining post-process (scripts/post-process-generated.py).

Deferred

  • Regen — Docker unavailable in this env, so make generate was not re-run. Makefile is now reproducible against 787382ef and the const post-process is wired but not yet executed; committed src/base/generated/* are unchanged (CI green).
  • Re-pin to merged SHA787382ef is the open stellar-xdr#307 head; re-pin to the merged/tagged SHA once the SPIKE chain lands.
  • Browser bundle (dist/lib gitignored, built in CI).

Upstream

sisuresh added 3 commits July 2, 2026 17:46
js-stellar-sdk v16 vendors the former stellar-base into src/base and owns
XDR generation (xdr/*.x -> src/base/generated via Makefile/xdrgen). Ports
the CAP-0084 changes from stellar/js-stellar-base#980 (head d79a2b7):

- xdr/{curr,next}/Stellar-contract.x: SC_ADDRESS_TYPE_MUXED_CONTRACT arm,
  MuxedContract struct, SCAddress union case.
- Regenerated src/base/generated/{curr,next}_generated.js + .d.ts (targeted
  muxed-contract additions only; preserved existing dts-xdr/xdrgen shape).
- Address.muxedContract() + contractId()/muxedId() accessors and
  fromScAddress/toScAddress/toString arms.
- Tests + CHANGELOG.

Canonical XDR: stellar/stellar-xdr CAP-0084 SCAddress MuxedContract arm.
The SC_ADDRESS_TYPE_MUXED_CONTRACT arm was leaking into the released
`curr` codec. Per the feature-flag contract a gated CAP def must be
`next`-only until the protocol is enabled. Mirrors the fix on
stellar/js-stellar-base#980.

- xdr/curr/Stellar-contract.x + src/base/generated/curr{,_generated}.{js,d.ts}:
  drop the muxed-contract arm (next-channel files keep it).
- src/base/address.ts: guard the fromScAddress case label with optional
  chaining and reach the gated members via a cast so the curr-bound
  Address codec no longer fails to type-check or throws when the arm is
  absent (the write path stays dormant until the arm lands in curr).
- test/unit/base/address.test.ts: codec round-trip cases run only when
  the active codec defines the arm; Address-level assertions stay
  codec-agnostic.
Address.muxedContract's `id` param links to {@link xdr.Uint64}, which
typedoc resolves but excludes from the docs (generated xdr files are
excluded), tripping treatWarningsAsErrors. Add xdr.Uint64 to the
external-symbol mapping like the other xdr.* symbols, and regenerate the
reference docs for the new muxed-contract API.
@sisuresh

sisuresh commented Jul 3, 2026

Copy link
Copy Markdown
Author

The Makefile pinned 68fa1ac5, which predates the CAP-0084 XDR commit,
and left XDR_FEATURES undefined, so `make generate` could not reproduce
the committed generated codec. Pin XDR_BASE_URL_{CURR,NEXT} to
stellar-xdr@787382ef (CAP-0084 muxed-contract arm) and split into
XDR_FEATURES_CURR=CAP_0083 / XDR_FEATURES_NEXT=CAP_0083,CAP_0084_MUXED_CONTRACT
so curr excludes and next includes the muxed-contract arm, mirroring
stellar/js-stellar-base#981. Drop `docker run -it` for non-TTY/CI regen
and wire the xdrgen#152 const-inlining post-process (scripts/post-process-generated.py)
for curr and next.

Regen deferred: Docker is unavailable in this environment, so
`make generate` was not re-run. The Makefile is now reproducible against
787382ef and the const post-process is wired but not yet executed; the
committed src/base/generated/* (correct CAP-0084 arm content, CI green)
are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

1 participant