Repository navigation
Add Go examples to the learn pages - #3125
Open
stellar-triage-bot[bot] wants to merge 2 commits into
Open
stellar-triage-bot[bot] wants to merge 2 commits into
stellar-triage-bot[bot] wants to merge 2 commits into
Conversation
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.
Contributor
Author
|
🤖 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
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 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.Not verified
goneeds approval in this lane. A maintainer runs the Go blocks before merge, as @ElliotFriend said on Add Go examples to the transactions and basics guides #3123.main(stacked PR).Overlaps
transaction-simulation,state-archival,fees-resource-limits-metering,events). Merge Add Python examples to the guides and learn pages that lacked them #3115, Add Go examples to the transactions and basics guides #3123 and Add Go examples to the archival, conventions, rpc, conversions and events guides #3124 first, then this PR.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.