Skip to content

Commit ef25155

Browse files
committed
Docs: revised introductory material
1 parent a271b9e commit ef25155

File tree

3 files changed

+60
-24
lines changed

3 files changed

+60
-24
lines changed

docs/index.md

+30-12
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,26 @@
6363

6464
# Introduction
6565

66-
RippleAPI allows you to query and submit transactions to a node on the Ripple network.
66+
RippleAPI is the official client library to the Ripple Consensus Ledger. Currently, RippleAPI is only available in JavaScript.
67+
Using RippleAPI, you can:
68+
69+
* [Query transactions from the network](#gettransaction)
70+
* [Sign](#sign) transactions securely without connecting to any server
71+
* [Submit](#submit) transactions to the Ripple Consensus Ledger, including [Payments](#payment), [Orders](#order), [Settings changes](#settings), and [other types](#transaction-types)
72+
* [Generate a new Ripple Address](#generateaddress)
73+
* ... and [much more](#api-methods).
6774

6875
RippleAPI only provides access to *validated*, *immutable* transaction data.
6976

7077
## Boilerplate
7178

79+
Use the following [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_code) to wrap your custom code using RippleAPI.
80+
7281
```javascript
7382
const {RippleAPI} = require('ripple-lib');
7483

7584
const api = new RippleAPI({
76-
servers: ['wss://s1.ripple.com']
85+
servers: ['wss://s1.ripple.com'] //Public rippled server hosted by Ripple, Inc.
7786
});
7887
api.connect().then(() => {
7988
/* insert code here */
@@ -82,25 +91,34 @@ api.connect().then(() => {
8291
}).catch(console.error);
8392
```
8493

85-
To get started, first install [nodejs](https://nodejs.org) version `0.12.0` or greater, then:
94+
RippleAPI is designed to work in [NodeJS](https://nodejs.org) (version `0.12.0` or greater) using [Babel](https://babeljs.io/) for [ECMAScript 6](https://babeljs.io/docs/learn-es2015/) support.
95+
96+
The code samples in this documentation are written in ES6, but `RippleAPI` will work with ES5 also. Regardless of whether you use ES5 or ES6, the methods that return promises will return [ES6-style promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise_).
97+
98+
<aside class="notice">
99+
All the code snippets in this documentation assume that you have surrounded them with this boilerplate.
100+
</aside>
86101

87-
`npm install -g babel`
102+
<aside class="notice">
103+
If you omit the "catch" section, errors may not be visible.
104+
</aside>
88105

89-
`npm install ripple-lib`
90106

91-
Then create a script based on the boilerplate shown here and run with:
107+
### Installation ###
92108

93-
`babel-node script.js`
109+
1. Install [NodeJS](https://nodejs.org) and the Node Package Manager (npm). Most Linux distros have a package for NodeJS, but make sure you have version `0.12.0` or higher.
110+
2. Use npm to install [Babel](https://babeljs.io/) globally:
111+
npm install -g babel
112+
3. Use npm to install RippleAPI:
113+
npm install ripple-lib
94114

95-
The code samples in this documentation are written in ES6, but `RippleAPI` will work with ES5 also. Regardless of whether you use ES5 or ES6, the methods that return promises will return ES6-style promises.
115+
After you have installed ripple-lib, you can create scripts using the [boilerplate](#boilerplate) and run them using babel-node:
116+
babel-node script.js
96117

97118
<aside class="notice">
98-
All the code snippets in this documentation assume that you have surrounded them with this boilerplate.
119+
Instead of using babel-node in production, we recommend using Babel to transpile to ECMAScript 5 first.
99120
</aside>
100121

101-
<aside class="notice">
102-
Dont forget the "catch" or errors may not be visible.
103-
</aside>
104122

105123
# Basic Types
106124

docs/src/boilerplate.md.ejs

+22-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
## Boilerplate
22

3+
Use the following [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_code) to wrap your custom code using RippleAPI.
4+
35
```javascript
46
const {RippleAPI} = require('ripple-lib');
57

68
const api = new RippleAPI({
7-
servers: ['wss://s1.ripple.com']
9+
servers: ['wss://s1.ripple.com'] //Public rippled server hosted by Ripple, Inc.
810
});
911
api.connect().then(() => {
1012
/* insert code here */
@@ -13,22 +15,31 @@ api.connect().then(() => {
1315
}).catch(console.error);
1416
```
1517

16-
To get started, first install [nodejs](https://nodejs.org) version `0.12.0` or greater, then:
18+
RippleAPI is designed to work in [NodeJS](https://nodejs.org) (version `0.12.0` or greater) using [Babel](https://babeljs.io/) for [ECMAScript 6](https://babeljs.io/docs/learn-es2015/) support.
1719

18-
`npm install -g babel`
20+
The code samples in this documentation are written in ES6, but `RippleAPI` will work with ES5 also. Regardless of whether you use ES5 or ES6, the methods that return promises will return [ES6-style promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise_).
1921

20-
`npm install ripple-lib`
22+
<aside class="notice">
23+
All the code snippets in this documentation assume that you have surrounded them with this boilerplate.
24+
</aside>
2125

22-
Then create a script based on the boilerplate shown here and run with:
26+
<aside class="notice">
27+
If you omit the "catch" section, errors may not be visible.
28+
</aside>
2329

24-
`babel-node script.js`
2530

26-
The code samples in this documentation are written in ES6, but `RippleAPI` will work with ES5 also. Regardless of whether you use ES5 or ES6, the methods that return promises will return ES6-style promises.
31+
### Installation ###
2732

28-
<aside class="notice">
29-
All the code snippets in this documentation assume that you have surrounded them with this boilerplate.
30-
</aside>
33+
1. Install [NodeJS](https://nodejs.org) and the Node Package Manager (npm). Most Linux distros have a package for NodeJS, but make sure you have version `0.12.0` or higher.
34+
2. Use npm to install [Babel](https://babeljs.io/) globally:
35+
npm install -g babel
36+
3. Use npm to install RippleAPI:
37+
npm install ripple-lib
38+
39+
After you have installed ripple-lib, you can create scripts using the [boilerplate](#boilerplate) and run them using babel-node:
40+
babel-node script.js
3141

3242
<aside class="notice">
33-
Dont forget the "catch" or errors may not be visible.
43+
Instead of using babel-node in production, we recommend using Babel to transpile to ECMAScript 5 first.
3444
</aside>
45+

docs/src/introduction.md.ejs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Introduction
22

3-
RippleAPI allows you to query and submit transactions to a node on the Ripple network.
3+
RippleAPI is the official client library to the Ripple Consensus Ledger. Currently, RippleAPI is only available in JavaScript.
4+
Using RippleAPI, you can:
5+
6+
* [Query transactions from the network](#gettransaction)
7+
* [Sign](#sign) transactions securely without connecting to any server
8+
* [Submit](#submit) transactions to the Ripple Consensus Ledger, including [Payments](#payment), [Orders](#order), [Settings changes](#settings), and [other types](#transaction-types)
9+
* [Generate a new Ripple Address](#generateaddress)
10+
* ... and [much more](#api-methods).
411

512
RippleAPI only provides access to *validated*, *immutable* transaction data.

0 commit comments

Comments
 (0)