mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +00:00
Organize JSON schemas for documentation generation
This commit is contained in:
@@ -17,5 +17,6 @@ module.exports = {
|
|||||||
convertKeysFromSnakeCaseToCamelCase:
|
convertKeysFromSnakeCaseToCamelCase:
|
||||||
utils.convertKeysFromSnakeCaseToCamelCase,
|
utils.convertKeysFromSnakeCaseToCamelCase,
|
||||||
iso8601ToRippleTime: utils.iso8601ToRippleTime,
|
iso8601ToRippleTime: utils.iso8601ToRippleTime,
|
||||||
rippleTimeToISO8601: utils.rippleTimeToISO8601
|
rippleTimeToISO8601: utils.rippleTimeToISO8601,
|
||||||
|
isValidSecret: utils.isValidSecret
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,79 +6,93 @@ const assert = require('assert');
|
|||||||
const Ajv = require('ajv');
|
const Ajv = require('ajv');
|
||||||
const ValidationError = require('./errors').ValidationError;
|
const ValidationError = require('./errors').ValidationError;
|
||||||
const {isValidAddress} = require('ripple-address-codec');
|
const {isValidAddress} = require('ripple-address-codec');
|
||||||
|
const {isValidSecret} = require('./utils');
|
||||||
|
|
||||||
function loadSchemas() {
|
function loadSchemas() {
|
||||||
// listed explicitly for webpack (instead of scanning schemas directory)
|
// listed explicitly for webpack (instead of scanning schemas directory)
|
||||||
const schemas = [
|
const schemas = [
|
||||||
require('./schemas/objects/address.json'),
|
require('./schemas/objects/tx-json.json'),
|
||||||
require('./schemas/objects/adjustment.json'),
|
|
||||||
require('./schemas/objects/amount.json'),
|
|
||||||
require('./schemas/objects/amount-base.json'),
|
|
||||||
require('./schemas/objects/balance.json'),
|
|
||||||
require('./schemas/objects/blob.json'),
|
|
||||||
require('./schemas/objects/currency.json'),
|
|
||||||
require('./schemas/output/get-account-info.json'),
|
|
||||||
require('./schemas/output/get-balances.json'),
|
|
||||||
require('./schemas/output/get-balance-sheet'),
|
|
||||||
require('./schemas/input/balance-sheet-options.json'),
|
|
||||||
require('./schemas/output/get-ledger.json'),
|
|
||||||
require('./schemas/output/get-orderbook.json'),
|
|
||||||
require('./schemas/output/get-orders.json'),
|
|
||||||
require('./schemas/output/get-paths.json'),
|
|
||||||
require('./schemas/output/get-server-info.json'),
|
|
||||||
require('./schemas/output/get-settings.json'),
|
|
||||||
require('./schemas/output/get-transaction.json'),
|
|
||||||
require('./schemas/output/get-transactions.json'),
|
|
||||||
require('./schemas/output/get-trustlines.json'),
|
|
||||||
require('./schemas/objects/hash128.json'),
|
require('./schemas/objects/hash128.json'),
|
||||||
require('./schemas/objects/hash256.json'),
|
require('./schemas/objects/hash256.json'),
|
||||||
require('./schemas/input/instructions.json'),
|
require('./schemas/objects/sequence.json'),
|
||||||
require('./schemas/objects/issue.json'),
|
require('./schemas/objects/issue.json'),
|
||||||
require('./schemas/input/ledger-options.json'),
|
|
||||||
require('./schemas/objects/ledgerversion.json'),
|
require('./schemas/objects/ledgerversion.json'),
|
||||||
require('./schemas/objects/max-adjustment.json'),
|
require('./schemas/objects/max-adjustment.json'),
|
||||||
require('./schemas/objects/memo.json'),
|
require('./schemas/objects/memo.json'),
|
||||||
require('./schemas/output/order-cancellation-transaction.json'),
|
|
||||||
require('./schemas/input/order-cancellation.json'),
|
|
||||||
require('./schemas/output/order-change.json'),
|
|
||||||
require('./schemas/output/order-transaction.json'),
|
|
||||||
require('./schemas/input/order.json'),
|
|
||||||
require('./schemas/output/orderbook-orders.json'),
|
|
||||||
require('./schemas/input/orderbook.json'),
|
|
||||||
require('./schemas/input/orders-options.json'),
|
|
||||||
require('./schemas/output/outcome.json'),
|
|
||||||
require('./schemas/input/pathfind.json'),
|
|
||||||
require('./schemas/output/payment-transaction.json'),
|
|
||||||
require('./schemas/input/payment.json'),
|
|
||||||
require('./schemas/objects/quality.json'),
|
|
||||||
require('./schemas/input/api-options.json'),
|
|
||||||
require('./schemas/objects/sequence.json'),
|
|
||||||
require('./schemas/input/settings-options.json'),
|
|
||||||
require('./schemas/output/settings-transaction.json'),
|
|
||||||
require('./schemas/input/settings.json'),
|
|
||||||
require('./schemas/output/sign.json'),
|
|
||||||
require('./schemas/objects/signed-value.json'),
|
|
||||||
require('./schemas/output/submit.json'),
|
|
||||||
require('./schemas/input/suspended-payment-cancellation.json'),
|
|
||||||
require('./schemas/input/suspended-payment-execution.json'),
|
|
||||||
require('./schemas/input/suspended-payment-creation.json'),
|
|
||||||
require('./schemas/input/transaction-options.json'),
|
|
||||||
require('./schemas/input/transactions-options.json'),
|
|
||||||
require('./schemas/output/trustline-transaction.json'),
|
|
||||||
require('./schemas/input/trustline.json'),
|
|
||||||
require('./schemas/input/trustlines-options.json'),
|
|
||||||
require('./schemas/objects/tx-json.json'),
|
|
||||||
require('./schemas/objects/uint32.json'),
|
require('./schemas/objects/uint32.json'),
|
||||||
require('./schemas/objects/value.json'),
|
require('./schemas/objects/value.json'),
|
||||||
require('./schemas/output/prepare.json'),
|
|
||||||
require('./schemas/output/ledger-closed.json'),
|
|
||||||
require('./schemas/objects/source-adjustment.json'),
|
require('./schemas/objects/source-adjustment.json'),
|
||||||
require('./schemas/objects/destination-adjustment.json'),
|
require('./schemas/objects/destination-adjustment.json'),
|
||||||
require('./schemas/objects/tag.json'),
|
require('./schemas/objects/tag.json'),
|
||||||
require('./schemas/objects/lax-amount.json'),
|
require('./schemas/objects/lax-amount.json'),
|
||||||
require('./schemas/objects/lax-lax-amount.json'),
|
require('./schemas/objects/lax-lax-amount.json'),
|
||||||
require('./schemas/objects/min-adjustment.json'),
|
require('./schemas/objects/min-adjustment.json'),
|
||||||
require('./schemas/objects/lax-adjustment.json')
|
require('./schemas/objects/lax-adjustment.json'),
|
||||||
|
require('./schemas/objects/tx-hash.json'),
|
||||||
|
require('./schemas/objects/address.json'),
|
||||||
|
require('./schemas/objects/adjustment.json'),
|
||||||
|
require('./schemas/objects/quality.json'),
|
||||||
|
require('./schemas/objects/amount.json'),
|
||||||
|
require('./schemas/objects/amount-base.json'),
|
||||||
|
require('./schemas/objects/balance.json'),
|
||||||
|
require('./schemas/objects/blob.json'),
|
||||||
|
require('./schemas/objects/currency.json'),
|
||||||
|
require('./schemas/objects/signed-value.json'),
|
||||||
|
require('./schemas/objects/orderbook.json'),
|
||||||
|
require('./schemas/objects/instructions.json'),
|
||||||
|
require('./schemas/specifications/settings.json'),
|
||||||
|
require('./schemas/specifications/payment.json'),
|
||||||
|
require('./schemas/specifications/suspended-payment-cancellation.json'),
|
||||||
|
require('./schemas/specifications/order-cancellation.json'),
|
||||||
|
require('./schemas/specifications/order.json'),
|
||||||
|
require('./schemas/specifications/suspended-payment-execution.json'),
|
||||||
|
require('./schemas/specifications/suspended-payment-creation.json'),
|
||||||
|
require('./schemas/specifications/trustline.json'),
|
||||||
|
require('./schemas/output/sign.json'),
|
||||||
|
require('./schemas/output/submit.json'),
|
||||||
|
require('./schemas/output/get-account-info.json'),
|
||||||
|
require('./schemas/output/get-balances.json'),
|
||||||
|
require('./schemas/output/get-balance-sheet'),
|
||||||
|
require('./schemas/output/get-ledger.json'),
|
||||||
|
require('./schemas/output/get-orderbook.json'),
|
||||||
|
require('./schemas/output/settings-transaction.json'),
|
||||||
|
require('./schemas/output/get-orders.json'),
|
||||||
|
require('./schemas/output/order-change.json'),
|
||||||
|
require('./schemas/output/order-cancellation-transaction.json'),
|
||||||
|
require('./schemas/output/prepare.json'),
|
||||||
|
require('./schemas/output/ledger-closed.json'),
|
||||||
|
require('./schemas/output/order-transaction.json'),
|
||||||
|
require('./schemas/output/get-paths.json'),
|
||||||
|
require('./schemas/output/trustline-transaction.json'),
|
||||||
|
require('./schemas/output/get-server-info.json'),
|
||||||
|
require('./schemas/output/get-settings.json'),
|
||||||
|
require('./schemas/output/orderbook-orders.json'),
|
||||||
|
require('./schemas/output/payment-transaction.json'),
|
||||||
|
require('./schemas/output/outcome.json'),
|
||||||
|
require('./schemas/output/get-transaction.json'),
|
||||||
|
require('./schemas/output/get-transactions.json'),
|
||||||
|
require('./schemas/output/get-trustlines.json'),
|
||||||
|
require('./schemas/input/get-balance-sheet.json'),
|
||||||
|
require('./schemas/input/get-ledger.json'),
|
||||||
|
require('./schemas/input/get-orders.json'),
|
||||||
|
require('./schemas/input/get-orderbook.json'),
|
||||||
|
require('./schemas/input/get-paths.json'),
|
||||||
|
require('./schemas/input/api-options.json'),
|
||||||
|
require('./schemas/input/get-settings.json'),
|
||||||
|
require('./schemas/input/get-transaction.json'),
|
||||||
|
require('./schemas/input/get-transactions.json'),
|
||||||
|
require('./schemas/input/get-trustlines.json'),
|
||||||
|
require('./schemas/input/prepare-payment.json'),
|
||||||
|
require('./schemas/input/prepare-order.json'),
|
||||||
|
require('./schemas/input/prepare-trustline.json'),
|
||||||
|
require('./schemas/input/prepare-order-cancellation.json'),
|
||||||
|
require('./schemas/input/prepare-settings.json'),
|
||||||
|
require('./schemas/input/prepare-suspended-payment-creation.json'),
|
||||||
|
require('./schemas/input/prepare-suspended-payment-cancellation.json'),
|
||||||
|
require('./schemas/input/prepare-suspended-payment-execution.json'),
|
||||||
|
require('./schemas/input/compute-ledger-hash'),
|
||||||
|
require('./schemas/input/sign'),
|
||||||
|
require('./schemas/input/submit')
|
||||||
];
|
];
|
||||||
const titles = _.map(schemas, schema => schema.title);
|
const titles = _.map(schemas, schema => schema.title);
|
||||||
const duplicates = _.keys(_.pick(_.countBy(titles), count => count > 1));
|
const duplicates = _.keys(_.pick(_.countBy(titles), count => count > 1));
|
||||||
@@ -86,6 +100,7 @@ function loadSchemas() {
|
|||||||
const ajv = new Ajv();
|
const ajv = new Ajv();
|
||||||
_.forEach(schemas, schema => ajv.addSchema(schema, schema.title));
|
_.forEach(schemas, schema => ajv.addSchema(schema, schema.title));
|
||||||
ajv.addFormat('address', isValidAddress);
|
ajv.addFormat('address', isValidAddress);
|
||||||
|
ajv.addFormat('secret', isValidSecret);
|
||||||
return ajv;
|
return ajv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,5 +114,6 @@ function schemaValidate(schemaName: string, object: any): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
schemaValidate
|
schemaValidate,
|
||||||
|
isValidSecret
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
||||||
"title": "balance-sheet-options",
|
|
||||||
"description": "Options for getBalanceSheet",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"excludeAddresses": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {"$ref": "address"},
|
|
||||||
"uniqueItems": true
|
|
||||||
},
|
|
||||||
"ledgerVersion": {"$ref": "ledgerVersion"}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
10
src/common/schemas/input/compute-ledger-hash.json
Normal file
10
src/common/schemas/input/compute-ledger-hash.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "computeLedgerHashParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"ledger": {"$ref": "getLedger"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["ledger"]
|
||||||
|
}
|
||||||
22
src/common/schemas/input/get-balance-sheet.json
Normal file
22
src/common/schemas/input/get-balance-sheet.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "getBalanceSheetParameters",
|
||||||
|
"description": "Parameters for getBalanceSheet",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"options": {
|
||||||
|
"properties": {
|
||||||
|
"excludeAddresses": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {"$ref": "address"},
|
||||||
|
"uniqueItems": true
|
||||||
|
},
|
||||||
|
"ledgerVersion": {"$ref": "ledgerVersion"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address"]
|
||||||
|
}
|
||||||
18
src/common/schemas/input/get-ledger.json
Normal file
18
src/common/schemas/input/get-ledger.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "getLedgerParameters",
|
||||||
|
"description": "Parameters for getLedger",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"options": {
|
||||||
|
"properties": {
|
||||||
|
"ledgerVersion": {"$ref": "ledgerVersion"},
|
||||||
|
"includeAllData": {"type": "boolean"},
|
||||||
|
"includeTransactions": {"type": "boolean"},
|
||||||
|
"includeState": {"type": "boolean"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
25
src/common/schemas/input/get-orderbook.json
Normal file
25
src/common/schemas/input/get-orderbook.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "getOrderbookParameters",
|
||||||
|
"description": "Parameters for getOrderbook",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {
|
||||||
|
"$ref": "address",
|
||||||
|
"description": "Address of an account to use as point-of-view. (This affects which unfunded offers are returned.)"
|
||||||
|
},
|
||||||
|
"orderbook": {"$ref": "orderbook"},
|
||||||
|
"options": {
|
||||||
|
"properties": {
|
||||||
|
"limit": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
"ledgerVersion": {"$ref": "ledgerVersion"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["address", "orderbook"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
21
src/common/schemas/input/get-orders.json
Normal file
21
src/common/schemas/input/get-orders.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "getOrdersParameters",
|
||||||
|
"description": "Parameters for getOrders",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"options": {
|
||||||
|
"properties": {
|
||||||
|
"limit": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
"ledgerVersion": {"$ref": "ledgerVersion"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["address"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
49
src/common/schemas/input/get-paths.json
Normal file
49
src/common/schemas/input/get-paths.json
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "getPathsParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"pathfind": {
|
||||||
|
"properties": {
|
||||||
|
"source": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"amount": {"$ref": "laxAmount"},
|
||||||
|
"currencies": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"currency": {"$ref": "currency"},
|
||||||
|
"counterparty": {"$ref": "address"}
|
||||||
|
},
|
||||||
|
"required": ["currency"],
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
"uniqueItems": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"not": {
|
||||||
|
"required": ["amount", "currencies"]
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address"]
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"amount": {"$ref": "laxLaxAmount"}
|
||||||
|
},
|
||||||
|
"required": ["address", "amount"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["source", "destination"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["pathfind"]
|
||||||
|
}
|
||||||
17
src/common/schemas/input/get-settings.json
Normal file
17
src/common/schemas/input/get-settings.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "getSettingsParameters",
|
||||||
|
"description": "Parameters for getSettings and getAccountInfo",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"options": {
|
||||||
|
"properties": {
|
||||||
|
"ledgerVersion": {"$ref": "ledgerVersion"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["address"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
18
src/common/schemas/input/get-transaction.json
Normal file
18
src/common/schemas/input/get-transaction.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "getTransactionParameters",
|
||||||
|
"description": "Parameters for getTransaction",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"identifier": {"$ref": "identifier"},
|
||||||
|
"options": {
|
||||||
|
"properties": {
|
||||||
|
"minLedgerVersion": {"$ref": "ledgerVersion"},
|
||||||
|
"maxLedgerVersion": {"$ref": "ledgerVersion"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["identifier"]
|
||||||
|
}
|
||||||
46
src/common/schemas/input/get-transactions.json
Normal file
46
src/common/schemas/input/get-transactions.json
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "getTransactionsParameters",
|
||||||
|
"description": "Parameters for getTransactions",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"options": {
|
||||||
|
"properties": {
|
||||||
|
"start": {"$ref": "hash256"},
|
||||||
|
"limit": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
"minLedgerVersion": {"$ref": "ledgerVersion"},
|
||||||
|
"maxLedgerVersion": {"$ref": "ledgerVersion"},
|
||||||
|
"earliestFirst": {"type": "boolean"},
|
||||||
|
"excludeFailures": {"type": "boolean"},
|
||||||
|
"initiated": {"type": "boolean"},
|
||||||
|
"counterparty": {"$ref": "address"},
|
||||||
|
"types": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"enum": [
|
||||||
|
"payment",
|
||||||
|
"trustline",
|
||||||
|
"order",
|
||||||
|
"orderCancellation",
|
||||||
|
"settings"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"binary": {"type": "boolean"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"not": {
|
||||||
|
"anyOf": [
|
||||||
|
{"required": ["start", "minLedgerVersion"]},
|
||||||
|
{"required": ["start", "maxLedgerVersion"]}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address"]
|
||||||
|
}
|
||||||
23
src/common/schemas/input/get-trustlines.json
Normal file
23
src/common/schemas/input/get-trustlines.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "getTrustlinesParameters",
|
||||||
|
"description": "Parameters for getTrustlines and getBalances",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"options": {
|
||||||
|
"properties": {
|
||||||
|
"counterparty": {"$ref": "address"},
|
||||||
|
"currency": {"$ref": "currency"},
|
||||||
|
"limit": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1
|
||||||
|
},
|
||||||
|
"ledgerVersion": {"$ref": "ledgerVersion"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address"]
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
||||||
"title": "ledger-options",
|
|
||||||
"description": "Options for getLedger",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"ledgerVersion": {"$ref": "ledgerVersion"},
|
|
||||||
"includeAllData": {"type": "boolean"},
|
|
||||||
"includeTransactions": {"type": "boolean"},
|
|
||||||
"includeState": {"type": "boolean"}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
||||||
"title": "orders-options",
|
|
||||||
"description": "Options for getOrders and getOrderbook",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"limit": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 1
|
|
||||||
},
|
|
||||||
"ledgerVersion": {"$ref": "ledgerVersion"}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
||||||
"title": "pathfind",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"source": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"address": {"$ref": "address"},
|
|
||||||
"amount": {"$ref": "laxAmount"},
|
|
||||||
"currencies": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"currency": {"$ref": "currency"},
|
|
||||||
"counterparty": {"$ref": "address"}
|
|
||||||
},
|
|
||||||
"required": ["currency"],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"uniqueItems": true
|
|
||||||
},
|
|
||||||
"not": {
|
|
||||||
"required": ["amount", "currencies"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false,
|
|
||||||
"required": ["address"]
|
|
||||||
},
|
|
||||||
"destination": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"address": {"$ref": "address"},
|
|
||||||
"amount": {"$ref": "laxLaxAmount"}
|
|
||||||
},
|
|
||||||
"required": ["address", "amount"],
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": ["source", "destination"],
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
12
src/common/schemas/input/prepare-order-cancellation.json
Normal file
12
src/common/schemas/input/prepare-order-cancellation.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "prepareOrderCancellationParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"sequence": {"$ref": "sequence"},
|
||||||
|
"instructions": {"$ref": "instructions"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address", "sequence"]
|
||||||
|
}
|
||||||
12
src/common/schemas/input/prepare-order.json
Normal file
12
src/common/schemas/input/prepare-order.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "prepareOrderParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"order": {"$ref": "order"},
|
||||||
|
"instructions": {"$ref": "instructions"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address", "order"]
|
||||||
|
}
|
||||||
12
src/common/schemas/input/prepare-payment.json
Normal file
12
src/common/schemas/input/prepare-payment.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "preparePaymentParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"payment": {"$ref": "payment"},
|
||||||
|
"instructions": {"$ref": "instructions"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address", "payment"]
|
||||||
|
}
|
||||||
12
src/common/schemas/input/prepare-settings.json
Normal file
12
src/common/schemas/input/prepare-settings.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "prepareSettingsParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"settings": {"$ref": "settings"},
|
||||||
|
"instructions": {"$ref": "instructions"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address", "settings"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "prepareSuspendedPaymentCancellationParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"suspendedPaymentCancellation": {"$ref": "suspendedPaymentCancellation"},
|
||||||
|
"instructions": {"$ref": "instructions"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address", "suspendedPaymentCancellation"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "prepareSuspendedPaymentCreationParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"suspendedPaymentCreation": {"$ref": "suspendedPaymentCreation"},
|
||||||
|
"instructions": {"$ref": "instructions"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address", "suspendedPaymentCreation"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "prepareSuspendedPaymentExecutionParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"suspendedPaymentExecution": {"$ref": "suspendedPaymentExecution"},
|
||||||
|
"instructions": {"$ref": "instructions"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address", "suspendedPaymentExecution"]
|
||||||
|
}
|
||||||
12
src/common/schemas/input/prepare-trustline.json
Normal file
12
src/common/schemas/input/prepare-trustline.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "prepareTrustlineParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {"$ref": "address"},
|
||||||
|
"trustline": {"$ref": "trustline"},
|
||||||
|
"instructions": {"$ref": "instructions"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["address", "trustline"]
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
||||||
"title": "settings-options",
|
|
||||||
"description": "Options for getSettings and getAccountInfo",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"ledgerVersion": {"$ref": "ledgerVersion"}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
18
src/common/schemas/input/sign.json
Normal file
18
src/common/schemas/input/sign.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "signParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"txJSON": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Transaction represented as a JSON string in rippled format."
|
||||||
|
},
|
||||||
|
"secret": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "secret",
|
||||||
|
"description": "The secret of the account that is initiating the transaction."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["txJSON", "secret"]
|
||||||
|
}
|
||||||
10
src/common/schemas/input/submit.json
Normal file
10
src/common/schemas/input/submit.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "submitParameters",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"txBlob": {"$ref": "blob"}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"required": ["txBlob"]
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
||||||
"title": "transaction-options",
|
|
||||||
"description": "Options for getTransaction",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"minLedgerVersion": {"$ref": "ledgerVersion"},
|
|
||||||
"maxLedgerVersion": {"$ref": "ledgerVersion"}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
||||||
"title": "transactions-options",
|
|
||||||
"description": "Options for getTransactions",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"start": {"$ref": "hash256"},
|
|
||||||
"limit": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 1
|
|
||||||
},
|
|
||||||
"minLedgerVersion": {"$ref": "ledgerVersion"},
|
|
||||||
"maxLedgerVersion": {"$ref": "ledgerVersion"},
|
|
||||||
"earliestFirst": {"type": "boolean"},
|
|
||||||
"excludeFailures": {"type": "boolean"},
|
|
||||||
"initiated": {"type": "boolean"},
|
|
||||||
"counterparty": {"$ref": "address"},
|
|
||||||
"types": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"enum": [
|
|
||||||
"payment",
|
|
||||||
"trustline",
|
|
||||||
"order",
|
|
||||||
"orderCancellation",
|
|
||||||
"settings"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"binary": {"type": "boolean"}
|
|
||||||
},
|
|
||||||
"additionalProperties": false,
|
|
||||||
"not": {
|
|
||||||
"anyOf": [
|
|
||||||
{"required": ["incoming", "outgoing"]},
|
|
||||||
{"required": ["start", "minLedgerVersion"]},
|
|
||||||
{"required": ["start", "maxLedgerVersion"]}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
||||||
"title": "trustlines-options",
|
|
||||||
"description": "Options for getTrustlines and getBalances",
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"counterparty": {"$ref": "address"},
|
|
||||||
"currency": {"$ref": "currency"},
|
|
||||||
"limit": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 1
|
|
||||||
},
|
|
||||||
"ledgerVersion": {"$ref": "ledgerVersion"}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
@@ -4,5 +4,6 @@
|
|||||||
"description": "A Ripple account address",
|
"description": "A Ripple account address",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "address",
|
"format": "address",
|
||||||
|
"link": "ripple-address",
|
||||||
"pattern": "^r[1-9A-HJ-NP-Za-km-z]{25,34}$"
|
"pattern": "^r[1-9A-HJ-NP-Za-km-z]{25,34}$"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "amount",
|
"title": "amount",
|
||||||
|
"link": "amount",
|
||||||
"description": "An Amount on the Ripple Protocol, used also for XRP in the ripple-rest API",
|
"description": "An Amount on the Ripple Protocol, used also for XRP in the ripple-rest API",
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{"$ref": "amountbase"},
|
{"$ref": "amountbase"},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "balance",
|
"title": "balance",
|
||||||
"description": "Balance amount",
|
"description": "Balance amount",
|
||||||
|
"link": "amount",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"value": {
|
"value": {
|
||||||
|
|||||||
@@ -3,5 +3,6 @@
|
|||||||
"title": "currency",
|
"title": "currency",
|
||||||
"description": "The three-character code or hex string used to denote currencies",
|
"description": "The three-character code or hex string used to denote currencies",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"link": "currency",
|
||||||
"pattern": "^([a-zA-Z0-9<>(){}[\\]|?!@#$%^&*]{3}|[A-F0-9]{40})$"
|
"pattern": "^([a-zA-Z0-9<>(){}[\\]|?!@#$%^&*]{3}|[A-F0-9]{40})$"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "instructions",
|
"title": "instructions",
|
||||||
|
"link": "transaction-instructions",
|
||||||
"description": "Instructions for executing a transaction",
|
"description": "Instructions for executing a transaction",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "laxAmount",
|
"title": "laxAmount",
|
||||||
"description": "Amount where counterparty is optional",
|
"description": "Amount where counterparty is optional",
|
||||||
|
"link": "amount",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"currency": {"$ref": "currency"},
|
"currency": {"$ref": "currency"},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "laxLaxAmount",
|
"title": "laxLaxAmount",
|
||||||
"description": "Amount where counterparty and value are optional",
|
"description": "Amount where counterparty and value are optional",
|
||||||
|
"link": "amount",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"currency": {"$ref": "currency"},
|
"currency": {"$ref": "currency"},
|
||||||
|
|||||||
8
src/common/schemas/objects/tx-hash.json
Normal file
8
src/common/schemas/objects/tx-hash.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "identifier",
|
||||||
|
"link": "transaction-identifier",
|
||||||
|
"description": "A hash of a transaction used to identify the transaction, represented in hexadecimal.",
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "^[A-F0-9]{64}$"
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "tx",
|
"title": "tx",
|
||||||
|
"link": "https://ripple.com/build/transactions/",
|
||||||
"description": "An object in rippled txJSON format",
|
"description": "An object in rippled txJSON format",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -3,47 +3,117 @@
|
|||||||
"title": "getServerInfo",
|
"title": "getServerInfo",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"buildVersion": {"type": "string"},
|
"buildVersion": {
|
||||||
"completeLedgers": {"type": "string", "pattern": "[0-9,-]+"},
|
"type": "string",
|
||||||
"hostid": {"type": "string"},
|
"description": "The version number of the running rippled version."
|
||||||
"ioLatencyMs": {"type": "number"},
|
},
|
||||||
|
"completeLedgers": {
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "[0-9,-]+",
|
||||||
|
"description": "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": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "On an admin request, returns the hostname of the server running the rippled instance; otherwise, returns a unique four letter word."
|
||||||
|
},
|
||||||
|
"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."
|
||||||
|
},
|
||||||
"load": {
|
"load": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"description": "*(Admin only)* Detailed information about the current load state of the server.",
|
||||||
"properties": {
|
"properties": {
|
||||||
"jobTypes": {
|
"jobTypes": {
|
||||||
"type": "array",
|
"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.",
|
||||||
"items": {"type": "object"}
|
"items": {"type": "object"}
|
||||||
},
|
},
|
||||||
"threads": {"type": "number"}
|
"threads": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "*(Admin only)* The number of threads in the server’s main job pool, performing various Ripple Network operations."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"required": ["jobTypes", "threads"]
|
||||||
|
},
|
||||||
"lastClose": {
|
"lastClose": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"description": "Information about the last time the server closed a ledger.",
|
||||||
"properties": {
|
"properties": {
|
||||||
"convergeTimeS": {"type": "number"},
|
"convergeTimeS": {
|
||||||
"proposers": {"type": "integer", "minimum": 0}
|
"type": "number",
|
||||||
}
|
"description": "The time it took to reach a consensus for the last ledger closing."
|
||||||
|
},
|
||||||
|
"proposers": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"description": "Number of trusted validators participating in the ledger closing."}
|
||||||
|
},
|
||||||
|
"required": ["convergeTimeS", "proposers"]
|
||||||
|
},
|
||||||
|
"loadFactor": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "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 server’s load factor, cluster’s load factor, and the overall network’s load factor."
|
||||||
|
},
|
||||||
|
"peers": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"description": "How many other rippled servers the node is currently connected to."
|
||||||
|
},
|
||||||
|
"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.)"
|
||||||
|
},
|
||||||
|
"pubkeyValidator": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "*(Admin only)* Public key used by this node to sign ledger validations."
|
||||||
},
|
},
|
||||||
"loadFactor": {"type": "number"},
|
|
||||||
"peers": {"type": "integer", "minimum": 0},
|
|
||||||
"pubkeyNode": {"type": "string"},
|
|
||||||
"pubkeyValidator": {"type": "string"},
|
|
||||||
"serverState": {
|
"serverState": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
"description": "A string indicating to what extent the server is participating in the network. See [Possible Server States](https://ripple.com/build/rippled-apis/#possible-server-states) for more details.",
|
||||||
"enum": ["disconnected", "connected", "syncing", "tracking", "full", "validating", "proposing"]
|
"enum": ["disconnected", "connected", "syncing", "tracking", "full", "validating", "proposing"]
|
||||||
},
|
},
|
||||||
"validatedLedger": {
|
"validatedLedger": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"description": "Information about the fully-validated ledger with the highest sequence number (the most recent).",
|
||||||
"properties": {
|
"properties": {
|
||||||
"age": {"type": "integer", "minimum": 0},
|
"age": {
|
||||||
"baseFeeXrp": {"type": "number"},
|
"type": "integer",
|
||||||
"hash": {"$ref": "hash256"},
|
"minimum": 0,
|
||||||
"reserveBaseXrp": {"type": "integer", "minimum": 0},
|
"description": "The time since the ledger was closed, in seconds."
|
||||||
"reserveIncXrp": {"type": "integer", "minimum": 0},
|
},
|
||||||
"seq": {"type": "integer", "minimum": 0}
|
"baseFeeXrp": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Base fee, in XRP. This may be represented in scientific notation such as 1e-05 for 0.00005."
|
||||||
|
},
|
||||||
|
"hash": {
|
||||||
|
"$ref": "hash256",
|
||||||
|
"description": "Unique hash for the ledger, as hex."
|
||||||
|
},
|
||||||
|
"reserveBaseXrp": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"description": "Minimum amount of XRP (not drops) necessary for every account to keep in reserve."
|
||||||
|
},
|
||||||
|
"reserveIncXrp": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"description": "Amount of XRP (not drops) added to the account reserve for each object an account is responsible for in the ledger."
|
||||||
|
},
|
||||||
|
"seq": {
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"description": "Identifying sequence number of this ledger version."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validationQuorum": {"type": "number"}
|
"additionalProperties": false,
|
||||||
|
"required": ["age", "baseFeeXrp", "hash", "reserveBaseXrp", "reserveIncXrp", "seq"]
|
||||||
},
|
},
|
||||||
|
"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."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["buildVersion", "completeLedgers", "hostid", "ioLatencyMs", "lastClose", "loadFactor", "peers", "pubkeyNode", "serverState", "validatedLedger", "validationQuorum"],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "getSettings",
|
"title": "getSettings",
|
||||||
|
"link": "settings-specification",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"passwordSpent": {"type": "boolean"},
|
"passwordSpent": {"type": "boolean"},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "outcome",
|
"title": "outcome",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"link": "transaction-outcome",
|
||||||
"properties": {
|
"properties": {
|
||||||
"result": {"type": "string"},
|
"result": {"type": "string"},
|
||||||
"timestamp": {"type": "string", "format": "date-time"},
|
"timestamp": {"type": "string", "format": "date-time"},
|
||||||
|
|||||||
@@ -10,6 +10,6 @@
|
|||||||
"address": {"$ref": "address"},
|
"address": {"$ref": "address"},
|
||||||
"sequence": {"$ref": "sequence"}
|
"sequence": {"$ref": "sequence"}
|
||||||
},
|
},
|
||||||
"required": ["type", "id", "address", "sequence", "specification"],
|
"required": ["type", "id", "address", "sequence", "specification", "outcome"],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "orderCancellation",
|
"title": "orderCancellation",
|
||||||
|
"link": "order-cancellation-specification",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"orderSequence": {"$ref": "sequence"}
|
"orderSequence": {"$ref": "sequence"}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "order",
|
"title": "order",
|
||||||
|
"link": "order-specification",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"direction": {
|
"direction": {
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "payment",
|
"title": "payment",
|
||||||
|
"link": "payment-specification",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"source": {"$ref": "sourceAdjustment"},
|
"source": {"$ref": "sourceAdjustment"},
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "settings",
|
"title": "settings",
|
||||||
|
"link": "settings-specification",
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
"$ref": "getSettings"
|
"$ref": "getSettings"
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "suspended-payment-cancellation",
|
"title": "suspendedPaymentCancellation",
|
||||||
|
"link": "suspended-payment-cancellation-specification",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"memos": {
|
"memos": {
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "suspended-payment-creation",
|
"title": "suspendedPaymentCreation",
|
||||||
|
"link": "suspended-payment-creation-specification",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"source": {"$ref": "maxAdjustment"},
|
"source": {"$ref": "maxAdjustment"},
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "suspended-payment-execution",
|
"title": "suspendedPaymentExecution",
|
||||||
|
"link": "suspended-payment-execution-specification",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"memos": {
|
"memos": {
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "trustline",
|
"title": "trustline",
|
||||||
|
"link": "trustline-specification",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"currency": {"$ref": "currency"},
|
"currency": {"$ref": "currency"},
|
||||||
@@ -4,9 +4,19 @@ const _ = require('lodash');
|
|||||||
const BigNumber = require('bignumber.js');
|
const BigNumber = require('bignumber.js');
|
||||||
const errors = require('./errors');
|
const errors = require('./errors');
|
||||||
const keypairs = require('ripple-keypairs');
|
const keypairs = require('ripple-keypairs');
|
||||||
|
const {deriveKeypair} = require('ripple-keypairs');
|
||||||
|
|
||||||
import type {Amount, RippledAmount} from './types.js';
|
import type {Amount, RippledAmount} from './types.js';
|
||||||
|
|
||||||
|
function isValidSecret(secret: string): boolean {
|
||||||
|
try {
|
||||||
|
deriveKeypair(secret);
|
||||||
|
return true;
|
||||||
|
} catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function dropsToXrp(drops: string): string {
|
function dropsToXrp(drops: string): string {
|
||||||
return (new BigNumber(drops)).dividedBy(1000000.0).toString();
|
return (new BigNumber(drops)).dividedBy(1000000.0).toString();
|
||||||
}
|
}
|
||||||
@@ -96,5 +106,6 @@ module.exports = {
|
|||||||
convertKeysFromSnakeCaseToCamelCase,
|
convertKeysFromSnakeCaseToCamelCase,
|
||||||
removeUndefined,
|
removeUndefined,
|
||||||
rippleTimeToISO8601,
|
rippleTimeToISO8601,
|
||||||
iso8601ToRippleTime
|
iso8601ToRippleTime,
|
||||||
|
isValidSecret
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
'use strict';
|
'use strict';
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const deriveKeypair = require('ripple-keypairs').deriveKeypair;
|
|
||||||
const ValidationError = require('./errors').ValidationError;
|
const ValidationError = require('./errors').ValidationError;
|
||||||
const schemaValidate = require('./schema-validator').schemaValidate;
|
const schemaValidate = require('./schema-validator').schemaValidate;
|
||||||
|
|
||||||
@@ -9,27 +8,8 @@ function error(text) {
|
|||||||
return new ValidationError(text);
|
return new ValidationError(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isValidSecret(secret) {
|
|
||||||
try {
|
|
||||||
deriveKeypair(secret);
|
|
||||||
return true;
|
|
||||||
} catch (err) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateSecret(secret: string): void {
|
|
||||||
if (!secret) {
|
|
||||||
throw error('Parameter missing: secret');
|
|
||||||
}
|
|
||||||
if (typeof secret !== 'string' || secret[0] !== 's'
|
|
||||||
|| !isValidSecret(secret)) {
|
|
||||||
throw error('Invalid parameter: secret');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateLedgerRange(options) {
|
function validateLedgerRange(options) {
|
||||||
if (!_.isUndefined(options.minLedgerVersion)
|
if (!_.isUndefined(options) && !_.isUndefined(options.minLedgerVersion)
|
||||||
&& !_.isUndefined(options.maxLedgerVersion)) {
|
&& !_.isUndefined(options.maxLedgerVersion)) {
|
||||||
if (Number(options.minLedgerVersion) > Number(options.maxLedgerVersion)) {
|
if (Number(options.minLedgerVersion) > Number(options.maxLedgerVersion)) {
|
||||||
throw error('minLedgerVersion must not be greater than maxLedgerVersion');
|
throw error('minLedgerVersion must not be greater than maxLedgerVersion');
|
||||||
@@ -37,43 +17,38 @@ function validateLedgerRange(options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateOptions(schema, options) {
|
function validateOptions(schema, instance) {
|
||||||
schemaValidate(schema, options);
|
schemaValidate(schema, instance);
|
||||||
validateLedgerRange(options);
|
validateLedgerRange(instance.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
address: _.partial(schemaValidate, 'address'),
|
getPaths: _.partial(schemaValidate, 'getPathsParameters'),
|
||||||
secret: validateSecret,
|
getTransactions: _.partial(validateOptions, 'getTransactionsParameters'),
|
||||||
currency: _.partial(schemaValidate, 'currency'),
|
getSettings: _.partial(validateOptions, 'getSettingsParameters'),
|
||||||
identifier: _.partial(schemaValidate, 'hash256'),
|
getAccountInfo: _.partial(validateOptions, 'getSettingsParameters'),
|
||||||
ledgerVersion: _.partial(schemaValidate, 'ledgerVersion'),
|
getTrustlines: _.partial(validateOptions, 'getTrustlinesParameters'),
|
||||||
sequence: _.partial(schemaValidate, 'sequence'),
|
getBalances: _.partial(validateOptions, 'getTrustlinesParameters'),
|
||||||
order: _.partial(schemaValidate, 'order'),
|
getBalanceSheet: _.partial(validateOptions, 'getBalanceSheetParameters'),
|
||||||
orderbook: _.partial(schemaValidate, 'orderbook'),
|
getOrders: _.partial(validateOptions, 'getOrdersParameters'),
|
||||||
payment: _.partial(schemaValidate, 'payment'),
|
getOrderbook: _.partial(validateOptions, 'getOrderbookParameters'),
|
||||||
suspendedPaymentCreation:
|
getTransaction: _.partial(validateOptions, 'getTransactionParameters'),
|
||||||
_.partial(schemaValidate, 'suspended-payment-creation'),
|
getLedger: _.partial(validateOptions, 'getLedgerParameters'),
|
||||||
suspendedPaymentExecution:
|
preparePayment: _.partial(schemaValidate, 'preparePaymentParameters'),
|
||||||
_.partial(schemaValidate, 'suspended-payment-execution'),
|
prepareOrder: _.partial(schemaValidate, 'prepareOrderParameters'),
|
||||||
suspendedPaymentCancellation:
|
prepareOrderCancellation:
|
||||||
_.partial(schemaValidate, 'suspended-payment-cancellation'),
|
_.partial(schemaValidate, 'prepareOrderCancellationParameters'),
|
||||||
pathfind: _.partial(schemaValidate, 'pathfind'),
|
prepareTrustline: _.partial(schemaValidate, 'prepareTrustlineParameters'),
|
||||||
settings: _.partial(schemaValidate, 'settings'),
|
prepareSettings: _.partial(schemaValidate, 'prepareSettingsParameters'),
|
||||||
trustline: _.partial(schemaValidate, 'trustline'),
|
prepareSuspendedPaymentCreation: _.partial(schemaValidate,
|
||||||
txJSON: _.partial(schemaValidate, 'tx'),
|
'prepareSuspendedPaymentCreationParameters'),
|
||||||
blob: _.partial(schemaValidate, 'blob'),
|
prepareSuspendedPaymentCancellation: _.partial(schemaValidate,
|
||||||
getTransactionsOptions: _.partial(validateOptions, 'transactions-options'),
|
'prepareSuspendedPaymentCancellationParameters'),
|
||||||
getSettingsOptions: _.partial(validateOptions, 'settings-options'),
|
prepareSuspendedPaymentExecution: _.partial(schemaValidate,
|
||||||
getAccountInfoOptions: _.partial(validateOptions, 'settings-options'),
|
'prepareSuspendedPaymentExecutionParameters'),
|
||||||
getTrustlinesOptions: _.partial(validateOptions, 'trustlines-options'),
|
sign: _.partial(schemaValidate, 'signParameters'),
|
||||||
getBalancesOptions: _.partial(validateOptions, 'trustlines-options'),
|
submit: _.partial(schemaValidate, 'submitParameters'),
|
||||||
getBalanceSheetOptions: _.partial(validateOptions, 'balance-sheet-options'),
|
computeLedgerHash: _.partial(schemaValidate, 'computeLedgerHashParameters'),
|
||||||
getOrdersOptions: _.partial(validateOptions, 'orders-options'),
|
|
||||||
getOrderbookOptions: _.partial(validateOptions, 'orders-options'),
|
|
||||||
getTransactionOptions: _.partial(validateOptions, 'transaction-options'),
|
|
||||||
getLedgerOptions: _.partial(validateOptions, 'ledger-options'),
|
|
||||||
options: _.partial(validateOptions, 'options'),
|
|
||||||
apiOptions: _.partial(schemaValidate, 'api-options'),
|
apiOptions: _.partial(schemaValidate, 'api-options'),
|
||||||
instructions: _.partial(schemaValidate, 'instructions')
|
instructions: _.partial(schemaValidate, 'instructions')
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -50,14 +50,13 @@ function formatAccountInfo(response: AccountDataResponse) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAccountInfo(account: string, options: AccountInfoOptions = {}
|
function getAccountInfo(address: string, options: AccountInfoOptions = {}
|
||||||
): Promise<AccountInfoResponse> {
|
): Promise<AccountInfoResponse> {
|
||||||
validate.address(account);
|
validate.getAccountInfo({address, options});
|
||||||
validate.getAccountInfoOptions(options);
|
|
||||||
|
|
||||||
const request = {
|
const request = {
|
||||||
command: 'account_info',
|
command: 'account_info',
|
||||||
account: account,
|
account: address,
|
||||||
ledger_index: options.ledgerVersion || 'validated'
|
ledger_index: options.ledgerVersion || 'validated'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ function formatBalanceSheet(balanceSheet): GetBalanceSheet {
|
|||||||
|
|
||||||
function getBalanceSheet(address: string, options: BalanceSheetOptions = {}
|
function getBalanceSheet(address: string, options: BalanceSheetOptions = {}
|
||||||
): Promise<GetBalanceSheet> {
|
): Promise<GetBalanceSheet> {
|
||||||
validate.address(address);
|
validate.getBalanceSheet({address, options});
|
||||||
validate.getBalanceSheetOptions(options);
|
|
||||||
|
|
||||||
return utils.ensureLedgerVersion.call(this, options).then(_options => {
|
return utils.ensureLedgerVersion.call(this, options).then(_options => {
|
||||||
const request = {
|
const request = {
|
||||||
|
|||||||
@@ -48,16 +48,15 @@ function getLedgerVersionHelper(connection: Connection, optionValue?: number
|
|||||||
return connection.getLedgerVersion();
|
return connection.getLedgerVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBalances(account: string, options: TrustlinesOptions = {}
|
function getBalances(address: string, options: TrustlinesOptions = {}
|
||||||
): Promise<GetBalances> {
|
): Promise<GetBalances> {
|
||||||
validate.address(account);
|
validate.getTrustlines({address, options});
|
||||||
validate.getBalancesOptions(options);
|
|
||||||
|
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
getLedgerVersionHelper(this.connection, options.ledgerVersion).then(
|
getLedgerVersionHelper(this.connection, options.ledgerVersion).then(
|
||||||
ledgerVersion =>
|
ledgerVersion =>
|
||||||
utils.getXRPBalance(this.connection, account, ledgerVersion)),
|
utils.getXRPBalance(this.connection, address, ledgerVersion)),
|
||||||
this.getTrustlines(account, options)
|
this.getTrustlines(address, options)
|
||||||
]).then(results =>
|
]).then(results =>
|
||||||
formatBalances(options, {xrp: results[0], trustlines: results[1]}));
|
formatBalances(options, {xrp: results[0], trustlines: results[1]}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ type LedgerOptions = {
|
|||||||
|
|
||||||
|
|
||||||
function getLedger(options: LedgerOptions = {}): Promise<GetLedger> {
|
function getLedger(options: LedgerOptions = {}): Promise<GetLedger> {
|
||||||
validate.getLedgerOptions(options);
|
validate.getLedger({options});
|
||||||
|
|
||||||
const request = {
|
const request = {
|
||||||
command: 'ledger',
|
command: 'ledger',
|
||||||
|
|||||||
@@ -91,14 +91,12 @@ function formatBidsAndAsks(orderbook: Orderbook, offers) {
|
|||||||
return {bids, asks};
|
return {bids, asks};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOrderbook(account: string, orderbook: Orderbook,
|
function getOrderbook(address: string, orderbook: Orderbook,
|
||||||
options: OrdersOptions = {}
|
options: OrdersOptions = {}
|
||||||
): Promise<GetOrderbook> {
|
): Promise<GetOrderbook> {
|
||||||
validate.address(account);
|
validate.getOrderbook({address, orderbook, options});
|
||||||
validate.orderbook(orderbook);
|
|
||||||
validate.getOrderbookOptions(options);
|
|
||||||
|
|
||||||
const getter = _.partial(getBookOffers, this.connection, account,
|
const getter = _.partial(getBookOffers, this.connection, address,
|
||||||
options.ledgerVersion, options.limit);
|
options.ledgerVersion, options.limit);
|
||||||
const getOffers = _.partial(getter, orderbook.base, orderbook.counter);
|
const getOffers = _.partial(getter, orderbook.base, orderbook.counter);
|
||||||
const getReverseOffers = _.partial(getter, orderbook.counter, orderbook.base);
|
const getReverseOffers = _.partial(getter, orderbook.counter, orderbook.base);
|
||||||
|
|||||||
@@ -26,13 +26,12 @@ function requestAccountOffers(connection: Connection, address: string,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOrders(account: string, options: OrdersOptions = {}
|
function getOrders(address: string, options: OrdersOptions = {}
|
||||||
): Promise<GetOrders> {
|
): Promise<GetOrders> {
|
||||||
validate.address(account);
|
validate.getOrders({address, options});
|
||||||
validate.getOrdersOptions(options);
|
|
||||||
|
|
||||||
return utils.ensureLedgerVersion.call(this, options).then(_options => {
|
return utils.ensureLedgerVersion.call(this, options).then(_options => {
|
||||||
const getter = _.partial(requestAccountOffers, this.connection, account,
|
const getter = _.partial(requestAccountOffers, this.connection, address,
|
||||||
_options.ledgerVersion);
|
_options.ledgerVersion);
|
||||||
return utils.getRecursive(getter, _options.limit).then(orders =>
|
return utils.getRecursive(getter, _options.limit).then(orders =>
|
||||||
_.sortBy(orders, (order) => order.properties.sequence));
|
_.sortBy(orders, (order) => order.properties.sequence));
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ function formatResponse(pathfind: PathFind, paths: RippledPathsResponse) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getPaths(pathfind: PathFind): Promise<GetPaths> {
|
function getPaths(pathfind: PathFind): Promise<GetPaths> {
|
||||||
validate.pathfind(pathfind);
|
validate.getPaths({pathfind});
|
||||||
|
|
||||||
const address = pathfind.source.address;
|
const address = pathfind.source.address;
|
||||||
return requestPathFind(this.connection, pathfind).then(paths =>
|
return requestPathFind(this.connection, pathfind).then(paths =>
|
||||||
|
|||||||
@@ -48,14 +48,13 @@ function formatSettings(response) {
|
|||||||
return _.assign({}, parsedFlags, parsedFields);
|
return _.assign({}, parsedFlags, parsedFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSettings(account: string, options: SettingsOptions = {}
|
function getSettings(address: string, options: SettingsOptions = {}
|
||||||
): Promise<GetSettings> {
|
): Promise<GetSettings> {
|
||||||
validate.address(account);
|
validate.getSettings({address, options});
|
||||||
validate.getSettingsOptions(options);
|
|
||||||
|
|
||||||
const request = {
|
const request = {
|
||||||
command: 'account_info',
|
command: 'account_info',
|
||||||
account: account,
|
account: address,
|
||||||
ledger_index: options.ledgerVersion || 'validated'
|
ledger_index: options.ledgerVersion || 'validated'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -78,8 +78,7 @@ function formatResponse(options: TransactionOptions, tx: TransactionType
|
|||||||
function getTransaction(identifier: string,
|
function getTransaction(identifier: string,
|
||||||
options: TransactionOptions = {}
|
options: TransactionOptions = {}
|
||||||
): Promise<TransactionType> {
|
): Promise<TransactionType> {
|
||||||
validate.identifier(identifier);
|
validate.getTransaction({identifier, options});
|
||||||
validate.getTransactionOptions(options);
|
|
||||||
|
|
||||||
const request = {
|
const request = {
|
||||||
command: 'tx',
|
command: 'tx',
|
||||||
|
|||||||
@@ -163,10 +163,9 @@ function getTransactionsInternal(connection: Connection, address: string,
|
|||||||
return utils.getRecursive(getter, options.limit).then(format);
|
return utils.getRecursive(getter, options.limit).then(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTransactions(account: string, options: TransactionsOptions = {}
|
function getTransactions(address: string, options: TransactionsOptions = {}
|
||||||
): Promise<GetTransactionsResponse> {
|
): Promise<GetTransactionsResponse> {
|
||||||
validate.address(account);
|
validate.getTransactions({address, options});
|
||||||
validate.getTransactionsOptions(options);
|
|
||||||
|
|
||||||
const defaults = {maxLedgerVersion: -1};
|
const defaults = {maxLedgerVersion: -1};
|
||||||
if (options.start) {
|
if (options.start) {
|
||||||
@@ -175,11 +174,11 @@ function getTransactions(account: string, options: TransactionsOptions = {}
|
|||||||
const bound = options.earliestFirst ?
|
const bound = options.earliestFirst ?
|
||||||
{minLedgerVersion: ledgerVersion} : {maxLedgerVersion: ledgerVersion};
|
{minLedgerVersion: ledgerVersion} : {maxLedgerVersion: ledgerVersion};
|
||||||
const newOptions = _.assign(defaults, options, {startTx: tx}, bound);
|
const newOptions = _.assign(defaults, options, {startTx: tx}, bound);
|
||||||
return getTransactionsInternal(this.connection, account, newOptions);
|
return getTransactionsInternal(this.connection, address, newOptions);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const newOptions = _.assign(defaults, options);
|
const newOptions = _.assign(defaults, options);
|
||||||
return getTransactionsInternal(this.connection, account, newOptions);
|
return getTransactionsInternal(this.connection, address, newOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = getTransactions;
|
module.exports = getTransactions;
|
||||||
|
|||||||
@@ -38,13 +38,12 @@ function getAccountLines(connection: Connection, address: string,
|
|||||||
return connection.request(request).then(_.partial(formatResponse, options));
|
return connection.request(request).then(_.partial(formatResponse, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTrustlines(account: string, options: TrustlinesOptions = {}
|
function getTrustlines(address: string, options: TrustlinesOptions = {}
|
||||||
): Promise<GetTrustlinesResponse> {
|
): Promise<GetTrustlinesResponse> {
|
||||||
validate.address(account);
|
validate.getTrustlines({address, options});
|
||||||
validate.getTrustlinesOptions(options);
|
|
||||||
|
|
||||||
return this.getLedgerVersion().then(ledgerVersion => {
|
return this.getLedgerVersion().then(ledgerVersion => {
|
||||||
const getter = _.partial(getAccountLines, this.connection, account,
|
const getter = _.partial(getAccountLines, this.connection, address,
|
||||||
options.ledgerVersion || ledgerVersion, options);
|
options.ledgerVersion || ledgerVersion, options);
|
||||||
return utils.getRecursive(getter, options.limit);
|
return utils.getRecursive(getter, options.limit);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import type {Instructions, Prepare} from './types.js';
|
|||||||
import type {Order} from '../ledger/transaction-types.js';
|
import type {Order} from '../ledger/transaction-types.js';
|
||||||
|
|
||||||
function createOrderTransaction(account: string, order: Order): Object {
|
function createOrderTransaction(account: string, order: Order): Object {
|
||||||
validate.address(account);
|
|
||||||
validate.order(order);
|
|
||||||
|
|
||||||
const takerPays = utils.common.toRippledAmount(order.direction === 'buy' ?
|
const takerPays = utils.common.toRippledAmount(order.direction === 'buy' ?
|
||||||
order.quantity : order.totalPrice);
|
order.quantity : order.totalPrice);
|
||||||
const takerGets = utils.common.toRippledAmount(order.direction === 'buy' ?
|
const takerGets = utils.common.toRippledAmount(order.direction === 'buy' ?
|
||||||
@@ -40,10 +37,11 @@ function createOrderTransaction(account: string, order: Order): Object {
|
|||||||
return txJSON;
|
return txJSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareOrder(account: string, order: Order,
|
function prepareOrder(address: string, order: Order,
|
||||||
instructions: Instructions = {}
|
instructions: Instructions = {}
|
||||||
): Promise<Prepare> {
|
): Promise<Prepare> {
|
||||||
const txJSON = createOrderTransaction(account, order);
|
validate.prepareOrder({address, order, instructions});
|
||||||
|
const txJSON = createOrderTransaction(address, order);
|
||||||
return utils.prepareTransaction(txJSON, this, instructions);
|
return utils.prepareTransaction(txJSON, this, instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import type {Instructions, Prepare} from './types.js';
|
|||||||
function createOrderCancellationTransaction(account: string,
|
function createOrderCancellationTransaction(account: string,
|
||||||
sequence: number
|
sequence: number
|
||||||
): Object {
|
): Object {
|
||||||
validate.address(account);
|
|
||||||
validate.sequence(sequence);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
TransactionType: 'OfferCancel',
|
TransactionType: 'OfferCancel',
|
||||||
Account: account,
|
Account: account,
|
||||||
@@ -17,10 +14,11 @@ function createOrderCancellationTransaction(account: string,
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareOrderCancellation(account: string, sequence: number,
|
function prepareOrderCancellation(address: string, sequence: number,
|
||||||
instructions: Instructions = {}
|
instructions: Instructions = {}
|
||||||
): Promise<Prepare> {
|
): Promise<Prepare> {
|
||||||
const txJSON = createOrderCancellationTransaction(account, sequence);
|
validate.prepareOrderCancellation({address, sequence, instructions});
|
||||||
|
const txJSON = createOrderCancellationTransaction(address, sequence);
|
||||||
return utils.prepareTransaction(txJSON, this, instructions);
|
return utils.prepareTransaction(txJSON, this, instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,12 +65,14 @@ function createMaximalAmount(amount: Amount): Amount {
|
|||||||
return _.assign(amount, {value: maxValue});
|
return _.assign(amount, {value: maxValue});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPaymentTransaction(account: string, paymentArgument: Payment
|
function createPaymentTransaction(address: string, paymentArgument: Payment
|
||||||
): Object {
|
): Object {
|
||||||
const payment = _.cloneDeep(paymentArgument);
|
const payment = _.cloneDeep(paymentArgument);
|
||||||
applyAnyCounterpartyEncoding(payment);
|
applyAnyCounterpartyEncoding(payment);
|
||||||
validate.address(account);
|
|
||||||
validate.payment(payment);
|
if (address !== payment.source.address) {
|
||||||
|
throw new ValidationError('address must match payment.source.address');
|
||||||
|
}
|
||||||
|
|
||||||
if ((payment.source.maxAmount && payment.destination.minAmount) ||
|
if ((payment.source.maxAmount && payment.destination.minAmount) ||
|
||||||
(payment.source.amount && payment.destination.amount)) {
|
(payment.source.amount && payment.destination.amount)) {
|
||||||
@@ -141,10 +143,11 @@ function createPaymentTransaction(account: string, paymentArgument: Payment
|
|||||||
return txJSON;
|
return txJSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
function preparePayment(account: string, payment: Payment,
|
function preparePayment(address: string, payment: Payment,
|
||||||
instructions: Instructions
|
instructions: Instructions = {}
|
||||||
): Promise<Prepare> {
|
): Promise<Prepare> {
|
||||||
const txJSON = createPaymentTransaction(account, payment);
|
validate.preparePayment({address, payment, instructions});
|
||||||
|
const txJSON = createPaymentTransaction(address, payment);
|
||||||
return utils.prepareTransaction(txJSON, this, instructions);
|
return utils.prepareTransaction(txJSON, this, instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,9 +71,6 @@ function convertTransferRate(transferRate: number | string): number | string {
|
|||||||
|
|
||||||
function createSettingsTransaction(account: string, settings: Settings
|
function createSettingsTransaction(account: string, settings: Settings
|
||||||
): Object {
|
): Object {
|
||||||
validate.address(account);
|
|
||||||
validate.settings(settings);
|
|
||||||
|
|
||||||
if (settings.regularKey) {
|
if (settings.regularKey) {
|
||||||
return {
|
return {
|
||||||
TransactionType: 'SetRegularKey',
|
TransactionType: 'SetRegularKey',
|
||||||
@@ -95,10 +92,11 @@ function createSettingsTransaction(account: string, settings: Settings
|
|||||||
return txJSON;
|
return txJSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareSettings(account: string, settings: Settings,
|
function prepareSettings(address: string, settings: Settings,
|
||||||
instructions: Instructions = {}
|
instructions: Instructions = {}
|
||||||
): Promise<Prepare> {
|
): Promise<Prepare> {
|
||||||
const txJSON = createSettingsTransaction(account, settings);
|
validate.prepareSettings({address, settings, instructions});
|
||||||
|
const txJSON = createSettingsTransaction(address, settings);
|
||||||
return utils.prepareTransaction(txJSON, this, instructions);
|
return utils.prepareTransaction(txJSON, this, instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,11 @@ function computeSignature(txJSON, privateKey) {
|
|||||||
|
|
||||||
function sign(txJSON: string, secret: string
|
function sign(txJSON: string, secret: string
|
||||||
): {signedTransaction: string; id: string} {
|
): {signedTransaction: string; id: string} {
|
||||||
const tx = JSON.parse(txJSON);
|
validate.sign({txJSON, secret});
|
||||||
validate.txJSON(tx);
|
|
||||||
// we can't validate that the secret matches the account because
|
// we can't validate that the secret matches the account because
|
||||||
// the secret could correspond to the regular key
|
// the secret could correspond to the regular key
|
||||||
validate.secret(secret);
|
|
||||||
|
|
||||||
|
const tx = JSON.parse(txJSON);
|
||||||
const keypair = keypairs.deriveKeypair(secret);
|
const keypair = keypairs.deriveKeypair(secret);
|
||||||
if (tx.SigningPubKey === undefined) {
|
if (tx.SigningPubKey === undefined) {
|
||||||
tx.SigningPubKey = keypair.publicKey;
|
tx.SigningPubKey = keypair.publicKey;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ function formatResponse(response) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function submit(txBlob: string): Promise<Submit> {
|
function submit(txBlob: string): Promise<Submit> {
|
||||||
validate.blob(txBlob);
|
validate.submit({txBlob});
|
||||||
const request = {
|
const request = {
|
||||||
command: 'submit',
|
command: 'submit',
|
||||||
tx_blob: txBlob
|
tx_blob: txBlob
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ type SuspendedPaymentCancellation = {
|
|||||||
function createSuspendedPaymentCancellationTransaction(account: string,
|
function createSuspendedPaymentCancellationTransaction(account: string,
|
||||||
payment: SuspendedPaymentCancellation
|
payment: SuspendedPaymentCancellation
|
||||||
): Object {
|
): Object {
|
||||||
validate.address(account);
|
|
||||||
validate.suspendedPaymentCancellation(payment);
|
|
||||||
|
|
||||||
const txJSON: Object = {
|
const txJSON: Object = {
|
||||||
TransactionType: 'SuspendedPaymentCancel',
|
TransactionType: 'SuspendedPaymentCancel',
|
||||||
Account: account,
|
Account: account,
|
||||||
@@ -30,11 +27,14 @@ function createSuspendedPaymentCancellationTransaction(account: string,
|
|||||||
return txJSON;
|
return txJSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareSuspendedPaymentCancellation(account: string,
|
function prepareSuspendedPaymentCancellation(address: string,
|
||||||
payment: SuspendedPaymentCancellation, instructions: Instructions = {}
|
suspendedPaymentCancellation: SuspendedPaymentCancellation,
|
||||||
|
instructions: Instructions = {}
|
||||||
): Promise<Prepare> {
|
): Promise<Prepare> {
|
||||||
const txJSON =
|
validate.prepareSuspendedPaymentCancellation(
|
||||||
createSuspendedPaymentCancellationTransaction(account, payment);
|
{address, suspendedPaymentCancellation, instructions});
|
||||||
|
const txJSON = createSuspendedPaymentCancellationTransaction(
|
||||||
|
address, suspendedPaymentCancellation);
|
||||||
return utils.prepareTransaction(txJSON, this, instructions);
|
return utils.prepareTransaction(txJSON, this, instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ type SuspendedPaymentCreation = {
|
|||||||
function createSuspendedPaymentCreationTransaction(account: string,
|
function createSuspendedPaymentCreationTransaction(account: string,
|
||||||
payment: SuspendedPaymentCreation
|
payment: SuspendedPaymentCreation
|
||||||
): Object {
|
): Object {
|
||||||
validate.address(account);
|
|
||||||
validate.suspendedPaymentCreation(payment);
|
|
||||||
|
|
||||||
const txJSON: Object = {
|
const txJSON: Object = {
|
||||||
TransactionType: 'SuspendedPaymentCreate',
|
TransactionType: 'SuspendedPaymentCreate',
|
||||||
Account: account,
|
Account: account,
|
||||||
@@ -49,10 +46,14 @@ function createSuspendedPaymentCreationTransaction(account: string,
|
|||||||
return txJSON;
|
return txJSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareSuspendedPaymentCreation(account: string,
|
function prepareSuspendedPaymentCreation(address: string,
|
||||||
payment: SuspendedPaymentCreation, instructions: Instructions = {}
|
suspendedPaymentCreation: SuspendedPaymentCreation,
|
||||||
|
instructions: Instructions = {}
|
||||||
): Promise<Prepare> {
|
): Promise<Prepare> {
|
||||||
const txJSON = createSuspendedPaymentCreationTransaction(account, payment);
|
validate.prepareSuspendedPaymentCreation(
|
||||||
|
{address, suspendedPaymentCreation, instructions});
|
||||||
|
const txJSON = createSuspendedPaymentCreationTransaction(
|
||||||
|
address, suspendedPaymentCreation);
|
||||||
return utils.prepareTransaction(txJSON, this, instructions);
|
return utils.prepareTransaction(txJSON, this, instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ type SuspendedPaymentExecution = {
|
|||||||
function createSuspendedPaymentExecutionTransaction(account: string,
|
function createSuspendedPaymentExecutionTransaction(account: string,
|
||||||
payment: SuspendedPaymentExecution
|
payment: SuspendedPaymentExecution
|
||||||
): Object {
|
): Object {
|
||||||
validate.address(account);
|
|
||||||
validate.suspendedPaymentExecution(payment);
|
|
||||||
|
|
||||||
const txJSON: Object = {
|
const txJSON: Object = {
|
||||||
TransactionType: 'SuspendedPaymentFinish',
|
TransactionType: 'SuspendedPaymentFinish',
|
||||||
Account: account,
|
Account: account,
|
||||||
@@ -43,10 +40,14 @@ function createSuspendedPaymentExecutionTransaction(account: string,
|
|||||||
return txJSON;
|
return txJSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareSuspendedPaymentExecution(account: string,
|
function prepareSuspendedPaymentExecution(address: string,
|
||||||
payment: SuspendedPaymentExecution, instructions: Instructions = {}
|
suspendedPaymentExecution: SuspendedPaymentExecution,
|
||||||
|
instructions: Instructions = {}
|
||||||
): Promise<Prepare> {
|
): Promise<Prepare> {
|
||||||
const txJSON = createSuspendedPaymentExecutionTransaction(account, payment);
|
validate.prepareSuspendedPaymentExecution(
|
||||||
|
{address, suspendedPaymentExecution, instructions});
|
||||||
|
const txJSON = createSuspendedPaymentExecutionTransaction(
|
||||||
|
address, suspendedPaymentExecution);
|
||||||
return utils.prepareTransaction(txJSON, this, instructions);
|
return utils.prepareTransaction(txJSON, this, instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ function convertQuality(quality) {
|
|||||||
function createTrustlineTransaction(account: string,
|
function createTrustlineTransaction(account: string,
|
||||||
trustline: TrustLineSpecification
|
trustline: TrustLineSpecification
|
||||||
): Object {
|
): Object {
|
||||||
validate.address(account);
|
|
||||||
validate.trustline(trustline);
|
|
||||||
|
|
||||||
const limit = {
|
const limit = {
|
||||||
currency: trustline.currency,
|
currency: trustline.currency,
|
||||||
issuer: trustline.counterparty,
|
issuer: trustline.counterparty,
|
||||||
@@ -50,10 +47,11 @@ function createTrustlineTransaction(account: string,
|
|||||||
return txJSON;
|
return txJSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareTrustline(account: string,
|
function prepareTrustline(address: string,
|
||||||
trustline: TrustLineSpecification, instructions: Instructions = {}
|
trustline: TrustLineSpecification, instructions: Instructions = {}
|
||||||
): Promise<Prepare> {
|
): Promise<Prepare> {
|
||||||
const txJSON = createTrustlineTransaction(account, trustline);
|
validate.prepareTrustline({address, trustline, instructions});
|
||||||
|
const txJSON = createTrustlineTransaction(address, trustline);
|
||||||
return utils.prepareTransaction(txJSON, this, instructions);
|
return utils.prepareTransaction(txJSON, this, instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -834,26 +834,32 @@ describe('RippleAPI', function() {
|
|||||||
minLedgerVersion: 20000,
|
minLedgerVersion: 20000,
|
||||||
maxLedgerVersion: 10000
|
maxLedgerVersion: 10000
|
||||||
};
|
};
|
||||||
assert.throws(_.partial(validate.getTransactionsOptions, options),
|
const thunk = _.partial(validate.getTransactions,
|
||||||
this.api.errors.ValidationError);
|
{address, options});
|
||||||
assert.throws(_.partial(validate.getTransactionsOptions, options),
|
assert.throws(thunk, this.api.errors.ValidationError);
|
||||||
|
assert.throws(thunk,
|
||||||
/minLedgerVersion must not be greater than maxLedgerVersion/);
|
/minLedgerVersion must not be greater than maxLedgerVersion/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('secret', function() {
|
it('secret', function() {
|
||||||
assert.doesNotThrow(_.partial(validate.secret,
|
function validateSecret(secret) {
|
||||||
|
validate.sign({txJSON: '', secret});
|
||||||
|
}
|
||||||
|
assert.doesNotThrow(_.partial(validateSecret,
|
||||||
'shzjfakiK79YQdMjy4h8cGGfQSV6u'));
|
'shzjfakiK79YQdMjy4h8cGGfQSV6u'));
|
||||||
assert.throws(_.partial(validate.secret, 1),
|
assert.throws(_.partial(validateSecret,
|
||||||
/Invalid parameter/);
|
'shzjfakiK79YQdMjy4h8cGGfQSV6v'), this.api.errors.ValidationError);
|
||||||
assert.throws(_.partial(validate.secret, ''),
|
assert.throws(_.partial(validateSecret, 1),
|
||||||
this.api.errors.ValidationError);
|
this.api.errors.ValidationError);
|
||||||
assert.throws(_.partial(validate.secret, 's!!!'),
|
assert.throws(_.partial(validateSecret, ''),
|
||||||
this.api.errors.ValidationError);
|
this.api.errors.ValidationError);
|
||||||
assert.throws(_.partial(validate.secret, 'passphrase'),
|
assert.throws(_.partial(validateSecret, 's!!!'),
|
||||||
|
this.api.errors.ValidationError);
|
||||||
|
assert.throws(_.partial(validateSecret, 'passphrase'),
|
||||||
this.api.errors.ValidationError);
|
this.api.errors.ValidationError);
|
||||||
// 32 0s is a valid hex repr of seed bytes
|
// 32 0s is a valid hex repr of seed bytes
|
||||||
const hex = new Array(33).join('0');
|
const hex = new Array(33).join('0');
|
||||||
assert.throws(_.partial(validate.secret, hex),
|
assert.throws(_.partial(validateSecret, hex),
|
||||||
this.api.errors.ValidationError);
|
this.api.errors.ValidationError);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
1
test/fixtures/responses/get-server-info.json
vendored
1
test/fixtures/responses/get-server-info.json
vendored
@@ -2,6 +2,7 @@
|
|||||||
"buildVersion": "0.24.0-rc1",
|
"buildVersion": "0.24.0-rc1",
|
||||||
"completeLedgers": "32570-6595042",
|
"completeLedgers": "32570-6595042",
|
||||||
"hostid": "ARTS",
|
"hostid": "ARTS",
|
||||||
|
"ioLatencyMs": 1,
|
||||||
"lastClose": {
|
"lastClose": {
|
||||||
"convergeTimeS": 2.007,
|
"convergeTimeS": 2.007,
|
||||||
"proposers": 4
|
"proposers": 4
|
||||||
|
|||||||
1
test/fixtures/rippled/server-info.json
vendored
1
test/fixtures/rippled/server-info.json
vendored
@@ -7,6 +7,7 @@
|
|||||||
"build_version": "0.24.0-rc1",
|
"build_version": "0.24.0-rc1",
|
||||||
"complete_ledgers": "32570-6595042",
|
"complete_ledgers": "32570-6595042",
|
||||||
"hostid": "ARTS",
|
"hostid": "ARTS",
|
||||||
|
"io_latency_ms": 1,
|
||||||
"last_close": {
|
"last_close": {
|
||||||
"converge_time_s": 2.007,
|
"converge_time_s": 2.007,
|
||||||
"proposers": 4
|
"proposers": 4
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const errors = require('../../src/common/errors');
|
const errors = require('../../src/common/errors');
|
||||||
const validate = require('../../src/common').validate;
|
|
||||||
const wallet = require('./wallet');
|
const wallet = require('./wallet');
|
||||||
const requests = require('../fixtures/requests');
|
const requests = require('../fixtures/requests');
|
||||||
const RippleAPI = require('../../src').RippleAPI;
|
const RippleAPI = require('../../src').RippleAPI;
|
||||||
|
const {isValidAddress} = require('ripple-address-codec');
|
||||||
|
const {isValidSecret} = require('../../src/common');
|
||||||
|
|
||||||
|
|
||||||
const TIMEOUT = 30000; // how long before each test case times out
|
const TIMEOUT = 30000; // how long before each test case times out
|
||||||
@@ -292,8 +293,8 @@ describe('integration tests', function() {
|
|||||||
it('generateWallet', function() {
|
it('generateWallet', function() {
|
||||||
const newWallet = this.api.generateAddress();
|
const newWallet = this.api.generateAddress();
|
||||||
assert(newWallet && newWallet.address && newWallet.secret);
|
assert(newWallet && newWallet.address && newWallet.secret);
|
||||||
validate.address(newWallet.address);
|
assert(isValidAddress(newWallet.address));
|
||||||
validate.secret(newWallet.secret);
|
assert(isValidSecret(newWallet.secret));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user