Repository navigation
Add Go examples to the tokens and Horizon error and pagination pages - #3126
Conversation
|
🤖 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 What I checked
|
ElliotFriend
left a comment
There was a problem hiding this comment.
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,:501to:503:errfromNewTransactionandAccountDetailis overwritten unchecked, so a failed build passesniltoSubmitTransactionand 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.Gethas no timeout, while the Python tab uses 30 seconds. Use&http.Client{Timeout: 30 * time.Second}, and checkStatusCodeat:628.
Prose and comments
- Oxford comma in the
prepareTransactiondoc comment atcross-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.
282a55c to
cc611b7
Compare
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.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
cc611b7 to
734e5a8
Compare
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.
|
🤖 Automated message from the Stellar Triage Bot. Back on this because @ElliotFriend requested changes. Done in d4e88a9, all four asks: every What I checked
|
ElliotFriend
left a comment
There was a problem hiding this comment.
The fixes look good. Thanks!
🤖 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 Horizonerrorsandpaginationpages (6 pages). Base:main(#3115, #3123, #3124 and #3125 have merged). Java A to D follow.What changed
tokens/quickstart: issue an asset in one transaction (Friendbot,ChangeTrust,Payment).tokens/control-asset-access:SetOptionswithAuthRequiredandAuthRevocable. 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, thendeposit_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 bashcurlblock has no SDK code, so it stays as it is.horizon/api-reference/structure/paginationandpage-arguments: one example each.SorobanInclusionFee.prepareTransaction. Where a page needs one, the Go tab defines a small helper and says so in a comment.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-transfersline 140 did, and it now names Go too.Verified
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 asyncERRORstatus decodes into the response, not an error).txnbuild:transaction.go(NewTransactionadds the SorobanResourceFeeto the fee;Timebounds()),timebounds.go(TimeoutInfinite),set_options.go,change_trust.go,payment.go,asset.go.clients/rpcclient/main.go:PollTransactionpolls 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).minimumFeeandforwardFee.med(/v2/burn/USDC/fees/27/6?forward=true).pnpm checkpasses: prettier,mint validate, no broken links.Not verified
goneeds 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
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.error-handling.mdx, JavaScript time-bounds example: it comparesDate.now()(milliseconds) withmaxTime(seconds). So it always reports a timeout and never retries. Python and Go compare seconds.time.sleep(5 * time.Second), readsresultoutside its.then, never definesaccount, and sends a contract call withoutprepareTransaction.Horizon.Server(...)is called withoutnew.quickstart.mdx: the JavaScript tab prints the issuer keys under "destination account keys". The Python tab labels the destination keys "issuer keys", and it defineshorion_urlbut never uses it.page-arguments.mdx: ledger26478723and its cursor return 404 on testnet today, after testnet resets. Every tab and the sample response use them.publishing-asset-info.mdx(not in this PR): the Go tab setsHomeDomain: "yourdomain.com". The field is*string, so it needstxnbuild.NewHomeDomain("yourdomain.com").