Repository navigation
Add Go examples to the learn pages - #3125
Conversation
|
🤖 Automated message from the Stellar Triage Bot. Reviewing because I opened this PR for #1770. Verified: every Go symbol matches go-stellar-sdk v0.9.0, and 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. No code changes needed. Small prose fixes before merge:
- Oxford comma:
stellar-transaction.mdx:10;events.mdx:190;xdr.mdx:154;transaction-simulation.mdx:547;liquidity-on-stellar-sdex-liquidity-pools.mdx:321; and theprepareTransaction/assembleTransactiondoc comments ("resources, resource fee and authorization entries"). xdr.mdx:174: "Stellar Network" should be "Stellar network" (CONTRIBUTING terminology).stellar-transaction.mdx:10: since this line changes anyway, make theincrement examplelink root-relative (/docs/build/smart-contracts/getting-started/storing-data).
The increment contract at stellar-transaction.mdx:246 no longer exists on testnet. That affects every tab, and a separate PR covers it, so leave it out of this one.
|
🤖 Automated message from the Stellar Triage Bot. Back on this because @ElliotFriend requested changes. Done in b22b3b5: every prose fix from your review. What I checked
|
Go tabs on the 8 learn/ pages that had JavaScript, Python or Java examples but no Go: assets, events, XDR, fees, liquidity pools, state archival, transaction simulation and the Stellar transaction page.
…nt link, note the single-operation helpers
b22b3b5 to
4262104
Compare
|
🤖 Automated message from the Stellar Triage Bot. Back on this because @ElliotFriend rebased the stack after #3115 merged. The rebase changed nothing on these 8 pages, and all checks pass. Ready to merge after #3123 and #3124. Your changes-requested review still needs clearing. What I checked
|
ElliotFriend
left a comment
There was a problem hiding this comment.
Thanks! Every point from my review is fixed: the Oxford commas, "Stellar network", and the root-relative increment link. The code changes are comment-only, so the earlier compile and testnet results still hold.
🤖 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 C: Go tabs on the 8
learn/pages. Base: #3124 (docs-agent/1770-go-b). Go D and Java A to D follow.What changed
learn/fundamentals/:stellar-data-structures/assets: tabs now in the order JavaScript, Python, Go, Java (Java moved after Python).stellar-data-structures/events: the Go listener asks RPC forxdrFormat: "json", because the Go SDK has noscValToNative.data-format/xdr: Go for theUint64primitive, theScAddressunion switch andScAddress.String(). The PythonUint64block moved into a code group with Go.fees-resource-limits-metering: Go fee bump.liquidity-on-stellar-sdex-liquidity-pools: all 6 code groups. Amounts stay in stroops (big.Rat,big.Int), and prices go throughprice.Parse.contract-development/storage/state-archival: the same Go code as the reviewed archival guides in Add Go examples to the archival, conventions, rpc, conversions and events guides #3124.contract-development/contract-interactions/transaction-simulation: all 3 examples.contract-development/contract-interactions/stellar-transaction: a Go tab in<Tabs>, between Python and Java.prepareTransactionand no auth-entry signer. Where a page needs one, the Go tab defines a small helper and says so in a comment.xdr,state-archival).Why this matters
Go readers had no example on these 8 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
txnbuild:transaction.go(NewTransaction,NewFeeBumpTransaction,FeeBumpTransactionParams;BaseFee()returns the bid without the resource fee, L220, L829),asset.go,change_trust.go,change_trust_asset.go,liquidity_pool_{deposit,withdraw,id,parameters}.go,payment.go.clients/horizonclient:client.go(FeeStats,AccountDetail,LiquidityPoolDetail,Operations,SubmitTransaction,SubmitFeeBumpTransaction),main.go,liquidity_pool_request.go.protocols/horizon:Balance,LiquidityPool,LiquidityPoolReserve,FeeDistribution.P90(int64).operations/main.gounmarshals a deposit as the value typeLiquidityPoolDeposit(L629-634).clients/rpcclient/main.go:PollTransactionpolls until its context ends (L242-294), so the Go tab sets a 30-second deadline and reports "status unknown" when it passes.protocols/rpc:get_events.go(a cursor and a start ledger cannot both be set, L168-174),cursor.go(ParseCursor),format.go(FormatJSON),simulate_transaction.go,send_transaction.go,get_transaction.go.xdr:xdr_generated.go(ScAddressarms,SorobanCredentialsTypeSorobanCredentialsAddressV2,HashIdPreimageSorobanAuthorizationWithAddress,Uint64),scval.go(ScAddress.String),asset.go(Asset.ContractID),main.go(MarshalBase64).price/main.go(Parse),amount/main.go(ParseInt64,StringFromInt64),keypair/main.go(MustParseFull,MustRandom),strkey/main.go(MustEncode).authorizeEntryontransaction-simulationsigns both legacy and V2 address credentials, like the JavaScript and Python tabs there. V2 signs theENVELOPE_TYPE_SOROBAN_AUTHORIZATION_WITH_ADDRESSpreimage, which also holds the address, the same as py-stellar-base 17.0.1stellar_sdk/auth.pybuild_authorization_preimage.pnpm checkpasses: prettier,mint validate, no broken links.go vet, and ran them on testnet (review on a4e5cc0). The later commit changes only prose and code comments.checks, CodeQL, Socket) passes at the current head.Not verified
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.liquidity-on-stellar-sdex-liquidity-pools.mdx(prose under the preamble): it says the two funded accounts arekp2andkp3. The code names themkps[1]andkps[2](kp1andkp2).main(): it deposits from all three keypairs, the issuerkp0too. Python, and now Go, deposit fromkp1andkp2only.stellar-transaction.mdx: the JavaScript and Java tabs call contractCBEOJUP5…KZW6, the Python tabCDMARRPK…5U73. The Go tab uses the JavaScript one.signing-soroban-invocations.mdx: its GoauthorizeEntrysigns only legacy address credentials. Testnet runs Protocol 30, so simulation can return V2 entries that it skips. This PR'stransaction-simulationGo tab handles both. I can port that to Add Go examples to the transactions and basics guides #3123 if you want it there.