chore(docs): small style and comments changes and fixes

This commit is contained in:
banasa44
2025-07-22 17:08:38 +02:00
parent 2aa7d5f4cc
commit 79ed25b125
4 changed files with 31 additions and 4 deletions

View File

@@ -21,4 +21,6 @@ func main() {
panic(err) panic(err)
} }
// ... custom code goes here
} }

View File

@@ -9,7 +9,8 @@ import (
func main() { func main() {
// Define the network client // 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) // Disconnect the client when done. (Defer executes at the end of the function)
defer client.Disconnect() defer client.Disconnect()

View File

@@ -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: 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" /%} 1. Via `websocket`:
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" /%} ```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 #### Connect to the production XRP Ledger

View File

@@ -1,5 +1,5 @@
--- ---
html: build-apps-with-golang.html html: build-apps-in-golang.html
parent: golang.html parent: golang.html
top_nav_grouping: Article Types top_nav_grouping: Article Types
metadata: metadata: