SPIKE: Protocol 28 (CAP-0084)#1499
Draft
sisuresh wants to merge 2 commits into
Draft
Conversation
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.
Author
|
Downstream lab PR (CAP-0084 SPIKE): stellar/laboratory#2131 |
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.
SPIKE porting CAP-0084 (muxed contract addresses) into the SDK. v16 vendored the
former
@stellar/stellar-baseintosrc/base/and now owns XDR generation(
xdr/*.x→src/base/generatedvia the Makefile/xdrgen), so this work liveshere rather than in a pinned base dependency.
Changes
xdr/{curr,next}/Stellar-contract.x:SC_ADDRESS_TYPE_MUXED_CONTRACTarm,MuxedContractstruct,SCAddressunion case.src/base/generated/{curr,next}_generated.js+.d.ts— targeted muxed-contract additions only; preserved existing xdrgen/dts-xdr shape (incl. thexdrgen#152SCSYMBOL_LIMIT/SC_SPEC_DOC_LIMITworkaround) to keep the diff reviewable and avoid regressing the type API.src/base/address.ts:Address.muxedContract()factory,contractId()/muxedId()accessors, andfromScAddress/toScAddress/toStringarms. Display-only<C-strkey>:<id>(not constructor-parseable; round-trips via ScAddress/ScVal).pnpm run build:prodand the base unit suite (1594 tests) pass.Deferred
XDR_BASE_URLbump instead of the manual.xpatch.Makefileunchanged (manual.xpatch; pinned stellar-xdr commit predates the arm).Cross-links