You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Start a new project by creating an empty folder, then move into that folder and use [NPM](https://www.npmjs.com/) to install the latest version of xrpl.js:
80
81
@@ -94,7 +95,7 @@ Your `package.json` file should look something like this:
94
95
{% step id="connect-tag" %}
95
96
#### Connect to the XRP Ledger Testnet
96
97
97
-
To make queries and submit transactions, you need to connect to the XRP Ledger. To do this with `xrpl.js`, you create an instance of the `Client` class and use the `connect()` method.
98
+
To make queries and submit transactions, you need to connect to the XRP Ledger. To do this with `xrpl.js`, you create an instance of the [`Client`](https://js.xrpl.org/classes/Client.html) class and use the [`connect()`](https://js.xrpl.org/classes/Client.html#connect) method.
98
99
99
100
{% admonition type="success" name="Tip" %}Many network functions in `xrpl.js` use [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) to return values asynchronously. The code samples here use the [`async/await` pattern](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Async_await) to wait for the actual result of the Promises.{% /admonition %}
100
101
@@ -130,46 +131,48 @@ The sample code shows you how to connect to the Testnet, which is one of the ava
130
131
{% step id="get-account-create-wallet-tag"%}
131
132
#### Create and Fund a Wallet
132
133
133
-
The `xrpl.js` library has a `Wallet`classfor handling the keys and address of an XRP Ledger account. On Testnet, you can fund a newaccount as shown in the example.
134
+
The `xrpl.js` library has a [`Wallet`](https://js.xrpl.org/classes/Wallet.html) class for handling the keys and address of an XRP Ledger account. On Testnet, you can fund a new account as shown in the example.
134
135
{%/step %}
135
136
136
137
{% step id="get-account-create-wallet-b-tag"%}
137
138
#### (Optional) Generate a Wallet Only
138
139
139
-
If you want to generate a wallet without funding it, you can create a new`Wallet`instance. Keepin mind that you need to send XRP to the wallet for it to be a valid account on the ledger.
140
+
If you want to generate a wallet without funding it, you can create a new[`Wallet`](https://js.xrpl.org/classes/Wallet.html) instance. Keep in mind that you need to send XRP to the wallet for it to be a valid account on the ledger.
140
141
{%/step %}
141
142
142
143
{% step id="get-account-create-wallet-c-tag"%}
143
144
#### (Optional) Use Your Own Wallet Seed
144
145
145
-
To use an existing wallet seed encoded in [base58][], you can create a `Wallet` instance from it.
146
+
To use an existing wallet seed encoded in [base58][], you can create a [`Wallet`](https://js.xrpl.org/classes/Wallet.html) instance from it.
146
147
{%/step %}
147
148
149
+
{% step id="query-xrpl-tag"%}
148
150
### 4. Query the XRP Ledger
149
151
150
-
{% step id="query-xrpl-tag"%}
151
-
Use the Client's `request()` method to access the XRP Ledger's [WebSocketAPI](../../../references/http-websocket-apis/api-conventions/request-formatting.md).
152
+
Use the Client's [`request()`](https://js.xrpl.org/classes/Client.html#request) method to access the XRP Ledger's [WebSocketAPI](../../../references/http-websocket-apis/api-conventions/request-formatting.md).
152
153
{%/step %}
153
154
155
+
{% step id="listen-for-events-tag"%}
154
156
### 5. Listen for Events
155
157
156
-
{% step id="listen-for-events-tag"%}
157
-
You can set up handlers for various types of events in`xrpl.js`, such as whenever the XRP Ledger's [consensus process](../../../concepts/consensus-protocol/index.md) produces a new [ledger version](../../../concepts/ledgers/index.md). To do that, first call the [subscribe method][] to get the type of events you want, then attach an event handler using the `on(eventType, callback)` method of the client.
158
+
You can set up handlers for various types of events in`xrpl.js`, such as whenever the XRP Ledger's [consensus process](../../../concepts/consensus-protocol/index.md) produces a new [ledger version](../../../concepts/ledgers/index.md). To do that, first call the [subscribe method][] to get the type of events you want, then attach an event handler using the [`on(eventType, callback)`](https://js.xrpl.org/classes/Client.html#on) method of the client.
Disconnect when done so Node.js can end the process. The example code waits 10 seconds before disconnecting to allow time for the ledger event listener to receive and display events.
164
+
Call the [`disconnect()`](https://js.xrpl.org/classes/Client.html#disconnect) function so Node.js can end the process. The example code waits 10 seconds before disconnecting to allow time for the ledger event listener to receive and display events.
Disconnect from the ledger when done. The example code waits 10 seconds before disconnecting to allow time for the ledger event listener to receive and display events.
168
+
### 6. Disconnect
169
+
170
+
Call the [`disconnect()`](https://js.xrpl.org/classes/Client.html#disconnect) function to disconnect from the ledger when done. The example code waits 10 seconds before disconnecting to allow time for the ledger event listener to receive and display events.
0 commit comments