From 79ed25b125b1aa7c444e150019ddec1951c0643a Mon Sep 17 00:00:00 2001 From: banasa44 Date: Tue, 22 Jul 2025 17:08:38 +0200 Subject: [PATCH] chore(docs): small style and comments changes and fixes --- _code-samples/get-started/go/base/rpc/main.go | 2 ++ _code-samples/get-started/go/base/ws/main.go | 3 +- docs/tutorials/go/build-apps/get-started.md | 28 +++++++++++++++++-- docs/tutorials/go/build-apps/index.md | 2 +- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/_code-samples/get-started/go/base/rpc/main.go b/_code-samples/get-started/go/base/rpc/main.go index 61ec4c0101..e463386254 100644 --- a/_code-samples/get-started/go/base/rpc/main.go +++ b/_code-samples/get-started/go/base/rpc/main.go @@ -21,4 +21,6 @@ func main() { panic(err) } + // ... custom code goes here + } diff --git a/_code-samples/get-started/go/base/ws/main.go b/_code-samples/get-started/go/base/ws/main.go index 1d16541391..dad84126f1 100644 --- a/_code-samples/get-started/go/base/ws/main.go +++ b/_code-samples/get-started/go/base/ws/main.go @@ -9,7 +9,8 @@ import ( func main() { // Define the network client - client := websocket.NewClient(websocket.NewClientConfig().WithHost("wss://s.altnet.rippletest.net:51233")) + client := websocket.NewClient(websocket.NewClientConfig(). + WithHost("wss://s.altnet.rippletest.net:51233")) // Disconnect the client when done. (Defer executes at the end of the function) defer client.Disconnect() diff --git a/docs/tutorials/go/build-apps/get-started.md b/docs/tutorials/go/build-apps/get-started.md index 631201a446..3c956b0bc8 100644 --- a/docs/tutorials/go/build-apps/get-started.md +++ b/docs/tutorials/go/build-apps/get-started.md @@ -61,8 +61,32 @@ Here are the basic steps you'll need to cover for almost any XRP Ledger project: To make queries and submit transactions, you need to connect to the XRP Ledger. To do this with `xrpl-go`, you have two main options: -1. Via `websocket`: {% code-snippet file="/_code-samples/get-started/go/base/ws/main.go from="// Define the network client" before="// ... custom code goes here" language="go" /%} -2. Via `RPC`: {% code-snippet file="/_code-samples/get-started/go/base/rpc/main.go from="// Define the network client" before="// Ping the network (used to avoid Go unused variable error, but useful to check connectivity)" language="go" /%} +1. Via `websocket`: + ```go + // Define the network client + client := websocket.NewClient(websocket.NewClientConfig(). + WithHost("wss://s.altnet.rippletest.net:51233")) + + // Disconnect the client when done. (Defer executes at the end of the function) + defer client.Disconnect() + + // Connect to the network + if err := client.Connect(); err != nil { + fmt.Println(err) + return + } + ``` +2. Via `RPC`: + ```go + cfg, err := rpc.NewClientConfig("https://s.altnet.rippletest.net:51234/") + if err != nil { + panic(err) + } + + // Initiate the network client + client := rpc.NewClient(cfg) + ``` + #### Connect to the production XRP Ledger diff --git a/docs/tutorials/go/build-apps/index.md b/docs/tutorials/go/build-apps/index.md index 0b3ee02541..d2d4fd8edd 100644 --- a/docs/tutorials/go/build-apps/index.md +++ b/docs/tutorials/go/build-apps/index.md @@ -1,5 +1,5 @@ --- -html: build-apps-with-golang.html +html: build-apps-in-golang.html parent: golang.html top_nav_grouping: Article Types metadata: