Compare commits

...

80 Commits

Author SHA1 Message Date
Nathan Nichols
418f80bf6d chore: update HISTORY.md and package version (#1527)
* chore: update HISTORY.md and package version
2021-08-17 14:32:29 -05:00
Nathan Nichols
ec121ee62d docs: Add documentation for generateFaucetWallet() (#1529)
* docs: Add documentation for generateFaucetWallet()
2021-08-17 14:32:06 -05:00
Nathan Nichols
decc395e5b docs: export and document asf Flags (#1525)
* docs: export and document asf Flags
2021-08-12 11:30:26 -07:00
Jackson Mills
8b79fe6ba1 Update sign docs with more info about keypairs (#1523)
* Add links to how to derive keypairs and examples of keypairs to the 'sign' docs
2021-08-11 13:01:53 -07:00
Nathan Nichols
5f0c38531c build: include lodash in webpack build (#1500)
* build: include lodash in webpack build
2021-08-10 07:43:52 -07:00
Florent
69113de552 Generate faucet wallet Testnet and Devnet (#1497)
* generate faucet wallet

* updated comments

* added example in documentation

* updated documentation

* Added xprl.org link in docs

* updated code snippet

* Made changes from comments

* new changes from comments

* yarn.lock

* removed axios and use https.request

* updated webpack to include http and https fallback

* fixed files formatting

* small fixes

* Fix typo for Testnet

Co-authored-by: Elliot Lee <github.public@intelliot.com>

Co-authored-by: Elliot Lee <github.public@intelliot.com>
2021-08-10 15:20:43 +08:00
Mayukha Vadari
b81c1dab35 fix: ledger version in getTrustlines (#1505)
* fix: correctly propagate options.ledgerVersion 

* test: verify that `account_lines` uses correct `ledger_index`
2021-08-06 12:18:53 -05:00
dependabot[bot]
20ed4640a7 build(deps-dev): bump @types/mocha from 8.2.3 to 9.0.0 (#1491)
Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.2.3 to 9.0.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)

---
updated-dependencies:
- dependency-name: "@types/mocha"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-04 13:07:27 -07:00
Jackson Mills
42464b84de refactor combine logic for clarity (#1486)
refactor combine logic for clarity by using functional styles and breaking down the logic into digestible pieces
2021-08-04 12:52:55 -07:00
Nathan Nichols
76780c8a8e Run Integration Tests in Browser (#1468)
* ci: Adds github actions testing for webpacked integration test
2021-08-02 16:29:35 -05:00
Elliot Lee
25a2bcd3be release: 1.9.8 (#1489) 2021-07-30 12:04:02 -07:00
Nathan Nichols
d9a42c8669 Allow XAddress Issuers (#1471)
* feat: Allow clients to use XAddresses for issuers
2021-07-30 13:16:01 -05:00
Mayukha Vadari
6e0fff2ad6 Reduce dependencies on lodash (#1467)
* assign -> Object.assign

* replace isundefined

* remove forEach

* remove some

* remove reduce

* remove keys

* remove map

* remove includes

* remove filter

* remove last

* remove isstring

* remove every

* remove rearg

* remove indexOf

* remove values

* remove startswith

* remove first and pick

* build smaller lodash

* remove lodash.isequal package

* add lodash-cli dev dependency

* add lodash script

* test fix

* Revert "build smaller lodash" This reverts commit 979446e57f60b29cb5d377b54efe91cfbeae0707.

* upgrade npm

* change ===/!== undefined to ==/!= null
2021-07-29 20:18:08 -04:00
Rome Reginelli
4e49b6a99c docs: edit style and update old URLs (#1420)
Use example.com instead of ripple.com

Co-authored-by: Elliot Lee <github.public@intelliot.com>
2021-07-27 16:15:56 -07:00
Nathan Nichols
10efd5eedb chore: update ripple-binary-codec to 1.1.3 (#1482) 2021-07-27 16:54:41 -05:00
Omar Khan
de293de1e6 export offline methods to top-level of package (#1479)
* export offline methods to top-level of package
- All methods that don’t require a network connection are exported at the top-level of the package.
- These instance methods are now marked as deprecated.
- Removed an empty ts file
2021-07-27 17:41:50 -04:00
dependabot[bot]
5df32e2e6e build(deps-dev): bump ts-node from 9.1.1 to 10.1.0 (#1470)
Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 9.1.1 to 10.1.0.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](https://github.com/TypeStrong/ts-node/compare/v9.1.1...v10.1.0)

---
updated-dependencies:
- dependency-name: ts-node
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-27 15:14:59 -04:00
dependabot[bot]
31e012bde5 build(deps-dev): bump @types/node from 15.12.5 to 16.4.3 (#1480)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 15.12.5 to 16.4.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-27 15:14:43 -04:00
nutbreaker
1e66f40348 Fix ripple/ripple-lib#1472: test:watch missing configuration (#1473)
Co-authored-by: Nathan Nichols <natenichols@cox.net>
2021-07-27 15:09:56 -04:00
Nathan Nichols
9adfd404e5 GitHub Actions Integration Tests (#1466)
* ci: Add Github Actions integration testing against standalone rippled
2021-07-27 12:47:55 -05:00
Aaron Huang
d941653477 fix: multisig example in documentation (#1463)
Co-authored-by: Elliot Lee <github.public@intelliot.com>
2021-07-27 10:33:27 -07:00
Mayukha Vadari
cdf9e33ad2 Fixes miscommunication with ripplingDisabled in trustlines (#1481) 2021-07-27 13:23:13 -04:00
Elliot Lee
b7de3b0ea9 feat: minor improvement to docs (#1251) 2021-07-26 16:12:15 -07:00
Elliot Lee
aa081a4348 refactor!: remove deprecated ledger fields (#1160)
Per https://github.com/ripple/rippled/issues/3214

The following fields are deprecated and may be removed without further notice: accepted, hash (use ledger_hash instead), seqNum (use ledger_index instead), totalCoins (use total_coins instead).
2021-07-26 16:10:55 -07:00
Nathan Nichols
e3752c9057 Adds Github Actions Testing (#1464)
* ci: Adds github actions testing
2021-07-26 16:49:39 -05:00
Elliot Lee
be1267fb14 fix: lint errors (#1478) 2021-07-26 16:22:05 -05:00
Elliot Lee
dd30e33e8e fix: add void return type to Promises (#1477)
Follow-up to #1476
2021-07-26 14:04:46 -05:00
Elliot Lee
a973266434 fix #1474: add type argument to Promise (#1476) 2021-07-26 11:30:03 -07:00
Jackson Mills
0ac1061d26 Added test for lowercase memo hex (#1475)
Added test for lowercase hex in transaction memo
* Relaxed existing test to accept case change in memo after decoding
* Added check of resulting signature
2021-07-26 10:41:21 -07:00
dependabot[bot]
6938773a22 build(deps): bump ws from 7.5.2 to 7.5.3 (#1461)
Bumps [ws](https://github.com/websockets/ws) from 7.5.2 to 7.5.3.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.5.2...7.5.3)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-22 15:52:25 -04:00
dependabot[bot]
81668a8282 build(deps-dev): bump typescript from 3.9.9 to 4.3.5 (#1437)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.9.9 to 4.3.5.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v3.9.9...v4.3.5)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-22 15:51:34 -04:00
Mayukha Vadari
22a77653af Add PR template (#1469) 2021-07-22 15:45:13 -04:00
Elliot Lee
6e1e2081c9 release: 1.9.7 2021-07-14 17:15:47 -07:00
dependabot[bot]
97cc99a1c0 build(deps): bump ws from 7.4.6 to 7.5.2 (#1450)
Bumps [ws](https://github.com/websockets/ws) from 7.4.6 to 7.5.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.6...7.5.2)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-14 17:07:48 -07:00
dependabot[bot]
fee832be3a build(deps): bump @types/ws from 7.4.4 to 7.4.6 (#1452)
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 7.4.4 to 7.4.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

---
updated-dependencies:
- dependency-name: "@types/ws"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-14 17:07:20 -07:00
dependabot[bot]
e35aca7a40 build(deps-dev): bump mocha from 8.4.0 to 9.0.2 (#1456)
Bumps [mocha](https://github.com/mochajs/mocha) from 8.4.0 to 9.0.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/v8.4.0...v9.0.2)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-14 17:06:05 -07:00
Rome Reginelli
53f35b5a99 Update boilerplate (#1459)
- Suggest XRPLF's public cluster; this is a better starter experience since
  it's full-history and blocks known scam accounts
- Update the Node.js compatibility language to match the README.
- Remove dated language about ES5/ES6 Promises.
- Re-gen docs (this seems to have added a memo field that was previously
  modified in some other PR)
2021-07-14 17:05:54 -07:00
Matthew Rosendin
44d91d8d96 fix: TrustlineTransaction type (#1458) (#1460) 2021-07-14 08:59:09 -07:00
dependabot[bot]
14d47f62e8 build(deps-dev): bump doctoc from 2.0.0 to 2.0.1 (#1440)
Bumps [doctoc](https://github.com/thlorenz/doctoc) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/thlorenz/doctoc/releases)
- [Commits](https://github.com/thlorenz/doctoc/compare/v2.0.0...v2.0.1)

---
updated-dependencies:
- dependency-name: doctoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-07 20:34:16 -07:00
dependabot[bot]
be04427145 build(deps-dev): bump @types/mocha from 8.2.2 to 8.2.3 (#1455)
Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.2.2 to 8.2.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)

---
updated-dependencies:
- dependency-name: "@types/mocha"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-07 20:34:03 -07:00
dependabot[bot]
d0229d2c9d build(deps): bump @types/lodash from 4.14.170 to 4.14.171 (#1454)
Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.170 to 4.14.171.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

---
updated-dependencies:
- dependency-name: "@types/lodash"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-07 20:33:38 -07:00
dependabot[bot]
250d0763d7 build(deps-dev): bump webpack-cli from 4.7.0 to 4.7.2 (#1453)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.7.0 to 4.7.2.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.7.0...webpack-cli@4.7.2)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-07 20:33:26 -07:00
dependabot[bot]
3db42279e1 build(deps): bump ws from 7.4.6 to 7.5.1 (#1442)
Bumps [ws](https://github.com/websockets/ws) from 7.4.6 to 7.5.1.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.6...7.5.1)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-07 20:29:33 -07:00
dependabot[bot]
ba7c589545 build(deps): bump @types/ws from 7.4.4 to 7.4.5 (#1443)
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 7.4.4 to 7.4.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

---
updated-dependencies:
- dependency-name: "@types/ws"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-07 20:29:23 -07:00
dependabot[bot]
eaf8593960 build(deps): bump ripple-binary-codec from 1.1.2 to 1.1.3 (#1444)
Bumps [ripple-binary-codec](https://github.com/ripple/ripple-binary-codec) from 1.1.2 to 1.1.3.
- [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/1.1.2...1.1.3)

---
updated-dependencies:
- dependency-name: ripple-binary-codec
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-07 20:29:14 -07:00
dependabot[bot]
ee30927304 build(deps-dev): bump prettier from 2.3.0 to 2.3.2 (#1445)
Bumps [prettier](https://github.com/prettier/prettier) from 2.3.0 to 2.3.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.3.0...2.3.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-07 20:29:02 -07:00
dependabot[bot]
b58ef11e57 build(deps-dev): bump webpack from 5.38.1 to 5.41.1 (#1446)
Bumps [webpack](https://github.com/webpack/webpack) from 5.38.1 to 5.41.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.38.1...v5.41.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-07 20:28:51 -07:00
dependabot[bot]
c726a5eab8 build(deps-dev): bump @types/node from 15.6.1 to 15.12.5 (#1447)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 15.6.1 to 15.12.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-07 20:28:40 -07:00
Elliot Lee
1e86ba0aa0 release: 1.9.6 (#1436) 2021-06-30 23:34:18 -07:00
Elliot Lee
cabd4cc88d fix: allow multiple settings at once (#1435) 2021-06-30 23:27:04 -07:00
Elliot Lee
28d2fc2a3a fix #999: use 'current' ledger when preparing txs (#1429) 2021-06-07 15:34:02 -07:00
dependabot[bot]
42db44fb59 build(deps-dev): bump mocha from 7.2.0 to 8.4.0 (#1414)
Bumps [mocha](https://github.com/mochajs/mocha) from 7.2.0 to 8.4.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.2.0...v8.4.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-07 12:54:00 -07:00
dependabot[bot]
ad0165cf22 build(deps-dev): bump prettier from 2.2.1 to 2.3.0 (#1430)
Bumps [prettier](https://github.com/prettier/prettier) from 2.2.1 to 2.3.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.2.1...2.3.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-07 12:42:15 -07:00
dependabot[bot]
708d8c0bb5 build(deps): bump ripple-address-codec from 4.1.2 to 4.1.3 (#1432)
Bumps [ripple-address-codec](https://github.com/ripple/ripple-address-codec) from 4.1.2 to 4.1.3.
- [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.1.2...4.1.3)

---
updated-dependencies:
- dependency-name: ripple-address-codec
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-07 12:42:02 -07:00
Elliot Lee
5074441b3b release: 1.9.5 2021-06-01 16:25:38 -07:00
Antonio Campos
a1edc0b2d5 fix #1113: return promise inside catch block of reconnect to propagate promise (#1418) 2021-06-01 15:58:52 -07:00
dependabot[bot]
3afdc1fca0 build(deps): bump @types/lodash from 4.14.168 to 4.14.170 (#1427)
Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.168 to 4.14.170.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 15:58:25 -07:00
dependabot[bot]
6b7cdfc413 build(deps-dev): bump @types/node from 15.0.1 to 15.6.1 (#1426)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 15.0.1 to 15.6.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 15:58:12 -07:00
dependabot[bot]
95e1314eb9 build(deps-dev): bump webpack from 5.36.2 to 5.38.1 (#1425)
Bumps [webpack](https://github.com/webpack/webpack) from 5.36.2 to 5.38.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.36.2...v5.38.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 15:58:01 -07:00
dependabot[bot]
ad0cc209af build(deps-dev): bump webpack-cli from 4.6.0 to 4.7.0 (#1424)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.6.0 to 4.7.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.6.0...webpack-cli@4.7.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 15:57:46 -07:00
dependabot[bot]
dd11ce480d build(deps-dev): bump webpack-bundle-analyzer from 4.4.1 to 4.4.2 (#1423)
Bumps [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) from 4.4.1 to 4.4.2.
- [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/v4.4.1...v4.4.2)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 15:57:33 -07:00
dependabot[bot]
10ace18d27 build(deps): bump @types/ws from 7.4.2 to 7.4.4 (#1422)
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 7.4.2 to 7.4.4.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 15:57:20 -07:00
dependabot[bot]
e8ca25f792 build(deps): bump ws from 7.4.5 to 7.4.6 (#1421)
Bumps [ws](https://github.com/websockets/ws) from 7.4.5 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.5...7.4.6)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 15:57:04 -07:00
dependabot[bot]
95d626f69e build(deps): bump browserslist from 4.16.3 to 4.16.6 (#1419)
Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.16.3 to 4.16.6.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.16.3...4.16.6)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-01 15:56:44 -07:00
Antonio Campos
3fdc56ab90 fix #1210: update mocha to use RC file config (#1417) 2021-06-01 15:56:07 -07:00
dependabot-preview[bot]
bb44598e32 build(deps-dev): bump assert-diff from 3.0.1 to 3.0.2 (#1371)
Bumps [assert-diff](https://github.com/pihvi/assert-diff) from 3.0.1 to 3.0.2.
- [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>
2021-06-01 08:23:39 -07:00
Lathan
3c86b04fee docs: add ODL monitors (#1408)
* new additions ODL monitors

utility scan and xrpl-rosetta https://github.com/mouradski/xrapid_alert and https://github.com/lathanbritz/xrpl-rosetta

* Update APPLICATIONS.md

Co-authored-by: Elliot Lee <github.public@intelliot.com>
2021-05-11 18:06:13 -07:00
dependabot[bot]
7ee87f2625 build(deps): bump ws from 7.4.4 to 7.4.5 (#1409)
Bumps [ws](https://github.com/websockets/ws) from 7.4.4 to 7.4.5.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.4...7.4.5)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-11 18:05:44 -07:00
dependabot[bot]
2f03347dda build(deps-dev): bump webpack-bundle-analyzer from 4.4.0 to 4.4.1 (#1410)
Bumps [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) from 4.4.0 to 4.4.1.
- [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/v4.4.0...v4.4.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-11 18:05:33 -07:00
dependabot[bot]
bbb19dce9f build(deps): bump @types/ws from 7.4.0 to 7.4.2 (#1411)
Bumps [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) from 7.4.0 to 7.4.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-11 18:05:24 -07:00
Elliot Lee
c8b0035897 fix: prevent getFee from returning NaN from Reporting Mode (#1401)
When using a rippled server in Reporting Mode, the server_info response does not have a load_factor property.

https://xrpl.org/rippled-server-modes.html#reporting-mode

https://github.com/ripple/rippled/issues/3812

Now, when load_factor is missing, we default to a load_factor of 1.

Fix #1398
2021-05-10 13:56:31 -07:00
dependabot[bot]
67d1b5278d build(deps-dev): bump webpack from 5.25.1 to 5.36.2 (#1412)
Bumps [webpack](https://github.com/webpack/webpack) from 5.25.1 to 5.36.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.25.1...v5.36.2)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-10 13:54:23 -07:00
dependabot[bot]
43e444b47d build(deps-dev): bump @types/node from 14.14.34 to 15.0.1 (#1413)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.14.34 to 15.0.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-10 13:54:12 -07:00
Elliot Lee
f3fd468566 release: 1.9.4 2021-04-18 17:09:21 -07:00
dependabot[bot]
97d4f1f2ce build(deps-dev): bump webpack-cli from 4.5.0 to 4.6.0 (#1391)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.5.0 to 4.6.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.5.0...webpack-cli@4.6.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-18 17:04:53 -07:00
dependabot[bot]
fbecaf2ddc build(deps-dev): bump @types/mocha from 8.2.1 to 8.2.2 (#1396)
Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.2.1 to 8.2.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-16 09:40:00 -07:00
elmurci
978a5bcd99 docs(#1387): add Deno and React instructions 2021-04-09 07:29:59 +02:00
elmurci
650d722609 Fix #1353: add memos support for multiple transaction types in getTransactions (#1397)
* fix(#1353): adds memos support for the following transaction types in `getTransactions`:

- AccountDelete
- OfferCreate
- OfferCancel
- CheckCancel
- CheckCash
- CheckCreate
- DepositPreauth
- SetFee
- PaymentChannelFund
- PaymentChannelClaim
- PaymentChannelCreate
- TicketCreate
2021-04-08 11:46:54 +02:00
Elliot Lee
ef1f8752d9 docs: update HISTORY regarding rippled v1.7 issue 2021-03-23 16:22:57 -07:00
Elliot Lee
6fd0b3a5f1 release: add checksums for 1.9.3 2021-03-16 22:22:11 -07:00
247 changed files with 5557 additions and 1687 deletions

View File

@@ -8,6 +8,9 @@
"extends": [
"eslint:recommended"
],
"globals": {
"NodeJS": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,

50
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,50 @@
## High Level Overview of Change
<!--
Please include a summary/list of the changes.
If too broad, please consider splitting into multiple PRs.
If a relevant Asana task, please link it here.
-->
### Context of Change
<!--
Please include the context of a change.
If a bug fix, when was the bug introduced? What was the behavior?
If a new feature, why was this architecture chosen? What were the alternatives?
If a refactor, how is this better than the previous implementation?
If there is a design document for this feature, please link it here.
-->
### Type of Change
<!--
Please check relevant options, delete irrelevant ones.
-->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Refactor (non-breaking change that only restructures code)
- [ ] Tests (You added tests for code that already exists, or your new feature included in this PR)
- [ ] Documentation Updates
- [ ] Release
## Before / After
<!--
If just refactoring / back-end changes, this can be just an in-English description of the change at a technical level.
If a UI change, screenshots should be included.
-->
## Test Plan
<!--
Please describe the tests that you ran to verify your changes and provide instructions so that others can reproduce.
-->
<!--
## Future Tasks
For future tasks related to PR.
-->

81
.github/workflows/nodejs.yml vendored Normal file
View File

@@ -0,0 +1,81 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ develop, master ]
pull_request:
branches: [ develop ]
jobs:
unit:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn test
- run: yarn lint
- run: yarn build
integration:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
services:
rippled:
image: natenichols/rippled-standalone:latest
ports:
- 6006:6006
options:
--health-cmd="wget localhost:6006 || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn test:integration
env:
HOST: localhost
PORT: ${{ job.services.rippled.ports['6006'] }}
browser:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x] # This just needs to be compatible w/ puppeteer
services:
rippled:
image: natenichols/rippled-standalone:latest
ports:
- 6006:6006
options:
--health-cmd="wget localhost:6006 || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn test:browser

3
.gitignore vendored
View File

@@ -68,3 +68,6 @@ scripts/cache
# nyc (istanbul)
.nyc_output
# browser tests
test-compiled-for-web

View File

@@ -20,7 +20,7 @@ Warning: Use at your own risk.
Exchange allowing clients to buy and sell XRP, based in Mexico.
## Data and visualizations
## Explorers
- **[xrpintel - XRP Intelligence](https://xrpintel.com/)**
@@ -58,10 +58,20 @@ Warning: Use at your own risk.
XRP Ledger explorer, API, metrics, and analytics using a graph database that is synchronized live with the XRPL.
## Data monitoring
- **[zerptracker](https://zerptracker.com)**
Monitor the XRPL using powerful JSONPath expressions, and receive notifications via email, SMS, webhooks, and more.
- **[Utility-Scan](https://utility-scan.com)**
Attempts to detect RippleNet on-demand liquidity (ODL) transactions through known fiat corridors and report these transactions in real time.
- **[XRPL Rosetta](https://xrpl-rosetta-oepox.ondigitalocean.app)**
3D Globe written in three.js connected to a Node.js websocket server that is listening to exchanges and the XRPL. The visualization aims to show trading, ODL, and liquidity at exchanges, intra-exchange volume, and flows.
## Wallets and wallet tools
- **[XUMM](https://xumm.app/)**

View File

@@ -2,6 +2,103 @@
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.10.0 (2021-08-12)
* Add address generation from Devnet/Testnet faucets (#1497)
* Fix bug with `getBalances()` ledgerVersion (#1505)
* Include lodash in webpack build (#1500)
* Documentation Updates:
* Export and document AccountSetFlags (#1525)
* Add links to example keypair derivation (#1523)
## 1.9.8 (2021-07-30)
* Export offline methods to top level of package (#1479)
* Remove deprecated ledger fields (#1160)
* These fields have been deprecated for many years: accepted, hash (use ledger_hash instead), seqNum (use ledger_index instead), totalCoins (use total_coins instead)
* Docs improvements (#1251, #1420, #1463)
* Reduce dependencies on lodash (#1467)
* Bug fixes
* Allow lowercase hex for memos (#1475)
* Add type argument to Promise (#1474)
* Fix miscommunication with ripplingDisabled in trustlines (#1481)
* Allow X-address for issuer (#1471)
* Dependencies
* ws, ripple-binary-codec
* deps-dev: typescript, @types/node, ts-node
The SHA-256 checksums for the browser version of this release can be found below.
```
% shasum -a 256 build/*
f3a0efb9f8bb618da6b10425a9b55a8492359a331a22d0ab4de7d3551870eb3d build/ripple-latest-min.js
fc17a5572001d814ea6b81aa701fcb66882ec031c68afb769a8ea8b71c6529a6 build/ripple-latest-min.js.LICENSE.txt
fd40457a89a14732ce261148e129cdda5aa963d9a433c57700353083faa1bffe build/ripple-latest.js
```
## 1.9.7 (2021-07-14)
* Bug fixes
* TypeScript: fix TrustlineTransaction type (#1458) (#1460) (thanks @mrosendin)
* Docs
* Update boilerplate (#1459) (thanks @mDuo13)
* Dependencies
* @types/node, @types/ws, @types/lodash, @types/mocha, prettier, mocha, webpack, ripple-binary-codec, ws, webpack-cli, doctoc
The SHA-256 checksums for the browser version of this release can be found below.
```
% shasum -a 256 build/*
a994422648c040076251c9a040fd494bc2ee30de23867607985b953022853afc build/ripple-latest-min.js
fc17a5572001d814ea6b81aa701fcb66882ec031c68afb769a8ea8b71c6529a6 build/ripple-latest-min.js.LICENSE.txt
2e22b6187ff5f9300520c29a538013067609b439181f1f2184d6a80fcfa2449c build/ripple-latest.js
```
## 1.9.6 (2021-07-01)
* Bug fixes
* Use 'current' ledger when preparing txs (#1429) (#999)
* Allow multiple settings at once (#1435)
* Dependencies
* ripple-address-codec, prettier, mocha
The SHA-256 checksums for the browser version of this release can be found below.
```
% shasum -a 256 build/*
cac7f6f3be93efbd61dc5fd527c40f0d1baec06f2f9faa64e9eeb191cc85a710 build/ripple-latest-min.js
fc17a5572001d814ea6b81aa701fcb66882ec031c68afb769a8ea8b71c6529a6 build/ripple-latest-min.js.LICENSE.txt
5737483e940dca8b73768d8a1de8217c7e921a9cebaadef02d2b16867658f331 build/ripple-latest.js
```
## 1.9.5 (2021-06-01)
* Bug fixes
* Prevent getFee from returning NaN from Reporting Mode (#1401) (#1398)
* Return promise inside catch block of reconnect to propagate promise (#1418) (#1113) (thanks @camposfyi)
* Internal
* Update mocha to use RC file config (#1417) (#1210) (thanks @camposfyi)
* Dependencies
* @types/ws, ws, browserslist, @types/lodash
The SHA-256 checksums for the browser version of this release can be found below.
```
% shasum -a 256 build/*
fcdc4aa1e1df7cb788b68f3d036e168aa64f9e818f441b99fef62d4571c0387d build/ripple-latest-min.js
fc17a5572001d814ea6b81aa701fcb66882ec031c68afb769a8ea8b71c6529a6 build/ripple-latest-min.js.LICENSE.txt
dfb7a92c4156fb3ee367254b5ea0935cda741cd3b5c36cdca695e7d89f88605e build/ripple-latest.js
```
## 1.9.4 (2021-04-18)
* Add memos support for all transaction types for getTransactions (#1353, #1397)
* Add Deno and React instructions (#1387)
The SHA-256 checksums for the browser version of this release can be found below.
```
% shasum -a 256 build/*
daa2b892a18037e89fea6fcf7de67624a782971956cb8df17cd765a4b0201ee9 build/ripple-latest-min.js
fc17a5572001d814ea6b81aa701fcb66882ec031c68afb769a8ea8b71c6529a6 build/ripple-latest-min.js.LICENSE.txt
b1d0bab54c6dbc76091610ede54a4269e73dea8cc6a9c25738d62bd7671920e4 build/ripple-latest.js
```
## 1.9.3 (2021-03-16)
* Expose ripple-address-codec methods. These are static methods on RippleAPI, so you do not need to create a RippleAPI instance.
@@ -53,6 +150,14 @@ Output for Example 3:
}
```
The SHA-256 checksums for the browser version of this release can be found below.
```
% shasum -a 256 build/*
bcc8db4e5464197151a267d9f240693794bf1eb4d26a4e0b3637f82a1d66e440 build/ripple-latest-min.js
fc17a5572001d814ea6b81aa701fcb66882ec031c68afb769a8ea8b71c6529a6 build/ripple-latest-min.js.LICENSE.txt
99c2825685d249c074abe7b59abaf197afce67ece7ad08ded6db67185e916dd2 build/ripple-latest.js
```
## 1.9.2 (2021-03-12)
* Docs
@@ -61,6 +166,7 @@ Output for Example 3:
* Deserialization and verification of payment paths (#1382) (#1347) (#1376)
* Dependencies
* Bump ripple-binary-codec to 1.1.2
* Fix edge case when constructing a value from "0", which can occur when using rippled v1.7.0
* Bump lodash, ripple-address-codec
The SHA-256 checksums for the browser version of this release can be found below.

View File

@@ -36,7 +36,67 @@ In an existing project (with `package.json`), install `ripple-lib`:
$ yarn add ripple-lib
```
Then see the documentation:
Then see the [documentation](#documentation).
### Using ripple-lib with React Native
If you want to use `ripple-lib` with React Native you will need to have some of the NodeJS modules available. To help with this you can use a module like [rn-nodeify](https://github.com/tradle/rn-nodeify).
1. Install dependencies (you can use `npm` as well):
```shell
yarn add react-native-crypto
yarn add ripple-lib
# install peer deps
yarn add react-native-randombytes
# install latest rn-nodeify
yarn add rn-nodeify@latest --dev
```
2. After that, run the following command:
```shell
# install node core shims and recursively hack package.json files
# in ./node_modules to add/update the "browser"/"react-native" field with relevant mappings
./node_modules/.bin/rn-nodeify --hack --install
```
3. Enable `crypto`:
`rn-nodeify` will create a `shim.js` file in the project root directory.
Open it and uncomment the line that requires the crypto module:
```javascript
// If using the crypto shim, uncomment the following line to ensure
// crypto is loaded first, so it can populate global.crypto
require('crypto')
```
4. Import `shim` in your project (it must be the first line):
```javascript
import './shim'
...
```
### Using ripple-lib with Deno
Until official support for [Deno](https://deno.land) is added, you can use the following work-around to use `ripple-lib` with Deno:
```javascript
import ripple from 'https://dev.jspm.io/npm:ripple-lib';
(async () => {
const api = new (ripple as any).RippleAPI({ server: 'wss://s.altnet.rippletest.net:51233' });
const address = 'rH8NxV12EuV...khfJ5uw9kT';
api.connect().then(() => {
api.getBalances(address).then((balances: any) => {
console.log(JSON.stringify(balances, null, 2));
});
});
})();
```
## Documentation

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
## accountSetFlags
To modify account flags, you can use an AccountSet transaction and its `SetFlag` or `ClearFlag` fields.
The flags are called [AccountSet flags (asf*)](https://xrpl.org/accountset.html#accountset-flags):
`RippleAPI.accountSetFlags.requireDestinationTag`: Require a destination tag to send transactions to this account.
`RippleAPI.accountSetFlags.requireAuthorization`: Require authorization for users to hold balances issued by this address. Can only be enabled if the address has no trust lines connected to it.
`RippleAPI.accountSetFlags.disallowIncomingXRP`: XRP should not be sent to this account. (Enforced by client applications, not by rippled)
`RippleAPI.accountSetFlags.disableMasterKey`: Disallow use of the master key pair. Can only be enabled if the account has configured another way to sign transactions.
`RippleAPI.accountSetFlags.enableTransactionIDTracking`: Track the ID of this account's most recent transaction.
`RippleAPI.accountSetFlags.noFreeze`: Permanently give up the ability to freeze individual trust lines or disable Global Freeze. This flag can never be disabled after being enabled.
`RippleAPI.accountSetFlags.globalFreeze`: Freeze all assets issued by this account.
`RippleAPI.accountSetFlags.defaultRipple`: Enable [rippling](https://xrpl.org/rippling.html) on this account's trust lines by default.
`RippleAPI.accountSetFlags.depositAuth`:Enable Deposit Authorization on this account.

View File

@@ -31,7 +31,7 @@ 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). 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.
**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 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 like 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`.

View File

@@ -6,7 +6,7 @@ Use the following [boilerplate code](https://en.wikipedia.org/wiki/Boilerplate_c
const RippleAPI = require('ripple-lib').RippleAPI;
const api = new RippleAPI({
server: 'wss://s1.ripple.com' // Public rippled server hosted by Ripple, Inc.
server: 'wss://xrplcluster.com' // Public cluster
});
api.on('error', (errorCode, errorMessage) => {
console.log(errorCode + ': ' + errorMessage);
@@ -16,7 +16,7 @@ api.on('connected', () => {
});
api.on('disconnected', (code) => {
// code - [close code](https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent) sent by the server
// will be 1000 if this was normal closure
// the code is 1000 for a normal closure
console.log('disconnected, code:', code);
});
api.connect().then(() => {
@@ -26,9 +26,7 @@ api.connect().then(() => {
}).catch(console.error);
```
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).
[Node.js v14](https://nodejs.org/) is recommended. Other versions may work but are not frequently tested.
<aside class="notice">
All the code snippets in this documentation assume that you have surrounded them with this boilerplate.
@@ -39,7 +37,7 @@ If you omit the "catch" section, errors may not be visible.
</aside>
<aside class="notice">
The "error" event is emitted whenever an error occurs that cannot be associated with a specific request. If the listener is not registered, an exception will be thrown whenever the event is emitted.
The API emits an "error" event whenever an error occurs that cannot be associated with a specific request. If there is no listener registered for this event, the API throws an exception whenever the event is emitted.
</aside>
### Parameters

View File

@@ -2,7 +2,7 @@
`combine(signedTransactions: Array<string>): {signedTransaction: string, id: string}`
Combines signed transactions from multiple accounts for a multisignature transaction. The signed transaction must subsequently be [submitted](#submit).
Combines signed transactions from multiple accounts for a multisignature transaction into a form that can be [submitted](#submit).
### Parameters

View File

@@ -27,7 +27,7 @@ This event is emitted when there is an error on the connection to the server tha
The first parameter is a string indicating the error type:
* `badMessage` - rippled returned a malformed message
* `websocket` - the websocket library emitted an error
* one of the error codes found in the [rippled Universal Errors](https://ripple.com/build/rippled-apis/#universal-errors).
* one of the error codes found in the [`rippled` Universal Errors](https://xrpl.org/error-formatting.html#universal-errors).
The second parameter is a message explaining the error.

View File

@@ -15,7 +15,7 @@ This method takes two parameters.
### 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.)
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. Both `bids` and `asks` are formatted the same way.
Object structure:
@@ -23,7 +23,7 @@ Object structure:
**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).
For details, see the `rippled` [book_offers method](https://xrpl.org/book_offers.html).
### Example

View File

@@ -0,0 +1,19 @@
## generateFaucetWallet
`generateFaucetWallet(onTestnet = true)`
Calls the Testnet or Devnet faucet API in order to generate a new, random wallet with some amount of test XRP. This is for testing purposes only.
### Example
**Request**
Create a new wallet on the Testnet:
```javascript
const wallet = await api.generateFaucetWallet()
```
**Response**
<%- renderFixture('responses/generate-faucet-wallet.json') %>

View File

@@ -4,7 +4,7 @@
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`.
This uses the [feeCushion parameter](#parameters) provided to the RippleAPI constructor, or the default value of `1.2`.
### Parameters

View File

@@ -14,13 +14,13 @@ Returns open orders for the specified account. Open orders are orders that have
### Return Value
This method returns a promise that resolves with an object with the following structure (Note: the structures of `bids` and `asks` are identical):
This method returns a promise that resolves with an object with the following structure Both `bids` and `asks` have the same format:
<%- 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).
For details, see the `rippled` [book_offers method](https://xrpl.org/book_offers.html).
### Example

View File

@@ -10,7 +10,7 @@ Returns settings for the specified account. Note: For account data that is not m
### Return Value
This method returns a promise that resolves with an array of objects with the following structure (Note: all fields are optional as they will not be shown if they are set to their default value):
This method returns a promise that resolves with an array of objects with the following structure. All fields are optional, and are omitted if they are set to their default value.
<%- renderSchema('output/get-settings.json') %>

View File

@@ -6,7 +6,7 @@ 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).
See [Markers and Pagination](https://xrpl.org/markers-and-pagination.html).
### Return Value

View File

@@ -59,6 +59,7 @@
<%- include('isValidSecret.md.ejs') %>
<%- include('deriveKeypair.md.ejs') %>
<%- include('deriveAddress.md.ejs') %>
<%- include('generateFaucetWallet.md.ejs') %>
<%- include('signPaymentChannelClaim.md.ejs') %>
<%- include('verifyPaymentChannelClaim.md.ejs') %>
<%- include('computeLedgerHash.md.ejs') %>
@@ -66,5 +67,6 @@
<%- include('iso8601ToRippleTime.md.ejs') %>
<%- include('rippleTimeToISO8601.md.ejs') %>
<%- include('txFlags.md.ejs') %>
<%- include('accountSetFlags.md.ejs') %>
<%- include('schemaValidator.md.ejs') %>
<%- include('events.md.ejs') %>

View File

@@ -1,8 +1,8 @@
## Offline functionality
RippleAPI can also function without internet connectivity. This can be useful in order to generate secrets and sign transactions from a secure, isolated machine.
RippleAPI can also function without internet connectivity, so you can generate secrets and sign transactions from a secure, isolated machine.
To instantiate RippleAPI in offline mode, use the following boilerplate code:
To instantiate RippleAPI in offline mode, use the following code:
```javascript
const RippleAPI = require('ripple-lib').RippleAPI;

View File

@@ -2,7 +2,7 @@
`parseAccountFlags(Flags: number): object`
Parse an `AccountRoot` object's [`Flags`](https://developers.ripple.com/accountroot.html#accountroot-flags).
Parse an `AccountRoot` object's [`Flags`](https://xrpl.org/accountroot.html#accountroot-flags).
### Parameters

View File

@@ -2,7 +2,7 @@
`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).
Prepare a Check cancellation transaction. This type of transaction cancels an unredeemed Check, removing it from the ledger without sending any money. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

@@ -2,7 +2,7 @@
`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).
Prepare a Check cashing transaction. This redeems a Check to receive up to the amount authorized by the corresponding CheckCreate transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

@@ -2,7 +2,7 @@
`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).
Prepare a Check creation transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

@@ -2,7 +2,7 @@
`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).
Prepare an escrow cancellation transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

@@ -2,7 +2,7 @@
`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).
Prepare an escrow creation transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

@@ -2,7 +2,7 @@
`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).
Prepare an escrow execution transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

@@ -2,7 +2,7 @@
`prepareOrder(address: string, order: object, instructions: object): Promise<object>`
Prepare an order transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
Prepare an order transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

@@ -2,7 +2,7 @@
`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).
Prepare an order cancellation transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

@@ -2,7 +2,7 @@
`preparePayment(address: string, payment: object, instructions: object): Promise<object>`
Prepare a payment transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
Prepare a payment transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

@@ -2,7 +2,7 @@
`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).
Prepare a payment channel claim transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

@@ -2,7 +2,7 @@
`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).
Prepare a payment channel creation transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

@@ -2,7 +2,7 @@
`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).
Prepare a payment channel fund transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
### Parameters

View File

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

View File

@@ -2,7 +2,7 @@
`prepareTicketCreate(address: string, ticketCount: number, instructions: object): Promise<object>`
Prepare a ticket transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
Prepare a ticket transaction. The prepared transaction can then be [signed](#sign) and [submitted](#submit).
Ticket functionality requires the [TicketBatch amendment](https://github.com/ripple/xrpl-dev-portal/issues/898). As of 2020-11-24, this amendment is not activated on the Mainnet, Testnet, or Devnet.

View File

@@ -2,9 +2,9 @@
`prepareTransaction(transaction: object, instructions: object): Promise<object>`
Prepare a transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
Prepare a transaction. The prepared transaction can then 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).
This method works with any of [the transaction types supported by rippled](https://xrpl.org/transaction-types.html).
Notably, this is the preferred method for preparing `DepositPreauth` or `AccountDelete` transactions.
@@ -12,8 +12,8 @@ Notably, this is the preferred method for preparing `DepositPreauth` or `Account
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.
transaction | [Transaction](https://xrpl.org/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

View File

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

View File

@@ -12,7 +12,7 @@ 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`.
This method returns a new object based on the source object, but with `issuer` instead of `counterparty`.
### Example

View File

@@ -4,7 +4,7 @@
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).
Refer to [HTTP / WebSocket APIs](https://xrpl.org/rippled-api.html) 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://xrpl.org/basic-data-types.html#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).

View File

@@ -6,13 +6,13 @@ 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).
See [Markers and Pagination](https://xrpl.org/markers-and-pagination.html).
### 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')`.
If the response does not have a next page, the promise rejects with `new errors.NotFoundError('response does not have a next page')`.
### Example

View File

@@ -1,15 +1,15 @@
# 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:
ripple-lib uses the XRP Ledger's [WebSocket API](https://xrpl.org/rippled-api.html) for online functionality. You can use ripple-lib to call these APIs directly. 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 `request()` to issue any `rippled` command, including `account_currencies`, `subscribe`, and `unsubscribe`. [Full list of API Methods](https://xrpl.org/public-rippled-methods.html).
* Use `hasNextPage()` to determine whether a response has more pages. This is true when the response includes a [`marker` field](https://xrpl.org/markers-and-pagination.html).
* 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).
* [Specify XRP amounts in drops](https://xrpl.org/basic-data-types.html#specifying-currency-amounts).
* [Specify timestamps as the number of seconds since the "Ripple Epoch"](https://xrpl.org/basic-data-types.html#specifying-time).
* Instead of `counterparty`, use `issuer`.
## Listening to streams
@@ -68,4 +68,4 @@ api.connect().then(() => {
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).
For full details, see the [subscribe method](https://xrpl.org/subscribe.html).

View File

@@ -6,14 +6,14 @@ Unlike the rest of the ripple-lib API, schemaValidator is a static object on Rip
`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.
This method checks an object for conformance to a specified schema. It does not return anything, but throws a `ValidationError` if the object does not conform to the schema.
### Example
```javascript
RippleAPI.schemaValidator.schemaValidate('sign', {
signedTransaction: '12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D874473045022100BDE09A1F6670403F341C21A77CF35BA47E45CDE974096E1AA5FC39811D8269E702203D60291B9A27F1DCABA9CF5DED307B4F23223E0B6F156991DB601DFB9C41CE1C770A726970706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304',
id: '02ACE87F1996E3A23690A5BB7F1774BF71CCBA68F79805831B42ABAD5913D6F4'
signedTransaction: '12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D8744630440220680070A157682D9EB510E8AD58C35DC9C8346B155077D73792E88120B7A3B6B1022079537D3300C9B4D2D3D62ACCE1E66CDA893F9612CB2577ADEC8154B933765336770B6578616D706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304',
id: '10B54D31384A49336C36A5907E3C28227139E282D3C7F734FEA351DE446F3674'
})
```
@@ -25,7 +25,7 @@ If the object is valid (conforms to the schema), nothing is returned. Otherwise,
```javascript
RippleAPI.schemaValidator.schemaValidate('sign', {
signedTransaction: '12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D874473045022100BDE09A1F6670403F341C21A77CF35BA47E45CDE974096E1AA5FC39811D8269E702203D60291B9A27F1DCABA9CF5DED307B4F23223E0B6F156991DB601DFB9C41CE1C770A726970706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304',
signedTransaction: '12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D8744630440220680070A157682D9EB510E8AD58C35DC9C8346B155077D73792E88120B7A3B6B1022079537D3300C9B4D2D3D62ACCE1E66CDA893F9612CB2577ADEC8154B933765336770B6578616D706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304',
id: '123'
})
```

View File

@@ -5,9 +5,9 @@ sign(txJSON: string, secret: string, options: object): {signedTransaction: strin
sign(txJSON: string, keypair: object, options: object): {signedTransaction: string, id: string}
```
Sign a prepared transaction. The signed transaction must subsequently be [submitted](#submit).
Sign a prepared transaction. The signed transaction can then 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:
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 is unrecognized until `ripple-binary-codec` is updated. If you try to sign an unrecognized transaction type, this method throws an error like the following:
`Error: [TRANSACTION_TYPE] is not a valid name or ordinal for TransactionType`
@@ -15,7 +15,7 @@ This method can sign any of [the transaction types supported by ripple-binary-co
<%- 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.
When this method is used for multi-signing, the `options` parameter is required. See the multi-signing example in this section for more details.
### Return Value
@@ -26,7 +26,8 @@ This method returns an object with the following structure:
### Example
```javascript
const txJSON = '{"Flags":2147483648,"TransactionType":"AccountSet","Account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59","Domain":"726970706C652E636F6D","LastLedgerSequence":8820051,"Fee":"12","Sequence":23}';
// AccountSet transaction that sets Domain to example.com:
const txJSON = '{"Flags":2147483648,"TransactionType":"AccountSet","Account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59","Domain":"6578616D706C652E636F6D","LastLedgerSequence":8820051,"Fee":"12","Sequence":23}';
const secret = 'shsWGZcmZz6YsWWmcnpfr6fLTdtFV';
const keypair = { privateKey: '00ACCD3309DB14D1A4FC9B1DAE608031F4408C85C73EE05E035B7DC8B25840107A', publicKey: '02F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D8' };
return api.sign(txJSON, secret); // or: api.sign(txJSON, keypair);
@@ -34,7 +35,20 @@ return api.sign(txJSON, secret); // or: api.sign(txJSON, keypair);
<%- renderFixture("responses/sign.json") %>
### Example (multisigning)
### Example Keypairs
To learn how keypairs are derived read [here](https://xrpl.org/cryptographic-keys.html#generating-keys).
```javascript
// secp25519 (33 bytes)
const privateKey = "002512BBDFDBB77510883B7DCCBEF270B86DEAC8B64AC762873D75A1BEE6298665"
const publicKey = "0390A196799EE412284A5D80BF78C3E84CBB80E1437A0AECD9ADF94D7FEAAFA284"
// ed25519 (Note the 0xED prefixes a 32 byte value for a total of 33 bytes)
const privateKey = "ED0B6CBAC838DFE7F47EA1BD0DF00EC282FDF45510C92161072CCFB84035390C4D"
const publicKey = "ED1A7C082846CFF58FF9A892BA4BA2593151CCF1DBA59F37714CC9ED39824AF85F"
```
### Example (multi-signing)
```javascript
const RippleAPI = require('ripple-lib').RippleAPI;
@@ -84,6 +98,10 @@ const multiSignPaymentTransaction = {
Amount: '88000000'
};
const multiSignPaymentInstruction = {
signersCount: 2
};
const api = new RippleAPI({
server: 'wss://s.altnet.rippletest.net:51233'
});
@@ -97,7 +115,7 @@ api.connect().then(() => {
console.log(response.resultCode, response.resultMessage);
// multi sign a transaction
api.prepareTransaction(multiSignPaymentTransaction).then(prepared => {
api.prepareTransaction(multiSignPaymentTransaction, multiSignPaymentInstruction).then(prepared => {
console.log(prepared);
// Aya and Bran sign it too but with 'signAs' set to their own account
@@ -116,8 +134,8 @@ api.connect().then(() => {
}).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:
If the multi-signing account was setup properly, the above example logs `resultCode: 'tesSUCCESS'` and the hash for the transaction. If any of `{signAs: some_address}` options were missing, the code returns a validation error such as:
```
[ValidationError(txJSON is not the same for all signedTransactions)]
```

View File

@@ -2,7 +2,7 @@
`signPaymentChannelClaim(channel: string, amount: string, privateKey: string): string`
Sign a payment channel claim. The signature can be submitted in a subsequent [PaymentChannelClaim](#preparepaymentchannelclaim) transaction.
Sign a payment channel claim. A [PaymentChannelClaim](#preparepaymentchannelclaim) transaction can use the resulting signature to withdraw XRP from a payment channel.
### Parameters

View File

@@ -47,7 +47,7 @@ Transaction hash: 80C5E11E1A21A626759D6CB944B33DBAAC66BD704A289C86E330B847904F5C
Convert a classic address and tag to an X-address.
If `test` is `true`, the address with start with `T` and readers of the address will know that the address is intended for use on a test network.
If `test` is `true`, the address starts with `T` to show that the address is intended for use on a test network.
### Example: Encode an X-address with tag 4294967295

View File

@@ -6,14 +6,14 @@ A transaction type is specified by the strings in the first column in the table
Type | Description
---- | -----------
[payment](#payment) | A `payment` transaction represents a transfer of value from one account to another. Depending on the [path](https://ripple.com/build/paths/) taken, additional exchanges of value may occur atomically to facilitate the payment.
[payment](#payment) | A `payment` transaction represents a transfer of value from one account to another. Depending on the [path](https://xrpl.org/paths.html) taken, additional exchanges of value may occur atomically to enable the payment.
[order](#order) | An `order` transaction creates a limit order. It defines an intent to exchange currencies, and creates an order in the XRP Ledger's order book if not completely fulfilled when placed. Orders can be partially fulfilled.
[orderCancellation](#order-cancellation) | An `orderCancellation` transaction cancels an order in the XRP Ledger's order book.
[trustline](#trustline) | A `trustline` transaction creates or modifies a trust line between two accounts.
[settings](#settings) | A `settings` transaction modifies the settings of an account in the XRP Ledger.
[escrowCreation](#escrow-creation) | An `escrowCreation` transaction creates an escrow on the ledger, which locks XRP until a cryptographic condition is met or it expires. It is like an escrow service where the XRP Ledger acts as the escrow agent.
[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.
[escrowCancellation](#escrow-cancellation) | An `escrowCancellation` transaction unlocks the funds in an escrow and sends them back to the creator of the escrow, if the escrow has expired.
[escrowExecution](#escrow-execution) | An `escrowExecution` transaction unlocks the funds in an escrow and sends them to the destination of the escrow, if the conditions for the escrow are met.
[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 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.
@@ -49,7 +49,7 @@ Every transaction must destroy a small amount of XRP as a cost to apply the tran
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).
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` is 20 drops × (1 + 2 Signatures) = 60 drops. See [Transaction Cost](https://xrpl.org/transaction-cost.html).
## Transaction Instructions
@@ -57,7 +57,7 @@ Transaction instructions indicate how to execute a transaction, complementary wi
<%- renderSchema("objects/instructions.json") %>
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.
We recommend that you specify a `maxLedgerVersion` so that you can quickly determine that a failed transaction can 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

View File

@@ -18,9 +18,9 @@ Applies globally to all transactions.
`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.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://xrpl.org/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.
`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://xrpl.org/payment.html#limit-quality) for details.
### OfferCreate Flags
@@ -38,9 +38,9 @@ Applies globally to all transactions.
`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.SetNoRipple`: Blocks [rippling](https://xrpl.org/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.ClearNoRipple`: Clears the No-[Rippling](https://xrpl.org/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.
@@ -50,7 +50,7 @@ Applies globally to all transactions.
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).
In the rippled API, Account Flags can be enabled and disabled with the SetFlag and ClearFlag parameters. See [AccountSet Flags](https://xrpl.org/accountset.html#accountset-flags).
The AccountSet transaction type has some transaction flags, but their use is discouraged.

View File

@@ -1,6 +1,6 @@
{
"name": "ripple-lib",
"version": "1.9.3",
"version": "1.10.0",
"license": "ISC",
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
"files": [
@@ -26,9 +26,8 @@
"https-proxy-agent": "^5.0.0",
"jsonschema": "1.2.2",
"lodash": "^4.17.4",
"lodash.isequal": "^4.5.0",
"ripple-address-codec": "^4.1.1",
"ripple-binary-codec": "^1.1.2",
"ripple-binary-codec": "^1.1.3",
"ripple-keypairs": "^1.0.3",
"ripple-lib-transactionparser": "0.8.2",
"ws": "^7.2.0"
@@ -37,8 +36,8 @@
"elliptic": "^6.5.4"
},
"devDependencies": {
"@types/mocha": "^8.2.1",
"@types/node": "^14.0.1",
"@types/mocha": "^9.0.0",
"@types/node": "^16.4.3",
"@typescript-eslint/eslint-plugin": "^2.3.3",
"@typescript-eslint/parser": "^2.27.0",
"assert": "^2.0.0",
@@ -49,14 +48,19 @@
"ejs": "^3.0.1",
"eslint": "^6.5.1",
"eventemitter2": "^6.0.0",
"https-browserify": "^1.0.0",
"json-schema-to-markdown-table": "^0.4.0",
"mocha": "^7",
"mocha": "^9",
"nyc": "^15",
"path-browserify": "1.0.1",
"prettier": "^2.0.5",
"process": "^0.11.10",
"puppeteer": "5.4.1",
"stream-browserify": "^3.0.0",
"ts-node": "^9.1.1",
"typescript": "^3.7.5",
"stream-http": "3.1.1",
"ts-loader": "^8.0.11",
"ts-node": "^10.1.0",
"typescript": "^3.9.9",
"url": "^0.11.0",
"webpack": "^5.6.0",
"webpack-bundle-analyzer": "^4.1.0",
@@ -73,8 +77,10 @@
"doctoc": "doctoc docs/index.md --title '# RippleAPI Reference' --github --maxlevel 2",
"docgen": "node --harmony scripts/build_docs.js",
"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",
"test": "TS_NODE_PROJECT=src/tsconfig.json nyc mocha --config=test/.mocharc.json --exit",
"test:integration": "TS_NODE_PROJECT=src/tsconfig.json nyc mocha ./test/integration/*.ts",
"test:browser": "TS_NODE_PROJECT=src/tsconfig.json nyc mocha ./test/browser/*.ts",
"test:watch": "TS_NODE_PROJECT=src/tsconfig.json mocha --config=test/.mocharc.json --watch --reporter dot",
"format": "prettier --write '{src,test}/**/*.ts'",
"lint": "eslint 'src/**/*.ts' 'test/*-test.{ts,js}'",
"perf": "./scripts/perf_test.sh",

View File

@@ -104,7 +104,7 @@ async function performPayments(payments) {
// Most of the time we'll get 'tesSUCCESS' or (after many submissions) 'terQUEUED'
console.log(`tx ${i} - tentative: ${result.resultCode}`)
const txFinalizedPromise = new Promise((resolve) => {
const txFinalizedPromise = new Promise<void>((resolve) => {
const ledgerClosedCallback = async (event: LedgerClosedEvent) => {
let status
try {

View File

@@ -1,6 +1,7 @@
import {EventEmitter} from 'events'
import {
Connection,
constants,
errors,
validate,
xrpToDrops,
@@ -8,7 +9,7 @@ import {
rippleTimeToISO8601,
iso8601ToRippleTime,
txFlags,
ensureClassicAddress
ensureClassicAddress,
} from './common'
import {
connect,
@@ -47,11 +48,7 @@ import prepareTicketCreate from './transaction/ticket'
import sign from './transaction/sign'
import combine from './transaction/combine'
import submit from './transaction/submit'
import {
generateAddressAPI,
GenerateAddressOptions,
GeneratedAddress
} from './offline/generate-address'
import {generateAddress, generateXAddress} from './offline/utils'
import {deriveKeypair, deriveAddress, deriveXAddress} from './offline/derive'
import computeLedgerHash from './offline/ledgerhash'
import signPaymentChannelClaim from './offline/sign-payment-channel-claim'
@@ -89,7 +86,22 @@ 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 {classicAddressToXAddress, xAddressToClassicAddress, isValidXAddress, isValidClassicAddress, encodeSeed, decodeSeed, encodeAccountID, decodeAccountID, encodeNodePublic, decodeNodePublic, encodeAccountPublic, decodeAccountPublic, encodeXAddress, decodeXAddress} from 'ripple-address-codec'
import {
classicAddressToXAddress,
xAddressToClassicAddress,
isValidXAddress,
isValidClassicAddress,
encodeSeed,
decodeSeed,
encodeAccountID,
decodeAccountID,
encodeNodePublic,
decodeNodePublic,
encodeAccountPublic,
decodeAccountPublic,
encodeXAddress,
decodeXAddress
} from 'ripple-address-codec'
import {
computeBinaryTransactionHash,
computeTransactionHash,
@@ -104,6 +116,8 @@ import {
computePaymentChannelHash
} from './common/hashes'
import generateFaucetWallet from './wallet/wallet-generation'
export interface APIOptions extends ConnectionUserOptions {
server?: string
feeCushion?: number
@@ -154,7 +168,7 @@ class RippleAPI extends EventEmitter {
this._feeCushion = options.feeCushion || 1.2
this._maxFeeXRP = options.maxFeeXRP || '2'
const serverURL = options.server
if (serverURL !== undefined) {
if (serverURL != null) {
this.connection = new Connection(serverURL, options)
this.connection.on('ledgerClosed', (message) => {
this.emit('ledger', formatLedgerClose(message))
@@ -324,7 +338,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 != null ? params.limit : Infinity
let count: number = 0
let marker: string = params.marker
let lastBatchLength: number
@@ -352,14 +366,9 @@ class RippleAPI extends EventEmitter {
return results
}
// @deprecated Use X-addresses instead
generateAddress(options: GenerateAddressOptions = {}): GeneratedAddress {
return generateAddressAPI({...options, includeClassicAddress: true})
}
generateXAddress(options: GenerateAddressOptions = {}): GeneratedAddress {
return generateAddressAPI(options)
}
// @deprecated Use X-addresses instead & Invoke from top-level package instead
generateAddress = generateAddress
generateXAddress = generateXAddress // @deprecated Invoke from top-level package instead
connect = connect
disconnect = disconnect
@@ -403,11 +412,14 @@ class RippleAPI extends EventEmitter {
submit = submit // @deprecated Use api.request('submit', { tx_blob: signedTransaction }) instead
deriveKeypair = deriveKeypair
deriveAddress = deriveAddress
computeLedgerHash = computeLedgerHash
signPaymentChannelClaim = signPaymentChannelClaim
verifyPaymentChannelClaim = verifyPaymentChannelClaim
deriveKeypair = deriveKeypair // @deprecated Invoke from top-level package instead
deriveAddress = deriveAddress // @deprecated Invoke from top-level package instead
computeLedgerHash = computeLedgerHash // @deprecated Invoke from top-level package instead
signPaymentChannelClaim = signPaymentChannelClaim // @deprecated Invoke from top-level package instead
verifyPaymentChannelClaim = verifyPaymentChannelClaim // @deprecated Invoke from top-level package instead
generateFaucetWallet = generateFaucetWallet
errors = errors
static deriveXAddress = deriveXAddress
@@ -418,59 +430,71 @@ class RippleAPI extends EventEmitter {
/**
* Static methods to expose ripple-address-codec methods
*/
static classicAddressToXAddress = classicAddressToXAddress
static xAddressToClassicAddress = xAddressToClassicAddress
static isValidXAddress = isValidXAddress
static isValidClassicAddress = isValidClassicAddress
static encodeSeed = encodeSeed
static decodeSeed = decodeSeed
static encodeAccountID = encodeAccountID
static decodeAccountID = decodeAccountID
static encodeNodePublic = encodeNodePublic
static decodeNodePublic = decodeNodePublic
static encodeAccountPublic = encodeAccountPublic
static decodeAccountPublic = decodeAccountPublic
static encodeXAddress = encodeXAddress
static decodeXAddress = decodeXAddress
static classicAddressToXAddress = classicAddressToXAddress
static xAddressToClassicAddress = xAddressToClassicAddress
static isValidXAddress = isValidXAddress
static isValidClassicAddress = isValidClassicAddress
static encodeSeed = encodeSeed
static decodeSeed = decodeSeed
static encodeAccountID = encodeAccountID
static decodeAccountID = decodeAccountID
static encodeNodePublic = encodeNodePublic
static decodeNodePublic = decodeNodePublic
static encodeAccountPublic = encodeAccountPublic
static decodeAccountPublic = decodeAccountPublic
static encodeXAddress = encodeXAddress
static decodeXAddress = decodeXAddress
/**
* Static methods that replace functionality from the now-deprecated ripple-hashes library
*/
// Compute the hash of a binary transaction blob.
// @deprecated Invoke from top-level package instead
static computeBinaryTransactionHash = computeBinaryTransactionHash // (txBlobHex: string): string
// Compute the hash of a transaction in txJSON format.
// @deprecated Invoke from top-level package instead
static computeTransactionHash = computeTransactionHash // (txJSON: any): string
static computeBinaryTransactionSigningHash = computeBinaryTransactionSigningHash // (txBlobHex: string): string
// @deprecated Invoke from top-level package instead
static computeBinaryTransactionSigningHash =
computeBinaryTransactionSigningHash // (txBlobHex: string): string
// Compute the hash of an account, given the account's classic address (starting with `r`).
// @deprecated Invoke from top-level package instead
static computeAccountLedgerObjectID = computeAccountLedgerObjectID // (address: string): string
// Compute the hash (ID) of an account's SignerList.
// @deprecated Invoke from top-level package instead
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.
// @deprecated Invoke from top-level package instead
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.
// @deprecated Invoke from top-level package instead
static computeTrustlineHash = computeTrustlineHash // (address1: string, address2: string, currency: string): string
// @deprecated Invoke from top-level package instead
static computeTransactionTreeHash = computeTransactionTreeHash // (transactions: any[]): string
// @deprecated Invoke from top-level package instead
static computeStateTreeHash = computeStateTreeHash // (entries: any[]): string
// Compute the hash of a ledger.
// @deprecated Invoke from top-level package instead
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.
// @deprecated Invoke from top-level package instead
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.
// @deprecated Invoke from top-level package instead
static computePaymentChannelHash = computePaymentChannelHash // (address, dstAddress, sequence): string
xrpToDrops = xrpToDrops
dropsToXrp = dropsToXrp
rippleTimeToISO8601 = rippleTimeToISO8601
iso8601ToRippleTime = iso8601ToRippleTime
xrpToDrops = xrpToDrops // @deprecated Invoke from top-level package instead
dropsToXrp = dropsToXrp // @deprecated Invoke from top-level package instead
rippleTimeToISO8601 = rippleTimeToISO8601 // @deprecated Invoke from top-level package instead
iso8601ToRippleTime = iso8601ToRippleTime // @deprecated Invoke from top-level package instead
txFlags = txFlags
static accountSetFlags = constants.AccountSetFlags
isValidAddress = schemaValidator.isValidAddress
isValidSecret = schemaValidator.isValidSecret
}
export {
RippleAPI
}
export {RippleAPI}
export type {
AccountObjectsRequest,

View File

@@ -1,4 +1,3 @@
import * as _ from 'lodash'
import {RippleAPI, APIOptions} from './api'
class RippleAPIBroadcast extends RippleAPI {
@@ -9,7 +8,7 @@ class RippleAPIBroadcast extends RippleAPI {
super(options)
const apis: RippleAPI[] = servers.map(
(server) => new RippleAPI(_.assign({}, options, {server}))
(server) => new RippleAPI(Object.assign({}, options, {server}))
)
// exposed for testing
@@ -51,7 +50,7 @@ class RippleAPIBroadcast extends RippleAPI {
onLedgerEvent(ledger) {
if (
ledger.ledgerVersion > this.ledgerVersion ||
this.ledgerVersion === undefined
this.ledgerVersion == null
) {
this.ledgerVersion = ledger.ledgerVersion
this.emit('ledger', ledger)

View File

@@ -68,7 +68,7 @@ const INTENTIONAL_DISCONNECT_CODE = 4000
*/
function createWebSocket(url: string, config: ConnectionOptions): WebSocket {
const options: WebSocket.ClientOptions = {}
if (config.proxy !== undefined) {
if (config.proxy != null) {
const parsedURL = parseUrl(url)
const parsedProxyURL = parseUrl(config.proxy)
const proxyOverrides = _.omitBy(
@@ -81,9 +81,9 @@ function createWebSocket(url: string, config: ConnectionOptions): WebSocket {
passphrase: config.passphrase,
cert: config.certificate
},
_.isUndefined
(value) => value == null
)
const proxyOptions = _.assign({}, parsedProxyURL, proxyOverrides)
const proxyOptions = Object.assign({}, parsedProxyURL, proxyOverrides)
let HttpsProxyAgent
try {
HttpsProxyAgent = require('https-proxy-agent')
@@ -92,7 +92,7 @@ function createWebSocket(url: string, config: ConnectionOptions): WebSocket {
}
options.agent = new HttpsProxyAgent(proxyOptions)
}
if (config.authorization !== undefined) {
if (config.authorization != null) {
const base64 = Buffer.from(config.authorization).toString('base64')
options.headers = {Authorization: `Basic ${base64}`}
}
@@ -103,9 +103,9 @@ function createWebSocket(url: string, config: ConnectionOptions): WebSocket {
passphrase: config.passphrase,
cert: config.certificate
},
_.isUndefined
(value) => value == null
)
const websocketOptions = _.assign({}, options, optionsOverrides)
const websocketOptions = Object.assign({}, options, optionsOverrides)
const websocket = new WebSocket(url, null, websocketOptions)
// we will have a listener for each outstanding request,
// so we have to raise the limit (the default is 10)
@@ -345,7 +345,7 @@ export class Connection extends EventEmitter {
this.emit('error', 'badMessage', error.message, message)
return
}
if (data.type === undefined && data.error) {
if (data.type == null && data.error) {
this.emit('error', data.error, data.error_message, data) // e.g. slowDown
return
}
@@ -390,7 +390,7 @@ export class Connection extends EventEmitter {
*/
private _heartbeat = () => {
return this.request({command: 'ping'}).catch(() => {
this.reconnect().catch((error) => {
return this.reconnect().catch((error) => {
this.emit('error', 'reconnect', error.message, error)
})
})
@@ -642,4 +642,13 @@ export class Connection extends EventEmitter {
return responsePromise
}
/**
* Get the Websocket connection URL
*
* @returns The Websocket connection URL
*/
getUrl(): string {
return this._url
}
}

View File

@@ -70,7 +70,7 @@ export interface Settings {
defaultRipple?: boolean
}
const AccountFlagIndices = {
const AccountSetFlags = {
requireDestinationTag: txFlagIndices.AccountSet.asfRequireDest,
requireAuthorization: txFlagIndices.AccountSet.asfRequireAuth,
depositAuth: txFlagIndices.AccountSet.asfDepositAuth,
@@ -96,4 +96,4 @@ const AccountFields = {
TickSize: {name: 'tickSize', defaults: 0}
}
export {AccountFields, AccountFlagIndices, AccountFlags}
export {AccountFields, AccountSetFlags, AccountFlags}

View File

@@ -54,6 +54,8 @@ class ResponseFormatError extends ConnectionError {}
class ValidationError extends RippleError {}
class XRPLFaucetError extends RippleError {}
class NotFoundError extends RippleError {
constructor(message = 'Not found') {
super(message)
@@ -90,5 +92,6 @@ export {
NotFoundError,
PendingLedgerVersionError,
MissingLedgerHistoryError,
LedgerVersionError
LedgerVersionError,
XRPLFaucetError
}

View File

@@ -45,14 +45,14 @@ class RangeSet {
parseAndAddRanges(rangesString: string) {
const rangeStrings = rangesString.split(',')
_.forEach(rangeStrings, (rangeString) => {
rangeStrings.forEach((rangeString) => {
const range = rangeString.split('-').map(Number)
this.addRange(range[0], range.length === 1 ? range[0] : range[1])
})
}
containsRange(start: number, end: number) {
return _.some(this.ranges, (range) => range[0] <= start && range[1] >= end)
return this.ranges.some((range) => range[0] <= start && range[1] >= end)
}
containsValue(value: number) {

View File

@@ -126,7 +126,7 @@ function loadSchemas() {
require('./schemas/input/combine.json')
]
const titles = schemas.map((schema) => schema.title)
const duplicates = _.keys(_.pickBy(_.countBy(titles), (count) => count > 1))
const duplicates = Object.keys(_.pickBy(_.countBy(titles), (count) => count > 1))
assert.ok(duplicates.length === 0, 'Duplicate schemas for: ' + duplicates)
const validator = new Validator()
// Register custom format validators that ignore undefined instances
@@ -135,7 +135,7 @@ function loadSchemas() {
// This relies on "format": "xAddress" in `x-address.json`!
validator.customFormats.xAddress = function (instance) {
if (instance === undefined) {
if (instance == null) {
return true
}
return isValidXAddress(instance)
@@ -143,21 +143,21 @@ function loadSchemas() {
// This relies on "format": "classicAddress" in `classic-address.json`!
validator.customFormats.classicAddress = function (instance) {
if (instance === undefined) {
if (instance == null) {
return true
}
return isValidAddress(instance)
}
validator.customFormats.secret = function (instance) {
if (instance === undefined) {
if (instance == null) {
return true
}
return isValidSecret(instance)
}
// Register under the root URI '/'
_.forEach(schemas, (schema) =>
schemas.forEach((schema) =>
validator.addSchema(schema, '/' + schema.title)
)
return validator
@@ -168,7 +168,7 @@ const schemaValidator = loadSchemas()
function schemaValidate(schemaName: string, object: any): void {
// Lookup under the root URI '/'
const schema = schemaValidator.getSchema('/' + schemaName)
if (schema === undefined) {
if (schema == null) {
throw new ValidationError('no schema for ' + schemaName)
}
const result = schemaValidator.validate(object, schema)

View File

@@ -23,11 +23,11 @@
},
"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`."
"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 starts with `T`. If `false`, the address should only be used on Mainnet, and starts with `X`."
},
"includeClassicAddress": {
"type": "boolean",
"description": "If `true`, return the classic address, in addition to the X-address."
"description": "If `true`, also return the classic address."
}
},
"additionalProperties": false

View File

@@ -23,7 +23,7 @@
},
"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`."
"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 starts with `T`. If `false`, the address should only be used on Mainnet, and starts with `X`."
},
"includeClassicAddress": {
"type": "boolean",

View File

@@ -21,7 +21,7 @@
"description": "Get the balance sheet as of this historical ledger version."
}
},
"description": "Options to determine how the balances will be calculated.",
"description": "Options to determine how the balances are calculated.",
"additionalProperties": false
}
},

View File

@@ -17,15 +17,15 @@
},
"includeAllData": {
"type": "boolean",
"description": "Include full transactions and/or state information if `includeTransactions` and/or `includeState` is set."
"description": "Include the details of the transactions or state information if `includeTransactions` or `includeState` is set."
},
"includeTransactions": {
"type": "boolean",
"description": "Return an array of hashes for each transaction or an array of all transactions that were validated in this ledger version, depending on whether `includeAllData` is set."
"description": "Return an array of transactions in this ledger. By default, provides the identifying hashes for each transaction. If `includeAllData` is true, include the entire transaction JSON for each transaction instead."
},
"includeState": {
"type": "boolean",
"description": "Return an array of hashes for all state data or an array of all state data in this ledger version, depending on whether `includeAllData` is set."
"description": "Return an array of state data in this ledger. By default, provides the identifying hashes of state data. If `includeAllData` is true, return the state data in JSON form instead. **Admin required:** This is a very large amount of data."
}
},
"additionalProperties": false

View File

@@ -9,12 +9,12 @@
"description": "The XRP Ledger address of the account to get open orders for."
},
"options": {
"description": "Options that determine what orders will be returned.",
"description": "Options that determine what orders to return.",
"properties": {
"limit": {
"type": "integer",
"minimum": 1,
"description": "At most this many orders will be returned."
"description": "Return at most this many orders."
},
"ledgerVersion": {
"$ref": "ledgerVersion",

View File

@@ -12,7 +12,7 @@
"properties": {
"address": {
"$ref": "address",
"description": "The XRP Ledger address of the account where funds will come from."
"description": "The XRP Ledger address of the planned sender."
},
"amount": {
"$ref": "laxAmount",

View File

@@ -6,7 +6,7 @@
"properties": {
"id": {"$ref": "transactionHash"},
"options": {
"description": "Options to limit the ledger versions to search and/or to include raw transaction data.",
"description": "Options to limit the ledger versions to search or include raw transaction data.",
"properties": {
"minLedgerVersion": {
"$ref": "ledgerVersion",

View File

@@ -13,7 +13,7 @@
"properties": {
"start": {
"$ref": "hash256",
"description": "If specified, this transaction will be the first transaction in the result. You cannot use `start` with `minLedgerVersion` or `maxLedgerVersion`. When `start` is specified, these ledger versions will be determined internally."
"description": "If specified, start the results from this transaction. You cannot use `start` with `minLedgerVersion` or `maxLedgerVersion`. When `start` is specified, these ledger versions are determined internally."
},
"limit": {
"type": "integer",
@@ -30,11 +30,11 @@
},
"earliestFirst": {
"type": "boolean",
"description": "If true, sort transactions so that the earliest ones come first. By default, the newest transactions will come first."
"description": "If true, sort transactions so that the earliest ones come first. By default, the newest transactions come first."
},
"excludeFailures": {
"type": "boolean",
"description": "If true, the result will omit transactions that did not succeed."
"description": "If true, the result omits transactions that did not succeed."
},
"initiated": {
"type": "boolean",
@@ -54,7 +54,7 @@
},
"binary": {
"type": "boolean",
"description": "If true, the transactions will be sent from the server in a condensed binary format rather than JSON."
"description": "If true, return transactions in binary format rather than JSON."
}
},
"additionalProperties": false,

View File

@@ -17,11 +17,11 @@
"properties": {
"privateKey": {
"type": "privateKey",
"description": "The uppercase hexadecimal representation of the secp256k1 or Ed25519 private key."
"description": "The uppercase hexadecimal representation of the secp256k1 or Ed25519 private key. Ed25519 keys are prefixed with 0xED. You can read about how keys are derived [here](https://xrpl.org/cryptographic-keys.html)."
},
"publicKey": {
"type": "publicKey",
"description": "The uppercase hexadecimal representation of the secp256k1 or Ed25519 public key."
"description": "The uppercase hexadecimal representation of the secp256k1 or Ed25519 public key. Ed25519 keys are prefixed with 0xED. You can read about how keys are derived [here](https://xrpl.org/cryptographic-keys.html)."
}
},
"description": "The private and public key of the account that is initiating the transaction. (This field cannot be used with secret).",
@@ -30,7 +30,7 @@
},
"options": {
"type": "object",
"description": "Options that control the type of signature that will be generated.",
"description": "Options that control the type of signature to create.",
"properties": {
"signAs": {
"$ref": "address",

View File

@@ -5,7 +5,7 @@
"type": "object",
"properties": {
"value": {
"description": "The quantity of the currency, denoted as a string to retain floating point precision",
"description": "The quantity of the currency, denoted as a string so that it does not lose precision",
"$ref": "value"
},
"currency": {

View File

@@ -18,11 +18,11 @@
"$ref": "value"
},
"maxFee": {
"description": "Deprecated: Use `maxFeeXRP` in the RippleAPI constructor instead. The maximum fee to pay for this transaction. If this exceeds `maxFeeXRP`, `maxFeeXRP` will be used instead. See [Transaction Fees](#transaction-fees) for more information.",
"description": "Deprecated: Use `maxFeeXRP` in the RippleAPI constructor instead. The maximum fee to pay for this transaction. If this exceeds `maxFeeXRP`, use `maxFeeXRP` instead. See [Transaction Fees](#transaction-fees) for more information.",
"$ref": "value"
},
"maxLedgerVersion": {
"description": "The highest ledger version that the transaction can be included in. If this option and `maxLedgerVersionOffset` are both omitted, the `maxLedgerVersion` option will default to 3 greater than the current validated ledger version (equivalent to `maxLedgerVersionOffset=3`). Use `null` to not set a maximum ledger version. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.",
"description": "The highest ledger version that the transaction can be included in. If this option and `maxLedgerVersionOffset` are both omitted, the default is 3 greater than the current validated ledger version (equivalent to `maxLedgerVersionOffset=3`). Use `null` to not set a maximum ledger version. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.",
"oneOf": [
{"$ref": "ledgerVersion"},
{"type": "null"}
@@ -34,7 +34,7 @@
"minimum": 0
},
"signersCount": {
"description": "Number of signers that will be signing this transaction.",
"description": "Number of signers that can multi-sign this transaction.",
"type": "integer",
"minimum": 1
}

View File

@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "issue",
"description": "A currency-counterparty pair, or just currency if it's XRP",
"description": "The currency code, and the counterparty if it's not XRP.",
"allOf": [
{"$ref": "amountbase"},
{"not": {"required": ["value"]}}

View File

@@ -5,15 +5,15 @@
"properties": {
"defaultRipple": {
"type": "boolean",
"description": "Enable [rippling](https://ripple.com/build/understanding-the-noripple-flag/) on this accounts trust lines by default. (New in [rippled 0.27.3](https://github.com/ripple/rippled/releases/tag/0.27.3))"
"description": "Enable [rippling](https://xrpl.org/rippling.html) on this accounts trust lines by default. Currency issuers should enable this setting; most others should not."
},
"depositAuth": {
"type": "boolean",
"description": "Enable [Deposit Authorization](https://ripple.com/build/deposit-authorization/) on this account. If set, transactions cannot send value of any kind to this account unless the sender of those transactions is the account itself. (Requires the [DepositAuth amendment](https://ripple.com/build/known-amendments/#depositauth))"
"description": "Enable [Deposit Authorization](https://xrpl.org/depositauth.html) on this account. If set, transactions cannot send value of any kind to this account unless the sender of those transactions is the account itself. (Requires the [DepositAuth amendment](https://xrpl.org/known-amendments.html#depositauth))"
},
"disableMasterKey": {
"type": "boolean",
"description": "Disallows use of the master key to sign transactions for this account. To disable the master key, you must authorize the transaction by signing it with the master key pair. You cannot use a regular key pair or a multi-signature. You can re-enable the master key pair using a regular key pair or multi-signature. See [AccountSet](https://developers.ripple.com/accountset.html)."
"description": "Disallows use of the master key to sign transactions for this account. To disable the master key, you must authorize the transaction by signing it with the master key pair. You cannot use a regular key pair or a multi-signature. You can re-enable the master key pair using a regular key pair or multi-signature. See [AccountSet](https://xrpl.org/accountset.html)."
},
"disallowIncomingXRP": {
"type": "boolean",
@@ -67,7 +67,7 @@
},
"requireAuthorization": {
"type": "boolean",
"description": "If set, this account must individually approve other users in order for those users to hold this accounts issuances."
"description": "If set, this account must individually give other users permission to hold this accounts issued tokens."
},
"requireDestinationTag": {
"type": "boolean",

View File

@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "tx-json",
"link": "https://developers.ripple.com/transaction-formats.html",
"link": "https://xrpl.org/transaction-formats.html",
"description": "An object in rippled txJSON format",
"type": "object",
"properties": {

View File

@@ -7,7 +7,7 @@
"balances": {
"type": "array",
"items": {"$ref": "amount"},
"description": "Amounts issued to the hotwallet accounts from the request. The keys are hot wallet addresses and the values are arrays of currency amounts they hold. The issuer (omitted from the currency amounts) is the account from the request."
"description": "Amounts issued to the \"hotwallet\" accounts from the request. The keys are the accounts' addresses, and the values are arrays of currency amounts they hold. The issuer (omitted from the currency amounts) is the account from the request."
},
"assets": {
"type": "array",

View File

@@ -20,7 +20,7 @@
"closeFlags": {
"type": "integer",
"minimum": 0,
"description": "A bit-map of flags relating to the closing of this ledger. Currently, the ledger has only one flag defined for `closeFlags`: **sLCF_NoConsensusTime** (value 1). If this flag is enabled, it means that validators were in conflict regarding the correct close time for the ledger, but built otherwise the same ledger, so they declared consensus while \"agreeing to disagree\" on the close time. In this case, the consensus ledger contains a `closeTime` value that is 1 second after that of the previous ledger. (In this case, there is no official close time, but the actual real-world close time is probably 3-6 seconds later than the specified `closeTime`.)"
"description": "A bit-map of flags relating to the closing of this ledger. Currently, the ledger has only one flag defined for `closeFlags`: **sLCF_NoConsensusTime** (value 1). If this flag is enabled, it means that validators disagreed on the correct close time for the ledger, but built otherwise the same ledger, so they declared consensus while \"agreeing to disagree\" on the close time. In this case, the consensus ledger contains a `closeTime` value that is 1 second after that of the previous ledger. (In this case, there is no official close time, but the actual real-world close time is probably 3-6 seconds later than the specified `closeTime`.)"
},
"ledgerHash": {
"$ref": "hash256",

View File

@@ -30,7 +30,7 @@
},
"publicKey": {
"$ref": "publicKey",
"description": "Public key of the key pair the source will use to sign claims against this channel."
"description": "Public key of the key pair the source uses to sign claims against this channel."
},
"cancelAfter": {
"type": "string",

View File

@@ -18,7 +18,7 @@
},
"ioLatencyMs": {
"type": "number",
"description": "Amount of time spent waiting for I/O operations to be performed, in milliseconds. If this number is not very, very low, then the rippled server is probably having serious load issues."
"description": "Amount of time spent waiting for I/O operations, in milliseconds. If this number is not very, very low, then the rippled server is probably having serious load issues."
},
"load": {
"type": "object",
@@ -26,7 +26,7 @@
"properties": {
"jobTypes": {
"type": "array",
"description": "*(Admin only)* Information about the rate of different types of jobs being performed by the server and how much time it spends on each.",
"description": "*(Admin only)* Information about the rate of different types of jobs the server is doing and how much time it spends on each.",
"items": {"type": "object"}
},
"threads": {
@@ -62,7 +62,7 @@
},
"pubkeyNode": {
"type": "string",
"description": "Public key used to verify this node for internal communications; this key is automatically generated by the server the first time it starts up. (If deleted, the node can just create a new pair of keys.)"
"description": "Public key used to verify this node for internal communications; this key is automatically generated by the server the first time it starts up."
},
"pubkeyValidator": {
"type": "string",
@@ -70,7 +70,7 @@
},
"serverState": {
"type": "string",
"description": "A string indicating to what extent the server is participating in the network. See [Possible Server States](https://developers.ripple.com/rippled-server-states.html) for more details.",
"description": "A string indicating to what extent the server is participating in the network. See [Possible Server States](https://xrpl.org/rippled-server-states.html) for more details.",
"enum": ["disconnected", "connected", "syncing", "tracking", "full", "validating", "proposing"]
},
"validatedLedger": {
@@ -96,12 +96,12 @@
},
"reserveIncrementXRP": {
"$ref": "value",
"description": "Amount of XRP added to the account reserve for each object an account is responsible for in the ledger."
"description": "Amount of XRP added to the account reserve for each object an account owns in the ledger."
},
"ledgerVersion": {
"type": "integer",
"minimum": 0,
"description": "Identifying sequence number of this ledger version."
"description": "Identifying ledger index of this ledger version."
}
},
"additionalProperties": false,
@@ -109,7 +109,7 @@
},
"validationQuorum": {
"type": "number",
"description": "Minimum number of trusted validations required in order to validate a ledger version. Some circumstances may cause the server to require more validations."
"description": "Minimum number of trusted validations required to validate a ledger version. Some circumstances may cause the server to require more validations."
}
},
"required": ["buildVersion", "completeLedgers", "hostID", "ioLatencyMs", "lastClose", "loadFactor", "peers", "pubkeyNode", "serverState", "validatedLedger", "validationQuorum"],

View File

@@ -6,13 +6,13 @@
"properties": {
"specification": {
"$ref": "trustline",
"description": "A trustline specification that would produce this trustline in its current state."
"description": "A trust line specification that would produce this trust line in its current state."
},
"counterparty": {
"properties": {
"limit": {
"$ref": "value",
"description": "The maximum amount that the counterparty can be owed through the trustline."
"description": "The maximum amount that the counterparty can be owed through the trust line."
},
"ripplingDisabled": {
"type": "boolean",
@@ -20,7 +20,7 @@
},
"frozen": {
"type": "boolean",
"description": "If true, the trustline is frozen, which means that funds can only be sent to the counterparty."
"description": "If true, the trust line is frozen, which means that funds can only be sent directly to the counterparty."
},
"authorized": {
"type": "boolean",
@@ -35,10 +35,10 @@
"properties": {
"balance": {
"$ref": "signedValue",
"description": "The balance on the trustline, representing which party owes the other and by how much."
"description": "The balance on the trust line, representing which party owes the other and by how much."
}
},
"description": "Properties of the trustline regarding it's current state that are not part of the specification.",
"description": "Non-settings details of the trust line's state.",
"required": ["balance"],
"additionalProperties": false
}

View File

@@ -6,7 +6,7 @@
"properties": {
"result": {
"type": "string",
"description": "Result code returned by rippled. See [Transaction Results](https://developers.ripple.com/transaction-results.html) for a complete list."
"description": "Result code returned by rippled. See [Transaction Results](https://xrpl.org/transaction-results.html) for a complete list."
},
"timestamp": {
"type": "string",

View File

@@ -14,7 +14,7 @@
"properties": {
"fee": {
"$ref": "value",
"description": "The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide."
"description": "The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee is multiplied by (N+1), where N is the number of signatures you plan to provide."
},
"sequence": {
"$ref": "sequence",

View File

@@ -13,7 +13,7 @@
},
"engine_result": {
"type": "string",
"description": "Code indicating the preliminary result of the transaction, for example `tesSUCCESS`. [List of transaction responses](https://developers.ripple.com/transaction-results.html)"
"description": "Code indicating the preliminary result of the transaction, for example `tesSUCCESS`. [List of transaction responses](https://xrpl.org/transaction-results.html)"
},
"engine_result_code": {
"type": "integer",

View File

@@ -15,7 +15,8 @@
"destinationXAddress": {
"$ref": "address",
"description": "X-address of an account to receive any leftover XRP after deleting the sending account. Must be a funded account in the ledger, and must not be the sending account."
}
},
"memos": {"$ref": "memos"}
},
"anyOf": [
{

View File

@@ -7,7 +7,8 @@
"checkID": {
"$ref": "hash256",
"description": "The ID of the Check ledger object to cancel, as a 64-character hexadecimal string."
}
},
"memos": {"$ref": "memos"}
},
"required": ["checkID"],
"additionalProperties": false

View File

@@ -15,7 +15,8 @@
"deliverMin": {
"$ref": "laxAmount",
"description": "Redeem the Check for at least this amount and for as much as possible. The currency must match that of the sendMax of the corresponding CheckCreate transaction. You must provide either this field or amount."
}
},
"memos": {"$ref": "memos"}
},
"required": ["checkID"],
"oneOf": [

View File

@@ -24,7 +24,8 @@
"invoiceID": {
"$ref": "hash256",
"description": "256-bit hash, as a 64-character hexadecimal string, representing a specific reason or identifier for this check."
}
},
"memos": {"$ref": "memos"}
},
"required": ["destination", "sendMax"],
"additionalProperties": false

View File

@@ -11,7 +11,8 @@
"unauthorize": {
"$ref": "address",
"description": "Address of the account that can cash the check."
}
},
"memos": {"$ref": "memos"}
},
"oneOf": [
{"required": ["authorize"]},

View File

@@ -22,7 +22,7 @@
"$ref": "hash256"
},
"allowPartialPayment": {
"description": "If true, this payment should proceed even if the whole amount cannot be delivered due to a lack of liquidity or a lack of funds in the source account.",
"description": "If true, this payment can deliver less than the full amount.",
"type": "boolean"
},
"noDirectRipple": {

View File

@@ -19,14 +19,14 @@
},
"immediateOrCancel": {
"type": "boolean",
"description": "Treat the offer as an [Immediate or Cancel order](http://en.wikipedia.org/wiki/Immediate_or_cancel). If enabled, the offer will never become a ledger node: it only attempts to match existing offers in the ledger. This cannot be used with `fillOrKill`."
"description": "Treat the offer as an [Immediate or Cancel order](http://en.wikipedia.org/wiki/Immediate_or_cancel). If enabled, do not create an object in the ledger that can be matched later: instead, only execute as much as can be fulfilled immediately. This cannot be used with `fillOrKill`."
},
"fillOrKill": {
"type": "boolean",
"description": "Treat the offer as a [Fill or Kill order](http://en.wikipedia.org/wiki/Fill_or_kill). Only attempt to match existing offers in the ledger, and only do so if the entire quantity can be exchanged. This cannot be used with `immediateOrCancel`."
},
"passive": {
"description": "If enabled, the offer will not consume offers that exactly match it, and instead becomes an Offer node in the ledger. It will still consume offers that cross it.",
"description": "If enabled, the offer does not consume offers that exactly match it, and instead becomes an Offer node in the ledger. It still consumes offers that cross it.",
"type": "boolean"
},
"expirationTime": {

View File

@@ -31,7 +31,8 @@
"close": {
"type": "boolean",
"description": "Request to close the channel. If the channel has no XRP remaining or the destination address requests it, closes the channel immediately (returning unclaimed XRP to the source address). Otherwise, sets the channel to expire after settleDelay seconds have passed."
}
},
"memos": {"$ref": "memos"}
},
"required": ["channel"],
"additionalProperties": false

View File

@@ -32,7 +32,8 @@
"destinationTag": {
"$ref": "tag",
"description": "Destination tag."
}
},
"memos": {"$ref": "memos"}
},
"required": ["amount", "destination", "settleDelay", "publicKey"],
"additionalProperties": false

View File

@@ -16,7 +16,8 @@
"type": "string",
"format": "date-time",
"description": "New expiration for this channel. (This does not change the cancelAfter expiration, if the channel has one.) Cannot move the expiration sooner than settleDelay seconds from time of the request."
}
},
"memos": {"$ref": "memos"}
},
"required": ["amount", "channel"],
"additionalProperties": false

View File

@@ -22,7 +22,7 @@
"$ref": "hash256"
},
"allowPartialPayment": {
"description": "If true, this payment should proceed even if the whole amount cannot be delivered due to a lack of liquidity or a lack of funds in the source account.",
"description": "If true, this payment can deliver less than the full amount.",
"type": "boolean"
},
"noDirectRipple": {

View File

@@ -33,8 +33,9 @@ export type GetServerInfoResponse = {
networkLedger?: string
}
function renameKeys(object, mapping) {
_.forEach(mapping, (to, from) => {
function renameKeys(object: Record<string, any>, mapping: Record<string, any>) {
Object.entries(mapping).forEach(entry => {
const [from, to] = entry;
object[to] = object[from]
delete object[from]
})
@@ -62,15 +63,19 @@ function getServerInfo(this: RippleAPI): Promise<GetServerInfoResponse> {
// This is a public API that can be called directly.
// This is not used by the `prepare*` methods. See `src/transaction/utils.ts`
async function getFee(this: RippleAPI, cushion?: number): Promise<string> {
if (cushion === undefined) {
if (cushion == null) {
cushion = this._feeCushion
}
if (cushion === undefined) {
if (cushion == null) {
cushion = 1.2
}
const serverInfo = (await this.request('server_info')).info
const baseFeeXrp = new BigNumber(serverInfo.validated_ledger.base_fee_xrp)
if (serverInfo.load_factor == null) {
// https://github.com/ripple/rippled/issues/3812#issuecomment-816871100
serverInfo.load_factor = 1
}
let fee = baseFeeXrp.times(serverInfo.load_factor).times(cushion)
// Cap fee to `this._maxFeeXRP`

View File

@@ -10,12 +10,6 @@ export interface Ledger {
total_coins: string
transaction_hash: string
transactions: string[] | object[]
// @deprecated
seqNum?: string
// @deprecated
totalCoins?: string
// @deprecated
hash?: string
close_flags?: number
parent_close_time?: number
accountState?: any[]

View File

@@ -1,8 +1,9 @@
import * as _ from 'lodash'
import BigNumber from 'bignumber.js'
import {deriveKeypair} from 'ripple-keypairs'
import {Amount, RippledAmount} from './types/objects'
import {RippledAmount} from './types/objects'
import {ValidationError} from './errors'
import {xAddressToClassicAddress} from 'ripple-address-codec'
function isValidSecret(secret: string): boolean {
try {
@@ -105,20 +106,31 @@ function xrpToDrops(xrp: BigNumber.Value): string {
.toString(10)
}
function toRippledAmount(amount: Amount): RippledAmount {
function toRippledAmount(amount: RippledAmount): RippledAmount {
if (typeof amount === 'string')
return amount;
if (amount.currency === 'XRP') {
return xrpToDrops(amount.value)
}
if (amount.currency === 'drops') {
return amount.value
}
let issuer = amount.counterparty || amount.issuer
let tag: number | false = false;
try {
({classicAddress: issuer, tag} = xAddressToClassicAddress(issuer))
} catch (e) { /* not an X-address */ }
if (tag !== false) {
throw new ValidationError("Issuer X-address includes a tag")
}
return {
currency: amount.currency,
issuer: amount.counterparty
? amount.counterparty
: amount.issuer
? amount.issuer
: undefined,
issuer,
value: amount.value
}
}
@@ -127,9 +139,8 @@ function convertKeysFromSnakeCaseToCamelCase(obj: any): any {
if (typeof obj === 'object') {
const accumulator = Array.isArray(obj) ? [] : {}
let newKey
return _.reduce(
obj,
(result, value, key) => {
return Object.entries(obj).reduce(
(result, [key, value]) => {
newKey = key
// taking this out of function leads to error in PhantomJS
const FINDSNAKE = /([a-zA-Z]_[a-zA-Z])/g
@@ -146,7 +157,7 @@ function convertKeysFromSnakeCaseToCamelCase(obj: any): any {
}
function removeUndefined<T extends object>(obj: T): T {
return _.omitBy(obj, _.isUndefined) as T
return _.omitBy(obj, value => value == null) as T
}
/**

View File

@@ -8,9 +8,9 @@ function error(text) {
function validateLedgerRange(options) {
if (
!_.isUndefined(options) &&
!_.isUndefined(options.minLedgerVersion) &&
!_.isUndefined(options.maxLedgerVersion)
options != null &&
options.minLedgerVersion != null &&
options.maxLedgerVersion != null
) {
if (Number(options.minLedgerVersion) > Number(options.maxLedgerVersion)) {
throw error('minLedgerVersion must not be greater than maxLedgerVersion')

View File

@@ -4,5 +4,7 @@ export * from './transaction/types'
export * from './common/types/objects/ledger'
export * from './offline/utils';
// Broadcast api is experimental
export {RippleAPIBroadcast} from './broadcast'

View File

@@ -18,29 +18,38 @@ export type GetBalanceSheet = {
}>
}
function formatBalanceSheet(balanceSheet): GetBalanceSheet {
type BalanceSheet = {
account: string,
assets?: Record<string, any>,
balances?: Record<string, any>,
obligations?: Record<string, string>,
ledger_current_index?: number,
validated?: boolean
}
function formatBalanceSheet(balanceSheet: BalanceSheet): GetBalanceSheet {
const result: GetBalanceSheet = {}
if (!_.isUndefined(balanceSheet.balances)) {
if (balanceSheet.balances != null) {
result.balances = []
_.forEach(balanceSheet.balances, (balances, counterparty) => {
_.forEach(balances, (balance) => {
Object.entries(balanceSheet.balances).forEach(entry => {
const [counterparty, balances] = entry;
balances.forEach((balance) => {
result.balances.push(Object.assign({counterparty}, balance))
})
})
}
if (!_.isUndefined(balanceSheet.assets)) {
if (balanceSheet.assets != null) {
result.assets = []
_.forEach(balanceSheet.assets, (assets, counterparty) => {
_.forEach(assets, (balance) => {
Object.entries(balanceSheet.assets).forEach(([counterparty, assets]) => {
assets.forEach((balance) => {
result.assets.push(Object.assign({counterparty}, balance))
})
})
}
if (!_.isUndefined(balanceSheet.obligations)) {
result.obligations = _.map(
balanceSheet.obligations as {[key: string]: string},
(value, currency) => ({currency, value})
if (balanceSheet.obligations != null) {
result.obligations = Object.entries(balanceSheet.obligations as {[key: string]: string}).map(
([currency, value]) => ({currency, value})
)
}

View File

@@ -43,7 +43,7 @@ function getLedgerVersionHelper(
connection: Connection,
optionValue?: number
): Promise<number> {
if (optionValue !== undefined && optionValue !== null) {
if (optionValue != null && optionValue !== null) {
return Promise.resolve(optionValue)
}
return connection.getLedgerVersion()

View File

@@ -1,6 +1,7 @@
import * as assert from 'assert'
import {removeUndefined} from '../../common'
import {classicAddressToXAddress} from 'ripple-address-codec'
import {parseMemos} from './utils'
export type FormattedAccountDelete = {
// account (address) of an account to receive any leftover XRP after deleting the sending account.
@@ -21,11 +22,12 @@ function parseAccountDelete(tx: any): FormattedAccountDelete {
assert.ok(tx.TransactionType === 'AccountDelete')
return removeUndefined({
memos: parseMemos(tx),
destination: tx.Destination,
destinationTag: tx.DestinationTag,
destinationXAddress: classicAddressToXAddress(
tx.Destination,
tx.DestinationTag === undefined ? false : tx.DestinationTag,
tx.DestinationTag == null ? false : tx.DestinationTag,
false
)
})

View File

@@ -14,16 +14,16 @@ function parseAccountTrustline(trustline: Trustline): FormattedTrustline {
counterparty: trustline.account,
qualityIn: parseQuality(trustline.quality_in) || undefined,
qualityOut: parseQuality(trustline.quality_out) || undefined,
ripplingDisabled: trustline.no_ripple || undefined,
frozen: trustline.freeze || undefined,
authorized: trustline.authorized || undefined
ripplingDisabled: trustline.no_ripple,
frozen: trustline.freeze,
authorized: trustline.authorized
})
// rippled doesn't provide the counterparty's qualities
const counterparty = removeUndefined({
limit: trustline.limit_peer,
ripplingDisabled: trustline.no_ripple_peer || undefined,
frozen: trustline.freeze_peer || undefined,
authorized: trustline.peer_authorized || undefined
ripplingDisabled: trustline.no_ripple_peer,
frozen: trustline.freeze_peer,
authorized: trustline.peer_authorized
})
const state = {
balance: trustline.balance

View File

@@ -1,8 +1,10 @@
import * as assert from 'assert'
import {parseMemos} from './utils'
function parseOrderCancellation(tx: any): object {
assert.ok(tx.TransactionType === 'OfferCancel')
return {
memos: parseMemos(tx),
orderSequence: tx.OfferSequence
}
}

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