mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-23 13:15:49 +00:00
Replace cycler patterns with hard-coded numbers in tutorials
This commit is contained in:
@@ -75,7 +75,6 @@ To install with Maven, add the following to your project's `pom.xml` file and th
|
||||
Check out the [xrpl4j sample project](https://github.com/XRPLF/xrpl4j-sample) for a full Maven project containing the code from this tutorial.
|
||||
|
||||
## Start Building
|
||||
{% set n = cycler(* range(1,99)) %}
|
||||
|
||||
When you're working with the XRP Ledger, there are a few things you'll need to manage, whether you're adding XRP to your [account](accounts.html), integrating with the [decentralized exchange](decentralized-exchange.html), or [issuing tokens](tokens.html). This tutorial walks you through basic patterns common to getting started with all of these use cases and provides sample code for implementing them.
|
||||
|
||||
@@ -86,7 +85,7 @@ Here are the basic steps you'll need to cover for almost any XRP Ledger project:
|
||||
1. [Query the XRP Ledger.](#3-query-the-xrp-ledger)
|
||||
|
||||
|
||||
### {{n.next()}}. 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 `xrpl4j`,
|
||||
you can use an [`XrplClient`](https://javadoc.io/doc/org.xrpl/xrpl4j-client/3.0.1/org/xrpl/xrpl4j/client/XrplClient.html):
|
||||
@@ -109,7 +108,7 @@ The sample code in the previous section shows you how to connect to the Testnet,
|
||||
final HttpUrl rippledUrl = HttpUrl.get("https://s2.ripple.com:51234/");
|
||||
XrplClient xrplClient = new XrplClient(rippledUrl);
|
||||
|
||||
### {{n.next()}}. Get account
|
||||
### 2. Get account
|
||||
|
||||
To store value and execute transactions on the XRP Ledger, you need to get an account: a [set of keys](cryptographic-keys.html#key-components) and an [address](addresses.html) that's been [funded with enough XRP](accounts.html#creating-accounts) to meet the [account reserve](reserves.html). The address is the identifier of your account and you use the [private key](cryptographic-keys.html#private-key) to sign transactions that you submit to the XRP Ledger. For production purposes, you should take care to store your keys and set up a [secure signing method](secure-signing.html).
|
||||
|
||||
@@ -137,7 +136,7 @@ For testing and development purposes, you can use a `FaucetClient` connected to
|
||||
|
||||
{{ include_code("_code-samples/get-started/java/GetAccountInfo.java", start_with="// Fund the account using the testnet Faucet", end_before="// Look up your Account Info", language="java") }}
|
||||
|
||||
### {{n.next()}}. Query the XRP Ledger
|
||||
### 3. Query the XRP Ledger
|
||||
|
||||
You can query the XRP Ledger to get information about [a specific account](account-methods.html), [a specific transaction](tx.html), the state of a [current or a historical ledger](ledger-methods.html), and [the XRP Ledger's decentralized exchange](path-and-order-book-methods.html). You need to make these queries, among other reasons, to look up account info to follow best practices for [reliable transaction submission](reliable-transaction-submission.html).
|
||||
|
||||
@@ -146,7 +145,7 @@ Here, we'll use the [`XrplClient` we constructed](#1-connect-to-the-xrp-ledger)
|
||||
{{ include_code("_code-samples/get-started/java/GetAccountInfo.java", start_with="// Look up your Account Info", end_before="// Print the result", language="java") }}
|
||||
|
||||
|
||||
### {{n.next()}}. Putting it all together
|
||||
### 4. Putting it all together
|
||||
|
||||
Using these building blocks, we can create a Java app that:
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ pip3 install xrpl-py
|
||||
```
|
||||
|
||||
## Start Building
|
||||
{% set n = cycler(* range(1,99)) %}
|
||||
|
||||
When you're working with the XRP Ledger, there are a few things you'll need to manage, whether you're adding XRP to your [account](accounts.html), integrating with the [decentralized exchange](decentralized-exchange.html), or [issuing tokens](tokens.html). This tutorial walks you through basic patterns common to getting started with all of these use cases and provides sample code for implementing them.
|
||||
|
||||
@@ -51,7 +50,7 @@ Here are the basic steps you'll need to cover for almost any XRP Ledger project:
|
||||
1. [Query the XRP Ledger.](#3-query-the-xrp-ledger)
|
||||
|
||||
|
||||
### {{n.next()}}. 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-py`, use the [`xrp.clients` module](https://xrpl-py.readthedocs.io/en/latest/source/xrpl.clients.html):
|
||||
|
||||
@@ -76,7 +75,7 @@ The sample code in the previous section shows you how to connect to the Testnet,
|
||||
client = JsonRpcClient(JSON_RPC_URL)
|
||||
|
||||
|
||||
### {{n.next()}}. Get account
|
||||
### 2. Get account
|
||||
|
||||
To store value and execute transactions on the XRP Ledger, you need an account: a [set of keys](cryptographic-keys.html#key-components) and an [address](addresses.html) that's been [funded with enough XRP](accounts.html#creating-accounts) to meet the [account reserve](reserves.html). The address is the identifier of your account and you use the [private key](cryptographic-keys.html#private-key) to sign transactions that you submit to the XRP Ledger.
|
||||
|
||||
@@ -128,7 +127,7 @@ You can use `xrpl-py`'s [`xrpl.core.addresscodec`](https://xrpl-py.readthedocs.i
|
||||
The X-address format [packs the address and destination tag](https://github.com/XRPLF/XRPL-Standards/issues/6) into a more user-friendly value.
|
||||
|
||||
|
||||
### {{n.next()}}. Query the XRP Ledger
|
||||
### 3. Query the XRP Ledger
|
||||
|
||||
You can query the XRP Ledger to get information about [a specific account](account-methods.html), [a specific transaction](tx.html), the state of a [current or a historical ledger](ledger-methods.html), and [the XRP Ledger's decentralized exchange](path-and-order-book-methods.html). You need to make these queries, among other reasons, to look up account info to follow best practices for [reliable transaction submission](reliable-transaction-submission.html).
|
||||
|
||||
@@ -139,7 +138,7 @@ Here, we use `xrpl-py`'s [`xrpl.account`](https://xrpl-py.readthedocs.io/en/late
|
||||
|
||||
|
||||
|
||||
### {{n.next()}}. Putting it all together
|
||||
### 4. Putting it all together
|
||||
|
||||
Using these building blocks, we can create a Python app that:
|
||||
|
||||
|
||||
@@ -34,9 +34,8 @@ function writeToConsole(console_selector, message) {
|
||||
}
|
||||
</script>
|
||||
|
||||
{% set n = cycler(* range(1,99)) %}
|
||||
|
||||
## {{n.next()}}. Connect to the XRP Ledger
|
||||
## 1. Connect to the XRP Ledger
|
||||
|
||||
The first step of monitoring for incoming payments is to connect to the XRP Ledger, specifically a `rippled` server.
|
||||
|
||||
@@ -111,7 +110,7 @@ $("#connect-socket-button").click((event) => {
|
||||
</script>
|
||||
|
||||
|
||||
## {{n.next()}}. Dispatch Incoming Messages to Handlers
|
||||
## 2. Dispatch Incoming Messages to Handlers
|
||||
|
||||
Since WebSocket connections can have several messages going each way and there is not a strict 1:1 correlation between requests and responses, you need to identify what to do with each incoming message. A good model for coding this is to set up a "dispatcher" function that reads incoming messages and relays each message to the correct code path for handling it. To help dispatch messages appropriately, the `rippled` server provides a `type` field on every WebSocket message:
|
||||
|
||||
@@ -257,7 +256,7 @@ $("#dispatch_ping").click((event) => {
|
||||
})
|
||||
</script>
|
||||
|
||||
## {{n.next()}}. Subscribe to the Account
|
||||
## 3. Subscribe to the Account
|
||||
|
||||
To get a live notification whenever a transaction affects your account, you can subscribe to the account with the [subscribe method][]. In fact, it doesn't have to be your own account: since all transactions are public, you can subscribe to any account or even a combination of accounts.
|
||||
|
||||
@@ -331,7 +330,7 @@ WS_HANDLERS["transaction"] = log_tx
|
||||
</script>
|
||||
|
||||
|
||||
## {{n.next()}}. Read Incoming Payments
|
||||
## 4. Read Incoming Payments
|
||||
|
||||
When you subscribe to an account, you get messages for _all transactions to or from the account_, as well as _transactions that affect the account indirectly_, such as trading its [tokens](tokens.html). If your goal is to recognize when the account has received incoming payments, you must filter the transactions stream and process the payments based on the amount they actually delivered. Look for the following information:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user