mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-18 03:05:48 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3c34bd75a | ||
|
|
5419e67dbc | ||
|
|
8d37da0952 | ||
|
|
a8075d98df |
119
APPLICATIONS.md
Normal file
119
APPLICATIONS.md
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
# Applications using ripple-lib (RippleAPI)
|
||||||
|
|
||||||
|
A curated list of some of the projects and apps that leverage `ripple-lib` in some way.
|
||||||
|
|
||||||
|
**Have one to add?** Please edit this file and open a PR!
|
||||||
|
|
||||||
|
## Notice (disclaimer)
|
||||||
|
|
||||||
|
These sites are independent of Ripple and have not been authorized, endorsed, sponsored or otherwise approved by Ripple or its affiliates.
|
||||||
|
|
||||||
|
Warning: Use at your own risk.
|
||||||
|
|
||||||
|
## Data and visualizations
|
||||||
|
|
||||||
|
- **[Wipple - XRP Intelligence](https://wipple.devnull.network/)**
|
||||||
|
|
||||||
|
Monitor the XRP Network in real time and explore historical statistics.
|
||||||
|
|
||||||
|
- **[XRP Charts](https://xrpcharts.ripple.com/)** (xrpcharts.ripple.com)
|
||||||
|
|
||||||
|
XRP Charts provides information based on public data, including trade volume, top markets, metrics, transactions, and more.
|
||||||
|
|
||||||
|
- **[Ripple Live](https://gatehub.net/live)** (gatehub.net/live)
|
||||||
|
|
||||||
|
Visualize XRP network transactions.
|
||||||
|
|
||||||
|
- **[XRPL Dev. Dashboard](https://xrp.fans/)** (xrp.fans)
|
||||||
|
|
||||||
|
Debugging dashboard for `rippled-ws-client-pool`, transaction and query explorer, and transaction signing and submission tool.
|
||||||
|
|
||||||
|
- **[XRP Value](http://xrpvalue.com/)**
|
||||||
|
|
||||||
|
Real-time XRP price, trades, and orderbook data from the XRP Ledger.
|
||||||
|
|
||||||
|
- **[Bithomp - XRPL validators](https://bithomp.com/validators)**
|
||||||
|
|
||||||
|
List of XRPL validators, nodes, and testnet validators.
|
||||||
|
|
||||||
|
## Send and request payments
|
||||||
|
|
||||||
|
- **[XRP Tip Bot](https://www.xrptipbot.com/)**
|
||||||
|
|
||||||
|
A bot that enables users on reddit, Twitter and Discord to send XRP to each other through reddit comments and Twitter tweets.
|
||||||
|
|
||||||
|
- **[XRP Text](https://xrptext.com/)**
|
||||||
|
|
||||||
|
Send XRP using SMS text messages.
|
||||||
|
|
||||||
|
- **[XRParrot](https://xrparrot.com/)** (uses `ripple-address-codec`)
|
||||||
|
|
||||||
|
Easy EUR (SEPA) to XRP transfer (currency conversion).
|
||||||
|
|
||||||
|
- **[XRP Payment](https://xrpayments.co/)** (xrpayments.co)
|
||||||
|
|
||||||
|
Tool for generating a XRP payment request URI in a QR code, with currency converter.
|
||||||
|
|
||||||
|
## Wallets and wallet tools
|
||||||
|
|
||||||
|
- **[Toast Wallet](https://toastwallet.com/)**
|
||||||
|
|
||||||
|
A free, open source XRP Wallet for iOS, Android, Windows, Mac and Linux.
|
||||||
|
|
||||||
|
- **[Toastify Ledger](https://github.com/WietseWind/toastify-ledger)** (uses `ripple-keypairs`)
|
||||||
|
|
||||||
|
Add a Regular Key to a mnemonic XRP Wallet (e.g. Ledger Nano S) to use the account with a Family Seed (secret).
|
||||||
|
|
||||||
|
- **[Bithomp-submit](https://github.com/Bithomp/bithomp-submit)** (GitHub)
|
||||||
|
|
||||||
|
A tool to submit an offline-signed XRPL transaction.
|
||||||
|
|
||||||
|
- **[Kyte](https://kyteapp.co/)** (kyteapp.co) ([Source](https://github.com/WietseWind/Zerp-Wallet)) (Deprecated)
|
||||||
|
|
||||||
|
Web-based XRP wallet.
|
||||||
|
|
||||||
|
- **[XRP Vanity Address Generator](https://github.com/WietseWind/xrp-vanity-generator)** (Node.js)
|
||||||
|
|
||||||
|
A vanity address is a wallet address containing a few characters you like at the beginning or the end of the wallet address.
|
||||||
|
|
||||||
|
- **[XRP Account Mnemonic Recovery](https://github.com/WietseWind/xrp-mnemonic-recovery)** (uses `ripple-keypairs`)
|
||||||
|
|
||||||
|
Recover a 24 word mnemonic if one word is wrong or one word is missing.
|
||||||
|
|
||||||
|
## Development tools
|
||||||
|
|
||||||
|
- **[XRP Test Net Faucet](https://developers.ripple.com/xrp-test-net-faucet.html)**
|
||||||
|
|
||||||
|
Get some test funds for development on the test network. The faucet was built using `ripple-lib`.
|
||||||
|
|
||||||
|
## Code samples and libraries
|
||||||
|
|
||||||
|
- **[ilp-plugin-xrp-paychan](https://github.com/interledgerjs/ilp-plugin-xrp-paychan)**
|
||||||
|
|
||||||
|
Send ILP payments using XRP and payment channels (PayChan).
|
||||||
|
|
||||||
|
- **[RunKit: WietseWind](https://runkit.com/wietsewind/)**
|
||||||
|
|
||||||
|
XRP Ledger code samples for Node.js.
|
||||||
|
|
||||||
|
- **[GitHub Gist: WietseWind](https://gist.github.com/WietseWind)**
|
||||||
|
|
||||||
|
XRP Ledger code samples for Node.js and the web (mostly).
|
||||||
|
|
||||||
|
- **[rippled-ws-client-sign](https://github.com/WietseWind/rippled-ws-client-sign)**
|
||||||
|
|
||||||
|
Sign transactions, with support for MultiSign.
|
||||||
|
|
||||||
|
- **[ILP-enabled power switch](https://xrpcommunity.blog/raspberry-pi-interledger-xp-powerswitch-howto/)** ([video](https://www.youtube.com/watch?v=c-eS0HQUuJg)) (uses [`moneyd-uplink-xrp`](https://github.com/interledgerjs/moneyd-uplink-xrp))
|
||||||
|
|
||||||
|
For about $30 in parts (Raspberry Pi, 3.3V Relay board and a few wires) you can build your own power switch that will switch on if a streaming ILP payment comes in. When the payment stream stops, the power turns off.
|
||||||
|
|
||||||
|
## Related apps that do not appear to use ripple-lib
|
||||||
|
|
||||||
|
- **[XRP Stats](https://ledger.exposed/)** (ledger.exposed)
|
||||||
|
|
||||||
|
Rich list, live ledger stats and XRP distribution. Visualize escrows and flow of funds.
|
||||||
|
|
||||||
|
- **[XRP Vanity](https://xrpvanity.com/)** (xrpvanity.com)
|
||||||
|
|
||||||
|
Custom XRP addresses for sale, delivered by SetRegularKey.
|
||||||
20
HISTORY.md
20
HISTORY.md
@@ -1,5 +1,25 @@
|
|||||||
# ripple-lib Release History
|
# ripple-lib Release History
|
||||||
|
|
||||||
|
## 1.1.2 (2018-12-12)
|
||||||
|
|
||||||
|
+ Update `submit` response (#978)
|
||||||
|
+ Includes the full object returned by rippled, while keeping the existing
|
||||||
|
fields for backward compatibility
|
||||||
|
+ Add `getLedger` option for ledger hash (##980)
|
||||||
|
+ Use the `ledgerHash` option to get a specific ledger by hash
|
||||||
|
|
||||||
|
When using `ripple-lib` with `rippled`, we recommend using `rippled` version
|
||||||
|
1.1.2 or later.
|
||||||
|
|
||||||
|
The SHA-256 checksums for the browser version of this release can be found
|
||||||
|
below.
|
||||||
|
```
|
||||||
|
% shasum -a 256 *
|
||||||
|
e6cc52395d0c3e205263777ba2e528e50f4d1f84bb4b16763a3bf7f5fcc290f5 ripple-1.1.2-debug.js
|
||||||
|
82df879bc2970e0e4fd161975a99448b4859b0cde751d8ea34e9f51d672090b9 ripple-1.1.2-min.js
|
||||||
|
12f56330dc71bba8ac3004025cbc9698413a0c619df302dda105b31228a67319 ripple-1.1.2.js
|
||||||
|
```
|
||||||
|
|
||||||
## 1.1.1 (2018-11-27)
|
## 1.1.1 (2018-11-27)
|
||||||
|
|
||||||
+ Fix `getOrderbook` offer sorting (#970)
|
+ Fix `getOrderbook` offer sorting (#970)
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -7,8 +7,8 @@ A JavaScript API for interacting with the XRP Ledger
|
|||||||
### Features
|
### Features
|
||||||
|
|
||||||
+ Connect to a `rippled` server from Node.js or a web browser
|
+ Connect to a `rippled` server from Node.js or a web browser
|
||||||
+ Issue [rippled API](https://ripple.com/build/rippled-apis/) requests
|
+ Helpers for creating requests and parsing responses for the [rippled API](https://developers.ripple.com/rippled-api.html)
|
||||||
+ Listen to events on the XRP Ledger (transaction, ledger, etc.)
|
+ Listen to events on the XRP Ledger (transactions, ledger, validations, etc.)
|
||||||
+ Sign and submit transactions to the XRP Ledger
|
+ Sign and submit transactions to the XRP Ledger
|
||||||
+ Type definitions for TypeScript
|
+ Type definitions for TypeScript
|
||||||
|
|
||||||
@@ -30,6 +30,8 @@ $ yarn add ripple-lib
|
|||||||
|
|
||||||
Then see the [documentation](https://github.com/ripple/ripple-lib/blob/develop/docs/index.md) and [code samples](https://github.com/ripple/ripple-lib/tree/develop/docs/samples).
|
Then see the [documentation](https://github.com/ripple/ripple-lib/blob/develop/docs/index.md) and [code samples](https://github.com/ripple/ripple-lib/tree/develop/docs/samples).
|
||||||
|
|
||||||
|
**What is ripple-lib used for?** Here's a [list of applications](APPLICATIONS.md) that use `ripple-lib`. Open a PR to add your app or project to the list!
|
||||||
|
|
||||||
### Mailing Lists
|
### Mailing Lists
|
||||||
|
|
||||||
We have a low-traffic mailing list for announcements of new ripple-lib releases. (About 1 email per week)
|
We have a low-traffic mailing list for announcements of new ripple-lib releases. (About 1 email per week)
|
||||||
@@ -56,7 +58,7 @@ $ yarn build
|
|||||||
|
|
||||||
Gulp will [output](./Gulpfile.js) the resulting JS files in `./build/`.
|
Gulp will [output](./Gulpfile.js) the resulting JS files in `./build/`.
|
||||||
|
|
||||||
For more details, see the `scripts` in `package.json`.
|
For details, see the `scripts` in `package.json`.
|
||||||
|
|
||||||
## Running Tests
|
## Running Tests
|
||||||
|
|
||||||
@@ -64,12 +66,12 @@ For more details, see the `scripts` in `package.json`.
|
|||||||
2. `cd` into the repository and install dependencies with `yarn install`
|
2. `cd` into the repository and install dependencies with `yarn install`
|
||||||
3. `yarn test`
|
3. `yarn test`
|
||||||
|
|
||||||
|
Also, run `yarn lint` to lint the code with `tslint`.
|
||||||
|
|
||||||
## Generating Documentation
|
## Generating Documentation
|
||||||
|
|
||||||
The continuous integration tests require that the documentation stays up-to-date. If you make changes to the JSON schemas, fixtures, or documentation sources, you must update the documentation by running `yarn run docgen`.
|
The continuous integration tests require that the documentation stays up-to-date. If you make changes to the JSON schemas, fixtures, or documentation sources, you must update the documentation by running `yarn run docgen`.
|
||||||
|
|
||||||
`npm` may be used instead of `yarn` in the commands above.
|
|
||||||
|
|
||||||
## More Information
|
## More Information
|
||||||
|
|
||||||
+ [Ripple Developer Center](https://ripple.com/build/)
|
+ [Ripple Developer Center](https://ripple.com/build/)
|
||||||
|
|||||||
@@ -4387,6 +4387,7 @@ options | object | *Optional* Options affecting what ledger and how much data to
|
|||||||
*options.* includeAllData | boolean | *Optional* Include full transactions and/or state information if `includeTransactions` and/or `includeState` is set.
|
*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.* 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.* 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.* 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 | integer | *Optional* Get ledger data for this historical ledger version.
|
||||||
*options.* ledgerVersion | string | *Optional* Get ledger data for this historical ledger version.
|
*options.* ledgerVersion | string | *Optional* Get ledger data for this historical ledger version.
|
||||||
|
|
||||||
@@ -5481,8 +5482,13 @@ This method returns an object with the following structure:
|
|||||||
|
|
||||||
Name | Type | Description
|
Name | Type | Description
|
||||||
---- | ---- | -----------
|
---- | ---- | -----------
|
||||||
resultCode | string | The result code returned by rippled. [List of transaction responses](https://ripple.com/build/transactions/#full-transaction-response-list)
|
resultCode | string | Deprecated: Use `engine_result` instead.
|
||||||
resultMessage | string | Human-readable explanation of the status of the transaction.
|
resultMessage | string | Deprecated: Use `engine_result_message` instead.
|
||||||
|
engine_result | string | Code indicating the preliminary result of the transaction, for example tesSUCCESS. [List of transaction responses](https://ripple.com/build/transactions/#full-transaction-response-list)
|
||||||
|
engine_result_code | integer | Numeric code indicating the preliminary result of the transaction, directly correlated to `engine_result`
|
||||||
|
engine_result_message | string | Human-readable explanation of the transaction's preliminary result.
|
||||||
|
tx_blob | string | The complete transaction in hex string format.
|
||||||
|
tx_json | [tx](https://ripple.com/build/transactions/) | The complete transaction in JSON format.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
@@ -5496,7 +5502,27 @@ return api.submit(signedTransaction)
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"resultCode": "tesSUCCESS",
|
"resultCode": "tesSUCCESS",
|
||||||
"resultMessage": "The transaction was applied. Only final in a validated ledger."
|
"resultMessage": "The transaction was applied. Only final in a validated ledger.",
|
||||||
|
"engine_result": "tesSUCCESS",
|
||||||
|
"engine_result_code": 0,
|
||||||
|
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||||
|
"tx_blob": "1200002280000000240000016861D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA9684000000000002710732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB7446304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F858081144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754",
|
||||||
|
"tx_json": {
|
||||||
|
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
|
"Amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||||
|
"Fee": "10000",
|
||||||
|
"Flags": 2147483648,
|
||||||
|
"Sequence": 360,
|
||||||
|
"SigningPubKey": "03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB",
|
||||||
|
"TransactionType": "Payment",
|
||||||
|
"TxnSignature": "304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F8580",
|
||||||
|
"hash": "4D5D90890F8D49519E4151938601EF3D0B30B16CD6A519D9C99102C9FA77F7E0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ripple-lib",
|
"name": "ripple-lib",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"description": "A JavaScript API for interacting with Ripple in Node.js and the browser",
|
"description": "A JavaScript API for interacting with Ripple in Node.js and the browser",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"description": "Options affecting what ledger and how much data to return.",
|
"description": "Options affecting what ledger and how much data to return.",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"ledgerHash": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Get ledger data for this historical ledger hash."
|
||||||
|
},
|
||||||
"ledgerVersion": {
|
"ledgerVersion": {
|
||||||
"$ref": "ledgerVersion",
|
"$ref": "ledgerVersion",
|
||||||
"description": "Get ledger data for this historical ledger version."
|
"description": "Get ledger data for this historical ledger version."
|
||||||
|
|||||||
@@ -5,13 +5,33 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"resultCode": {
|
"resultCode": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The result code returned by rippled. [List of transaction responses](https://ripple.com/build/transactions/#full-transaction-response-list)"
|
"description": "Deprecated: Use `engine_result` instead."
|
||||||
},
|
},
|
||||||
"resultMessage": {
|
"resultMessage": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Human-readable explanation of the status of the transaction."
|
"description": "Deprecated: Use `engine_result_message` instead."
|
||||||
|
},
|
||||||
|
"engine_result": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Code indicating the preliminary result of the transaction, for example tesSUCCESS. [List of transaction responses](https://ripple.com/build/transactions/#full-transaction-response-list)"
|
||||||
|
},
|
||||||
|
"engine_result_code": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Numeric code indicating the preliminary result of the transaction, directly correlated to `engine_result`"
|
||||||
|
},
|
||||||
|
"engine_result_message": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Human-readable explanation of the transaction's preliminary result."
|
||||||
|
},
|
||||||
|
"tx_blob": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The complete transaction in hex string format."
|
||||||
|
},
|
||||||
|
"tx_json": {
|
||||||
|
"$ref": "tx",
|
||||||
|
"description": "The complete transaction in JSON format."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["resultCode", "resultMessage"],
|
"required": ["resultCode", "resultMessage", "engine_result", "engine_result_code", "engine_result_message", "tx_blob", "tx_json"],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {FormattedLedger, parseLedger} from './parse/ledger'
|
|||||||
import {RippleAPI} from '../api'
|
import {RippleAPI} from '../api'
|
||||||
|
|
||||||
export type GetLedgerOptions = {
|
export type GetLedgerOptions = {
|
||||||
|
ledgerHash?: string,
|
||||||
ledgerVersion?: number,
|
ledgerVersion?: number,
|
||||||
includeAllData?: boolean,
|
includeAllData?: boolean,
|
||||||
includeTransactions?: boolean,
|
includeTransactions?: boolean,
|
||||||
@@ -16,6 +17,7 @@ async function getLedger(
|
|||||||
validate.getLedger({options})
|
validate.getLedger({options})
|
||||||
// 2. Make Request
|
// 2. Make Request
|
||||||
const response = await this.request('ledger', {
|
const response = await this.request('ledger', {
|
||||||
|
ledger_hash: options.ledgerHash,
|
||||||
ledger_index: options.ledgerVersion || 'validated',
|
ledger_index: options.ledgerVersion || 'validated',
|
||||||
expand: options.includeAllData,
|
expand: options.includeAllData,
|
||||||
transactions: options.includeTransactions,
|
transactions: options.includeTransactions,
|
||||||
|
|||||||
@@ -20,8 +20,15 @@ function isImmediateRejection(engineResult: string): boolean {
|
|||||||
|
|
||||||
function formatSubmitResponse(response): FormattedSubmitResponse {
|
function formatSubmitResponse(response): FormattedSubmitResponse {
|
||||||
const data = {
|
const data = {
|
||||||
|
// @deprecated
|
||||||
resultCode: response.engine_result,
|
resultCode: response.engine_result,
|
||||||
resultMessage: response.engine_result_message
|
// @deprecated
|
||||||
|
resultMessage: response.engine_result_message,
|
||||||
|
engine_result: response.engine_result,
|
||||||
|
engine_result_code: response.engine_result_code,
|
||||||
|
engine_result_message: response.engine_result_message,
|
||||||
|
tx_blob: response.tx_blob,
|
||||||
|
tx_json: response.tx_json
|
||||||
}
|
}
|
||||||
if (isImmediateRejection(response.engine_result)) {
|
if (isImmediateRejection(response.engine_result)) {
|
||||||
throw new utils.common.errors.RippledError('Submit failed', data)
|
throw new utils.common.errors.RippledError('Submit failed', data)
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ function checkResult(expected, schemaName, response) {
|
|||||||
assert(response.txJSON);
|
assert(response.txJSON);
|
||||||
assert.deepEqual(JSON.parse(response.txJSON), JSON.parse(expected.txJSON));
|
assert.deepEqual(JSON.parse(response.txJSON), JSON.parse(expected.txJSON));
|
||||||
}
|
}
|
||||||
assert.deepEqual(_.omit(response, 'txJSON'), _.omit(expected, 'txJSON'));
|
if (expected.tx_json) {
|
||||||
|
assert(response.tx_json);
|
||||||
|
assert.deepEqual(response.tx_json, expected.tx_json);
|
||||||
|
}
|
||||||
|
assert.deepEqual(_.omit(response, 'txJSON'), _.omit(expected, 'txJSON'), _.omit(response, 'tx_json'), _.omit(response, 'tx_json'));
|
||||||
if (schemaName) {
|
if (schemaName) {
|
||||||
schemaValidator.schemaValidate(schemaName, response);
|
schemaValidator.schemaValidate(schemaName, response);
|
||||||
}
|
}
|
||||||
@@ -1536,8 +1540,9 @@ describe('RippleAPI', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('submit', function () {
|
it('submit', function () {
|
||||||
return this.api.submit(responses.sign.normal.signedTransaction).then(
|
return this.api.submit(responses.sign.normal.signedTransaction).then(response => {
|
||||||
_.partial(checkResult, responses.submit, 'submit'));
|
checkResult(responses.submit, 'submit', response);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('submit - failure', function () {
|
it('submit - failure', function () {
|
||||||
@@ -3085,6 +3090,11 @@ describe('RippleAPI', function () {
|
|||||||
_.partial(checkResult, responses.getLedger.header, 'getLedger'));
|
_.partial(checkResult, responses.getLedger.header, 'getLedger'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('getLedger - by hash', function () {
|
||||||
|
return this.api.getLedger({ ledgerHash: '15F20E5FA6EA9770BBFFDBD62787400960B04BE32803B20C41F117F41C13830D' }).then(
|
||||||
|
_.partial(checkResult, responses.getLedger.headerByHash, 'getLedger'));
|
||||||
|
});
|
||||||
|
|
||||||
it('getLedger - future ledger version', function () {
|
it('getLedger - future ledger version', function () {
|
||||||
return this.api.getLedger({ ledgerVersion: 14661789 }).then(response => {
|
return this.api.getLedger({ ledgerVersion: 14661789 }).then(response => {
|
||||||
assert(response)
|
assert(response)
|
||||||
|
|||||||
12
test/fixtures/responses/get-ledger-by-hash.json
vendored
Normal file
12
test/fixtures/responses/get-ledger-by-hash.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"stateHash": "A155BFE86054BE654796EC449E7C374CD5CAA3789BA75D302E7F0F4CE470CCB3",
|
||||||
|
"closeTime": "2018-12-07T11:10:30.000Z",
|
||||||
|
"closeTimeResolution": 10,
|
||||||
|
"closeFlags": 0,
|
||||||
|
"ledgerHash": "15F20E5FA6EA9770BBFFDBD62787400960B04BE32803B20C41F117F41C13830D",
|
||||||
|
"ledgerVersion": 14995338,
|
||||||
|
"parentLedgerHash": "E0BC4F5FB8D9025087BE238664833DFA5658C9E7CE413B3B6F7DF4FFF1EDBF40",
|
||||||
|
"parentCloseTime": "2018-12-07T11:10:22.000Z",
|
||||||
|
"totalDrops": "99997114637345372",
|
||||||
|
"transactionHash": "52C0B6604D2EF203710FEA24F4A3750A4F2BCD5C67D6EB5FB1B2DBAE9A14DCE8"
|
||||||
|
}
|
||||||
1
test/fixtures/responses/index.js
vendored
1
test/fixtures/responses/index.js
vendored
@@ -83,6 +83,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
getLedger: {
|
getLedger: {
|
||||||
header: require('./get-ledger'),
|
header: require('./get-ledger'),
|
||||||
|
headerByHash: require('./get-ledger-by-hash'),
|
||||||
full: require('./get-ledger-full'),
|
full: require('./get-ledger-full'),
|
||||||
withSettingsTx: require('./get-ledger-with-settings-tx'),
|
withSettingsTx: require('./get-ledger-with-settings-tx'),
|
||||||
withStateAsHashes: require('./get-ledger-with-state-as-hashes'),
|
withStateAsHashes: require('./get-ledger-with-state-as-hashes'),
|
||||||
|
|||||||
22
test/fixtures/responses/submit.json
vendored
22
test/fixtures/responses/submit.json
vendored
@@ -1,4 +1,24 @@
|
|||||||
{
|
{
|
||||||
"resultCode": "tesSUCCESS",
|
"resultCode": "tesSUCCESS",
|
||||||
"resultMessage": "The transaction was applied. Only final in a validated ledger."
|
"resultMessage": "The transaction was applied. Only final in a validated ledger.",
|
||||||
|
"engine_result": "tesSUCCESS",
|
||||||
|
"engine_result_code": 0,
|
||||||
|
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||||
|
"tx_blob": "1200002280000000240000016861D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA9684000000000002710732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB7446304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F858081144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754",
|
||||||
|
"tx_json": {
|
||||||
|
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
|
"Amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||||
|
"Fee": "10000",
|
||||||
|
"Flags": 2147483648,
|
||||||
|
"Sequence": 360,
|
||||||
|
"SigningPubKey": "03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB",
|
||||||
|
"TransactionType": "Payment",
|
||||||
|
"TxnSignature": "304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F8580",
|
||||||
|
"hash": "4D5D90890F8D49519E4151938601EF3D0B30B16CD6A519D9C99102C9FA77F7E0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
test/fixtures/rippled/index.js
vendored
1
test/fixtures/rippled/index.js
vendored
@@ -7,6 +7,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
ledger: {
|
ledger: {
|
||||||
normal: require('./ledger'),
|
normal: require('./ledger'),
|
||||||
|
normalByHash: require('./ledger-by-hash'),
|
||||||
notFound: require('./ledger-not-found'),
|
notFound: require('./ledger-not-found'),
|
||||||
withoutCloseTime: require('./ledger-without-close-time'),
|
withoutCloseTime: require('./ledger-without-close-time'),
|
||||||
withSettingsTx: require('./ledger-with-settings-tx'),
|
withSettingsTx: require('./ledger-with-settings-tx'),
|
||||||
|
|||||||
28
test/fixtures/rippled/ledger-by-hash.json
vendored
Normal file
28
test/fixtures/rippled/ledger-by-hash.json
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"id":1,
|
||||||
|
"result": {
|
||||||
|
"ledger": {
|
||||||
|
"accepted": true,
|
||||||
|
"account_hash": "A155BFE86054BE654796EC449E7C374CD5CAA3789BA75D302E7F0F4CE470CCB3",
|
||||||
|
"close_flags": 0,
|
||||||
|
"close_time": 597496230,
|
||||||
|
"close_time_human": "2018-Dec-07 11:10:30.000000000",
|
||||||
|
"close_time_resolution": 10,
|
||||||
|
"closed": true,
|
||||||
|
"hash": "15F20E5FA6EA9770BBFFDBD62787400960B04BE32803B20C41F117F41C13830D",
|
||||||
|
"ledger_hash": "15F20E5FA6EA9770BBFFDBD62787400960B04BE32803B20C41F117F41C13830D",
|
||||||
|
"ledger_index": "14995338",
|
||||||
|
"parent_close_time": 597496222,
|
||||||
|
"parent_hash": "E0BC4F5FB8D9025087BE238664833DFA5658C9E7CE413B3B6F7DF4FFF1EDBF40",
|
||||||
|
"seqNum": "14995338",
|
||||||
|
"totalCoins": "99997114637345372",
|
||||||
|
"total_coins": "99997114637345372",
|
||||||
|
"transaction_hash": "52C0B6604D2EF203710FEA24F4A3750A4F2BCD5C67D6EB5FB1B2DBAE9A14DCE8"
|
||||||
|
},
|
||||||
|
"ledger_hash": "15F20E5FA6EA9770BBFFDBD62787400960B04BE32803B20C41F117F41C13830D",
|
||||||
|
"ledger_index": 14995338,
|
||||||
|
"validated": true
|
||||||
|
},
|
||||||
|
"status": "success",
|
||||||
|
"type": "response"
|
||||||
|
}
|
||||||
19
test/fixtures/rippled/submit.json
vendored
19
test/fixtures/rippled/submit.json
vendored
@@ -7,7 +7,22 @@
|
|||||||
"engine_result": "tesSUCCESS",
|
"engine_result": "tesSUCCESS",
|
||||||
"engine_result_code": 0,
|
"engine_result_code": 0,
|
||||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||||
"tx_blob": "12000322000000002400000017201B0086955468400000000000000C732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D87446304402207660BDEF67105CE1EBA9AD35DC7156BAB43FF1D47633199EE257D70B6B9AAFBF02207F5517BC8AEF2ADC1325897ECDBA8C673838048BCA62F4E98B252F19BE88796D770A726970706C652E636F6D81144FBFF73DA4ECF9B701940F27341FA8020C313443",
|
"tx_blob": "1200002280000000240000016861D4838D7EA4C6800000000000000000000000000055534400000000004B4E9C06F24296074F7BC48F92A97916C6DC5EA9684000000000002710732103AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB7446304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F858081144B4E9C06F24296074F7BC48F92A97916C6DC5EA983143E9D4A2B8AA0780F682D136F7A56D6724EF53754",
|
||||||
"tx_json": {}
|
"tx_json": {
|
||||||
|
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
|
"Amount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||||
|
"Fee": "10000",
|
||||||
|
"Flags": 2147483648,
|
||||||
|
"Sequence": 360,
|
||||||
|
"SigningPubKey": "03AB40A0490F9B7ED8DF29D246BF2D6269820A0EE7742ACDD457BEA7C7D0931EDB",
|
||||||
|
"TransactionType": "Payment",
|
||||||
|
"TxnSignature": "304402200E5C2DD81FDF0BE9AB2A8D797885ED49E804DBF28E806604D878756410CA98B102203349581946B0DDA06B36B35DBC20EDA27552C1F167BCF5C6ECFF49C6A46F8580",
|
||||||
|
"hash": "4D5D90890F8D49519E4151938601EF3D0B30B16CD6A519D9C99102C9FA77F7E0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,6 +268,8 @@ module.exports = function createMockRippled(port) {
|
|||||||
const response = _.assign({}, fixtures.ledger.normal,
|
const response = _.assign({}, fixtures.ledger.normal,
|
||||||
{ result: { ledger: fullLedger } });
|
{ result: { ledger: fullLedger } });
|
||||||
conn.send(createLedgerResponse(request, response));
|
conn.send(createLedgerResponse(request, response));
|
||||||
|
} else if (request.ledger_hash === '15F20E5FA6EA9770BBFFDBD62787400960B04BE32803B20C41F117F41C13830D') {
|
||||||
|
conn.send(createLedgerResponse(request, fixtures.ledger.normalByHash));
|
||||||
} else if (request.ledger_index === 'validated' ||
|
} else if (request.ledger_index === 'validated' ||
|
||||||
request.ledger_index === 14661789 ||
|
request.ledger_index === 14661789 ||
|
||||||
request.ledger_index === 14661788 /* getTransaction - order */) {
|
request.ledger_index === 14661788 /* getTransaction - order */) {
|
||||||
|
|||||||
Reference in New Issue
Block a user