Compare commits

..

9 Commits

Author SHA1 Message Date
Alan Cohen
9cd8beb778 Bump version to 0.13.2 2015-11-20 10:54:01 -08:00
Chris Clark
aaa165a0f3 Merge pull request #640 from lumberj/fix-pathfind
Fix: Specify send_max when pathfinding with a source amount
2015-11-20 10:48:39 -08:00
Alan Cohen
7514213918 Fix: Specify send_max when pathfinding with a source amount
When specifying a fixed sending amount during a pathfind request, the source
amount is specified as a `send_max` field. This fixes a bug where the amount was
specified as `source_amount`. Leading to strange pathfinding behavior.

Example bad behavior (rippled pathfind request/response):

```
 {
  "command": "ripple_path_find",
  "source_account": "rM21sWyMAJY1oqzgnweDatURxGMurBs7Kf",
  "destination_account": "raDjTrcEtyMqZT6s3PyKGcikUJqYNXUPPv",
  "destination_amount": {
    "currency": "EUR",
    "issuer": "raDjTrcEtyMqZT6s3PyKGcikUJqYNXUPPv",
    "value": -1
  },
  "source_amount": {
    "currency": "USD",
    "issuer": "rM21sWyMAJY1oqzgnweDatURxGMurBs7Kf",
    "value": "9.9"
  },
  "id": 2
}
{
  "id": 2,
  "result": {
    "alternatives": [
      {
        "destination_amount": {
          "currency": "EUR",
          "issuer": "raDjTrcEtyMqZT6s3PyKGcikUJqYNXUPPv",
          "value": "147520.7583553951"
        },
        "paths_canonical": [],
        "paths_computed": [
          [
            {
              "account": "r9HqF3wexBb1vtu2DfZKiFuyy3HoTAwUnH",
              "type": 1,
              "type_hex": "0000000000000001"
            },
            {
              "currency": "EUR",
              "issuer": "raDjTrcEtyMqZT6s3PyKGcikUJqYNXUPPv",
              "type": 48,
              "type_hex": "0000000000000030"
            }
          ]
        ],
        "source_amount": {
          "currency": "USD",
          "issuer": "rM21sWyMAJY1oqzgnweDatURxGMurBs7Kf",
          "value": "160510.6025237665"
        }
      }
    ],
    "destination_account": "raDjTrcEtyMqZT6s3PyKGcikUJqYNXUPPv",
    "destination_currencies": [
      "EUR",
      "XRP"
    ],
    "ledger_current_index": 2771044,
    "validated": false
  },
  "status": "success",
  "type": "response"
}
```

https://ripple.com/build/rippled-apis/#ripple-path-find
2015-11-20 10:44:21 -08:00
Alan Cohen
849ba999cb Bump version to 0.13.1 2015-11-19 18:00:22 -08:00
Chris Clark
10eb08095a Merge pull request #639 from lumberj/babel-polyfill
Add babel-polyfill
2015-11-19 17:46:54 -08:00
Chris Clark
23eb4c90fd Merge pull request #636 from clark800/events-doc
Add documentation for API events
2015-11-19 17:45:00 -08:00
Alan Cohen
12e5765c64 Bump version on ripple-hashes 2015-11-19 17:42:54 -08:00
Alan Cohen
8a53abc32f Add babel-polyfill
» node
> ripple = require('ripple-lib')
Error: Cannot find module 'babel-core/polyfill'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/alan/Projects/ripple-connect/node_modules/ripple-lib/dist/npm/index.js:23:3)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
2015-11-19 17:31:52 -08:00
Chris Clark
25d1ac0c5f Add documentation for API events 2015-11-19 15:40:35 -08:00
11 changed files with 352 additions and 126 deletions

View File

@@ -1,3 +1,15 @@
##0.13.2
**Changes**
+ [Fix: Specify send_max when pathfinding with a source amount](https://github.com/ripple/ripple-lib/commit/75142139184625c8b9fcc480b1825d9985337813)
##0.13.1
+ [Add documentation for API events](https://github.com/ripple/ripple-lib/commit/25d1ac0c5f95cad32ea4ceebb))
**Changes**
+ [Fix: Add babel-polyfill](https://github.com/ripple/ripple-lib/commit/8a53abc32f6ec6c7d50cd182492d6fb511b86704)
+ [Fix: Bump version on ripple-hashes](https://github.com/ripple/ripple-lib/commit/12e5765c64aea31b3c2fb65ff989cf01e6368f58)
##0.13.0
**Breaking Changes**

View File

@@ -55,6 +55,9 @@
- [submit](#submit)
- [generateAddress](#generateaddress)
- [computeLedgerHash](#computeledgerhash)
- [API Events](#api-events)
- [ledgerClosed](#ledgerclosed)
- [error](#error)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -211,7 +214,7 @@ A *transaction specification* specifies what a transaction should do. Each [Tran
## Payment
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
Name | Type | Description
---- | ---- | -----------
@@ -264,7 +267,7 @@ paths | string | *Optional* The paths of trustlines and orders to use in executi
## Trustline
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
Name | Type | Description
---- | ---- | -----------
@@ -295,7 +298,7 @@ ripplingDisabled | boolean | *Optional* If true, payments cannot ripple through
## Order
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
Name | Type | Description
---- | ---- | -----------
@@ -329,7 +332,7 @@ passive | boolean | *Optional* If enabled, the offer will not consume offers tha
## Order Cancellation
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
Name | Type | Description
---- | ---- | -----------
@@ -345,7 +348,7 @@ orderSequence | [sequence](#account-sequence-number) | The [account sequence num
## Settings
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
Name | Type | Description
---- | ---- | -----------
@@ -376,7 +379,7 @@ transferRate | number,null | *Optional* The fee to charge when users transfer t
## Suspended Payment Creation
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
Name | Type | Description
---- | ---- | -----------
@@ -425,7 +428,7 @@ memos[] | object | Memo objects represent arbitrary data that can be included in
## Suspended Payment Cancellation
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
Name | Type | Description
---- | ---- | -----------
@@ -450,7 +453,7 @@ memos[] | object | Memo objects represent arbitrary data that can be included in
## Suspended Payment Execution
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
Name | Type | Description
---- | ---- | -----------
@@ -3306,3 +3309,67 @@ return api.computeLedgerHash(ledger);
"F4D865D83EB88C1A1911B9E90641919A1314F36E1B099F8E95FE3B7C77BE3349"
```
# API Events
## ledgerClosed
This event is emitted whenever a new ledger version is validated on the connected server.
### Return Value
Name | Type | Description
---- | ---- | -----------
feeBase | integer | Base fee, in drops.
feeReference | integer | Cost of the 'reference transaction' in 'fee units'.
ledgerHash | string | Unique hash of the ledger that was closed, as hex.
ledgerTimestamp | date-time string | The time at which this ledger closed.
reserveBase | integer | The minimum reserve, in drops of XRP, that is required for an account.
reserveIncrement | integer | The increase in account reserve that is added for each item the account owns, such as offers or trust lines.
transactionCount | integer | Number of new transactions included in this ledger.
ledgerVersion | integer | Ledger version of the ledger that closed.
validatedLedgerVersions | string | Range of ledgers that the server has available. This may be discontiguous.
### Example
```javascript
api.on('ledgerClosed', ledger => {
console.log(JSON.stringify(ledger, null, 2));
});
```
```json
{
"feeBase": 10,
"feeReference": 10,
"ledgerVersion": 14804627,
"ledgerHash": "9141FA171F2C0CE63E609466AF728FF66C12F7ACD4B4B50B0947A7F3409D593A",
"ledgerTimestamp": "2015-07-23T05:50:40.000Z",
"reserveBase": 20000000,
"reserveIncrement": 5000000,
"transactionCount": 19,
"validatedLedgerVersions": "13983423-14804627"
}
```
## error
This event is emitted when there is an error on the connection to the server.
### Return Value
The first parameter is a string indicating the error type, which may be `badMessage` (meaning that rippled returned a malformed message), or one of the [rippled Universal Errors](https://ripple.com/build/rippled-apis/#universal-errors). The second parameter is a message explaining the error, or the message that caused the error in the case of `badMessage`.
### Example
```javascript
api.on('error', (errorCode, errorMessage) => {
console.log(errorCode + ': ' + errorMessage);
});
```
```
tooBusy: The server is too busy to help you now.
```

39
docs/src/events.md.ejs Normal file
View File

@@ -0,0 +1,39 @@
# API Events
## ledgerClosed
This event is emitted whenever a new ledger version is validated on the connected server.
### Return Value
<%- renderSchema('output/ledger-closed.json') %>
### Example
```javascript
api.on('ledgerClosed', ledger => {
console.log(JSON.stringify(ledger, null, 2));
});
```
<%- renderFixture('responses/ledger-closed.json') %>
## error
This event is emitted when there is an error on the connection to the server.
### Return Value
The first parameter is a string indicating the error type, which may be `badMessage` (meaning that rippled returned a malformed message), or one of the [rippled Universal Errors](https://ripple.com/build/rippled-apis/#universal-errors). The second parameter is a message explaining the error, or the message that caused the error in the case of `badMessage`.
### Example
```javascript
api.on('error', (errorCode, errorMessage) => {
console.log(errorCode + ': ' + errorMessage);
});
```
```
tooBusy: The server is too busy to help you now.
```

View File

@@ -33,3 +33,4 @@
<% include submit.md.ejs %>
<% include generateAddress.md.ejs %>
<% include computeLedgerHash.md.ejs %>
<% include events.md.ejs %>

View File

@@ -4,7 +4,7 @@ A *transaction specification* specifies what a transaction should do. Each [Tran
## Payment
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
<%- renderSchema('specifications/payment.json') %>
@@ -14,7 +14,7 @@ See [Transcation Types](#transaction-types) for a description.
## Trustline
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
<%- renderSchema('specifications/trustline.json') %>
@@ -24,7 +24,7 @@ See [Transcation Types](#transaction-types) for a description.
## Order
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
<%- renderSchema('specifications/order.json') %>
@@ -34,7 +34,7 @@ See [Transcation Types](#transaction-types) for a description.
## Order Cancellation
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
<%- renderSchema('specifications/order-cancellation.json') %>
@@ -44,7 +44,7 @@ See [Transcation Types](#transaction-types) for a description.
## Settings
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
<%- renderSchema('output/get-settings.json') %>
@@ -54,7 +54,7 @@ See [Transcation Types](#transaction-types) for a description.
## Suspended Payment Creation
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
<%- renderSchema('specifications/suspended-payment-creation.json') %>
@@ -64,7 +64,7 @@ See [Transcation Types](#transaction-types) for a description.
## Suspended Payment Cancellation
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
<%- renderSchema('specifications/suspended-payment-cancellation.json') %>
@@ -74,7 +74,7 @@ See [Transcation Types](#transaction-types) for a description.
## Suspended Payment Execution
See [Transcation Types](#transaction-types) for a description.
See [Transaction Types](#transaction-types) for a description.
<%- renderSchema('specifications/suspended-payment-execution.json') %>

140
npm-shrinkwrap.json generated
View File

@@ -1,93 +1,126 @@
{
"name": "ripple-lib",
"version": "0.13.0",
"npm-shrinkwrap-version": "5.4.0",
"node-version": "v0.12.7",
"version": "0.13.2",
"dependencies": {
"ajv": {
"version": "1.4.8",
"from": "https://registry.npmjs.org/ajv/-/ajv-1.4.8.tgz",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-1.4.8.tgz",
"dependencies": {
"json-stable-stringify": {
"version": "1.0.0",
"from": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.0.tgz",
"dependencies": {
"jsonify": {
"version": "0.0.0",
"from": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz"
}
}
}
}
},
"babel-polyfill": {
"version": "6.2.0",
"from": "babel-polyfill@*",
"resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.2.0.tgz",
"dependencies": {
"core-js": {
"version": "1.2.6",
"from": "core-js@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.6.tgz"
},
"babel-regenerator-runtime": {
"version": "6.2.0",
"from": "babel-regenerator-runtime@>=6.2.0 <7.0.0",
"resolved": "https://registry.npmjs.org/babel-regenerator-runtime/-/babel-regenerator-runtime-6.2.0.tgz"
}
}
},
"babel-runtime": {
"version": "5.8.29",
"from": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-5.8.29.tgz",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-5.8.29.tgz",
"dependencies": {
"core-js": {
"version": "1.2.3",
"from": "https://registry.npmjs.org/core-js/-/core-js-1.2.3.tgz",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.3.tgz"
}
}
},
"bignumber.js": {
"version": "2.1.0",
"from": "bignumber.js@>=2.0.3 <3.0.0",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-2.1.0.tgz"
},
"https-proxy-agent": {
"version": "1.0.0",
"from": "https-proxy-agent@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-1.0.0.tgz",
"dependencies": {
"agent-base": {
"version": "2.0.1",
"from": "agent-base@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.0.1.tgz",
"dependencies": {
"semver": {
"version": "5.0.3",
"from": "semver@>=5.0.1 <5.1.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz"
}
}
},
"debug": {
"version": "2.2.0",
"from": "debug@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"dependencies": {
"ms": {
"version": "0.7.1",
"from": "ms@0.7.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz"
}
}
},
"extend": {
"version": "3.0.0",
"from": "extend@>=3.0.0 <4.0.0",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz"
}
}
},
"lodash": {
"version": "3.10.1",
"from": "lodash@>=3.1.0 <4.0.0",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz"
},
"ripple-address-codec": {
"version": "2.0.1",
"from": "ripple-address-codec@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-2.0.1.tgz",
"dependencies": {
"hash.js": {
"version": "1.0.3",
"from": "hash.js@>=1.0.3 <2.0.0",
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz",
"dependencies": {
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
},
"x-address-codec": {
"version": "0.7.2",
"from": "x-address-codec@>=0.7.0 <0.8.0",
"resolved": "https://registry.npmjs.org/x-address-codec/-/x-address-codec-0.7.2.tgz",
"dependencies": {
"base-x": {
"version": "1.0.1",
"from": "base-x@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-1.0.1.tgz"
}
}
@@ -95,97 +128,77 @@
}
},
"ripple-binary-codec": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-0.0.7.tgz",
"version": "0.1.0",
"from": "ripple-binary-codec@0.1.0",
"resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-0.1.0.tgz",
"dependencies": {
"babel-runtime": {
"version": "5.8.34",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-5.8.34.tgz",
"dependencies": {
"core-js": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.6.tgz"
}
}
},
"bn.js": {
"version": "3.3.0",
"from": "bn.js@>=3.2.0 <4.0.0",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-3.3.0.tgz"
},
"create-hash": {
"version": "1.1.2",
"from": "create-hash@>=1.1.2 <2.0.0",
"resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.2.tgz",
"dependencies": {
"cipher-base": {
"version": "1.0.2",
"from": "cipher-base@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.2.tgz"
},
"ripemd160": {
"version": "1.0.1",
"from": "ripemd160@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-1.0.1.tgz"
},
"sha.js": {
"version": "2.4.4",
"from": "sha.js@>=2.3.6 <3.0.0",
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.4.tgz"
}
}
},
"decimal.js": {
"version": "4.0.3",
"from": "decimal.js@>=4.0.2 <5.0.0",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-4.0.3.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
},
"lodash": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz"
},
"ripple-address-codec": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-2.0.1.tgz",
"dependencies": {
"hash.js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz"
},
"x-address-codec": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/x-address-codec/-/x-address-codec-0.7.2.tgz",
"dependencies": {
"base-x": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-1.0.1.tgz"
}
}
}
}
}
}
},
"ripple-hashes": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/ripple-hashes/-/ripple-hashes-0.0.1.tgz",
"version": "0.1.0",
"from": "ripple-hashes@0.1.0",
"resolved": "https://registry.npmjs.org/ripple-hashes/-/ripple-hashes-0.1.0.tgz",
"dependencies": {
"create-hash": {
"version": "1.1.2",
"from": "create-hash@>=1.1.2 <2.0.0",
"resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.2.tgz",
"dependencies": {
"cipher-base": {
"version": "1.0.2",
"from": "cipher-base@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.2.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
},
"ripemd160": {
"version": "1.0.1",
"from": "ripemd160@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-1.0.1.tgz"
},
"sha.js": {
"version": "2.4.4",
"from": "sha.js@>=2.3.6 <3.0.0",
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.4.tgz"
}
}
@@ -194,32 +207,39 @@
},
"ripple-keypairs": {
"version": "0.10.0",
"from": "ripple-keypairs@>=0.10.0 <0.11.0",
"resolved": "https://registry.npmjs.org/ripple-keypairs/-/ripple-keypairs-0.10.0.tgz",
"dependencies": {
"bn.js": {
"version": "3.3.0",
"from": "bn.js@>=3.1.1 <4.0.0",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-3.3.0.tgz"
},
"brorand": {
"version": "1.0.5",
"from": "brorand@>=1.0.5 <2.0.0",
"resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz"
},
"elliptic": {
"version": "5.2.1",
"from": "elliptic@>=5.1.0 <6.0.0",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-5.2.1.tgz",
"dependencies": {
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
},
"hash.js": {
"version": "1.0.3",
"from": "hash.js@>=1.0.3 <2.0.0",
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz",
"dependencies": {
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
@@ -228,19 +248,57 @@
},
"ripple-lib-transactionparser": {
"version": "0.6.0",
"from": "ripple-lib-transactionparser@>=0.6.0 <0.7.0",
"resolved": "https://registry.npmjs.org/ripple-lib-transactionparser/-/ripple-lib-transactionparser-0.6.0.tgz"
},
"ws": {
"version": "0.7.2",
"from": "ws@>=0.7.1 <0.8.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-0.7.2.tgz",
"dependencies": {
"options": {
"version": "0.0.6",
"from": "options@>=0.0.5",
"resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz"
},
"ultron": {
"version": "1.0.2",
"from": "ultron@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz"
},
"bufferutil": {
"version": "1.1.0",
"from": "bufferutil@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-1.1.0.tgz",
"dependencies": {
"bindings": {
"version": "1.2.1",
"from": "bindings@>=1.2.0 <1.3.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz"
},
"nan": {
"version": "1.8.4",
"from": "nan@>=1.8.0 <1.9.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-1.8.4.tgz"
}
}
},
"utf-8-validate": {
"version": "1.1.0",
"from": "utf-8-validate@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-1.1.0.tgz",
"dependencies": {
"bindings": {
"version": "1.2.1",
"from": "bindings@>=1.2.0 <1.3.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz"
},
"nan": {
"version": "1.8.4",
"from": "nan@>=1.8.0 <1.9.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-1.8.4.tgz"
}
}
}
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "ripple-lib",
"version": "0.13.0",
"version": "0.13.2",
"license": "ISC",
"description": "A JavaScript API for interacting with Ripple in Node.js and the browser",
"files": [
@@ -16,13 +16,14 @@
},
"dependencies": {
"ajv": "^1.4.8",
"babel-polyfill": "^6.2.0",
"babel-runtime": "^5.5.4",
"bignumber.js": "^2.0.3",
"https-proxy-agent": "^1.0.0",
"lodash": "^3.1.0",
"ripple-address-codec": "^2.0.1",
"ripple-binary-codec": "^0.1.0",
"ripple-hashes": "^0.0.1",
"ripple-hashes": "^0.1.0",
"ripple-keypairs": "^0.10.0",
"ripple-lib-transactionparser": "^0.6.0",
"ws": "^0.7.1"

View File

@@ -4,15 +4,48 @@
"description": "A ledgerClosed event message",
"type": "object",
"properties": {
"feeBase": {"type": "integer", "minimum": 0},
"feeReference": {"type": "integer", "minimum": 0},
"ledgerHash": {"$ref": "hash256"},
"ledgerVersion": {"$ref": "ledgerVersion"},
"ledgerTimestamp": {"type": "string", "format": "date-time"},
"reserveBase": {"type": "integer", "minimum": 0},
"reserveIncrement": {"type": "integer", "minimum": 0},
"transactionCount": {"type": "integer", "minimum": 0},
"validatedLedgerVersions": {"type": "string"}
"feeBase": {
"type": "integer",
"minimum": 0,
"description": "Base fee, in drops."
},
"feeReference": {
"type": "integer",
"minimum": 0,
"description": "Cost of the 'reference transaction' in 'fee units'."
},
"ledgerHash": {
"$ref": "hash256",
"description": "Unique hash of the ledger that was closed, as hex."
},
"ledgerVersion": {
"$ref": "ledgerVersion",
"description": "Ledger version of the ledger that closed."
},
"ledgerTimestamp": {
"type": "string",
"format": "date-time",
"description": "The time at which this ledger closed."
},
"reserveBase": {
"type": "integer",
"minimum": 0,
"description": "The minimum reserve, in drops of XRP, that is required for an account."
},
"reserveIncrement": {
"type": "integer",
"minimum": 0,
"description": "The increase in account reserve that is added for each item the account owns, such as offers or trust lines."
},
"transactionCount": {
"type": "integer",
"minimum": 0,
"description": "Number of new transactions included in this ledger."
},
"validatedLedgerVersions": {
"type": "string",
"description": "Range of ledgers that the server has available. This may be discontiguous."
}
},
"addtionalProperties": false,
"required": ["feeBase", "feeReference", "ledgerHash", "ledgerTimestamp",

View File

@@ -1,55 +1,55 @@
/* @flow */
'use strict';
import type {Amount, LaxLaxAmount, RippledAmount, Adjustment, MaxAdjustment,
MinAdjustment} from '../common/types.js';
type Path = {
source: Adjustment | MaxAdjustment,
destination: Adjustment | MinAdjustment,
paths: string
}
export type GetPaths = Array<Path>
export type PathFind = {
source: {
address: string,
amount?: Amount,
currencies?: Array<{currency: string, counterparty?:string}>
},
destination: {
address: string,
amount: LaxLaxAmount
}
}
export type PathFindRequest = {
command: string,
source_account: string,
destination_amount: RippledAmount,
destination_account: string,
source_amount?: RippledAmount,
source_currencies?: Array<string>
}
export type RippledPathsResponse = {
alternatives: Array<{
paths_computed: Array<Array<{
type: number,
type_hex: string,
account?: string,
issuer?: string,
currency?: string
}>>,
source_amount: RippledAmount
}>,
type: string,
destination_account: string,
destination_amount: RippledAmount,
destination_currencies?: Array<string>,
source_account?: string,
source_currencies?: Array<{currency: string}>,
full_reply?: boolean
}
/* @flow */
'use strict';
import type {Amount, LaxLaxAmount, RippledAmount, Adjustment, MaxAdjustment,
MinAdjustment} from '../common/types.js';
type Path = {
source: Adjustment | MaxAdjustment,
destination: Adjustment | MinAdjustment,
paths: string
}
export type GetPaths = Array<Path>
export type PathFind = {
source: {
address: string,
amount?: Amount,
currencies?: Array<{currency: string, counterparty?:string}>
},
destination: {
address: string,
amount: LaxLaxAmount
}
}
export type PathFindRequest = {
command: string,
source_account: string,
destination_amount: RippledAmount,
destination_account: string,
source_currencies?: Array<string>,
send_max?: RippledAmount
}
export type RippledPathsResponse = {
alternatives: Array<{
paths_computed: Array<Array<{
type: number,
type_hex: string,
account?: string,
issuer?: string,
currency?: string
}>>,
source_amount: RippledAmount
}>,
type: string,
destination_account: string,
destination_amount: RippledAmount,
destination_currencies?: Array<string>,
source_account?: string,
source_currencies?: Array<{currency: string}>,
full_reply?: boolean
}

View File

@@ -46,9 +46,9 @@ function requestPathFind(connection: Connection, pathfind: PathFind): Promise {
throw new ValidationError('Cannot specify both source.amount'
+ ' and destination.amount.value in getPaths');
}
request.source_amount = toRippledAmount(pathfind.source.amount);
if (request.source_amount.currency && !request.source_amount.issuer) {
request.source_amount.issuer = pathfind.source.address;
request.send_max = toRippledAmount(pathfind.source.amount);
if (request.send_max.currency && !request.send_max.issuer) {
request.send_max.issuer = pathfind.source.address;
}
}

View File

@@ -289,6 +289,21 @@ describe('integration tests', function() {
});
});
it('getPaths - send all', function() {
const pathfind = requests.getPaths.sendAll;
return this.api.getPaths(pathfind).then(data => {
assert(data && data.length > 0);
assert(_.every(data, path => {
return parseFloat(path.source.amount.value)
<= parseFloat(pathfind.source.amount.value);
}));
const path = data[0];
assert(path && path.source);
assert.strictEqual(path.source.address, pathfind.source.address);
assert(path.paths && path.paths.length > 0);
});
});
it('generateWallet', function() {
const newWallet = this.api.generateAddress();