Compare commits

..

30 Commits

Author SHA1 Message Date
Mayukha Vadari
1b857cee98 one more update 2021-12-01 15:16:03 -05:00
Mayukha Vadari
3793012acd update rbc 2021-12-01 14:06:32 -05:00
Mayukha Vadari
515407bdaf update keypairs 2021-12-01 13:54:58 -05:00
Mayukha Vadari
23a15e416c update beta version 2021-12-01 13:11:35 -05:00
Mayukha Vadari
8ff9ebe276 edit address-codec and keypairs versions 2021-12-01 13:11:22 -05:00
Elliot Lee
dcf3473f1c bump version to 1.9.8-storm.1 2021-12-01 09:51:33 -08:00
Elliot Lee
ac99b3e25c bump ripple-binary-codec to 1.1.4-beta.1 2021-12-01 09:50:05 -08:00
natenichols
d6da4f820e publish a branch for data team's legacy process 2021-12-01 10:46:48 -06: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
173 changed files with 1889 additions and 1604 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.
-->

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

@@ -0,0 +1,57 @@
# 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'] }}

View File

@@ -2,6 +2,30 @@
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.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

View File

@@ -135,7 +135,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://xrplcluster.com'
server: 'wss://xrplcluster.com' // Public cluster
});
api.on('error', (errorCode, errorMessage) => {
console.log(errorCode + ': ' + errorMessage);
@@ -145,7 +145,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(() => {
@@ -166,7 +166,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
@@ -204,9 +204,9 @@ After you have installed ripple-lib, you can create scripts using the [boilerpla
## 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;
@@ -263,7 +263,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`.
@@ -300,7 +300,7 @@ Name | Type | Description
---- | ---- | -----------
currency | [currency](#currency) | The three-character code or hexadecimal string used to denote currencies, or "drops" for the smallest unit of XRP.
counterparty | [address](#address) | *Optional* The XRP Ledger address of the account that owes or is owed the funds (omitted if `currency` is "XRP" or "drops")
value | [value](#value) | *Optional* The quantity of the currency, denoted as a string to retain floating point precision
value | [value](#value) | *Optional* The quantity of the currency, denoted as a string so that it does not lose precision
# Transaction Overview
@@ -310,14 +310,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.
@@ -353,7 +353,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
@@ -362,15 +362,15 @@ Transaction instructions indicate how to execute a transaction, complementary wi
Name | Type | Description
---- | ---- | -----------
fee | [value](#value) | *Optional* An exact fee to pay for the transaction, before multiplying for multi-signed transactions. See [Transaction Fees](#transaction-fees) for more information.
maxFee | [value](#value) | *Optional* 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.
maxLedgerVersion | integer,null | *Optional* 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'.
maxLedgerVersion | string,null | *Optional* 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'.
maxFee | [value](#value) | *Optional* 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.
maxLedgerVersion | integer,null | *Optional* 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'.
maxLedgerVersion | string,null | *Optional* 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'.
maxLedgerVersionOffset | integer | *Optional* Offset from current validated ledger version to highest ledger version that the transaction can be included in.
sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
signersCount | integer | *Optional* Number of signers that will be signing this transaction.
signersCount | integer | *Optional* Number of signers that can multi-sign this transaction.
ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The ticket sequence to be used for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
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
@@ -584,10 +584,10 @@ quantity | [amount](#amount) | The amount of currency to buy or sell.
totalPrice | [amount](#amount) | The total price to be paid for the `quantity` to be bought or sold.
expirationTime | date-time string | *Optional* Time after which the offer is no longer active, as an [ISO 8601 date-time](https://en.wikipedia.org/wiki/ISO_8601).
fillOrKill | boolean | *Optional* 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`.
immediateOrCancel | boolean | *Optional* 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`.
immediateOrCancel | boolean | *Optional* 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`.
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
orderToReplace | [sequence](#account-sequence-number) | *Optional* The [account sequence number](#account-sequence-number) of an order to cancel before the new order is created, effectively replacing the old order.
passive | boolean | *Optional* 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.
passive | boolean | *Optional* 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.
The following invalid flag combination causes a `ValidationError`: `immediateOrCancel` and `fillOrKill`. These fields are mutually exclusive, and cannot both be set at the same time.
@@ -649,7 +649,7 @@ destination | object | The destination of the funds to be sent.
*destination.* amount | [laxAmount](#amount) | An exact amount to deliver to the recipient. If the counterparty is not specified, amounts with any counterparty may be used. (This field cannot be used with `destination.minAmount`.)
*destination.* tag | integer | *Optional* An arbitrary 32-bit unsigned integer. It typically maps to an off-ledger account; for example, a hosted wallet or exchange account.
*destination.* minAmount | [laxAmount](#amount) | The minimum amount to be delivered. (This field cannot be used with destination.amount)
allowPartialPayment | boolean | *Optional* 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.
allowPartialPayment | boolean | *Optional* If true, this payment can deliver less than the full amount.
invoiceID | string | *Optional* A 256-bit hash that can be used to identify a particular payment.
limitQuality | boolean | *Optional* 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.
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
@@ -767,9 +767,9 @@ Change account settings. (Native transaction types: [AccountSet](https://xrpl.or
Name | Type | Description
---- | ---- | -----------
defaultRipple | boolean | *Optional* 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))
depositAuth | boolean | *Optional* 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))
disableMasterKey | boolean | *Optional* 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).
defaultRipple | boolean | *Optional* 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 | boolean | *Optional* 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 | boolean | *Optional* 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 | boolean | *Optional* Indicates that client applications should not send XRP to this account. Not enforced by rippled.
domain | string | *Optional* The domain that owns this account, as a hexadecimal string representing the ASCII for the domain in lowercase.
emailHash | string,null | *Optional* Hash of an email address to be used for generating an avatar image. Conventionally, clients use Gravatar to display this image. Use `null` to clear.
@@ -780,7 +780,7 @@ messageKey | string | *Optional* Public key for sending encrypted messages to th
noFreeze | boolean | *Optional* Permanently give up the ability to freeze individual trust lines. This flag can never be disabled after being enabled.
passwordSpent | boolean | *Optional* Indicates that the account has used its free SetRegularKey transaction.
regularKey | [address](#address),null | *Optional* The public key of a new keypair, to use as the regular key to this account, as a base-58-encoded string in the same format as an account address. Use `null` to remove the regular key.
requireAuthorization | boolean | *Optional* If set, this account must individually approve other users in order for those users to hold this accounts issuances.
requireAuthorization | boolean | *Optional* If set, this account must individually give other users permission to hold this accounts issued tokens.
requireDestinationTag | boolean | *Optional* Requires incoming payments to specify a destination tag.
signers | object | *Optional* Settings that determine what sets of accounts can be used to sign a transaction on behalf of this account using multisigning.
*signers.* threshold | integer | A target number for the signer weights. A multi-signature from this list is valid only if the sum weights of the signatures provided is equal or greater than this value. To delete the signers setting, use the value `0`.
@@ -797,7 +797,7 @@ walletLocator | string,null | *Optional* Transaction hash or any other 64 charac
```json
{
"domain": "ripple.com",
"domain": "example.com",
"memos": [
{
"type": "test",
@@ -860,16 +860,16 @@ ripplingDisabled | boolean | *Optional* If true, payments cannot ripple through
# 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
@@ -928,7 +928,7 @@ 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).
## request
@@ -936,7 +936,7 @@ For full details, see [rippled Subscriptions](https://ripple.com/build/rippled-a
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).
@@ -960,20 +960,16 @@ return api.request('ledger', {
```json
{
"ledger": {
"accepted": true,
"account_hash": "F9E9653EA76EA0AEA58AC98A8E19EDCEC8299C2940519A190674FFAED3639A1F",
"close_flags": 0,
"close_time": 577999430,
"close_time_human": "2018-Apr-25 19:23:50",
"close_time_resolution": 10,
"closed": true,
"hash": "450E5CB0A39495839DA9CD9A0FED74BD71CBB929423A907ADC00F14FC7E7F920",
"ledger_hash": "450E5CB0A39495839DA9CD9A0FED74BD71CBB929423A907ADC00F14FC7E7F920",
"ledger_index": "38217406",
"parent_close_time": 577999422,
"parent_hash": "B8B364C63EB9E13FDB89CB729FEF833089B8438CBEB8FC41744CB667209221B3",
"seqNum": "38217406",
"totalCoins": "99992286058637091",
"total_coins": "99992286058637091",
"transaction_hash": "5BDD3D2780C28FB2C91C3404BD8ED04786B764B1E18CF319888EDE2C09834726"
},
@@ -992,7 +988,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
@@ -1020,13 +1016,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
@@ -1092,7 +1088,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
@@ -1158,7 +1154,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
@@ -1199,7 +1195,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:
@@ -1230,7 +1226,7 @@ asks[] | object | An order in the order book.
**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
@@ -1542,24 +1538,24 @@ Name | Type | Description
buildVersion | string | The version number of the running rippled version.
completeLedgers | string | Range expression indicating the sequence numbers of the ledger versions the local rippled has in its database. It is possible to be a disjoint sequence, e.g. “2500-5000,32570-7695432”.
hostID | string | On an admin request, returns the hostname of the server running the rippled instance; otherwise, returns a unique four letter word.
ioLatencyMs | number | 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.
ioLatencyMs | number | 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.
lastClose | object | Information about the last time the server closed a ledger.
*lastClose.* convergeTimeS | number | The time it took to reach a consensus for the last ledger closing, in seconds.
*lastClose.* proposers | integer | Number of trusted validators participating in the ledger closing.
loadFactor | number | The load factor the server is currently enforcing, as a multiplier on the base transaction fee. The load factor is determined by the highest of the individual servers load factor, clusters load factor, and the overall networks load factor.
peers | integer | How many other rippled servers the node is currently connected to.
pubkeyNode | string | 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.)
serverState | string | 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.
pubkeyNode | string | Public key used to verify this node for internal communications; this key is automatically generated by the server the first time it starts up.
serverState | string | 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.
validatedLedger | object | Information about the fully-validated ledger with the highest sequence number (the most recent).
*validatedLedger.* age | integer | The time since the ledger was closed, in seconds.
*validatedLedger.* baseFeeXRP | [value](#value) | Base fee, in XRP. This may be represented in scientific notation such as 1e-05 for 0.00005.
*validatedLedger.* hash | string | Unique hash for the ledger, as an uppercase hexadecimal string.
*validatedLedger.* reserveBaseXRP | [value](#value) | Minimum amount of XRP necessary for every account to keep in reserve.
*validatedLedger.* reserveIncrementXRP | [value](#value) | Amount of XRP added to the account reserve for each object an account is responsible for in the ledger.
*validatedLedger.* ledgerVersion | integer | Identifying sequence number of this ledger version.
validationQuorum | number | Minimum number of trusted validations required in order to validate a ledger version. Some circumstances may cause the server to require more validations.
*validatedLedger.* reserveIncrementXRP | [value](#value) | Amount of XRP added to the account reserve for each object an account owns in the ledger.
*validatedLedger.* ledgerVersion | integer | Identifying ledger index of this ledger version.
validationQuorum | number | Minimum number of trusted validations required to validate a ledger version. Some circumstances may cause the server to require more validations.
load | object | *Optional* *(Admin only)* Detailed information about the current load state of the server.
*load.* jobTypes | array\<object\> | *(Admin only)* Information about the rate of different types of jobs being performed by the server and how much time it spends on each.
*load.* jobTypes | array\<object\> | *(Admin only)* Information about the rate of different types of jobs the server is doing and how much time it spends on each.
*load.* threads | number | *(Admin only)* The number of threads in the servers main job pool, performing various operations.
pubkeyValidator | string | *Optional* *(Admin only)* Public key used by this node to sign ledger validations.
@@ -1603,7 +1599,7 @@ return api.getServerInfo().then(info => {/* ... */});
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
@@ -1663,7 +1659,7 @@ Retrieves a transaction by its [Transaction ID](#transaction-id).
Name | Type | Description
---- | ---- | -----------
id | [transactionHash](#transaction-id) | A hash of a transaction used to identify the transaction, represented in hexadecimal.
options | object | *Optional* Options to limit the ledger versions to search and/or to include raw transaction data.
options | object | *Optional* Options to limit the ledger versions to search or include raw transaction data.
*options.* includeRawTransaction | object | *Optional* Include raw transaction data. For advanced users; exercise caution when interpreting this data.
*options.* maxLedgerVersion | integer | *Optional* The highest ledger version to search. This must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*options.* maxLedgerVersion | string | *Optional* The highest ledger version to search. This must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
@@ -1682,7 +1678,7 @@ sequence | [sequence](#account-sequence-number) | The account sequence number of
type | [transactionType](#transaction-types) | The type of the transaction.
specification | object | A specification that would produce the same outcome as this transaction. *Exception:* For payment transactions, this omits the `destination.amount` field, to prevent misunderstanding. The structure of the specification depends on the value of the `type` field (see [Transaction Types](#transaction-types) for details). *Note:* This is **not** necessarily the same as the original specification.
outcome | object | The outcome of the transaction (what effects it had).
*outcome.* result | string | Result code returned by rippled. See [Transaction Results](https://developers.ripple.com/transaction-results.html) for a complete list.
*outcome.* result | string | Result code returned by rippled. See [Transaction Results](https://xrpl.org/transaction-results.html) for a complete list.
*outcome.* fee | [value](#value) | The XRP fee that was charged for the transaction.
*outcome.balanceChanges.* \* | array\<[balance](#amount)\> | Key is the XRP Ledger address; value is an array of signed amounts representing changes of balances for that address.
*outcome.orderbookChanges.* \* | array | Key is the maker's XRP Ledger address; value is an array of changes
@@ -1816,10 +1812,10 @@ Name | Type | Description
---- | ---- | -----------
address | [address](#address) | The address of the account to get transactions for.
options | object | *Optional* Options to filter the resulting transactions.
*options.* binary | boolean | *Optional* If true, the transactions will be sent from the server in a condensed binary format rather than JSON.
*options.* binary | boolean | *Optional* If true, return transactions in binary format rather than JSON.
*options.* counterparty | [address](#address) | *Optional* If provided, only return transactions with this account as a counterparty to the transaction.
*options.* earliestFirst | boolean | *Optional* If true, sort transactions so that the earliest ones come first. By default, the newest transactions will come first.
*options.* excludeFailures | boolean | *Optional* If true, the result will omit transactions that did not succeed.
*options.* earliestFirst | boolean | *Optional* If true, sort transactions so that the earliest ones come first. By default, the newest transactions come first.
*options.* excludeFailures | boolean | *Optional* If true, the result omits transactions that did not succeed.
*options.* includeRawTransactions | object | *Optional* Include raw transaction data. For advanced users; exercise caution when interpreting this data.
*options.* initiated | boolean | *Optional* If true, return only transactions initiated by the account specified by `address`. If false, return only transactions not initiated by the account specified by `address`.
*options.* limit | integer | *Optional* If specified, return at most this many transactions.
@@ -1827,7 +1823,7 @@ options | object | *Optional* Options to filter the resulting transactions.
*options.* maxLedgerVersion | string | *Optional* Return only transactions in this ledger version or lower.
*options.* minLedgerVersion | integer | *Optional* Return only transactions in this ledger version or higher.
*options.* minLedgerVersion | string | *Optional* Return only transactions in this ledger version or higher.
*options.* start | string | *Optional* 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.
*options.* start | string | *Optional* 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.
*options.* types | array\<[transactionType](#transaction-types)\> | *Optional* Only return transactions of the specified [Transaction Types](#transaction-types).
### Return Value
@@ -2062,14 +2058,14 @@ This method returns a promise that resolves with an array of objects with the fo
Name | Type | Description
---- | ---- | -----------
specification | [trustline](#trustline) | A trustline specification that would produce this trustline in its current state.
specification | [trustline](#trustline) | A trust line specification that would produce this trust line in its current state.
counterparty | object | Properties of the trustline from the perspective of the counterparty.
*counterparty.* limit | [value](#value) | The maximum amount that the counterparty can be owed through the trustline.
*counterparty.* limit | [value](#value) | The maximum amount that the counterparty can be owed through the trust line.
*counterparty.* authorized | boolean | *Optional* If true, the counterparty authorizes this party to hold issuances from the counterparty.
*counterparty.* frozen | boolean | *Optional* If true, the trustline is frozen, which means that funds can only be sent to the counterparty.
*counterparty.* frozen | boolean | *Optional* If true, the trust line is frozen, which means that funds can only be sent directly to the counterparty.
*counterparty.* ripplingDisabled | boolean | *Optional* If true, payments cannot ripple through this trustline.
state | object | Properties of the trustline regarding it's current state that are not part of the specification.
*state.* balance | [signedValue](#value) | The balance on the trustline, representing which party owes the other and by how much.
state | object | Non-settings details of the trust line's state.
*state.* balance | [signedValue](#value) | The balance on the trust line, representing which party owes the other and by how much.
### Example
@@ -2361,7 +2357,7 @@ Returns aggregate balances by currency plus a breakdown of assets and obligation
Name | Type | Description
---- | ---- | -----------
address | [address](#address) | The XRP Ledger address of the account to get the balance sheet of.
options | object | *Optional* Options to determine how the balances will be calculated.
options | object | *Optional* Options to determine how the balances are calculated.
*options.* excludeAddresses | array\<[address](#address)\> | *Optional* Addresses to exclude from the balance totals.
*options.* ledgerVersion | integer | *Optional* Get the balance sheet as of this historical ledger version.
*options.* ledgerVersion | string | *Optional* Get the balance sheet as of this historical ledger version.
@@ -2373,7 +2369,7 @@ This method returns a promise that resolves with an object with the following st
Name | Type | Description
---- | ---- | -----------
assets | array\<[amount](#amount)\> | *Optional* Total amounts held that are issued by others. For the recommended gateway configuration, there should be none.
balances | array\<[amount](#amount)\> | *Optional* 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.
balances | array\<[amount](#amount)\> | *Optional* 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.
obligations | array | *Optional* Total amounts issued to accounts that are not hot wallets, as a map of currencies to the total value issued.
obligations[] | object | An amount that is owed.
*obligations[].* currency | [currency](#currency) | The three-character code or hexadecimal string used to denote currencies
@@ -2458,7 +2454,7 @@ Name | Type | Description
---- | ---- | -----------
pathfind | object | Specification of a pathfind request.
*pathfind.* source | object | Properties of the source of funds.
*pathfind.source.* address | [address](#address) | The XRP Ledger address of the account where funds will come from.
*pathfind.source.* address | [address](#address) | The XRP Ledger address of the planned sender.
*pathfind.source.* amount | [laxAmount](#amount) | *Optional* The amount of funds to send.
*pathfind.source.* currencies | array | *Optional* An array of currencies (with optional counterparty) that may be used in the payment paths.
*pathfind.source.* currencies[] | object | A currency with optional counterparty.
@@ -2578,10 +2574,10 @@ Returns open orders for the specified account. Open orders are orders that have
Name | Type | Description
---- | ---- | -----------
address | [address](#address) | The XRP Ledger address of the account to get open orders for.
options | object | *Optional* Options that determine what orders will be returned.
options | object | *Optional* Options that determine what orders to return.
*options.* ledgerVersion | integer | *Optional* Return orders as of this historical ledger version.
*options.* ledgerVersion | string | *Optional* Return orders as of this historical ledger version.
*options.* limit | integer | *Optional* At most this many orders will be returned.
*options.* limit | integer | *Optional* Return at most this many orders.
### Return Value
@@ -2964,8 +2960,8 @@ Name | Type | Description
---- | ---- | -----------
address | [address](#address) | Address of an account to use as point-of-view. (This affects which unfunded offers are returned.)
orderbook | object | The order book to get.
*orderbook.* base | object | A currency-counterparty pair, or just currency if it's XRP
*orderbook.* counter | object | A currency-counterparty pair, or just currency if it's XRP
*orderbook.* base | object | The currency code, and the counterparty if it's not XRP.
*orderbook.* counter | object | The currency code, and the counterparty if it's not XRP.
options | object | *Optional* Options to determine what to return.
*options.* ledgerVersion | integer | *Optional* Return the order book as of this historical ledger version.
*options.* ledgerVersion | string | *Optional* Return the order book as of this historical ledger version.
@@ -2973,7 +2969,7 @@ options | object | *Optional* Options to determine what to return.
### 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:
Name | Type | Description
---- | ---- | -----------
@@ -3002,7 +2998,7 @@ asks[] | object | An order in the order book.
**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
@@ -4071,13 +4067,13 @@ options | object | *Optional* Options that affect what to return.
### 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.
Name | Type | Description
---- | ---- | -----------
defaultRipple | boolean | *Optional* 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))
depositAuth | boolean | *Optional* 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))
disableMasterKey | boolean | *Optional* 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).
defaultRipple | boolean | *Optional* 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 | boolean | *Optional* 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 | boolean | *Optional* 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 | boolean | *Optional* Indicates that client applications should not send XRP to this account. Not enforced by rippled.
domain | string | *Optional* The domain that owns this account, as a hexadecimal string representing the ASCII for the domain in lowercase.
emailHash | string,null | *Optional* Hash of an email address to be used for generating an avatar image. Conventionally, clients use Gravatar to display this image. Use `null` to clear.
@@ -4088,7 +4084,7 @@ messageKey | string | *Optional* Public key for sending encrypted messages to th
noFreeze | boolean | *Optional* Permanently give up the ability to freeze individual trust lines. This flag can never be disabled after being enabled.
passwordSpent | boolean | *Optional* Indicates that the account has used its free SetRegularKey transaction.
regularKey | [address](#address),null | *Optional* The public key of a new keypair, to use as the regular key to this account, as a base-58-encoded string in the same format as an account address. Use `null` to remove the regular key.
requireAuthorization | boolean | *Optional* If set, this account must individually approve other users in order for those users to hold this accounts issuances.
requireAuthorization | boolean | *Optional* If set, this account must individually give other users permission to hold this accounts issued tokens.
requireDestinationTag | boolean | *Optional* Requires incoming payments to specify a destination tag.
signers | object | *Optional* Settings that determine what sets of accounts can be used to sign a transaction on behalf of this account using multisigning.
*signers.* threshold | integer | A target number for the signer weights. A multi-signature from this list is valid only if the sum weights of the signatures provided is equal or greater than this value. To delete the signers setting, use the value `0`.
@@ -4540,7 +4536,7 @@ previousAffectingTransactionLedgerVersion | string | The ledger version that the
cancelAfter | date-time string | *Optional* Time when this channel expires as specified at creation.
destinationTag | integer | *Optional* Destination tag.
expiration | date-time string | *Optional* Time when this channel expires.
publicKey | string | *Optional* Public key of the key pair the source will use to sign claims against this channel.
publicKey | string | *Optional* Public key of the key pair the source uses to sign claims against this channel.
sourceTag | integer | *Optional* Source tag.
### Example
@@ -4578,9 +4574,9 @@ Returns header information for the specified ledger (or the most recent validate
Name | Type | Description
---- | ---- | -----------
options | object | *Optional* Options affecting what ledger and how much data to return.
*options.* includeAllData | boolean | *Optional* Include full transactions and/or state information if `includeTransactions` and/or `includeState` is set.
*options.* includeState | boolean | *Optional* 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.
*options.* includeTransactions | boolean | *Optional* 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.
*options.* includeAllData | boolean | *Optional* Include the details of the transactions or state information if `includeTransactions` or `includeState` is set.
*options.* includeState | boolean | *Optional* 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.
*options.* includeTransactions | boolean | *Optional* 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.
*options.* ledgerHash | string | *Optional* Get ledger data for this historical ledger hash.
*options.* ledgerVersion | integer | *Optional* Get ledger data for this historical ledger version.
*options.* ledgerVersion | string | *Optional* Get ledger data for this historical ledger version.
@@ -4594,7 +4590,7 @@ Name | Type | Description
stateHash | string | Hash of all state information in this ledger.
closeTime | date-time string | The approximate time when this ledger was closed. This number is rounded based on the `closeTimeResolution`. If it would have been rounded to the same time as a previous ledger, the close time is recorded as 1 second later instead.
closeTimeResolution | integer | A number of seconds, indicating how much the `closeTime` could be rounded. Ledger close times are approximate so that small differences in servers clocks don't hinder consensus.
closeFlags | integer | 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`.)
closeFlags | integer | 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 | string | Unique identifying hash of the entire ledger.
ledgerVersion | integer | The ledger version of this ledger.
ledgerVersion | string | The ledger version of this ledger.
@@ -4635,7 +4631,7 @@ return api.getLedger()
`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
@@ -4671,9 +4667,9 @@ console.log(JSON.stringify(flags, null, 2))
`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.
@@ -4681,8 +4677,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
@@ -4696,7 +4692,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -4730,7 +4726,7 @@ async function preparedPreauth() {
`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
@@ -4752,7 +4748,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -4804,7 +4800,7 @@ return api.preparePayment(address, payment).then(prepared => {
`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
@@ -4826,7 +4822,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -4873,7 +4869,7 @@ return api.prepareTrustline(address, trustline).then(prepared =>
`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
@@ -4895,7 +4891,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -4942,7 +4938,7 @@ return api.prepareOrder(address, order)
`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
@@ -4964,7 +4960,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -4996,7 +4992,7 @@ return api.prepareOrderCancellation(address, orderCancellation)
`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
@@ -5018,7 +5014,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -5029,7 +5025,7 @@ instructions | object | The instructions for how to execute the transaction afte
```javascript
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
const settings = {
"domain": "ripple.com",
"domain": "example.com",
"memos": [
{
"type": "test",
@@ -5045,7 +5041,7 @@ return api.prepareSettings(address, settings)
```json
{
"domain": "ripple.com",
"domain": "example.com",
"memos": [
{
"type": "test",
@@ -5061,7 +5057,7 @@ return api.prepareSettings(address, settings)
`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
@@ -5089,7 +5085,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -5126,7 +5122,7 @@ return api.prepareEscrowCreation(address, escrowCreation).then(prepared =>
`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
@@ -5148,7 +5144,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -5183,7 +5179,7 @@ return api.prepareEscrowCancellation(address, escrowCancellation).then(prepared
`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
@@ -5205,7 +5201,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -5242,7 +5238,7 @@ return api.prepareEscrowExecution(address, escrowExecution).then(prepared =>
`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
@@ -5264,7 +5260,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -5301,7 +5297,7 @@ return api.preparePaymentChannelCreate(address, paymentChannelCreate).then(prepa
`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
@@ -5323,7 +5319,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -5357,7 +5353,7 @@ return api.preparePaymentChannelClaim(address, paymentChannelClaim).then(prepare
`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
@@ -5379,7 +5375,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -5414,7 +5410,7 @@ return api.preparePaymentChannelFund(address, paymentChannelFund).then(prepared
`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
@@ -5436,7 +5432,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -5474,7 +5470,7 @@ return api.prepareCheckCreate(address, checkCreate).then(prepared =>
`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
@@ -5496,7 +5492,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -5530,7 +5526,7 @@ return api.prepareCheckCancel(address, checkCancel).then(prepared =>
`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
@@ -5552,7 +5548,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -5590,7 +5586,7 @@ return api.prepareCheckCash(address, checkCash).then(prepared =>
`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.
@@ -5614,7 +5610,7 @@ Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | 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.
*instructions.* fee | [value](#value) | 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.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
@@ -5651,9 +5647,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`
@@ -5665,11 +5661,11 @@ txJSON | string | Transaction represented as a JSON string in rippled format.
keypair | object | *Optional* The private and public key of the account that is initiating the transaction. (This field cannot be used with secret).
*keypair.* privateKey | privateKey | The uppercase hexadecimal representation of the secp256k1 or Ed25519 private key.
*keypair.* publicKey | publicKey | The uppercase hexadecimal representation of the secp256k1 or Ed25519 public key.
options | object | *Optional* Options that control the type of signature that will be generated.
options | object | *Optional* Options that control the type of signature to create.
*options.* signAs | [address](#address) | *Optional* The account that the signature should count for in multisigning.
secret | secret string | *Optional* The secret of the account that is initiating the transaction. (This field cannot be used with keypair).
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
@@ -5683,7 +5679,8 @@ id | [transactionHash](#transaction-id) | The [Transaction ID](#transaction-id)
### 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);
@@ -5692,13 +5689,13 @@ return api.sign(txJSON, secret); // or: api.sign(txJSON, keypair);
```json
{
"signedTransaction": "12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D874473045022100BDE09A1F6670403F341C21A77CF35BA47E45CDE974096E1AA5FC39811D8269E702203D60291B9A27F1DCABA9CF5DED307B4F23223E0B6F156991DB601DFB9C41CE1C770A726970706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304",
"id": "02ACE87F1996E3A23690A5BB7F1774BF71CCBA68F79805831B42ABAD5913D6F4"
"signedTransaction": "12000322800000002400000017201B0086955368400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D8744630440220680070A157682D9EB510E8AD58C35DC9C8346B155077D73792E88120B7A3B6B1022079537D3300C9B4D2D3D62ACCE1E66CDA893F9612CB2577ADEC8154B933765336770B6578616D706C652E636F6D81145E7B112523F68D2F5E879DB4EAC51C6698A69304",
"id": "10B54D31384A49336C36A5907E3C28227139E282D3C7F734FEA351DE446F3674"
}
```
### Example (multisigning)
### Example (multi-signing)
```javascript
const RippleAPI = require('ripple-lib').RippleAPI;
@@ -5748,6 +5745,10 @@ const multiSignPaymentTransaction = {
Amount: '88000000'
};
const multiSignPaymentInstruction = {
signersCount: 2
};
const api = new RippleAPI({
server: 'wss://s.altnet.rippletest.net:51233'
});
@@ -5761,7 +5762,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
@@ -5780,8 +5781,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)]
```
@@ -5790,7 +5791,7 @@ If any of `{signAs: some_address}` options were missing the code will return a v
`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
@@ -5922,7 +5923,7 @@ options | object | *Optional* Options to control how the address and secret are
*options.* algorithm | string | *Optional* The digital signature algorithm to generate an address for. Can be `ecdsa-secp256k1` (default) or `ed25519`.
*options.* entropy | array\<integer\> | *Optional* The entropy to use to generate the seed. Must be an array of length 16 with values from 0-255 (16 bytes of entropy)
*options.* includeClassicAddress | boolean | *Optional* Specifies whether the classic address should also be included in the returned payload.
*options.* test | boolean | *Optional* 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`.
*options.* test | boolean | *Optional* 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`.
### Return Value
@@ -5963,8 +5964,8 @@ Name | Type | Description
options | object | *Optional* Options to control how the address and secret are generated.
*options.* algorithm | string | *Optional* The digital signature algorithm to generate an address for. Can be `ecdsa-secp256k1` (default) or `ed25519`.
*options.* entropy | array\<integer\> | *Optional* The entropy to use to generate the seed. Must be an array of length 16 with values from 0-255 (16 bytes of entropy)
*options.* includeClassicAddress | boolean | *Optional* If `true`, return the classic address, in addition to the X-address.
*options.* test | boolean | *Optional* 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`.
*options.* includeClassicAddress | boolean | *Optional* If `true`, also return the classic address.
*options.* test | boolean | *Optional* 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`.
### Return Value
@@ -6080,7 +6081,7 @@ var address = api.deriveAddress(public_key);
`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
@@ -6172,7 +6173,7 @@ ledger | object | The ledger header to hash.
*ledger.* stateHash | string | Hash of all state information in this ledger.
*ledger.* closeTime | date-time string | The approximate time when this ledger was closed. This number is rounded based on the `closeTimeResolution`. If it would have been rounded to the same time as a previous ledger, the close time is recorded as 1 second later instead.
*ledger.* closeTimeResolution | integer | A number of seconds, indicating how much the `closeTime` could be rounded. Ledger close times are approximate so that small differences in servers clocks don't hinder consensus.
*ledger.* closeFlags | integer | 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`.)
*ledger.* closeFlags | integer | 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`.)
*ledger.* ledgerHash | string | Unique identifying hash of the entire ledger.
*ledger.* ledgerVersion | integer | The ledger version of this ledger.
*ledger.* ledgerVersion | string | The ledger version of this ledger.
@@ -6334,9 +6335,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
@@ -6354,9 +6355,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.
@@ -6366,7 +6367,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.
@@ -6404,14 +6405,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'
})
```
@@ -6423,7 +6424,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'
})
```
@@ -6484,7 +6485,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

@@ -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://xrplcluster.com'
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(() => {
@@ -37,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

@@ -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

@@ -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,7 @@ return api.sign(txJSON, secret); // or: api.sign(txJSON, keypair);
<%- renderFixture("responses/sign.json") %>
### Example (multisigning)
### Example (multi-signing)
```javascript
const RippleAPI = require('ripple-lib').RippleAPI;
@@ -84,6 +85,10 @@ const multiSignPaymentTransaction = {
Amount: '88000000'
};
const multiSignPaymentInstruction = {
signersCount: 2
};
const api = new RippleAPI({
server: 'wss://s.altnet.rippletest.net:51233'
});
@@ -97,7 +102,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 +121,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.7",
"version": "1.9.8-storm.4",
"license": "ISC",
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
"files": [
@@ -26,10 +26,9 @@
"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-keypairs": "^1.0.3",
"ripple-address-codec": "4.1.3",
"ripple-binary-codec": "1.1.4-beta.2",
"ripple-keypairs": "1.0.4-storm.2",
"ripple-lib-transactionparser": "0.8.2",
"ws": "^7.2.0"
},
@@ -38,7 +37,7 @@
},
"devDependencies": {
"@types/mocha": "^8.2.1",
"@types/node": "^15.0.1",
"@types/node": "^16.4.3",
"@typescript-eslint/eslint-plugin": "^2.3.3",
"@typescript-eslint/parser": "^2.27.0",
"assert": "^2.0.0",
@@ -55,8 +54,8 @@
"prettier": "^2.0.5",
"process": "^0.11.10",
"stream-browserify": "^3.0.0",
"ts-node": "^9.1.1",
"typescript": "^3.7.5",
"ts-node": "^10.1.0",
"typescript": "^3.9.9",
"url": "^0.11.0",
"webpack": "^5.6.0",
"webpack-bundle-analyzer": "^4.1.0",
@@ -74,7 +73,8 @@
"docgen": "node --harmony scripts/build_docs.js",
"prepublish": "yarn clean && yarn build",
"test": "TS_NODE_PROJECT=src/tsconfig.json nyc mocha --config=test/.mocharc.json --exit",
"test:watch": "TS_NODE_PROJECT=src/tsconfig.json mocha --watch --reporter dot",
"test:integration": "TS_NODE_PROJECT=src/tsconfig.json nyc mocha ./test/integration/*.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

@@ -47,11 +47,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'
@@ -154,7 +150,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 +320,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 +348,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 +394,11 @@ 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
errors = errors
static deriveXAddress = deriveXAddress
@@ -437,31 +428,43 @@ class RippleAPI extends EventEmitter {
* 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
// @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
isValidAddress = schemaValidator.isValidAddress

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
}

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

@@ -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

@@ -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

@@ -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,16 +63,16 @@ 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 === undefined) {
if (serverInfo.load_factor == null) {
// https://github.com/ripple/rippled/issues/3812#issuecomment-816871100
serverInfo.load_factor = 1
}

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

@@ -27,7 +27,7 @@ function parseAccountDelete(tx: any): FormattedAccountDelete {
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

@@ -18,7 +18,7 @@ function parseFields(data: any): object {
const settings: any = {}
for (const fieldName in AccountFields) {
const fieldValue = data[fieldName]
if (fieldValue !== undefined) {
if (fieldValue != null) {
const info = AccountFields[fieldName]
settings[info.name] = parseField(info, fieldValue)
}
@@ -36,8 +36,7 @@ function parseFields(data: any): object {
settings.signers.threshold = data.signer_lists[0].SignerQuorum
}
if (data.signer_lists[0].SignerEntries) {
settings.signers.weights = _.map(
data.signer_lists[0].SignerEntries,
settings.signers.weights = data.signer_lists[0].SignerEntries.map(
(entry: any) => {
return {
address: entry.SignerEntry.Account,

View File

@@ -5,7 +5,6 @@ import {Ledger} from '../../common/types/objects'
export type FormattedLedger = {
// TODO: properties in type don't match response object. Fix!
// accepted: boolean,
// closed: boolean,
stateHash: string
closeTime: string
@@ -25,7 +24,7 @@ export type FormattedLedger = {
function parseTransactionWrapper(ledgerVersion, tx) {
// renames metaData to meta and adds ledger_index
const transaction = _.assign({}, _.omit(tx, 'metaData'), {
const transaction = Object.assign({}, _.omit(tx, 'metaData'), {
meta: tx.metaData,
ledger_index: ledgerVersion
})
@@ -40,12 +39,11 @@ function parseTransactions(transactions, ledgerVersion) {
if (_.isEmpty(transactions)) {
return {}
}
if (_.isString(transactions[0])) {
if (typeof transactions[0] === 'string') {
return {transactionHashes: transactions}
}
return {
transactions: _.map(
transactions,
transactions: transactions.map(
_.partial(parseTransactionWrapper, ledgerVersion)
)
}
@@ -55,7 +53,7 @@ function parseState(state) {
if (_.isEmpty(state)) {
return {}
}
if (_.isString(state[0])) {
if (typeof state[0] === 'string') {
return {stateHashes: state}
}
return {rawState: JSON.stringify(state)}
@@ -67,7 +65,7 @@ function parseState(state) {
* @throws RangeError: Invalid time value (rippleTimeToISO8601)
*/
export function parseLedger(ledger: Ledger): FormattedLedger {
const ledgerVersion = parseInt(ledger.ledger_index || ledger.seqNum, 10)
const ledgerVersion = parseInt(ledger.ledger_index, 10)
return removeUndefined(
Object.assign(
{
@@ -75,11 +73,11 @@ export function parseLedger(ledger: Ledger): FormattedLedger {
closeTime: rippleTimeToISO8601(ledger.close_time),
closeTimeResolution: ledger.close_time_resolution,
closeFlags: ledger.close_flags,
ledgerHash: ledger.hash || ledger.ledger_hash,
ledgerHash: ledger.ledger_hash,
ledgerVersion: ledgerVersion,
parentLedgerHash: ledger.parent_hash,
parentCloseTime: rippleTimeToISO8601(ledger.parent_close_time),
totalDrops: ledger.total_coins || ledger.totalCoins,
totalDrops: ledger.total_coins,
transactionHash: ledger.transaction_hash
},
parseTransactions(ledger.transactions, ledgerVersion),

View File

@@ -19,7 +19,7 @@ function createAdjustment(
address: string,
adjustmentWithoutAddress: object
): any {
const amountKey = _.keys(adjustmentWithoutAddress)[0]
const amountKey = Object.keys(adjustmentWithoutAddress)[0]
const amount = adjustmentWithoutAddress[amountKey]
return _.set(
{address: address},
@@ -37,7 +37,7 @@ function parseAlternative(
// we use "maxAmount"/"minAmount" here so that the result can be passed
// directly to preparePayment
const amounts =
alternative.destination_amount !== undefined
alternative.destination_amount != null
? {
source: {amount: parseAmount(alternative.source_amount)},
destination: {minAmount: parseAmount(alternative.destination_amount)}

View File

@@ -22,11 +22,12 @@ function parseFlags(tx: any): any {
const oldFlags = _.get(node.PreviousFields, 'Flags')
const newFlags = _.get(node.FinalFields, 'Flags')
if (oldFlags !== undefined && newFlags !== undefined) {
if (oldFlags != null && newFlags != null) {
const changedFlags = oldFlags ^ newFlags
const setFlags = newFlags & changedFlags
const clearedFlags = oldFlags & changedFlags
_.forEach(AccountFlags, (flagValue, flagName) => {
Object.entries(AccountFlags).forEach(entry => {
const [flagName, flagValue] = entry;
if (setFlags & flagValue) {
settings[flagName] = true
} else if (clearedFlags & flagValue) {
@@ -58,7 +59,7 @@ function parseSettings(tx: any) {
txType === 'SignerListSet'
)
return _.assign({}, parseFlags(tx), parseFields(tx))
return Object.assign({}, parseFlags(tx), parseFields(tx))
}
export default parseSettings

View File

@@ -1,4 +1,3 @@
import * as _ from 'lodash'
import transactionParser from 'ripple-lib-transactionparser'
import BigNumber from 'bignumber.js'
import * as common from '../../common'
@@ -6,6 +5,29 @@ import parseAmount from './amount'
import {Amount, Memo} from '../../common/types/objects'
type OfferDescription = {
direction: string,
quantity: any,
totalPrice: any,
sequence: number,
status: string,
makerExchangeRate: string
}
type Orderbook = {
[key: string]: OfferDescription[]
}
type BalanceSheetItem = {
counterparty: string,
currency: string,
value: string
}
type BalanceSheet = {
[key: string]: BalanceSheetItem[]
}
function adjustQualityForXRP(
quality: string,
takerGetsCurrency: string,
@@ -41,16 +63,16 @@ function removeEmptyCounterparty(amount) {
}
}
function removeEmptyCounterpartyInBalanceChanges(balanceChanges) {
_.forEach(balanceChanges, (changes) => {
_.forEach(changes, removeEmptyCounterparty)
function removeEmptyCounterpartyInBalanceChanges(balanceChanges: BalanceSheet) {
Object.entries(balanceChanges).forEach(([_, changes]) => {
changes.forEach(removeEmptyCounterparty)
})
}
function removeEmptyCounterpartyInOrderbookChanges(orderbookChanges) {
_.forEach(orderbookChanges, (changes) => {
_.forEach(changes, (change) => {
_.forEach(change, removeEmptyCounterparty)
function removeEmptyCounterpartyInOrderbookChanges(orderbookChanges: Orderbook) {
Object.entries(orderbookChanges).forEach(([_, changes]) => {
changes.forEach((change) => {
Object.entries(change).forEach(removeEmptyCounterparty)
})
})
}

View File

@@ -26,7 +26,7 @@ function addParams(
result: RippledPathsResponse
): RippledPathsResponse {
return _.defaults(
_.assign({}, result, {
Object.assign({}, result, {
source_account: request.source_account,
source_currencies: request.source_currencies
}),
@@ -38,7 +38,7 @@ function requestPathFind(
connection: Connection,
pathfind: PathFind
): Promise<RippledPathsResponse> {
const destinationAmount: Amount = _.assign(
const destinationAmount: Amount = Object.assign(
{
// This is converted back to drops by toRippledAmount()
value:
@@ -67,7 +67,7 @@ function requestPathFind(
)
}
if (pathfind.source.amount) {
if (pathfind.destination.amount.value !== undefined) {
if (pathfind.destination.amount.value != null) {
throw new ValidationError(
'Cannot specify both source.amount' +
' and destination.amount.value in getPaths'
@@ -112,7 +112,7 @@ function conditionallyAddDirectXRPPath(
): Promise<RippledPathsResponse> {
if (
isRippledIOUAmount(paths.destination_amount) ||
!_.includes(paths.destination_currencies, 'XRP')
!paths.destination_currencies.includes('XRP')
) {
return Promise.resolve(paths)
}
@@ -127,10 +127,10 @@ function filterSourceFundsLowPaths(
): RippledPathsResponse {
if (
pathfind.source.amount &&
pathfind.destination.amount.value === undefined &&
pathfind.destination.amount.value == null &&
paths.alternatives
) {
paths.alternatives = _.filter(paths.alternatives, (alt) => {
paths.alternatives = paths.alternatives.filter((alt) => {
if (!alt.source_amount) {
return false
}
@@ -155,9 +155,8 @@ function formatResponse(pathfind: PathFind, paths: RippledPathsResponse) {
return parsePathfind(paths)
}
if (
paths.destination_currencies !== undefined &&
!_.includes(
paths.destination_currencies,
paths.destination_currencies != null &&
!paths.destination_currencies.includes(
pathfind.destination.amount.currency
)
) {

View File

@@ -11,7 +11,7 @@ function formatResponse(
response: LedgerEntryResponse
): FormattedPaymentChannel {
if (
response.node === undefined ||
response.node == null ||
response.node.LedgerEntryType !== 'PayChannel'
) {
throw new NotFoundError('Payment channel ledger entry not found')

View File

@@ -1,4 +1,3 @@
import * as _ from 'lodash'
import parseFields from './parse/fields'
import {validate, constants, ensureClassicAddress} from '../common'
import {FormattedSettings} from '../common/types/objects'
@@ -33,7 +32,7 @@ function formatSettings(response: AccountInfoResponse) {
const data = response.account_data
const parsedFlags = parseAccountFlags(data.Flags, {excludeFalse: true})
const parsedFields = parseFields(data)
return _.assign({}, parsedFlags, parsedFields)
return Object.assign({}, parsedFlags, parsedFields)
}
export async function getSettings(

View File

@@ -1,4 +1,3 @@
import * as _ from 'lodash'
import * as utils from './utils'
import parseTransaction from './parse/transaction'
import {validate, errors} from '../common'
@@ -50,7 +49,7 @@ function attachTransactionDate(
.request(request)
.then((data) => {
if (typeof data.ledger.close_time === 'number') {
return _.assign({date: data.ledger.close_time}, tx)
return Object.assign({date: data.ledger.close_time}, tx)
}
throw new errors.UnexpectedError('Ledger missing close_time')
})

View File

@@ -40,7 +40,7 @@ function parseAccountTxTransaction(tx, includeRawTransaction: boolean) {
const _tx = tx.tx_blob ? parseBinaryTransaction(tx) : tx
// rippled uses a different response format for 'account_tx' than 'tx'
return parseTransaction(
_.assign({}, _tx.tx, {meta: _tx.meta, validated: _tx.validated}),
Object.assign({}, _tx.tx, {meta: _tx.meta, validated: _tx.validated}),
includeRawTransaction
)
}
@@ -69,7 +69,7 @@ function transactionFilter(
if (filters.excludeFailures && tx.outcome.result !== 'tesSUCCESS') {
return false
}
if (filters.types && !_.includes(filters.types, tx.type)) {
if (filters.types && !filters.types.includes(tx.type)) {
return false
}
if (filters.initiated === true && tx.address !== address) {
@@ -150,9 +150,9 @@ function checkForLedgerGaps(
// the range of ledgers spanned by those transactions
if (options.limit && transactions.length === options.limit) {
if (options.earliestFirst) {
maxLedgerVersion = _.last(transactions)!.outcome.ledgerVersion
maxLedgerVersion = transactions[transactions.length-1]!.outcome.ledgerVersion
} else {
minLedgerVersion = _.last(transactions)!.outcome.ledgerVersion
minLedgerVersion = transactions[transactions.length-1]!.outcome.ledgerVersion
}
}
@@ -170,10 +170,9 @@ function formatResponse(
options: TransactionsOptions,
transactions: GetTransactionsResponse
) {
const compare = options.earliestFirst
? utils.compareTransactions
: _.rearg(utils.compareTransactions, 1, 0)
const sortedTransactions = transactions.sort(compare)
const sortedTransactions = options.earliestFirst
? transactions.sort(utils.compareTransactions)
: transactions.sort(utils.compareTransactions).reverse()
return checkForLedgerGaps(connection, options, sortedTransactions).then(
() => sortedTransactions
)
@@ -209,11 +208,11 @@ function getTransactions(
const bound = options.earliestFirst
? {minLedgerVersion: ledgerVersion}
: {maxLedgerVersion: ledgerVersion}
const startOptions = _.assign({}, defaults, options, {startTx: tx}, bound)
const startOptions = Object.assign({}, defaults, options, {startTx: tx}, bound)
return getTransactionsInternal(this.connection, address, startOptions)
})
}
const newOptions = _.assign({}, defaults, options)
const newOptions = Object.assign({}, defaults, options)
return getTransactionsInternal(this.connection, address, newOptions)
}

View File

@@ -41,7 +41,7 @@ function getRecursiveRecur(
): Promise<Array<any>> {
return getter(marker, limit).then((data) => {
const remaining = limit - data.results.length
if (remaining > 0 && data.marker !== undefined) {
if (remaining > 0 && data.marker != null) {
return getRecursiveRecur(getter, data.marker, remaining).then((results) =>
data.results.concat(results)
)
@@ -58,9 +58,9 @@ function renameCounterpartyToIssuer<T>(
obj: T & {counterparty?: string; issuer?: string}
): T & {issuer?: string} {
const issuer =
obj.counterparty !== undefined
obj.counterparty != null
? obj.counterparty
: obj.issuer !== undefined
: obj.issuer != null
? obj.issuer
: undefined
const withIssuer = Object.assign({}, obj, {issuer})
@@ -74,7 +74,7 @@ function renameCounterpartyToIssuerInOrder(order: RequestBookOffersArgs) {
const taker_gets = renameCounterpartyToIssuer(order.taker_gets)
const taker_pays = renameCounterpartyToIssuer(order.taker_pays)
const changes = {taker_gets, taker_pays}
return _.assign({}, order, _.omitBy(changes, _.isUndefined))
return Object.assign({}, order, _.omitBy(changes, value => value == null))
}
function signum(num) {
@@ -124,13 +124,13 @@ function isPendingLedgerVersion(
function ensureLedgerVersion(this: RippleAPI, options: any): Promise<object> {
if (
Boolean(options) &&
options.ledgerVersion !== undefined &&
options.ledgerVersion != null &&
options.ledgerVersion !== null
) {
return Promise.resolve(options)
}
return this.getLedgerVersion().then((ledgerVersion) =>
_.assign({}, options, {ledgerVersion})
Object.assign({}, options, {ledgerVersion})
)
}

View File

@@ -25,7 +25,7 @@ export interface GenerateAddressOptions {
includeClassicAddress?: boolean
}
function generateAddressAPI(options: GenerateAddressOptions): GeneratedAddress {
function generateAddressAPI(options: GenerateAddressOptions = {}): GeneratedAddress {
validate.generateAddress({options})
try {
const generateSeedOptions: {

View File

@@ -15,11 +15,9 @@ function convertLedgerHeader(header): any {
hash: header.ledgerHash,
ledger_hash: header.ledgerHash,
ledger_index: header.ledgerVersion.toString(),
seqNum: header.ledgerVersion.toString(),
parent_hash: header.parentLedgerHash,
parent_close_time: common.iso8601ToRippleTime(header.parentCloseTime),
total_coins: header.totalDrops,
totalCoins: header.totalDrops,
transaction_hash: header.transactionHash
}
}
@@ -60,10 +58,10 @@ function computeTransactionHash(
}
return ledger.transactionHash
}
const txs = _.map(transactions, (tx) => {
const mergeTx = _.assign({}, _.omit(tx, 'tx'), tx.tx || {})
const txs = transactions.map((tx) => {
const mergeTx = Object.assign({}, _.omit(tx, 'tx'), tx.tx || {})
// rename `meta` back to `metaData`
const renameMeta = _.assign(
const renameMeta = Object.assign(
{},
_.omit(mergeTx, 'meta'),
tx.meta ? {metaData: tx.meta} : {}
@@ -72,7 +70,7 @@ function computeTransactionHash(
})
const transactionHash = computeTransactionTreeHash(txs)
if (
ledger.transactionHash !== undefined &&
ledger.transactionHash != null &&
ledger.transactionHash !== transactionHash
) {
throw new common.errors.ValidationError(
@@ -88,7 +86,7 @@ function computeTransactionHash(
}
function computeStateHash(ledger, options: ComputeLedgerHeaderHashOptions) {
if (ledger.rawState === undefined) {
if (ledger.rawState == null) {
if (options.computeTreeHashes) {
throw new common.errors.ValidationError(
'rawState' + ' property is missing from the ledger'
@@ -98,7 +96,7 @@ function computeStateHash(ledger, options: ComputeLedgerHeaderHashOptions) {
}
const state = JSON.parse(ledger.rawState)
const stateHash = computeStateTreeHash(state)
if (ledger.stateHash !== undefined && ledger.stateHash !== stateHash) {
if (ledger.stateHash != null && ledger.stateHash !== stateHash) {
throw new common.errors.ValidationError(
'stateHash in header' + ' does not match computed hash of state'
)
@@ -118,7 +116,7 @@ function computeLedgerHeaderHash(
transactionHash: computeTransactionHash(ledger, options),
stateHash: computeStateHash(ledger, options)
}
return hashLedgerHeader(_.assign({}, ledger, subhashes))
return hashLedgerHeader(Object.assign({}, ledger, subhashes))
}
export default computeLedgerHeaderHash

64
src/offline/utils.ts Normal file
View File

@@ -0,0 +1,64 @@
import { deriveKeypair, deriveAddress, deriveXAddress } from './derive'
import computeLedgerHeaderHash from './ledgerhash'
import signPaymentChannelClaim from './sign-payment-channel-claim'
import verifyPaymentChannelClaim from './verify-payment-channel-claim'
import { dropsToXrp,
xrpToDrops,
toRippledAmount,
convertKeysFromSnakeCaseToCamelCase,
removeUndefined,
rippleTimeToISO8601,
iso8601ToRippleTime,
isValidSecret,
} from '../common/utils'
import {
computeBinaryTransactionHash,
computeTransactionHash,
computeBinaryTransactionSigningHash,
computeAccountLedgerObjectID,
computeSignerListLedgerObjectID,
computeOrderID,
computeTrustlineHash,
computeTransactionTreeHash,
computeStateTreeHash,
computeLedgerHash,
computeEscrowHash,
computePaymentChannelHash,
} from '../common/hashes'
import { generateAddressAPI, GenerateAddressOptions, GeneratedAddress } from '../offline/generate-address'
// @deprecated Use X-addresses instead
const generateAddress = (options: GenerateAddressOptions = {}): GeneratedAddress => (
generateAddressAPI({...options, includeClassicAddress: true})
)
export {
computeLedgerHeaderHash,
dropsToXrp,
xrpToDrops,
toRippledAmount,
convertKeysFromSnakeCaseToCamelCase,
removeUndefined,
rippleTimeToISO8601,
iso8601ToRippleTime,
isValidSecret,
computeBinaryTransactionHash,
computeTransactionHash,
computeBinaryTransactionSigningHash,
computeAccountLedgerObjectID,
computeSignerListLedgerObjectID,
computeOrderID,
computeTrustlineHash,
computeTransactionTreeHash,
computeStateTreeHash,
computeLedgerHash,
computeEscrowHash,
computePaymentChannelHash,
generateAddress,
generateAddressAPI as generateXAddress,
deriveKeypair,
deriveAddress,
deriveXAddress,
signPaymentChannelClaim,
verifyPaymentChannelClaim,
}

View File

@@ -29,11 +29,11 @@ function createCheckCashTransaction(
CheckID: checkCash.checkID
}
if (checkCash.amount !== undefined) {
if (checkCash.amount != null) {
txJSON.Amount = toRippledAmount(checkCash.amount)
}
if (checkCash.deliverMin !== undefined) {
if (checkCash.deliverMin != null) {
txJSON.DeliverMin = toRippledAmount(checkCash.deliverMin)
}

View File

@@ -24,15 +24,15 @@ function createCheckCreateTransaction(
SendMax: toRippledAmount(check.sendMax)
}
if (check.destinationTag !== undefined) {
if (check.destinationTag != null) {
txJSON.DestinationTag = check.destinationTag
}
if (check.expiration !== undefined) {
if (check.expiration != null) {
txJSON.Expiration = iso8601ToRippleTime(check.expiration)
}
if (check.invoiceID !== undefined) {
if (check.invoiceID != null) {
txJSON.InvoiceID = check.invoiceID
}

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