Apply suggestions from code review

Co-authored-by: Maria Shodunke <maria-robobug@users.noreply.github.com>
Co-authored-by: oeggert <117319296+oeggert@users.noreply.github.com>
This commit is contained in:
Carles
2025-08-25 10:58:26 +02:00
committed by GitHub
parent e1153eb008
commit 22d67e640d
12 changed files with 69 additions and 95 deletions

View File

@@ -8,4 +8,4 @@ For more context, see the Get Started tutorial for your preferred language:
- [Java](https://xrpl.org/get-started-using-java.html) - [Java](https://xrpl.org/get-started-using-java.html)
- [JavaScript](https://xrpl.org/get-started-using-javascript.html) - [JavaScript](https://xrpl.org/get-started-using-javascript.html)
- [PHP](https://xrpl.org/get-started-using-php.html) - [PHP](https://xrpl.org/get-started-using-php.html)
- [GoLang](https://xrpl.org/get-started-using-golang.html) - [Go](https://xrpl.org/get-started-using-go.html)

View File

@@ -7,7 +7,10 @@ import (
func main() { func main() {
// Define the network client configuration // Define the network client configuration
cfg, err := rpc.NewClientConfig("https://s.altnet.rippletest.net:51234/") cfg, err := rpc.NewClientConfig(
"https://s.altnet.rippletest.net:51234/",
rpc.WithFaucetProvider(faucet.NewTestnetFaucetProvider()),
)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

@@ -9,8 +9,10 @@ import (
func main() { func main() {
// Define the network client // Define the network client
client := websocket.NewClient(websocket.NewClientConfig(). client := websocket.NewClient(websocket.NewClientConfig().
WithHost("wss://s.altnet.rippletest.net:51233")) WithHost("wss://s.altnet.rippletest.net:51233").
WithFaucetProvider(faucet.NewTestnetFaucetProvider()),
)
// 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

@@ -337,17 +337,7 @@ export default function Docs() {
<div className="col langs"> <div className="col langs">
<Link to="/docs/tutorials/go/"> <Link to="/docs/tutorials/go/">
<img <img
alt="GoLang Logo" alt="Go Logo"
src={require("../static/img/logos/golang.svg")}
className="circled-logo"
/>
<h5 className="btn-arrow">{translate("GoLang")}</h5>
</Link>
</div>
<div className="col langs">
<Link to="/docs/tutorials/go/">
<img
alt="GoLang Logo"
src={require("../static/img/logos/golang.svg")} src={require("../static/img/logos/golang.svg")}
className="circled-logo" className="circled-logo"
/> />

View File

@@ -13,7 +13,7 @@ For other programming languages, you can access the XRP Ledger through the [HTTP
| Language | Library Name | Get Started | API Reference | Source Code | | Language | Library Name | Get Started | API Reference | Source Code |
|---------------------------------|---------------------------|-------------|--------------|-------------| |---------------------------------|---------------------------|-------------|--------------|-------------|
| **Python** | `xrpl-py` | [Get Started Using Python](../tutorials/python/build-apps/get-started.md) | [API Reference](https://xrpl-py.readthedocs.io/) | [Repo](https://github.com/XRPLF/xrpl-py) | | **Python** | `xrpl-py` | [Get Started Using Python](../tutorials/python/build-apps/get-started.md) | [API Reference](https://xrpl-py.readthedocs.io/) | [Repo](https://github.com/XRPLF/xrpl-py) |
| **GoLang** | `xrpl-go` | [Get Started Using Go](../tutorials/go/build-apps/get-started.md) | [API Reference](https://pkg.go.dev/github.com/Peersyst/xrpl-go) | [Repo](https://github.com/Peersyst/xrpl-go) | | **Go** | `xrpl-go` | [Get Started Using Go](../tutorials/go/build-apps/get-started.md) | [API Reference](https://pkg.go.dev/github.com/Peersyst/xrpl-go) | [Repo](https://github.com/Peersyst/xrpl-go) |
| **JavaScript** / **TypeScript** | `xrpl.js` | [Get Started](../tutorials/javascript/build-apps/get-started.md) | [API Reference](https://js.xrpl.org/) | [Repo](https://github.com/XRPLF/xrpl.js) | | **JavaScript** / **TypeScript** | `xrpl.js` | [Get Started](../tutorials/javascript/build-apps/get-started.md) | [API Reference](https://js.xrpl.org/) | [Repo](https://github.com/XRPLF/xrpl.js) |
| **JavaScript** / **TypeScript** | `xrpl-client` | [Get Started](https://jsfiddle.net/WietseWind/35az6p1b/) | [NPM Reference](https://www.npmjs.com/package/xrpl-client) | [Repo](https://github.com/XRPL-Labs/xrpl-client) | | **JavaScript** / **TypeScript** | `xrpl-client` | [Get Started](https://jsfiddle.net/WietseWind/35az6p1b/) | [NPM Reference](https://www.npmjs.com/package/xrpl-client) | [Repo](https://github.com/XRPL-Labs/xrpl-client) |
| **JavaScript** / **TypeScript** | `xrpl-accountlib` | [Get Started](https://jsfiddle.net/WietseWind/gkefpnu0/) | [NPM Reference](https://www.npmjs.com/package/xrpl-accountlib) | [Repo](https://github.com/WietseWind/xrpl-accountlib) | | **JavaScript** / **TypeScript** | `xrpl-accountlib` | [Get Started](https://jsfiddle.net/WietseWind/gkefpnu0/) | [NPM Reference](https://www.npmjs.com/package/xrpl-accountlib) | [Repo](https://github.com/WietseWind/xrpl-accountlib) |

View File

@@ -16,7 +16,7 @@ Use these libraries to access the XRP Ledger from your programming language of c
{% xrpl-card title="Python" body="xrpl.py - a pure Python library" href="https://xrpl-py.readthedocs.io/" image="/img/logos/python.svg" imageAlt="Python logo" /%} {% xrpl-card title="Python" body="xrpl.py - a pure Python library" href="https://xrpl-py.readthedocs.io/" image="/img/logos/python.svg" imageAlt="Python logo" /%}
{% xrpl-card title="GoLang" body="xrpl.go - a pure GoLang library" href="https://pkg.go.dev/github.com/Peersyst/xrpl-go" image="/img/logos/golang.svg" imageAlt="GoLang logo" /%} {% xrpl-card title="Go" body="xrpl.go - a pure Go library" href="https://pkg.go.dev/github.com/Peersyst/xrpl-go" image="/img/logos/golang.svg" imageAlt="Go logo" /%}
{% xrpl-card title="Java" body="xrpl4j - a pure Java library" href="https://javadoc.io/doc/org.xrpl/" image="/img/logos/java.svg" imageAlt="Java logo" /%} {% xrpl-card title="Java" body="xrpl4j - a pure Java library" href="https://javadoc.io/doc/org.xrpl/" image="/img/logos/java.svg" imageAlt="Java logo" /%}

View File

@@ -1,21 +1,13 @@
--- ---
html: get-started-using-golang-library.html
parent: golang.html
funnel: Build
doc_type: Tutorials
category: Get Started
seo: seo:
description: Build a GoLang application that interacts with the XRP Ledger. description: Build a Go application that interacts with the XRP Ledger.
top_nav_name: GoLang
top_nav_grouping: Get Started
labels: labels:
- Development - Development
showcase_icon: assets/img/logos/golang.svg
--- ---
# Get Started Using GoLang Library # Get Started Using Go Library
This tutorial walks you through the basics of building an XRP Ledger-connected application using [`xrpl-go`](https://github.com/Peersyst/xrpl-go), a pure GoLang library built to interact with the XRP Ledger. This tutorial walks you through the basics of building an XRP Ledger-connected application using [`xrpl-go`](https://github.com/Peersyst/xrpl-go), a pure Go library built to interact with the XRP Ledger.
This tutorial is intended for beginners and should take no longer than 30 minutes to complete. This tutorial is intended for beginners and should take no longer than 30 minutes to complete.
@@ -30,8 +22,8 @@ In this tutorial, you'll learn:
## Requirements ## Requirements
Requiring Go version `1.22.0` and later. To follow this tutorial, you should have Go version `1.22.0` or later installed.
[Download latest Go version](https://go.dev/dl/) [Download latest Go version](https://go.dev/dl/).
## Installation ## Installation
@@ -53,15 +45,15 @@ When you're working with the XRP Ledger, there are a few things you'll need to m
Here are the basic steps you'll need to cover for almost any XRP Ledger project: Here are the basic steps you'll need to cover for almost any XRP Ledger project:
1. [Connect to the XRP Ledger.](#1-connect-to-the-xrp-ledger) 1. [Connect to the XRP Ledger.](#1.-connect-to-the-xrp-ledger)
1. [Get an account.](#2-get-account) 2. [Get an account.](#2.-get-account)
1. [Query the XRP Ledger.](#3-query-the-xrp-ledger) 3. [Query the XRP Ledger.](#3.-query-the-xrp-ledger)
### 1. Connect to the XRP Ledger ### 1. Connect to the XRP Ledger
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`: 1. Via WebSocket:
```go ```go
// Define the network client // Define the network client
client := websocket.NewClient(websocket.NewClientConfig(). client := websocket.NewClient(websocket.NewClientConfig().
@@ -76,16 +68,9 @@ To make queries and submit transactions, you need to connect to the XRP Ledger.
return return
} }
``` ```
2. Via `RPC`: 2. Via RPC:
```go
cfg, err := rpc.NewClientConfig("https://s.altnet.rippletest.net:51234/")
if err != nil {
panic(err)
}
// Initiate the network client {% code-snippet file="/_code-samples/get-started/go/base/rpc/main.go" from="func main()" language="go" /%}
client := rpc.NewClient(cfg)
```
#### Connect to the production XRP Ledger #### Connect to the production XRP Ledger
@@ -95,40 +80,38 @@ The sample code in the previous section shows you how to connect to the Testnet,
- By [installing the core server](../../../infrastructure/installation/index.md) (`rippled`) and running a node yourself. The core server connects to the Mainnet by default, but you can [change the configuration to use Testnet or Devnet](../../../infrastructure/configuration/connect-your-rippled-to-the-xrp-test-net.md). [There are good reasons to run your own core server](../../../concepts/networks-and-servers/index.md#reasons-to-run-your-own-server). If you run your own server, you can connect to it like so: - By [installing the core server](../../../infrastructure/installation/index.md) (`rippled`) and running a node yourself. The core server connects to the Mainnet by default, but you can [change the configuration to use Testnet or Devnet](../../../infrastructure/configuration/connect-your-rippled-to-the-xrp-test-net.md). [There are good reasons to run your own core server](../../../concepts/networks-and-servers/index.md#reasons-to-run-your-own-server). If you run your own server, you can connect to it like so:
```go ```go
import "github.com/Peersyst/xrpl-go/xrpl/websocket" import "github.com/Peersyst/xrpl-go/xrpl/websocket"
const MyServer := "ws://localhost:6006/"
client := websocket.NewClient(websocket.NewClientConfig().WithHost(MyServer)) const MY_SERVER = "ws://localhost:6006/"
```
func main() {
client := websocket.NewClient(websocket.NewClientConfig().WithHost(MY_SERVER))
// ... custom code goes here
}
See the example [core server config file](https://github.com/XRPLF/rippled/blob/c0a0b79d2d483b318ce1d82e526bd53df83a4a2c/cfg/rippled-example.cfg#L1562) for more information about default values. See the example [core server config file](https://github.com/XRPLF/rippled/blob/c0a0b79d2d483b318ce1d82e526bd53df83a4a2c/cfg/rippled-example.cfg#L1562) for more information about default values.
- By using one of the available [public servers][]: - By using one of the available [public servers][]:
```go ```go
import "github.com/Peersyst/xrpl-go/xrpl/websocket" import "github.com/Peersyst/xrpl-go/xrpl/websocket"
const PublicServer = "wss://xrplcluster.com/"
client := websocket.NewClient(websocket.NewClientConfig().WithHost(PublicServer)) const PUBLIC_SERVER = "wss://xrplcluster.com/"
```
func main() {
client := websocket.NewClient(websocket.NewClientConfig().WithHost(PUBLIC_SERVER))
// ... custom code goes here
}
### 2. Get account ### 2. Get account
In `xrpl-go`, account creation and key management live in the wallet package, and on Testnet you can use the built-in faucet provider on your WebSocket (or RPC) client to fund a brand-new account immediately. In `xrpl-go`, account creation and key management live in the `wallet` package, and on Testnet you can use the built-in faucet provider on your WebSocket (or RPC) client to fund a brand-new account immediately.
Here we spin up a Testnetconnected WebSocket client, generate a fresh ED25519 wallet, then fund it automatically via the public faucet. On Testnet, you can fund a new ED25519 account like this:
```go ```go
client := websocket.NewClient(
websocket.NewClientConfig().
WithHost("wss://s.altnet.rippletest.net:51233").
WithFaucetProvider(faucet.NewTestnetFaucetProvider()),
)
defer client.Disconnect()
if err := client.Connect(); err != nil {
fmt.Println(err)
return
}
w, err := wallet.New(crypto.ED25519()) w, err := wallet.New(crypto.ED25519())
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
@@ -161,16 +144,18 @@ If you already have a seed encoded in [base58][], you can make a `Wallet` instan
You can query the XRP Ledger to get information about [a specific account](../../../references/http-websocket-apis/public-api-methods/account-methods/index.md), [a specific transaction](../../../references/http-websocket-apis/public-api-methods/transaction-methods/tx.md), the state of a [current or a historical ledger](../../../references/http-websocket-apis/public-api-methods/ledger-methods/index.md), and [the XRP Ledger's decentralized exchange](../../../references/http-websocket-apis/public-api-methods/path-and-order-book-methods/index.md). You need to make these queries, among other reasons, to look up account info to follow best practices for [reliable transaction submission](../../../concepts/transactions/reliable-transaction-submission.md). You can query the XRP Ledger to get information about [a specific account](../../../references/http-websocket-apis/public-api-methods/account-methods/index.md), [a specific transaction](../../../references/http-websocket-apis/public-api-methods/transaction-methods/tx.md), the state of a [current or a historical ledger](../../../references/http-websocket-apis/public-api-methods/ledger-methods/index.md), and [the XRP Ledger's decentralized exchange](../../../references/http-websocket-apis/public-api-methods/path-and-order-book-methods/index.md). You need to make these queries, among other reasons, to look up account info to follow best practices for [reliable transaction submission](../../../concepts/transactions/reliable-transaction-submission.md).
You can use either the Client's `request()` method to access the XRP Ledger's [WebSocket API](../../../references/http-websocket-apis/api-conventions/request-formatting.md). For example: Use the Client's `Request()` method to access the XRP Ledger's [WebSocket API](../../../references/http-websocket-apis/api-conventions/request-formatting.md). For example:
{% code-snippet file="/_code-samples/get-tx/go/main.go" from="// Get the latest validated ledger" language="go" /%} {% code-snippet file="/_code-samples/get-tx/go/main.go" from="// Get the latest validated ledger" language="go" /%}
Or use the [`websocket` or `rpc` packages](https://pkg.go.dev/github.com/Peersyst/xrpl-go@v0.1.12/xrpl/websocket#Client.GetAccountChannels) getter methods: Or, use the getter methods from the [`websocket`](https://pkg.go.dev/github.com/Peersyst/xrpl-go@v0.1.12/xrpl/websocket) or [`rpc`](https://pkg.go.dev/github.com/Peersyst/xrpl-go@v0.1.12/xrpl/rpc) packages:
{% code-snippet file="/_code-samples/get-started/go/get-acc-info/ws/main.go" from="// Get info from" before="// Get info about" language="go" /%} {% code-snippet file="/_code-samples/get-started/go/get-acc-info/ws/main.go" from="// Get info from" before="// Get info about" language="go" /%}
## Keep on Building ## Keep on Building
Now that you know how to use `xrpl.js` to connect to the XRP Ledger, get an account, and look up information about it, you can also: Now that you know how to use `xrpl-go` to connect to the XRP Ledger, get an account, and look up information about it, you can also:
- [Send XRP](../../how-tos/send-xrp.md). - [Send XRP](../../how-tos/send-xrp.md).
{% raw-partial file="/docs/_snippets/common-links.md" /%}

View File

@@ -1,7 +1,4 @@
--- ---
html: build-apps-in-golang.html
parent: golang.html
top_nav_grouping: Article Types
metadata: metadata:
indexPage: true indexPage: true
--- ---

View File

@@ -1,12 +1,9 @@
--- ---
html: golang.html
parent: tutorials.html
top_nav_grouping: Article Types
metadata: metadata:
indexPage: true indexPage: true
--- ---
# GoLang # Go
You can create your own interface to try out the capabilities and support your specific business needs. These tutorials build a test harness interface to try out features of the XRP Ledger. You can create your own interface to try out the capabilities and support your specific business needs. These tutorials build a test harness interface to try out features of the XRP Ledger.
@@ -17,7 +14,7 @@ Typically, the example functions involve four steps.
- Get the state of accounts and tokens on the XRP Ledger using requests. - Get the state of accounts and tokens on the XRP Ledger using requests.
- Disconnect from the XRP Ledger. - Disconnect from the XRP Ledger.
Once familiar with the library functions, you can build sample applications in GoLang. We anticipate that the applications you build greatly improve upon these examples. Your feedback and contributions are most welcome. Once familiar with the library functions, you can build sample applications in Go. We anticipate that the applications you build greatly improve upon these examples. Your feedback and contributions are most welcome.
## Tutorial Modules ## Tutorial Modules

View File

@@ -28,7 +28,7 @@ To interact with the XRP Ledger, you need to set up a dev environment with the n
- **Python** with the [`xrpl-py` library](https://xrpl-py.readthedocs.io/). See [Get Started using Python](../python/build-apps/get-started.md) for setup steps. - **Python** with the [`xrpl-py` library](https://xrpl-py.readthedocs.io/). See [Get Started using Python](../python/build-apps/get-started.md) for setup steps.
- **Java** with the [xrpl4j library](https://github.com/XRPLF/xrpl4j). See [Get Started Using Java](../java/build-apps/get-started.md) for setup steps. - **Java** with the [xrpl4j library](https://github.com/XRPLF/xrpl4j). See [Get Started Using Java](../java/build-apps/get-started.md) for setup steps.
- **PHP** with the [XRPL_PHP library](https://github.com/AlexanderBuzz/xrpl-php). See [Get Started Using PHP](../php/build-apps/get-started.md) for setup steps. - **PHP** with the [XRPL_PHP library](https://github.com/AlexanderBuzz/xrpl-php). See [Get Started Using PHP](../php/build-apps/get-started.md) for setup steps.
- **GoLang** with the [xrpl-go library](https://github.com/Peersyst/xrpl-go). See [Get Started Using GoLang](../go/build-apps/get-started.md) for setup steps. - **Go** with the [xrpl-go library](https://github.com/Peersyst/xrpl-go). See [Get Started Using Go](../go/build-apps/get-started.md) for setup steps.
## Send a Payment on the Test Net ## Send a Payment on the Test Net
@@ -54,7 +54,7 @@ To transact on the XRP Ledger, you need an address and secret key, and some XRP.
{% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Example credentials" before="// Create" language="php" /%} {% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Example credentials" before="// Create" language="php" /%}
{% /tab %} {% /tab %}
{% tab label="GoLang" %} {% tab label="Go" %}
{% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Example credentials" before="// Funding" language="go" /%} {% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Example credentials" before="// Funding" language="go" /%}
{% /tab %} {% /tab %}
@@ -91,7 +91,7 @@ The following code connects to a public Testnet servers:
{% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Create a client" before="// Transaction definition" language="php" /%} {% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Create a client" before="// Transaction definition" language="php" /%}
{% /tab %} {% /tab %}
{% tab label="GoLang" %} {% tab label="Go" %}
{% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="func main()" before="if !client.IsConnected() " language="go" /%} {% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="func main()" before="if !client.IsConnected() " language="go" /%}
{% /tab %} {% /tab %}
@@ -150,7 +150,7 @@ Here's an example of preparing the above payment:
{% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Transaction definition" before="// Sign" language="php" /%} {% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Transaction definition" before="// Sign" language="php" /%}
{% /tab %} {% /tab %}
{% tab label="GoLang" %} {% tab label="Go" %}
{% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Prepare " before="// Sign" language="go" /%} {% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Prepare " before="// Sign" language="go" /%}
{% /tab %} {% /tab %}
@@ -184,7 +184,7 @@ Signing a transaction uses your credentials to authorize the transaction on your
- **Python:** Use the [`xrpl.transaction.safe_sign_transaction()` method](https://xrpl-py.readthedocs.io/en/latest/source/xrpl.transaction.html#xrpl.transaction.safe_sign_transaction) with a model and `Wallet` object. - **Python:** Use the [`xrpl.transaction.safe_sign_transaction()` method](https://xrpl-py.readthedocs.io/en/latest/source/xrpl.transaction.html#xrpl.transaction.safe_sign_transaction) with a model and `Wallet` object.
- **Java:** Use a [`SignatureService`](https://javadoc.io/doc/org.xrpl/xrpl4j-crypto-core/latest/org/xrpl/xrpl4j/crypto/signing/SignatureService.html) instance to sign the transaction. For this tutorial, use the [`SingleKeySignatureService`](https://javadoc.io/doc/org.xrpl/xrpl4j-crypto-bouncycastle/latest/org/xrpl/xrpl4j/crypto/signing/SingleKeySignatureService.html). - **Java:** Use a [`SignatureService`](https://javadoc.io/doc/org.xrpl/xrpl4j-crypto-core/latest/org/xrpl/xrpl4j/crypto/signing/SignatureService.html) instance to sign the transaction. For this tutorial, use the [`SingleKeySignatureService`](https://javadoc.io/doc/org.xrpl/xrpl4j-crypto-bouncycastle/latest/org/xrpl/xrpl4j/crypto/signing/SingleKeySignatureService.html).
- **PHP:** Use a [`sign()` method of a `Wallet` instance](https://alexanderbuzz.github.io/xrpl-php-docs/wallet.html#signing-a-transaction) instance to sign the transaction. The input to this step is a completed array of transaction instructions. - **PHP:** Use a [`sign()` method of a `Wallet` instance](https://alexanderbuzz.github.io/xrpl-php-docs/wallet.html#signing-a-transaction) instance to sign the transaction. The input to this step is a completed array of transaction instructions.
- **GoLang:** Use the [`Sign()` method of the `Wallet` package](https://pkg.go.dev/github.com/Peersyst/xrpl-go@v0.1.12/xrpl/wallet) to sign the transaction. - **Go:** Use the [`Sign()` method of the `Wallet` package](https://pkg.go.dev/github.com/Peersyst/xrpl-go@v0.1.12/xrpl/wallet) to sign the transaction.
{% tabs %} {% tabs %}
@@ -204,7 +204,7 @@ Signing a transaction uses your credentials to authorize the transaction on your
{% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Sign" before="// Submit" language="php" /%} {% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Sign" before="// Submit" language="php" /%}
{% /tab %} {% /tab %}
{% tab label="GoLang" %} {% tab label="Go" %}
{% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Sign" before="// Submit" language="go" /%} {% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Sign" before="// Submit" language="go" /%}
{% /tab %} {% /tab %}
@@ -235,7 +235,7 @@ Now that you have a signed transaction, you can submit it to an XRP Ledger serve
- **Python:** Use the [`xrpl.transaction.submit_and_wait()` method](https://xrpl-py.readthedocs.io/en/stable/source/xrpl.transaction.html#xrpl.transaction.submit_and_wait) to submit a transaction to the network and wait for a response. - **Python:** Use the [`xrpl.transaction.submit_and_wait()` method](https://xrpl-py.readthedocs.io/en/stable/source/xrpl.transaction.html#xrpl.transaction.submit_and_wait) to submit a transaction to the network and wait for a response.
- **Java:** Use the [`XrplClient.submit(SignedTransaction)` method](https://javadoc.io/doc/org.xrpl/xrpl4j-client/latest/org/xrpl/xrpl4j/client/XrplClient.html#submit(org.xrpl.xrpl4j.crypto.signing.SignedTransaction)) to submit a transaction to the network. Use the [`XrplClient.ledger()`](https://javadoc.io/doc/org.xrpl/xrpl4j-client/latest/org/xrpl/xrpl4j/client/XrplClient.html#ledger(org.xrpl.xrpl4j.model.client.ledger.LedgerRequestParams)) method to get the latest validated ledger index. - **Java:** Use the [`XrplClient.submit(SignedTransaction)` method](https://javadoc.io/doc/org.xrpl/xrpl4j-client/latest/org/xrpl/xrpl4j/client/XrplClient.html#submit(org.xrpl.xrpl4j.crypto.signing.SignedTransaction)) to submit a transaction to the network. Use the [`XrplClient.ledger()`](https://javadoc.io/doc/org.xrpl/xrpl4j-client/latest/org/xrpl/xrpl4j/client/XrplClient.html#ledger(org.xrpl.xrpl4j.model.client.ledger.LedgerRequestParams)) method to get the latest validated ledger index.
- **PHP:** Use the [`submitAndWait()` method of the Client](https://alexanderbuzz.github.io/xrpl-php-docs/client.html) to submit a transaction to the network and wait for the response. - **PHP:** Use the [`submitAndWait()` method of the Client](https://alexanderbuzz.github.io/xrpl-php-docs/client.html) to submit a transaction to the network and wait for the response.
- **GoLang:** Use [`SubmitTxAndWait()` or `SubmitTxBlobAndWait()` methods os the Client](https://pkg.go.dev/github.com/Peersyst/xrpl-go@v0.1.12/xrpl/websocket#Client.SubmitTxAndWait) to submit a transaction to the network and wait for the response. - **Go:** Use [`SubmitTxAndWait()` or `SubmitTxBlobAndWait()` methods os the Client](https://pkg.go.dev/github.com/Peersyst/xrpl-go@v0.1.12/xrpl/websocket#Client.SubmitTxAndWait) to submit a transaction to the network and wait for the response.
{% tabs %} {% tabs %}
@@ -255,7 +255,7 @@ Now that you have a signed transaction, you can submit it to an XRP Ledger serve
{% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Submit" before="// Wait" language="php" /%} {% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Submit" before="// Wait" language="php" /%}
{% /tab %} {% /tab %}
{% tab label="GoLang" %} {% tab label="Go" %}
{% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Submit" before="// Wait" language="go" /%} {% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Submit" before="// Wait" language="go" /%}
{% /tab %} {% /tab %}
@@ -296,7 +296,7 @@ Most transactions are accepted into the next ledger version after they're submit
- **PHP:** If you used the [`.submitAndWait()` method](https://alexanderbuzz.github.io/xrpl-php-docs/client.html), you can wait until the returned Promise resolves. Other, more asynchronous approaches are also possible. - **PHP:** If you used the [`.submitAndWait()` method](https://alexanderbuzz.github.io/xrpl-php-docs/client.html), you can wait until the returned Promise resolves. Other, more asynchronous approaches are also possible.
- **GoLang:** If you used the `SubmitTxAndWait()` or `SubmitTxBlobAndWait()` methods, the client will handle submission and wait until the transaction is confirmed in a ledger. Internally, these methods use a polling mechanism, querying the transaction status with the client's `Request()` method and a `TxRequest`. - **Go:** If you used the `SubmitTxAndWait()` or `SubmitTxBlobAndWait()` methods, the client will handle submission and wait until the transaction is confirmed in a ledger. Internally, these methods use a polling mechanism, querying the transaction status with the client's `Request()` method and a `TxRequest`.
{% tabs %} {% tabs %}
@@ -316,7 +316,7 @@ Most transactions are accepted into the next ledger version after they're submit
{% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Wait" before="// Check" language="php" /%} {% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Wait" before="// Check" language="php" /%}
{% /tab %} {% /tab %}
{% tab label="GoLang" %} {% tab label="Go" %}
{% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Wait" before="// Check" language="go" /%} {% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Wait" before="// Check" language="go" /%}
{% /tab %} {% /tab %}
@@ -339,7 +339,7 @@ To know for sure what a transaction did, you must look up the outcome of the tra
- **PHP:** Use the response from `submitAndWait()` or call the `tx method` using [`$client->syncRequest()`](https://alexanderbuzz.github.io/xrpl-php-docs/client.html). - **PHP:** Use the response from `submitAndWait()` or call the `tx method` using [`$client->syncRequest()`](https://alexanderbuzz.github.io/xrpl-php-docs/client.html).
- **GoLang:** Use the response from `SubmitTxAndWait()` or `SubmitTxBlobAndWait()`, or manually query the transaction status using a `TxRequest` with the client's `Request()` method. - **Go:** Use the response from `SubmitTxAndWait()` or `SubmitTxBlobAndWait()`, or manually query the transaction status using a `TxRequest` with the client's `Request()` method.
{% tabs %} {% tabs %}
@@ -359,7 +359,7 @@ To know for sure what a transaction did, you must look up the outcome of the tra
{% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Check" language="php" /%} {% code-snippet file="/_code-samples/send-xrp/php/send-xrp.php" from="// Check" language="php" /%}
{% /tab %} {% /tab %}
{% tab label="GoLang" %} {% tab label="Go" %}
{% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Check" language="go" /%} {% code-snippet file="/_code-samples/send-xrp/go/ws/main.go" from="// Check" language="go" /%}
{% /tab %} {% /tab %}
@@ -426,12 +426,12 @@ print_r("Seed: " . $wallet->getSeed()); // Example: sp6JS7f14BuwFY8Mw6bTtLKWauoU
``` ```
{% /tab %} {% /tab %}
{% tab label="GoLang" %} {% tab label="Go" %}
```go ```go
wallet, err := wallet.New(crypto.ED25519()) wallet, err := wallet.New(crypto.ED25519())
fmt.Println("🌐 Classic Address:", wallet.ClassicAddress) // Example: r9ESeQQswbTxV8neiDTLTHXbXfUwiihyJk fmt.Println("Classic Address:", wallet.ClassicAddress) // Example: r9ESeQQswbTxV8neiDTLTHXbXfUwiihyJk
fmt.Println("🌐 Seed:", wallet.Seed) // Example: sEd7XGFGSWteam777HQHvw7vHypEWy2 fmt.Println("Seed:", wallet.Seed) // Example: sEd7XGFGSWteam777HQHvw7vHypEWy2
``` ```
{% /tab %} {% /tab %}
@@ -478,7 +478,7 @@ $client = new JsonRpcClient("https://xrplcluster.com");
``` ```
{% /tab %} {% /tab %}
{% tab label="GoLang" %} {% tab label="Go" %}
```go ```go
client := websocket.NewClient( client := websocket.NewClient(
@@ -528,7 +528,7 @@ $client = new JsonRpcClient("http://localhost:5005");
``` ```
{% /tab %} {% /tab %}
{% tab label="GoLang" %} {% tab label="Go" %}
```go ```go
client := websocket.NewClient( client := websocket.NewClient(

View File

@@ -16,7 +16,7 @@ These tutorials walk you through the basics of building a very simple XRP Ledger
{% xrpl-card title="Python" body="Using xrpl.py, a pure Python library." href="/docs/tutorials/python/" image="/img/logos/python.svg" imageAlt="Python logo" /%} {% xrpl-card title="Python" body="Using xrpl.py, a pure Python library." href="/docs/tutorials/python/" image="/img/logos/python.svg" imageAlt="Python logo" /%}
{% xrpl-card title="GoLang" body="Using xrpl-go, a pure GoLang library." href="/docs/tutorials/go/" image="/img/logos/golang.svg" imageAlt="GoLang logo" /%} {% xrpl-card title="Go" body="Using xrpl-go, a pure Go library." href="/docs/tutorials/go/" image="/img/logos/golang.svg" imageAlt="Go logo" /%}
{% xrpl-card title="Java" body="Using xrpl4j, a pure Java library." href="/docs/tutorials/java/" image="/img/logos/java.svg" imageAlt="Java logo" /%} {% xrpl-card title="Java" body="Using xrpl4j, a pure Java library." href="/docs/tutorials/java/" image="/img/logos/java.svg" imageAlt="Java logo" /%}

View File

@@ -476,7 +476,7 @@
- label: Ruby Client Library - label: Ruby Client Library
href: https://www.rubydoc.info/gems/xrbp href: https://www.rubydoc.info/gems/xrbp
external: true external: true
- label: GoLang Client Library - label: Go Client Library
href: https://pkg.go.dev/github.com/Peersyst/xrpl-go href: https://pkg.go.dev/github.com/Peersyst/xrpl-go
external: true external: true
- page: docs/references/http-websocket-apis/index.md - page: docs/references/http-websocket-apis/index.md