mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-16 09:45:51 +00:00
chore(docs): small style and comments changes and fixes
This commit is contained in:
@@ -21,4 +21,6 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ... custom code goes here
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user