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
Copy file name to clipboardexpand all lines: docs/index.md
+30-12
Original file line number
Diff line number
Diff line change
@@ -63,17 +63,26 @@
63
63
64
64
# Introduction
65
65
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).
67
74
68
75
RippleAPI only provides access to *validated*, *immutable* transaction data.
69
76
70
77
## Boilerplate
71
78
79
+
Use the following [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_code) to wrap your custom code using RippleAPI.
80
+
72
81
```javascript
73
82
const {RippleAPI} =require('ripple-lib');
74
83
75
84
constapi=newRippleAPI({
76
-
servers: ['wss://s1.ripple.com']
85
+
servers: ['wss://s1.ripple.com']//Public rippled server hosted by Ripple, Inc.
77
86
});
78
87
api.connect().then(() => {
79
88
/* insert code here */
@@ -82,25 +91,34 @@ api.connect().then(() => {
82
91
}).catch(console.error);
83
92
```
84
93
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
+
<asideclass="notice">
99
+
All the code snippets in this documentation assume that you have surrounded them with this boilerplate.
100
+
</aside>
86
101
87
-
`npm install -g babel`
102
+
<asideclass="notice">
103
+
If you omit the "catch" section, errors may not be visible.
104
+
</aside>
88
105
89
-
`npm install ripple-lib`
90
106
91
-
Then create a script based on the boilerplate shown here and run with:
107
+
### Installation ###
92
108
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
94
114
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
96
117
97
118
<asideclass="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.
99
120
</aside>
100
121
101
-
<asideclass="notice">
102
-
Dont forget the "catch" or errors may not be visible.
Use the following [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_code) to wrap your custom code using RippleAPI.
4
+
3
5
```javascript
4
6
const {RippleAPI} = require('ripple-lib');
5
7
6
8
const api = new RippleAPI({
7
-
servers: ['wss://s1.ripple.com']
9
+
servers: ['wss://s1.ripple.com'] //Public rippled server hosted by Ripple, Inc.
8
10
});
9
11
api.connect().then(() => {
10
12
/* insert code here */
@@ -13,22 +15,31 @@ api.connect().then(() => {
13
15
}).catch(console.error);
14
16
```
15
17
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.
17
19
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_).
19
21
20
-
`npm install ripple-lib`
22
+
<asideclass="notice">
23
+
All the code snippets in this documentation assume that you have surrounded them with this boilerplate.
24
+
</aside>
21
25
22
-
Then create a script based on the boilerplate shown here and run with:
26
+
<asideclass="notice">
27
+
If you omit the "catch" section, errors may not be visible.
28
+
</aside>
23
29
24
-
`babel-node script.js`
25
30
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 ###
27
32
28
-
<asideclass="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
31
41
32
42
<asideclass="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.
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).
4
11
5
12
RippleAPI only provides access to *validated*, *immutable* transaction data.
0 commit comments