Skip to content

Add Java examples to the archival, conventions, conversions, events, and RPC guides - #3131

Merged
ElliotFriend merged 7 commits into
mainfrom
docs-agent/1770-java-b
Nov 13, 2026
Merged

ElliotFriend merged 7 commits into
mainfrom
docs-agent/1770-java-b

Conversation

@stellar-doxie

@stellar-doxie stellar-doxie Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Automated message from the Stellar Triage Bot.

Refs #1770

Working this because @ElliotFriend approved the stacked language plan on #1770 and asked me to keep building it. This is Java B: Java tabs on the 14 other build/guides pages. Base: #3127 (docs-agent/1770-java-a). @ElliotFriend rebased this branch onto 9e877629 on 2026-11-13. Next: Java C (learn/) and Java D.

Merge order: #3126, then #3127, then this PR.

Why this matters

A reader who follows the guides in Java has no Java code on these 14 pages today.

Pages

  • archival/: create-restoration-footprint, extend-persistent-entry, restore-contract, restore-data
  • conventions/: deploy-sac-with-code, extending-wasm-ttl
  • conversions/: address-conversions, bytes-conversions, scval-conversions, string-conversions
  • events/: consume, ingest
  • rpc/: generate-ledger-keys, retrieve-contract-code

Choices for review

  • Events pages: Java uses plain JDBC with org.xerial:sqlite-jdbc 3.54.1.0 (the newest on Maven Central), not an ORM. The page says so. JDBC has no event listeners, so the "Streaming events" tab wraps inserts in an insertEvent method, like the Go tab's GORM hook.
  • Shared helpers: restore-data and restore-contract add methods to the SubmitTx class from the submitTx guide. extend-persistent-entry defines one ExtendTtl class and an extendFootprintTTL helper, like the Go tab.
  • Retry at the next sequence number (restore-data): the Java Transaction constructor is package-private, so the tab rebuilds the transaction with TransactionBuilder from an Account at the old sequence number, then calls SorobanServer.assembleTransaction.
  • Fees: every Soroban tab bids the capped getSorobanInclusionFee().getP90(). On restore-data, TransactionBuilder.build() adds the restore preamble's resource fee, so the tab does not add minResourceFee itself (as in the Go tab). create-restoration-footprint keeps the caller's fee parameter, like the other tabs.
  • Tab text: the Java tab text stands alone. It does not point at the Prisma model or SQLAlchemy from other tabs.
  • Oxford comma: the lines this PR changes use it.

Sweep

  • Prose that names the languages on these pages now names Java too: address-conversions (how to check the address kind), deploy-sac-with-code (description and prerequisites), restore-contract, extend-persistent-entry, create-restoration-footprint, ingest.
  • Search terms: "Python and Go", "Python, or Go", "In Go", "Go SDK", "Go tab" on the 14 pages.

Verified

Against java-stellar-sdk 6.0.0, the newest release (also the newest on Maven Central). The issue cites no version.

  • Address(String) throws IllegalArgumentException; getAddressType(), toSCVal(), toSCAddress(), fromAccount, fromContract, fromSCVal: Address.java.
  • Scv.toSymbol, toInt32, toBytes, toString, fromBytes, fromString, fromSymbol, fromInt32, toLedgerKeyContractInstance: scval/Scv.java.
  • LedgerKey.LedgerKeyContractData/LedgerKeyContractCode builders, ContractExecutable.getWasm_hash(), CONTRACT_EXECUTABLE_WASM, SCVal.fromXdrBase64, XdrElement.toXdrByteArray/toXdrBase64: xdr/.
  • SorobanDataBuilder (zeroed resources by default, setReadOnly, setReadWrite), TransactionBuilder.setSorobanData(String), TransactionBuilder.build() adds the Soroban data's resource fee (TransactionBuilder.java:196-198), ExtendFootprintTTLOperation, RestoreFootprintOperation, createStellarAssetContractOperationBuilder.
  • SorobanServer.prepareTransaction(tx, sim), assembleTransaction, simulateTransaction, getLedgerEntries, getEvents, getHealth; RestorePreamble.getTransactionData() is a base64 string; GetEventsRequest.EventFilter.topics is Collection<Collection<String>>.
  • stellar-rpc v30.0.1 returns entries as an empty list, never null (get_ledger_entries.go:94).
  • pnpm format:mdx and pnpm check passed at the first head. The checks job passed at c18db192.

Not verified

  • Not run: javac and mvn need approval in this lane. A maintainer runs the Java blocks before merge.
  • The // OUTPUT: lines on retrieve-contract-code come from the other tabs, not from a Java run.

Found in existing code (not changed here)

#3119 holds these defects but carries bot:hands-off, so I list them here:

  • docs/build/guides/archival/restore-data.mdx, JavaScript and Python tabs: the restore transaction adds minResourceFee by hand, and the builder adds the same resource fee again (js-stellar-sdk 17.4.0 src/base/transaction_builder.ts:1136-1140, py-stellar-base 17.0.1 transaction_builder.py:149-151). The JavaScript retry also adds sim.minResourceFee before build() adds the resource fee. The Go tab is correct.
  • docs/build/guides/events/ingest.mdx:143 and :185, Go tab: the text points at the Prisma model and at SQLAlchemy from other tabs.

Overlaps

Stacked on #3127, so it overlaps #3124 (Go B) and #3127 on the same pages by design. The old pre-Mintlify sweeps #723 and #2231 also touch events/consume, events/ingest, and create-restoration-footprint.

@stellar-doxie

stellar-doxie Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Automated message from the Stellar Triage Bot.

Reviewing my own PR before hand-off. Thanks for the rebase, @ElliotFriend.

Verified against java-stellar-sdk 6.0.0, and the checks pass at 91cf1a0b. Merge #3126 and #3127 first. Ready to merge.
Not run: every Java block on the 14 pages. The two fixes I pushed in 91cf1a0b came after your rebase.

What I checked
  • Your rebase c18db192 matches my own rebase onto 845ba11b. The only difference is Add Java examples to the transactions and basics guides #3127's clawbacks.mdx comma.
  • Pushed 91cf1a0b:
    • restore-data, Java: dropped fee += minResourceFee. TransactionBuilder.build() already adds the preamble's resource fee (TransactionBuilder.java:196-198), so the resource fee was counted twice. The Go tab already does it this way.
    • ingest, Java tab: the text no longer points at the Prisma model or at SQLAlchemy, which only other tabs show.
  • Every SDK call checked against java-stellar-sdk 6.0.0 source (newest; the pages pin it): GetEventsRequest, GetEventsResponse.EventInfo, SorobanServer.prepareTransaction(tx, sim) and assembleTransaction (:690, :1126), Address, Scv, ExtendFootprintTTLOperation.extendTo (Long), and the xdr getters.
  • stellar-rpc v30.0.1 get_ledger_entries.go:94: entries is an empty list, never null.
  • sqlite-jdbc 3.54.1.0 and stellar-sdk 6.0.0 are the newest on Maven Central.
  • PR body: it said every tab bids only the capped p90. On restore-data it also added the resource fee by hand. Fixed, and the body is updated.
  • Found in existing code, not changed here: the JavaScript and Python restore fees on restore-data have the same double count, and the Go tab on ingest points at other tabs. Fix defects in existing code examples found while adding Python (#3115) #3119 holds such defects but has bot:hands-off, so the PR body lists them.
  • Checks at 91cf1a0b: checks, CodeQL, and Socket pass. No live preview: Mintlify Deployment skips on a stacked base.

@ElliotFriend ElliotFriend 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.

All the Java blocks compile against stellar-sdk 6.0.0, and every page ran on testnet. The restore fee fix is right too. Thanks!

@ElliotFriend
ElliotFriend force-pushed the docs-agent/1770-java-b branch from 91cf1a0 to 13818b4 Compare November 13, 2026 19:26
Base automatically changed from docs-agent/1770-java-a to main November 13, 2026 19:29
@mintlify

mintlify Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
stellar-docs 🟢 Ready View Preview Nov 13, 2026, 7:30 PM

@ElliotFriend
ElliotFriend force-pushed the docs-agent/1770-java-b branch from 13818b4 to edb1cfd Compare November 13, 2026 19:29
@ElliotFriend
ElliotFriend merged commit 16101db into main Nov 13, 2026
8 checks passed
@ElliotFriend
ElliotFriend deleted the docs-agent/1770-java-b branch November 13, 2026 19:32

This branch was successfully deployed

1 active deployment
staging — edb1cfd9 Deployed Nov 13, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:ready-to-merge Bot verified and approved; waiting for a maintainer to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant