Skip to content

fix: update ContractDataDurability enum access for SDK v17 - #2855

Merged
ElliotFriend merged 1 commit into
stellar:mainfrom
yigitcangokmen:fix/contractdatadurability-v17-syntax
Sep 14, 2026
Merged

fix: update ContractDataDurability enum access for SDK v17#2855
ElliotFriend merged 1 commit into
stellar:mainfrom
yigitcangokmen:fix/contractdatadurability-v17-syntax

Conversation

@yigitcangokmen

Copy link
Copy Markdown

SDK v17 replaced the js-xdr library with typed XDR. ContractDataDurability.persistent is now a static enum object, not a factory function. Calling it with () throws TypeError: xdr.ContractDataDurability.persistent is not a function.

The v17.0.0 changelog documents this: "Enums are singletons, not factory calls."

This removes the trailing () on 4 executable lines and 1 comment across 3 files:

  • extend-persistent-entry-js.mdx lines 54, 233
  • getLedgerEntries.mdx lines 222 (comment), 223
  • create-restoration-footprint-js.mdx line 58

guestbook/frontend.mdx:426 has the same pattern but is already covered by #2837.

Verified on @stellar/stellar-sdk@17.0.1:

// Before (throws)
xdr.ContractDataDurability.persistent()
// TypeError: xdr.ContractDataDurability.persistent is not a function

// After (works)
xdr.ContractDataDurability.persistent
// ContractDataDurability { name: 'persistent', value: 1 }

Copilot AI balanced review requested due to automatic review settings September 13, 2026 13:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates JavaScript SDK examples for the typed XDR enum API introduced in SDK v17.

Changes:

  • Replaces four obsolete enum factory calls with static enum values.
  • Updates the related temporary-durability comment.

Recommendation: MERGE-READY — correct, complete, and scoped appropriately.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docs/data/apis/rpc/api-reference/methods/getLedgerEntries.mdx Updates persistent and temporary durability syntax.
docs/build/guides/archival/extend-persistent-entry-js.mdx Fixes two persistent-entry examples.
docs/build/guides/archival/create-restoration-footprint-js.mdx Fixes restoration-footprint enum access.

Note

Copilot is running an experiment and ran this review at Balanced.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

SDK v17 replaced the js-xdr library with typed XDR. Enums are now
static singleton objects, not factory functions. Calling
`xdr.ContractDataDurability.persistent()` throws TypeError on v17+.

The v17.0.0 changelog documents this: "Enums are singletons, not
factory calls."
@yigitcangokmen
yigitcangokmen force-pushed the fix/contractdatadurability-v17-syntax branch from 31f9c07 to 814f900 Compare September 13, 2026 16:41
@ElliotFriend
ElliotFriend merged commit f54638a into stellar:main Sep 14, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

PR Preview: torn down

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.

3 participants