Compare commits

...

447 Commits

Author SHA1 Message Date
Elliot Lee
a5c35586f7 Add SHA-256 checksums for 1.8.1 2020-09-28 12:37:47 -07:00
Elliot Lee
a54655c0ff Release 1.8.1 (#1313)
* Update to ripple-binary-codec 1.0.2
2020-09-25 14:08:20 -07:00
dependabot-preview[bot]
2681e81d6b [Security] Bump elliptic from 6.5.2 to 6.5.3 (#1308)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3. **This update includes a security fix.**
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-11 08:32:12 -07:00
dependabot[bot]
2a0234e5ce Bump lodash from 4.17.15 to 4.17.19 (#1305)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-27 13:57:13 -07:00
Elliot Lee
6b326a6efd Release 1.8.0 2020-07-06 21:25:17 -07:00
Mo Morsi
48d2bf849f Update APPLICATIONS.md to reflect latest Dev Null Productions products (#1300)
* s/xrp1ntel/xrpintel

* Add zerptracker to APPLICATIONS
2020-06-26 10:04:44 -07:00
Elliot Lee
4ab808b6de Deprecate submit() in favor of request('submit', {...}) (#1294)
Using request('submit', ...) allows the ripple-lib API to be effectively
identical to the underlying rippled API. Whereas submit() returns only
certain fields from rippled, using request('submit') gives you rippled's
full response, including the new fields added in rippled v1.5.0.
2020-06-09 09:04:01 -07:00
Elliot Lee
e5496e84a6 Release 1.7.1 2020-05-26 15:56:14 -07:00
Elliot Lee
83b5c7f678 Fix preparePayment when using source.amount/destination.minAmount (#1295)
See: https://github.com/ripple/ripple-lib/issues/1237#issuecomment-631670946

Fix #1237

Thanks to @leobel
2020-05-26 15:48:50 -07:00
dependabot-preview[bot]
e6c9617e01 Bump eventemitter2 from 6.3.1 to 6.4.0 (#1287)
Bumps [eventemitter2](https://github.com/hij1nx/EventEmitter2) from 6.3.1 to 6.4.0.
- [Release notes](https://github.com/hij1nx/EventEmitter2/releases)
- [Changelog](https://github.com/EventEmitter2/EventEmitter2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hij1nx/EventEmitter2/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-14 21:42:17 -07:00
dependabot-preview[bot]
6c5fcc3dc6 Bump @types/node from 13.13.4 to 14.0.1 (#1292)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.13.4 to 14.0.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-14 21:41:52 -07:00
dependabot-preview[bot]
2931bb2863 Bump @typescript-eslint/parser from 2.30.0 to 2.31.0 (#1289)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 2.30.0 to 2.31.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.31.0/packages/parser)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-14 20:54:04 -07:00
dependabot-preview[bot]
d745b128e3 Bump ws from 7.2.5 to 7.3.0 (#1290)
Bumps [ws](https://github.com/websockets/ws) from 7.2.5 to 7.3.0.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.2.5...7.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-14 20:53:05 -07:00
dependabot-preview[bot]
73b952ec0d Bump @typescript-eslint/eslint-plugin from 2.30.0 to 2.31.0 (#1291)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.30.0 to 2.31.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.31.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-14 20:52:38 -07:00
Yusuf Şahin HAMZA
be961fb9a7 Fix generateXAddress example (#1286) 2020-05-08 19:36:12 -07:00
Elliot Lee
851d84bde8 Update docs 2020-05-07 00:06:02 -07:00
Elliot Lee
854c4ebfdd Update Transaction Streams link (#1278) 2020-05-06 14:55:44 -07:00
dependabot-preview[bot]
a77448f7c0 Bump ts-node from 8.9.1 to 8.10.1 (#1279)
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.9.1 to 8.10.1.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v8.9.1...v8.10.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 13:30:34 -07:00
dependabot-preview[bot]
0dc33f3d88 Bump ws from 7.2.3 to 7.2.5 (#1280)
Bumps [ws](https://github.com/websockets/ws) from 7.2.3 to 7.2.5.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.2.3...7.2.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 13:30:06 -07:00
dependabot-preview[bot]
aaff0257b0 Bump @types/ws from 7.2.3 to 7.2.4 (#1281)
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 7.2.3 to 7.2.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 13:29:46 -07:00
dependabot-preview[bot]
3557a57bbd Bump @typescript-eslint/parser from 2.27.0 to 2.30.0 (#1282)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 2.27.0 to 2.30.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.30.0/packages/parser)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 13:29:31 -07:00
dependabot-preview[bot]
051d23edff Bump webpack-bundle-analyzer from 3.6.1 to 3.7.0 (#1283)
Bumps [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) from 3.6.1 to 3.7.0.
- [Release notes](https://github.com/webpack-contrib/webpack-bundle-analyzer/releases)
- [Changelog](https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/webpack-bundle-analyzer/compare/v3.6.1...v3.7.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 13:29:19 -07:00
dependabot-preview[bot]
ccb91c1268 Bump mocha from 7.1.1 to 7.1.2 (#1284)
Bumps [mocha](https://github.com/mochajs/mocha) from 7.1.1 to 7.1.2.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v7.1.1...v7.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 13:29:04 -07:00
dependabot-preview[bot]
6c1c0eee59 Bump assert-diff from 3.0.0 to 3.0.1 (#1285)
Bumps [assert-diff](https://github.com/pihvi/assert-diff) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/pihvi/assert-diff/releases)
- [Commits](https://github.com/pihvi/assert-diff/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-05 13:28:49 -07:00
Elliot Lee
f1c1c7033a Release 1.7.0 (Merge #1276) 2020-04-28 23:31:01 -07:00
Elliot Lee
bc352c4cf0 Document computeBinaryTransactionHash 2020-04-28 23:29:46 -07:00
Elliot Lee
1980fa9fa4 HISTORY: Add 1.7.0 2020-04-28 14:44:22 -07:00
Elliot Lee
6cabb2e935 Release 1.7.0 2020-04-28 14:34:49 -07:00
AGallouin
05411527ee Add failHard (fail_hard) option in submit method (#1029)
See https://xrpl.org/submit.html

Co-authored-by: Elliot Lee <github.public@intelliot.com>
2020-04-28 14:32:25 -07:00
Elliot Lee
3c13da66b3 Export hashing functions (#1275)
The now-deprecated ripple-hashes library provided a number of hash
functions for users to compute the hashes/IDs for various XRP Ledger
objects:

* Transactions (to generate transaction hashes, also known as IDs)
* Transaction signing hashes (to sign transactions)
* Ledger Object IDs (to look up specific ledger objects in a ledger's
  state tree; see https://xrpl.org/ledger-object-ids.html)

This commit exports these utility methods from ripple-lib as static
methods. Access them on the RippleAPI class. Example:

import {RippleAPI} from 'ripple-lib'
const hash = RippleAPI.computeBinaryTransactionHash(...)
2020-04-28 14:19:36 -07:00
dependabot-preview[bot]
5d6af09508 Bump @typescript-eslint/eslint-plugin from 2.24.0 to 2.30.0
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.24.0 to 2.30.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.30.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-28 14:16:27 -07:00
dependabot-preview[bot]
15bf721d24 Bump prettier from 1.19.1 to 2.0.5
Bumps [prettier](https://github.com/prettier/prettier) from 1.19.1 to 2.0.5.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/1.19.1...2.0.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-28 14:16:11 -07:00
dependabot-preview[bot]
14351c9512 Bump ts-node from 8.6.2 to 8.9.1
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.6.2 to 8.9.1.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v8.6.2...v8.9.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-28 14:15:59 -07:00
dependabot-preview[bot]
3b13de5310 Bump webpack from 4.42.0 to 4.43.0
Bumps [webpack](https://github.com/webpack/webpack) from 4.42.0 to 4.43.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.42.0...v4.43.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-28 14:15:46 -07:00
dependabot-preview[bot]
f92eff2df8 Bump @types/node from 13.9.3 to 13.13.4
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.9.3 to 13.13.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-28 14:15:15 -07:00
dependabot-preview[bot]
a65ac5f8f0 Bump ejs from 3.0.1 to 3.1.2
Bumps [ejs](https://github.com/mde/ejs) from 3.0.1 to 3.1.2.
- [Release notes](https://github.com/mde/ejs/releases)
- [Changelog](https://github.com/mde/ejs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mde/ejs/compare/v3.0.1...v3.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 12:11:18 -07:00
dependabot-preview[bot]
0e36a1c505 Bump @types/lodash from 4.14.149 to 4.14.150
Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.149 to 4.14.150.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 12:10:49 -07:00
dependabot-preview[bot]
f5bed635e0 Bump nyc from 15.0.0 to 15.0.1
Bumps [nyc](https://github.com/istanbuljs/nyc) from 15.0.0 to 15.0.1.
- [Release notes](https://github.com/istanbuljs/nyc/releases)
- [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/istanbuljs/nyc/compare/v15.0.0...v15.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 12:08:23 -07:00
dependabot-preview[bot]
905ab9f2e4 Bump eventemitter2 from 6.0.0 to 6.3.1
Bumps [eventemitter2](https://github.com/hij1nx/EventEmitter2) from 6.0.0 to 6.3.1.
- [Release notes](https://github.com/hij1nx/EventEmitter2/releases)
- [Changelog](https://github.com/EventEmitter2/EventEmitter2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hij1nx/EventEmitter2/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 12:08:04 -07:00
Elliot Lee
547b63b891 Run prettier (yarn format) 2020-04-27 12:06:18 -07:00
Elliot Lee
c26ddb497e Add api.connection.getReserveBase() (#1259)
* Returns the current minimum reserve, in drops of XRP, that is required
for an account.

* Release 1.6.6-beta.2
2020-04-27 10:02:03 -07:00
Elliot Lee
2e81cfb56f Add type for parseAccountFlags (#1258)
* Return type is `Settings`
* Bump @typescript-eslint/parser to 2.27.0
* Bump yarn.lock
* Release 1.6.6-beta.1
2020-04-27 10:02:03 -07:00
dependabot-preview[bot]
337cb6574a Bump https-proxy-agent from 4.0.0 to 5.0.0 (#1204)
Bumps [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) from 4.0.0 to 5.0.0.
- [Release notes](https://github.com/TooTallNate/node-https-proxy-agent/releases)
- [Commits](https://github.com/TooTallNate/node-https-proxy-agent/compare/4.0.0...5.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-27 10:00:53 -07:00
Elliot Lee
abcb6bfecb Travis: remove node 8 (#1257)
ripple-address-codec 4.1.1 requires node 10+
2020-04-07 11:56:39 -07:00
Elliot Lee
797fda3363 Update ripple-address-codec to 4.1.1 2020-04-03 14:08:11 -07:00
dependabot-preview[bot]
bd920ee5bb Bump @types/ws from 7.2.2 to 7.2.3 (#1239)
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 7.2.2 to 7.2.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-03 14:06:04 -07:00
Elliot Lee
2720970e1f Release 1.6.5 2020-03-23 14:53:13 -07:00
dependabot-preview[bot]
b7a12d4bbb Bump assert-diff from 2.0.3 to 3.0.0 (#1228)
Bumps [assert-diff](https://github.com/pihvi/assert-diff) from 2.0.3 to 3.0.0.
- [Release notes](https://github.com/pihvi/assert-diff/releases)
- [Commits](https://github.com/pihvi/assert-diff/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-23 14:38:51 -07:00
dependabot-preview[bot]
b4f6135b96 Bump @types/node from 13.7.7 to 13.9.3 (#1240)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.7.7 to 13.9.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-23 14:37:47 -07:00
Elliot Lee
7d65bf4641 Upgrade webpack 2020-03-23 14:37:18 -07:00
Elliot Lee
656c81a72c Upgrade mocha and remove mocha-junit-reporter 2020-03-23 14:33:34 -07:00
dependabot-preview[bot]
bfd0374ef6 Bump @typescript-eslint/eslint-plugin from 2.22.0 to 2.24.0 (#1243)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.22.0 to 2.24.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.24.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-23 11:06:25 -07:00
Rahul Kulkarni
bf1a772e40 Fix typo in comment (#1236) 2020-03-20 14:36:24 -07:00
Elliot Lee
8ede100594 Add link to release announcement mailing list 2020-03-17 12:35:35 -07:00
dependabot-preview[bot]
927f1f6d9a Bump ws from 7.2.1 to 7.2.3 (#1235)
Bumps [ws](https://github.com/websockets/ws) from 7.2.1 to 7.2.3.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.2.1...7.2.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-16 14:45:25 -07:00
dependabot-preview[bot]
0be4c6f233 Bump @types/mocha from 7.0.1 to 7.0.2
Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 7.0.1 to 7.0.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-07 01:43:44 +00:00
Elliot Lee
912eea5037 Merge branch 'develop' of github.com:ripple/ripple-lib into develop 2020-03-06 12:34:28 -08:00
Elliot Lee
06a029b89c connection.ts: fix typo 2020-03-06 12:33:55 -08:00
dependabot-preview[bot]
df708a77d2 Bump webpack from 4.41.6 to 4.42.0 (#1223)
Bumps [webpack](https://github.com/webpack/webpack) from 4.41.6 to 4.42.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.41.6...v4.42.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-04 11:28:07 -05:00
dependabot-preview[bot]
31232ad50c Bump @typescript-eslint/eslint-plugin from 2.21.0 to 2.22.0 (#1226)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.21.0 to 2.22.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.22.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-04 11:28:01 -05:00
dependabot-preview[bot]
7abaf61e11 Bump @types/node from 13.7.6 to 13.7.7 (#1225)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.7.6 to 13.7.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-02 09:13:56 -05:00
dependabot-preview[bot]
903a6e31b8 Bump typescript from 3.8.2 to 3.8.3 (#1224)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.8.2 to 3.8.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v3.8.2...v3.8.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-02 09:13:43 -05:00
dependabot-preview[bot]
2eb5898e8b Bump @types/ws from 7.2.1 to 7.2.2 (#1219)
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 7.2.1 to 7.2.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-26 23:10:01 -08:00
dependabot-preview[bot]
dc2bc0291b Bump mocha from 7.0.1 to 7.1.0 (#1220)
Bumps [mocha](https://github.com/mochajs/mocha) from 7.0.1 to 7.1.0.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v7.0.1...v7.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-26 22:58:06 -08:00
dependabot-preview[bot]
1357f7eeb4 Bump @types/node from 13.7.4 to 13.7.6 (#1221)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.7.4 to 13.7.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-26 22:57:29 -08:00
Thomas Silkjær
b0cb0a759b Added xrplorer.com (#1218) 2020-02-26 22:57:19 -08:00
dependabot-preview[bot]
19d0ca6bfc Bump @typescript-eslint/eslint-plugin from 2.20.0 to 2.21.0 (#1217)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.20.0 to 2.21.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.21.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-25 11:19:09 -08:00
dependabot-preview[bot]
26d03fe2a5 Bump typescript from 3.7.5 to 3.8.2 (#1215)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.7.5 to 3.8.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-22 12:46:57 -08:00
dependabot-preview[bot]
dfa61df40a Bump @types/node from 13.7.2 to 13.7.4 (#1214)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.7.2 to 13.7.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-20 10:54:46 -08:00
dependabot-preview[bot]
d154cced14 Bump @types/node from 13.7.1 to 13.7.2 (#1213)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.7.1 to 13.7.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-19 07:52:27 -08:00
Elliot Lee
80b96d9bc9 Release 1.6.4 2020-02-18 11:19:03 -08:00
dependabot-preview[bot]
8fa30f71eb Bump @typescript-eslint/eslint-plugin from 2.19.2 to 2.20.0 (#1212)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.19.2 to 2.20.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.20.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-18 11:14:57 -08:00
Elliot Lee
804094b1ce Fix generateXAddress() and generateXAddress() with no entropy (#1211)
Fix #1209

Calling: Uint8Array.from(undefined)
Throws:
  TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at Function.from (<anonymous>)

* generateSeed: Pass only entropy and algorithm

* Update typescript and ripple-keypairs

* Improve unit tests

* Rename [Original Address] to [Classic Address] in test output
2020-02-18 11:14:09 -08:00
dependabot-preview[bot]
9caf077b58 Bump @typescript-eslint/eslint-plugin from 2.19.0 to 2.19.2 (#1205)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.19.0 to 2.19.2.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.19.2/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 10:30:19 -08:00
dependabot-preview[bot]
1a5ba06ca3 Bump webpack from 4.41.4 to 4.41.6 (#1206)
Bumps [webpack](https://github.com/webpack/webpack) from 4.41.4 to 4.41.6.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.41.4...v4.41.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 10:30:05 -08:00
dependabot-preview[bot]
657cad9ffd Bump @types/node from 13.7.0 to 13.7.1 (#1207)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.7.0 to 13.7.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 10:29:46 -08:00
dependabot-preview[bot]
a338a936db Bump webpack-cli from 3.3.10 to 3.3.11 (#1208)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 3.3.10 to 3.3.11.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/next/CHANGELOG_v3.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/v3.3.10...v3.3.11)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 10:29:33 -08:00
Elliot Lee
226e10bca2 Release 1.6.3 2020-02-05 22:19:47 -08:00
dependabot-preview[bot]
3a5a989011 Bump ripple-keypairs from 1.0.0-beta.6 to 1.0.0 (#1203)
Bumps [ripple-keypairs](https://github.com/ripple/ripple-keypairs) from 1.0.0-beta.6 to 1.0.0.
- [Release notes](https://github.com/ripple/ripple-keypairs/releases)
- [Changelog](https://github.com/ripple/ripple-keypairs/blob/master/HISTORY.md)
- [Commits](https://github.com/ripple/ripple-keypairs/commits/1.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-05 18:36:50 -08:00
dependabot-preview[bot]
c9720ef061 Bump @types/node from 13.5.3 to 13.7.0 (#1201)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.5.3 to 13.7.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-05 10:33:54 -08:00
dependabot-preview[bot]
b6927f178f Bump @typescript-eslint/eslint-plugin from 2.18.0 to 2.19.0 (#1202)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.18.0 to 2.19.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.19.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-05 10:33:42 -08:00
Elliot Lee
6b40e4fe9d Release 1.6.3-beta.1 (#1195)
* Update ripple-keypairs and fix types
2020-02-02 15:14:44 -08:00
Elliot Lee
59ec56db4c Update README.md 2020-01-31 13:59:11 -08:00
dependabot-preview[bot]
a8119d678a Bump @types/node from 13.5.2 to 13.5.3 (#1200)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.5.2 to 13.5.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-31 10:51:36 -08:00
dependabot-preview[bot]
8e38e313b2 Bump @types/ws from 7.2.0 to 7.2.1 (#1197)
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 7.2.0 to 7.2.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-31 00:40:07 -08:00
dependabot-preview[bot]
b7b75d78ae Bump @types/node from 13.5.1 to 13.5.2 (#1198)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.5.1 to 13.5.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-31 00:39:52 -08:00
dependabot-preview[bot]
824efb6b59 Bump @types/mocha from 5.2.7 to 7.0.1 (#1199)
Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 5.2.7 to 7.0.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-31 00:39:41 -08:00
dependabot-preview[bot]
c151ca202c Bump ripple-address-codec from 4.0.0 to 4.1.0 (#1184)
Bumps [ripple-address-codec](https://github.com/ripple/ripple-address-codec) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/ripple/ripple-address-codec/releases)
- [Changelog](https://github.com/ripple/ripple-address-codec/blob/master/HISTORY.md)
- [Commits](https://github.com/ripple/ripple-address-codec/compare/4.0.0...4.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-29 10:00:09 -08:00
dependabot-preview[bot]
b9a64c92e7 Bump @typescript-eslint/eslint-plugin from 2.16.0 to 2.18.0 (#1189)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.16.0 to 2.18.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.18.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-29 09:59:51 -08:00
dependabot-preview[bot]
bcaa06721a Bump ripple-keypairs from 0.11.0 to 0.11.1 (#1190)
Bumps [ripple-keypairs](https://github.com/ripple/ripple-keypairs) from 0.11.0 to 0.11.1.
- [Release notes](https://github.com/ripple/ripple-keypairs/releases)
- [Changelog](https://github.com/ripple/ripple-keypairs/blob/0.11.1/HISTORY.md)
- [Commits](https://github.com/ripple/ripple-keypairs/compare/0.11.0...0.11.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-29 09:58:35 -08:00
dependabot-preview[bot]
06227ef12b Bump @types/node from 13.5.0 to 13.5.1 (#1193)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.5.0 to 13.5.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-29 09:57:21 -08:00
Nicholas Smith
c17827e030 Assign event listener to socket close event on open before attempting post-open logic (#1186)
* Assign event listener to socket close event on open before attempting to execute post-connection logic, prottects possible unhandled rejection in disconnect
* Remove try/catch for linting failure
* Up timeout for CI failure
* Feedback emit error for disconnection failure on connect failure
* Feedback ignore error on disconnect, propagate root cause
* Feedback add extra test check for expected error on connect
* Feedback remove setTimeout for await reconnect
2020-01-28 09:08:47 -05:00
dependabot-preview[bot]
97ca0f0b21 Bump @types/node from 13.1.8 to 13.5.0 (#1187)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.1.8 to 13.5.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-28 02:23:50 -08:00
dependabot-preview[bot]
e4e6419e50 Bump mocha from 7.0.0 to 7.0.1 (#1188)
Bumps [mocha](https://github.com/mochajs/mocha) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v7.0.0...v7.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-28 02:23:35 -08:00
Elliot Lee
fd8c883cf4 Update tsconfig-base.json - remove comments 2020-01-21 13:52:53 -08:00
FKSRipple
6b66a59673 Merge pull request #1180 from ripple/dependabot/npm_and_yarn/mocha-junit-reporter-1.23.3
Bump mocha-junit-reporter from 1.23.2 to 1.23.3
2020-01-20 20:55:40 -08:00
FKSRipple
46177338c2 Merge pull request #1182 from ripple/dependabot/npm_and_yarn/types/node-13.1.8
Bump @types/node from 13.1.7 to 13.1.8
2020-01-20 20:55:28 -08:00
dependabot-preview[bot]
6fcff9b106 Bump @types/node from 13.1.7 to 13.1.8
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.1.7 to 13.1.8.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-20 13:27:16 +00:00
Elliot Lee
208f5f6c5c Release 1.6.2 2020-01-17 15:30:21 -08:00
Elliot Lee
de3e2a9867 Docs: Fix whitespace
Do not use newline-trimming ending tag

Fix #1175 (bug introduced in #1153)
2020-01-17 15:24:23 -08:00
dependabot-preview[bot]
40eea3c659 Bump typescript from 3.7.4 to 3.7.5 (#1181)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.7.4 to 3.7.5.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v3.7.4...v3.7.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-17 14:45:33 -05:00
dependabot-preview[bot]
4f9b6b9186 Bump mocha-junit-reporter from 1.23.2 to 1.23.3
Bumps [mocha-junit-reporter](https://github.com/michaelleeallen/mocha-junit-reporter) from 1.23.2 to 1.23.3.
- [Release notes](https://github.com/michaelleeallen/mocha-junit-reporter/releases)
- [Commits](https://github.com/michaelleeallen/mocha-junit-reporter/compare/v1.23.2...v1.23.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-17 13:26:35 +00:00
FKSRipple
4a848ec527 Merge pull request #1179 from nickewansmith/fix-unhandled-rejection-warning-on-heartbeat
Catch possible error in reconnect() on _heartbeat(), emit reconnect error
2020-01-16 08:32:37 -08:00
FKSRipple
10414e169c Merge pull request #1171 from ripple/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-2.16.0
Bump @typescript-eslint/eslint-plugin from 2.13.0 to 2.16.0
2020-01-16 08:22:42 -08:00
FKSRipple
1a6c68d028 Merge pull request #1173 from ripple/FKSRipple-patch-1-1
Add Update note to HISTORY.md
2020-01-16 08:22:21 -08:00
FKSRipple
9156734ced Update HISTORY.md 2020-01-16 08:22:00 -08:00
FKSRipple
0dfe3ff4ac Merge pull request #1177 from ripple/dependabot/npm_and_yarn/types/ws-7.2.0
Bump @types/ws from 6.0.4 to 7.2.0
2020-01-16 08:21:12 -08:00
FKSRipple
3a8c7f02cc Merge pull request #1176 from ripple/dependabot/npm_and_yarn/types/node-13.1.7
Bump @types/node from 13.1.6 to 13.1.7
2020-01-16 08:20:53 -08:00
Nicholas Smith
e03b192fcc Catch possible error in reconnect() on _heartbeat(), emit reconnect error 2020-01-15 12:36:39 -05:00
dependabot-preview[bot]
cf40bd2c30 Bump @types/ws from 6.0.4 to 7.2.0
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 6.0.4 to 7.2.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-15 13:40:35 +00:00
dependabot-preview[bot]
4082e88416 Bump @types/node from 13.1.6 to 13.1.7
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.1.6 to 13.1.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-15 13:40:09 +00:00
FKSRipple
27abc10d93 Merge pull request #1172 from ripple/dependabot/npm_and_yarn/ts-node-8.6.2
Bump ts-node from 8.5.4 to 8.6.2
2020-01-14 11:27:39 -08:00
FKSRipple
d6474d71f2 Update HISTORY.md 2020-01-14 11:26:35 -08:00
dependabot-preview[bot]
d57603e854 Bump ts-node from 8.5.4 to 8.6.2
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.5.4 to 8.6.2.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v8.5.4...v8.6.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-14 13:41:19 +00:00
dependabot-preview[bot]
ac92584678 Bump @typescript-eslint/eslint-plugin from 2.13.0 to 2.16.0
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.13.0 to 2.16.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.16.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-14 13:40:55 +00:00
Elliot Lee
c234be0a8c Release 1.6.1 (#1170)
Update HISTORY and version number
2020-01-13 23:48:59 -08:00
Hans Bergren
7c6b8398cf Improve documentation for generateXAddress() (#1169)
It takes an optional property for including the classic address in the
return payload

Co-authored-by: Elliot Lee
2020-01-13 23:39:02 -08:00
Elliot Lee
7de677c953 Create SECURITY.md (#1164) 2020-01-13 23:27:05 -08:00
FKSRipple
aa23f44555 Merge pull request #1168 from ripple/dependabot/npm_and_yarn/mocha-junit-reporter-1.23.2
Bump mocha-junit-reporter from 1.23.1 to 1.23.2
2020-01-13 22:17:47 -08:00
dependabot-preview[bot]
901d75a1eb Bump mocha-junit-reporter from 1.23.1 to 1.23.2
Bumps [mocha-junit-reporter](https://github.com/michaelleeallen/mocha-junit-reporter) from 1.23.1 to 1.23.2.
- [Release notes](https://github.com/michaelleeallen/mocha-junit-reporter/releases)
- [Commits](https://github.com/michaelleeallen/mocha-junit-reporter/compare/v1.23.1...v1.23.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-13 13:27:35 +00:00
FKSRipple
aa95286810 Merge pull request #1140 from ripple/connection-cleanup-tests
Refactor tests to support the new connection logic
2020-01-10 17:24:52 -08:00
FKSRipple
f6b3f661d6 Merge branch 'develop' into connection-cleanup-tests 2020-01-10 16:15:16 -08:00
FKSRipple
0850d85791 Merge pull request #1141 from ripple/connection-cleanup-logic
Refactor the Connection class
2020-01-10 16:10:27 -08:00
FKSRipple
c564400ac4 Merge pull request #1119 from ripple/connection-cleanup-ledger
Add LedgerHistory to Connection
2020-01-10 16:07:08 -08:00
dependabot-preview[bot]
94ab545ffe Bump @types/node from 13.1.4 to 13.1.6 (#1163)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.1.4 to 13.1.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-10 11:57:41 -08:00
Hans Bergren
e10df203b7 Update documentation for functions that can be called offline (#1159)
You can also generate an X-Address without a connection to the ledger.
2020-01-09 10:33:12 -05:00
Hans Bergren
eea20a6eab Improve documentation for address generation (#1158)
The documentation previously just stated that any array of integers
was acceptable for providing as entropy, but it must be an array of
length 16 where the values are from 0-255 (uint8) to ensure we have
16 bytes of entropy.
2020-01-08 18:30:08 -05:00
Fred K. Schott
5f208801ee move backoff into codebase 2020-01-08 14:50:17 -08:00
Fred K. Schott
0a22697e5d Refactor the Connection 2020-01-08 12:21:37 -08:00
Fred K. Schott
30cf4f0b00 cleanup event listeners 2020-01-08 12:20:58 -08:00
Fred K. Schott
e4bb88a725 clarify comment 2020-01-08 12:20:58 -08:00
Fred K. Schott
e3822e6bc3 refactor tests for the new connection logic 2020-01-08 12:20:58 -08:00
Fred K. Schott
20d3be0d1d nevermind, regression wasn't actually a regression 2020-01-08 12:20:40 -08:00
Fred K. Schott
1785863686 update docs, fix a regression 2020-01-08 11:53:33 -08:00
FKSRipple
ea4ced3cc1 Merge pull request #1154 from ripple/dependabot/npm_and_yarn/types/node-13.1.4
Bump @types/node from 13.1.2 to 13.1.4
2020-01-08 11:35:01 -08:00
FKSRipple
149008d18b Merge pull request #1156 from ripple/dependabot/npm_and_yarn/ripple-binary-codec-0.2.6
Bump ripple-binary-codec from 0.2.5 to 0.2.6
2020-01-08 11:34:15 -08:00
FKSRipple
55a21d2eec Merge pull request #1157 from ripple/dependabot/npm_and_yarn/mocha-7.0.0
Bump mocha from 6.2.2 to 7.0.0
2020-01-08 11:32:45 -08:00
dependabot-preview[bot]
c7491e631a Bump mocha from 6.2.2 to 7.0.0
Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-08 13:40:56 +00:00
dependabot-preview[bot]
468a205e36 Bump ripple-binary-codec from 0.2.5 to 0.2.6
Bumps [ripple-binary-codec](https://github.com/ripple/ripple-binary-codec) from 0.2.5 to 0.2.6.
- [Release notes](https://github.com/ripple/ripple-binary-codec/releases)
- [Changelog](https://github.com/ripple/ripple-binary-codec/blob/master/HISTORY.md)
- [Commits](https://github.com/ripple/ripple-binary-codec/compare/0.2.5...0.2.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-08 13:40:27 +00:00
dependabot-preview[bot]
bebe951a57 Bump @types/node from 13.1.2 to 13.1.4
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.1.2 to 13.1.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-08 13:39:39 +00:00
FKSRipple
85a8ab32ef update docs dependencies (#1153) 2020-01-07 15:30:29 -08:00
FKSRipple
34ddbe170c Merge pull request #1127 from you21979/fix-account-object
fix AccountObjectsResponse structure
2020-01-07 11:52:01 -08:00
FKSRipple
e9846eb249 Merge pull request #1145 from ripple/dependabot/npm_and_yarn/nyc-15.0.0
Bump nyc from 14.1.1 to 15.0.0
2020-01-07 11:51:39 -08:00
FKSRipple
7cc418ac93 Merge pull request #1131 from ripple/dependabot/npm_and_yarn/ws-7.2.1
Bump ws from 7.2.0 to 7.2.1
2020-01-07 11:50:43 -08:00
FKSRipple
69532a4f23 Merge pull request #1128 from ripple/dependabot/npm_and_yarn/typescript-3.7.4
Bump typescript from 3.6.4 to 3.7.4
2020-01-07 11:49:21 -08:00
FKSRipple
f59419d96f Update ledger_entries.ts 2020-01-07 11:44:14 -08:00
FKSRipple
7f288d0555 Update signers.ts 2020-01-07 11:43:37 -08:00
FKSRipple
53afa8c276 Merge pull request #1121 from r0bertz/develop
Document message type 'path_find' that connection can listen on
2020-01-07 11:34:57 -08:00
dependabot-preview[bot]
22f4dd2f75 Bump ws from 7.2.0 to 7.2.1
Bumps [ws](https://github.com/websockets/ws) from 7.2.0 to 7.2.1.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.2.0...7.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-07 19:29:37 +00:00
FKSRipple
0989152024 Merge pull request #1150 from ripple/dependabot/npm_and_yarn/ripple-lib-transactionparser-0.8.2
Bump ripple-lib-transactionparser from 0.8.1 to 0.8.2
2020-01-07 11:28:03 -08:00
dependabot-preview[bot]
f74809d361 Bump nyc from 14.1.1 to 15.0.0
Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0.
- [Release notes](https://github.com/istanbuljs/nyc/releases)
- [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-07 19:27:39 +00:00
FKSRipple
9724cf7776 Merge pull request #1144 from ripple/dependabot/npm_and_yarn/eslint-6.8.0
Bump eslint from 6.5.1 to 6.8.0
2020-01-07 11:26:01 -08:00
dependabot-preview[bot]
909e5438a8 Bump typescript from 3.6.4 to 3.7.4
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.6.4 to 3.7.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-06 21:49:27 +00:00
Hans Bergren
3c534d87c0 Release 1.6.0 2020-01-06 16:47:44 -05:00
dependabot-preview[bot]
4022a59705 Bump ripple-lib-transactionparser from 0.8.1 to 0.8.2
Bumps [ripple-lib-transactionparser](https://github.com/ripple/ripple-lib-extensions) from 0.8.1 to 0.8.2.
- [Release notes](https://github.com/ripple/ripple-lib-extensions/releases)
- [Commits](https://github.com/ripple/ripple-lib-extensions/compare/0.8.1...0.8.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-06 13:26:07 +00:00
Elliot Lee
138e7942da Add support for AccountDelete (#1120)
https://xrpl.org/accountdelete.html
2020-01-06 04:01:10 -08:00
dependabot-preview[bot]
d7d26a3ae1 Bump eslint from 6.5.1 to 6.8.0
Bumps [eslint](https://github.com/eslint/eslint) from 6.5.1 to 6.8.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v6.5.1...v6.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-06 03:56:35 +00:00
dependabot-preview[bot]
23504821cf Bump @typescript-eslint/parser from 2.13.0 to 2.14.0 (#1147)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 2.13.0 to 2.14.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.14.0/packages/parser)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-05 19:54:52 -08:00
dependabot-preview[bot]
b09da3e8f1 Bump @types/node from 13.1.1 to 13.1.2 (#1148)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 13.1.1 to 13.1.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-05 19:54:37 -08:00
Elliot Lee
f3dd2fec99 Merge pull request #1098 from nickewansmith/fix-possible-unhandled-throw-on-send
Adds unit test for ripple#1092, fixes unhandled throw on upgraded ws send
2020-01-05 19:51:58 -08:00
Elliot Lee
462e375800 Add ripple-latest.js to npm 2019-12-28 11:51:00 -08:00
Elliot Lee
ca8c881375 Release 1.5.1 2019-12-28 11:47:57 -08:00
Elliot Lee
96605a57d4 Fix CDNs (#1142)
* Rename browser build output file to ripple-latest-min.js (the name prior to #1061)
* Add unpkg and jsdelivr
2019-12-28 11:46:52 -08:00
FKSRipple
491ce40081 Merge pull request #1136 from ripple/dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-2.13.0
Bump @typescript-eslint/eslint-plugin from 2.5.0 to 2.13.0
2019-12-27 12:46:00 -08:00
FKSRipple
f33eb07bdd Merge pull request #1135 from ripple/dependabot/npm_and_yarn/https-proxy-agent-4.0.0
Bump https-proxy-agent from 3.0.1 to 4.0.0
2019-12-27 10:16:58 -08:00
dependabot-preview[bot]
8bb1dc9b47 Bump @typescript-eslint/eslint-plugin from 2.5.0 to 2.13.0
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 2.5.0 to 2.13.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.13.0/packages/eslint-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-27 18:03:54 +00:00
FKSRipple
78b50472da Merge pull request #1137 from ripple/dependabot/npm_and_yarn/types/node-13.1.1
Bump @types/node from 12.12.5 to 13.1.1
2019-12-27 10:02:11 -08:00
FKSRipple
e0259b37ed Merge pull request #1138 from ripple/dependabot/npm_and_yarn/eventemitter2-6.0.0
Bump eventemitter2 from 5.0.1 to 6.0.0
2019-12-27 10:01:27 -08:00
FKSRipple
bf863a2594 Merge pull request #1139 from ripple/dependabot/npm_and_yarn/typescript-eslint/parser-2.13.0
Bump @typescript-eslint/parser from 2.5.0 to 2.13.0
2019-12-27 10:01:10 -08:00
FKSRipple
edd174881e Merge pull request #1134 from ripple/dependabot/npm_and_yarn/types/lodash-4.14.149
Bump @types/lodash from 4.14.144 to 4.14.149
2019-12-27 09:57:50 -08:00
dependabot-preview[bot]
0bf747f6fc Bump @typescript-eslint/parser from 2.5.0 to 2.13.0
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 2.5.0 to 2.13.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v2.13.0/packages/parser)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-27 13:40:22 +00:00
dependabot-preview[bot]
ab4d2b5d58 Bump eventemitter2 from 5.0.1 to 6.0.0
Bumps [eventemitter2](https://github.com/hij1nx/EventEmitter2) from 5.0.1 to 6.0.0.
- [Release notes](https://github.com/hij1nx/EventEmitter2/releases)
- [Changelog](https://github.com/EventEmitter2/EventEmitter2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hij1nx/EventEmitter2/commits/v6.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-27 13:39:54 +00:00
dependabot-preview[bot]
1b81280358 Bump mocha from 6.2.0 to 6.2.2 (#1126)
Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.0 to 6.2.2.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v6.2.0...v6.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-26 12:49:31 -08:00
dependabot-preview[bot]
32f4eea3b8 Bump @types/node from 12.12.5 to 13.1.1
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.12.5 to 13.1.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-26 20:21:14 +00:00
dependabot-preview[bot]
1a3a49decb Bump @types/ws from 6.0.3 to 6.0.4 (#1125)
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 6.0.3 to 6.0.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-26 12:19:32 -08:00
dependabot-preview[bot]
416717aff6 Bump https-proxy-agent from 3.0.1 to 4.0.0
Bumps [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) from 3.0.1 to 4.0.0.
- [Release notes](https://github.com/TooTallNate/node-https-proxy-agent/releases)
- [Commits](https://github.com/TooTallNate/node-https-proxy-agent/compare/3.0.1...4.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-24 13:53:06 +00:00
dependabot-preview[bot]
769d955a40 Bump @types/lodash from 4.14.144 to 4.14.149
Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.144 to 4.14.149.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-24 13:52:42 +00:00
dependabot-preview[bot]
6de85b841d Bump ts-node from 8.4.1 to 8.5.4 (#1124)
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.4.1 to 8.5.4.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v8.4.1...v8.5.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-23 11:40:59 -08:00
yuki akiyama
66db127245 fix AccountObjectsResponse: Does not match the structure returned by the API. 2019-12-23 13:21:26 +09:00
dependabot-preview[bot]
b4c6af29e4 Bump webpack from 4.41.2 to 4.41.4 (#1123)
Bumps [webpack](https://github.com/webpack/webpack) from 4.41.2 to 4.41.4.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.41.2...v4.41.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-22 15:53:29 -08:00
dependabot-preview[bot]
7192606e21 Bump webpack-cli from 3.3.9 to 3.3.10 (#1122)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 3.3.9 to 3.3.10.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/v3.3.10/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/v3.3.9...v3.3.10)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-22 15:52:01 -08:00
Robert Zhang
932be02e9e Document message type 'path_find' that connection can listen on 2019-12-21 20:01:00 -08:00
Fred K. Schott
fc524894c6 add ledger to connection 2019-12-18 11:35:47 -08:00
FKSRipple
f5196389e8 Merge pull request #1116 from ripple/prettier-format
run prettier format
2019-12-18 11:25:14 -08:00
FKSRipple
27be06c5c9 Merge pull request #1118 from ripple/eslint-fix
Fix incorrect eslint matching glob
2019-12-18 11:24:52 -08:00
Fred K. Schott
1d3ddb5e85 update eslint command 2019-12-17 10:36:32 -08:00
Fred K. Schott
2145c104fd run prettier format 2019-12-17 10:35:59 -08:00
FKSRipple
64e0d098e7 Merge pull request #1115 from ripple/connection-cleanup-config
Cleanup the connection config state
2019-12-17 10:31:04 -08:00
FKSRipple
50d8cbb0ee Merge pull request #1114 from ripple/connection-cleanup-trace
Cleanup the connection trace logic
2019-12-17 08:58:44 -08:00
Fred K. Schott
9580397558 cleanup the connection config 2019-12-16 17:26:00 -08:00
Fred K. Schott
cf544b74f5 fix msg abbreviation 2019-12-16 17:25:21 -08:00
Fred K. Schott
312f831efb cleanup the connection trace logic 2019-12-16 11:57:51 -08:00
Elliot Lee
f5bad5d28e Release 1.5.0 2019-12-14 22:45:12 -08:00
Elliot Lee
9b7d255200 Update webpack (#1112) 2019-12-14 10:24:32 -08:00
Elliot Lee
7a027bdd93 Update README (#1111) 2019-12-14 10:24:05 -08:00
FKSRipple
439a611a9e Add a heartbeat to detect hung connections (#1101)
* disconnect is now reconnect on heartbeat fail
2019-12-14 10:23:09 -08:00
RareData
5f92b230aa Add support for WalletLocator (#1083)
Being able to fetch the WalletLocator field opens up new use-cases. The field can store for example a transaction hash, referencing a transaction with memos containing useful data.
2019-12-11 23:47:41 -08:00
Elliot Lee
29bc5303ae Fix tests (#1109)
* Revert "[docs] Update getTransactions example request/response (#1106)"

This reverts commit 5314e5e7e9.

* Redo #1106 but with passing tests
2019-12-11 22:54:33 -08:00
Elliot Lee
5314e5e7e9 [docs] Update getTransactions example request/response (#1106) 2019-12-11 14:45:04 -08:00
Elliot Lee
c88462c99b [package.json] Require node 8 and yarn (#1107) 2019-12-11 14:43:04 -08:00
Elliot Lee
0b552f1a7e Update yarn.lock
ripple-lib-transactionparser@0.8.1
2019-12-10 11:36:34 -08:00
FKSRipple
552635a3c7 Merge pull request #1104 from ripple/all-tests
Migrate RippleAPI tests to new test runner
2019-12-09 11:00:34 -08:00
FKSRipple
ca769bee39 Merge pull request #1103 from ripple/test-runner-02
Make improvements to test runner
2019-12-09 11:00:06 -08:00
Elliot Lee
b7ca0a0a14 Merge pull request #1102 from ripple/test-runner-01
Small source fixes, based on issues found with test improvements
2019-12-09 09:16:58 -08:00
Fred K. Schott
84097a3179 move the remaining RippleAPI tests to the new test runner 2019-11-26 16:52:21 -08:00
Fred K. Schott
8ba36b2588 fix bad path 2019-11-26 16:52:05 -08:00
Fred K. Schott
e1d4ebc5f6 add docs 2019-11-26 16:50:12 -08:00
Fred K. Schott
9e712d6089 fix old ref 2019-11-26 16:44:11 -08:00
Fred K. Schott
90bea3dc6b fix old utils ref 2019-11-26 16:41:16 -08:00
Fred K. Schott
bf480bb971 remove outdated test utils 2019-11-26 16:37:56 -08:00
Fred K. Schott
a94b48be50 improve the test runner 2019-11-26 16:34:17 -08:00
Fred K. Schott
abed42d848 fix source directory, based on issues found with test improvements 2019-11-26 16:01:03 -08:00
FKSRipple
3d6e795ca5 Merge pull request #1096 from magmel48/typescript3.7-TransactionJSON-conflict-fix
TransactionJSON conflict fix
2019-11-19 15:04:10 -08:00
magmel
a3cbe8e9d4 back to ts3.6.4 2019-11-18 15:39:45 +03:00
FKSRipple
0a2000098a Merge pull request #1097 from r0bertz/develop
Bump ripple-lib-transactionparser to 0.8.1
2019-11-18 00:02:11 -08:00
FKSRipple
a2348b5133 revert package version change 2019-11-18 00:01:18 -08:00
FKSRipple
20d2f9d894 Merge pull request #1086 from ripple/refactor-tests
Add RippleAPI test runner, with support for multiple address testing
2019-11-17 23:49:22 -08:00
FKSRipple
321f908e76 Merge pull request #1084 from ripple/tests-to-ts-04
Complete move of tests to TS
2019-11-17 23:42:38 -08:00
FKSRipple
49875cb0e5 Update api-test.ts 2019-11-17 23:42:21 -08:00
Nicholas Smith
fa6a2c5bbb Adds unit test for ripple#1092, fixes unhandled throw when not connected on send due to upgraded ws module 2019-11-17 01:28:19 -05:00
Le Zhang
1074c00b60 Bump ripple-lib-transactionparser to 0.8.1 2019-11-16 01:05:48 -08:00
magmel
8a8b10541e yarn.lock 2019-11-15 15:47:14 +03:00
magmel
46cf4d677c typescript ^ in package.json 2019-11-15 15:46:11 +03:00
magmel
94587d7515 moved TransactionJSON to proper types.ts file 2019-11-15 15:44:31 +03:00
Elliot Lee
14ec58ef9a Fix link 2019-11-14 21:00:33 -08:00
Elliot Lee
8f4f6f3de0 Release 1.4.2 2019-11-14 20:50:29 -08:00
Elliot Lee
f8c0ac3ce0 Update docs
* Add tickSize parameter
* Fix formatting
2019-11-14 20:38:40 -08:00
RareData
8ebad98912 Add support for tick size (#1090) 2019-11-14 20:13:58 -08:00
FKSRipple
08429b6110 Merge pull request #1092 from nickewansmith/fix-unhandled-rejection-warning-on-send
Fix Unhandled Promise Rejection Warning on message _send
2019-11-13 19:54:48 -08:00
FKSRipple
0e128e15f1 Merge pull request #1089 from RareData/patch-2
Update email hash default to allow proper clearing
2019-11-13 19:51:53 -08:00
Fred K. Schott
b77a12fd0d Add test runner for RippleAPI, begin to break up large test file 2019-11-13 19:47:49 -08:00
Fred K. Schott
a98526b398 Revert "Revert "Merge pull request #1052 from FredKSchott/tests-to-ts-03""
This reverts commit b648387a57.
2019-11-13 19:47:18 -08:00
Fred K. Schott
5639bf9d48 merge xaddress tests into main test file 2019-11-13 19:47:18 -08:00
Fred K. Schott
c626685103 start running test/x-address-api-test.ts 2019-11-13 19:47:18 -08:00
FKSRipple
e233d15fbb Merge pull request #1087 from ripple/prettier
Add a prettier config
2019-11-13 09:51:45 -08:00
Fred K. Schott
a5d83900d9 set trailing trailingComma to none 2019-11-13 09:50:13 -08:00
Nicholas Smith
d8dbeedcc2 Adds an immediate catch to the _send promise passed to _whenReady in case there is rejection before async handlers are added 2019-11-13 01:24:09 -05:00
FKSRipple
56b67d62a3 Update Node.js Testing Versions (#1085)
Updated our testing matrix based on: https://nodejs.org/en/about/releases/

- Node 11 is no longer supported (not LTS)
- Node 12 added (active LTS)
- Node 13 added ("current" release)
2019-11-11 13:56:22 -08:00
RareData
dc084b4bd9 Add XRP Toolkit reference (#1088) 2019-11-11 13:54:27 -08:00
RareData
1bc0eab7ae Update email hash default to fix clearing bug 2019-11-11 19:09:32 +01:00
Fred K. Schott
ca14d1b108 add a prettier config 2019-11-10 13:56:42 -08:00
Elliot Lee
d6757aced2 Release 1.4.1 (#1079) 2019-11-06 21:30:14 -08:00
Keefer Taylor
5c84eed292 Fix Travis Build (#1076)
* Drop support for node 6

* Add build badge

* Remove `compile` command, no longer used
2019-11-06 16:44:57 -08:00
Elliot Lee
b648387a57 Revert "Merge pull request #1052 from FredKSchott/tests-to-ts-03"
This reverts commit e08367365f, reversing
changes made to 36a9e7a7cf.
2019-11-06 10:34:05 -08:00
Tyler Levine
5232f95c3f Change TypeScript compile target to es6 (#1071)
This allows for the use of Node 6. Note that Node v6 is no longer supported by Node.js (End-of-life'd in April 2019). We recommend updating to Node v8/v10 ASAP, to keep getting security updates and fixes from the Node.js team.
2019-11-05 09:05:47 -08:00
FKSRipple
0742960ec4 Merge pull request #1061 from ripple/webpack-update
Update Webpack
2019-11-05 08:13:44 -08:00
Fred K. Schott
4c41b7f8df revert name change 2019-11-05 08:13:27 -08:00
Fred K. Schott
c5d0c24237 update webpack flow 2019-11-04 21:33:39 -08:00
FKSRipple
8b5c51ceaa Merge pull request #1073 from ripple/update-ws
update ws dependency
2019-11-04 19:38:05 -08:00
Fred K. Schott
c09bceb66a fix type 2019-11-04 19:36:34 -08:00
Fred K. Schott
e7afd3ec76 respond to comments 2019-11-04 19:33:43 -08:00
Fred K. Schott
3d30be3472 update ws dependency 2019-11-04 19:33:43 -08:00
FKSRipple
e08367365f Merge pull request #1052 from FredKSchott/tests-to-ts-03
Convert the rest of the test helpers to TS
2019-11-04 19:30:02 -08:00
Fred K. Schott
6692fbeed4 respond to comments 2019-11-04 19:20:40 -08:00
FKSRipple
36a9e7a7cf Merge pull request #1074 from ripple/update-bignumber
update bignumber dependency
2019-11-04 18:59:43 -08:00
FKSRipple
49b5ff5fd9 Merge pull request #1075 from ripple/update-keypairs
update ripple-keypairs
2019-11-04 18:58:16 -08:00
Fred K. Schott
1bde56a11a update ripple-keypairs 2019-11-02 08:54:46 -07:00
Fred K. Schott
f47d7b6935 update bignumber dependency 2019-11-02 08:36:46 -07:00
Fred K. Schott
2dbad40a34 update assert-diff 2019-11-02 07:51:39 -07:00
Fred K. Schott
39f6a51794 convert the rest of the helper files to ts 2019-11-02 07:40:52 -07:00
Fred K. Schott
7ec128c2e4 move tests to TypeScript 2019-11-02 07:40:52 -07:00
FKSRipple
b55f0e849e Merge pull request #1069 from mDuo13/getAccountObjects_doc
getAccountObjects doc fix
2019-11-02 06:54:13 -07:00
mDuo13
f158390ba1 getAccountObjects doc fix
Add necessary blank line for the list to render properly. (xrpl.org's
Markdown parser won't recognize the list without it.)
2019-10-29 14:23:10 -07:00
Elliot Lee
e4b245104a Release 1.4.0 2019-10-28 17:10:03 -07:00
Elliot Lee
789497b07e Fix lint errors 2019-10-28 17:01:32 -07:00
FKSRipple
5cf01ba099 Merge pull request #1051 from FredKSchott/tests-to-ts-02
Move tests to TypeScript
2019-10-28 10:54:39 -07:00
Fred K. Schott
e8669891f8 small typo fixes 2019-10-28 10:54:06 -07:00
Fred K. Schott
ac0f265a5b move tests to TypeScript 2019-10-28 10:53:36 -07:00
Elliot Lee
fcd6b430e1 Reduce dependency size (#1057)
- Remove .npmignore since it is overridden by package.json 'files'
- Include build/ripple-latest-min.js, not everything in build/
2019-10-25 13:57:45 -07:00
Elliot Lee
f3ad8a9b80 Merge pull request #1060 from fix-test
Fix broken tests
2019-10-25 13:56:43 -07:00
Fred K. Schott
43ff824da1 fix broken tests 2019-10-25 10:18:46 -07:00
Fairy
b8022610ca Fix error in Safari (#869)
* Safari minify fix

* Update browser-hacks.ts
2019-10-24 10:41:21 -07:00
FKSRipple
03defe203a Merge pull request #773 from aMoniker/develop
unref timer so it doesnt hang the node process
2019-10-23 18:29:20 -07:00
FKSRipple
aedcbe56b3 Added small style changes 2019-10-23 18:29:07 -07:00
FKSRipple
c365db460a Merge pull request #1044 from ripple/connection-timeout
Add a 2-second timeout for connect()
2019-10-23 18:19:39 -07:00
Elliot Lee
cfdc4752d0 let -> const and reject with error 2019-10-23 12:25:02 -07:00
Elliot Lee
e1964ac5ed Add support for the X-address format (#1041)
* Update schema-validator

* Update to ripple-address-codec 4.0.0

* Update ./src/common/hashes/index.ts

* Add generateXAddress method

* Deprecate generateAddress method

* Add unit tests

* Add documentation
2019-10-23 12:03:59 -07:00
James Greenleaf
e17ab9cd8f Add conditional to timer.unref 2019-10-23 14:44:20 -04:00
James Greenleaf
edc15b8727 Merge remote-tracking branch 'upstream/develop' into develop 2019-10-23 14:42:05 -04:00
Fred K. Schott
034f8d41fc remove bad semicolon 2019-10-23 00:33:09 -07:00
Fred K. Schott
0fa70db1e1 Merge branch 'develop' into connection-timeout 2019-10-23 00:32:03 -07:00
FKSRipple
fa7ba9b72b Update connection.ts 2019-10-23 00:27:17 -07:00
FKSRipple
3a20123e0f Merge pull request #1046 from ripple/improve-tx-not-found
Improve getTransaction() error when tx has not been validated yet
2019-10-23 00:22:07 -07:00
FKSRipple
03510d1bc4 Update index.ts 2019-10-23 00:21:35 -07:00
Elliot Lee
8b116f637a Update yarn.lock 2019-10-22 00:57:26 -07:00
Elliot Lee
9c49de6552 Merge pull request #1054 from tylerlevine/update-https-proxy-agent
Update https-proxy-agent to 3.0.0
2019-10-22 00:56:33 -07:00
Elliot Lee
842347bcab Merge branch 'develop' into update-https-proxy-agent 2019-10-22 00:56:07 -07:00
Elliot Lee
628b9c4853 Merge pull request #1049 from FredKSchott/eslint
Replace tslint (since deprecated) with eslint
2019-10-21 11:01:53 -07:00
Fred K. Schott
d60b6ee33f Merge remote-tracking branch 'myfork/eslint' into eslint 2019-10-21 10:03:27 -07:00
Fred K. Schott
4f4fcbbc70 add tests to linting 2019-10-21 10:02:14 -07:00
Tyler Levine
cc896670dc Update https-proxy-agent to 3.0.0 2019-10-18 16:16:54 -07:00
Elliot Lee
eb2a497dee Release 1.3.4 2019-10-18 14:41:58 -07:00
Fred K. Schott
0cf5ce1416 Merge branch 'develop' into eslint 2019-10-17 11:23:26 -07:00
Elliot Lee
988381d584 Merge pull request #1048 from FredKSchott/tsc-update
Update TypeScript
2019-10-16 23:04:20 -07:00
Elliot Lee
0b163eae23 XRP Ledger Hashes: create README.md 2019-10-15 16:34:48 -07:00
Fred K. Schott
3a3ff8a65e Update utils.ts 2019-10-15 13:49:03 -07:00
Fred K. Schott
9f183a6dfc replace tslint (deprecated) with eslint 2019-10-13 16:44:22 -07:00
Fred K. Schott
fadfd4e06c update typescript 2019-10-13 16:19:45 -07:00
Sohail Salehi
eb521faa8d Doc update for sign() method (#1010)
* Add multi-signing example to the sign() method

Explains why the `signAs` option is compulsory for multi-signing scenarios.
2019-10-08 11:59:12 -07:00
Elliot Lee
6b572ca862 Improve getTransaction() error when tx has not been validated yet 2019-10-04 23:56:09 -07:00
Elliot Lee
d075ec6716 Add a 2-second timeout for connect() 2019-10-03 00:02:55 -07:00
Tyler Storm
14e6bf5ef9 Integrate ripple-hashes (#1039)
* Update TxParser and Mocha

* Convert ripple-hashes to TypeScript and add into ripple-lib along with unit tests

* Switch casing to camelCase

* Document intToVuc

* Convert Slots to numbers, add exception if number is outside 0-15

* Remove Shamap v2 support

* Improve naming
2019-10-01 23:35:11 -07:00
Elliot Lee
b6bddd3b0e [MINOR] Remove unnecessary semicolon 2019-09-26 03:18:54 -07:00
Elliot Lee
d5ed9b6cf5 Improve error message when signing fails
When there are multiple representations of the same value
(for example, trailing zeros) the verification will fail.

This points users to the error.data object for details about
the failure, and adds a diff so that the cause of the
discrepancy can be seen at a glance.
2019-09-24 09:58:24 -07:00
Tyler Storm
7a9912d4e0 Update TxParser and Mocha 2019-09-24 09:57:56 -07:00
Mo Morsi
4d2ddceb4e Change "wipple" to "xrp1ntel" (#1036)
The Wipple Analytics Engine is now accessed through the xrp1ntel website
2019-09-12 13:15:26 -07:00
Elliot Lee
ae2aed675a v1.3.3 2019-09-10 19:30:11 -07:00
Elliot Lee
1d7cb41218 Add rippleTimeToISO8601.md.ejs 2019-09-04 00:31:02 -07:00
Elliot Lee
76db002eb5 Expand node version compatibility
Previously the library could not be installed with node 12:

https://github.com/ripple/ripple-binary-codec/pull/33
2019-09-04 00:17:53 -07:00
Elliot Lee
ebb64ba177 v1.3.2 2019-09-03 16:43:31 -07:00
Elliot Lee
1a685e2b68 Fix #1032 (#1033)
* Update ripple-address-codec@latest

* Export and document rippleTimeToISO8601
2019-09-03 16:38:56 -07:00
Rome Reginelli
9c561885a1 Docs: update recommended Node ver. (#1031) 2019-08-29 20:34:25 -07:00
Elliot Lee
612e98b198 Release 1.3.1 2019-08-26 13:58:09 -07:00
Elliot Lee
0a41d5ccf1 Upgrade to gulp 4; remove http server (#1030)
* Update gulp version to ^4.0.2 and Gulpfile.js

* Remove http server
2019-08-26 13:50:36 -07:00
Elliot Lee
ba8fe1f32c Update HISTORY - rippled 1.3.1 2019-08-16 21:28:32 -07:00
Elliot Lee
0f840876a5 Update HISTORY 2019-08-16 21:11:02 -07:00
Elliot Lee
ac3900b6f4 Release 1.2.5 and 1.3.0 2019-08-16 21:09:08 -07:00
Elliot Lee
5e138b9937 Sign method - verify accurate encoding (#1026)
* Decode signed transactions and check field integrity

* Add tests (including signing a tx without Flags)

* Update tests to output more descriptive errors on failure

* Update ripple-binary-codec to 0.2.2
2019-08-16 16:22:25 -07:00
Elliot Lee
82d50cd903 Document setCanonicalFlag and export from src/transaction/utils 2019-08-09 10:16:33 -07:00
Elliot Lee
c5b1d4daac Update lodash to ^4.14.136, fix docs typo, update HISTORY.md 2019-08-07 12:20:56 -07:00
Namrata
b4a30d49d8 Support removing a signer list (#1021)
* Make weights an optional field
* Fix #971
2019-07-30 16:48:30 -07:00
Elliot Lee
229360d1b9 README - Update link 2019-07-18 21:50:58 -07:00
Rome Reginelli
d627d362af Merge pull request #1023 from mDuo13/doc_cleanup
Phrasing cleanup in schema descriptions
2019-07-16 15:11:01 -07:00
mDuo13
7ca7a07942 Phrasing cleanup in schema descriptions
- Change 'Ripple address'→'XRP Ledger address'
- Change 'is exclusive with'→'cannot be used with'
2019-07-15 14:26:43 -07:00
dependabot[bot]
09f81fa3cd Bump lodash from 4.17.11 to 4.17.13
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.13.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.13)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-13 13:26:48 -07:00
The XRP Scan Project
b03bf9c7f1 Updated APPLICATIONS.md and added xrpscan
Added xrpscan.com under Data and Visualization section.
2019-06-24 02:03:21 -07:00
Elliot Lee
4d696369fe APIOptions: extend ConnectionOptions (#1018)
Fix #1017
2019-06-21 01:45:47 -07:00
Elliot Lee
bcb80ea5f5 Fix getServerInfo (#1012)
* Return array for serverInfo.load.jobTypes

* Include start/end in invalid range assertion error
2019-06-14 14:57:36 -07:00
Elliot Lee
1be2ee5875 Docs: fix #574 (#1011)
destination.address
2019-06-14 14:57:14 -07:00
Elliot Lee
3554e807df Release 1.2.4 2019-06-06 16:01:24 -07:00
Elliot Lee
5ffbd6e86d Update dependencies (#1007)
* Update dependencies: @types/lodash@4.14.133, mocha-junit-reporter@1.22.0, tslint@5.17.0, nyc

Fix type errors
2019-06-06 15:56:29 -07:00
Elliot Lee
e2572c61cf Add details about transaction fees, master keys, and multi-signing 2019-06-05 00:27:25 -07:00
Elliot Lee
7df2b74d43 Update get-server-info.json 2019-05-27 14:37:38 -07:00
Elliot Lee
f51a69f080 Fix typo 2019-05-22 10:04:43 -07:00
Elliot Lee
c0a2d9fc2b Update README.md 2019-05-16 22:51:22 -07:00
Elliot Lee
51dad19f88 Release 1.2.3 2019-04-30 15:01:54 -07:00
Elliot Lee
3d1a530796 Fix browser builds (#1006)
tsconfig:
- Must set composite: false
- Must set declarationMap: false in order to use declaration: false

json-loader:
- Not needed with webpack >= v2.0.0 and in fact does not work

https-proxy-agent cannot be used in the browser
2019-04-29 23:19:05 -07:00
Elliot Lee
f6a22d2121 No working browser version for 1.2.2
Using `"noEmitOnError": true` in `tsconfig.json` prevents the browser build from being created
2019-04-18 00:53:28 -07:00
Elliot Lee
6f2d448059 Release 1.2.2 2019-04-15 12:30:20 -07:00
Elliot Lee
0d5103a3f3 Use TypeScript project reference (#1002)
* Add *.tsbuildinfo to .gitignore

* Bump versions of dependencies, nyc and yargs

* Drop support for node 9 (EOL 2018-06-30)

https://github.com/nodejs/Release

* Add getTransaction snippet
2019-04-15 11:06:31 -07:00
Elliot Lee
4da80028bf Prevent prepareTransaction from overwriting values in txJSON (#1000)
Fix #997
2019-04-13 11:33:16 -07:00
Daniel Chan
bb40dbde9d Add deliveredAmount as optional field for type Outcome (#996) 2019-04-11 17:13:42 -07:00
Elliot Lee
50fc36ec3e Add "strict": true to tsconfig.json (#994)
- Remove process.browser
2019-04-11 15:48:23 -07:00
Elliot Lee
1abcef73a0 Merge pull request #993 from adrianhopebailie/patch-1
fix: build fails with strict checks
2019-04-08 13:04:27 -07:00
Adrian Hope-Bailie
0d7879b25c fix: build fails with strict checks 2019-03-29 11:48:13 +02:00
Elliot Lee
8278dc5b5b Release 1.2.1 2019-03-23 15:50:26 -07:00
Elliot Lee
c90d486454 Update ripple-binary-codec to 0.2.1 to support tecKILLED 2019-03-23 15:12:22 -07:00
Elliot Lee
35f9b7ec8d Release 1.2.0 2019-03-19 01:28:42 -07:00
Elliot Lee
69e621af86 Remove coveralls from devDependencies 2019-03-19 01:21:36 -07:00
Elliot Lee
0e92e696d4 Remove unused http-server from devDependencies 2019-03-18 16:51:08 -07:00
Elliot Lee
0b1445bfe9 Remove sauce runner 2019-03-18 16:14:21 -07:00
Elliot Lee
db2d7ba1f5 Update mocha to 6.0.2 2019-03-18 16:09:26 -07:00
Elliot Lee
d82703f41b prepareTransaction should not overwrite Sequence (#990)
* Cleans up some code and fixes some type errors

* Clarify how null settings work

* Document updated RippledError

* Updates per review by @mDuo13
2019-03-18 15:55:42 -07:00
Elliot Lee
8213861ab7 Update HISTORY.md 2019-03-13 14:34:31 -07:00
Kincaid O'Neil
a842c380cf fix: add amount to FormattedPaymentChannel type (#989)
* fix: add amount to FormattedPaymentChannel type

* fix: ignore package-lock.json
2019-03-12 16:58:30 -07:00
Elliot Lee
5bf6f1849a Fix typos in docs 2019-03-12 15:27:19 -07:00
Elliot Lee
bfe4877f73 Merge remote-tracking branch 'origin/master' into develop 2019-03-12 15:12:58 -07:00
Elliot Lee
63dcddf6f4 [Docs] Update transaction responses link
List of transaction responses
2019-03-11 12:14:41 -07:00
Rome Reginelli
68735ddb35 Docs: Fix prepareTransaction method specification (#986) 2019-02-11 23:39:41 -08:00
Elliot Lee
1fd9ca7ef2 Use Buffer.from and clean up a few things (#985) 2019-02-07 00:29:59 -08:00
Elliot Lee
2445004333 Change prepare* methods to reject Promise on error (#984)
* Reject Promise on error, update docs, and add tests:
  * preparePayment
  * prepareTrustline
  * prepareOrder
  * prepareOrderCancellation
  * prepareSettings
  * prepareEscrowCreation
  * prepareEscrowExecution
  * prepareCheckCreate
  * prepareCheckCash
  * prepareCheckCancel
  * preparePaymentChannelCreate
  * preparePaymentChannelFund
  * preparePaymentChannelClaim

Note that we can't update mocha to ^5.2.0 because it causes testing to hang indefinitely; this needs to be investigated.
2019-01-29 15:22:18 -08:00
Elliot Lee
dc148bf954 Update HISTORY.md 2018-12-12 17:38:34 -08:00
Elliot Lee
f3c34bd75a Release 1.1.2 2018-12-12 14:55:15 -08:00
Alexandru Chiriac
5419e67dbc GetLedger by hash option (#980)
* update ledger input schema
* include ledgerHash option
2018-12-12 11:02:50 -08:00
Alexandru Chiriac
8d37da0952 Update Submit Response (#978)
* update submit output schema
* update submit response object
2018-12-04 15:35:07 -08:00
Elliot Lee
a8075d98df Add list of applications using ripple-lib (#976) 2018-11-29 16:39:48 -08:00
Elliot Lee
fcc205b85a Release 1.1.1 2018-11-27 15:17:42 -08:00
Elliot Lee
0f5056221f Fix getOrderbook (#970)
* Fix `getOrderbook` (Fix #766)
* Add `formatBidsAndAsks` as a recommended alternative to `getOrderbook`
* Add `renameCounterpartyToIssuer`
2018-11-26 15:25:15 -08:00
Elliot Lee
8384ace746 Add return type for generateAddress (#968)
For TypeScript apps
2018-11-20 15:35:34 -08:00
Elliot Lee
040cabece0 Add comments for accountRootFlags (#962) 2018-11-16 22:34:41 -08:00
Elliot Lee
319a8d6ab2 Fix book-offers test fixture by swapping bids/asks (#966) 2018-10-31 22:48:27 -07:00
Elliot Lee
50a7320886 Release 1.1.0 2018-10-31 16:36:20 -07:00
Elliot Lee
418987476e Add DepositPreauth (#958)
* Expose parseAccountFlags() and add docs
* Add example snippet
* Default to node v10 for nvm
* Maintain existing behavior for getSettings
* Increase max line length from 80 to 120 (ter-max-len)
2018-10-31 16:27:32 -07:00
Elliot Lee
89e4ff328c Apply formatting to book-offers fixture 2018-10-31 16:07:25 -07:00
Elliot Lee
04bf49cb43 Support node 10 (#964)
* Update webpack from 3.11.0 to 3.12.0 and upath from 1.0.4 to 1.1.0
* Run: yarn upgrade gulp
  * See https://github.com/gulpjs/gulp/issues/2162
* Update README
* Travis: test node 10
2018-10-30 14:15:42 -07:00
Elliot Lee
1c017df2a3 Merge pull request #955 from jcperkins12/feature/balanceChanges-TypeCorrection
Type balanceChanges should be array of changes not array with one change
2018-10-24 20:34:03 -07:00
Elliot Lee
5fed1f08e4 Document xrpToDrops, dropsToXrp, iso8601ToRippleTime, schemaValidator, and more
The following methods are available directly under the RippleAPI object,
not under schemaValidator:

isValidAddress, isValidSecret, deriveKeypair, deriveAddress
2018-10-18 01:16:50 -07:00
Elliot Lee
82c349c8c4 HISTORY: List Check transaction types
Transaction types that were added in 0.19.0
2018-10-17 16:22:48 -07:00
Elliot Lee
0f7af6a4e9 Add depositAuth to FormattedSettings type 2018-10-17 15:58:52 -07:00
Elliot Lee
8db1791ed2 README: Remove obsolete badges 2018-10-16 12:48:48 -07:00
Elliot Lee
a29ec1b8c7 Release 1.0.2 2018-10-16 12:28:24 -07:00
Elliot Lee
232a760a58 yarn: Add integrity hashes to yarn.lock
Added in yarn v1.10.0, see https://github.com/yarnpkg/yarn/pull/5042
2018-10-16 12:24:15 -07:00
Elliot Lee
f4ad04d334 Exclude SendMax from XRP to XRP payments (#957)
Fix #954
2018-10-16 12:21:29 -07:00
Cory Perkins
8dfec20871 Changed type of balanceChanges made to an account from an array of one change to an array of 1 change to and array of records with the type of a blanceChange 2018-10-10 12:21:16 -05:00
Cory Perkins
64745017e9 book_offers returns offers type OfferLedgerEntry (#951)
* rippled-api function book_offers returns offers in the format of OfferLedgerEntry not OfferCreateTransaction
* updated type of account_objects
2018-10-02 02:14:17 -07:00
Elliot Lee
37edede728 Use object instead of Object (#936) 2018-10-02 02:13:28 -07:00
Elliot Lee
f785605db8 Release 1.0.1 2018-09-27 19:01:38 -07:00
Elliot Lee
01ad30ab07 Fix typos in ledger_entries.ts 2018-09-19 14:24:02 -07:00
Cory Perkins
e08d507462 Add remaining LedgerEntry types (#943)
* Replaced the union with 'any' in the LedgerEntry type
* Added DepositPreauthLedgerEntry (new in rippled 1.1.0)
2018-09-19 14:21:52 -07:00
wudanjs
4c23bd5ad3 Include memos when parsing trustlines (#949) 2018-09-19 14:17:38 -07:00
Scott M Sunarto
b15abd5376 Update server regex to accommodate UDS (#944) 2018-09-18 11:47:46 -07:00
Elliot Lee
79971f906b Update release notes 2018-09-11 18:45:52 -07:00
Elliot Lee
9eec98778f Expose validation methods (#932)
Merge branch 'movitto-expose_validation_methods' into develop
2018-09-11 18:33:55 -07:00
Elliot Lee
dcd0e14142 Add test of deriveKeypair with ed25519 secret 2018-09-11 18:33:07 -07:00
Elliot Lee
cfcbc9aab7 Update checksums for 1.0.0 2018-09-10 14:52:14 -07:00
Mo Morsi
a80de5658a Move deriveKeypair and deriveAddress to offline module 2018-09-09 09:39:25 -04:00
Mo Morsi
34215eb309 Add docs for newly exposed API methods 2018-09-09 09:39:25 -04:00
Mo Morsi
9458005d7f Add tests for newly exposed API methods 2018-09-09 09:39:25 -04:00
Mo Morsi
5f36df0172 Expose deriveKeypair, deriveAddress, isValidAddress, and isValidSecret to the public API 2018-09-09 09:39:25 -04:00
Elliot Lee
3ff4929a49 Fix PendingLedgerVersionError message and export FormattedTransactionType (#941) 2018-09-04 18:31:24 -07:00
Elliot Lee
4bea69d647 Release 1.0.0 2018-08-30 14:30:57 -07:00
Elliot Lee
09541dae86 docs: rippled APIs use issuer 2018-08-30 14:12:45 -07:00
Elliot Lee
bcbcc53c87 No `--coverage' option anymore with nyc
See https://github.com/istanbuljs/nyc
2018-08-30 13:41:52 -07:00
Elliot Lee
76f120bec9 Merge branch 'getLedger-includeRawTransaction-2' into develop 2018-08-30 13:30:18 -07:00
Elliot Lee
f8bf28876d if statements must be braced 2018-08-30 13:29:50 -07:00
wilsonianb
b03795df09 Add hidden computeTreeHashes option 2018-08-30 13:29:50 -07:00
Elliot Lee
dbe20d6574 getLedger: include raw transaction with each transaction
computeLedgerHash: support new getLedger response by using
rawTransaction

BREAKING CHANGES:

* Remove the `rawTransactions` field and replace it with a new `rawTransaction` field in each transaction.
* Rename the `metaData` field (in each raw transaction) to `meta` (for consistency with rippled's `tx` method).
* Add `ledger_index` to each raw transaction.
2018-08-30 13:28:52 -07:00
Elliot Lee
0550fab73e Update escrowCreation error message and docs (#934)
Fix #933
2018-08-29 19:03:33 -07:00
Elliot Lee
3f2d9d198e computeLedgerHash - add requireRawTransactions option 2018-08-28 17:31:12 -07:00
Elliot Lee
b9c953fce6 Fix getPaths (#930)
* getPaths:
  * Filter paths correctly
  * Use correct value when XRP is the destination currency
2018-08-23 17:37:02 -07:00
Elliot Lee
181cfd69de Prevent 'amount' from being misinterpreted (#924)
The 'amount' field should almost never be used.
With partial payments, the field can show an amount that is
significantly less than the amount that the transaction actually
delivered. This change sets amount to 0 XRP when it may be misleading.

This change omits the `amount` when parsing payment transactions.
See `HISTORY.md` for recommended alternatives.
2018-08-23 16:17:23 -07:00
Elliot Lee
569766b8f8 Rename json schemas (#931)
Rename files for consistency with their titles:

* Rename amount-base to amountbase
* Rename tx-hash to transaction-hash
* Rename id to transactionHash
* Rename objects/settings.json to objects/settings-plus-memos.json
* Rename ledgerversion to ledger-version
2018-08-22 14:41:41 -07:00
Elliot Lee
53a232ebdc Update docs 2018-08-14 20:05:50 -07:00
Elliot Lee
4c9a2ff538 Improve Order docs. Fix #776 2018-08-14 19:27:50 -07:00
Elliot Lee
dc623cd049 Release 1.0.0-beta.5 2018-08-11 01:38:36 -07:00
Elliot Lee
7cd517268b Fix error TS2307: Cannot find module 2018-08-11 01:35:47 -07:00
Elliot Lee
2438295e70 Release 1.0.0-beta.4 2018-08-10 14:58:19 -07:00
Elliot Lee
f5e1a4a588 Revert "Expose validation methods in public api"
This reverts commit 9e9a0a7d9b.

We should move methods like deriveKeypair and deriveAddress
off of the schemaValidator object.
2018-08-10 14:54:01 -07:00
Mo Morsi
9e9a0a7d9b Expose validation methods in public api
Updated to fix tests
2018-08-06 16:09:04 -07:00
Elliot Lee
1c68283d1e ES6: omit property value since it matches the variable name 2018-07-28 00:42:37 -07:00
Elliot Lee
28796d37cb Update TypeScript to 2.9.2 2018-07-28 00:18:58 -07:00
Elliot Lee
067bc48d4e Add prepareTransaction() (#898)
* Export iso8601ToRippleTime(), txFlags, convertStringToHex()

* Fix a bug that caused fees exceeding 999 to throw an error

e.g. '1,000' would not be recognized as a valid number.
To use 6 decimal places, toFixed should be used instead of toFormat.
2018-07-26 12:24:29 -07:00
Fred K. Schott
b94698df0b Update some API methods to use api.request() internally (#896)
* use any instead of object
2018-07-26 12:23:07 -07:00
Elliot Lee
4f40b5cb6d Update README.md - How to build ripple-lib (#837) 2018-07-25 12:09:55 -07:00
Elliot Lee
14704eee6b Add more tests of getFee (#897) 2018-07-25 01:53:27 -07:00
Elliot Lee
860f6a6cd8 Release 1.0.0-beta.3 2018-07-17 22:39:00 -07:00
Elliot Lee
7a928804ec feat: add payment channel details to tx (2) (#920)
* Bump transactionparser to v0.7.1 and update output schema
* yarn docgen for required `threshold` and `weights`
2018-07-17 22:22:07 -07:00
adrianhopebailie
14444bea3f feat: add payment channel details to tx 2018-07-17 22:20:47 -07:00
Rome Reginelli
47a139fdff Fix text/plain MIMETYPE in examples with memos (#914) 2018-07-03 17:18:46 -07:00
Brandon Wilson
4e30b9b2fa Require threshold and weights in signers settings (#909)
Fixes #908
2018-07-02 16:27:03 -07:00
Elliot Lee
2112d4c0b3 Round XRP fee to 6 decimal places (#912)
* Round XRP fee to 6 decimal places

Fix #911
2018-06-28 17:59:00 -07:00
Elliot Lee
1d1132b7fa Release 1.0.0-beta.2 2018-06-08 08:11:00 -07:00
Elliot Lee
e07fa11923 Maximum fee values (#902)
* Add maxFeeXRP (default 2 XRP) as an optional RippleAPI constructor parameter
  - No calculated or specified fee can exceed this value
  - If the fee exceeds 2 XRP, throw a ValidationError
* sign() - throw ValidationError when Fee exceeds maxFeeXRP
* Document getFee parameters
* Explain new fee limits in HISTORY.md
* Deprecate `maxFee`
2018-06-07 23:29:24 -07:00
Elliot Lee
7c92adbf45 Release 1.0.0-beta.1 2018-05-24 20:13:26 -07:00
Elliot Lee
d55aa2339f Improve docs (raw order data) 2018-05-24 20:02:45 -07:00
Elliot Lee
95e39153da Bump node version to v8 2018-05-24 19:29:09 -07:00
Daniel Davis
65d8260908 Updated yarn command (#900)
`yarn install` deprecated in favor of `yarn add`
2018-05-23 23:05:09 -07:00
Elliot Lee
1aa9feda71 Allow specifying amounts in drops (#892)
* Accept "drops" in lieu of "XRP"
* Export xrpToDrops() and dropsToXrp()
* Throw our own validation errors instead of BigNumber Errors
2018-05-21 13:19:18 -07:00
Fred K. Schott
2e5b435b11 add server_info request typing (#895) 2018-05-17 16:37:17 -07:00
Elliot Lee
54f12862dc Improve errors (#893)
- `RippledError`: Include the full response from the `rippled` server.
- A new test ensures correct behavior when `streams` is not an array.
- `NotConnectedError` may be thrown with a different message than before.
2018-05-12 09:38:49 -07:00
Elliot Lee
226ef862ae Link to mailing lists 2018-05-10 16:25:05 -07:00
Elliot Lee
4a0d675726 Release 1.0.0-beta.0 2018-05-10 15:56:23 -07:00
Elliot Lee
b2b6715ac0 Add request(), hasNextPage(), and requestNextPage() (#887)
* Add support for all rippled APIs, including subscriptions.
* Add support for arbitrary stream message types.
* Note that rippled APIs take amounts in drops.
* request() will be available in ripple-lib version 1.0.0+
2018-05-10 15:43:56 -07:00
Elliot Lee
823d93b86c Add checksums for 0.22.0 2018-05-10 15:26:43 -07:00
Elliot Lee
7a42db99c9 Bump version to 0.22.0 2018-05-10 00:33:20 -07:00
Elliot Lee
f28ec27614 getOrderbook - return raw order data (#886)
Fix #799
2018-05-08 15:05:41 -07:00
Jim Greenleaf
0c98082b25 unref timer so it doesnt hang the node process 2017-06-19 15:30:49 -04:00
411 changed files with 41725 additions and 11648 deletions

26
.eslintrc.json Normal file
View File

@@ -0,0 +1,26 @@
{
"env": {
"browser": true,
"es6": true,
"node": true,
"mocha": true
},
"extends": [
"eslint:recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"no-useless-constructor": 0,
"no-unused-vars": 0,
"no-prototype-builtins": 0,
"require-atomic-updates": 0,
"no-dupe-class-members": 0
}
}

7
.gitignore vendored
View File

@@ -1,5 +1,9 @@
# .gitignore
# Ignore package locks other than Yarn.
package-lock.json
npm-shrinkwrap.json
# Ignore vim swap files.
*.swp
@@ -54,6 +58,9 @@ npm-debug.log
# Ignore dist folder, built from tsc
dist/
# TypeScript incremental compilation cache
*.tsbuildinfo
# Ignore perf test cache
scripts/cache

View File

@@ -1,4 +0,0 @@
lib-cov
coverage.html
src
dist/bower

2
.nvmrc
View File

@@ -1 +1 @@
v6
v10

10
.prettierrc Normal file
View File

@@ -0,0 +1,10 @@
{
"parser": "typescript",
"printWidth": 80,
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"quoteProps": "consistent",
"bracketSpacing": false
}

View File

@@ -1,10 +1,9 @@
language: node_js
node_js:
- 6
- 8
- 9
- 10
- 12
- 13
script:
- yarn compile
- yarn test
- yarn build
- yarn lint

135
APPLICATIONS.md Normal file
View File

@@ -0,0 +1,135 @@
# Applications using ripple-lib (RippleAPI)
A curated list of some of the projects and apps that leverage `ripple-lib` in some way.
**Have one to add?** Please edit this file and open a PR!
## Notice (disclaimer)
These sites are independent of Ripple and have not been authorized, endorsed, sponsored or otherwise approved by Ripple or its affiliates.
Warning: Use at your own risk.
## Data and visualizations
- **[xrpintel - XRP Intelligence](https://xrpintel.com/)**
Monitor the XRP Network in real time and explore historical statistics.
- **[XRP Charts](https://xrpcharts.ripple.com/)** (xrpcharts.ripple.com)
XRP Charts provides information based on public data, including trade volume, top markets, metrics, transactions, and more.
- **[Ripple Live](https://gatehub.net/live)** (gatehub.net/live)
Visualize XRP network transactions.
- **[XRPL Dev. Dashboard](https://xrp.fans/)** (xrp.fans)
Debugging dashboard for `rippled-ws-client-pool`, transaction and query explorer, and transaction signing and submission tool.
- **[XRP Value](http://xrpvalue.com/)**
Real-time XRP price, trades, and orderbook data from the XRP Ledger.
- **[Bithomp - XRPL validators](https://bithomp.com/validators)**
List of XRPL validators, nodes, and testnet validators.
- **[XRP Scan - XRP Ledger explorer](https://xrpscan.com)**
XRP Ledger explorer, metrics and analytics.
- **[xrplorer](https://xrplorer.com)**
XRP Ledger explorer, API, metrics, and analytics using a graph database that is synchronized live with the XRPL.
- **[zerptracker](https://zerptracker.com)**
Monitor the XRPL using powerful JSONPath expressions, and receive notifications via email, SMS, webhooks, and more.
## Send and request payments
- **[XRP Tip Bot](https://www.xrptipbot.com/)**
A bot that enables users on reddit, Twitter and Discord to send XRP to each other through reddit comments and Twitter tweets.
- **[XRP Text](https://xrptext.com/)**
Send XRP using SMS text messages.
- **[XRParrot](https://xrparrot.com/)** (uses `ripple-address-codec`)
Easy EUR (SEPA) to XRP transfer (currency conversion).
- **[XRP Payment](https://xrpayments.co/)** (xrpayments.co)
Tool for generating a XRP payment request URI in a QR code, with currency converter.
## Wallets and wallet tools
- **[XRP Toolkit](https://www.xrptoolkit.com)**
A web interface to the XRP Ledger, supporting both hardware and software wallets.
- **[Toast Wallet](https://toastwallet.com/)**
A free, open source XRP Wallet for iOS, Android, Windows, Mac and Linux.
- **[Toastify Ledger](https://github.com/WietseWind/toastify-ledger)** (uses `ripple-keypairs`)
Add a Regular Key to a mnemonic XRP Wallet (e.g. Ledger Nano S) to use the account with a Family Seed (secret).
- **[Bithomp-submit](https://github.com/Bithomp/bithomp-submit)** (GitHub)
A tool to submit an offline-signed XRPL transaction.
- **[Kyte](https://kyteapp.co/)** (kyteapp.co) ([Source](https://github.com/WietseWind/Zerp-Wallet)) (Deprecated)
Web-based XRP wallet.
- **[XRP Vanity Address Generator](https://github.com/WietseWind/xrp-vanity-generator)** (Node.js)
A vanity address is a wallet address containing a few characters you like at the beginning or the end of the wallet address.
- **[XRP Account Mnemonic Recovery](https://github.com/WietseWind/xrp-mnemonic-recovery)** (uses `ripple-keypairs`)
Recover a 24 word mnemonic if one word is wrong or one word is missing.
## Development tools
- **[XRP Test Net Faucet](https://developers.ripple.com/xrp-test-net-faucet.html)**
Get some test funds for development on the test network. The faucet was built using `ripple-lib`.
## Code samples and libraries
- **[ilp-plugin-xrp-paychan](https://github.com/interledgerjs/ilp-plugin-xrp-paychan)**
Send ILP payments using XRP and payment channels (PayChan).
- **[RunKit: WietseWind](https://runkit.com/wietsewind/)**
XRP Ledger code samples for Node.js.
- **[GitHub Gist: WietseWind](https://gist.github.com/WietseWind)**
XRP Ledger code samples for Node.js and the web (mostly).
- **[rippled-ws-client-sign](https://github.com/WietseWind/rippled-ws-client-sign)**
Sign transactions, with support for MultiSign.
- **[ILP-enabled power switch](https://xrpcommunity.blog/raspberry-pi-interledger-xp-powerswitch-howto/)** ([video](https://www.youtube.com/watch?v=c-eS0HQUuJg)) (uses [`moneyd-uplink-xrp`](https://github.com/interledgerjs/moneyd-uplink-xrp))
For about $30 in parts (Raspberry Pi, 3.3V Relay board and a few wires) you can build your own power switch that will switch on if a streaming ILP payment comes in. When the payment stream stops, the power turns off.
## Related apps that do not appear to use ripple-lib
- **[XRP Stats](https://ledger.exposed/)** (ledger.exposed)
Rich list, live ledger stats and XRP distribution. Visualize escrows and flow of funds.
- **[XRP Vanity](https://xrpvanity.com/)** (xrpvanity.com)
Custom XRP addresses for sale, delivered by SetRegularKey.

View File

@@ -1,216 +0,0 @@
/* eslint-disable no-var, no-param-reassign */
/* these eslint rules are disabled because gulp does not support babel yet */
'use strict';
const _ = require('lodash');
const fs = require('fs');
const path = require('path');
const assert = require('assert');
const gulp = require('gulp');
const rename = require('gulp-rename');
const webpack = require('webpack');
const bump = require('gulp-bump');
const argv = require('yargs').argv;
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
var pkg = require('./package.json');
var uglifyOptions = {
mangle: {
reserved: ['_', 'RippleError', 'RippledError', 'UnexpectedError',
'LedgerVersionError', 'ConnectionError', 'NotConnectedError',
'DisconnectedError', 'TimeoutError', 'ResponseFormatError',
'ValidationError', 'NotFoundError', 'MissingLedgerHistoryError',
'PendingLedgerVersionError'
]
}
};
function getWebpackConfig(extension, overrides) {
overrides = overrides || {};
let defaults = {
cache: true,
externals: [{
'lodash': '_'
}],
entry: './src/index.ts',
output: {
library: 'ripple',
path: path.join(__dirname, 'build/'),
filename: ['ripple-', extension].join(pkg.version)
},
plugins: [
new webpack.NormalModuleReplacementPlugin(/^ws$/, './wswrapper'),
new webpack.NormalModuleReplacementPlugin(/^\.\/wallet$/, './wallet-web'),
new webpack.NormalModuleReplacementPlugin(/^.*setup-api$/,
'./setup-api-web')
],
module: {
rules: [{
test: /jayson/,
use: 'null',
}, {
test: /\.ts$/,
use: [{
loader: 'ts-loader',
options: {
compilerOptions: {declaration: false}
},
}],
}, {
test: /\.json/,
use: 'json-loader',
}]
},
resolve: {
extensions: [ '.ts', '.js' ]
},
};
return _.assign({}, defaults, overrides);
}
function webpackConfigForWebTest(testFileName, path) {
var match = testFileName.match(/\/?([^\/]*)-test.js$/);
if (!match) {
assert(false, 'wrong filename:' + testFileName);
}
var configOverrides = {
externals: [{
'lodash': '_',
'ripple-api': 'ripple',
'net': 'null'
}],
entry: testFileName,
output: {
library: match[1].replace(/-/g, '_'),
path: './test-compiled-for-web/' + (path ? path : ''),
filename: match[1] + '-test.js'
}
};
return getWebpackConfig('.js', configOverrides);
}
gulp.task('build-tests', function(callback) {
var times = 0;
function done() {
if (++times >= 5) {
callback();
}
}
webpack(webpackConfigForWebTest('./test/rangeset-test.js'), done);
webpack(webpackConfigForWebTest('./test/connection-test.js'), done);
webpack(webpackConfigForWebTest('./test/api-test.js'), done);
webpack(webpackConfigForWebTest('./test/broadcast-api-test.js'), done);
webpack(webpackConfigForWebTest('./test/integration/integration-test.js',
'integration/'), done);
});
function createLink(from, to) {
if (fs.existsSync(to)) {
fs.unlinkSync(to);
}
fs.linkSync(from, to);
}
function createBuildLink(callback) {
return function(err, res) {
createLink('./build/ripple-' + pkg.version + '.js',
'./build/ripple-latest.js');
callback(err, res);
};
}
gulp.task('build', function(callback) {
webpack(getWebpackConfig('.js'), createBuildLink(callback));
});
gulp.task('build-min', function(callback) {
const webpackConfig = getWebpackConfig('-min.js');
webpackConfig.plugins.push(new UglifyJsPlugin({uglifyOptions}));
webpack(webpackConfig, function() {
createLink('./build/ripple-' + pkg.version + '-min.js',
'./build/ripple-latest-min.js');
callback();
});
});
gulp.task('build-debug', function(callback) {
const webpackConfig = getWebpackConfig('-debug.js', {devtool: 'eval'});
webpackConfig.plugins.unshift(new webpack.LoaderOptionsPlugin({debug: true}));
webpack(webpackConfig, callback);
});
/**
* Generate a WebPack external for a given unavailable module which replaces
* that module's constructor with an error-thrower
*/
function buildUseError(cons) {
return ('var {<CONS>:function(){throw new Error('
+ '"Class is unavailable in this build: <CONS>")}}')
.replace(new RegExp('<CONS>', 'g'), cons);
}
gulp.task('build-core', function(callback) {
var configOverrides = {
cache: false,
entry: './src/remote.ts',
externals: [{
'./transaction': buildUseError('Transaction'),
'./orderbook': buildUseError('OrderBook'),
'./account': buildUseError('Account'),
'./serializedobject': buildUseError('SerializedObject')
}],
plugins: [
new UglifyJsPlugin()
]
};
webpack(getWebpackConfig('-core.js', configOverrides), callback);
});
gulp.task('bower-build', ['build'], function() {
return gulp.src(['./build/ripple-', '.js'].join(pkg.version))
.pipe(rename('ripple.js'))
.pipe(gulp.dest('./dist/bower'));
});
gulp.task('bower-build-min', ['build-min'], function() {
return gulp.src(['./build/ripple-', '-min.js'].join(pkg.version))
.pipe(rename('ripple-min.js'))
.pipe(gulp.dest('./dist/bower'));
});
gulp.task('bower-build-debug', ['build-debug'], function() {
return gulp.src(['./build/ripple-', '-debug.js'].join(pkg.version))
.pipe(rename('ripple-debug.js'))
.pipe(gulp.dest('./dist/bower'));
});
gulp.task('bower-version', function() {
gulp.src('./dist/bower/bower.json')
.pipe(bump({version: pkg.version}))
.pipe(gulp.dest('./dist/bower'));
});
gulp.task('bower', ['bower-build', 'bower-build-min', 'bower-build-debug',
'bower-version']);
gulp.task('watch', function() {
gulp.watch('src/*', ['build-debug']);
});
gulp.task('version-bump', function() {
if (!argv.type) {
throw new Error('No type found, pass it in using the --type argument');
}
gulp.src('./package.json')
.pipe(bump({type: argv.type}))
.pipe(gulp.dest('./'));
});
gulp.task('version-beta', function() {
gulp.src('./package.json')
.pipe(bump({version: pkg.version + '-beta'}))
.pipe(gulp.dest('./'));
});
gulp.task('default', ['build', 'build-debug', 'build-min']);

View File

@@ -1,5 +1,760 @@
# ripple-lib Release History
Subscribe to [the **ripple-lib-announce** mailing list](https://groups.google.com/forum/#!forum/ripple-lib-announce) for release announcements. We recommend that ripple-lib users stay up-to-date with the latest stable release.
## 1.8.1 (2020-09-25)
* Internal
* Bump elliptic to 6.5.3 (this patches a potential security issue, although we do not believe that the issue affects ripple-lib)
* Bump ripple-binary-codec to 1.0.2
* Bump lodash to 4.17.19
The SHA-256 checksums for the browser version of this release can be found below.
```
% shasum -a 256 *
0895f349944fa11bb1976b2c350c0eb143dfd09abbfc7c2be33aed5c2a4b9ee8 ripple-latest-min.js
7c00188a28f9d295d8e66aa08b340294d2fe49f635d154fb0df049ae8572c195 ripple-latest.js
```
## 1.8.0 (2020-07-06)
* [Document `request('submit', ...)` method](https://github.com/ripple/ripple-lib/blob/develop/docs/index.md#submit), which includes additional useful information in the response
* Update [list of applications using ripple-lib](https://github.com/ripple/ripple-lib/blob/1.7.0/APPLICATIONS.md)
## 1.7.1 (2020-05-26)
* Fix preparePayment when using source.amount/destination.minAmount (#1295) (Fix #1237) (Thanks to @leobel)
* Docs
* Fix generateXAddress example (#1286)
* Update Transaction Streams link (#1278)
* Dependencies
* Update assert-diff, mocha, webpack-bundle-analyzer, @typescript-eslint/parser, @typescript-eslint/eslint-plugin, @types/ws, @types/node, ws, ts-node, eventemitter2
## 1.7.0 (2020-04-28)
* Export hashing functions (#1275)
* Add failHard (fail_hard) option in `submit` method (#1029)
* Add type for parseAccountFlags (#1258)
* Add api.connection.getReserveBase() (#1259)
* Travis: remove node 8 (#1257)
* Dependencies
* Update ripple-address-codec, @types/ws, @types/lodash, https-proxy-agent
* Update devDependencies: eventemitter2, nyc, ejs, @types/node, webpack, ts-node, prettier, @typescript-eslint/eslint-plugin
## 1.6.5 (2020-03-23)
* APPLICATIONS.md: Add xrplorer.com
* Internal: Fix typos
* Dependencies
* Update @types/ws, @types/node, @typescript-eslint/eslint-plugin, @types/mocha, webpack, typescript, mocha, assert-diff
* Remove mocha-junit-reporter
## 1.6.4 (2020-02-18)
* Fix generateXAddress() and generateAddress() with no entropy (#1211, #1209)
* Internal
* Improve unit tests
* Dependencies
* Update webpack-cli, @types/node, webpack, @typescript-eslint/eslint-plugin,
typescript, ripple-keypairs
## 1.6.3 (2020-02-05)
* Update ripple-keypairs to 1.0.0
* Bug fix: Assign event listener to socket close event on open before attempting post-open logic (#1186)
* Protects against possible unhandled rejection in disconnect
* Adds the Connection `_ws.close` event listener post `_ws.open` before executing any post `_ws.open` logic, i.e. `Connection._subscribeToLedger`
* This prevents a reconnection error loop that occurs if `Connection._ws` is never cleaned up by the unreachable `_ws.close` event listener
* Also ensures that a possible disconnect() promise rejection is not unhandled if any `_ws.open` logic in `Connection.connect()` throws
* Dependencies
* Update mocha-junit-reporter, @types/node, mocha, @typescript-eslint/eslint-plugin, ripple-address-codec
## 1.6.2 (2020-01-17)
* Bug fix: Catch possible error in reconnect() on _heartbeat(), emit reconnect error (#1179)
* Docs: Fix whitespace
* Dependencies
* Update @typescript-eslint/eslint-plugin, ts-node, @types/node, @types/ws, typescript
## 1.6.1 (2020-01-14)
> **Update Note:** In this release we refactored the internal connection logic of ripple-lib to improve resiliency across dropped messages and reconnects. The external interface remains the same, with zero changes to public methods/properties. However, If you experience any problems around connections, requests, and request retries, please [file an issue]( https://github.com/ripple/ripple-lib/issues/new) with the repo (and be sure to test against v1.6.0 to confirm that the problem was introduced in this version).
* Documentation
* Document message type 'path_find' (#1121) (thanks @r0bertz)
* Improve documentation for address generation; functions that can be called offline; generateXAddress() (#1158, #1159, #1169) (thanks @hbergren)
* Add [Security Policy](https://github.com/ripple/ripple-lib/blob/develop/SECURITY.md)
* Bug fixes
* Types: Fix AccountObjectsResponse structure (#1127) (thanks @you21979)
* In some cases, ripple-lib would fail to wait for the connection to be ready (#1119)
* Dependencies
* Update docs dependencies, ejs and doctoc (#1153)
* Update eslint, ripple-lib-transactionparser, typescript, nyc, ws, @types/node, ripple-binary-codec, mocha, mocha-junit-reporter
* Internal
* Add LedgerHistory to Connection (#1119): Moved ledger logic into its own Ledger class
## 1.6.0 (2020-01-06)
* Add support for AccountDelete (#1120)
* Improve error type given on rejected message _send to be DisconnectedError (#1098)
* Internal
* Add unit test for unhandled promise rejection warning on message _send (#1098)
* Dependencies
* Update @types/node, @typescript-eslint/parser
## 1.5.1 (2019-12-28)
* Fix support for CDNs (#1142)
* Internal
* Clean up connection trace logic (#1114)
* Clean up the connection config (#1115)
* Run prettier format (#1116)
* Update eslint command (#1118)
* Dependencies
* Update webpack-cli, webpack, ts-node, @types/lodash, @types/ws, @types/node, @typescript-eslint/parser, @typescript-eslint/eslint-plugin, https-proxy-agent, mocha, eventemitter2
## 1.5.0 (2019-12-14)
* Add support for `WalletLocator` (#1083)
* Types: Move and de-dupe `TransactionJSON` type (#1096)
* This resolves an error surfaced by [TypeScript 3.7](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#local-and-imported-type-declarations-now-conflict)
* Add a heartbeat to detect hung connections (#1101)
* Dependencies
* Update TypeScript version (#1096)
* Update ripple-lib-transactionparser to 0.8.1 (#1097)
* Update ripple-binary-codec to 0.2.5
* Update webpack (#1112)
* Require node 8 and yarn (#1107)
* Testing: Refactor and add unit tests
* Fix some errors caught by the improved tests
## 1.4.2 (2019-11-14)
* Add support for tick size (#1090) (thanks @RareData)
* Update email hash default to allow proper clearing (#1089) (thanks @RareData)
* Fix Unhandled Promise Rejection Warning on message `_send`
* Add an immediate catch to the `_send` promise passed to `_whenReady` in case there is rejection before async handlers are added (#1092) (thanks @nickewansmith)
* Docs improvements
* Add XRP Toolkit reference (#1088)
* Internal improvements
* Add a prettier config
* Update Node.js Testing Versions (#1085)
* Testing matrix based on: https://nodejs.org/en/about/releases/
- Node 11 is no longer supported (not LTS)
- Node 12 added (active LTS)
- Node 13 added ("current" release)
## 1.4.1 (2019-11-06)
* Compatibility: Change TypeScript compile target back to `es6` (#1071)
* WARNING: This allows for the use of Node v6, which is no longer supported by Node.js, as it was end-of-life'd in April 2019
* We recommend updating to Node v8/v10 ASAP in order to get security updates and fixes from the Node.js team
* We are not actively running tests against Node v6 (ref #1076)
* Docs: `getAccountObjects` doc fix
* Dependencies:
* Update `bignumber.js`
* Update `ripple-keypairs`
* Update `ws`
* Build process: Update `webpack` flow
## 1.4.0 (2019-10-28)
* Unref timer so it does not hang the Node.js process
* Add a 2-second timeout for connect()
* Improve getTransaction() error when tx has not been validated yet
* Add support for the new X-address format
* Fix error in Safari, Chrome 78, Firefox 70
* Some error messages have changed slightly. For example:
* `-instance.Account is not of a type(s) string,instance.Account does not conform to the "address" format`
* `+instance.Account is not of a type(s) string,instance.Account is not exactly one from <xAddress>,<classicAddress>`
### Internal improvements
* Reduce dependency size
* Move tests to TypeScript
* Replace tslint with eslint
* Update https-proxy-agent
* Add tests
## 1.3.4 (2019-10-18)
* Update ripple-lib-transactionparser
* Improve error message when signing fails (e.g. due to trailing zeros)
* Integrate ripple-hashes (in TypeScript with improved naming and docs)
* Add multi-signing example to sign() method docs
* Update TypeScript
## 1.3.3 (2019-09-10)
* Expand node version compatibility to support Node.js 12 ([ripple-binary-codec#32](https://github.com/ripple/ripple-binary-codec/issues/32))
## 1.3.2 (2019-09-03)
* Export and document `rippleTimeToISO8601()` method
* Add type for isValidAddress (fixes error TS7016, #1032)
* Docs: update recommended Node.js version (#1031)
When using this release with [rippled](https://github.com/ripple/rippled), we recommend using [rippled version 1.3.1](https://github.com/ripple/rippled/releases/tag/1.3.1) or later.
## 1.3.1 (2019-08-26)
* Upgrade to gulp 4 (#1030)
* Remove http server (unused)
* Update dependencies
There are no changes in the browser version with this release. The npm package for Node.js should be slightly smaller.
When using this release with [rippled](https://github.com/ripple/rippled), we recommend using [rippled version 1.3.1](https://github.com/ripple/rippled/releases/tag/1.3.1).
## 1.3.0 (2019-08-16)
### Bug fixes:
* Breaking change: Fix `getServerInfo` (#1012)
Before:
```
{
// ...
"load": {
"jobTypes": {
"0": {"jobType": "untrustedValidation", "perSecond": 10},
"1": {"jobType": "ledgerData", "peakTime": 2, "perSecond": 2},
"2": {"inProgress": 1, "jobType": "clientCommand", "perSecond": 1},
"3": {"jobType": "transaction", "perSecond": 1},
// ...
},
"threads": 6
},
// ...
}
```
After:
```
{
// ...
"load": {
"jobTypes": [
{
"jobType": "untrustedValidation",
"perSecond": 8
},
{
"avgTime": 2,
"jobType": "ledgerData",
"peakTime": 72,
"perSecond": 2
},
{
"inProgress": 1,
"jobType": "clientCommand",
"perSecond": 1
},
{
"jobType": "transaction",
"perSecond": 1
},
// ...
],
"threads": 6
},
// ...
}
```
* Sign method - verify accurate encoding (#1026)
* In previous versions, the following could be encoded incorrectly:
* Amounts of XRP with more than 6 decimal places
* Amounts of XRP drops with any decimal places
* In versions 1.2.5 and 1.3.0, amounts that are invalid in this way will throw an error
* Expand `APIOptions` by extending `ConnectionOptions` (#1018, fixes #1017)
* Fix docs for destination.address (#1011)
### New features:
* Support removing a signer list (#1021)
* Export `setCanonicalFlag` method from `src/transaction/utils`
### Improvements:
* Clean up phrasing in schema descriptions (#1023)
* Improve docs
* Update dependencies
Since this release fixes a bug that could cause transactions to be serialized incorrectly during the signing process, it has also been simultaneously released as version 1.2.5 (patch release).
When using this release with [rippled](https://github.com/ripple/rippled), we recommend using [rippled version 1.3.1](https://github.com/ripple/rippled/releases/tag/1.3.1).
## 1.2.4 (2019-06-06)
* Update README.md
* Clarify docs
* Update dependencies
* Fix typos
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
4f09c056ccc51bc6cf17b128b559112e9c5adf19cc96ac8f9a06faee185697a7 ripple-1.2.4-debug.js
5da1c75a02d76b0b105d98355ee4561f5d5036e8d5d0237efd5960812dcaa1fd ripple-1.2.4-min.js
e147f303e880a65db149d2a5b9183b75814bd8145cd00740bcc4679d867192c8 ripple-1.2.4.js
```
## 1.2.3 (2019-04-30)
* Fix browser builds
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
efb0f29cde94534a015d8a2171abb11b9a4345ba01418bf5b6ab6042a6d51dde ripple-1.2.3-debug.js
b86145c0e30099b966ed8d3830ba25988d72877f1f87044d9954d6707be098ac ripple-1.2.3-min.js
e027d91c7321d41ba94bb1bdc77dcff0107a5fd9eb833c6dbd06f1bbedef3900 ripple-1.2.3.js
```
## 1.2.2 (2019-04-15)
* Prevent `prepareTransaction` from overwriting `Fee` and/or `LastLedgerSequence` (#997)
* Add `deliveredAmount` as optional field for type `Outcome` (#996)
* Fix build failure with TS strict checks (#993)
Minor changes:
* Use TypeScript project references
* Travis: Drop node 9 and add node 11 for testing
* Bump versions of devDependencies
Note: There is no browser version of this release.
## 1.2.1 (2019-03-23)
* Update `ripple-binary-codec` to 0.2.1 to support `tecKILLED`
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
531c2a8f4bf6d6b5bd4afe6a40b6a68a77179a343902cfa4210d7e35b5697af0 ripple-1.2.1-debug.js
201ee99922b16b7e32afb5317ef4bb9facc23b20c272bb5c4ed7010f5d996cab ripple-1.2.1-min.js
c1b984581299bf00e0e3c8ac4e62eadfc9b190bd78a2458a76e59ceb56046148 ripple-1.2.1.js
```
## 1.2.0 (2019-03-19)
This release:
* changes the way you handle errors for the `prepare*` methods.
* improves the `message` field of `RippledError`s.
* allows `Sequence` to be set in the transaction JSON provided to
`prepareTransaction`.
For details, continue reading:
### [BREAKING CHANGE] `prepare*` methods reject the Promise on error
The `prepare*` methods now always reject the Promise when an error occurs, instead of throwing.
Previously, the methods would synchronously throw on validation errors, despite being asynchronous methods that return Promises.
In other words, to handle errors in the past, you would need to use a try/catch block:
```
// OBSOLETE - no need for try/catch anymore
try {
api.preparePayment(address, payment, instructions).then(prepared => {
res.send(prepared.txJSON);
}).catch(error => {
// Handle asynchronous error
});
} catch (error) {
// Handle synchronous error
}
```
Now, you can rely on the Promise's `catch` handler, which is called with the error when the Promise is rejected:
```
api.preparePayment(address, payment, instructions).then(prepared => {
res.send(prepared.txJSON);
}).catch(error => {
// Handle error
});
```
This applies to:
* preparePayment
* prepareTrustline
* prepareOrder
* prepareOrderCancellation
* prepareSettings
* prepareEscrowCreation
* prepareEscrowExecution
* prepareCheckCreate
* prepareCheckCash
* prepareCheckCancel
* preparePaymentChannelCreate
* preparePaymentChannelClaim
* preparePaymentChannelFund
### Improved `RippledError` `message`
Previously, `RippledErrors` (errors from rippled) used rippled's `error` field as the `message`.
Now, the `error_message` field is used as the `message`.
This helps to surface the specific cause of an error.
For example, before:
```
[RippledError(invalidParams, { error: 'invalidParams',
error_code: 31,
error_message: 'Missing field \'account\'.',
id: 3,
request: { command: 'account_info', id: 3 },
status: 'error',
type: 'response' })]
```
After:
```
[RippledError(Missing field 'account'., { error: 'invalidParams',
error_code: 31,
error_message: 'Missing field \'account\'.',
id: 3,
request: { command: 'account_info', id: 3 },
status: 'error',
type: 'response' })]
```
In this case, you can see at a glance that `account` is the missing field.
The `error` field is still available in `errorObject.data.error`.
When `error_message` is not set (as with e.g. error 'entryNotFound'), the `error` field is used as the `message`.
### [BUG FIX] `prepareTransaction` does not overwrite the `Sequence` field
The `prepareTransaction` method now allows `Sequence` to be set in the Transaction JSON object, instead of overwriting it with the account's expected sequence based on the state of the ledger.
Previously, you had to use the `sequence` field in the `instructions` object to manually set a transaction's sequence number.
### New in rippled 1.2.1
As this is the first release of ripple-lib following the release of rippled 1.2.1, we would like to highlight the following API improvements:
1. The [`delivered_amount` field](https://developers.ripple.com/partial-payments.html#the-delivered-amount-field) has been added to the `ledger` method, and to transaction subscriptions.
api.getLedger({includeTransactions: true, includeAllData: true, ledgerVersion: 17718771}).then(...)
You can also call `ledger` directly:
request('ledger', {...}).then(...)
2. [Support for Ed25519 seeds encoded using ripple-lib](https://github.com/ripple/rippled/pull/2734)
You have access to these improvements when you use a rippled server running version 1.2.1 or later. At the time of writing, we recommend using rippled version **1.2.2** or later.
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
13021fe3efbdd59faf68597b0b18204b39847b285cca82f84c737e3d19922cc2 ripple-1.2.0-debug.js
0070225e731afd8c2c0a0976111ebf326c19a96ee1549368de9f016abdd53d2f ripple-1.2.0-min.js
d440268397c03ad5137a3294e53a07b959ef93cd23b1990d6f82621c4776ba9f ripple-1.2.0.js
```
## 1.1.2 (2018-12-12)
+ Update `submit` response (#978)
+ Includes the full object returned by rippled, while keeping the existing
fields for backward compatibility
+ Add `getLedger` option for ledger hash (#980)
+ Use the `ledgerHash` option to get a specific ledger by hash
Thanks to @alexchiriac for the contributions in this release.
When using `ripple-lib` with `rippled`, we recommend using `rippled` version
1.1.2 or later.
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
e6cc52395d0c3e205263777ba2e528e50f4d1f84bb4b16763a3bf7f5fcc290f5 ripple-1.1.2-debug.js
82df879bc2970e0e4fd161975a99448b4859b0cde751d8ea34e9f51d672090b9 ripple-1.1.2-min.js
12f56330dc71bba8ac3004025cbc9698413a0c619df302dda105b31228a67319 ripple-1.1.2.js
```
## 1.1.1 (2018-11-27)
+ Fix `getOrderbook` offer sorting (#970)
+ **BREAKING CHANGE:** The ordering of offers returned by `getOrderbook` has
been changed so that offers with the best quality are sorted first
+ Add new helper methods for working with the `rippled` APIs:
+ `formatBidsAndAsks`: Takes offers and returns a formatted order book object
with bids and asks
+ `renameCounterpartyToIssuer`: Takes an object and renames the `counterparty`
field to `issuer`
+ TypeScript: Add return type for `generateAddress` (#968)
When using `ripple-lib` with `rippled`, we recommend using `rippled` version 1.1.1 or
later.
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
e151900e49bb5482b02bef5b0b1542ea586076363b072ae616f6d4d2f7f5b8a1 ripple-1.1.1-debug.js
6aee3757b29de285f361e20862261090033c07a13fd09f4a3cc4c097b6e84b55 ripple-1.1.1-min.js
bea4a889fb9ee4092324c6667490ea66469bdde869ddc1aaddf5e9d12b0cf091 ripple-1.1.1.js
```
## 1.1.0 (2018-10-31)
+ Add support for Node.js v10 LTS (#964)
+ Add [DepositPreauth](https://developers.ripple.com/depositauth.html) ([#958](https://github.com/ripple/ripple-lib/pull/958))
+ In `FormattedTransactionType`, the `Outcome`'s `balanceChanges` property had
the wrong type. This is now fixed (#955)
+ Add/fix docs for: xrpToDrops, dropsToXrp, iso8601ToRippleTime, schemaValidator, isValidAddress, isValidSecret, deriveKeypair, deriveAddress
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
e1d742092b3c0fcee97a875e18db4baeab3bbc82f08b96e883ee188c5f0cfb37 ripple-1.1.0-debug.js
f28921f57a133678dcb3cb54c497626bd76b1f953d22d61f3ddca31c8947d552 ripple-1.1.0-min.js
3696871a80c1102635699994adcaf00cdfdfcff5014fc2eba3d8f8d8437c8f91 ripple-1.1.0.js
```
## 1.0.2 (2018-10-16)
+ Fix #954: Exclude SendMax from all XRP to XRP payments (thanks @jefftrudeau)
+ TypeScript
+ book_offers returns offers type OfferLedgerEntry (#951)
+ Use `object` (#936)
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
2556fe17296e127ed44e7066e90a6175e2b164f00ca3c1aa7b1c554f31c688dd ripple-1.0.2-debug.js
e0342ea21eac32a1024c62034fba09c6f26dd3e7371b23ea1e153e03135cd590 ripple-1.0.2-min.js
c7286c517497d018d02d09257e81172b61d36c8b9885a077af68e8133c3b3b9b ripple-1.0.2.js
```
## 1.0.1 (2018-09-27)
+ Add address/secret/key validation and derivation methods ([#932](https://github.com/ripple/ripple-lib/pull/932))
+ `isValidAddress(address: string) : boolean`: Checks if the specified string contains a valid address.
+ `isValidSecret(secret: string): boolean`: Checks if the specified string contains a valid secret.
+ `deriveKeypair(seed: string): {privateKey: string, publicKey: string}`: Derive a public and private key from a seed.
+ `deriveAddress(publicKey: string): string`: Derive an XRP Ledger address from a public key.
+ To derive an address from a secret:
1. Derive the public key from the secret.
2. Derive the address from the public key.
+ Example: `const address = api.deriveAddress(api.deriveKeypair(secret).publicKey)`
+ Update server regex to accommodate UDS (#944)
+ Include memos when parsing trustlines (#949)
+ Add remaining LedgerEntry types (#943)
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
9b6408641ce83659afcd5765c256c35829a4fcb4c3244dc9ca6bf27c871a45c4 ripple-1.0.1-debug.js
7ab2b69fe59c2d4a74638116e2ba3b387155eb2d23e48a01bbf7beb72911f898 ripple-1.0.1-min.js
8bb4dcad9ce25a27003b1d73d71ddf41b8a5af02ece4ebbfeaff4aeb91f3b8c4 ripple-1.0.1.js
```
## 1.0.0 (2018-08-30)
We are pleased to announce the release of `ripple-lib` version 1.0.0.
This version features a range of changes and improvements that make the library
more capable and flexible. It includes new methods for accessing rippled APIs,
including subscriptions.
When using this version with `rippled` for online functionality, we recommend
using `rippled` version 1.0.1 or later.
Here is a summary of the changes since `ripple-lib` version 0.22.0, which was
the last non-beta version.
### New Features
+ [Add `request()`, `hasNextPage()`, and `requestNextPage()` for accessing `rippled`
APIs](https://github.com/ripple/ripple-lib/blob/09541dae86bc859bf5928ac65b2645dfaaf7f8b1/docs/index.md#rippled-apis).
+ Add `prepareTransaction()` for preparing raw `txJSON`.
+ XRP amounts can be specified in drops. Also, `xrpToDrops()` and `dropsToXrp()`
are available to make conversions.
+ `getTransaction` responses can include a new `channelChanges` property that
describes the details of a payment channel.
### Data Validation and Errors
+ [Amounts in drops and XRP are checked for
validity](https://github.com/ripple/ripple-lib/blob/develop/HISTORY.md#100-beta1-2018-05-24).
+ [A maximum fee is now
imposed](https://github.com/ripple/ripple-lib/blob/develop/HISTORY.md#100-beta2-2018-06-08). Exceeding it causes a `ValidationError` to be
thrown.
+ Errors are improved and more data validation was added.
+ Bug fix: `getPaths` now filters paths correctly and works correctly when the
destination currency is XRP.
### Breaking Changes
The following changes were introduced in 1.0.0.
+ `getTransaction()` and `getTransactions()`
+ The `specification.destination.amount` field has been removed from the parsed transaction response.
+ To determine the amount that a transaction delivered, use `outcome.deliveredAmount`.
+ If you require the provisional requested `Amount` from the original transaction:
+ Use `getTransaction`'s `includeRawTransaction` option, or
+ Use `getTransactions`'s `includeRawTransactions` option, or
+ Use the rippled APIs directly with `request`. For example, call the API methods `tx`, `account_tx`, etc.
+ `getLedger()` response object
+ The `rawTransactions` field has been removed (for consistency with `getTransaction()` and `getTransactions()`).
+ Instead, within each `transaction`, use the new `rawTransaction` JSON string.
+ The `metaData` field has been renamed to `meta` for consistency with rippled's `tx` method.
+ `ledger_index` has been added to each raw transaction.
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
06e5efcb6846ad45dedfd85cfa2ef4bdeb608b15ccbfb60b872c995d97342426 ripple-1.0.0-debug.js
cdb26b928a89ce228c727d1ff966df266eb46b2f76bd94f81cbeb0a9d75febf0 ripple-1.0.0-min.js
f74ee804e8a945a994e4e3901a0a3eb52292fbdcbff61ed30cefb8ffbcba50c3 ripple-1.0.0.js
```
## 1.0.0-beta.5 (2018-08-11)
+ [Fix a TypeScript error by importing the `Prepare` type](https://github.com/ripple/ripple-lib/commit/7cd517268bda5fe74b91dad02fedf8b51b7eae9b)
## 1.0.0-beta.4 (2018-08-10)
+ [Add `prepareTransaction()`](https://github.com/ripple/ripple-lib/pull/898)
+ Internal improvements and cleanup
## 1.0.0-beta.3 (2018-07-17)
+ For payment channel transactions, `getTransaction` includes a new
`channelChanges` property that describes the details of the payment channel.
(#920)
### Bug Fixes
+ A bug caused calculated fees to use too many decimal places. This was fixed by
rounding fees to 6 decimal places. (#912)
+ When using the Settings transaction to set up a multi-signing list, the
threshold and weights fields are required. (#909)
+ Docs: Fix the MIMETYPE in examples with memos. (#914)
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
460dbb521e24c44cb53dabc1a74feeca33d031b44d889dd5b51103ca92d51de6 ripple-1.0.0-beta.3-debug.js
cccfd24973c6b7990d9e933a589175dae26249825737fff4f2f73d8558a3f186 ripple-1.0.0-beta.3-min.js
0dc456a58fb078347d9920310621595905085595d73c2b8fe96bea73bcf35450 ripple-1.0.0-beta.3.js
```
## 1.0.0-beta.2 (2018-06-08)
### Breaking Changes
+ During transaction preparation, there is now a maximum fee. Also, when a transaction is signed, its fee is checked and an error is thrown if the fee exceeds the maximum. The default `maxFeeXRP` is `'2'` (2 XRP). Override this value in the RippleAPI constructor.
+ Attempting to prepare a transaction with an exact `fee` higher than `maxFeeXRP` causes a `ValidationError` to be thrown.
+ Attempting to sign a transaction with a fee higher than `maxFeeXRP` causes a `ValidationError` to be thrown.
+ The value returned by `getFee()` is capped at `maxFeeXRP`.
### Other Changes
+ In Transaction Instructions, the `maxFee` parameter is deprecated. Use the `maxFeeXRP` parameter in the RippleAPI constructor.
#### Overview of new fee limit
Most users of ripple-lib do not need to make any code changes to accommodate the new soft limit on fees. The limit is designed to protect against the most severe cases where an unintentionally high fee may be used.
+ When having ripple-lib provide the fee with a `prepare*` method, a maximum fee of `maxFeeXRP` (default 2 XRP) applies. You can prepare more economical transactions by setting a lower `maxFeeXRP`, or support high-priority transactions by setting a higher `maxFeeXRP` in the RippleAPI constructor.
+ When using `sign` with a Fee higher than `maxFeeXRP`, a `ValidationError` is thrown.
If you have any questions or concerns, please open an issue on GitHub.
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
ef348a2805098e61395b689b410cbf4bfd35e4d72e38c89f4ab74ec5e19793f5 ripple-1.0.0-beta.2-debug.js
ea33fd53df8c7176d5fbf52dae0b64aade7180860f26449062cdbefaf8bd4d9b ripple-1.0.0-beta.2-min.js
fe5cc6e97c9b8a1470dacb34f16a64255cd639a25381abe9db1ba79e102456f2 ripple-1.0.0-beta.2.js
```
## 1.0.0-beta.1 (2018-05-24)
### Breaking Changes
+ Amounts in drops and XRP are checked for validity. Some
methods may now throw a `BigNumber Error` or `ValidationError` if the amount
is invalid. This may include methods that previously did not throw.
+ Note that 1 drop is equivalent to 0.000001 XRP and 1 XRP is equivalent to 1,000,000 drops.
+ Using drops is recommended. All rippled APIs require XRP amounts to be
expressed in drops.
### Other Changes
+ Allow specifying amounts in drops for consistency with the `rippled`
APIs.
+ Export `xrpToDrops()` and `dropsToXrp()` functions.
+ Potentially breaking change: Improve errors. For example, `RippledError` now includes the full response from
the `rippled` server ([#687](https://github.com/ripple/ripple-lib/issues/687)). `NotConnectedError`
may be thrown with a different message than before.
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
a80ebb39e186640246306eadb2879147458c8271fd3c6cb32e6ef78d0b4b01a5 ripple-1.0.0-beta.1-debug.js
81bcc4b5fd6fd52220ed151242eaddd63eb29c4078845edc68f65b769557d126 ripple-1.0.0-beta.1-min.js
738b4d65b58cf4e3542fa396f8d319a24cd7d0b7aff5ff629a900e244f735ff4 ripple-1.0.0-beta.1.js
```
## 1.0.0-beta.0 (2018-05-10)
+ [Add `request`, `hasNextPage`, and
`requestNextPage`](https://github.com/ripple/ripple-lib/pull/887).
+ This provides support for all rippled APIs, including subscriptions.
When using rippled APIs, you must:
+ For all XRP amounts, use drops (1 drop = 0.000001 XRP).
+ Instead of `counterparty`, use `issuer`.
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
ab2094979a3d6b320c7bc22bc5946c50fa5e29af0976d352e7689b0a4d840c55 ripple-1.0.0-beta.0-debug.js
0e7f7d740606c2866ebf63776b13b41a555848e1a1419e2c8058d2e6c562d7fd ripple-1.0.0-beta.0-min.js
bd05e8806832ca4192aea7ba2d0362baa9f44605f8e8e6676acd25eb0b94b778 ripple-1.0.0-beta.0.js
```
## 0.22.0 (2018-05-10)
+ [`getOrderbook` - return raw order data](https://github.com/ripple/ripple-lib/pull/886). The full `BookOffer` data is now provided under `data`.
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
33f71b55c4adec4452826e44fe7809377364df04222b60f0fce01e7de2daff33 ripple-0.22.0-debug.js
63232888a4ea77065e8e8eb8fdaa8ebfe3a785428fe935e2667c1ea54c837f29 ripple-0.22.0-min.js
ab98026fabe296bd938297c48cb58e01dfdbe90f3c66c9617d6a3e1efd4c6b93 ripple-0.22.0.js
```
## 0.21.0 (2018-04-11)
+ [Upgrade https-proxy-agent](https://github.com/ripple/ripple-lib/pull/883)
@@ -8,7 +763,7 @@
The SHA-256 checksums for the browser version of this release can be found
below.
```
% shasum -a 256 *
% shasum -a 256 *
3ab52209ad4a80393c8c08ef3f4aa9cfb47bc76c0ede2ee9fa7f5ca180ba4d67 ripple-0.21.0-debug.js
3b1efccded347bed5f64757098a1ea6a513bb8932d922d00af47cd24e001dc14 ripple-0.21.0-min.js
db08e5a3eab1f659b4c803543374398004d950ba720adc4b9a7658817cb5c94b ripple-0.21.0.js
@@ -48,6 +803,9 @@ below.
## 0.19.0 (2018-03-02)
+ [Add support for Checks](https://github.com/ripple/ripple-lib/pull/853)
+ **CheckCreate** adds a check entry to the ledger. The check is a promise from the source of the check that the destination of the check may cash the check and receive up to the SendMax specified on the check. The check may have an (optional) expiration, after which the check may no longer be cashed.
+ **CheckCancel** removes the check from the ledger without transferring funds. Either the check's source or destination can cancel the check at any time. After a check has expired, any account can cancel the check.
+ **CheckCash** is a request by the destination of the check to transfer a requested amount of funds, up to the check's SendMax, from the source to the destination. The destination may receive less than the SendMax due to transfer fees.
+ [Add support for the Deposit Authorization account root flag](https://github.com/ripple/ripple-lib/pull/852)
+ [Generate .ts.d TypeScript declaration files](https://github.com/ripple/ripple-lib/pull/851)
+ [Improve documentation of getTransactions params](https://github.com/ripple/ripple-lib/pull/856)

View File

@@ -1,45 +1,92 @@
# ripple-lib
# ripple-lib (RippleAPI)
A JavaScript API for interacting with the XRP Ledger
[![Circle CI](https://circleci.com/gh/ripple/ripple-lib/tree/develop.svg?style=svg)](https://circleci.com/gh/ripple/ripple-lib/tree/develop) [![Coverage Status](https://coveralls.io/repos/ripple/ripple-lib/badge.png?branch=develop)](https://coveralls.io/r/ripple/ripple-lib?branch=develop)
A JavaScript/TypeScript API for interacting with the XRP Ledger
[![NPM](https://nodei.co/npm/ripple-lib.png)](https://www.npmjs.org/package/ripple-lib)
This is the recommended library for integrating a JavaScript/TypeScript app with the XRP Ledger, especially if you intend to use advanced functionality such as IOUs, payment paths, the decentralized exchange, account settings, payment channels, escrows, multi-signing, and more.
## [➡️ Reference Documentation](https://xrpl.org/rippleapi-reference.html)
See the full reference documentation on the XRP Ledger Dev Portal.
## [➡️ Applications and Projects](APPLICATIONS.md)
What is ripple-lib used for? The applications on the list linked above use `ripple-lib`. Open a PR to add your app or project to the list!
### Features
+ Connect to a `rippled` server from Node.js or a web browser
+ Issue [rippled API](https://ripple.com/build/rippled-apis/) requests
+ Listen to events on the XRP Ledger (transaction, ledger, etc.)
+ Helpers for creating requests and parsing responses for the [rippled API](https://developers.ripple.com/rippled-api.html)
+ Listen to events on the XRP Ledger (transactions, ledger, validations, etc.)
+ Sign and submit transactions to the XRP Ledger
+ Type definitions for TypeScript
## Getting Started
### Requirements
See also: [RippleAPI Beginners Guide](https://ripple.com/build/rippleapi-beginners-guide/)
+ **[Node v10](https://nodejs.org/)** is recommended. Other versions may work but are not frequently tested.
+ **[Yarn](https://yarnpkg.com/)** is recommended. `npm` may work but we use `yarn.lock`.
You can use `npm`, but we recommend using `yarn` for the added assurance provided by `yarn.lock`.
### Install
+ [Yarn Installation Instructions](https://yarnpkg.com/en/docs/install)
Install `ripple-lib`:
In an existing project (with `package.json`), install `ripple-lib`:
```
$ yarn add ripple-lib
```
Then see the [documentation](https://github.com/ripple/ripple-lib/blob/develop/docs/index.md) and [code samples](https://github.com/ripple/ripple-lib/tree/develop/docs/samples)
## Documentation
## Running tests
+ [RippleAPI Beginners Guide](https://xrpl.org/get-started-with-rippleapi-for-javascript.html)
+ [RippleAPI Full Reference Documentation](https://xrpl.org/rippleapi-reference.html) ([in this repo](https://github.com/ripple/ripple-lib/blob/develop/docs/index.md))
+ [Code Samples](https://github.com/ripple/ripple-lib/tree/develop/docs/samples)
### Mailing Lists
We have a low-traffic mailing list for announcements of new ripple-lib releases. (About 1 email per week)
+ [Subscribe to ripple-lib-announce](https://groups.google.com/forum/#!forum/ripple-lib-announce)
If you're using the XRP Ledger in production, you should run a [rippled server](https://github.com/ripple/rippled) and subscribe to the ripple-server mailing list as well.
+ [Subscribe to ripple-server](https://groups.google.com/forum/#!forum/ripple-server)
## Development
To build the library for Node.js and the browser:
```
$ yarn build
```
The TypeScript compiler will [output](./tsconfig.json#L7) the resulting JS files in `./dist/npm/`.
webpack will output the resulting JS files in `./build/`.
For details, see the `scripts` in `package.json`.
## Running Tests
### Unit Tests
1. Clone the repository
2. `cd` into the repository and install dependencies with `yarn install`
3. `yarn test` or `yarn test --coverage` (`istanbul` will create coverage reports in `coverage/lcov-report/`)
3. `yarn test`
### Linting
Run `yarn lint` to lint the code with `eslint`.
## Generating Documentation
The continuous integration tests require that the documentation stays up-to-date. If you make changes to the JSON schemas, fixtures, or documentation sources, you must update the documentation by running `yarn run docgen`.
Do not edit `./docs/index.md` directly because it is a generated file.
`npm` may be used instead of `yarn` in the commands above.
Instead, edit the appropriate `.md.ejs` files in `./docs/src/`.
If you make changes to the JSON schemas, fixtures, or documentation sources, update the documentation by running `yarn run docgen`.
## More Information
+ [Ripple Developer Center](https://ripple.com/build/)
+ [ripple-lib-announce mailing list](https://groups.google.com/forum/#!forum/ripple-lib-announce) - subscribe for release announcements
+ [RippleAPI Reference](https://xrpl.org/rippleapi-reference.html) - XRP Ledger Dev Portal
+ [XRP Ledger Dev Portal](https://xrpl.org/)
[![Build Status](https://travis-ci.org/ripple/ripple-lib.svg?branch=master)](https://travis-ci.org/ripple/ripple-lib)

29
SECURITY.md Normal file
View File

@@ -0,0 +1,29 @@
# Security Policy
## Supported Versions
This table shows which versions of ripple-lib are currently supported with security updates:
| Version | Supported |
| ------- | ---------------------- |
| 1.x | :white_check_mark: Yes |
| 0.x | :x: No |
## Responsible disclosure security policy
The responsible disclosure of vulnerabilities helps to protect users of the project. Vulnerabilities are first triaged in a private manner, and only publicly disclosed after a reasonable time period that allows patching the vulnerability and provides an upgrade path for users.
When contacting us directly via email, we will do our best to respond in a reasonable time to resolve the issue. Do not disclose the vulnerability until it has been patched and users have been given time to upgrade.
We kindly ask you to refrain from malicious acts that put our users, the project, or any of the projects team members at risk.
## Reporting a security issue
Security is a top priority. But no matter how much effort we put into security, there can still be vulnerabilities present.
If you discover a security vulnerability, please use the following means of communications to report it to us:
- Report the security issue to bugs@ripple.com
- [Ripple Bug Bounty](https://ripple.com/bug-bounty/)
Your efforts to responsibly disclose your findings are sincerely appreciated and will be taken into account to acknowledge your contributions.

View File

@@ -1,9 +0,0 @@
/**
* This is an extension of Node's `process` object to include the browser
* property, which is added by webpack.
*/
interface AmbiguousProcess extends NodeJS.Process {
browser?: true
}
declare var process: AmbiguousProcess;

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,19 @@
"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59"
```
Every XRP Ledger account has an *address*, which is a base58-encoding of a hash of the account's public key. XRP Ledger addresses always start with the lowercase letter `r`.
```json
"X7AcgcsBL6XDcUb289X4mJ8djcdyKaB5hJDWMArnXr61cqZ"
```
An *address* refers to a specific XRP Ledger account. It is a base-58 encoding of a hash of the account's public key. There are two kinds of addresses in common use:
### Classic Address
A *classic address* encodes a hash of the account's public key and a checksum. It has no other data. This kind of address always starts with the lowercase letter `r`.
### X-address
An *X-address* encodes a hash of the account's public key, a tag, and a checksum. This kind of address starts with the uppercase letter `X` if it is intended for use on the production XRP Ledger (mainnet). It starts with the uppercase letter `T` if it is intended for use on a test network such as Testnet or Devnet.
## Account Sequence Number
@@ -19,14 +31,13 @@ Currencies are represented as either 3-character currency codes or 40-character
## Value
A *value* is a quantity of a currency represented as a decimal string. Be careful: JavaScript's native number format does not have sufficient precision to represent all values. XRP has different precision from other currencies.
**XRP** has 6 significant digits past the decimal point. In other words, XRP cannot be divided into positive values smaller than `0.000001` (1e-6). XRP has a maximum value of `100000000000` (1e11).
**XRP** has 6 significant digits past the decimal point. In other words, XRP cannot be divided into positive values smaller than `0.000001` (1e-6). This smallest unit is called a "drop". XRP has a maximum value of `100000000000` (1e11). Some RippleAPI methods accept XRP in order to maintain compatibility with older versions of the API. For consistency with the `rippled` APIs, we recommend formally specifying XRP values in *drops* in all API requests, and converting them to XRP for display. This is similar to Bitcoin's *satoshis* and Ethereum's *wei*. 1 XRP = 1,000,000 drops.
**Non-XRP values** have 16 decimal digits of precision, with a maximum value of `9999999999999999e80`. The smallest positive non-XRP value is `1e-81`.
## Amount
Example amount:
Example 100.00 USD amount:
```json
{
@@ -36,15 +47,16 @@ Example amount:
}
```
Example XRP amount:
Example 3.0 XRP amount, in drops:
```json
{
"currency": "XRP",
"value": "2000"
"currency": "drops",
"value": "3000000"
}
```
(Requires `ripple-lib` version 1.0.0 or higher.)
An *amount* is data structure representing a currency, a quantity of that currency, and the counterparty on the trustline that holds the value. For XRP, there is no counterparty.
An *amount* is an object specifying a currency, a quantity of that currency, and the counterparty (issuer) on the trustline that holds the value. For XRP, there is no counterparty.
A *lax amount* allows the counterparty to be omitted for all currencies. If the counterparty is not specified in an amount within a transaction specification, then any counterparty may be used for that amount.
@@ -52,4 +64,4 @@ A *lax lax amount* allows either or both the counterparty and value to be omitte
A *balance* is an amount than can have a negative value.
<%- renderSchema('objects/amount-base.json') %>
<%- renderSchema('objects/amountbase.json') %>

View File

@@ -26,7 +26,7 @@ api.connect().then(() => {
}).catch(console.error);
```
RippleAPI is designed to work in [Node.js](https://nodejs.org) version **6.11.3**. RippleAPI may work on older Node.js versions if you use [Babel](https://babeljs.io/) for [ECMAScript 6](https://babeljs.io/docs/learn-es2015/) support.
RippleAPI is designed to work in [Node.js](https://nodejs.org) version 6 or higher. Ripple recommends Node.js v10 LTS.
The code samples in this documentation are written with ECMAScript 6 (ES6) features, but `RippleAPI` also works with ECMAScript 5 (ES5). Regardless of whether you use ES5 or ES6, the methods that return Promises return [ES6-style promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
@@ -55,7 +55,7 @@ If you omit the `server` parameter, RippleAPI operates [offline](#offline-functi
1. Install [Node.js](https://nodejs.org) and [Yarn](https://yarnpkg.com/en/docs/install). Most Linux distros have a package for Node.js; check that it's the version you want.
2. Use yarn to install RippleAPI:
`yarn install ripple-lib`
`yarn add ripple-lib`
After you have installed ripple-lib, you can create scripts using the [boilerplate](#boilerplate) and run them using the Node.js executable, typically named `node`:

View File

@@ -1,6 +1,6 @@
## computeLedgerHash
`computeLedgerHash(ledger: Object): string`
`computeLedgerHash(ledger: object): string`
Compute the hash of a ledger.

View File

@@ -0,0 +1,19 @@
## deriveAddress
`deriveAddress(publicKey: string): string`
Derive an XRP Ledger address from a public key.
### Parameters
This method takes one parameter, the public key from which to derive the address.
### Return Value
This method returns a string corresponding to the address derived from the public key.
### Example
```javascript
var address = api.deriveAddress(public_key);
```

View File

@@ -0,0 +1,21 @@
## deriveKeypair
`deriveKeypair(seed: string): {privateKey: string, publicKey: string}`
Derive a public and private key from a seed.
### Parameters
This method takes one parameter, the seed from which to derive the public and private key.
### Return Value
This method returns an object containing the public and private components of the keypair corresponding to the seed.
### Example
```javascript
var keypair = api.deriveKeypair(seed)
var public_key = keypair.publicKey;
var private_key = keypair.privateKey;
```

View File

@@ -0,0 +1,254 @@
## formatBidsAndAsks
`formatBidsAndAsks(orderbookInfo: {base: Issue, counter: Issue}, offers: BookOffer[]): orderbook`
Returns formatted bids and asks, which make up an orderbook.
This is a static method on the `RippleAPI` class.
### Parameters
This method takes two parameters.
1. An `OrderbookInfo` object: `{ base: Issue, counter: Issue }`.
2. An array of `BookOffer` objects.
### Return Value
This method returns an object with two properties: `bids` and `asks`, each of which is an array of bids (buy orders) or asks (sell orders), respectively. (Note: the structures of `bids` and `asks` are identical.)
Object structure:
<%- renderSchema('output/get-orderbook.json') %>
**Raw order data:** The response includes a `data` property containing the raw order data. This may include `owner_funds`, `Flags`, and other fields.
For details, see the rippled method [book_offers](https://ripple.com/build/rippled-apis/#book-offers).
### Example
```javascript
const orderbookInfo = {
"base": {
"currency": "USD",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
"counter": {
"currency": "BTC",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
}
};
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
return Promise.all(
[
this.api.request('book_offers', {
taker_gets: RippleAPI.renameCounterpartyToIssuer(orderbookInfo.base),
taker_pays: RippleAPI.renameCounterpartyToIssuer(orderbookInfo.counter),
ledger_index: 'validated',
limit: 20,
taker: address
}),
this.api.request('book_offers', {
taker_gets: RippleAPI.renameCounterpartyToIssuer(orderbookInfo.counter),
taker_pays: RippleAPI.renameCounterpartyToIssuer(orderbookInfo.base),
ledger_index: 'validated',
limit: 20,
taker: address
})
]
).then((directOfferResults, reverseOfferResults) => {
const directOffers = (directOfferResults ? directOfferResults : []).reduce((acc, res) => acc.concat(res.offers), [])
const reverseOffers = (reverseOfferResults ? reverseOfferResults : []).reduce((acc, res) => acc.concat(res.offers), [])
const orderbook = RippleAPI.formatBidsAndAsks(orderbookInfo, [...directOffers, ...reverseOffers]);
console.log(JSON.stringify(orderbook, null, 2));
});
```
```
{
"bids": [
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "0.71800168",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
"totalPrice": {
"currency": "BTC",
"value": "0.00016708342",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
}
},
"properties": {
"maker": "rUKoQ1Zhn6c8EfPsaVa2Yx5NqaKN1JQSvq",
"sequence": 262660,
"makerExchangeRate": "4297.264683713081"
},
"data": {
"Account": "rUKoQ1Zhn6c8EfPsaVa2Yx5NqaKN1JQSvq",
"BookDirectory": "6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC98580F4456E6FA8239",
"BookNode": "0000000000000000",
"Flags": 0,
"LedgerEntryType": "Offer",
"OwnerNode": "000000000000001D",
"PreviousTxnID": "16D75506C6317723FC03543130B5E0AAB13E8AD22514C1DB098BE05771C90447",
"PreviousTxnLgrSeq": 43127860,
"Sequence": 262660,
"TakerGets": {
"currency": "BTC",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0.00016708342"
},
"TakerPays": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0.71800168"
},
"index": "DE877FB94EF892A4BCC58DB8CDE063D97AB5133201905DE6C8650B5DEA19E11B",
"owner_funds": "0.03358376764081196",
"quality": "4297.264683713081"
}
},
{
"specification": {
"direction": "buy",
"quantity": {
"currency": "USD",
"value": "1.6770875",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
"totalPrice": {
"currency": "BTC",
"value": "0.00038681218",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
}
},
"properties": {
"maker": "rpmL45YbZWKgp8AH8EjBSknWo5c8dNuuBM",
"sequence": 231459,
"makerExchangeRate": "4335.663628792661"
},
"data": {
"Account": "rpmL45YbZWKgp8AH8EjBSknWo5c8dNuuBM",
"BookDirectory": "6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC98580F67435A75B355",
"BookNode": "0000000000000000",
"Flags": 0,
"LedgerEntryType": "Offer",
"OwnerNode": "0000000000000001",
"PreviousTxnID": "F049EAFDDDA7B99970F77533743D95C9E12A16FE6C56215A0B09C32C4D23163F",
"PreviousTxnLgrSeq": 43127094,
"Sequence": 231459,
"TakerGets": {
"currency": "BTC",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0.00038681218"
},
"TakerPays": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "1.6770875"
},
"index": "3B314A51BD57601CA1509834DF9462037BF4B05AFCC1E1EFD334DB4E2D7B2AA6",
"owner_funds": "0.03906802968738533",
"quality": "4335.663628792661"
}
},
// ... trimmed for brevity ...
],
"asks": [
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "0.71085738",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
"totalPrice": {
"currency": "BTC",
"value": "0.00016876265",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
}
},
"properties": {
"maker": "rUKoQ1Zhn6c8EfPsaVa2Yx5NqaKN1JQSvq",
"sequence": 262664,
"makerExchangeRate": "0.0002374071856720401"
},
"data": {
"Account": "rUKoQ1Zhn6c8EfPsaVa2Yx5NqaKN1JQSvq",
"BookDirectory": "20294C923E80A51B487EB9547B3835FD483748B170D2D0A451086F34ADB0EA11",
"BookNode": "0000000000000000",
"Flags": 0,
"LedgerEntryType": "Offer",
"OwnerNode": "000000000000001D",
"PreviousTxnID": "54CE0B2783AF973718FAFA35E864A3C172BE488EBBB6F2852611C6DAC8893BDF",
"PreviousTxnLgrSeq": 43127875,
"Sequence": 262664,
"TakerGets": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0.71085738"
},
"TakerPays": {
"currency": "BTC",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0.00016876265"
},
"index": "2D4ED103D6B3FEFA21BC385C53B63359F5678E5AA5429DDE6E1D8FE8B41CD6A8",
"owner_funds": "142.8821425048244",
"quality": "0.0002374071856720401"
}
},
{
"specification": {
"direction": "sell",
"quantity": {
"currency": "USD",
"value": "1.6438778",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
"totalPrice": {
"currency": "BTC",
"value": "0.00039462656",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
}
},
"properties": {
"maker": "rpmL45YbZWKgp8AH8EjBSknWo5c8dNuuBM",
"sequence": 231483,
"makerExchangeRate": "0.0002400583303698121"
},
"data": {
"Account": "rpmL45YbZWKgp8AH8EjBSknWo5c8dNuuBM",
"BookDirectory": "20294C923E80A51B487EB9547B3835FD483748B170D2D0A4510887515B1216C9",
"BookNode": "0000000000000000",
"Flags": 0,
"LedgerEntryType": "Offer",
"OwnerNode": "0000000000000001",
"PreviousTxnID": "6FA370F52C45F6149482156FF7B4226713AECE991FB7D053F74172CB0B8F24E9",
"PreviousTxnLgrSeq": 43127158,
"Sequence": 231483,
"TakerGets": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "1.6438778"
},
"TakerPays": {
"currency": "BTC",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0.00039462656"
},
"index": "735F9661AD006BA0776859BE371D445555FC0815604603AC056469C16AC84AE3",
"owner_funds": "166.0316626329364",
"quality": "0.0002400583303698121"
}
},
// ... trimmed for brevity ...
]
}
```

View File

@@ -1,6 +1,8 @@
## generateAddress
`generateAddress(): {address: string, secret: string}`
`generateAddress(options?: object): {address: string, secret: string}`
Deprecated: This method returns a classic address. If you do not need the classic address, use `generateXAddress` instead.
Generate a new XRP Ledger address and corresponding secret.

View File

@@ -0,0 +1,23 @@
## generateXAddress
`generateXAddress(options?: object): {address: string, secret: string}`
Generate a new XRP Ledger address and corresponding secret.
### Parameters
<%- renderSchema('input/generate-x-address.json') %>
### Return Value
This method returns an object with the following structure:
<%- renderSchema('output/generate-x-address.json') %>
### Example
```javascript
return api.generateXAddress();
```
<%- renderFixture('responses/generate-x-address.json') %>

View File

@@ -1,6 +1,6 @@
## getAccountInfo
`getAccountInfo(address: string, options: Object): Promise<Object>`
`getAccountInfo(address: string, options: object): Promise<object>`
Returns information for the specified account. Note: For account data that is modifiable by the user, see [getSettings](#getsettings).

View File

@@ -15,12 +15,13 @@ This method returns a promise that resolves with an object with the following st
<%- renderSchema('output/get-account-objects.json') %>
The types of objects that may be returned include:
* Offer objects for orders that are currently live, unfunded, or expired but not yet removed.
* RippleState objects for trust lines where this account's side is not in the default state.
* A SignerList object if the account has multi-signing enabled.
* Escrow objects for held payments that have not yet been executed or canceled.
* PayChannel objects for open payment channels.
* Check objects for pending checks.
* `Offer` objects for orders that are currently live, unfunded, or expired but not yet removed.
* `RippleState` objects for trust lines where this account's side is not in the default state.
* A `SignerList` object if the account has multi-signing enabled.
* `Escrow` objects for held payments that have not yet been executed or canceled.
* `PayChannel` objects for open payment channels.
* `Check` objects for pending checks.
### Example

View File

@@ -1,6 +1,6 @@
## getBalanceSheet
`getBalanceSheet(address: string, options: Object): Promise<Object>`
`getBalanceSheet(address: string, options: object): Promise<object>`
Returns aggregate balances by currency plus a breakdown of assets and obligations for a specified account.

View File

@@ -1,6 +1,6 @@
## getBalances
`getBalances(address: string, options: Object): Promise<Array<Object>>`
`getBalances(address: string, options: object): Promise<Array<object>>`
Returns balances for a specified account.

View File

@@ -4,13 +4,15 @@
Returns the estimated transaction fee for the rippled server the RippleAPI instance is connected to.
This will use the [feeCushion parameter](#parameters) provided to the RippleAPI constructor, or the default value of `1.2`.
### Parameters
This method has no parameters.
<%- renderSchema('input/get-fee.json') %>
### Return Value
This method returns a promise that resolves with a string encoded floating point value representing the estimated fee to submit a transaction, expressed in XRP.
This method returns a promise that resolves with a string-encoded floating point value representing the estimated fee to submit a transaction, expressed in XRP.
### Example
@@ -19,5 +21,5 @@ return api.getFee().then(fee => {/* ... */});
```
```json
"0.012"
"0.000012"
```

View File

@@ -1,6 +1,6 @@
## getLedger
`getLedger(options: Object): Promise<Object>`
`getLedger(options: object): Promise<object>`
Returns header information for the specified ledger (or the most recent validated ledger if no ledger is specified). Optionally, all the transactions that were validated in the ledger or the account state information can be returned with the ledger header.

View File

@@ -1,9 +1,13 @@
## getOrderbook
`getOrderbook(address: string, orderbook: Object, options: Object): Promise<Object>`
`getOrderbook(address: string, orderbook: object, options: object): Promise<object>`
Returns open orders for the specified account. Open orders are orders that have not yet been fully executed and are still in the order book.
**Breaking change:** In ripple-lib 1.1.0 and earlier, orders returned by this method were not sorted correctly. Orders are now sorted correctly, from best to worst.
**See also:** An alternative way to get orderbooks is with `request` and [`formatBidsAndAsks`](#formatbidsandasks).
### Parameters
<%- renderSchema('input/get-orderbook.json') %>
@@ -14,6 +18,10 @@ This method returns a promise that resolves with an object with the following st
<%- renderSchema('output/get-orderbook.json') %>
**Raw order data:** The response includes a `data` property containing the raw order data. This may include `owner_funds`, `Flags`, and other fields.
For details, see the rippled method [book_offers](https://ripple.com/build/rippled-apis/#book-offers).
### Example
```javascript

View File

@@ -1,6 +1,6 @@
## getOrders
`getOrders(address: string, options: Object): Promise<Array<Object>>`
`getOrders(address: string, options: object): Promise<Array<object>>`
Returns open orders for the specified account. Open orders are orders that have not yet been fully executed and are still in the order book.

View File

@@ -1,6 +1,6 @@
## getPaths
`getPaths(pathfind: Object): Promise<Array<Object>>`
`getPaths(pathfind: object): Promise<Array<object>>`
Finds paths to send a payment. Paths are options for how to route a payment.

View File

@@ -1,6 +1,6 @@
## getPaymentChannel
`getPaymentChannel(id: string): Promise<Object>`
`getPaymentChannel(id: string): Promise<object>`
Returns specified payment channel.

View File

@@ -1,6 +1,6 @@
## getSettings
`getSettings(address: string, options: Object): Promise<Object>`
`getSettings(address: string, options: object): Promise<object>`
Returns settings for the specified account. Note: For account data that is not modifiable by the user, see [getAccountInfo](#getaccountinfo).

View File

@@ -1,6 +1,6 @@
## getTransaction
`getTransaction(id: string, options: Object): Promise<Object>`
`getTransaction(id: string, options: object): Promise<object>`
Retrieves a transaction by its [Transaction ID](#transaction-id).

View File

@@ -1,6 +1,6 @@
## getTransactions
`getTransactions(address: string, options: Object): Promise<Array<Object>>`
`getTransactions(address: string, options: object): Promise<Array<object>>`
Retrieves historical transactions of an account.

View File

@@ -1,6 +1,6 @@
## getTrustlines
`getTrustlines(address: string, options: Object): Promise<Array<Object>>`
`getTrustlines(address: string, options: object): Promise<Array<object>>`
Returns trustlines for a specified account.

View File

@@ -0,0 +1,27 @@
## hasNextPage
`hasNextPage(currentResponse): boolean`
Returns `true` when there are more pages available.
When there are more results than contained in the response, the response includes a `marker` field. You can use this convenience method, or check for `marker` yourself.
See [Markers and Pagination](https://ripple.com/build/rippled-apis/#markers-and-pagination).
### Return Value
This method returns `true` if `currentResponse` includes a `marker`.
### Example
```javascript
return api.request('ledger_data', {
ledger_index: 'validated'
}).then(response => {
/* Do something useful with response */
if (api.hasNextPage(response)) {
/* There are more pages available */
}
}).catch(console.error);
```

View File

@@ -1,48 +1,69 @@
<% include introduction.md.ejs %>
<% include boilerplate.md.ejs %>
<% include offline.md.ejs %>
<% include basictypes.md.ejs %>
<% include transactions.md.ejs %>
<% include specifications.md.ejs %>
<% include methods.md.ejs %>
<% include connect.md.ejs %>
<% include disconnect.md.ejs %>
<% include isConnected.md.ejs %>
<% include getServerInfo.md.ejs %>
<% include getFee.md.ejs %>
<% include getLedgerVersion.md.ejs %>
<% include getTransaction.md.ejs %>
<% include getTransactions.md.ejs %>
<% include getTrustlines.md.ejs %>
<% include getBalances.md.ejs %>
<% include getBalanceSheet.md.ejs %>
<% include getPaths.md.ejs %>
<% include getOrders.md.ejs %>
<% include getOrderbook.md.ejs %>
<% include getSettings.md.ejs %>
<% include getAccountInfo.md.ejs %>
<% include getAccountObjects.md.ejs %>
<% include getPaymentChannel.md.ejs %>
<% include getLedger.md.ejs %>
<% include preparePayment.md.ejs %>
<% include prepareTrustline.md.ejs %>
<% include prepareOrder.md.ejs %>
<% include prepareOrderCancellation.md.ejs %>
<% include prepareSettings.md.ejs %>
<% include prepareEscrowCreation.md.ejs %>
<% include prepareEscrowCancellation.md.ejs %>
<% include prepareEscrowExecution.md.ejs %>
<% include preparePaymentChannelCreate.md.ejs %>
<% include preparePaymentChannelClaim.md.ejs %>
<% include preparePaymentChannelFund.md.ejs %>
<% include prepareCheckCreate.md.ejs %>
<% include prepareCheckCancel.md.ejs %>
<% include prepareCheckCash.md.ejs %>
<% include sign.md.ejs %>
<% include combine.md.ejs %>
<% include submit.md.ejs %>
<% include generateAddress.md.ejs %>
<% include signPaymentChannelClaim.md.ejs %>
<% include verifyPaymentChannelClaim.md.ejs %>
<% include computeLedgerHash.md.ejs %>
<% include events.md.ejs %>
<%- include('introduction.md.ejs') %>
<%- include('boilerplate.md.ejs') %>
<%- include('offline.md.ejs') %>
<%- include('basictypes.md.ejs') %>
<%- include('transactions.md.ejs') %>
<%- include('specifications.md.ejs') %>
<%- include('rippledAPIs.md.ejs') %>
<%- include('request.md.ejs') %>
<%- include('hasNextPage.md.ejs') %>
<%- include('requestNextPage.md.ejs') %>
<%- include('staticMethods.md.ejs') %>
<%- include('renameCounterpartyToIssuer.md.ejs') %>
<%- include('formatBidsAndAsks.md.ejs') %>
<%- include('methods.md.ejs') %>
<%- include('connect.md.ejs') %>
<%- include('disconnect.md.ejs') %>
<%- include('isConnected.md.ejs') %>
<%- include('getServerInfo.md.ejs') %>
<%- include('getFee.md.ejs') %>
<%- include('getLedgerVersion.md.ejs') %>
<%- include('getTransaction.md.ejs') %>
<%- include('getTransactions.md.ejs') %>
<%- include('getTrustlines.md.ejs') %>
<%- include('getBalances.md.ejs') %>
<%- include('getBalanceSheet.md.ejs') %>
<%- include('getPaths.md.ejs') %>
<%- include('getOrders.md.ejs') %>
<%- include('getOrderbook.md.ejs') %>
<%- include('getSettings.md.ejs') %>
<%- include('getAccountInfo.md.ejs') %>
<%- include('getAccountObjects.md.ejs') %>
<%- include('getPaymentChannel.md.ejs') %>
<%- include('getLedger.md.ejs') %>
<%- include('parseAccountFlags.md.ejs') %>
<%- include('prepareTransaction.md.ejs') %>
<%- include('preparePayment.md.ejs') %>
<%- include('prepareTrustline.md.ejs') %>
<%- include('prepareOrder.md.ejs') %>
<%- include('prepareOrderCancellation.md.ejs') %>
<%- include('prepareSettings.md.ejs') %>
<%- include('prepareEscrowCreation.md.ejs') %>
<%- include('prepareEscrowCancellation.md.ejs') %>
<%- include('prepareEscrowExecution.md.ejs') %>
<%- include('preparePaymentChannelCreate.md.ejs') %>
<%- include('preparePaymentChannelClaim.md.ejs') %>
<%- include('preparePaymentChannelFund.md.ejs') %>
<%- include('prepareCheckCreate.md.ejs') %>
<%- include('prepareCheckCancel.md.ejs') %>
<%- include('prepareCheckCash.md.ejs') %>
<%- include('sign.md.ejs') %>
<%- include('combine.md.ejs') %>
<%- include('submit.md.ejs') %>
<%- include('generateXAddress.md.ejs') %>
<%- include('generateAddress.md.ejs') %>
<%- include('isValidAddress.md.ejs') %>
<%- include('isValidSecret.md.ejs') %>
<%- include('deriveKeypair.md.ejs') %>
<%- include('deriveAddress.md.ejs') %>
<%- include('signPaymentChannelClaim.md.ejs') %>
<%- include('verifyPaymentChannelClaim.md.ejs') %>
<%- include('computeLedgerHash.md.ejs') %>
<%- include('xrpToDropsAndDropsToXrp.md.ejs') %>
<%- include('iso8601ToRippleTime.md.ejs') %>
<%- include('rippleTimeToISO8601.md.ejs') %>
<%- include('txFlags.md.ejs') %>
<%- include('schemaValidator.md.ejs') %>
<%- include('events.md.ejs') %>

View File

@@ -1,6 +1,7 @@
# Introduction
RippleAPI is the official client library to the XRP Ledger. Currently, RippleAPI is only available in JavaScript.
RippleAPI (ripple-lib) is the official client library to the XRP Ledger. Currently, RippleAPI is only available in JavaScript/TypeScript.
Using RippleAPI, you can:
* [Query transactions from the XRP Ledger history](#gettransaction)
@@ -9,4 +10,6 @@ Using RippleAPI, you can:
* [Generate a new XRP Ledger Address](#generateaddress)
* ... and [much more](#api-methods).
RippleAPI only provides access to *validated*, *immutable* transaction data.
This page contains documentation for ripple-lib. To use ripple-lib with npm/yarn, begin with the [Getting Started](https://github.com/ripple/ripple-lib#getting-started) steps.
**What is ripple-lib used for?** Here's a [list of applications that use `ripple-lib`](https://github.com/ripple/ripple-lib/blob/develop/APPLICATIONS.md). Open a PR to add your app or project to the list!

View File

@@ -0,0 +1,19 @@
## isValidAddress
`isValidAddress(address: string): boolean`
Checks if the specified string contains a valid address. X-addresses are considered valid with ripple-lib v1.4.0 and higher.
### Parameters
This method takes one parameter, the address to validate.
### Return Value
This method returns `true` if the address is valid and `false` if it is not.
### Example
```javascript
return api.isValidAddress("address")
```

View File

@@ -0,0 +1,19 @@
## isValidSecret
`isValidSecret(secret: string): boolean`
Checks if the specified string contains a valid secret.
### Parameters
This method takes one parameter, the secret which to validate.
### Return Value
This method returns `true` if the secret is valid and `false` if it is not.
### Example
```javascript
return api.isValidSecret("secret")
```

View File

@@ -0,0 +1,27 @@
## iso8601ToRippleTime
`iso8601ToRippleTime(iso8601: string): number`
This method parses a string representation of a date, and returns the number of seconds since the "Ripple Epoch" of January 1, 2000 (00:00 UTC).
The Ripple Epoch is 946684800 seconds after the Unix Epoch.
This method is useful for creating timestamps to use with the rippled APIs. The rippled APIs represent time as an unsigned integer of the number of seconds since the Ripple Epoch.
### Parameters
`iso8601`: A string representing a date and time. This string is parsed using JavaScript's `Date.parse()` method.
### Return Value
The number of seconds since the Ripple Epoch.
### Example
```javascript
api.iso8601ToRippleTime('2017-02-17T15:04:57Z');
```
```json
540659097
```

View File

@@ -23,4 +23,5 @@ Methods that depend on the state of the XRP Ledger are unavailable in offline mo
* [prepareEscrowExecution](#prepareescrowexecution)
* [sign](#sign)
* [generateAddress](#generateaddress)
* [generateXAddress](#generatexaddress)
* [computeLedgerHash](#computeledgerhash)

View File

@@ -0,0 +1,35 @@
## parseAccountFlags
`parseAccountFlags(Flags: number): object`
Parse an `AccountRoot` object's [`Flags`](https://developers.ripple.com/accountroot.html#accountroot-flags).
### Parameters
This method takes one parameter, the AccountRoot `Flags` number to parse. Note that flags have different mappings on other types of objects or in transactions such as AccountSet.
### Return Value
This method returns an object with containing a key for each AccountRoot flag known to this version of RippleAPI. Each flag has a boolean value of `true` or `false`.
### Example
```javascript
const account_info = await api.request('account_info', {account: 'rKsdkGhyZH6b2Zzd5hNnEqSv2wpznn4n6N'})
const flags = api.parseAccountFlags(account_info.account_data.Flags)
console.log(JSON.stringify(flags, null, 2))
```
```json
{
"passwordSpent": false,
"requireDestinationTag": false,
"requireAuthorization": false,
"depositAuth": true,
"disallowIncomingXRP": false,
"disableMasterKey": false,
"noFreeze": false,
"globalFreeze": false,
"defaultRipple": false
}
```

View File

@@ -1,6 +1,6 @@
## prepareCheckCancel
`prepareCheckCancel(address: string, checkCancel: Object, instructions: Object): Promise<Object>`
`prepareCheckCancel(address: string, checkCancel: object, instructions: object): Promise<object>`
Prepare a Check cancellation transaction. This cancels an unredeemed Check, removing it from the ledger without sending any money. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).

View File

@@ -1,6 +1,6 @@
## prepareCheckCash
`prepareCheckCash(address: string, checkCash: Object, instructions: Object): Promise<Object>`
`prepareCheckCash(address: string, checkCash: object, instructions: object): Promise<object>`
Prepare a Check cashing transaction. This redeems a Check to receive up to the amount authorized by the corresponding CheckCreate transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).

View File

@@ -1,6 +1,6 @@
## prepareCheckCreate
`prepareCheckCreate(address: string, checkCreate: Object, instructions: Object): Promise<Object>`
`prepareCheckCreate(address: string, checkCreate: object, instructions: object): Promise<object>`
Prepare a Check creation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).

View File

@@ -1,6 +1,6 @@
## prepareEscrowCancellation
`prepareEscrowCancellation(address: string, escrowCancellation: Object, instructions: Object): Promise<Object>`
`prepareEscrowCancellation(address: string, escrowCancellation: object, instructions: object): Promise<object>`
Prepare an escrow cancellation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).

View File

@@ -1,6 +1,6 @@
## prepareEscrowCreation
`prepareEscrowCreation(address: string, escrowCreation: Object, instructions: Object): Promise<Object>`
`prepareEscrowCreation(address: string, escrowCreation: object, instructions: object): Promise<object>`
Prepare an escrow creation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
@@ -8,6 +8,12 @@ Prepare an escrow creation transaction. The prepared transaction must subsequent
<%- renderSchema('input/prepare-escrow-creation.json') %>
This is a convenience method for generating the EscrowCreate JSON used by rippled, so the same restrictions apply.
Field mapping: `allowCancelAfter` is equivalent to rippled's `CancelAfter`; `allowExecuteAfter` is equivalent to `FinishAfter`. At the `allowCancelAfter` time, the escrow is considered expired. This means that the funds can only be returned to the sender. At the `allowExecuteAfter` time, the escrow is permitted to be released to the recipient (if the `condition` is fulfilled).
Note that `allowCancelAfter` must be chronologically later than `allowExecuteAfter`.
### Return Value
This method returns a promise that resolves with an object with the following structure:

View File

@@ -1,6 +1,6 @@
## prepareEscrowExecution
`prepareEscrowExecution(address: string, escrowExecution: Object, instructions: Object): Promise<Object>`
`prepareEscrowExecution(address: string, escrowExecution: object, instructions: object): Promise<object>`
Prepare an escrow execution transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).

View File

@@ -1,6 +1,6 @@
## prepareOrder
`prepareOrder(address: string, order: Object, instructions: Object): Promise<Object>`
`prepareOrder(address: string, order: object, instructions: object): Promise<object>`
Prepare an order transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
@@ -22,6 +22,8 @@ All "prepare*" methods have the same return type.
```javascript
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
// Buy 10.10 USD (of the specified issuer) for 2.0 XRP (2000000 drops), fill or kill.
const order = <%- importFile('test/fixtures/requests/prepare-order.json') %>;
return api.prepareOrder(address, order)
.then(prepared => {/* ... */});

View File

@@ -1,6 +1,6 @@
## prepareOrderCancellation
`prepareOrderCancellation(address: string, orderCancellation: Object, instructions: Object): Promise<Object>`
`prepareOrderCancellation(address: string, orderCancellation: object, instructions: object): Promise<object>`
Prepare an order cancellation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).

View File

@@ -1,6 +1,6 @@
## preparePayment
`preparePayment(address: string, payment: Object, instructions: Object): Promise<Object>`
`preparePayment(address: string, payment: object, instructions: object): Promise<object>`
Prepare a payment transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
@@ -23,8 +23,11 @@ All "prepare*" methods have the same return type.
```javascript
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
const payment = <%- importFile('test/fixtures/requests/prepare-payment.json') %>;
return api.preparePayment(address, payment).then(prepared =>
{/* ... */});
return api.preparePayment(address, payment).then(prepared => {
/* ... */
}).catch(error => {
/* ... as with all prepare* methods, use a Promise catch block to handle errors ... */
})
```
<%- renderFixture("responses/prepare-payment.json") %>

View File

@@ -1,6 +1,6 @@
## preparePaymentChannelClaim
`preparePaymentChannelClaim(address: string, paymentChannelClaim: Object, instructions: Object): Promise<Object>`
`preparePaymentChannelClaim(address: string, paymentChannelClaim: object, instructions: object): Promise<object>`
Prepare a payment channel claim transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).

View File

@@ -1,6 +1,6 @@
## preparePaymentChannelCreate
`preparePaymentChannelCreate(address: string, paymentChannelCreate: Object, instructions: Object): Promise<Object>`
`preparePaymentChannelCreate(address: string, paymentChannelCreate: object, instructions: object): Promise<object>`
Prepare a payment channel creation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).

View File

@@ -1,6 +1,6 @@
## preparePaymentChannelFund
`preparePaymentChannelFund(address: string, paymentChannelFund: Object, instructions: Object): Promise<Object>`
`preparePaymentChannelFund(address: string, paymentChannelFund: object, instructions: object): Promise<object>`
Prepare a payment channel fund transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).

View File

@@ -1,6 +1,6 @@
## prepareSettings
`prepareSettings(address: string, settings: Object, instructions: Object): Promise<Object>`
`prepareSettings(address: string, settings: object, instructions: object): Promise<object>`
Prepare a settings transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).

View File

@@ -0,0 +1,50 @@
## prepareTransaction
`prepareTransaction(transaction: object, instructions: object): Promise<object>`
Prepare a transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
This method works with any of [the transaction types supported by rippled](https://developers.ripple.com/transaction-types.html).
Notably, this is the preferred method for preparing `DepositPreauth` or `AccountDelete` transactions.
### Parameters
Name | Type | Description
---- | ---- | -----------
transaction | [transaction](https://developers.ripple.com/transaction-formats.html) | The specification (JSON) of the transaction to prepare. Set `Account` to the address of the account that is creating the transaction. You may omit auto-fillable fields like `Fee`, `Flags`, and `Sequence` to have them set automatically.
instructions | [instructions](#transaction-instructions) | *Optional* Instructions for executing the transaction.
### Return Value
This method returns a promise that resolves with an object with the following structure:
<aside class="notice">
All "prepare*" methods have the same return type.
</aside>
<%- renderSchema("output/prepare.json") %>
### Example
```javascript
async function preparedPreauth() {
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
return api.prepareTransaction({
TransactionType: 'DepositPreauth',
Account: address,
Authorize: 'rMyVso4p83khNyHdV1m1PggV9QNadCj8wM'
});
}
```
```javascript
{
txJSON: '{"TransactionType":"DepositPreauth","Account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59","Authorize":"rMyVso4p83khNyHdV1m1PggV9QNadCj8wM","Flags":2147483648,"LastLedgerSequence":13561714,"Fee":"12","Sequence":1}',
instructions: {
fee: '0.000012',
sequence: 1,
maxLedgerVersion: 13561714
}
}
```

View File

@@ -1,6 +1,6 @@
## prepareTrustline
`prepareTrustline(address: string, trustline: Object, instructions: Object): Promise<Object>`
`prepareTrustline(address: string, trustline: object, instructions: object): Promise<object>`
Prepare a trustline transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).

View File

@@ -0,0 +1,37 @@
## renameCounterpartyToIssuer
`renameCounterpartyToIssuer(issue: {currency: string, counterparty: address}): {currency: string, issuer: address}`
Returns an object with the `counterparty` field renamed to `issuer`. This is useful because RippleAPI generally uses the name `counterparty` while the rippled API generally uses the name `issuer`.
This is a static method on the `RippleAPI` class.
### Parameters
This method takes one parameter, an object with a `counterparty` field.
### Return Value
This method returns a new object similar to the source object, but with `issuer` instead of `counterparty`.
### Example
```javascript
const orderbookInfo = {
"base": {
"currency": "USD",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
"counter": {
"currency": "BTC",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
}
};
console.log(RippleAPI.renameCounterpartyToIssuer(orderbookInfo.base))
console.log(RippleAPI.renameCounterpartyToIssuer(orderbookInfo.counter))
```
```
{ currency: 'USD', issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B' }
{ currency: 'BTC', issuer: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B' }
```

27
docs/src/request.md.ejs Normal file
View File

@@ -0,0 +1,27 @@
## request
`request(command: string, options: object): Promise<object>`
Returns the response from invoking the specified command, with the specified options, on the connected rippled server.
Refer to [rippled APIs](https://ripple.com/build/rippled-apis/) for commands and options. All XRP amounts must be specified in drops. One drop is equal to 0.000001 XRP. See [Specifying Currency Amounts](https://ripple.com/build/rippled-apis/#specifying-currency-amounts).
Most commands return data for the `current` (in-progress, open) ledger by default. Do not rely on this. Always specify a ledger version in your request. In the example below, the 'validated' ledger is requested, which is the most recent ledger that has been validated by the whole network. See [Specifying Ledgers](https://xrpl.org/basic-data-types.html#specifying-ledgers).
### Return Value
This method returns a promise that resolves with the response from rippled.
### Example
```javascript
// Replace 'ledger' with your desired rippled command
return api.request('ledger', {
ledger_index: 'validated'
}).then(response => {
/* Do something useful with response */
console.log(JSON.stringify(response, null, 2))
}).catch(console.error);
```
<%- renderFixture('responses/ledger.json') %>

View File

@@ -0,0 +1,29 @@
## requestNextPage
`requestNextPage(command: string, params: object = {}, currentResponse: object): Promise<object>`
Requests the next page of data.
You can use this convenience method, or include `currentResponse.marker` in `params` yourself, when using `request`.
See [Markers and Pagination](https://ripple.com/build/rippled-apis/#markers-and-pagination).
### Return Value
This method returns a promise that resolves with the next page of data from rippled.
If the response does not have a next page, the promise will reject with `new errors.NotFoundError('response does not have a next page')`.
### Example
```javascript
const command = 'ledger_data'
const params = {
ledger_index: 'validated'
}
return api.request(command, params).then(response => {
return api.requestNextPage(command, params, response)
}).then(response_page_2 => {
/* Do something useful with second page of response */
}).catch(console.error);
```

View File

@@ -0,0 +1,27 @@
## rippleTimeToISO8601
`rippleTimeToISO8601(rippleTime: number): string`
This method takes the number of seconds since the "Ripple Epoch" of January 1, 2000 (00:00 UTC) and returns a string representation of a date.
The Ripple Epoch is 946684800 seconds after the Unix Epoch.
This method is useful for interpreting timestamps returned by the rippled APIs. The rippled APIs represent time as an unsigned integer of the number of seconds since the Ripple Epoch.
### Parameters
`rippleTime`: A number of seconds since the Ripple Epoch.
### Return Value
A string representing a date and time, created by calling a `Date` object's `toISOString()` method.
### Example
```javascript
api.rippleTimeToISO8601(540659097);
```
```json
'2017-02-17T15:04:57.000Z'
```

View File

@@ -0,0 +1,70 @@
# rippled APIs
ripple-lib relies on [rippled APIs](https://ripple.com/build/rippled-apis/) for online functionality. In addition to ripple-lib's own methods, you can also access rippled APIs through ripple-lib. Use the `request()`, `hasNextPage()`, and `requestNextPage()` methods:
* Use `request()` to issue any `rippled` command, including `account_currencies`, `subscribe`, and `unsubscribe`. [Full list of API Methods](https://ripple.com/build/rippled-apis/#api-methods).
* Use `hasNextPage()` to determine whether a response has more pages. This is true when the response includes a [`marker` field](https://ripple.com/build/rippled-apis/#markers-and-pagination).
* Use `requestNextPage()` to request the next page of data.
When using rippled APIs:
* [Specify XRP amounts in drops](https://developers.ripple.com/basic-data-types.html#specifying-currency-amounts).
* [Specify timestamps as the number of seconds since the "Ripple Epoch"](https://developers.ripple.com/basic-data-types.html#specifying-time).
* Instead of `counterparty`, use `issuer`.
## Listening to streams
The `rippled` server can push updates to your client when various events happen. Refer to [Subscriptions in the `rippled` API docs](https://developers.ripple.com/subscription-methods.html) for details.
Note that the `streams` parameter for generic streams takes an array. For example, to subscribe to the `validations` stream, use `{ streams: [ 'validations' ] }`.
The string names of some generic streams to subscribe to are in the table below. (Refer to `rippled` for an up-to-date list of streams.)
Type | Description
---- | -----------
`server` | Sends a message whenever the status of the `rippled` server (for example, network connectivity) changes.
`ledger` | Sends a message whenever the consensus process declares a new validated ledger.
`transactions` | Sends a message whenever a transaction is included in a closed ledger.
`transactions_proposed` | Sends a message whenever a transaction is included in a closed ledger, as well as some transactions that have not yet been included in a validated ledger and may never be. Not all proposed transactions appear before validation. Even some transactions that don't succeed are included in validated ledgers because they take the anti-spam transaction fee.
`validations` | Sends a message whenever the server receives a validation message, also called a validation vote, regardless of whether the server trusts the validator.
`manifests` | Sends a message whenever the server receives a manifest.
`peer_status` | (Admin-only) Information about connected peer `rippled` servers, especially with regards to the consensus process.
When you subscribe to a stream, you must also listen to the relevant message type(s). Some of the available message types are in the table below. (Refer to `rippled` for an up-to-date list of message types.)
Type | Description
---- | -----------
`ledgerClosed` | Sent by the `ledger` stream when the consensus process declares a new fully validated ledger. The message identifies the ledger and provides some information about its contents.
`validationReceived` | Sent by the `validations` stream when the server receives a validation message, also called a validation vote, regardless of whether the server trusts the validator.
`manifestReceived` | Sent by the `manifests` stream when the server receives a manifest.
`transaction` | Sent by many subscriptions including `transactions`, `transactions_proposed`, `accounts`, `accounts_proposed`, and `book` (Order Book). See [Transaction Streams](https://xrpl.org/subscribe.html#transaction-streams) for details.
`peerStatusChange` | (Admin-only) Reports a large amount of information on the activities of other `rippled` servers to which the server is connected.
`path_find` | Asynchronous follow-up response to the currently open path\_find request. See [rippled path\_find method](https://xrpl.org/path_find.html) for details.
To register your listener function, use `connection.on(type, handler)`.
Here is an example of listening for transactions on given account(s):
```
const account = 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn' // Replace with the account you want notifications for
api.connect().then(() => {
// 'transaction' can be replaced with the relevant `type` from the table above
api.connection.on('transaction', (event) => {
// Do something useful with `event`
console.log(JSON.stringify(event, null, 2))
})
api.request('subscribe', {
accounts: [ account ]
}).then(response => {
console.log('Successfully subscribed')
}).catch(error => {
// Handle `error`
})
})
```
The subscription ends when you unsubscribe or the WebSocket connection is closed.
For full details, see [rippled Subscriptions](https://ripple.com/build/rippled-apis/#subscriptions).

View File

@@ -0,0 +1,35 @@
## schemaValidator
Unlike the rest of the ripple-lib API, schemaValidator is a static object on RippleAPI. It provides utility methods that do not use a server.
## schemaValidate
`RippleAPI.schemaValidator.schemaValidate(schemaName: string, object: any): void`
This method checks an object for conformance to a specified schema. It does not return anything, but will throw a `ValidationError` if the object does not conform to the schema.
### Example
```javascript
RippleAPI.schemaValidator.schemaValidate('sign', {
signedTransaction: '12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D874473045022100BDE09A1F6670403F341C21A77CF35BA47E45CDE974096E1AA5FC39811D8269E702203D60291B9A27F1DCABA9CF5DED307B4F23223E0B6F156991DB601DFB9C41CE1C770A726970706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304',
id: '02ACE87F1996E3A23690A5BB7F1774BF71CCBA68F79805831B42ABAD5913D6F4'
})
```
```json
undefined
```
If the object is valid (conforms to the schema), nothing is returned. Otherwise, `schemaValidate` throws an error:
```javascript
RippleAPI.schemaValidator.schemaValidate('sign', {
signedTransaction: '12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D874473045022100BDE09A1F6670403F341C21A77CF35BA47E45CDE974096E1AA5FC39811D8269E702203D60291B9A27F1DCABA9CF5DED307B4F23223E0B6F156991DB601DFB9C41CE1C770A726970706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304',
id: '123'
})
```
```
[ValidationError(instance.id does not match pattern "^[A-F0-9]{64}$")]
```

View File

@@ -1,16 +1,22 @@
## sign
```
sign(txJSON: string, secret: string, options: Object): {signedTransaction: string, id: string}
sign(txJSON: string, keypair: Object, options: Object): {signedTransaction: string, id: string}
sign(txJSON: string, secret: string, options: object): {signedTransaction: string, id: string}
sign(txJSON: string, keypair: object, options: object): {signedTransaction: string, id: string}
```
Sign a prepared transaction. The signed transaction must subsequently be [submitted](#submit).
This method can sign any of [the transaction types supported by ripple-binary-codec](https://github.com/ripple/ripple-binary-codec/blob/cfcde79c19c359e9a0466d7bc3dc9a3aef47bb99/src/enums/definitions.json#L1637). When a new transaction type is added to the XRP Ledger, it will be unrecognized until `ripple-binary-codec` is updated. If you try to sign an unrecognized transaction type, this method throws an error similar to the following:
`Error: [TRANSACTION_TYPE] is not a valid name or ordinal for TransactionType`
### Parameters
<%- renderSchema("input/sign.json") %>
When this method is used for multisigning, the `options` parameter is required. See the multisigning example in this section for more details.
### Return Value
This method returns an object with the following structure:
@@ -27,3 +33,91 @@ return api.sign(txJSON, secret); // or: api.sign(txJSON, keypair);
```
<%- renderFixture("responses/sign.json") %>
### Example (multisigning)
```javascript
const RippleAPI = require('ripple-lib').RippleAPI;
// jon's address will have a multi-signing setup with a quorum of 2
const jon = {
account: 'rJKpme4m2zBQceBuU89d7vLMzgoUw2Ptj',
secret: 'sh4Va7b1wQof8knHFV2sxwX12fSgK'
};
const aya = {
account: 'rnrPdBjs98fFFfmRpL6hM7exT788SWQPFN',
secret: 'snaMuMrXeVc2Vd4NYvHofeGNjgYoe'
};
const bran = {
account: 'rJ93RLnT1t5A8fCr7HTScw7WtfKJMRXodH',
secret: 'shQtQ8Um5MS218yvEU3Ehy1eZQKqH'
};
// Setup the signers list with a quorum of 2
const multiSignSetupTransaction = {
"Flags": 0,
"TransactionType": "SignerListSet",
"Account": "rJKpme4m2zBQceBuU89d7vLMzgoUw2Ptj",
"Fee": "120",
"SignerQuorum": 2,
"SignerEntries": [
{
"SignerEntry": {
"Account": "rnrPdBjs98fFFfmRpL6hM7exT788SWQPFN",
"SignerWeight": 2
}
},
{
"SignerEntry": {
"Account": "rJ93RLnT1t5A8fCr7HTScw7WtfKJMRXodH",
"SignerWeight": 1
}
},
]
};
// a transaction which requires multi signing
const multiSignPaymentTransaction = {
TransactionType: 'Payment',
Account: 'rJKpme4m2zBQceBuU89d7vLMzgoUw2Ptj',
Destination: 'rJ93RLnT1t5A8fCr7HTScw7WtfKJMRXodH',
Amount: '88000000'
};
const api = new RippleAPI({
server: 'wss://s.altnet.rippletest.net:51233'
});
api.connect().then(() => {
// adding the multi signing feature to jon's account
api.prepareTransaction(multiSignSetupTransaction).then((prepared) => {
console.log(prepared);
jonSign = api.sign(prepared.txJSON, jon.secret).signedTransaction;
api.submit(jonSign).then( response => {
console.log(response.resultCode, response.resultMessage);
// multi sign a transaction
api.prepareTransaction(multiSignPaymentTransaction).then(prepared => {
console.log(prepared);
// Aya and Bran sign it too but with 'signAs' set to their own account
let ayaSign = api.sign(prepared.txJSON, aya.secret, {'signAs': aya.account}).signedTransaction;
let branSign = api.sign(prepared.txJSON, bran.secret, {'signAs': bran.account}).signedTransaction;
// signatures are combined and submitted
let combinedTx = api.combine([ayaSign, branSign]);
api.submit(combinedTx.signedTransaction).then(response => {
console.log(response.tx_json.hash);
return api.disconnect();
}).catch(console.error);
}).catch(console.error);
}).catch(console.error)
}).catch(console.error);
}).catch(console.error);
```
Assuming the multisigning account was setup properly, the above example will respond with `resultCode: 'tesSUCCESS'` and the hash for the transaction.
If any of `{signAs: some_address}` options were missing the code will return a validation error as follow:
```
[ValidationError(txJSON is not the same for all signedTransactions)]
```

View File

@@ -28,6 +28,8 @@ See [Transaction Types](#transaction-types) for a description.
<%- renderSchema('specifications/order.json') %>
The following invalid flag combination causes a `ValidationError`: `immediateOrCancel` and `fillOrKill`. These fields are mutually exclusive, and cannot both be set at the same time.
### Example
<%- renderFixture('requests/prepare-order.json') %>

View File

@@ -0,0 +1,35 @@
# Static Methods
ripple-lib features a number of static methods that you can access directly on the `RippleAPI` object. The most commonly-used one is `computeBinaryTransactionHash`, described below. For the full list, see the [XRP Ledger Hashes README](https://github.com/ripple/ripple-lib/blob/develop/src/common/hashes/README.md).
## computeBinaryTransactionHash
`computeBinaryTransactionHash(txBlobHex: string): string`
Returns the hash (id) of a binary transaction blob.
This is a static method on the `RippleAPI` class.
### Parameters
This method takes one parameter, a string containing a binary transaction in hex.
### Return Value
This method returns a string representing the transaction's id (hash).
### Example
```javascript
const signed_blob = '120000228000000024000B2E5A201B0066374B61400000003B9ACA0068400000000000000C732102356E89059A75438887F9FEE2056A2890DB82A68353BE9C0C0C8F89C0018B37FC74473045022100B3721EEB1ED6DFF29FB8B209E2DE6B54A0A6E44D52D926342F3D334BE98F08640220367A74107AD5DEAEFA3AB2984C161FC23F30B2704BB5CC984358BA262177A4568114F667B0CA50CC7709A220B0561B85E53A48461FA883142B71D8B09B4EE8DAA68FB936C23E3A974713BDAC'
if (typeof signed_blob === 'string' && signed_blob.match(/^[A-F0-9]+$/)) {
const id = RippleAPI.computeBinaryTransactionHash(signed_blob)
console.log('Transaction hash:', id')
}
```
```
Transaction hash: 80C5E11E1A21A626759D6CB944B33DBAAC66BD704A289C86E330B847904F5C13
```
[RunKit Example: computeBinaryTransactionHash](https://runkit.com/intelliot/computebinarytransactionhash-example)

View File

@@ -1,25 +1,83 @@
## submit
`submit(signedTransaction: string): Promise<Object>`
`request('submit', {tx_blob: string, fail_hard: boolean}): Promise<object>`
Submits a signed transaction. The transaction is not guaranteed to succeed; it must be verified with [getTransaction](#gettransaction).
The `submit` method applies a transaction and sends it to the network to be confirmed and included in future ledgers.
This method takes a signed, serialized transaction as a binary blob, and submits it to the network as-is. Since signed transaction objects are immutable, no part of the transaction can be modified or automatically filled in after submission.
To send a transaction as robustly as possible, you should construct and sign it in advance, persist it somewhere that you can access even after a power outage, then `submit` it as a `tx_blob`. After submission, monitor the network with the `tx` method to see if the transaction was successfully applied; if a restart or other problem occurs, you can safely re-submit the `tx_blob` transaction: it won't be applied twice since it has the same sequence number as the old transaction.
### Parameters
<%- renderSchema('input/submit.json') %>
| `Field` | Type | Description |
|:------------|:--------|:-----------------------------------------------------|
| `tx_blob` | String | Hex representation of the signed transaction to submit. This can be a multi-signed transaction. |
| `fail_hard` | Boolean | (Optional, defaults to false) If true, and the transaction fails locally, do not retry or relay the transaction to other servers |
### Return Value
This method returns an object with the following structure:
When successful, this method returns an object containing the following fields:
<%- renderSchema('output/submit.json') %>
| `Field` | Type | Description |
|:------------------------|:--------|:-----------------------------------------|
| `engine_result` | String | Text [result code](https://xrpl.org/transaction-results.html) indicating the preliminary result of the transaction, for example `tesSUCCESS` |
| `engine_result_code` | Integer | Numeric version of the [result code](https://xrpl.org/transaction-results.html). **Not recommended.** |
| `engine_result_message` | String | Human-readable explanation of the transaction's preliminary result |
| `tx_blob` | String | The complete transaction in hex string format |
| `tx_json` | Object | The complete transaction in JSON format |
| `accepted` | Boolean | The value `true` indicates that the transaction was applied, queued, broadcast, or kept for later. The value `false` indicates that none of those happened, so the transaction cannot possibly succeed as long as you do not submit it again and have not already submitted it another time. [New in: rippled 1.5.0] |
| `account_sequence_available` | Number | The next [Sequence Number](https://xrpl.org/basic-data-types.html#account-sequence) available for the sending account after all pending and [queued](https://xrpl.org/transaction-queue.html) transactions. [New in: rippled 1.5.0] |
| `account_sequence_next` | number | The next [Sequence Number](https://xrpl.org/basic-data-types.html#account-sequence) for the sending account after all transactions that have been provisionally applied, but not transactions in the [queue](https://xrpl.org/transaction-queue.html). [New in: rippled 1.5.0] |
| `applied` | Boolean | The value `true` indicates that this transaction was applied to the open ledger. In this case, the transaction is likely, but not guaranteed, to be validated in the next ledger version. [New in: rippled 1.5.0] |
| `broadcast` | Boolean | The value `true` indicates this transaction was broadcast to peer servers in the peer-to-peer XRP Ledger network. (Note: if the server has no peers, such as in [stand-alone mode](https://xrpl.org/rippled-server-modes.html#reasons-to-run-a-rippled-server-in-stand-alone-mode), the server uses the value `true` for cases where it _would_ have broadcast the transaction.) The value `false` indicates the transaction was not broadcast to any other servers. [New in: rippled 1.5.0] |
| `kept` | Boolean | The value `true` indicates that the transaction was kept to be retried later. [New in: rippled 1.5.0] |
| `queued` | Boolean | The value `true` indicates the transaction was put in the [Transaction Queue](https://xrpl.org/transaction-queue.html), which means it is likely to be included in a future ledger version. [New in: rippled 1.5.0] |
| `open_ledger_cost` | String | The current [open ledger cost](https://xrpl.org/transaction-cost.html#open-ledger-cost) before processing this transaction. Transactions with a lower cost are likely to be [queued](https://xrpl.org/transaction-queue.html). [New in: rippled 1.5.0] |
| `validated_ledger_index` | Integer | The [ledger index](https://xrpl.org/basic-data-types.html#ledger-index) of the newest validated ledger at the time of submission. This provides a lower bound on the ledger versions that the transaction can appear in as a result of this request. (The transaction could only have been validated in this ledger version or earlier if it had already been submitted before.) |
Note: Many situations can prevent a transaction from processing successfully, such as a lack of trust lines connecting the two accounts in a payment, or changes in the state of the ledger since the time the transaction was constructed. Even if nothing is wrong, it may take several seconds to close and validate the ledger version that includes the transaction. Do not consider the transaction's results final until they appear in a validated ledger version.
### Example
```javascript
const signedTransaction = '12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D874473045022100BDE09A1F6670403F341C21A77CF35BA47E45CDE974096E1AA5FC39811D8269E702203D60291B9A27F1DCABA9CF5DED307B4F23223E0B6F156991DB601DFB9C41CE1C770A726970706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304';
return api.submit(signedTransaction)
.then(result => {/* ... */});
const signedTransaction = '12000022800000002400000007201B007008BC61400000000754D4C068400000000000000C732103E8110048477E60F292DEDA67CF518511E70A15E1E3771B3C024026E1F824832874473045022100D659C836C24FF346A87054E463078D805B19EFE9F10348FD4C6ED6C3F3C4D750022060BE0BFD5E2C4963A1B0E0F21D5BA800969863BA486F71E75C08D76D77C45B22811492F80A3F3849DBB5714A4F2C691CE7D47BEED58083141266204CFBC657E65D9B4D30301FF98644693935';
const failHard = false;
const result = await api.request('submit', {
tx_blob: signedTransaction,
fail_hard: failHard // optional
});
```
<%- renderFixture('responses/submit.json') %>
```json
{
"accepted": true,
"account_sequence_available": 8,
"account_sequence_next": 8,
"applied": true,
"broadcast": true,
"engine_result": "tesSUCCESS",
"engine_result_code": 0,
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
"kept": true,
"open_ledger_cost": "10",
"queued": false,
"tx_blob": "12000022800000002400000007201B007008BC61400000000754D4C068400000000000000C732103E8110048477E60F292DEDA67CF518511E70A15E1E3771B3C024026E1F824832874473045022100D659C836C24FF346A87054E463078D805B19EFE9F10348FD4C6ED6C3F3C4D750022060BE0BFD5E2C4963A1B0E0F21D5BA800969863BA486F71E75C08D76D77C45B22811492F80A3F3849DBB5714A4F2C691CE7D47BEED58083141266204CFBC657E65D9B4D30301FF98644693935",
"tx_json": {
"Account": "rNQao3Z1irwRjKWSs8heL4a8WKLPKfLrXs",
"Amount": "123000000",
"Destination": "rpgHWJdXkSvvzikdJCpuMzU7zWnuqsJRCZ",
"Fee": "12",
"Flags": 2147483648,
"LastLedgerSequence": 7342268,
"Sequence": 7,
"SigningPubKey": "03E8110048477E60F292DEDA67CF518511E70A15E1E3771B3C024026E1F8248328",
"TransactionType": "Payment",
"TxnSignature": "3045022100D659C836C24FF346A87054E463078D805B19EFE9F10348FD4C6ED6C3F3C4D750022060BE0BFD5E2C4963A1B0E0F21D5BA800969863BA486F71E75C08D76D77C45B22",
"hash": "FE8D68D7FF5805EB07AF15A1ADF07FB5463CCD2C6C0A15981EB3D26A02E1551C"
},
"validated_ledger_index": 7341775
}
```
(In ripple-lib 1.8.0, [the old `submit` method](https://github.com/ripple/ripple-lib/blob/1.7.0/docs/index.md#submit) was deprecated.)

View File

@@ -15,7 +15,7 @@ Type | Description
[escrowCancellation](#escrow-cancellation) | An `escrowCancellation` transaction unlocks the funds in an escrow and sends them back to the creator of the escrow, but it will only work after the escrow expires.
[escrowExecution](#escrow-execution) | An `escrowExecution` transaction unlocks the funds in an escrow and sends them to the destination of the escrow, but it will only work if the cryptographic condition is provided.
[checkCreate](#check-create) | A `checkCreate` transaction creates a check on the ledger, which is a deferred payment that can be cashed by its intended destination.
[checkCancel](#check-cancel) | A `checkCancel` transaction cancels an unreedemed Check, removing it from the ledger without sending any money.
[checkCancel](#check-cancel) | A `checkCancel` transaction cancels an unredeemed Check, removing it from the ledger without sending any money.
[checkCash](#check-cash) | A `checkCash` transaction redeems a Check to receive up to the amount authorized by the corresponding `checkCreate` transaction. Only the `destination` address of a Check can cash it.
[paymentChannelCreate](#payment-channel-create) | A `paymentChannelCreate` transaction opens a payment channel between two addresses with XRP set aside for asynchronous payments.
[paymentChannelFund](#payment-channel-fund) | A `paymentChannelFund` transaction adds XRP to a payment channel and optionally sets a new expiration for the channel.
@@ -43,17 +43,19 @@ Executing a transaction with `RippleAPI` requires the following four steps:
## Transaction Fees
Every transaction must destroy a small amount of XRP as a cost to send the transaction. This is also called a *transaction fee*. The transaction cost is designed to increase along with the load on the XRP Ledger, making it very expensive to deliberately or inadvertently overload the peer-to-peer network that powers the XRP Ledger.
Every transaction must destroy a small amount of XRP as a cost to apply the transaction to the ledger. This is also called a *transaction fee*. The transaction cost is designed to increase along with the load on the XRP Ledger, making it very expensive to deliberately or inadvertently overload the peer-to-peer network that powers the XRP Ledger.
You can choose the size of the fee you want to pay or let a default be used. You can get an estimate of the fee required to be included in the next ledger closing with the [getFee](#getfee) method.
For a multi-signed transaction, ripple-lib automatically multiplies the `fee` by (1 + Number of Signatures Provided). For example, if you set `instructions.fee = '0.000020'` and `instructions.signersCount = 2`, the prepared transaction's `Fee` will be 20 drops × (1 + 2 Signatures) = 60 drops. See [Transaction Cost](https://developers.ripple.com/transaction-cost.html).
## Transaction Instructions
Transaction instructions indicate how to execute a transaction, complementary with the [transaction specification](#transaction-specifications).
<%- renderSchema("objects/instructions.json") %>
We recommended that you specify a `maxLedgerVersion` so that you can quickly determine that a failed transaction will never succeeed in the future. It is impossible for a transaction to succeed after the XRP Ledger's consensus-validated ledger version exceeds the transaction's `maxLedgerVersion`. If you omit `maxLedgerVersion`, the "prepare*" method automatically supplies a `maxLedgerVersion` equal to the current ledger plus 3, which it includes in the return value from the "prepare*" method.
We recommend that you specify a `maxLedgerVersion` so that you can quickly determine that a failed transaction will never succeed in the future. It is impossible for a transaction to succeed after the XRP Ledger's consensus-validated ledger version exceeds the transaction's `maxLedgerVersion`. If you omit `maxLedgerVersion`, the "prepare\*" method automatically supplies a `maxLedgerVersion` equal to the current ledger plus 3, which it includes in the return value from the "prepare\*" method.
## Transaction ID

81
docs/src/txFlags.md.ejs Normal file
View File

@@ -0,0 +1,81 @@
## txFlags
`txFlags.TRANSACTION_TYPE.FLAG`
This object provides constants for use when creating or interpreting transaction flags. Most transactions have a set of bit-flags that represent various options that affect how a transaction should behave. These options are represented as binary values that can be combined with bitwise-or operations to encode multiple flags at once.
Most flags only have meaning for a specific transaction type. The same bitwise value may be reused for flags on different transaction types, so it is important to pay attention to the transaction type when setting and reading flags.
Bits that are not defined as flags MUST be 0.
### Global Flag
Applies globally to all transactions.
`txFlags.Universal.FullyCanonicalSig`: Require a fully-canonical signature. When preparing transactions, ripple-lib enables this flag for you.
### Payment Flags
`txFlags.Payment.NoRippleDirect`: Do not use the default path; only use specified paths. This is intended to force the transaction to take arbitrage opportunities. Most clients do not need this.
`txFlags.Payment.PartialPayment`: If the specified destination amount cannot be sent without spending more than the source maxAmount, reduce the received amount instead of failing outright. See [Partial Payments](https://developers.ripple.com/partial-payments.html) for more details.
`txFlags.Payment.LimitQuality`: Only take paths where all the conversions have an input:output ratio that is equal or better than the ratio of `destination.amount`:`source.maxAmount`. See [Limit Quality](https://developers.ripple.com/payment.html#limit-quality) for details.
### OfferCreate Flags
`txFlags.OfferCreate.Passive`: If enabled, the offer does not consume offers that exactly match it, and instead becomes an Offer object in the ledger. It still consumes offers that cross it.
`txFlags.OfferCreate.ImmediateOrCancel`: Treat the offer as an Immediate or Cancel order. If enabled, the offer never becomes a ledger object: it only tries to match existing offers in the ledger.
`txFlags.OfferCreate.FillOrKill`: Treat the offer as a Fill or Kill order.
`txFlags.OfferCreate.Sell`: Treat the offer as a Sell order. With `order.direction = 'sell'`, exchange the entire `order.quantity`, even if it means obtaining more than the `order.totalPrice` amount in exchange. If using `prepareOrder`, ripple-lib sets this flag for you.
### TrustSet Flags
`txFlags.TrustSet.SetAuth`: Authorize the other party to hold issuances from this account. (No effect unless using the AccountSet.RequireAuth flag.) Cannot be unset.
`txFlags.TrustSet.NoRipple`: Obsolete.
`txFlags.TrustSet.SetNoRipple`: Blocks [rippling](https://developers.ripple.com/rippling.html) between two trustlines of the same currency, if this flag is set on both.
`txFlags.TrustSet.ClearNoRipple`: Clears the No-[Rippling](https://developers.ripple.com/rippling.html) flag.
`txFlags.TrustSet.SetFreeze`: Freeze the trustline. A non-XRP currency can be frozen by the exchange or gateway that issued it. XRP cannot be frozen.
`txFlags.TrustSet.ClearFreeze`: Unfreeze the trustline.
### AccountSet Flags
You can use the `prepareSettings` method to change your account flags. This method uses AccountSet flags internally.
In the rippled API, Account Flags can be enabled and disabled with the SetFlag and ClearFlag parameters. See [AccountSet Flags](https://developers.ripple.com/accountset.html#accountset-flags).
The AccountSet transaction type has some transaction flags, but their use is discouraged.
* `txFlags.AccountSet.RequireDestTag`
* `txFlags.AccountSet.OptionalDestTag`
* `txFlags.AccountSet.RequireAuth`
* `txFlags.AccountSet.OptionalAuth`
* `txFlags.AccountSet.DisallowXRP`
* `txFlags.AccountSet.AllowXRP`
### PaymentChannelClaim Flags
`txFlags.PaymentChannelClaim.Renew`: Clear the channel's Expiration time. (Expiration is different from the channel's immutable CancelAfter time.) Only the source address of the payment channel can use this flag.
`txFlags.PaymentChannelClaim.Close`: Request to close the channel. Only the channel source and destination addresses can use this flag. This flag closes the channel immediately if it has no more XRP allocated to it after processing the current claim, or if the destination address uses it. If the source address uses this flag when the channel still holds XRP, this schedules the channel to close after SettleDelay seconds have passed. (Specifically, this sets the Expiration of the channel to the close time of the previous ledger plus the channel's SettleDelay time, unless the channel already has an earlier Expiration time.) If the destination address uses this flag when the channel still holds XRP, any XRP that remains after processing the claim is returned to the source address.
### Other Transaction Types
The remaining transaction types do not have any flags at this time.
* OfferCancel
* SetRegularKey
* SignerListSet
* EscrowCreate
* EscrowFinish
* EscrowCancel
* PaymentChannelCreate
* PaymentChannelFund

View File

@@ -0,0 +1,47 @@
## xrpToDrops
`xrpToDrops(xrp: string | BigNumber): string`
Converts an XRP amount to drops. 1 XRP = 1,000,000 drops, so 1 drop = 0.000001 XRP. This method is useful when converting amounts for use with the rippled API, which requires XRP amounts to be specified in drops.
### Parameters
`xrp`: A string or BigNumber representing an amount of XRP. If `xrp` is a string, it may start with `-`, must contain at least one number, and may contain up to one `.`. This method throws a `ValidationError` for invalid input.
### Return Value
A string representing an equivalent amount of drops.
### Example
```javascript
return api.xrpToDrops('1');
```
```json
'1000000'
```
## dropsToXrp
`dropsToXrp(drops: string | BigNumber): string`
Converts an amount of drops to XRP. 1 drop = 0.000001 XRP, so 1 XRP = 1,000,000 drops. This method is useful when converting amounts from the rippled API, which describes XRP amounts in drops.
### Parameters
`drops`: A string or BigNumber representing an amount of drops. If `drops` is a string, it may start with `-` and must contain at least one number. This method throws a `ValidationError` for invalid input.
### Return Value
A string representing an equivalent amount of XRP.
### Example
```javascript
return api.dropsToXrp('1');
```
```json
'0.000001'
```

View File

@@ -1,77 +1,75 @@
{
"name": "ripple-lib",
"version": "0.21.0",
"version": "1.8.1",
"license": "ISC",
"description": "A JavaScript API for interacting with Ripple in Node.js and the browser",
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
"files": [
"dist/npm/*",
"build/*"
"build/ripple-latest-min.js",
"build/ripple-latest.js"
],
"main": "dist/npm/",
"unpkg": "build/ripple-latest-min.js",
"jsdelivr": "build/ripple-latest-min.js",
"types": "dist/npm/index.d.ts",
"browser": {
"ws": "./dist/npm/common/wswrapper.js"
"ws": "./dist/npm/common/wswrapper.js",
"https-proxy-agent": false
},
"directories": {
"test": "test"
},
"dependencies": {
"@types/lodash": "^4.14.85",
"@types/ws": "^3.2.0",
"bignumber.js": "^4.1.0",
"https-proxy-agent": "2.2.1",
"@types/lodash": "^4.14.136",
"@types/ws": "^7.2.0",
"bignumber.js": "^9.0.0",
"https-proxy-agent": "^5.0.0",
"jsonschema": "1.2.2",
"lodash": "^4.17.4",
"ripple-address-codec": "^2.0.1",
"ripple-binary-codec": "^0.1.13",
"ripple-hashes": "^0.3.1",
"ripple-keypairs": "^0.10.1",
"ripple-lib-transactionparser": "^0.6.2",
"ws": "^3.3.1"
"lodash.isequal": "^4.5.0",
"ripple-address-codec": "^4.1.1",
"ripple-binary-codec": "^1.0.2",
"ripple-keypairs": "^1.0.0",
"ripple-lib-transactionparser": "0.8.2",
"ws": "^7.2.0"
},
"devDependencies": {
"@types/node": "^8.0.53",
"assert-diff": "^1.0.1",
"coveralls": "^2.13.1",
"doctoc": "^0.15.0",
"ejs": "^2.3.4",
"eventemitter2": "^0.4.14",
"gulp": "^3.8.10",
"gulp-bump": "^0.1.13",
"gulp-rename": "^1.2.0",
"http-server": "^0.8.5",
"jayson": "^1.2.2",
"json-loader": "^0.5.2",
"@types/mocha": "^7.0.1",
"@types/node": "^14.0.1",
"@typescript-eslint/eslint-plugin": "^2.3.3",
"@typescript-eslint/parser": "^2.27.0",
"assert-diff": "^3.0.0",
"doctoc": "^1.4.0",
"ejs": "^3.0.1",
"eslint": "^6.5.1",
"eventemitter2": "^6.0.0",
"json-schema-to-markdown-table": "^0.4.0",
"mocha": "^2.1.0",
"mocha-in-sauce": "^0.0.1",
"mocha-junit-reporter": "^1.9.1",
"null-loader": "^0.1.1",
"nyc": "^11.3.0",
"source-map-support": "^0.5.0",
"ts-loader": "^3.2.0",
"ts-node": "^3.3.0",
"tslint": "^5.8.0",
"tslint-eslint-rules": "^4.1.1",
"typescript": "^2.6.1",
"uglifyjs-webpack-plugin": "^1.1.4",
"webpack": "^3.10.0",
"yargs": "^8.0.2"
"mocha": "^7.1.1",
"nyc": "^15.0.0",
"prettier": "^2.0.5",
"ts-node": "^8.4.1",
"typescript": "^3.7.5",
"webpack": "^4.42.0",
"webpack-bundle-analyzer": "^3.6.0",
"webpack-cli": "^3.3.9"
},
"scripts": {
"build": "gulp",
"build:schemas": "mkdir -p dist/npm/common && cp -r src/common/schemas dist/npm/common/",
"build:lib": "tsc --build",
"build:web": "webpack",
"build": "yarn build:schemas && yarn build:lib && yarn build:web",
"analyze": "yarn build:web --analyze",
"watch": "yarn build:lib --watch",
"clean": "rm -rf dist/npm",
"doctoc": "doctoc docs/index.md --title '# RippleAPI Reference' --github --maxlevel 2",
"docgen": "node --harmony scripts/build_docs.js",
"clean": "rm -rf dist/npm",
"compile": "mkdir -p dist/npm/common && cp -r src/common/schemas dist/npm/common/ && tsc",
"watch": "tsc -w",
"prepublish": "npm run clean && npm run compile && npm run build",
"test": "nyc mocha",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"lint": "tslint -p ./",
"prepublish": "yarn clean && yarn build",
"test": "TS_NODE_PROJECT=src/tsconfig.json nyc mocha --exit",
"test:watch": "TS_NODE_PROJECT=src/tsconfig.json mocha --watch --reporter dot",
"format": "prettier --write '{src,test}/**/*.ts'",
"lint": "eslint 'src/**/*.ts' 'test/*-test.{ts,js}'",
"perf": "./scripts/perf_test.sh",
"start": "node scripts/http.js",
"sauce": "node scripts/sauce-runner.js"
"start": "node scripts/http.js"
},
"repository": {
"type": "git",
@@ -79,6 +77,7 @@
},
"readmeFilename": "README.md",
"engines": {
"node": ">=6.12.3"
"node": ">=8",
"yarn": "^1.15.2"
}
}

View File

@@ -14,9 +14,12 @@ lint() {
unittest() {
# test "src"
mocha test --reporter mocha-junit-reporter --reporter-options mochaFile=$CIRCLE_TEST_REPORTS/test-results.xml
# TODO: replace/upgrade mocha-junit-reporter
#mocha test --reporter mocha-junit-reporter --reporter-options mochaFile=$CIRCLE_TEST_REPORTS/test-results.xml
yarn test --coverage
yarn run coveralls
#yarn run coveralls
# test compiled version in "dist/npm"
$(npm bin)/babel -D --optional runtime --ignore "**/node_modules/**" -d test-compiled/ test/
@@ -45,7 +48,6 @@ unittest() {
integrationtest() {
mocha test/integration/integration-test.js
mocha test/integration/http-integration-test.js
# run integration tests in PhantomJS
#gulp build-tests build-min

View File

@@ -1,16 +0,0 @@
'use strict';
const createHTTPServer = require('../dist/npm/http').createHTTPServer;
const port = 5990;
const serverUrl = 'wss://s1.ripple.com';
function main() {
const server = createHTTPServer({server: serverUrl}, port);
server.start().then(() => {
console.log('Server started on port ' + String(port));
});
}
main();

View File

@@ -1,100 +0,0 @@
const _ = require('lodash');
const MochaSauce = require('mocha-in-sauce');
const testUrl = 'http://testripple.circleci.com:8080/test/saucerunner.html';
function main() {
// uncomment for more debug info
// process.env.DEBUG = '*';
// configure
const config = {
name: 'RippleAPI',
host: 'localhost',
port: 4445,
maxDuration: 180000,
// the current build name (optional)
build: Date.now(),
url: testUrl,
runSauceConnect: true
};
if (process.env.CIRCLE_BUILD_NUM) {
config.build = process.env.CIRCLE_BUILD_NUM;
config.tags = [process.env.CIRCLE_BRANCH, process.env.CIRCLE_SHA1];
config.tunnelIdentifier = process.env.CIRCLE_BUILD_NUM;
}
const sauce = new MochaSauce(config);
sauce.concurrency(5);
// setup what browsers to test with
sauce.browser({browserName: 'firefox', platform: 'Linux',
version: '43'});
sauce.browser({browserName: 'firefox', platform: 'Windows 8.1',
version: '43'});
sauce.browser({browserName: 'firefox', platform: 'OS X 10.11',
version: '43'});
sauce.browser({browserName: 'safari', platform: 'OS X 10.11',
version: '9'});
sauce.browser({browserName: 'safari', platform: 'OS X 10.10',
version: '8'});
sauce.browser({browserName: 'safari', platform: 'OS X 10.9',
version: '7'});
sauce.browser({browserName: 'chrome', platform: 'OS X 10.11',
version: '47'});
sauce.browser({browserName: 'chrome', platform: 'Linux',
version: '47'});
sauce.browser({browserName: 'chrome', platform: 'Windows 8.1',
version: '47'});
sauce.browser({browserName: 'internet explorer', platform: 'Windows 10',
version: '11'});
sauce.browser({browserName: 'MicrosoftEdge', platform: 'Windows 10',
version: '20'});
sauce.on('init', function(browser) {
console.log(' init : %s %s', browser.browserName, browser.platform);
});
sauce.on('start', function(browser) {
console.log(' start : %s %s', browser.browserName, browser.platform);
});
sauce.on('end', function(browser, res) {
console.log(' end : %s %s : %d failures', browser.browserName,
browser.platform, res && res.failures);
});
sauce.on('connected', sauceConnectProcess => {
sauceConnectProcess.on('exit', function(code, /* signal */) {
if (code > 0) {
console.log('something wrong - exiting');
process.exit();
} else {
console.log('normal tunnel exit');
}
});
});
sauce.start(function(err, res) {
let failure = false;
if (err) {
console.log('Error starting Sauce');
console.error(err);
process.exitCode = 2;
} else {
console.log('-------------- done --------------');
failure = _.some(res, 'failures');
console.log('Tests are failed:', failure);
if (failure) {
process.exitCode = 1;
}
}
});
}
main();

View File

@@ -0,0 +1,17 @@
import {RippleAPI} from '../../dist/npm'
const api = new RippleAPI({
server: 'wss://s.altnet.rippletest.net:51233'
})
getTransaction()
async function getTransaction() {
await api.connect()
const ledger = await api.getLedger({includeTransactions: true})
console.log(ledger)
const tx = await api.getTransaction(ledger.transactionHashes[0])
console.log(tx)
console.log('deliveredAmount:', tx.outcome.deliveredAmount)
process.exit(0)
}

View File

@@ -0,0 +1,13 @@
import {RippleAPI} from '../../dist/npm'
const api = new RippleAPI({server: 'wss://s.altnet.rippletest.net:51233'})
parseAccountFlags()
async function parseAccountFlags() {
await api.connect()
const account_info = await api.request('account_info', {account: 'rKsdkGhyZH6b2Zzd5hNnEqSv2wpznn4n6N'})
const flags = api.parseAccountFlags(account_info.account_data.Flags)
console.log(JSON.stringify(flags, null, 2))
process.exit(0)
}

13
snippets/tsconfig.json Normal file
View File

@@ -0,0 +1,13 @@
{
"extends": "../tsconfig-base",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src"
},
"references": [
{ "path": "../src" }
],
"include": [
"./src/**/*.ts"
]
}

View File

@@ -1,12 +1,19 @@
import * as _ from 'lodash'
import {EventEmitter} from 'events'
import {Connection, errors, validate} from './common'
import {
Connection,
errors,
validate,
xrpToDrops,
dropsToXrp,
rippleTimeToISO8601,
iso8601ToRippleTime,
txFlags,
ensureClassicAddress
} from './common'
import {
connect,
disconnect,
isConnected,
getServerInfo,
getFee,
getLedgerVersion,
formatLedgerClose
} from './server/server'
@@ -17,8 +24,8 @@ import getBalances from './ledger/balances'
import getBalanceSheet from './ledger/balance-sheet'
import getPaths from './ledger/pathfind'
import getOrders from './ledger/orders'
import getOrderbook from './ledger/orderbook'
import getSettings from './ledger/settings'
import {getOrderbook, formatBidsAndAsks} from './ledger/orderbook'
import {getSettings, parseAccountFlags} from './ledger/settings'
import getAccountInfo from './ledger/accountinfo'
import getAccountObjects from './ledger/accountobjects'
import getPaymentChannel from './ledger/payment-channel'
@@ -39,34 +46,68 @@ import prepareSettings from './transaction/settings'
import sign from './transaction/sign'
import combine from './transaction/combine'
import submit from './transaction/submit'
import {generateAddressAPI} from './offline/generate-address'
import {
generateAddressAPI,
GenerateAddressOptions,
GeneratedAddress
} from './offline/generate-address'
import {deriveKeypair, deriveAddress, deriveXAddress} from './offline/derive'
import computeLedgerHash from './offline/ledgerhash'
import signPaymentChannelClaim from './offline/sign-payment-channel-claim'
import verifyPaymentChannelClaim from './offline/verify-payment-channel-claim'
import getLedger from './ledger/ledger'
import {
AccountObjectsRequest, AccountObjectsResponse,
AccountOffersRequest, AccountOffersResponse,
AccountInfoRequest, AccountInfoResponse,
AccountLinesRequest, AccountLinesResponse,
BookOffersRequest, BookOffersResponse,
GatewayBalancesRequest, GatewayBalancesResponse,
LedgerRequest, LedgerResponse,
LedgerEntryRequest, LedgerEntryResponse
AccountObjectsRequest,
AccountObjectsResponse,
AccountOffersRequest,
AccountOffersResponse,
AccountInfoRequest,
AccountInfoResponse,
AccountLinesRequest,
AccountLinesResponse,
BookOffersRequest,
BookOffersResponse,
GatewayBalancesRequest,
GatewayBalancesResponse,
LedgerRequest,
LedgerResponse,
LedgerDataRequest,
LedgerDataResponse,
LedgerEntryRequest,
LedgerEntryResponse,
ServerInfoRequest,
ServerInfoResponse
} from './common/types/commands'
import RangeSet from './common/rangeset'
import * as ledgerUtils from './ledger/utils'
import * as transactionUtils from './transaction/utils'
import * as schemaValidator from './common/schema-validator'
import {clamp} from './ledger/utils'
import {getServerInfo, getFee} from './common/serverinfo'
import {clamp, renameCounterpartyToIssuer} from './ledger/utils'
import {TransactionJSON, Instructions, Prepare} from './transaction/types'
import {ConnectionUserOptions} from './common/connection'
import {isValidXAddress, isValidClassicAddress} from 'ripple-address-codec'
import {
computeBinaryTransactionHash,
computeTransactionHash,
computeBinaryTransactionSigningHash,
computeAccountLedgerObjectID,
computeSignerListLedgerObjectID,
computeOrderID,
computeTrustlineHash,
computeTransactionTreeHash,
computeStateTreeHash,
computeEscrowHash,
computePaymentChannelHash
} from './common/hashes'
export type APIOptions = {
server?: string,
feeCushion?: number,
trace?: boolean,
proxy?: string,
export interface APIOptions extends ConnectionUserOptions {
server?: string
feeCushion?: number
maxFeeXRP?: string
proxy?: string
timeout?: number
}
@@ -75,7 +116,7 @@ export type APIOptions = {
* command. This varies from command to command, but we need to know it to
* properly count across many requests.
*/
function getCollectKeyFromCommand(command: string): string|undefined {
function getCollectKeyFromCommand(command: string): string | undefined {
switch (command) {
case 'account_offers':
case 'book_offers':
@@ -87,41 +128,33 @@ function getCollectKeyFromCommand(command: string): string|undefined {
}
}
// prevent access to non-validated ledger versions
export class RestrictedConnection extends Connection {
request(request: any, timeout?: number) {
const ledger_index = request.ledger_index
if (ledger_index !== undefined && ledger_index !== 'validated') {
if (!_.isNumber(ledger_index) || ledger_index > this._ledgerVersion) {
return Promise.reject(new errors.LedgerVersionError(
`ledgerVersion ${ledger_index} is greater than server\'s ` +
`most recent validated ledger: ${this._ledgerVersion}`))
}
}
return super.request(request, timeout)
}
}
class RippleAPI extends EventEmitter {
_feeCushion: number
connection: RestrictedConnection
_maxFeeXRP: string
// New in > 0.21.0
// non-validated ledger versions are allowed, and passed to rippled as-is.
connection: Connection
// these are exposed only for use by unit tests; they are not part of the API.
static _PRIVATE = {
validate: validate,
validate,
RangeSet,
ledgerUtils,
schemaValidator
}
static renameCounterpartyToIssuer = renameCounterpartyToIssuer
static formatBidsAndAsks = formatBidsAndAsks
constructor(options: APIOptions = {}) {
super()
validate.apiOptions(options)
this._feeCushion = options.feeCushion || 1.2
this._maxFeeXRP = options.maxFeeXRP || '2'
const serverURL = options.server
if (serverURL !== undefined) {
this.connection = new RestrictedConnection(serverURL, options)
this.connection = new Connection(serverURL, options)
this.connection.on('ledgerClosed', message => {
this.emit('ledger', formatLedgerClose(message))
})
@@ -132,53 +165,126 @@ class RippleAPI extends EventEmitter {
this.emit('connected')
})
this.connection.on('disconnected', code => {
this.emit('disconnected', code)
let finalCode = code
// 1005: This is a backwards-compatible fix for this change in the ws library: https://github.com/websockets/ws/issues/1257
// 4000: Connection uses a 4000 code internally to indicate a manual disconnect/close
// TODO: Remove in next major, breaking version
if (finalCode === 1005 || finalCode === 4000) {
finalCode = 1000
}
this.emit('disconnected', finalCode)
})
} else {
// use null object pattern to provide better error message if user
// tries to call a method that requires a connection
this.connection = new RestrictedConnection(null, options)
this.connection = new Connection(null, options)
}
}
async _request(command: 'account_info', params: AccountInfoRequest):
Promise<AccountInfoResponse>
async _request(command: 'account_lines', params: AccountLinesRequest):
Promise<AccountLinesResponse>
/**
* Returns objects owned by an account.
* For an account's trust lines and balances,
* see `getTrustlines` and `getBalances`.
*/
async _request(command: 'account_objects', params: AccountObjectsRequest):
Promise<AccountObjectsResponse>
async _request(command: 'account_offers', params: AccountOffersRequest):
Promise<AccountOffersResponse>
async _request(command: 'book_offers', params: BookOffersRequest):
Promise<BookOffersResponse>
async _request(command: 'gateway_balances', params: GatewayBalancesRequest):
Promise<GatewayBalancesResponse>
async _request(command: 'ledger', params: LedgerRequest):
Promise<LedgerResponse>
async _request(command: 'ledger_entry', params: LedgerEntryRequest):
Promise<LedgerEntryResponse>
/**
* Makes a request to the API with the given command and
* additional request body parameters.
*
* NOTE: This command is under development.
*/
async _request(command: string, params: object = {}) {
async request(
command: 'account_info',
params: AccountInfoRequest
): Promise<AccountInfoResponse>
async request(
command: 'account_lines',
params: AccountLinesRequest
): Promise<AccountLinesResponse>
async request(
command: 'account_objects',
params: AccountObjectsRequest
): Promise<AccountObjectsResponse>
async request(
command: 'account_offers',
params: AccountOffersRequest
): Promise<AccountOffersResponse>
async request(
command: 'book_offers',
params: BookOffersRequest
): Promise<BookOffersResponse>
async request(
command: 'gateway_balances',
params: GatewayBalancesRequest
): Promise<GatewayBalancesResponse>
async request(
command: 'ledger',
params: LedgerRequest
): Promise<LedgerResponse>
async request(
command: 'ledger_data',
params?: LedgerDataRequest
): Promise<LedgerDataResponse>
async request(
command: 'ledger_entry',
params: LedgerEntryRequest
): Promise<LedgerEntryResponse>
async request(
command: 'server_info',
params?: ServerInfoRequest
): Promise<ServerInfoResponse>
async request(command: string, params: any): Promise<any>
async request(command: string, params: any = {}): Promise<any> {
return this.connection.request({
...params,
command
command,
account: params.account ? ensureClassicAddress(params.account) : undefined
})
}
/**
* Returns true if there are more pages of data.
*
* When there are more results than contained in the response, the response
* includes a `marker` field.
*
* See https://ripple.com/build/rippled-apis/#markers-and-pagination
*/
hasNextPage<T extends {marker?: string}>(currentResponse: T): boolean {
return !!currentResponse.marker
}
async requestNextPage<T extends {marker?: string}>(
command: string,
params: object = {},
currentResponse: T
): Promise<T> {
if (!currentResponse.marker) {
return Promise.reject(
new errors.NotFoundError('response does not have a next page')
)
}
const nextPageParams = Object.assign({}, params, {
marker: currentResponse.marker
})
return this.request(command, nextPageParams)
}
/**
* Prepare a transaction.
*
* You can later submit the transaction with a `submit` request.
*/
async prepareTransaction(
txJSON: TransactionJSON,
instructions: Instructions = {}
): Promise<Prepare> {
return transactionUtils.prepareTransaction(txJSON, this, instructions)
}
/**
* Convert a string to hex.
*
* This can be used to generate `MemoData`, `MemoType`, and `MemoFormat`.
*
* @param string string to convert to hex
*/
convertStringToHex(string: string): string {
return transactionUtils.convertStringToHex(string)
}
/**
* Makes multiple paged requests to the API to return a given number of
* resources. _requestAll() will make multiple requests until the `limit`
@@ -188,19 +294,27 @@ class RippleAPI extends EventEmitter {
* If the command is unknown, an additional `collect` property is required to
* know which response key contains the array of resources.
*
* NOTE: This command is under development and should not yet be relied
* on by external consumers.
* NOTE: This command is used by existing methods and is not recommended for
* general use. Instead, use rippled's built-in pagination and make multiple
* requests as needed.
*/
async _requestAll(command: 'account_offers', params: AccountOffersRequest):
Promise<AccountOffersResponse[]>
async _requestAll(command: 'book_offers', params: BookOffersRequest):
Promise<BookOffersResponse[]>
async _requestAll(command: 'account_lines', params: AccountLinesRequest):
Promise<AccountLinesResponse[]>
async _requestAll(
command: 'account_offers',
params: AccountOffersRequest
): Promise<AccountOffersResponse[]>
async _requestAll(
command: 'book_offers',
params: BookOffersRequest
): Promise<BookOffersResponse[]>
async _requestAll(
command: 'account_lines',
params: AccountLinesRequest
): Promise<AccountLinesResponse[]>
async _requestAll(
command: string,
params: any = {},
options: {collect?: string} = {}): Promise<any[]> {
options: {collect?: string} = {}
): Promise<any[]> {
// The data under collection is keyed based on the command. Fail if command
// not recognized and collection key not provided.
const collectKey = options.collect || getCollectKeyFromCommand(command)
@@ -209,8 +323,7 @@ class RippleAPI extends EventEmitter {
}
// If limit is not provided, fetches all data over multiple requests.
// NOTE: This may return much more than needed. Set limit when possible.
const countTo: number =
(params.limit !== undefined) ? params.limit : Infinity
const countTo: number = params.limit !== undefined ? params.limit : Infinity
let count: number = 0
let marker: string = params.marker
let lastBatchLength: number
@@ -222,12 +335,9 @@ class RippleAPI extends EventEmitter {
limit: countRemaining,
marker
}
// NOTE: We have to generalize the `this._request()` function signature
// here until we add support for unknown commands (since command is some
// unknown string).
const singleResult = await (<Function>this._request)(command, repeatProps)
const singleResult = await this.request(command, repeatProps)
const collectedData = singleResult[collectKey]
marker = singleResult.marker
marker = singleResult['marker']
results.push(singleResult)
// Make sure we handle when no data (not even an empty array) is returned.
const isExpectedFormat = Array.isArray(collectedData)
@@ -237,10 +347,19 @@ class RippleAPI extends EventEmitter {
} else {
lastBatchLength = 0
}
} while(!!marker && count < countTo && lastBatchLength !== 0)
} while (!!marker && count < countTo && lastBatchLength !== 0)
return results
}
// @deprecated Use X-addresses instead
generateAddress(options: GenerateAddressOptions = {}): GeneratedAddress {
return generateAddressAPI({...options, includeClassicAddress: true})
}
generateXAddress(options: GenerateAddressOptions = {}): GeneratedAddress {
return generateAddressAPI(options)
}
connect = connect
disconnect = disconnect
isConnected = isConnected
@@ -254,13 +373,14 @@ class RippleAPI extends EventEmitter {
getBalances = getBalances
getBalanceSheet = getBalanceSheet
getPaths = getPaths
getOrders = getOrders
getOrderbook = getOrderbook
getOrders = getOrders
getSettings = getSettings
getAccountInfo = getAccountInfo
getAccountObjects = getAccountObjects
getPaymentChannel = getPaymentChannel
getLedger = getLedger
parseAccountFlags = parseAccountFlags
preparePayment = preparePayment
prepareTrustline = prepareTrustline
@@ -278,15 +398,57 @@ class RippleAPI extends EventEmitter {
prepareSettings = prepareSettings
sign = sign
combine = combine
submit = submit
generateAddress = generateAddressAPI
submit = submit // @deprecated Use api.request('submit', { tx_blob: signedTransaction }) instead
deriveKeypair = deriveKeypair
deriveAddress = deriveAddress
computeLedgerHash = computeLedgerHash
signPaymentChannelClaim = signPaymentChannelClaim
verifyPaymentChannelClaim = verifyPaymentChannelClaim
errors = errors
static deriveXAddress = deriveXAddress
// RippleAPI.deriveClassicAddress (static) is a new name for api.deriveAddress
static deriveClassicAddress = deriveAddress
static isValidXAddress = isValidXAddress
static isValidClassicAddress = isValidClassicAddress
/**
* Static methods that replace functionality from the now-deprecated ripple-hashes library
*/
// Compute the hash of a binary transaction blob.
static computeBinaryTransactionHash = computeBinaryTransactionHash // (txBlobHex: string): string
// Compute the hash of a transaction in txJSON format.
static computeTransactionHash = computeTransactionHash // (txJSON: any): string
static computeBinaryTransactionSigningHash = computeBinaryTransactionSigningHash // (txBlobHex: string): string
// Compute the hash of an account, given the account's classic address (starting with `r`).
static computeAccountLedgerObjectID = computeAccountLedgerObjectID // (address: string): string
// Compute the hash (ID) of an account's SignerList.
static computeSignerListLedgerObjectID = computeSignerListLedgerObjectID // (address: string): string
// Compute the hash of an order, given the owner's classic address (starting with `r`) and the account sequence number of the `OfferCreate` order transaction.
static computeOrderID = computeOrderID // (address: string, sequence: number): string
// Compute the hash of a trustline, given the two parties' classic addresses (starting with `r`) and the currency code.
static computeTrustlineHash = computeTrustlineHash // (address1: string, address2: string, currency: string): string
static computeTransactionTreeHash = computeTransactionTreeHash // (transactions: any[]): string
static computeStateTreeHash = computeStateTreeHash // (entries: any[]): string
// Compute the hash of a ledger.
static computeLedgerHash = computeLedgerHash // (ledgerHeader): string
// Compute the hash of an escrow, given the owner's classic address (starting with `r`) and the account sequence number of the `EscrowCreate` escrow transaction.
static computeEscrowHash = computeEscrowHash // (address, sequence): string
// Compute the hash of a payment channel, given the owner's classic address (starting with `r`), the classic address of the destination, and the account sequence number of the `PaymentChannelCreate` payment channel transaction.
static computePaymentChannelHash = computePaymentChannelHash // (address, dstAddress, sequence): string
xrpToDrops = xrpToDrops
dropsToXrp = dropsToXrp
rippleTimeToISO8601 = rippleTimeToISO8601
iso8601ToRippleTime = iso8601ToRippleTime
txFlags = txFlags
isValidAddress = schemaValidator.isValidAddress
isValidSecret = schemaValidator.isValidSecret
}
export {
RippleAPI
}
export {RippleAPI}

View File

@@ -1,24 +1,23 @@
import * as _ from 'lodash'
import {RippleAPI} from './api'
import {RippleAPI, APIOptions} from './api'
class RippleAPIBroadcast extends RippleAPI {
ledgerVersion: number | undefined = undefined
private _apis: RippleAPI[]
constructor(servers, options) {
constructor(servers, options: APIOptions = {}) {
super(options)
const apis: RippleAPI[] = servers.map(server => new RippleAPI(
_.assign({}, options, {server})
))
const apis: RippleAPI[] = servers.map(
server => new RippleAPI(_.assign({}, options, {server}))
)
// exposed for testing
this._apis = apis
this.getMethodNames().forEach(name => {
this[name] = function() { // eslint-disable-line no-loop-func
this[name] = function() {
// eslint-disable-line no-loop-func
return Promise.race(apis.map(api => api[name](...arguments)))
}
})
@@ -44,13 +43,16 @@ class RippleAPIBroadcast extends RippleAPI {
apis.forEach(api => {
api.on('ledger', this.onLedgerEvent.bind(this))
api.on('error', (errorCode, errorMessage, data) =>
this.emit('error', errorCode, errorMessage, data))
this.emit('error', errorCode, errorMessage, data)
)
})
}
onLedgerEvent(ledger) {
if (ledger.ledgerVersion > this.ledgerVersion ||
this.ledgerVersion === undefined) {
if (
ledger.ledgerVersion > this.ledgerVersion ||
this.ledgerVersion === undefined
) {
this.ledgerVersion = ledger.ledgerVersion
this.emit('ledger', ledger)
}
@@ -68,6 +70,4 @@ class RippleAPIBroadcast extends RippleAPI {
}
}
export {
RippleAPIBroadcast
}
export {RippleAPIBroadcast}

44
src/common/backoff.ts Normal file
View File

@@ -0,0 +1,44 @@
/*
* Original code based on "backo" - https://github.com/segmentio/backo
* MIT License - Copyright 2014 Segment.io
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* A Back off strategy that increases exponentially. Useful with repeated
* setTimeout calls over a network (where the destination may be down).
*/
export class ExponentialBackoff {
private readonly ms: number
private readonly max: number
private readonly factor: number = 2
private readonly jitter: number = 0
attempts: number = 0
constructor(opts: {min?: number; max?: number} = {}) {
this.ms = opts.min || 100
this.max = opts.max || 10000
}
/**
* Return the backoff duration.
*/
duration() {
var ms = this.ms * Math.pow(this.factor, this.attempts++)
if (this.jitter) {
var rand = Math.random()
var deviation = Math.floor(rand * this.jitter * ms)
ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation
}
return Math.min(ms, this.max) | 0
}
/**
* Reset the number of attempts.
*/
reset() {
this.attempts = 0
}
}

View File

@@ -1,20 +1,20 @@
function setPrototypeOf(object, prototype) {
// Object.setPrototypeOf not supported on Internet Explorer 9
Object.setPrototypeOf ? Object.setPrototypeOf(object, prototype) :
// @ts-ignore: Specifically a fallback for IE9
object.__proto__ = prototype
Object.setPrototypeOf
? Object.setPrototypeOf(object, prototype)
: // @ts-ignore: Specifically a fallback for IE9
(object.__proto__ = prototype)
}
function getConstructorName(object: Object): string {
// hack for internet explorer
if (!object.constructor.name) {
return object.constructor.toString().match(/^function\s+([^(]*)/)![1]
function getConstructorName(object: object): string {
if (object.constructor.name) {
return object.constructor.name
}
return object.constructor.name
// try to guess it on legacy browsers (ie)
const constructorString = object.constructor.toString()
const functionConstructor = constructorString.match(/^function\s+([^(]*)/)
const classConstructor = constructorString.match(/^class\s([^\s]*)/)
return functionConstructor ? functionConstructor[1] : classConstructor[1]
}
export {
getConstructorName,
setPrototypeOf
}
export {getConstructorName, setPrototypeOf}

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,49 @@
import {txFlagIndices} from './txflags'
// Ordering from https://developers.ripple.com/accountroot.html
const accountRootFlags = {
PasswordSpent: 0x00010000, // password set fee is spent
RequireDestTag: 0x00020000, // require a DestinationTag for payments
RequireAuth: 0x00040000, // require authorization to hold IOUs
DepositAuth: 0x01000000, // require account to auth deposits
DisallowXRP: 0x00080000, // disallow sending XRP
DisableMaster: 0x00100000, // force regular key
NoFreeze: 0x00200000, // permanently disallowed freezing trustlines
GlobalFreeze: 0x00400000, // trustlines globally frozen
DefaultRipple: 0x00800000
// lsfDefaultRipple:
// Enable rippling on trust lines by default.
// Required for issuing addresses; discouraged for others.
DefaultRipple: 0x00800000,
// lsfDepositAuth:
// Require account to auth deposits.
// This account can only receive funds from transactions it sends,
// or preauthorized accounts.
DepositAuth: 0x01000000,
// lsfDisableMaster:
// Force regular key.
// Disallows use of the master key.
DisableMaster: 0x00100000,
// lsfDisallowXRP:
// Disallow sending XRP.
// Not enforced by rippled; client applications should check.
DisallowXRP: 0x00080000,
// lsfGlobalFreeze:
// Trustlines globally frozen.
GlobalFreeze: 0x00400000,
// lsfNoFreeze:
// Permanently disallowed freezing trustlines.
// Once enabled, cannot be disabled.
NoFreeze: 0x00200000,
// lsfPasswordSpent:
// Password set fee is spent.
// The account has used its free SetRegularKey transaction.
PasswordSpent: 0x00010000,
// lsfRequireAuth:
// Require authorization to hold IOUs (issuances).
RequireAuth: 0x00040000,
// lsfRequireDestTag:
// Require a DestinationTag for incoming payments.
RequireDestTag: 0x00020000
}
const AccountFlags = {
@@ -25,6 +58,18 @@ const AccountFlags = {
defaultRipple: accountRootFlags.DefaultRipple
}
export interface Settings {
passwordSpent?: boolean
requireDestinationTag?: boolean
requireAuthorization?: boolean
depositAuth?: boolean
disallowIncomingXRP?: boolean
disableMasterKey?: boolean
noFreeze?: boolean
globalFreeze?: boolean
defaultRipple?: boolean
}
const AccountFlagIndices = {
requireDestinationTag: txFlagIndices.AccountSet.asfRequireDest,
requireAuthorization: txFlagIndices.AccountSet.asfRequireAuth,
@@ -38,15 +83,17 @@ const AccountFlagIndices = {
}
const AccountFields = {
EmailHash: {name: 'emailHash', encoding: 'hex',
length: 32, defaults: '0'},
EmailHash: {
name: 'emailHash',
encoding: 'hex',
length: 32,
defaults: '00000000000000000000000000000000'
},
WalletLocator: {name: 'walletLocator'},
MessageKey: {name: 'messageKey'},
Domain: {name: 'domain', encoding: 'hex'},
TransferRate: {name: 'transferRate', defaults: 0, shift: 9}
TransferRate: {name: 'transferRate', defaults: 0, shift: 9},
TickSize: {name: 'tickSize', defaults: 0}
}
export {
AccountFields,
AccountFlagIndices,
AccountFlags
}
export {AccountFields, AccountFlagIndices, AccountFlags}

View File

@@ -1,9 +1,7 @@
import {inspect} from 'util'
import * as browserHacks from './browser-hacks'
class RippleError extends Error {
name: string
message: string
data?: any
@@ -70,8 +68,11 @@ class MissingLedgerHistoryError extends RippleError {
class PendingLedgerVersionError extends RippleError {
constructor(message?: string) {
super(message || 'maxLedgerVersion is greater than server\'s most recent ' +
' validated ledger')
super(
message ||
"maxLedgerVersion is greater than server's most recent" +
' validated ledger'
)
}
}

View File

@@ -0,0 +1,65 @@
# XRP Ledger Hashes
Methods to hash XRP Ledger objects
## Computing a transaction hash (ID)
### computeBinaryTransactionHash = (txBlobHex: string): string
Compute the hash of a binary transaction blob.
### computeTransactionHash = (txJSON: any): string
Compute the hash of a transaction in txJSON format.
## [Hash Prefixes](https://xrpl.org/basic-data-types.html#hash-prefixes)
In many cases, the XRP Ledger prefixes an object's binary data with a 4-byte code before calculating its hash, so that objects of different types have different hashes even if the binary data is the same. The existing 4-byte codes are structured as 3 alphabetic characters, encoded as ASCII, followed by a zero byte.
Some types of hashes appear in API requests and responses. Others are only calculated as the first step of signing a certain type of data, or calculating a higher-level hash. Some of following methods internally use some of the 4-byte hash prefixes in order to calculate the appropriate hash.
### computeBinaryTransactionSigningHash = (txBlobHex: string): string
In order to single-sign a transaction, you must perform these steps:
1. Assuming the transaction is in JSON format (txJSON), `encode` the transaction in the XRP Ledger's binary format.
2. Hash the data with the appropriate prefix (`0x53545800` if single-signing, or `0x534D5400` if multi-signing).
3. After signing, you must re-serialize the transaction with the `TxnSignature` field included.
The `computeBinaryTransactionSigningHash` helps with step 2, automatically using the `0x53545800` prefix needed for single-signing a transaction.
For details, see [Serialization Format](https://xrpl.org/serialization.html).
_Removed:_ `computeTransactionSigningHash`, which took txJSON as a parameter. It was part of the deprecated ripple-hashes library. If you have txJSON, `encode` it with [ripple-binary-codec](https://github.com/ripple/ripple-binary-codec) first. Example: `return computeBinaryTransactionSigningHash(encode(txJSON))`
### computeAccountLedgerObjectID = (address: string): string
Compute the hash of an account, given the account's classic address (starting with `r`).
### computeSignerListLedgerObjectID = (address: string): string
Compute the hash of an account's SignerList.
### computeOrderID = (address: string, sequence: number): string
Compute the hash of an order, given the owner's classic address (starting with `r`) and the account sequence number of the `OfferCreate` order transaction.
### computeTrustlineHash = (address1: string, address2: string, currency: string): string
Compute the hash of a trustline, given the two parties' classic addresses (starting with `r`) and the currency code.
### computeTransactionTreeHash = (transactions: any[]): string
### computeStateTreeHash = (entries: any[]): string
### computeLedgerHash = (ledgerHeader): string
Compute the hash of a ledger.
### computeEscrowHash = (address, sequence): string
Compute the hash of an escrow, given the owner's classic address (starting with `r`) and the account sequence number of the `EscrowCreate` escrow transaction.
### computePaymentChannelHash = (address, dstAddress, sequence): string
Compute the hash of a payment channel, given the owner's classic address (starting with `r`), the classic address of the destination, and the account sequence number of the `PaymentChannelCreate` payment channel transaction.

View File

@@ -0,0 +1,40 @@
/**
* Prefix for hashing functions.
*
* These prefixes are inserted before the source material used to
* generate various hashes. This is done to put each hash in its own
* "space." This way, two different types of objects with the
* same binary data will produce different hashes.
*
* Each prefix is a 4-byte value with the last byte set to zero
* and the first three bytes formed from the ASCII equivalent of
* some arbitrary string. For example "TXN".
*/
enum HashPrefix {
// transaction plus signature to give transaction ID
TRANSACTION_ID = 0x54584e00, // 'TXN'
// transaction plus metadata
TRANSACTION_NODE = 0x534e4400, // 'TND'
// inner node in tree
INNER_NODE = 0x4d494e00, // 'MIN'
// leaf node in tree
LEAF_NODE = 0x4d4c4e00, // 'MLN'
// inner transaction to sign
TRANSACTION_SIGN = 0x53545800, // 'STX'
// inner transaction to sign (TESTNET)
TRANSACTION_SIGN_TESTNET = 0x73747800, // 'stx'
// inner transaction to multisign
TRANSACTION_MULTISIGN = 0x534d5400, // 'SMT'
// ledger
LEDGER = 0x4c575200 // 'LWR'
}
export default HashPrefix

222
src/common/hashes/index.ts Normal file
View File

@@ -0,0 +1,222 @@
import BigNumber from 'bignumber.js'
import {decodeAccountID} from 'ripple-address-codec'
import sha512Half from './sha512Half'
import HashPrefix from './hash-prefix'
import {SHAMap, NodeType} from './shamap'
import {encode} from 'ripple-binary-codec'
import ledgerspaces from './ledgerspaces'
const padLeftZero = (string: string, length: number): string => {
return Array(length - string.length + 1).join('0') + string
}
const intToHex = (integer: number, byteLength: number): string => {
return padLeftZero(Number(integer).toString(16), byteLength * 2)
}
const bytesToHex = (bytes: number[]): string => {
return Buffer.from(bytes).toString('hex')
}
const bigintToHex = (
integerString: string | number | BigNumber,
byteLength: number
): string => {
const hex = new BigNumber(integerString).toString(16)
return padLeftZero(hex, byteLength * 2)
}
const ledgerSpaceHex = (name: string): string => {
return intToHex(ledgerspaces[name].charCodeAt(0), 2)
}
const addressToHex = (address: string): string => {
return Buffer.from(decodeAccountID(address)).toString('hex')
}
const currencyToHex = (currency: string): string => {
if (currency.length === 3) {
const bytes = new Array(20 + 1)
.join('0')
.split('')
.map(parseFloat)
bytes[12] = currency.charCodeAt(0) & 0xff
bytes[13] = currency.charCodeAt(1) & 0xff
bytes[14] = currency.charCodeAt(2) & 0xff
return bytesToHex(bytes)
}
return currency
}
const addLengthPrefix = (hex: string): string => {
const length = hex.length / 2
if (length <= 192) {
return bytesToHex([length]) + hex
} else if (length <= 12480) {
const x = length - 193
return bytesToHex([193 + (x >>> 8), x & 0xff]) + hex
} else if (length <= 918744) {
const x = length - 12481
return bytesToHex([241 + (x >>> 16), (x >>> 8) & 0xff, x & 0xff]) + hex
}
throw new Error('Variable integer overflow.')
}
export const computeBinaryTransactionHash = (txBlobHex: string): string => {
const prefix = HashPrefix.TRANSACTION_ID.toString(16).toUpperCase()
return sha512Half(prefix + txBlobHex)
}
export const computeTransactionHash = (txJSON: any): string => {
return computeBinaryTransactionHash(encode(txJSON))
}
/**
* Hash the given binary transaction data with the single-signing prefix.
*
* See [Serialization Format](https://xrpl.org/serialization.html)
*
* @param txBlobHex The binary transaction blob as a hexadecimal string
* @returns {string} The hash to sign
*/
export const computeBinaryTransactionSigningHash = (
txBlobHex: string
): string => {
const prefix = HashPrefix.TRANSACTION_SIGN.toString(16).toUpperCase()
return sha512Half(prefix + txBlobHex)
}
/**
* Compute Account Ledger Object ID
*
* All objects in a ledger's state tree have a unique ID.
* The Account Ledger Object ID is derived by hashing the
* address with a namespace identifier. This ensures every
* ID is unique.
*
* See [Ledger Object IDs](https://xrpl.org/ledger-object-ids.html)
*
* @param address The classic account address
* @returns {string} The Ledger Object ID for the account
*/
export const computeAccountLedgerObjectID = (address: string): string => {
return sha512Half(ledgerSpaceHex('account') + addressToHex(address))
}
/**
* [SignerList ID Format](https://xrpl.org/signerlist.html#signerlist-id-format)
*
* The ID of a SignerList object is the SHA-512Half of the following values, concatenated in order:
* * The RippleState space key (0x0053)
* * The AccountID of the owner of the SignerList
* * The SignerListID (currently always 0)
*
* This method computes a SignerList Ledger Object ID.
*
* @param address The classic account address of the SignerList owner (starting with r)
* @return {string} The ID of the account's SignerList object
*/
export const computeSignerListLedgerObjectID = (address: string): string => {
return sha512Half(
ledgerSpaceHex('signerList') + addressToHex(address) + '00000000'
) // uint32(0) signer list index
}
/**
* [Offer ID Format](https://xrpl.org/offer.html#offer-id-format)
*
* The ID of a Offer object is the SHA-512Half of the following values, concatenated in order:
* * The Offer space key (0x006F)
* * The AccountID of the account placing the offer
* * The Sequence number of the OfferCreate transaction that created the offer
*
* This method computes an Offer ID (aka Order ID).
*
* @param address The classic account address of the SignerList owner (starting with r)
* @returns {string} The ID of the account's Offer object
*/
export const computeOrderID = (address: string, sequence: number): string => {
const prefix = '00' + intToHex(ledgerspaces.offer.charCodeAt(0), 1)
return sha512Half(prefix + addressToHex(address) + intToHex(sequence, 4))
}
export const computeTrustlineHash = (
address1: string,
address2: string,
currency: string
): string => {
const address1Hex = addressToHex(address1)
const address2Hex = addressToHex(address2)
const swap = new BigNumber(address1Hex, 16).isGreaterThan(
new BigNumber(address2Hex, 16)
)
const lowAddressHex = swap ? address2Hex : address1Hex
const highAddressHex = swap ? address1Hex : address2Hex
const prefix = ledgerSpaceHex('rippleState')
return sha512Half(
prefix + lowAddressHex + highAddressHex + currencyToHex(currency)
)
}
export const computeTransactionTreeHash = (transactions: any[]): string => {
const shamap = new SHAMap()
transactions.forEach(txJSON => {
const txBlobHex = encode(txJSON)
const metaHex = encode(txJSON.metaData)
const txHash = computeBinaryTransactionHash(txBlobHex)
const data = addLengthPrefix(txBlobHex) + addLengthPrefix(metaHex)
shamap.addItem(txHash, data, NodeType.TRANSACTION_METADATA)
})
return shamap.hash
}
export const computeStateTreeHash = (entries: any[]): string => {
const shamap = new SHAMap()
entries.forEach(ledgerEntry => {
const data = encode(ledgerEntry)
shamap.addItem(ledgerEntry.index, data, NodeType.ACCOUNT_STATE)
})
return shamap.hash
}
// see rippled Ledger::updateHash()
export const computeLedgerHash = (ledgerHeader): string => {
const prefix = HashPrefix.LEDGER.toString(16).toUpperCase()
return sha512Half(
prefix +
intToHex(ledgerHeader.ledger_index, 4) +
bigintToHex(ledgerHeader.total_coins, 8) +
ledgerHeader.parent_hash +
ledgerHeader.transaction_hash +
ledgerHeader.account_hash +
intToHex(ledgerHeader.parent_close_time, 4) +
intToHex(ledgerHeader.close_time, 4) +
intToHex(ledgerHeader.close_time_resolution, 1) +
intToHex(ledgerHeader.close_flags, 1)
)
}
export const computeEscrowHash = (address, sequence): string => {
return sha512Half(
ledgerSpaceHex('escrow') + addressToHex(address) + intToHex(sequence, 4)
)
}
export const computePaymentChannelHash = (
address,
dstAddress,
sequence
): string => {
return sha512Half(
ledgerSpaceHex('paychan') +
addressToHex(address) +
addressToHex(dstAddress) +
intToHex(sequence, 4)
)
}

View File

@@ -0,0 +1,29 @@
/**
* XRP Ledger namespace prefixes.
*
* The XRP Ledger is a key-value store. In order to avoid name collisions,
* names are partitioned into namespaces.
*
* Each namespace is just a single character prefix.
*
* See [LedgerNameSpace enum](https://github.com/ripple/rippled/blob/master/src/ripple/protocol/LedgerFormats.h#L100)
*/
export default {
account: 'a',
dirNode: 'd',
generatorMap: 'g',
rippleState: 'r',
offer: 'o', // Entry for an offer.
ownerDir: 'O', // Directory of things owned by an account.
bookDir: 'B', // Directory of order books.
contract: 'c',
skipList: 's',
escrow: 'u',
amendment: 'f',
feeSettings: 'e',
ticket: 'T',
signerList: 'S',
paychan: 'x',
check: 'C',
depositPreauth: 'p'
}

View File

@@ -0,0 +1,11 @@
import {createHash} from 'crypto'
const sha512Half = (hex: string): string => {
return createHash('sha512')
.update(Buffer.from(hex, 'hex'))
.digest('hex')
.toUpperCase()
.slice(0, 64)
}
export default sha512Half

181
src/common/hashes/shamap.ts Normal file
View File

@@ -0,0 +1,181 @@
import hashPrefix from './hash-prefix'
import sha512Half from './sha512Half'
const HEX_ZERO =
'0000000000000000000000000000000000000000000000000000000000000000'
export enum NodeType {
INNER = 1,
TRANSACTION_NO_METADATA = 2,
TRANSACTION_METADATA = 3,
ACCOUNT_STATE = 4
}
export abstract class Node {
/**
* Abstract constructor representing a node in a SHAMap tree.
* Can be either InnerNode or Leaf.
* @constructor
*/
public constructor() {}
public addItem(_tag: string, _node: Node): void {
throw new Error(
'Called unimplemented virtual method SHAMapTreeNode#addItem.'
)
}
public get hash(): string | void {
throw new Error('Called unimplemented virtual method SHAMapTreeNode#hash.')
}
}
export class InnerNode extends Node {
public leaves: {[slot: number]: Node}
public type: NodeType
public depth: number
public empty: boolean
/**
* Define an Inner (non-leaf) node in a SHAMap tree.
* @param {number} depth i.e. how many parent inner nodes
* @constructor
*/
public constructor(depth: number = 0) {
super()
this.leaves = {}
this.type = NodeType.INNER
this.depth = depth
this.empty = true
}
/**
* @param {string} tag equates to a ledger entry `index`
* @param {Node} node to add
* @return {void}
*/
public addItem(tag: string, node: Node): void {
const existingNode = this.getNode(parseInt(tag[this.depth], 16))
if (existingNode) {
// A node already exists in this slot
if (existingNode instanceof InnerNode) {
// There is an inner node, so we need to go deeper
existingNode.addItem(tag, node)
} else if (existingNode instanceof Leaf) {
if (existingNode.tag === tag) {
// Collision
throw new Error(
'Tried to add a node to a SHAMap that was already in there.'
)
} else {
// Turn it into an inner node
const newInnerNode = new InnerNode(this.depth + 1)
// Parent new and existing node
newInnerNode.addItem(existingNode.tag, existingNode)
newInnerNode.addItem(tag, node)
// And place the newly created inner node in the slot
this.setNode(parseInt(tag[this.depth], 16), newInnerNode)
}
}
} else {
// Neat, we have a nice open spot for the new node
this.setNode(parseInt(tag[this.depth], 16), node)
}
}
/**
* Overwrite the node that is currently in a given slot.
* @param {number} slot a number 0-15
* @param {Node} node to place
* @return {void}
*/
public setNode(slot: number, node: Node): void {
if (slot < 0 || slot > 15) {
throw new Error('Invalid slot: slot must be between 0-15.')
}
this.leaves[slot] = node
this.empty = false
}
/**
* Get the node that is currently in a given slot.
* @param {number} slot a number 0-15
* @return {Node}
*/
public getNode(slot: number): Node {
if (slot < 0 || slot > 15) {
throw new Error('Invalid slot: slot must be between 0-15.')
}
return this.leaves[slot]
}
public get hash(): string {
if (this.empty) return HEX_ZERO
let hex = ''
for (let i = 0; i < 16; i++) {
hex += this.leaves[i] ? this.leaves[i].hash : HEX_ZERO
}
const prefix = hashPrefix.INNER_NODE.toString(16)
return sha512Half(prefix + hex)
}
}
export class Leaf extends Node {
public tag: string
public type: NodeType
public data: string
/**
* Leaf node in a SHAMap tree.
* @param {string} tag equates to a ledger entry `index`
* @param {string} data hex of account state, transaction etc
* @param {number} type one of TYPE_ACCOUNT_STATE, TYPE_TRANSACTION_MD etc
* @constructor
*/
public constructor(tag: string, data: string, type: NodeType) {
super()
this.tag = tag
this.type = type
this.data = data
}
public get hash(): string | void {
switch (this.type) {
case NodeType.ACCOUNT_STATE: {
const leafPrefix = hashPrefix.LEAF_NODE.toString(16)
return sha512Half(leafPrefix + this.data + this.tag)
}
case NodeType.TRANSACTION_NO_METADATA: {
const txIDPrefix = hashPrefix.TRANSACTION_ID.toString(16)
return sha512Half(txIDPrefix + this.data)
}
case NodeType.TRANSACTION_METADATA: {
const txNodePrefix = hashPrefix.TRANSACTION_NODE.toString(16)
return sha512Half(txNodePrefix + this.data + this.tag)
}
default:
throw new Error('Tried to hash a SHAMap node of unknown type.')
}
}
}
export class SHAMap {
public root: InnerNode
/**
* SHAMap tree.
* @constructor
*/
public constructor() {
this.root = new InnerNode(0)
}
public addItem(tag: string, data: string, type: NodeType): void {
this.root.addItem(tag, new Leaf(tag, data, type))
}
public get hash(): string {
return this.root.hash
}
}

View File

@@ -2,13 +2,29 @@ import * as constants from './constants'
import * as errors from './errors'
import * as validate from './validate'
import * as serverInfo from './serverinfo'
export {
constants,
errors,
validate,
serverInfo
import {xAddressToClassicAddress, isValidXAddress} from 'ripple-address-codec'
export function ensureClassicAddress(account: string): string {
if (isValidXAddress(account)) {
const {classicAddress, tag} = xAddressToClassicAddress(account)
// Except for special cases, X-addresses used for requests
// must not have an embedded tag. In other words,
// `tag` should be `false`.
if (tag !== false) {
throw new Error(
'This command does not support the use of a tag. Use an address without a tag.'
)
}
// For rippled requests that use an account, always use a classic address.
return classicAddress
} else {
return account
}
}
export {constants, errors, validate, serverInfo}
export {
dropsToXrp,
xrpToDrops,
@@ -18,6 +34,5 @@ export {
iso8601ToRippleTime,
rippleTimeToISO8601
} from './utils'
export {default as Connection} from './connection'
export {Connection} from './connection'
export {txFlags} from './txflags'

View File

@@ -18,7 +18,6 @@ function mergeIntervals(intervals: Interval[]): Interval[] {
}
class RangeSet {
ranges: Array<[number, number]>
constructor() {
@@ -30,12 +29,13 @@ class RangeSet {
}
serialize() {
return this.ranges.map(range =>
range[0].toString() + '-' + range[1].toString()).join(',')
return this.ranges
.map(range => range[0].toString() + '-' + range[1].toString())
.join(',')
}
addRange(start: number, end: number) {
assert(start <= end, 'invalid range')
assert.ok(start <= end, `invalid range ${start} <= ${end}`)
this.ranges = mergeIntervals(this.ranges.concat([[start, end]]))
}

View File

@@ -2,20 +2,20 @@ import * as _ from 'lodash'
import * as assert from 'assert'
const {Validator} = require('jsonschema')
import {ValidationError} from './errors'
import {isValidAddress} from 'ripple-address-codec'
import {isValidClassicAddress, isValidXAddress} from 'ripple-address-codec'
import {isValidSecret} from './utils'
function loadSchemas() {
// listed explicitly for webpack (instead of scanning schemas directory)
const schemas = [
require('./schemas/objects/tx-json.json'),
require('./schemas/objects/tx-type.json'),
require('./schemas/objects/transaction-type.json'),
require('./schemas/objects/hash128.json'),
require('./schemas/objects/hash256.json'),
require('./schemas/objects/sequence.json'),
require('./schemas/objects/signature.json'),
require('./schemas/objects/issue.json'),
require('./schemas/objects/ledgerversion.json'),
require('./schemas/objects/ledger-version.json'),
require('./schemas/objects/max-adjustment.json'),
require('./schemas/objects/memo.json'),
require('./schemas/objects/memos.json'),
@@ -31,21 +31,25 @@ function loadSchemas() {
require('./schemas/objects/min-adjustment.json'),
require('./schemas/objects/source-exact-adjustment.json'),
require('./schemas/objects/destination-exact-adjustment.json'),
require('./schemas/objects/tx-hash.json'),
require('./schemas/objects/destination-address-tag.json'),
require('./schemas/objects/transaction-hash.json'),
require('./schemas/objects/address.json'),
require('./schemas/objects/x-address.json'),
require('./schemas/objects/classic-address.json'),
require('./schemas/objects/adjustment.json'),
require('./schemas/objects/quality.json'),
require('./schemas/objects/amount.json'),
require('./schemas/objects/amount-base.json'),
require('./schemas/objects/amountbase.json'),
require('./schemas/objects/balance.json'),
require('./schemas/objects/blob.json'),
require('./schemas/objects/currency.json'),
require('./schemas/objects/signed-value.json'),
require('./schemas/objects/orderbook.json'),
require('./schemas/objects/instructions.json'),
require('./schemas/objects/settings.json'),
require('./schemas/objects/settings-plus-memos.json'),
require('./schemas/specifications/settings.json'),
require('./schemas/specifications/payment.json'),
require('./schemas/specifications/get-payment.json'),
require('./schemas/specifications/escrow-cancellation.json'),
require('./schemas/specifications/order-cancellation.json'),
require('./schemas/specifications/order.json'),
@@ -58,6 +62,8 @@ function loadSchemas() {
require('./schemas/specifications/check-cash.json'),
require('./schemas/specifications/check-cancel.json'),
require('./schemas/specifications/trustline.json'),
require('./schemas/specifications/deposit-preauth.json'),
require('./schemas/specifications/account-delete.json'),
require('./schemas/output/sign.json'),
require('./schemas/output/submit.json'),
require('./schemas/output/get-account-info.json'),
@@ -119,17 +125,28 @@ function loadSchemas() {
]
const titles = schemas.map(schema => schema.title)
const duplicates = _.keys(_.pickBy(_.countBy(titles), count => count > 1))
assert(duplicates.length === 0, 'Duplicate schemas for: ' + duplicates)
assert.ok(duplicates.length === 0, 'Duplicate schemas for: ' + duplicates)
const validator = new Validator()
// Register custom format validators that ignore undefined instances
// since jsonschema will still call the format validator on a missing
// (optional) property
validator.customFormats.address = function(instance) {
// This relies on "format": "xAddress" in `x-address.json`!
validator.customFormats.xAddress = function(instance) {
if (instance === undefined) {
return true
}
return isValidXAddress(instance)
}
// This relies on "format": "classicAddress" in `classic-address.json`!
validator.customFormats.classicAddress = function(instance) {
if (instance === undefined) {
return true
}
return isValidAddress(instance)
}
validator.customFormats.secret = function(instance) {
if (instance === undefined) {
return true
@@ -156,7 +173,8 @@ function schemaValidate(schemaName: string, object: any): void {
}
}
export {
schemaValidate,
isValidSecret
function isValidAddress(address: string): boolean {
return isValidXAddress(address) || isValidClassicAddress(address)
}
export {schemaValidate, isValidSecret, isValidAddress}

View File

@@ -12,11 +12,15 @@
"minimum": 1,
"description": "Factor to multiply estimated fee by to provide a cushion in case the required fee rises during submission of a transaction. Defaults to `1.2`."
},
"maxFeeXRP": {
"type": "string",
"description": "Maximum fee to use with transactions, in XRP. Must be a string-encoded number. Defaults to `'2'`."
},
"server": {
"type": "string",
"description": "URI for rippled websocket port to connect to. Must start with `wss://` or `ws://`.",
"description": "URI for rippled websocket port to connect to. Must start with `wss://`, `ws://`, `wss+unix://`, or `ws+unix://`.",
"format": "uri",
"pattern": "^wss?://"
"pattern": "^(wss?|wss?\\+unix)://"
},
"proxy": {
"format": "uri",

View File

@@ -14,12 +14,20 @@
"minimum": 0,
"maximum": 255
},
"description": "The entropy to use to generate the seed."
"description": "The entropy to use to generate the seed. Must be an array of length 16 with values from 0-255 (16 bytes of entropy)"
},
"algorithm": {
"type": "string",
"enum": ["ecdsa-secp256k1", "ed25519"],
"description": "The digital signature algorithm to generate an address for. Can be `ecdsa-secp256k1` (default) or `ed25519`."
},
"test": {
"type": "boolean",
"description": "Specifies whether the address is intended for use on a test network such as Testnet or Devnet. If `true`, the address should only be used for testing, and will start with `T`. If `false`, the address should only be used on mainnet, and will start with `X`."
},
"includeClassicAddress": {
"type": "boolean",
"description": "If `true`, return the classic address, in addition to the X-address."
}
},
"additionalProperties": false

View File

@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "generateXAddressParameters",
"type": "object",
"properties": {
"options": {
"type": "object",
"description": "Options to control how the address and secret are generated.",
"properties": {
"entropy": {
"type": "array",
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"description": "The entropy to use to generate the seed. Must be an array of length 16 with values from 0-255 (16 bytes of entropy)"
},
"algorithm": {
"type": "string",
"enum": ["ecdsa-secp256k1", "ed25519"],
"description": "The digital signature algorithm to generate an address for. Can be `ecdsa-secp256k1` (default) or `ed25519`."
},
"test": {
"type": "boolean",
"description": "Specifies whether the address is intended for use on a test network such as Testnet or Devnet. If `true`, the address should only be used for testing, and will start with `T`. If `false`, the address should only be used on mainnet, and will start with `X`."
},
"includeClassicAddress": {
"type": "boolean",
"description": "Specifies whether the classic address should also be included in the returned payload."
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}

View File

@@ -6,7 +6,7 @@
"properties": {
"address": {
"$ref": "address",
"description": "The Ripple address of the account to get the balance sheet of."
"description": "The XRP Ledger address of the account to get the balance sheet of."
},
"options": {
"properties": {

View File

@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "getFeeParameters",
"description": "Parameters for getFee",
"type": "object",
"properties": {
"cushion": {
"type": "number",
"description": "The fee is the product of the base fee, the `load_factor`, and this cushion. Default is provided by the `RippleAPI` constructor's `feeCushion`."
}
},
"additionalProperties": false
}

Some files were not shown because too many files have changed in this diff Show More