Skip to content

Add Go examples to the tokens and Horizon error and pagination pages - #3126

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

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

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 Go and Java splits in #1770 and asked me to keep building the stack. This is Go D, the last Go PR: Go tabs on tokens/ and the Horizon errors and pagination pages (6 pages). Base: main (#3115, #3123, #3124 and #3125 have merged). Java A to D follow.

What changed

  • A Go tab next to every Stellar SDK example on these 6 pages:
    • tokens/quickstart: issue an asset in one transaction (Friendbot, ChangeTrust, Payment).
    • tokens/control-asset-access: SetOptions with AuthRequired and AuthRevocable. Tabs now in the order JavaScript, Python, Go, Java (Java moved after Python, byte for byte).
    • tokens/cross-chain-transfers: the full CCTP worked example (approve, then deposit_for_burn_with_hook, fee quote, attestation polling). The line above it now names the Go SDK version too.
    • horizon/api-reference/errors/error-handling: all 3 SDK examples (async submit, time bounds, bad sequence). The bash curl block has no SDK code, so it stays as it is.
    • horizon/api-reference/structure/pagination and page-arguments: one example each.
  • Every transaction bids the capped fee-stats p90, like the other tabs. Soroban calls bid SorobanInclusionFee.
  • The Go SDK has no prepareTransaction. Where a page needs one, the Go tab defines a small helper and says so in a comment.
  • The Go time-bounds and bad-sequence tabs are fragments, like the JavaScript and Python tabs next to them.
  • After review: the bad-sequence fragment checks every err, Go error strings are lowercase, and the CCTP example uses an HTTP client with a 30-second timeout and checks the fee quote status.

Why this matters

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

Sweep

Not a claim fix, so no sweep. I checked the prose on each page for text that names only some languages. Only cross-chain-transfers line 140 did, and it now names Go too.

Verified

  • Every Go symbol, field and type against go-stellar-sdk v0.9.0, the newest release (2026-11-12). The pages pin no Go SDK version.
    • clients/horizonclient: client.go (AccountDetail, FeeStats, Operations, Transactions, NextTransactionsPage, TransactionDetail, SubmitTransaction, AsyncSubmitTransaction), main.go (DefaultTestNetClient, OperationRequest, TransactionRequest, OrderAsc), error.go (ResultCodes), error_helpers.go (GetError, IsNotFoundError), internal.go (an async ERROR status decodes into the response, not an error).
    • txnbuild: transaction.go (NewTransaction adds the Soroban ResourceFee to the fee; Timebounds()), timebounds.go (TimeoutInfinite), set_options.go, change_trust.go, payment.go, asset.go.
    • clients/rpcclient/main.go: PollTransaction polls until its context ends, so the Go tab sets a 30-second deadline and reports "not found yet" when it passes.
    • protocols/rpc: get_fee_stats.go (SorobanInclusionFee.P90, uint64), get_latest_ledger.go, send_transaction.go.
    • protocols/horizon/main.go: Account, Transaction.Hash, AsyncTransactionSubmissionResponse, TransactionResultCodes, FeeDistribution.P90 (int64).
    • xdr: xdr_generated.go (ScVal, Int128Parts, ScBytes, ContractId, InvokeContractArgs), account_id.go (MustAddressPtr).
  • The Circle sandbox fee API returns numbers: minimumFee and forwardFee.med (/v2/burn/USDC/fees/27/6?forward=true).
  • pnpm check passes: prettier, mint validate, no broken links.

Not verified

  • The Go code did not compile or run in this lane. go needs approval here. @ElliotFriend compiled and ran the Go blocks at 282a55c; the review fixes after that are small and use only the standard library.

Overlaps

  • No other open PR edits these pages.

Found in passing, not fixed here

#3119 collects defects in existing code, but it carries bot:hands-off, so I did not post there. A maintainer can move these to it.

  1. error-handling.mdx, JavaScript time-bounds example: it compares Date.now() (milliseconds) with maxTime (seconds). So it always reports a timeout and never retries. Python and Go compare seconds.
  2. Same page, JavaScript async example: it calls time.sleep(5 * time.Second), reads result outside its .then, never defines account, and sends a contract call without prepareTransaction.
  3. Same page, JavaScript time-bounds example: Horizon.Server(...) is called without new.
  4. quickstart.mdx: the JavaScript tab prints the issuer keys under "destination account keys". The Python tab labels the destination keys "issuer keys", and it defines horion_url but never uses it.
  5. page-arguments.mdx: ledger 26478723 and its cursor return 404 on testnet today, after testnet resets. Every tab and the sample response use them.
  6. publishing-asset-info.mdx (not in this PR): the Go tab sets HomeDomain: "yourdomain.com". The field is *string, so it needs txnbuild.NewHomeDomain("yourdomain.com").

@stellar-doxie
stellar-doxie Bot added this pull request to stack #3118 November 13, 2026 12:06
@stellar-doxie stellar-doxie Bot added the bot:ready-to-merge Bot verified and approved; waiting for a maintainer to merge label 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.

Reviewing because the issue lane opened this PR for #1770.

Verified: the Go tabs match go-stellar-sdk v0.9.0 (newest; the pages pin none), and CI is green at 282a55c. I pushed one fix: the Go async example now stops on ERROR and TRY_AGAIN_LATER instead of polling.
Not run: the Go blocks on all 6 pages, so a maintainer runs them before merge. No live preview: this stacked PR skips the Mintlify build. Merge #3115, #3123, #3124 and #3125 first. Ready to merge.

What I checked
  • Added by this review: [email protected] clients/horizonclient/internal.go decodeAsyncTxSubResponse returns ERROR, DUPLICATE and TRY_AGAIN_LATER replies with a nil error. The Go async tab polled after an ERROR and printed "Poll again later". Fixed in 282a55c (error-handling.mdx).
  • Symbols re-checked at [email protected]: clients/horizonclient (client.go, main.go: OperationRequest.ForLedger is uint), clients/rpcclient/main.go (LoadAccount, PollTransaction), protocols/rpc (AuthXDR *[]string, Sequence uint32, SorobanInclusionFee.P90 uint64), protocols/horizon/main.go (FeeCharged.P90 int64, TxStatus), txnbuild (ChangeTrust limit defaults to max, Timebounds(), TimeoutInfinite). go.mod says go 1.25.0, so the builtin min works.
  • Every import in each full Go program is used (hand audit).
  • Circle sandbox, curl /v2/burn/USDC/fees/27/6?forward=true on 2026-11-13: minimumFee 0 and forwardFee.med 53077 are numbers, so the *int64 decode works.
  • The CCTP Go flow matches the TypeScript and Python tabs step by step.
  • Tab order on all 6 pages: JavaScript, Python, Go, Java. The Java block in control-asset-access.mdx moved unchanged.
  • Sweep: only cross-chain-transfers.mdx:140 named languages in prose, and this PR updates it.
  • Checks at 282a55c: checks, CodeQL, Socket pass. Mintlify Deployment skipped (base is not main).
  • pnpm check not run in this lane. The fix is inside a Go fence, which prettier does not format, and CI checks passed after the push.
  • The defects in existing code listed in the PR body stay there, since Fix defects in existing code examples found while adding Python (#3115) #3119 carries bot:hands-off.

@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 small fixes before merge:

Code

  • error-handling.mdx:496, :501 to :503: err from NewTransaction and AccountDetail is overwritten unchecked, so a failed build passes nil to SubmitTransaction and panics. Check each error, or add a comment that error handling is left out.
  • error-handling.mdx:425, :443: Go error strings should start lowercase and have no trailing punctuation.
  • cross-chain-transfers.mdx:628, :675: http.Get has no timeout, while the Python tab uses 30 seconds. Use &http.Client{Timeout: 30 * time.Second}, and check StatusCode at :628.

Prose and comments

  • Oxford comma in the prepareTransaction doc comment at cross-chain-transfers.mdx:584.

The removed contract in error-handling.mdx and the out-of-range ledger in page-arguments.mdx affect every tab. A separate PR covers them, so leave them out of this one.

Base automatically changed from docs-agent/1770-go-c to main November 13, 2026 16:16
Adds a Go tab next to every Stellar SDK example on tokens/quickstart, tokens/control-asset-access, tokens/cross-chain-transfers and the Horizon error-handling and pagination pages. control-asset-access now orders its tabs JavaScript, Python, Go, Java.
@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, 4:23 PM

Addresses review feedback: check every err in the Go bad-sequence example, lowercase the Go error strings, use an HTTP client with a 30-second timeout and check the fee quote status in the CCTP example, and add an Oxford comma to the prepareTransaction doc comment.
@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.

Done in d4e88a9, all four asks: every err is checked in the bad-sequence fragment, Go error strings are lowercase, the CCTP example uses a 30-second HTTP client and checks the fee quote status, and the doc comment has the Oxford comma.
Not run: the 4 fixes (standard library only). Your earlier run covered the rest. Checks and the preview pass at d4e88a9. Your change request still blocks the merge until you re-review. Ready to merge.

What I checked

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

The fixes look good. Thanks!

@ElliotFriend
ElliotFriend merged commit 04445ae into main Nov 13, 2026
8 checks passed
@ElliotFriend
ElliotFriend deleted the docs-agent/1770-go-d branch November 13, 2026 19:26

This branch was successfully deployed

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