Skip to content

Add Go examples to the transactions and basics guides - #3123

Merged
ElliotFriend merged 3 commits into
mainfrom
docs-agent/1770-go-a
Nov 13, 2026
Merged

ElliotFriend merged 3 commits into
mainfrom
docs-agent/1770-go-a

Conversation

@stellar-doxie

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

Copy link
Copy Markdown
Contributor

🤖 Automated message from the Stellar Triage Bot.

Refs #1770

Working this because @ElliotFriend approved the Go and Java splits in #1770 and called me in with /triage. This is Go A: Go tabs on the 13 pages under build/guides/transactions and build/guides/basics. Base: main (#3115 merged on 2026-11-13). Go B to D and Java A to D follow, stacked on this PR.

What changed

  • A Go tab next to every Stellar SDK example on these 13 pages: basics/automate-reset-data, basics/verify-trustlines, and transactions/ channel-accounts, clawbacks, fee-bump-transactions, install-deploy-contract-with-code, invoke-contract-tx-sdk, path-payments, pooled-accounts-muxed-accounts-memos, signing-soroban-invocations, simulateTransaction-Deep-Dive, submit-transaction-wait, upload-wasm-bytecode.
  • Tab order is JavaScript, Python, Go, Java (then Rust where a page has it). No existing tab moved.
  • Every transaction bids the capped fee-stats p90, like the other languages. The fee-bump inner transaction and the simulate-only transactions keep the minimum fee, as the other tabs do.
  • The Go SDK has no prepareTransaction, AssembledTransaction, auth-entry signer or getAssetBalance. Where a page needs one, the Go tab defines a small helper (prepareTransaction, authorizeEntry) and says so in one line of prose.
  • NOT_FOUND after polling is reported as "status unknown", not as a failure.
  • Prose changed only where it named JavaScript and Python alone (install steps, run commands, helper notes).
  • From @ElliotFriend's review: the JavaScript and Go poll loops on upload-wasm-bytecode and the Go loop on invoke-contract-tx-sdk check the send status and stop after 30 polls; the fee-payer step on signing-soroban-invocations bids the capped fee-stats p90 in the JavaScript, Python and Go tabs; Oxford commas, one comma splice and the go run line placement.

Skipped

  • Blocks that are not SDK examples: output, shell, the TypeScript RestorePreamble shape, the raw fetch example, the Varial block, and the block that quotes a JavaScript SDK error.

Why this matters

Go readers had no example on these 13 pages. @ElliotFriend chose all four languages on every page in #1770.

Sweep

Not a claim fix, so no sweep. I checked the prose next to each new tab for text that named only JavaScript or Python, and updated it.

Verified

  • Every Go symbol, field and type against go-stellar-sdk v0.9.0, the newest release (2026-11-12): clients/rpcclient/main.go, protocols/rpc/*.go, txnbuild/*.go, xdr/xdr_generated.go, xdr/account_id.go, xdr/muxed_account.go, xdr/asset.go, strkey/main.go, amount/main.go, network/main.go. The pages pin no Go SDK version. go.mod of v0.9.0 needs Go 1.25, so the pages that list prerequisites say "Go 1.25 or later".
  • rpcclient.PollTransaction polls until the context ends (main.go:249-294), so the Go tabs bound it with context.WithTimeout and treat DeadlineExceeded as "unknown".
  • txnbuild.NewTransaction adds SorobanData.ResourceFee to the fee (transaction.go:902-926), so prepareTransaction only sets the operation's Ext and auth.
  • TransactionFromXDR copies the envelope's Soroban data into the parsed InvokeHostFunction.Ext (transaction.go:788-793), which the fee-payer step relies on.
  • @ElliotFriend compiled every Go block at 9084e7c, ran go vet and ran them on testnet.
  • pnpm check passes. pnpm check:links reports no broken links. prettier passes.

Not verified

  • The review fixes after 9084e7c did not run: the Go and JavaScript poll loops on upload-wasm-bytecode, the Go loop on invoke-contract-tx-sdk, and the fee-payer step on signing-soroban-invocations (JavaScript, Python, Go). Each was checked by hand against go-stellar-sdk v0.9.0, @stellar/stellar-sdk 17.4.0 and stellar-sdk (Python) 17.0.1.
  • authorizeEntry builds the ENVELOPE_TYPE_SOROBAN_AUTHORIZATION preimage and the {public_key, signature} signature map by hand, matching the JavaScript SDK's authorizeEntry. It signs only Address credentials, not AddressV2.
  • The signing guide's step 1 simulates with the same null source account the JavaScript SDK uses.

Overlaps

@stellar-doxie

stellar-doxie Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Automated message from the Stellar Triage Bot.

Reviewing my own PR, which the issue lane opened for #1770.

The Go tabs match go-stellar-sdk v0.9.0 (newest, out today), but no Go block was compiled or run. Should a maintainer run them before merge, or is the hand check enough? @kaankacar @ElliotFriend Merge #3115 first.

What I checked
  • Pushed 9084e7c: the Go comment in path-payments.mdx:245 said XLM goes "from the receiver to the sender". The code sends from the sender to the receiver. The JavaScript and Python tabs keep the old comment; I added them to Fix defects in existing code examples found while adding Python (#3115) #3119, as you asked in Add Python examples to the guides and learn pages that lacked them #3115.
  • Different from the PR body: "NOT_FOUND is reported as unknown" does not hold everywhere. The Go tabs on upload-wasm-bytecode and invoke-contract-tx-sdk poll with no limit, like the other tabs there. Listed in Fix defects in existing code examples found while adding Python (#3115) #3119.
  • Every symbol and field, by hand, against go-stellar-sdk v0.9.0 (5410d34): clients/rpcclient/main.go, protocols/rpc/*.go, txnbuild/transaction.go:812-930 (resource fee added to the fee), txnbuild/transaction.go:789-792 (parsed op keeps Ext), xdr/xdr_generated.go. go.mod needs Go 1.25, so "Go 1.25 or later" is right.
  • No prepareTransaction, auth-entry signer, ScValToNative or getAssetBalance in v0.9.0 (grep of the tree), so the prose that says so is right.
  • nullAccount matches NULL_ACCOUNT in js-stellar-sdk src/contract/types.ts:328. authorizeEntry signs only Address credentials, like js-stellar-base src/auth.js:122.
  • Imports checked per block: none unused, none missing. Tab order is JavaScript, Python, Go, Java.
  • Checks: checks, CodeQL and Socket passed at 6035c4e. They are running at 9084e7c (one comment word changed). Mintlify Deployment is skipped because the base is not main, so no live preview.
  • Sweep: not a claim fix. The prose next to each tab names Go where it named only JavaScript and Python.
  • Not run: every Go block on the 13 pages.

@ElliotFriend

Copy link
Copy Markdown
Contributor

one of the maintainers will compile and run the examples before merge. you can continue with the PR stack

@stellar-doxie stellar-doxie Bot added bot:ready-to-merge Bot verified and approved; waiting for a maintainer to merge and removed bot:needs-decision Bot needs a maintainer decision (listing, scope, policy) labels Nov 13, 2026
@stellar-doxie

stellar-doxie Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Automated message from the Stellar Triage Bot.

Back on this because @ElliotFriend replied.

Thanks. A maintainer runs the Go blocks before merge, so I moved this to ready-to-merge. Merge #3115 first. Go B comes next from the issue lane on #1770, stacked on this PR.

What I checked
  • Head is still 9084e7c, the commit my last review covered. No new pushes or review threads.
  • Checks at 9084e7c: checks, CodeQL and Socket pass. Mintlify Deployment is skipped because the base is not main, so no live preview.
  • The branch is 2 commits ahead of docs-agent/1770-python (2fbe36e, the current Add Python examples to the guides and learn pages that lacked them #3115 head) and 0 behind.
  • Not run: every Go block on the 13 pages (checked by hand against go-stellar-sdk v0.9.0). The maintainer runs them before merge.
  • Hold stellar/github-triage-bot#94 stays open for a maintainer to close.

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

Every Go block compiles against go-stellar-sdk v0.9.0, passes go vet, and ran on testnet. A few fixes before merge:

Code

  • upload-wasm-bytecode.mdx:391 and invoke-contract-tx-sdk.mdx:347: the poll loop never times out and ignores the SendTransaction status, so an ERROR send polls forever. Use the install-deploy-contract-with-code pattern (check the send status, cap the polls, then report "status unknown"). Fix the JavaScript tabs on these two pages the same way.
  • signing-soroban-invocations.mdx:947: BaseFee: clientTx.BaseFee() carries the client's resource fee, and prepareTransaction adds a new one (max fee 30,824 vs 11,817 stroops for Method 1). Bid the capped fee-stats p90 here, and in the JavaScript and Python tabs.

Prose and comments

  • Oxford comma: install-deploy-contract-with-code.mdx:8, :505, :565; signing-soroban-invocations.mdx:529; and the prepareTransaction doc comment ("resources, resource fee and authorization entries") on every page.
  • upload-wasm-bytecode.mdx:275: comma splice. Split it into two sentences.
  • install-deploy-contract-with-code.mdx:565: move "Run the Go version with go run main.go." next to the code it runs.

The missing testnet contract (invoke-contract-tx-sdk.mdx:265) and the unfunded account (automate-reset-data.mdx:998) affect every tab. A separate PR covers them, so leave them out of this one.

@stellar-doxie

stellar-doxie Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Automated message from the Stellar Triage Bot.

Back on this because @ElliotFriend requested changes.

All asks are done in 9b1d03d. Ready to merge after your re-review. Merge #3115 first.

What I checked
  • Poll loops: upload-wasm-bytecode (JavaScript, Go) and invoke-contract-tx-sdk (Go) now check the send status, poll at most 30 times, and report "status unknown". This is the install-deploy-contract-with-code pattern. The JavaScript tab on invoke-contract-tx-sdk uses signAndSend, so it has no loop.
  • Also fixed in the same JavaScript block: returnValue.bytes() throws on @stellar/stellar-sdk 17.4.0, because bytes is a property there (lib/esm/xdr/generated/sc-val.d.ts:350). The hash now comes from scValToNative (src/base/scval.ts:483). Say if you want this out.
  • Not changed: the Python tabs on both pages and the Java tab on invoke-contract-tx-sdk poll the same way. Items 8 and 9 of Fix defects in existing code examples found while adding Python (#3115) #3119 track them. Say if you want them in this PR.
  • Step 2 fee: the JavaScript, Python and Go tabs now bid the capped fee-stats p90. The client's fee already holds its resource fee:
    • JS assembleTransaction subtracts only the rebuilt transaction's resource fee, then adds the new one (js-stellar-sdk v17.4.0 src/rpc/transaction.ts:88-91).
    • Python _assemble_transaction does the same (stellar-sdk 17.0.1 base_soroban_server.py:151-156).
    • Go TransactionFromXDR sets BaseFee() to the whole envelope fee (go-stellar-sdk v0.9.0 txnbuild/transaction.go:757-761).
  • Oxford commas at the lines you named, and in the prepareTransaction doc comment on all five pages. Comma splice split. The go run line now follows the "Running the Script" code.
  • Left out, as you asked: the missing testnet contract and the unfunded account.
  • The stacked PRs Add Go examples to the archival, conventions, rpc, conversions and events guides #3124 to Add Go examples to the tokens and Horizon error and pagination pages #3126 add the same doc comment without the comma on five more pages: restore-data, deploy-sac-with-code, stellar-transaction, state-archival and cross-chain-transfers. Their reviews need the same fix.
  • Checks at 9b1d03d: checks, CodeQL and Socket pass. Mintlify Deployment skips because the base is not main, so no live preview.
  • Not run: the changed JavaScript, Python and Go blocks. I checked them by hand against the newest releases: @stellar/stellar-sdk 17.4.0, stellar-sdk (Python) 17.0.1 and go-stellar-sdk v0.9.0.
  • Your CHANGES_REQUESTED review stays until you clear it. Hold stellar/github-triage-bot#94 stays open for you to close.

Base automatically changed from docs-agent/1770-python to main November 13, 2026 14:35
…, Oxford commas

- upload-wasm-bytecode (JavaScript, Go) and invoke-contract-tx-sdk (Go):
  check the sendTransaction status, poll at most 30 times, and report
  NOT_FOUND as status unknown, like install-deploy-contract-with-code.
- upload-wasm-bytecode (JavaScript): read the Wasm hash with
  scValToNative, since ScVal.bytes is a property in stellar-sdk v17.
- signing-soroban-invocations step 2 (JavaScript, Python, Go): bid the
  capped fee-stats p90 instead of the client's fee, which already
  includes the client's resource fee.
- Oxford commas and a comma splice; move the go run line next to the
  code it runs.
@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, 2:37 PM

@stellar-doxie

stellar-doxie Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Automated message from the Stellar Triage Bot.

Back on this because #3115 merged and the stack moved this PR onto main.

The rebase changed no content, checks pass, and the live preview serves all 13 pages. Not run: the review fixes after 9084e7c (Go and JavaScript poll loops on upload-wasm-bytecode, Go loop on invoke-contract-tx-sdk, fee-payer step on signing-soroban-invocations). @ElliotFriend, your change request stays until you clear it. Ready to merge.

What I checked
  • git range-diff of 2fbe36e..9b1d03d against 8e9c5c1..9918ea4: all 3 commits are identical. The tree diff between the two heads touches only files from main, none of the 13 pages.
  • Branch is 3 commits ahead of main, 0 behind.
  • Checks at 9918ea4: checks, CodeQL, Socket and Mintlify Deployment pass. mint broken-links: no broken links.
  • Preview: all 13 pages return 200. The .md twins serve the Go tabs and the review fixes.
  • Your asks, at this head: send status checked and 30-poll cap in upload-wasm-bytecode.mdx:106-136 (JavaScript) and :393-430 (Go), and invoke-contract-tx-sdk.mdx:339-371 (Go). Capped fee-stats p90 in the fee-payer step (signing-soroban-invocations.mdx:952-967). No tab in docs/ reuses the client's fee. No "resource fee and" left without the Oxford comma.
  • Checked against go-stellar-sdk v0.9.0 (newest): SendTransactionResponse.Status is a string, FeeDistribution.P90 is uint64 (protocols/rpc/*.go). The pages pin no Go SDK version.
  • PR body updated: base is main, what you ran at 9084e7c, and what has not run since.
  • Not in this PR (existing 2024 JavaScript code): automate-reset-data.mdx:244 calls status.returnValue.bytes(), which throws on @stellar/stellar-sdk 17.4.0 because bytes is a property. Fix defects in existing code examples found while adding Python (#3115) #3119 is bot:hands-off, so I did not add it there.
  • Hold stellar/github-triage-bot#94 is still open for a maintainer to close.

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

Thanks! Every point from my review is fixed. I re-ran the changed code on testnet against go-stellar-sdk v0.9.0 and @stellar/stellar-sdk 17.4.0:

  • upload-wasm-bytecode: the Go and JavaScript tabs both upload, and the printed Wasm hash matches shasum of the file.
  • invoke-contract-tx-sdk: the bounded Go poll loop returns SUCCESS (run against my own deploy of the auth contract, since the page's contract is gone; see #3128).
  • signing-soroban-invocations Method 2: the fee-payer step now bids the capped p90. Max fee dropped from 30,824 to 13,244 stroops, and the transaction succeeded.
Not run

The matching Python fee change in step 2. It uses the same get_fee_stats().soroban_inclusion_fee.p90 pattern as other Python tabs on main.

@ElliotFriend
ElliotFriend merged commit 111e2f7 into main Nov 13, 2026
8 checks passed
@ElliotFriend
ElliotFriend deleted the docs-agent/1770-go-a branch November 13, 2026 16:16

This branch was successfully deployed

1 active deployment
staging — 9918ea48 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