From aa6cef520c9e5426d34960fa8ce399496526ae4d Mon Sep 17 00:00:00 2001 From: Mayukha Vadari Date: Fri, 3 Sep 2021 10:26:50 -0500 Subject: [PATCH] Removes jsonschemas (#1593) * remove jsonschemas stuff * fix ts issues * fix tests * remove package * remove scripts * replace isValidAddress --- package-lock.json | 30 - package.json | 5 +- src/client/index.ts | 10 +- src/common/index.ts | 3 +- src/common/schema-validator.ts | 188 ----- src/common/schemas/input/api-options.json | 69 -- src/common/schemas/input/combine.json | 19 - .../schemas/input/compute-ledger-hash.json | 13 - .../schemas/input/generate-address.json | 37 - .../schemas/input/generate-x-address.json | 37 - .../schemas/input/get-account-info.json | 24 - .../schemas/input/get-account-objects.json | 56 -- .../schemas/input/get-balance-sheet.json | 30 - src/common/schemas/input/get-balances.json | 37 - src/common/schemas/input/get-fee.json | 13 - src/common/schemas/input/get-ledger.json | 35 - src/common/schemas/input/get-orderbook.json | 33 - src/common/schemas/input/get-orders.json | 29 - src/common/schemas/input/get-paths.json | 69 -- .../schemas/input/get-payment-channel.json | 14 - src/common/schemas/input/get-settings.json | 24 - src/common/schemas/input/get-transaction.json | 28 - .../schemas/input/get-transactions.json | 71 -- src/common/schemas/input/get-trustlines.json | 37 - .../schemas/input/prepare-check-cancel.json | 18 - .../schemas/input/prepare-check-cash.json | 18 - .../schemas/input/prepare-check-create.json | 18 - .../input/prepare-escrow-cancellation.json | 18 - .../input/prepare-escrow-creation.json | 18 - .../input/prepare-escrow-execution.json | 18 - .../input/prepare-order-cancellation.json | 18 - src/common/schemas/input/prepare-order.json | 18 - .../input/prepare-payment-channel-claim.json | 18 - .../input/prepare-payment-channel-create.json | 18 - .../input/prepare-payment-channel-fund.json | 18 - src/common/schemas/input/prepare-payment.json | 18 - .../schemas/input/prepare-settings.json | 18 - .../schemas/input/prepare-ticket-create.json | 18 - .../schemas/input/prepare-trustline.json | 18 - .../input/sign-payment-channel-claim.json | 21 - src/common/schemas/input/sign.json | 55 -- src/common/schemas/input/submit.json | 17 - .../input/verify-payment-channel-claim.json | 25 - src/common/schemas/objects/address.json | 12 - src/common/schemas/objects/adjustment.json | 12 - src/common/schemas/objects/amount.json | 10 - src/common/schemas/objects/amountbase.json | 44 -- src/common/schemas/objects/balance.json | 45 -- src/common/schemas/objects/blob.json | 8 - .../schemas/objects/classic-address.json | 9 - src/common/schemas/objects/currency.json | 8 - .../objects/destination-address-tag.json | 15 - .../objects/destination-adjustment.json | 9 - .../objects/destination-exact-adjustment.json | 18 - src/common/schemas/objects/hash128.json | 7 - src/common/schemas/objects/hash256.json | 7 - src/common/schemas/objects/instructions.json | 59 -- src/common/schemas/objects/issue.json | 9 - src/common/schemas/objects/lax-amount.json | 14 - .../schemas/objects/lax-lax-amount.json | 14 - .../schemas/objects/ledger-version.json | 15 - .../schemas/objects/max-adjustment.json | 18 - src/common/schemas/objects/memo.json | 25 - src/common/schemas/objects/memos.json | 10 - .../schemas/objects/min-adjustment.json | 18 - src/common/schemas/objects/orderbook.json | 11 - src/common/schemas/objects/private-key.json | 7 - src/common/schemas/objects/public-key.json | 7 - src/common/schemas/objects/quality.json | 8 - src/common/schemas/objects/sequence.json | 8 - .../schemas/objects/settings-plus-memos.json | 120 ---- src/common/schemas/objects/signature.json | 7 - src/common/schemas/objects/signed-value.json | 8 - .../schemas/objects/source-adjustment.json | 9 - .../objects/source-exact-adjustment.json | 18 - src/common/schemas/objects/tag.json | 7 - .../schemas/objects/ticket-sequence.json | 8 - .../schemas/objects/transaction-hash.json | 8 - .../schemas/objects/transaction-type.json | 25 - src/common/schemas/objects/tx-json.json | 12 - src/common/schemas/objects/uint32.json | 8 - src/common/schemas/objects/value.json | 8 - src/common/schemas/objects/x-address.json | 9 - .../schemas/output/generate-address.json | 26 - .../schemas/output/generate-x-address.json | 18 - .../schemas/output/get-account-info.json | 40 -- .../schemas/output/get-account-objects.json | 48 -- .../schemas/output/get-balance-sheet.json | 33 - src/common/schemas/output/get-balances.json | 6 - src/common/schemas/output/get-ledger.json | 90 --- src/common/schemas/output/get-orderbook.json | 17 - src/common/schemas/output/get-orders.json | 36 - src/common/schemas/output/get-paths.json | 24 - .../schemas/output/get-payment-channel.json | 67 -- .../schemas/output/get-server-info.json | 117 --- src/common/schemas/output/get-settings.json | 8 - .../schemas/output/get-transaction.json | 237 ------ .../schemas/output/get-transactions.json | 8 - src/common/schemas/output/get-trustlines.json | 49 -- src/common/schemas/output/ledger-event.json | 46 -- src/common/schemas/output/order-change.json | 40 -- .../schemas/output/orderbook-orders.json | 58 -- src/common/schemas/output/outcome.json | 57 -- src/common/schemas/output/prepare.json | 47 -- .../output/sign-payment-channel-claim.json | 7 - src/common/schemas/output/sign.json | 18 - src/common/schemas/output/submit.json | 37 - .../output/verify-payment-channel-claim.json | 6 - .../specifications/account-delete.json | 30 - .../schemas/specifications/check-cancel.json | 15 - .../schemas/specifications/check-cash.json | 27 - .../schemas/specifications/check-create.json | 32 - .../specifications/deposit-preauth.json | 22 - .../specifications/escrow-cancellation.json | 19 - .../specifications/escrow-creation.json | 42 -- .../specifications/escrow-execution.json | 29 - .../schemas/specifications/get-payment.json | 39 - .../specifications/order-cancellation.json | 15 - src/common/schemas/specifications/order.json | 49 -- .../specifications/payment-channel-claim.json | 39 - .../payment-channel-create.json | 40 -- .../specifications/payment-channel-fund.json | 24 - .../schemas/specifications/payment.json | 39 - .../schemas/specifications/settings.json | 20 - .../schemas/specifications/trustline.json | 43 -- src/common/validate.ts | 174 ----- src/ledger/balances.ts | 10 +- src/ledger/pathfind.ts | 12 +- src/ledger/trustlines.ts | 5 +- src/transaction/check-cancel.ts | 6 +- src/transaction/check-cash.ts | 6 +- src/transaction/check-create.ts | 6 +- src/transaction/combine.ts | 3 - src/transaction/escrow-cancellation.ts | 9 +- src/transaction/escrow-creation.ts | 6 +- src/transaction/escrow-execution.ts | 6 +- src/transaction/order.ts | 6 +- src/transaction/ordercancellation.ts | 7 - src/transaction/payment-channel-claim.ts | 10 +- src/transaction/payment-channel-create.ts | 10 +- src/transaction/payment-channel-fund.ts | 10 +- src/transaction/payment.ts | 7 +- src/transaction/settings.ts | 6 +- src/transaction/sign.ts | 5 - src/transaction/ticket.ts | 2 - src/transaction/trustline.ts | 6 +- src/transaction/utils.ts | 11 +- src/utils/generateAddress.ts | 3 +- src/utils/signPaymentChannelClaim.ts | 3 - src/utils/verifyPaymentChannelClaim.ts | 4 - src/wallet/generateFaucetWallet.ts | 5 +- test/client.ts | 174 ++--- test/client/getPaths.ts | 26 +- test/client/isValidAddress.ts | 21 - test/client/isValidSecret.ts | 16 - test/client/prepareEscrowCreation.ts | 28 +- test/client/prepareOrder.ts | 42 +- test/client/prepareOrderCancellation.ts | 38 +- test/client/preparePayment.ts | 44 +- test/client/prepareSettings.ts | 122 ++-- test/client/prepareTransaction.ts | 672 +++++++++--------- test/client/prepareTrustline.ts | 42 +- test/client/sign.ts | 12 - 163 files changed, 601 insertions(+), 4611 deletions(-) delete mode 100644 src/common/schema-validator.ts delete mode 100644 src/common/schemas/input/api-options.json delete mode 100644 src/common/schemas/input/combine.json delete mode 100644 src/common/schemas/input/compute-ledger-hash.json delete mode 100644 src/common/schemas/input/generate-address.json delete mode 100644 src/common/schemas/input/generate-x-address.json delete mode 100644 src/common/schemas/input/get-account-info.json delete mode 100644 src/common/schemas/input/get-account-objects.json delete mode 100644 src/common/schemas/input/get-balance-sheet.json delete mode 100644 src/common/schemas/input/get-balances.json delete mode 100644 src/common/schemas/input/get-fee.json delete mode 100644 src/common/schemas/input/get-ledger.json delete mode 100644 src/common/schemas/input/get-orderbook.json delete mode 100644 src/common/schemas/input/get-orders.json delete mode 100644 src/common/schemas/input/get-paths.json delete mode 100644 src/common/schemas/input/get-payment-channel.json delete mode 100644 src/common/schemas/input/get-settings.json delete mode 100644 src/common/schemas/input/get-transaction.json delete mode 100644 src/common/schemas/input/get-transactions.json delete mode 100644 src/common/schemas/input/get-trustlines.json delete mode 100644 src/common/schemas/input/prepare-check-cancel.json delete mode 100644 src/common/schemas/input/prepare-check-cash.json delete mode 100644 src/common/schemas/input/prepare-check-create.json delete mode 100644 src/common/schemas/input/prepare-escrow-cancellation.json delete mode 100644 src/common/schemas/input/prepare-escrow-creation.json delete mode 100644 src/common/schemas/input/prepare-escrow-execution.json delete mode 100644 src/common/schemas/input/prepare-order-cancellation.json delete mode 100644 src/common/schemas/input/prepare-order.json delete mode 100644 src/common/schemas/input/prepare-payment-channel-claim.json delete mode 100644 src/common/schemas/input/prepare-payment-channel-create.json delete mode 100644 src/common/schemas/input/prepare-payment-channel-fund.json delete mode 100644 src/common/schemas/input/prepare-payment.json delete mode 100644 src/common/schemas/input/prepare-settings.json delete mode 100644 src/common/schemas/input/prepare-ticket-create.json delete mode 100644 src/common/schemas/input/prepare-trustline.json delete mode 100644 src/common/schemas/input/sign-payment-channel-claim.json delete mode 100644 src/common/schemas/input/sign.json delete mode 100644 src/common/schemas/input/submit.json delete mode 100644 src/common/schemas/input/verify-payment-channel-claim.json delete mode 100644 src/common/schemas/objects/address.json delete mode 100644 src/common/schemas/objects/adjustment.json delete mode 100644 src/common/schemas/objects/amount.json delete mode 100644 src/common/schemas/objects/amountbase.json delete mode 100644 src/common/schemas/objects/balance.json delete mode 100644 src/common/schemas/objects/blob.json delete mode 100644 src/common/schemas/objects/classic-address.json delete mode 100644 src/common/schemas/objects/currency.json delete mode 100644 src/common/schemas/objects/destination-address-tag.json delete mode 100644 src/common/schemas/objects/destination-adjustment.json delete mode 100644 src/common/schemas/objects/destination-exact-adjustment.json delete mode 100644 src/common/schemas/objects/hash128.json delete mode 100644 src/common/schemas/objects/hash256.json delete mode 100644 src/common/schemas/objects/instructions.json delete mode 100644 src/common/schemas/objects/issue.json delete mode 100644 src/common/schemas/objects/lax-amount.json delete mode 100644 src/common/schemas/objects/lax-lax-amount.json delete mode 100644 src/common/schemas/objects/ledger-version.json delete mode 100644 src/common/schemas/objects/max-adjustment.json delete mode 100644 src/common/schemas/objects/memo.json delete mode 100644 src/common/schemas/objects/memos.json delete mode 100644 src/common/schemas/objects/min-adjustment.json delete mode 100644 src/common/schemas/objects/orderbook.json delete mode 100644 src/common/schemas/objects/private-key.json delete mode 100644 src/common/schemas/objects/public-key.json delete mode 100644 src/common/schemas/objects/quality.json delete mode 100644 src/common/schemas/objects/sequence.json delete mode 100644 src/common/schemas/objects/settings-plus-memos.json delete mode 100644 src/common/schemas/objects/signature.json delete mode 100644 src/common/schemas/objects/signed-value.json delete mode 100644 src/common/schemas/objects/source-adjustment.json delete mode 100644 src/common/schemas/objects/source-exact-adjustment.json delete mode 100644 src/common/schemas/objects/tag.json delete mode 100644 src/common/schemas/objects/ticket-sequence.json delete mode 100644 src/common/schemas/objects/transaction-hash.json delete mode 100644 src/common/schemas/objects/transaction-type.json delete mode 100644 src/common/schemas/objects/tx-json.json delete mode 100644 src/common/schemas/objects/uint32.json delete mode 100644 src/common/schemas/objects/value.json delete mode 100644 src/common/schemas/objects/x-address.json delete mode 100644 src/common/schemas/output/generate-address.json delete mode 100644 src/common/schemas/output/generate-x-address.json delete mode 100644 src/common/schemas/output/get-account-info.json delete mode 100644 src/common/schemas/output/get-account-objects.json delete mode 100644 src/common/schemas/output/get-balance-sheet.json delete mode 100644 src/common/schemas/output/get-balances.json delete mode 100644 src/common/schemas/output/get-ledger.json delete mode 100644 src/common/schemas/output/get-orderbook.json delete mode 100644 src/common/schemas/output/get-orders.json delete mode 100644 src/common/schemas/output/get-paths.json delete mode 100644 src/common/schemas/output/get-payment-channel.json delete mode 100644 src/common/schemas/output/get-server-info.json delete mode 100644 src/common/schemas/output/get-settings.json delete mode 100644 src/common/schemas/output/get-transaction.json delete mode 100644 src/common/schemas/output/get-transactions.json delete mode 100644 src/common/schemas/output/get-trustlines.json delete mode 100644 src/common/schemas/output/ledger-event.json delete mode 100644 src/common/schemas/output/order-change.json delete mode 100644 src/common/schemas/output/orderbook-orders.json delete mode 100644 src/common/schemas/output/outcome.json delete mode 100644 src/common/schemas/output/prepare.json delete mode 100644 src/common/schemas/output/sign-payment-channel-claim.json delete mode 100644 src/common/schemas/output/sign.json delete mode 100644 src/common/schemas/output/submit.json delete mode 100644 src/common/schemas/output/verify-payment-channel-claim.json delete mode 100644 src/common/schemas/specifications/account-delete.json delete mode 100644 src/common/schemas/specifications/check-cancel.json delete mode 100644 src/common/schemas/specifications/check-cash.json delete mode 100644 src/common/schemas/specifications/check-create.json delete mode 100644 src/common/schemas/specifications/deposit-preauth.json delete mode 100644 src/common/schemas/specifications/escrow-cancellation.json delete mode 100644 src/common/schemas/specifications/escrow-creation.json delete mode 100644 src/common/schemas/specifications/escrow-execution.json delete mode 100644 src/common/schemas/specifications/get-payment.json delete mode 100644 src/common/schemas/specifications/order-cancellation.json delete mode 100644 src/common/schemas/specifications/order.json delete mode 100644 src/common/schemas/specifications/payment-channel-claim.json delete mode 100644 src/common/schemas/specifications/payment-channel-create.json delete mode 100644 src/common/schemas/specifications/payment-channel-fund.json delete mode 100644 src/common/schemas/specifications/payment.json delete mode 100644 src/common/schemas/specifications/settings.json delete mode 100644 src/common/schemas/specifications/trustline.json delete mode 100644 src/common/validate.ts delete mode 100644 test/client/isValidAddress.ts delete mode 100644 test/client/isValidSecret.ts diff --git a/package-lock.json b/package-lock.json index ff4771c5..39d36eba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,6 @@ "bip32": "^2.0.6", "bip39": "^3.0.4", "https-proxy-agent": "^5.0.0", - "jsonschema": "1.2.2", "lodash": "^4.17.4", "ripple-address-codec": "^4.1.1", "ripple-binary-codec": "^1.1.3", @@ -47,7 +46,6 @@ "eslint-plugin-tsdoc": "^0.2.14", "eventemitter2": "^6.0.0", "https-browserify": "^1.0.0", - "json-schema-to-markdown-table": "^0.4.0", "mocha": "^9", "npm-run-all": "^4.1.5", "nyc": "^15", @@ -5192,15 +5190,6 @@ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, - "node_modules/json-schema-to-markdown-table": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema-to-markdown-table/-/json-schema-to-markdown-table-0.4.0.tgz", - "integrity": "sha1-JJ83/eHrb/YqT2XQjKoFaCeUpow=", - "dev": true, - "bin": { - "json-schema-to-markdown": "json-schema-to-markdown.js" - } - }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -5228,14 +5217,6 @@ "node": ">=6" } }, - "node_modules/jsonschema": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.2.tgz", - "integrity": "sha512-iX5OFQ6yx9NgbHCwse51ohhKgLuLL7Z5cNOeZOPIlDUtAMrxlruHLzVZxbltdHE5mEDXN+75oFOwq6Gn0MZwsA==", - "engines": { - "node": "*" - } - }, "node_modules/jsx-ast-utils": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.2.0.tgz", @@ -12906,12 +12887,6 @@ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, - "json-schema-to-markdown-table": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema-to-markdown-table/-/json-schema-to-markdown-table-0.4.0.tgz", - "integrity": "sha1-JJ83/eHrb/YqT2XQjKoFaCeUpow=", - "dev": true - }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -12933,11 +12908,6 @@ "minimist": "^1.2.5" } }, - "jsonschema": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.2.tgz", - "integrity": "sha512-iX5OFQ6yx9NgbHCwse51ohhKgLuLL7Z5cNOeZOPIlDUtAMrxlruHLzVZxbltdHE5mEDXN+75oFOwq6Gn0MZwsA==" - }, "jsx-ast-utils": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.2.0.tgz", diff --git a/package.json b/package.json index 020966a3..995d2332 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "bip32": "^2.0.6", "bip39": "^3.0.4", "https-proxy-agent": "^5.0.0", - "jsonschema": "1.2.2", "lodash": "^4.17.4", "ripple-address-codec": "^4.1.1", "ripple-binary-codec": "^1.1.3", @@ -58,7 +57,6 @@ "eslint-plugin-tsdoc": "^0.2.14", "eventemitter2": "^6.0.0", "https-browserify": "^1.0.0", - "json-schema-to-markdown-table": "^0.4.0", "mocha": "^9", "npm-run-all": "^4.1.5", "nyc": "^15", @@ -77,8 +75,7 @@ "webpack-cli": "^4.2.0" }, "scripts": { - "build": "run-s build:schemas build:lib build:snippets build:web", - "build:schemas": "mkdir -p dist/npm/common && cp -r src/common/schemas dist/npm/common/", + "build": "run-s build:lib build:snippets build:web", "build:snippets": "tsc --build ./snippets/tsconfig.json", "build:lib": "tsc --build tsconfig.build.json", "build:web": "webpack", diff --git a/src/client/index.ts b/src/client/index.ts index ff6216f6..bdf48854 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -20,7 +20,6 @@ import { import { constants, errors, txFlags, ensureClassicAddress } from "../common"; import { ValidationError } from "../common/errors"; import { getFee } from "../common/fee"; -import * as schemaValidator from "../common/schema-validator"; import getBalances from "../ledger/balances"; import { getOrderbook, formatBidsAndAsks } from "../ledger/orderbook"; import getPaths from "../ledger/pathfind"; @@ -183,7 +182,7 @@ class Client extends EventEmitter { constructor(server: string, options: ClientOptions = {}) { super(); - if (typeof server !== "string" || !server.match("^(wss?|wss?\\+unix)://")) { + if (typeof server !== "string" || !/^(wss?|wss?\+unix):\/\//.exec(server)) { throw new ValidationError( "server URI must start with `wss://`, `ws://`, `wss+unix://`, or `ws+unix://`." ); @@ -252,7 +251,9 @@ class Client extends EventEmitter { ): Promise; public request(r: TransactionEntryRequest): Promise; public request(r: TxRequest): Promise; - public request(r: R): Promise { + public async request( + r: R + ): Promise { // TODO: should this be typed with `extends BaseRequest/BaseResponse`? return this.connection.request({ ...r, @@ -478,9 +479,6 @@ class Client extends EventEmitter { static txFlags = txFlags; accountSetFlags = constants.AccountSetFlags; static accountSetFlags = constants.AccountSetFlags; - - isValidAddress = schemaValidator.isValidAddress; - isValidSecret = schemaValidator.isValidSecret; } export { Client, Connection }; diff --git a/src/common/index.ts b/src/common/index.ts index fac617e2..fb9833c8 100644 --- a/src/common/index.ts +++ b/src/common/index.ts @@ -5,7 +5,6 @@ import { import * as constants from "./constants"; import * as errors from "./errors"; -import * as validate from "./validate"; export function ensureClassicAddress(account: string): string { if (isValidXAddress(account)) { @@ -26,5 +25,5 @@ export function ensureClassicAddress(account: string): string { return account; } -export { constants, errors, validate }; +export { constants, errors }; export { txFlags } from "./txflags"; diff --git a/src/common/schema-validator.ts b/src/common/schema-validator.ts deleted file mode 100644 index 6609e7da..00000000 --- a/src/common/schema-validator.ts +++ /dev/null @@ -1,188 +0,0 @@ -import * as assert from "assert"; - -import _ from "lodash"; -import { isValidClassicAddress, isValidXAddress } from "ripple-address-codec"; - -import { isValidSecret } from "../utils"; - -import { ValidationError } from "./errors"; - -const { Validator } = require("jsonschema"); - -function loadSchemas() { - // listed explicitly for webpack (instead of scanning schemas directory) - const schemas = [ - require("./schemas/objects/tx-json.json"), - require("./schemas/objects/transaction-type.json"), - require("./schemas/objects/hash128.json"), - require("./schemas/objects/hash256.json"), - require("./schemas/objects/sequence.json"), - require("./schemas/objects/ticket-sequence.json"), - require("./schemas/objects/signature.json"), - require("./schemas/objects/issue.json"), - require("./schemas/objects/ledger-version.json"), - require("./schemas/objects/max-adjustment.json"), - require("./schemas/objects/memo.json"), - require("./schemas/objects/memos.json"), - require("./schemas/objects/public-key.json"), - require("./schemas/objects/private-key.json"), - require("./schemas/objects/uint32.json"), - require("./schemas/objects/value.json"), - require("./schemas/objects/source-adjustment.json"), - require("./schemas/objects/destination-adjustment.json"), - require("./schemas/objects/tag.json"), - require("./schemas/objects/lax-amount.json"), - require("./schemas/objects/lax-lax-amount.json"), - require("./schemas/objects/min-adjustment.json"), - require("./schemas/objects/source-exact-adjustment.json"), - require("./schemas/objects/destination-exact-adjustment.json"), - require("./schemas/objects/destination-address-tag.json"), - require("./schemas/objects/transaction-hash.json"), - require("./schemas/objects/address.json"), - require("./schemas/objects/x-address.json"), - require("./schemas/objects/classic-address.json"), - require("./schemas/objects/adjustment.json"), - require("./schemas/objects/quality.json"), - require("./schemas/objects/amount.json"), - require("./schemas/objects/amountbase.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/objects/settings-plus-memos.json"), - require("./schemas/specifications/settings.json"), - require("./schemas/specifications/payment.json"), - require("./schemas/specifications/get-payment.json"), - require("./schemas/specifications/escrow-cancellation.json"), - require("./schemas/specifications/order-cancellation.json"), - require("./schemas/specifications/order.json"), - require("./schemas/specifications/escrow-execution.json"), - require("./schemas/specifications/escrow-creation.json"), - require("./schemas/specifications/payment-channel-create.json"), - require("./schemas/specifications/payment-channel-fund.json"), - require("./schemas/specifications/payment-channel-claim.json"), - require("./schemas/specifications/check-create.json"), - require("./schemas/specifications/check-cash.json"), - require("./schemas/specifications/check-cancel.json"), - require("./schemas/specifications/trustline.json"), - require("./schemas/specifications/deposit-preauth.json"), - require("./schemas/specifications/account-delete.json"), - require("./schemas/output/sign.json"), - require("./schemas/output/submit.json"), - require("./schemas/output/get-account-info.json"), - require("./schemas/output/get-account-objects.json"), - require("./schemas/output/get-balances.json"), - require("./schemas/output/get-balance-sheet.json"), - require("./schemas/output/get-ledger.json"), - require("./schemas/output/get-orderbook.json"), - require("./schemas/output/get-orders.json"), - require("./schemas/output/order-change.json"), - require("./schemas/output/get-payment-channel.json"), - require("./schemas/output/prepare.json"), - require("./schemas/output/ledger-event.json"), - require("./schemas/output/get-paths.json"), - require("./schemas/output/get-server-info.json"), - require("./schemas/output/get-settings.json"), - require("./schemas/output/orderbook-orders.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/output/sign-payment-channel-claim.json"), - require("./schemas/output/verify-payment-channel-claim.json"), - require("./schemas/input/get-balances.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/get-payment-channel.json"), - require("./schemas/input/api-options.json"), - require("./schemas/input/get-settings.json"), - require("./schemas/input/get-account-info.json"), - require("./schemas/input/get-account-objects.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-escrow-creation.json"), - require("./schemas/input/prepare-escrow-cancellation.json"), - require("./schemas/input/prepare-escrow-execution.json"), - require("./schemas/input/prepare-payment-channel-create.json"), - require("./schemas/input/prepare-payment-channel-fund.json"), - require("./schemas/input/prepare-payment-channel-claim.json"), - require("./schemas/input/prepare-check-create.json"), - require("./schemas/input/prepare-check-cash.json"), - require("./schemas/input/prepare-check-cancel.json"), - require("./schemas/input/prepare-ticket-create.json"), - require("./schemas/input/compute-ledger-hash.json"), - require("./schemas/input/sign.json"), - require("./schemas/input/submit.json"), - require("./schemas/input/generate-address.json"), - require("./schemas/input/sign-payment-channel-claim.json"), - require("./schemas/input/verify-payment-channel-claim.json"), - require("./schemas/input/combine.json"), - ]; - const titles = schemas.map((schema) => schema.title); - const duplicates = Object.keys( - _.pickBy(_.countBy(titles), (count) => count > 1) - ); - assert.ok(duplicates.length === 0, `Duplicate schemas for: ${duplicates}`); - const validator = new Validator(); - // Register custom format validators that ignore undefined instances - // since jsonschema will still call the format validator on a missing - // (optional) property - - // This relies on "format": "xAddress" in `x-address.json`! - validator.customFormats.xAddress = function (instance) { - if (instance == null) { - return true; - } - return isValidXAddress(instance); - }; - - // This relies on "format": "classicAddress" in `classic-address.json`! - validator.customFormats.classicAddress = function (instance) { - if (instance == null) { - return true; - } - return isValidAddress(instance); - }; - - validator.customFormats.secret = function (instance) { - if (instance == null) { - return true; - } - return isValidSecret(instance); - }; - - // Register under the root URI '/' - schemas.forEach((schema) => validator.addSchema(schema, `/${schema.title}`)); - return validator; -} - -const schemaValidator = loadSchemas(); - -function schemaValidate(schemaName: string, object: any): void { - // Lookup under the root URI '/' - const schema = schemaValidator.getSchema(`/${schemaName}`); - if (schema == null) { - throw new ValidationError(`no schema for ${schemaName}`); - } - const result = schemaValidator.validate(object, schema); - if (!result.valid) { - throw new ValidationError(result.errors.join()); - } -} - -function isValidAddress(address: string): boolean { - return isValidXAddress(address) || isValidClassicAddress(address); -} - -export { schemaValidate, isValidSecret, isValidAddress }; diff --git a/src/common/schemas/input/api-options.json b/src/common/schemas/input/api-options.json deleted file mode 100644 index 1da93bef..00000000 --- a/src/common/schemas/input/api-options.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "api-options", - "type": "object", - "properties": { - "trace": { - "type": "boolean", - "description": "If true, log rippled requests and responses to stdout." - }, - "feeCushion": { - "type": "number", - "minimum": 1, - "description": "Factor to multiply estimated fee by to provide a cushion in case the required fee rises during submission of a transaction. Defaults to `1.2`." - }, - "maxFeeXRP": { - "type": "string", - "description": "Maximum fee to use with transactions, in XRP. Must be a string-encoded number. Defaults to `'2'`." - }, - "server": { - "type": "string", - "description": "URI for rippled websocket port to connect to. Must start with `wss://`, `ws://`, `wss+unix://`, or `ws+unix://`.", - "format": "uri", - "pattern": "^(wss?|wss?\\+unix)://" - }, - "proxy": { - "format": "uri", - "description": "URI for HTTP/HTTPS proxy to use to connect to the rippled server." - }, - "timeout": { - "type": "integer", - "description": "Request timeout in milliseconds before considering a request to have failed. See also: connectionTimeout.", - "minimum": 1 - }, - "connectionTimeout": { - "type": "integer", - "description": "Connection timeout, in milliseconds, before considering connect() to have failed.", - "minimum": 1 - }, - "proxyAuthorization": { - "type": "string", - "description": "Username and password for HTTP basic authentication to the proxy in the format **username:password**." - }, - "authorization": { - "type": "string", - "description": "Username and password for HTTP basic authentication to the rippled server in the format **username:password**." - }, - "trustedCertificates": { - "type": "array", - "description": "Array of PEM-formatted SSL certificates to trust when connecting to a proxy. This is useful if you want to use a self-signed certificate on the proxy server. Note: Each element must contain a single certificate; concatenated certificates are not valid.", - "items": { - "type": "string", - "description": "A PEM-formatted SSL certificate to trust when connecting to a proxy." - } - }, - "key": { - "type": "string", - "description": "A string containing the private key of the client in PEM format. (Can be an array of keys)." - }, - "passphrase": { - "type": "string", - "description": "The passphrase for the private key of the client." - }, - "certificate": { - "type": "string", - "description": "A string containing the certificate key of the client in PEM format. (Can be an array of certificates)." - } - }, - "additionalProperties": false -} diff --git a/src/common/schemas/input/combine.json b/src/common/schemas/input/combine.json deleted file mode 100644 index fb487476..00000000 --- a/src/common/schemas/input/combine.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "combineParameters", - "type": "object", - "properties": { - "signedTransactions": { - "type": "array", - "description": "An array of signed transactions (from the output of [sign](#sign)) to combine.", - "items": { - "type": "string", - "pattern": "^[A-F0-9]+$", - "description": "A single-signed transaction represented as an uppercase hexadecimal string (from the output of [sign](#sign))" - }, - "minLength": 1 - } - }, - "additionalProperties": false, - "required": ["signedTransactions"] -} diff --git a/src/common/schemas/input/compute-ledger-hash.json b/src/common/schemas/input/compute-ledger-hash.json deleted file mode 100644 index 8adef681..00000000 --- a/src/common/schemas/input/compute-ledger-hash.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "computeLedgerHashParameters", - "type": "object", - "properties": { - "ledger": { - "$ref": "getLedger", - "description": "The ledger header to hash." - } - }, - "additionalProperties": false, - "required": ["ledger"] -} diff --git a/src/common/schemas/input/generate-address.json b/src/common/schemas/input/generate-address.json deleted file mode 100644 index af2dec48..00000000 --- a/src/common/schemas/input/generate-address.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "generateAddressParameters", - "type": "object", - "properties": { - "options": { - "type": "object", - "description": "Options to control how the address and secret are generated.", - "properties": { - "entropy": { - "type": "array", - "items": { - "type": "integer", - "minimum": 0, - "maximum": 255 - }, - "description": "The entropy to use to generate the seed. Must be an array of length 16 with values from 0-255 (16 bytes of entropy)" - }, - "algorithm": { - "type": "string", - "enum": ["ecdsa-secp256k1", "ed25519"], - "description": "The digital signature algorithm to generate an address for. Can be `ecdsa-secp256k1` (default) or `ed25519`." - }, - "test": { - "type": "boolean", - "description": "Specifies whether the address is intended for use on a test network such as Testnet or Devnet. If `true`, the address should only be used for testing, and starts with `T`. If `false`, the address should only be used on Mainnet, and starts with `X`." - }, - "includeClassicAddress": { - "type": "boolean", - "description": "If `true`, also return the classic address." - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false -} diff --git a/src/common/schemas/input/generate-x-address.json b/src/common/schemas/input/generate-x-address.json deleted file mode 100644 index 95d51164..00000000 --- a/src/common/schemas/input/generate-x-address.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "generateXAddressParameters", - "type": "object", - "properties": { - "options": { - "type": "object", - "description": "Options to control how the address and secret are generated.", - "properties": { - "entropy": { - "type": "array", - "items": { - "type": "integer", - "minimum": 0, - "maximum": 255 - }, - "description": "The entropy to use to generate the seed. Must be an array of length 16 with values from 0-255 (16 bytes of entropy)" - }, - "algorithm": { - "type": "string", - "enum": ["ecdsa-secp256k1", "ed25519"], - "description": "The digital signature algorithm to generate an address for. Can be `ecdsa-secp256k1` (default) or `ed25519`." - }, - "test": { - "type": "boolean", - "description": "Specifies whether the address is intended for use on a test network such as Testnet or Devnet. If `true`, the address should only be used for testing, and starts with `T`. If `false`, the address should only be used on Mainnet, and starts with `X`." - }, - "includeClassicAddress": { - "type": "boolean", - "description": "Specifies whether the classic address should also be included in the returned payload." - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false -} diff --git a/src/common/schemas/input/get-account-info.json b/src/common/schemas/input/get-account-info.json deleted file mode 100644 index 892da778..00000000 --- a/src/common/schemas/input/get-account-info.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getAccountInfoParameters", - "description": "Parameters for getAccountInfo", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account to get the account info of." - }, - "options": { - "description": "Options that affect what to return.", - "properties": { - "ledgerVersion": { - "$ref": "ledgerVersion", - "description": "Get the account info as of this historical ledger version." - } - }, - "additionalProperties": false - } - }, - "required": ["address"], - "additionalProperties": false -} diff --git a/src/common/schemas/input/get-account-objects.json b/src/common/schemas/input/get-account-objects.json deleted file mode 100644 index 54835dc9..00000000 --- a/src/common/schemas/input/get-account-objects.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getAccountObjectsOptions", - "description": "Request options for getAccountObjects", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account to get the account objects of." - }, - "options": { - "description": "Options that affect what to return.", - "properties": { - "type": { - "type": "string", - "enum": [ - "check", - "escrow", - "offer", - "payment_channel", - "signer_list", - "state" - ], - "description": - "(Optional) Filter results to include only this type of ledger object. The valid types are: `check`, `escrow`, `offer`, `payment_channel`, `signer_list`, and `state` (trust line)." - }, - "ledgerHash": { - "type": "string", - "description": - "(Optional) A 20-byte hex string for the ledger version to use." - }, - "ledgerIndex": { - "oneOf": [ - { - "$ref": "ledgerVersion" - }, - { - "type": "string" - } - ], - "description": - "(Optional) The sequence number of the ledger to use, or a shortcut string to choose a ledger automatically." - }, - "limit": { - "type": "integer", - "minimum": 1, - "description": - "(Optional) The maximum number of objects to include in the results." - } - }, - "additionalProperties": false - } - }, - "required": ["address"], - "additionalProperties": false -} diff --git a/src/common/schemas/input/get-balance-sheet.json b/src/common/schemas/input/get-balance-sheet.json deleted file mode 100644 index 86b077bd..00000000 --- a/src/common/schemas/input/get-balance-sheet.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getBalanceSheetParameters", - "description": "Parameters for getBalanceSheet", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The XRP Ledger address of the account to get the balance sheet of." - }, - "options": { - "properties": { - "excludeAddresses": { - "type": "array", - "items": {"$ref": "address"}, - "uniqueItems": true, - "description": "Addresses to exclude from the balance totals." - }, - "ledgerVersion": { - "$ref": "ledgerVersion", - "description": "Get the balance sheet as of this historical ledger version." - } - }, - "description": "Options to determine how the balances are calculated.", - "additionalProperties": false - } - }, - "additionalProperties": false, - "required": ["address"] -} diff --git a/src/common/schemas/input/get-balances.json b/src/common/schemas/input/get-balances.json deleted file mode 100644 index e5fb3cec..00000000 --- a/src/common/schemas/input/get-balances.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getBalancesParameters", - "description": "Parameters for getBalances", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account to get balances for." - }, - "options": { - "description": "Options to filter and determine which balances to return.", - "properties": { - "counterparty": { - "$ref": "address", - "description": "Only return balances with this counterparty." - }, - "currency": { - "$ref": "currency", - "description": "Only return balances for this currency." - }, - "limit": { - "type": "integer", - "minimum": 1, - "description": "Return at most this many balances." - }, - "ledgerVersion": { - "$ref": "ledgerVersion", - "description": "Return balances as they were in this historical ledger version." - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false, - "required": ["address"] -} diff --git a/src/common/schemas/input/get-fee.json b/src/common/schemas/input/get-fee.json deleted file mode 100644 index 4250b271..00000000 --- a/src/common/schemas/input/get-fee.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getFeeParameters", - "description": "Parameters for getFee", - "type": "object", - "properties": { - "cushion": { - "type": "number", - "description": "The fee is the product of the base fee, the `load_factor`, and this cushion. Default is provided by the `Client` constructor's `feeCushion`." - } - }, - "additionalProperties": false -} diff --git a/src/common/schemas/input/get-ledger.json b/src/common/schemas/input/get-ledger.json deleted file mode 100644 index 37a9c84e..00000000 --- a/src/common/schemas/input/get-ledger.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getLedgerParameters", - "description": "Parameters for getLedger", - "type": "object", - "properties": { - "options": { - "description": "Options affecting what ledger and how much data to return.", - "properties": { - "ledgerHash": { - "type": "string", - "description": "Get ledger data for this historical ledger hash." - }, - "ledgerVersion": { - "$ref": "ledgerVersion", - "description": "Get ledger data for this historical ledger version." - }, - "includeAllData": { - "type": "boolean", - "description": "Include the details of the transactions or state information if `includeTransactions` or `includeState` is set." - }, - "includeTransactions": { - "type": "boolean", - "description": "Return an array of transactions in this ledger. By default, provides the identifying hashes for each transaction. If `includeAllData` is true, include the entire transaction JSON for each transaction instead." - }, - "includeState": { - "type": "boolean", - "description": "Return an array of state data in this ledger. By default, provides the identifying hashes of state data. If `includeAllData` is true, return the state data in JSON form instead. **Admin required:** This is a very large amount of data." - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false -} diff --git a/src/common/schemas/input/get-orderbook.json b/src/common/schemas/input/get-orderbook.json deleted file mode 100644 index 95355041..00000000 --- a/src/common/schemas/input/get-orderbook.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "$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", - "description": "The order book to get." - }, - "options": { - "description": "Options to determine what to return.", - "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "description": "Return at most this many orders from the order book." - }, - "ledgerVersion": { - "$ref": "ledgerVersion", - "description": "Return the order book as of this historical ledger version." - } - }, - "additionalProperties": false - } - }, - "required": ["address", "orderbook"], - "additionalProperties": false -} diff --git a/src/common/schemas/input/get-orders.json b/src/common/schemas/input/get-orders.json deleted file mode 100644 index 932cd186..00000000 --- a/src/common/schemas/input/get-orders.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getOrdersParameters", - "description": "Parameters for getOrders", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The XRP Ledger address of the account to get open orders for." - }, - "options": { - "description": "Options that determine what orders to return.", - "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "description": "Return at most this many orders." - }, - "ledgerVersion": { - "$ref": "ledgerVersion", - "description": "Return orders as of this historical ledger version." - } - }, - "additionalProperties": false - } - }, - "required": ["address"], - "additionalProperties": false -} diff --git a/src/common/schemas/input/get-paths.json b/src/common/schemas/input/get-paths.json deleted file mode 100644 index 57e45b1b..00000000 --- a/src/common/schemas/input/get-paths.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getPathsParameters", - "type": "object", - "properties": { - "pathfind": { - "description": "Specification of a pathfind request.", - "properties": { - "source": { - "description": "Properties of the source of funds.", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The XRP Ledger address of the planned sender." - }, - "amount": { - "$ref": "laxAmount", - "description": "The amount of funds to send." - }, - "currencies": { - "description": "An array of currencies (with optional counterparty) that may be used in the payment paths.", - "type": "array", - "items": { - "description": "A currency with optional counterparty.", - "type": "object", - "properties": { - "currency": {"$ref": "currency"}, - "counterparty": { - "$ref": "address", - "description": "The counterparty for the currency; if omitted any counterparty may be used." - } - }, - "required": ["currency"], - "additionalProperties": false - }, - "uniqueItems": true - } - }, - "not": { - "required": ["amount", "currencies"] - }, - "additionalProperties": false, - "required": ["address"] - }, - "destination": { - "description": "Properties of the destination of funds.", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "An address representing the destination of the transaction." - }, - "amount": { - "$ref": "laxLaxAmount", - "description": "The amount to be received by the receiver (`value` may be ommitted if a source amount is specified)." - } - }, - "required": ["address", "amount"], - "additionalProperties": false - } - }, - "required": ["source", "destination"], - "additionalProperties": false - } - }, - "additionalProperties": false, - "required": ["pathfind"] -} diff --git a/src/common/schemas/input/get-payment-channel.json b/src/common/schemas/input/get-payment-channel.json deleted file mode 100644 index d4c1b8a5..00000000 --- a/src/common/schemas/input/get-payment-channel.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getPaymentChannelParameters", - "description": "Parameters for getPaymentChannel", - "type": "object", - "properties": { - "id": { - "$ref": "hash256", - "description": "256-bit hexadecimal channel identifier." - } - }, - "additionalProperties": false, - "required": ["id"] -} diff --git a/src/common/schemas/input/get-settings.json b/src/common/schemas/input/get-settings.json deleted file mode 100644 index ec1d3d41..00000000 --- a/src/common/schemas/input/get-settings.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getSettingsParameters", - "description": "Parameters for getSettings", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account to get the settings of." - }, - "options": { - "description": "Options that affect what to return.", - "properties": { - "ledgerVersion": { - "$ref": "ledgerVersion", - "description": "Get the settings as of this historical ledger version." - } - }, - "additionalProperties": false - } - }, - "required": ["address"], - "additionalProperties": false -} diff --git a/src/common/schemas/input/get-transaction.json b/src/common/schemas/input/get-transaction.json deleted file mode 100644 index 0dcd2ec8..00000000 --- a/src/common/schemas/input/get-transaction.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getTransactionParameters", - "description": "Parameters for getTransaction", - "type": "object", - "properties": { - "id": {"$ref": "transactionHash"}, - "options": { - "description": "Options to limit the ledger versions to search or include raw transaction data.", - "properties": { - "minLedgerVersion": { - "$ref": "ledgerVersion", - "description": "The lowest ledger version to search. This must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'." - }, - "maxLedgerVersion": { - "$ref": "ledgerVersion", - "description": "The highest ledger version to search. This must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'." - }, - "includeRawTransaction": { - "description": "Include raw transaction data. For advanced users; exercise caution when interpreting this data." - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false, - "required": ["id"] -} diff --git a/src/common/schemas/input/get-transactions.json b/src/common/schemas/input/get-transactions.json deleted file mode 100644 index a05d1fa0..00000000 --- a/src/common/schemas/input/get-transactions.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getTransactionsParameters", - "description": "Parameters for getTransactions", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account to get transactions for." - }, - "options": { - "description": "Options to filter the resulting transactions.", - "properties": { - "start": { - "$ref": "hash256", - "description": "If specified, start the results from this transaction. You cannot use `start` with `minLedgerVersion` or `maxLedgerVersion`. When `start` is specified, these ledger versions are determined internally." - }, - "limit": { - "type": "integer", - "minimum": 1, - "description": "If specified, return at most this many transactions." - }, - "minLedgerVersion": { - "$ref": "ledgerVersion", - "description": "Return only transactions in this ledger version or higher." - }, - "maxLedgerVersion": { - "$ref": "ledgerVersion", - "description": "Return only transactions in this ledger version or lower." - }, - "earliestFirst": { - "type": "boolean", - "description": "If true, sort transactions so that the earliest ones come first. By default, the newest transactions come first." - }, - "excludeFailures": { - "type": "boolean", - "description": "If true, the result omits transactions that did not succeed." - }, - "initiated": { - "type": "boolean", - "description": "If true, return only transactions initiated by the account specified by `address`. If false, return only transactions not initiated by the account specified by `address`." - }, - "counterparty": { - "$ref": "address", - "description": "If provided, only return transactions with this account as a counterparty to the transaction." - }, - "types": { - "type": "array", - "items": {"$ref": "transactionType"}, - "description": "Only return transactions of the specified [Transaction Types](#transaction-types)." - }, - "includeRawTransactions": { - "description": "Include raw transaction data. For advanced users; exercise caution when interpreting this data. " - }, - "binary": { - "type": "boolean", - "description": "If true, return transactions in binary format rather than JSON." - } - }, - "additionalProperties": false, - "not": { - "anyOf": [ - {"required": ["start", "minLedgerVersion"]}, - {"required": ["start", "maxLedgerVersion"]} - ] - } - } - }, - "additionalProperties": false, - "required": ["address"] -} diff --git a/src/common/schemas/input/get-trustlines.json b/src/common/schemas/input/get-trustlines.json deleted file mode 100644 index a2bcfadb..00000000 --- a/src/common/schemas/input/get-trustlines.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getTrustlinesParameters", - "description": "Parameters for getTrustlines", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account to get trustlines for." - }, - "options": { - "description": "Options to filter and determine which trustlines to return.", - "properties": { - "counterparty": { - "$ref": "address", - "description": "Only return trustlines with this counterparty." - }, - "currency": { - "$ref": "currency", - "description": "Only return trustlines for this currency." - }, - "limit": { - "type": "integer", - "minimum": 1, - "description": "Return at most this many trustlines." - }, - "ledgerVersion": { - "$ref": "ledgerVersion", - "description": "Return trustlines as they were in this historical ledger version." - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false, - "required": ["address"] -} diff --git a/src/common/schemas/input/prepare-check-cancel.json b/src/common/schemas/input/prepare-check-cancel.json deleted file mode 100644 index 430e47ff..00000000 --- a/src/common/schemas/input/prepare-check-cancel.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepareCheckCancelParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "checkCancel": { - "$ref": "checkCancel", - "description": "The specification of the Check cancellation to prepare." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "checkCancel"] -} diff --git a/src/common/schemas/input/prepare-check-cash.json b/src/common/schemas/input/prepare-check-cash.json deleted file mode 100644 index 16d491bf..00000000 --- a/src/common/schemas/input/prepare-check-cash.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepareCheckCashParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "checkCash": { - "$ref": "checkCash", - "description": "The specification of the Check cash to prepare." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "checkCash"] -} diff --git a/src/common/schemas/input/prepare-check-create.json b/src/common/schemas/input/prepare-check-create.json deleted file mode 100644 index 180281b8..00000000 --- a/src/common/schemas/input/prepare-check-create.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepareCheckCreateParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "checkCreate": { - "$ref": "checkCreate", - "description": "The specification of the Check create creation to prepare." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "checkCreate"] -} diff --git a/src/common/schemas/input/prepare-escrow-cancellation.json b/src/common/schemas/input/prepare-escrow-cancellation.json deleted file mode 100644 index 8cff98c6..00000000 --- a/src/common/schemas/input/prepare-escrow-cancellation.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepareEscrowCancellationParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "escrowCancellation": { - "$ref": "escrowCancellation", - "description": "The specification of the escrow cancellation to prepare." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "escrowCancellation"] -} diff --git a/src/common/schemas/input/prepare-escrow-creation.json b/src/common/schemas/input/prepare-escrow-creation.json deleted file mode 100644 index 4a9b385e..00000000 --- a/src/common/schemas/input/prepare-escrow-creation.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepareEscrowCreationParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "escrowCreation": { - "$ref": "escrowCreation", - "description": "The specification of the escrow creation to prepare." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "escrowCreation"] -} diff --git a/src/common/schemas/input/prepare-escrow-execution.json b/src/common/schemas/input/prepare-escrow-execution.json deleted file mode 100644 index f09ff2d3..00000000 --- a/src/common/schemas/input/prepare-escrow-execution.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepareEscrowExecutionParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "escrowExecution": { - "$ref": "escrowExecution", - "description": "The specification of the escrow execution to prepare." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "escrowExecution"] -} diff --git a/src/common/schemas/input/prepare-order-cancellation.json b/src/common/schemas/input/prepare-order-cancellation.json deleted file mode 100644 index 4281b74a..00000000 --- a/src/common/schemas/input/prepare-order-cancellation.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepareOrderCancellationParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "orderCancellation": { - "$ref": "orderCancellation", - "description": "The specification of the order cancellation to prepare." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "orderCancellation"] -} diff --git a/src/common/schemas/input/prepare-order.json b/src/common/schemas/input/prepare-order.json deleted file mode 100644 index 9008dcc3..00000000 --- a/src/common/schemas/input/prepare-order.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepareOrderParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "order": { - "$ref": "order", - "description": "The specification of the order to prepare." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "order"] -} diff --git a/src/common/schemas/input/prepare-payment-channel-claim.json b/src/common/schemas/input/prepare-payment-channel-claim.json deleted file mode 100644 index b7ec49dd..00000000 --- a/src/common/schemas/input/prepare-payment-channel-claim.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "preparePaymentChannelClaimParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "paymentChannelClaim": { - "$ref": "paymentChannelClaim", - "description": "Details of the channel and claim." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "paymentChannelClaim"] -} diff --git a/src/common/schemas/input/prepare-payment-channel-create.json b/src/common/schemas/input/prepare-payment-channel-create.json deleted file mode 100644 index 158eb702..00000000 --- a/src/common/schemas/input/prepare-payment-channel-create.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "preparePaymentChannelCreateParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "paymentChannelCreate": { - "$ref": "paymentChannelCreate", - "description": "The specification of the payment channel to create." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "paymentChannelCreate"] -} diff --git a/src/common/schemas/input/prepare-payment-channel-fund.json b/src/common/schemas/input/prepare-payment-channel-fund.json deleted file mode 100644 index 940e45c4..00000000 --- a/src/common/schemas/input/prepare-payment-channel-fund.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "preparePaymentChannelFundParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "paymentChannelFund": { - "$ref": "paymentChannelFund", - "description": "The channel to fund, and the details of how to fund it." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "paymentChannelFund"] -} diff --git a/src/common/schemas/input/prepare-payment.json b/src/common/schemas/input/prepare-payment.json deleted file mode 100644 index 76718426..00000000 --- a/src/common/schemas/input/prepare-payment.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "preparePaymentParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "payment": { - "$ref": "payment", - "description": "The specification of the payment to prepare." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "payment"] -} diff --git a/src/common/schemas/input/prepare-settings.json b/src/common/schemas/input/prepare-settings.json deleted file mode 100644 index fdd058c0..00000000 --- a/src/common/schemas/input/prepare-settings.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepareSettingsParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "settings": { - "$ref": "settings", - "description": "The specification of the settings to prepare." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "settings"] -} diff --git a/src/common/schemas/input/prepare-ticket-create.json b/src/common/schemas/input/prepare-ticket-create.json deleted file mode 100644 index 32d85f34..00000000 --- a/src/common/schemas/input/prepare-ticket-create.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepareTicketParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "ticketCount": { - "type": "number", - "description": "The number of tickets to be created." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "ticketCount"] -} diff --git a/src/common/schemas/input/prepare-trustline.json b/src/common/schemas/input/prepare-trustline.json deleted file mode 100644 index b98fadf2..00000000 --- a/src/common/schemas/input/prepare-trustline.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepareTrustlineParameters", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address of the account that is creating the transaction." - }, - "trustline": { - "$ref": "trustline", - "description": "The specification of the trustline to prepare." - }, - "instructions": {"$ref": "instructions"} - }, - "additionalProperties": false, - "required": ["address", "trustline"] -} diff --git a/src/common/schemas/input/sign-payment-channel-claim.json b/src/common/schemas/input/sign-payment-channel-claim.json deleted file mode 100644 index 5266facf..00000000 --- a/src/common/schemas/input/sign-payment-channel-claim.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "signPaymentChannelClaimParameters", - "type": "object", - "properties": { - "channel": { - "$ref": "hash256", - "description": "256-bit hexadecimal channel identifier." - }, - "amount": { - "$ref": "value", - "description": "Amount of XRP authorized by the claim." - }, - "privateKey": { - "$ref": "publicKey", - "description": "The private key to sign the payment channel claim." - } - }, - "additionalProperties": false, - "required": ["channel", "amount", "privateKey"] -} diff --git a/src/common/schemas/input/sign.json b/src/common/schemas/input/sign.json deleted file mode 100644 index cc87f533..00000000 --- a/src/common/schemas/input/sign.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "$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. (This field cannot be used with keypair)." - }, - "keypair": { - "type": "object", - "properties": { - "privateKey": { - "type": "privateKey", - "description": "The uppercase hexadecimal representation of the secp256k1 or Ed25519 private key. Ed25519 keys are prefixed with 0xED. You can read about how keys are derived [here](https://xrpl.org/cryptographic-keys.html)." - }, - "publicKey": { - "type": "publicKey", - "description": "The uppercase hexadecimal representation of the secp256k1 or Ed25519 public key. Ed25519 keys are prefixed with 0xED. You can read about how keys are derived [here](https://xrpl.org/cryptographic-keys.html)." - } - }, - "description": "The private and public key of the account that is initiating the transaction. (This field cannot be used with secret).", - "required": ["privateKey", "publicKey"], - "additionalProperties": false - }, - "options": { - "type": "object", - "description": "Options that control the type of signature to create.", - "properties": { - "signAs": { - "$ref": "address", - "description": "The account that the signature should count for in multisigning." - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false, - "required": ["txJSON"], - "oneOf": [ - { - "required": ["secret"], - "not": {"required": ["keypair"]} - }, - { - "required": ["keypair"], - "not": {"required": ["secret"]} - } - ] -} diff --git a/src/common/schemas/input/submit.json b/src/common/schemas/input/submit.json deleted file mode 100644 index f9b0dc4d..00000000 --- a/src/common/schemas/input/submit.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "submitParameters", - "type": "object", - "properties": { - "signedTransaction": { - "$ref": "blob", - "description": "A signed transaction as returned by [sign](#sign)." - }, - "failHard": { - "type": "boolean", - "description": "If `true`, and the transaction fails locally, do not retry or relay the transaction to other servers. Defaults to `false`." - } - }, - "additionalProperties": false, - "required": ["signedTransaction"] -} diff --git a/src/common/schemas/input/verify-payment-channel-claim.json b/src/common/schemas/input/verify-payment-channel-claim.json deleted file mode 100644 index 767267a1..00000000 --- a/src/common/schemas/input/verify-payment-channel-claim.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "verifyPaymentChannelClaimParameters", - "type": "object", - "properties": { - "channel": { - "$ref": "hash256", - "description": "256-bit hexadecimal channel identifier." - }, - "amount": { - "$ref": "value", - "description": "Amount of XRP authorized by the claim." - }, - "signature": { - "$ref": "signature", - "description": "Signature of this claim." - }, - "publicKey": { - "$ref": "publicKey", - "description": "Public key of the channel's sender" - } - }, - "additionalProperties": false, - "required": ["channel", "amount", "signature", "publicKey"] -} diff --git a/src/common/schemas/objects/address.json b/src/common/schemas/objects/address.json deleted file mode 100644 index df1adcfb..00000000 --- a/src/common/schemas/objects/address.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "address", - "description": "An account address on the XRP Ledger", - "type": "string", - "format": "address", - "link": "address", - "oneOf": [ - {"$ref": "xAddress"}, - {"$ref": "classicAddress"} - ] -} diff --git a/src/common/schemas/objects/adjustment.json b/src/common/schemas/objects/adjustment.json deleted file mode 100644 index d65812f5..00000000 --- a/src/common/schemas/objects/adjustment.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "adjustment", - "type": "object", - "properties": { - "address": {"$ref": "address"}, - "amount": {"$ref": "amount"}, - "tag": {"$ref": "tag"} - }, - "required": ["address", "amount"], - "additionalProperties": false -} diff --git a/src/common/schemas/objects/amount.json b/src/common/schemas/objects/amount.json deleted file mode 100644 index a4cd5c23..00000000 --- a/src/common/schemas/objects/amount.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "amount", - "link": "amount", - "description": "An Amount on the XRP Ledger", - "allOf": [ - {"$ref": "amountbase"}, - {"required": ["value"]} - ] -} diff --git a/src/common/schemas/objects/amountbase.json b/src/common/schemas/objects/amountbase.json deleted file mode 100644 index fdb03b06..00000000 --- a/src/common/schemas/objects/amountbase.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "amountbase", - "description": "Base class for amount and issue", - "type": "object", - "properties": { - "value": { - "description": "The quantity of the currency, denoted as a string so that it does not lose precision", - "$ref": "value" - }, - "currency": { - "description": "The three-character code or hexadecimal string used to denote currencies, or \"drops\" for the smallest unit of XRP.", - "$ref": "currency" - }, - "counterparty": { - "description": "The XRP Ledger address of the account that owes or is owed the funds (omitted if `currency` is \"XRP\" or \"drops\")", - "$ref": "address" - } - }, - "additionalProperties": false, - "required": ["currency"], - "oneOf": [ - { - "properties": { - "currency": { - "not": { - "enum": ["XRP", "drops"] - } - } - }, - "required": ["counterparty"] - }, - { - "properties": { - "currency": { - "enum": ["XRP", "drops"] - } - }, - "not": { - "required": ["counterparty"] - } - } - ] -} diff --git a/src/common/schemas/objects/balance.json b/src/common/schemas/objects/balance.json deleted file mode 100644 index 3c3bd1fb..00000000 --- a/src/common/schemas/objects/balance.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "balance", - "description": "Balance amount", - "link": "amount", - "type": "object", - "properties": { - "value": { - "description": "The balance on the trustline", - "$ref": "signedValue" - }, - "currency": { - "description": "The three-character code or hexadecimal string used to denote currencies", - "$ref": "currency" - }, - "counterparty": { - "description": "The XRP Ledger address of the account that owes or is owed the funds.", - "$ref": "address" - } - }, - "additionalProperties": false, - "required": ["currency", "value"], - "oneOf": [ - { - "properties": { - "currency": { - "not": { - "enum": ["XRP"] - } - } - }, - "required": ["counterparty"] - }, - { - "properties": { - "currency": { - "enum": ["XRP"] - } - }, - "not": { - "required": ["counterparty"] - } - } - ] -} diff --git a/src/common/schemas/objects/blob.json b/src/common/schemas/objects/blob.json deleted file mode 100644 index e42e8118..00000000 --- a/src/common/schemas/objects/blob.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "blob", - "description": "An uppercase hexadecimal string representation of a transaction", - "type": "string", - "minLength": 1, - "pattern": "^[0-9A-F]*$" -} diff --git a/src/common/schemas/objects/classic-address.json b/src/common/schemas/objects/classic-address.json deleted file mode 100644 index 4684b5f1..00000000 --- a/src/common/schemas/objects/classic-address.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "classicAddress", - "description": "A classic address (Account ID) for the XRP Ledger", - "type": "string", - "format": "classicAddress", - "link": "classic-address", - "pattern": "^r[1-9A-HJ-NP-Za-km-z]{24,34}$" -} diff --git a/src/common/schemas/objects/currency.json b/src/common/schemas/objects/currency.json deleted file mode 100644 index dcf9440e..00000000 --- a/src/common/schemas/objects/currency.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "currency", - "description": "The three-character code or hexadecimal string used to denote currencies", - "type": "string", - "link": "currency", - "pattern": "^([a-zA-Z0-9<>(){}[\\]|?!@#$%^&*]{3}|[A-F0-9]{40}|drops)$" -} diff --git a/src/common/schemas/objects/destination-address-tag.json b/src/common/schemas/objects/destination-address-tag.json deleted file mode 100644 index 02aa0c95..00000000 --- a/src/common/schemas/objects/destination-address-tag.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "destinationAddressTag", - "description": "A destination address and optional tag, with no amount included. When parsing an incoming transaction, the original specification's amount is hidden to prevent misinterpretation. For the amount that the transaction delivered, see `outcome.deliveredAmount`.", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "An address representing the destination of the transaction." - }, - "tag": {"$ref": "tag"} - }, - "required": ["address"], - "additionalProperties": false -} diff --git a/src/common/schemas/objects/destination-adjustment.json b/src/common/schemas/objects/destination-adjustment.json deleted file mode 100644 index 2e768531..00000000 --- a/src/common/schemas/objects/destination-adjustment.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "destinationAdjustment", - "type": "object", - "oneOf": [ - {"$ref": "destinationExactAdjustment"}, - {"$ref": "minAdjustment"} - ] -} diff --git a/src/common/schemas/objects/destination-exact-adjustment.json b/src/common/schemas/objects/destination-exact-adjustment.json deleted file mode 100644 index 4b6e19c1..00000000 --- a/src/common/schemas/objects/destination-exact-adjustment.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "destinationExactAdjustment", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "An address representing the destination of the transaction." - }, - "amount": { - "$ref": "laxAmount", - "description": "An exact amount to deliver to the recipient. If the counterparty is not specified, amounts with any counterparty may be used. (This field cannot be used with `destination.minAmount`.)" - }, - "tag": {"$ref": "tag"} - }, - "required": ["address", "amount"], - "additionalProperties": false -} diff --git a/src/common/schemas/objects/hash128.json b/src/common/schemas/objects/hash128.json deleted file mode 100644 index ea63b8ef..00000000 --- a/src/common/schemas/objects/hash128.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "hash128", - "description": "The hexadecimal representation of a 128-bit hash", - "type": "string", - "pattern": "^[A-F0-9]{32}$" -} diff --git a/src/common/schemas/objects/hash256.json b/src/common/schemas/objects/hash256.json deleted file mode 100644 index 5a848544..00000000 --- a/src/common/schemas/objects/hash256.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "hash256", - "description": "The hexadecimal representation of a 256-bit hash", - "type": "string", - "pattern": "^[A-F0-9]{64}$" -} diff --git a/src/common/schemas/objects/instructions.json b/src/common/schemas/objects/instructions.json deleted file mode 100644 index ef7da3fe..00000000 --- a/src/common/schemas/objects/instructions.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "instructions", - "link": "transaction-instructions", - "description": "Instructions for executing the transaction", - "type": "object", - "properties": { - "sequence": { - "description": "The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.", - "$ref": "sequence" - }, - "ticketSequence": { - "description": "The ticket sequence to be used for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.", - "$ref": "ticket-sequence" - }, - "fee": { - "description": "An exact fee to pay for the transaction, before multiplying for multi-signed transactions. See [Transaction Fees](#transaction-fees) for more information.", - "$ref": "value" - }, - "maxFee": { - "description": "Deprecated: Use `maxFeeXRP` in the Client constructor instead. The maximum fee to pay for this transaction. If this exceeds `maxFeeXRP`, use `maxFeeXRP` instead. See [Transaction Fees](#transaction-fees) for more information.", - "$ref": "value" - }, - "maxLedgerVersion": { - "description": "The highest ledger version that the transaction can be included in. If this option and `maxLedgerVersionOffset` are both omitted, the default is 3 greater than the current validated ledger version (equivalent to `maxLedgerVersionOffset=3`). Use `null` to not set a maximum ledger version. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.", - "oneOf": [ - {"$ref": "ledgerVersion"}, - {"type": "null"} - ] - }, - "maxLedgerVersionOffset": { - "description": "Offset from current validated ledger version to highest ledger version that the transaction can be included in.", - "type": "integer", - "minimum": 0 - }, - "signersCount": { - "description": "Number of signers that can multi-sign this transaction.", - "type": "integer", - "minimum": 1 - } - }, - "additionalProperties": false, - "not": { - "anyOf": [ - { - "description": "fee and maxFee are mutually exclusive", - "required": ["fee", "maxFee"] - }, - { - "description": "maxLedgerVersion and maxLedgerVersionOffset are mutually exclusive", - "required": ["maxLedgerVersion", "maxLedgerVersionOffset"] - }, - { - "description": "sequence and ticketSequence are mutually exclusive", - "required": ["sequence", "ticketSequence"] - } - ] - } -} diff --git a/src/common/schemas/objects/issue.json b/src/common/schemas/objects/issue.json deleted file mode 100644 index acf2b1f6..00000000 --- a/src/common/schemas/objects/issue.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "issue", - "description": "The currency code, and the counterparty if it's not XRP.", - "allOf": [ - {"$ref": "amountbase"}, - {"not": {"required": ["value"]}} - ] -} diff --git a/src/common/schemas/objects/lax-amount.json b/src/common/schemas/objects/lax-amount.json deleted file mode 100644 index 861d282b..00000000 --- a/src/common/schemas/objects/lax-amount.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "laxAmount", - "description": "Amount where counterparty is optional", - "link": "amount", - "type": "object", - "properties": { - "currency": {"$ref": "currency"}, - "counterparty": {"$ref": "address"}, - "value": {"$ref": "value"} - }, - "required": ["currency", "value"], - "additionalProperties": false -} diff --git a/src/common/schemas/objects/lax-lax-amount.json b/src/common/schemas/objects/lax-lax-amount.json deleted file mode 100644 index 4ef5933e..00000000 --- a/src/common/schemas/objects/lax-lax-amount.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "laxLaxAmount", - "description": "Amount where counterparty and value are optional", - "link": "amount", - "type": "object", - "properties": { - "currency": {"$ref": "currency"}, - "counterparty": {"$ref": "address"}, - "value": {"$ref": "value"} - }, - "required": ["currency"], - "additionalProperties": false -} diff --git a/src/common/schemas/objects/ledger-version.json b/src/common/schemas/objects/ledger-version.json deleted file mode 100644 index ce6f741c..00000000 --- a/src/common/schemas/objects/ledger-version.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "ledgerVersion", - "description": "A ledger version number", - "oneOf": [ - { - "type": "integer", - "minimum": 1 - }, - { - "type": "string", - "enum": ["validated", "closed", "current"] - } - ] -} diff --git a/src/common/schemas/objects/max-adjustment.json b/src/common/schemas/objects/max-adjustment.json deleted file mode 100644 index 1edf5a4f..00000000 --- a/src/common/schemas/objects/max-adjustment.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "maxAdjustment", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address to send from." - }, - "maxAmount": { - "$ref": "laxAmount", - "description": "The maximum amount to send. (This field cannot be used with source.amount)" - }, - "tag": {"$ref": "tag"} - }, - "required": ["address", "maxAmount"], - "additionalProperties": false -} diff --git a/src/common/schemas/objects/memo.json b/src/common/schemas/objects/memo.json deleted file mode 100644 index 9c2f0ac3..00000000 --- a/src/common/schemas/objects/memo.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "memo", - "description": "Memo objects represent arbitrary data that can be included in a transaction", - "type": "object", - "properties": { - "type": { - "pattern": "^[A-Za-z0-9\\-._~:/?#[\\]@!$&'()*+,;=%]*$", - "description": "Conventionally, a unique relation (according to [RFC 5988](http://tools.ietf.org/html/rfc5988#section-4)) that defines the format of this memo. Only characters allowed in URLs are permitted." - }, - "format": { - "pattern": "^[A-Za-z0-9\\-._~:/?#[\\]@!$&'()*+,;=%]*$", - "description": "Conventionally containing information on how the memo is encoded, for example as a [MIME type](http://www.iana.org/assignments/media-types/media-types.xhtml). Only characters allowed in URLs are permitted." - }, - "data": { - "type": "string", - "description": "Arbitrary string, conventionally containing the content of the memo." - } - }, - "additionalProperties": false, - "anyOf": [ - {"required": ["data"]}, - {"required": ["type"]} - ] -} diff --git a/src/common/schemas/objects/memos.json b/src/common/schemas/objects/memos.json deleted file mode 100644 index 5ca0c230..00000000 --- a/src/common/schemas/objects/memos.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "memos", - "link": "transaction-memos", - "description": "Array of memos to attach to the transaction.", - "type": "array", - "items": { - "$ref": "memo" - } -} diff --git a/src/common/schemas/objects/min-adjustment.json b/src/common/schemas/objects/min-adjustment.json deleted file mode 100644 index 5f3ecd11..00000000 --- a/src/common/schemas/objects/min-adjustment.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "minAdjustment", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "An address representing the destination of the transaction." - }, - "minAmount": { - "$ref": "laxAmount", - "description": "The minimum amount to be delivered. (This field cannot be used with destination.amount)" - }, - "tag": {"$ref": "tag"} - }, - "required": ["address", "minAmount"], - "additionalProperties": false -} diff --git a/src/common/schemas/objects/orderbook.json b/src/common/schemas/objects/orderbook.json deleted file mode 100644 index 05878ace..00000000 --- a/src/common/schemas/objects/orderbook.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "orderbook", - "type": "object", - "properties": { - "base": {"$ref": "issue"}, - "counter": {"$ref": "issue"} - }, - "required": ["base", "counter"], - "additionalProperties": false -} diff --git a/src/common/schemas/objects/private-key.json b/src/common/schemas/objects/private-key.json deleted file mode 100644 index ea2c0693..00000000 --- a/src/common/schemas/objects/private-key.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "privateKey", - "description": "The hexadecimal representation of a secp256k1 or Ed25519 private key.", - "type": "string", - "pattern": "^[A-F0-9]+$" -} diff --git a/src/common/schemas/objects/public-key.json b/src/common/schemas/objects/public-key.json deleted file mode 100644 index 3b236487..00000000 --- a/src/common/schemas/objects/public-key.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "publicKey", - "description": "The hexadecimal representation of a secp256k1 or Ed25519 public key.", - "type": "string", - "pattern": "^[A-F0-9]+$" -} diff --git a/src/common/schemas/objects/quality.json b/src/common/schemas/objects/quality.json deleted file mode 100644 index 47d0589f..00000000 --- a/src/common/schemas/objects/quality.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "quality", - "description": "Ratio for incoming/outgoing transit fees.", - "type": "number", - "minimum": 0.000000001, - "maximum": 4.294967295 -} diff --git a/src/common/schemas/objects/sequence.json b/src/common/schemas/objects/sequence.json deleted file mode 100644 index 26b9eb0b..00000000 --- a/src/common/schemas/objects/sequence.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "sequence", - "link": "account-sequence-number", - "description": "An account transaction sequence number", - "type": "integer", - "minimum": 0 -} diff --git a/src/common/schemas/objects/settings-plus-memos.json b/src/common/schemas/objects/settings-plus-memos.json deleted file mode 100644 index be162bfd..00000000 --- a/src/common/schemas/objects/settings-plus-memos.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "settingsPlusMemos", - "type": "object", - "properties": { - "defaultRipple": { - "type": "boolean", - "description": "Enable [rippling](https://xrpl.org/rippling.html) on this account’s trust lines by default. Currency issuers should enable this setting; most others should not." - }, - "depositAuth": { - "type": "boolean", - "description": "Enable [Deposit Authorization](https://xrpl.org/depositauth.html) on this account. If set, transactions cannot send value of any kind to this account unless the sender of those transactions is the account itself. (Requires the [DepositAuth amendment](https://xrpl.org/known-amendments.html#depositauth))" - }, - "disableMasterKey": { - "type": "boolean", - "description": "Disallows use of the master key to sign transactions for this account. To disable the master key, you must authorize the transaction by signing it with the master key pair. You cannot use a regular key pair or a multi-signature. You can re-enable the master key pair using a regular key pair or multi-signature. See [AccountSet](https://xrpl.org/accountset.html)." - }, - "disallowIncomingXRP": { - "type": "boolean", - "description": "Indicates that client applications should not send XRP to this account. Not enforced by rippled." - }, - "domain": { - "type": "string", - "description": "The domain that owns this account, as a hexadecimal string representing the ASCII for the domain in lowercase." - }, - "emailHash": { - "description": "Hash of an email address to be used for generating an avatar image. Conventionally, clients use Gravatar to display this image. Use `null` to clear.", - "oneOf": [ - {"type": "null"}, - {"$ref": "hash128"} - ] - }, - "walletLocator": { - "description": "Transaction hash or any other 64 character hexadecimal string, that may or may not represent the result of a hash operation. Use `null` to clear.", - "oneOf": [ - {"type": "null"}, - {"$ref": "hash256"} - ] - }, - "enableTransactionIDTracking": { - "type": "boolean", - "description": "Track the ID of this account’s most recent transaction." - }, - "globalFreeze": { - "type": "boolean", - "description": "Freeze all assets issued by this account." - }, - "memos": {"$ref": "memos"}, - "messageKey": { - "type": "string", - "description": "Public key for sending encrypted messages to this account. Conventionally, it should be a secp256k1 key, the same encryption that is used by the rest of Ripple." - }, - "noFreeze": { - "type": "boolean", - "description": "Permanently give up the ability to freeze individual trust lines. This flag can never be disabled after being enabled." - }, - "passwordSpent": { - "type": "boolean", - "description": "Indicates that the account has used its free SetRegularKey transaction." - }, - "regularKey": { - "oneOf": [ - {"$ref": "address"}, - {"type": "null"} - ], - "description": "The public key of a new keypair, to use as the regular key to this account, as a base-58-encoded string in the same format as an account address. Use `null` to remove the regular key." - }, - "requireAuthorization": { - "type": "boolean", - "description": "If set, this account must individually give other users permission to hold this account’s issued tokens." - }, - "requireDestinationTag": { - "type": "boolean", - "description": "Requires incoming payments to specify a destination tag." - }, - "signers": { - "type": "object", - "description": "Settings that determine what sets of accounts can be used to sign a transaction on behalf of this account using multisigning.", - "properties": { - "threshold": { - "$ref": "uint32", - "description": "A target number for the signer weights. A multi-signature from this list is valid only if the sum weights of the signatures provided is equal or greater than this value. To delete the signers setting, use the value `0`." - }, - "weights": { - "type": "array", - "description": "Weights of signatures for each signer.", - "items": { - "type": "object", - "description": "An association of an address and a weight.", - "properties": { - "address": {"$ref": "address"}, - "weight": { - "$ref": "uint32", - "description": "The weight that the signature of this account counts as towards the threshold." - } - }, - "required": ["address", "weight"], - "additionalProperties": false - }, - "minItems": 1, - "maxItems": 8 - } - }, - "required": ["threshold"], - "additionalProperties": false - }, - "transferRate": { - "description": "The fee to charge when users transfer this account’s issuances, as the decimal amount that must be sent to deliver 1 unit. Has precision up to 9 digits beyond the decimal point. Use `null` to set no fee.", - "oneOf": [ - {"type": "null"}, - {"type": "number", "minimum": 1, "maximum": 4.294967295} - ] - }, - "tickSize": { - "description": "Tick size to use for offers involving a currency issued by this address. The exchange rates of those offers is rounded to this many significant digits. Valid values are 3 to 15 inclusive, or 0 to disable.", - "enum": [0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] - } - }, - "additionalProperties": false -} diff --git a/src/common/schemas/objects/signature.json b/src/common/schemas/objects/signature.json deleted file mode 100644 index ac108b21..00000000 --- a/src/common/schemas/objects/signature.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "signature", - "description": "The hexadecimal representation of a signature.", - "type": "string", - "pattern": "^[A-F0-9]+$" -} diff --git a/src/common/schemas/objects/signed-value.json b/src/common/schemas/objects/signed-value.json deleted file mode 100644 index 1d17f6be..00000000 --- a/src/common/schemas/objects/signed-value.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "signedValue", - "description": "A string representation of a floating point number", - "type": "string", - "link": "value", - "pattern": "^[-]?[0-9]*[.]?[0-9]+([eE][-+]?[0-9]+)?$" -} diff --git a/src/common/schemas/objects/source-adjustment.json b/src/common/schemas/objects/source-adjustment.json deleted file mode 100644 index 3f5620c1..00000000 --- a/src/common/schemas/objects/source-adjustment.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "sourceAdjustment", - "type": "object", - "oneOf": [ - {"$ref": "sourceExactAdjustment"}, - {"$ref": "maxAdjustment"} - ] -} diff --git a/src/common/schemas/objects/source-exact-adjustment.json b/src/common/schemas/objects/source-exact-adjustment.json deleted file mode 100644 index 328e047f..00000000 --- a/src/common/schemas/objects/source-exact-adjustment.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "sourceExactAdjustment", - "type": "object", - "properties": { - "address": { - "$ref": "address", - "description": "The address to send from." - }, - "amount": { - "$ref": "laxAmount", - "description": "An exact amount to send. If the counterparty is not specified, amounts with any counterparty may be used. (This field cannot be used with source.maxAmount)" - }, - "tag": {"$ref": "tag"} - }, - "required": ["address", "amount"], - "additionalProperties": false -} diff --git a/src/common/schemas/objects/tag.json b/src/common/schemas/objects/tag.json deleted file mode 100644 index cf210a71..00000000 --- a/src/common/schemas/objects/tag.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "tag", - "description": "An arbitrary 32-bit unsigned integer. It typically maps to an off-ledger account; for example, a hosted wallet or exchange account.", - "type": "integer", - "$ref": "uint32" -} diff --git a/src/common/schemas/objects/ticket-sequence.json b/src/common/schemas/objects/ticket-sequence.json deleted file mode 100644 index 1892f1b2..00000000 --- a/src/common/schemas/objects/ticket-sequence.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "ticket-sequence", - "link": "account-sequence-number", - "description": "An account transaction tickt sequence number", - "type": "integer", - "minimum": 1 -} diff --git a/src/common/schemas/objects/transaction-hash.json b/src/common/schemas/objects/transaction-hash.json deleted file mode 100644 index 95b54676..00000000 --- a/src/common/schemas/objects/transaction-hash.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "transactionHash", - "link": "transaction-id", - "description": "A hash of a transaction used to identify the transaction, represented in hexadecimal.", - "type": "string", - "pattern": "^[A-F0-9]{64}$" -} diff --git a/src/common/schemas/objects/transaction-type.json b/src/common/schemas/objects/transaction-type.json deleted file mode 100644 index 5d8433e7..00000000 --- a/src/common/schemas/objects/transaction-type.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "transactionType", - "link": "transaction-types", - "description": "The type of the transaction.", - "type": "string", - "enum": [ - "payment", - "order", - "orderCancellation", - "trustline", - "settings", - "escrowCreation", - "escrowCancellation", - "escrowExecution", - "paymentChannelCreate", - "paymentChannelFund", - "paymentChannelClaim", - "checkCreate", - "checkCancel", - "checkCash", - "depositPreauth", - "accountDelete" - ] -} diff --git a/src/common/schemas/objects/tx-json.json b/src/common/schemas/objects/tx-json.json deleted file mode 100644 index 62c555ec..00000000 --- a/src/common/schemas/objects/tx-json.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "tx-json", - "link": "https://xrpl.org/transaction-formats.html", - "description": "An object in rippled txJSON format", - "type": "object", - "properties": { - "Account": {"$ref": "address"}, - "TransactionType": {"type": "string"} - }, - "required": ["Account", "TransactionType"] -} diff --git a/src/common/schemas/objects/uint32.json b/src/common/schemas/objects/uint32.json deleted file mode 100644 index e0b86646..00000000 --- a/src/common/schemas/objects/uint32.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "uint32", - "description": "A 32-bit unsigned integer", - "type": "integer", - "minimum": 0, - "maximum": 4294967295 -} diff --git a/src/common/schemas/objects/value.json b/src/common/schemas/objects/value.json deleted file mode 100644 index 6ad1aa2d..00000000 --- a/src/common/schemas/objects/value.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "value", - "link": "value", - "description": "A string representation of a non-negative floating point number", - "type": "string", - "pattern": "^[0-9]*[.]?[0-9]+([eE][-+]?[0-9]+)?$" -} diff --git a/src/common/schemas/objects/x-address.json b/src/common/schemas/objects/x-address.json deleted file mode 100644 index 717c4fd6..00000000 --- a/src/common/schemas/objects/x-address.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "xAddress", - "description": "An XRP Ledger address in X-address format", - "type": "string", - "format": "xAddress", - "link": "x-address", - "pattern": "^[XT][1-9A-HJ-NP-Za-km-z]{46}$" -} diff --git a/src/common/schemas/output/generate-address.json b/src/common/schemas/output/generate-address.json deleted file mode 100644 index b0858032..00000000 --- a/src/common/schemas/output/generate-address.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "generateAddress", - "type": "object", - "properties": { - "xAddress": { - "$ref": "xAddress", - "description": "A randomly generated XRP Ledger address in X-address format." - }, - "classicAddress": { - "$ref": "classicAddress", - "description": "A randomly generated XRP Ledger Account ID (classic address)." - }, - "address": { - "$ref": "classicAddress", - "description": "Deprecated: Use `classicAddress` instead." - }, - "secret": { - "type": "string", - "format": "secret", - "description": "The secret corresponding to the address." - } - }, - "required": ["xAddress", "classicAddress", "address", "secret"], - "additionalProperties": false -} diff --git a/src/common/schemas/output/generate-x-address.json b/src/common/schemas/output/generate-x-address.json deleted file mode 100644 index c0326436..00000000 --- a/src/common/schemas/output/generate-x-address.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "generateXAddress", - "type": "object", - "properties": { - "xAddress": { - "$ref": "xAddress", - "description": "A randomly generated XRP Ledger address in X-address format." - }, - "secret": { - "type": "string", - "format": "secret", - "description": "The secret corresponding to the address." - } - }, - "required": ["xAddress", "secret"], - "additionalProperties": false -} diff --git a/src/common/schemas/output/get-account-info.json b/src/common/schemas/output/get-account-info.json deleted file mode 100644 index 400d6116..00000000 --- a/src/common/schemas/output/get-account-info.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getAccountInfo", - "type": "object", - "properties": { - "sequence": { - "$ref": "sequence", - "description": "The next (smallest unused) sequence number for this account." - }, - "xrpBalance": { - "$ref": "value", - "description": "The XRP balance owned by the account." - }, - "ownerCount": { - "type": "integer", - "minimum": 0, - "description": "Number of other ledger entries (specifically, trust lines and offers) attributed to this account. This is used to calculate the total reserve required to use the account." - }, - "previousInitiatedTransactionID": { - "$ref": "hash256", - "description": "Hash value representing the most recent transaction that was initiated by this account." - }, - "previousAffectingTransactionID": { - "$ref": "hash256", - "description": "Hash value representing the most recent transaction that affected this account node directly. **Note:** This does not include changes to the account’s trust lines and offers." - }, - "previousAffectingTransactionLedgerVersion": { - "$ref": "ledgerVersion", - "description": "The ledger version that the transaction identified by the `previousAffectingTransactionID` was validated in." - } - }, - "required": [ - "sequence", - "xrpBalance", - "ownerCount", - "previousAffectingTransactionID", - "previousAffectingTransactionLedgerVersion" - ], - "additionalProperties": false -} diff --git a/src/common/schemas/output/get-account-objects.json b/src/common/schemas/output/get-account-objects.json deleted file mode 100644 index 37e6c826..00000000 --- a/src/common/schemas/output/get-account-objects.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "AccountObjectsResponse", - "description": "Response format for account_objects", - "type": "object", - "properties": { - "account": { - "$ref": "address", - "description": - "Unique address of the account this request corresponds to." - }, - "account_objects": { - "type": "array", - "items": { - "type": "object" - }, - "description": - "Array of objects owned by this account. Each object is in its raw ledger format." - }, - "ledger_hash": { - "type": "string", - "description": - "(May be omitted) The identifying hash of the ledger that was used to generate this response." - }, - "ledger_index": { - "$ref": "ledgerVersion", - "description": - "(May be omitted) The sequence number of the ledger that was used to generate this response." - }, - "ledger_current_index": { - "$ref": "ledgerVersion", - "description": - "(May be omitted) The sequence number of the ledger that was used to generate this response." - }, - "limit": { - "type": "integer", - "description": - "(May be omitted) The limit that was used in this request, if any." - }, - "validated": { - "type": "boolean", - "description": - "If included and set to true, the information in this request comes from a validated ledger version. Otherwise, the information is subject to change." - } - }, - "required": ["account", "account_objects"], - "additionalProperties": false -} diff --git a/src/common/schemas/output/get-balance-sheet.json b/src/common/schemas/output/get-balance-sheet.json deleted file mode 100644 index 12a0f5b0..00000000 --- a/src/common/schemas/output/get-balance-sheet.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getBalanceSheet", - "description": "getBalanceSheet response", - "type": "object", - "properties": { - "balances": { - "type": "array", - "items": {"$ref": "amount"}, - "description": "Amounts issued to the \"hotwallet\" accounts from the request. The keys are the accounts' addresses, and the values are arrays of currency amounts they hold. The issuer (omitted from the currency amounts) is the account from the request." - }, - "assets": { - "type": "array", - "items": {"$ref": "amount"}, - "description": "Total amounts held that are issued by others. For the recommended gateway configuration, there should be none." - }, - "obligations": { - "type": "array", - "items": { - "type": "object", - "required": ["currency", "value"], - "additionalProperties": false, - "properties": { - "currency": {"$ref": "currency"}, - "value": {"$ref": "value"} - }, - "description": "An amount that is owed." - }, - "description": "Total amounts issued to accounts that are not hot wallets, as a map of currencies to the total value issued." - } - }, - "additionalProperties": false -} diff --git a/src/common/schemas/output/get-balances.json b/src/common/schemas/output/get-balances.json deleted file mode 100644 index 7ee93ebd..00000000 --- a/src/common/schemas/output/get-balances.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getBalances", - "type": "array", - "items": {"$ref": "balance"} -} diff --git a/src/common/schemas/output/get-ledger.json b/src/common/schemas/output/get-ledger.json deleted file mode 100644 index ae25af31..00000000 --- a/src/common/schemas/output/get-ledger.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getLedger", - "type": "object", - "properties": { - "stateHash": { - "$ref": "hash256", - "description": "Hash of all state information in this ledger." - }, - "closeTime": { - "type": "string", - "format": "date-time", - "description": "The approximate time when this ledger was closed. This number is rounded based on the `closeTimeResolution`. If it would have been rounded to the same time as a previous ledger, the close time is recorded as 1 second later instead." - }, - "closeTimeResolution": { - "type": "integer", - "minimum": 1, - "description": "A number of seconds, indicating how much the `closeTime` could be rounded. Ledger close times are approximate so that small differences in servers clocks don't hinder consensus." - }, - "closeFlags": { - "type": "integer", - "minimum": 0, - "description": "A bit-map of flags relating to the closing of this ledger. Currently, the ledger has only one flag defined for `closeFlags`: **sLCF_NoConsensusTime** (value 1). If this flag is enabled, it means that validators disagreed on the correct close time for the ledger, but built otherwise the same ledger, so they declared consensus while \"agreeing to disagree\" on the close time. In this case, the consensus ledger contains a `closeTime` value that is 1 second after that of the previous ledger. (In this case, there is no official close time, but the actual real-world close time is probably 3-6 seconds later than the specified `closeTime`.)" - }, - "ledgerHash": { - "$ref": "hash256", - "description": "Unique identifying hash of the entire ledger." - }, - "ledgerVersion": { - "$ref": "ledgerVersion", - "description": "The ledger version of this ledger." - }, - "parentLedgerHash": { - "$ref": "hash256", - "description": "Unique identifying hash of the ledger that came immediately before this one." - }, - "parentCloseTime": { - "type": "string", - "format": "date-time", - "description": "The previous ledger's recorded close time." - }, - "totalDrops": { - "$ref": "value", - "description": "Total number of drops (1/1,000,000th of an XRP) in the network, as a quoted integer. (This decreases as transaction fees cause XRP to be destroyed.)" - }, - "transactionHash": { - "$ref": "hash256", - "description": "Hash of the transaction information included in this ledger." - }, - "transactions": { - "description": "Array of all transactions that were validated in this ledger. Transactions are represented in the same format as the return value of [getTransaction](#gettransaction).", - "type": "array", - "items": { - "$ref": "getTransaction", - "description": "A transaction in the same format as the return value of [getTransaction](#gettransaction)." - } - }, - "transactionHashes": { - "description": "An array of hashes of all transactions that were validated in this ledger.", - "type": "array", - "items": { - "$ref": "transactionHash" - } - }, - "rawState": { - "type": "string", - "description": "A JSON string containing all state data for this ledger in rippled JSON format." - }, - "stateHashes": { - "description": "An array of hashes of all state data in this ledger.", - "type": "array", - "items": { - "$ref": "hash256" - } - } - }, - "required": [ - "stateHash", - "closeTime", - "closeTimeResolution", - "closeFlags", - "ledgerHash", - "ledgerVersion", - "parentLedgerHash", - "parentCloseTime", - "totalDrops", - "transactionHash" - ], - "additionalProperties": false -} diff --git a/src/common/schemas/output/get-orderbook.json b/src/common/schemas/output/get-orderbook.json deleted file mode 100644 index 2727d78c..00000000 --- a/src/common/schemas/output/get-orderbook.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getOrderbook", - "type": "object", - "properties": { - "bids": { - "$ref": "orderbookOrders", - "description": "The buy orders in the order book." - }, - "asks": { - "$ref": "orderbookOrders", - "description": "The sell orders in the order book." - } - }, - "required": ["bids", "asks"], - "additionalProperties": false -} diff --git a/src/common/schemas/output/get-orders.json b/src/common/schemas/output/get-orders.json deleted file mode 100644 index 2e345470..00000000 --- a/src/common/schemas/output/get-orders.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getOrders", - "type": "array", - "items": { - "type": "object", - "properties": { - "specification": { - "$ref": "order", - "description": "An order specification that would create an order equivalent to the current state of this order." - }, - "properties": { - "description": "Properties of the order not in the specification.", - "type": "object", - "properties": { - "maker": { - "$ref": "address", - "description": "The address of the account that submitted the order." - }, - "sequence": { - "$ref": "sequence", - "description": "The account sequence number of the transaction that created this order." - }, - "makerExchangeRate": { - "$ref": "value", - "description": "The exchange rate from the point of view of the account that submitted the order (also known as \"quality\")." - } - }, - "required": ["maker", "sequence", "makerExchangeRate"], - "addtionalProperties": false - } - }, - "required": ["specification", "properties"], - "additionalProperties": false - } -} diff --git a/src/common/schemas/output/get-paths.json b/src/common/schemas/output/get-paths.json deleted file mode 100644 index f72a8d7e..00000000 --- a/src/common/schemas/output/get-paths.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getPaths", - "type": "array", - "items": { - "type": "object", - "properties": { - "source": { - "$ref": "sourceAdjustment", - "description": "Properties of the source of the payment." - }, - "destination": { - "$ref": "destinationAdjustment", - "description": "Properties of the destination of the payment." - }, - "paths": { - "type": "string", - "description": "The paths of trustlines and orders to use in executing the payment." - } - }, - "required": ["source", "destination", "paths"], - "additionalProperties": false - } -} diff --git a/src/common/schemas/output/get-payment-channel.json b/src/common/schemas/output/get-payment-channel.json deleted file mode 100644 index 56666b0a..00000000 --- a/src/common/schemas/output/get-payment-channel.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getPaymentChannel", - "type": "object", - "properties": { - "account": { - "$ref": "address", - "description": "Address that created the payment channel." - }, - "destination": { - "$ref": "address", - "description": "Address to receive XRP claims against this channel." - }, - "amount": { - "$ref": "value", - "description": "The total amount of XRP funded in this channel." - }, - "balance": { - "$ref": "value", - "description": "The total amount of XRP delivered by this channel." - }, - "settleDelay": { - "type": "number", - "description": "Amount of seconds the source address must wait before closing the channel if it has unclaimed XRP." - }, - "expiration": { - "type": "string", - "format": "date-time", - "description": "Time when this channel expires." - }, - "publicKey": { - "$ref": "publicKey", - "description": "Public key of the key pair the source uses to sign claims against this channel." - }, - "cancelAfter": { - "type": "string", - "format": "date-time", - "description": "Time when this channel expires as specified at creation." - }, - "sourceTag": { - "$ref": "tag", - "description": "Source tag." - }, - "destinationTag": { - "$ref": "tag", - "description": "Destination tag." - }, - "previousAffectingTransactionID": { - "$ref": "hash256", - "description": "Hash value representing the most recent transaction that affected this payment channel." - }, - "previousAffectingTransactionLedgerVersion": { - "$ref": "ledgerVersion", - "description": "The ledger version that the transaction identified by the `previousAffectingTransactionID` was validated in." - } - }, - "required": [ - "account", - "destination", - "amount", - "balance", - "settleDelay", - "previousAffectingTransactionID", - "previousAffectingTransactionLedgerVersion" - ], - "additionalProperties": false -} diff --git a/src/common/schemas/output/get-server-info.json b/src/common/schemas/output/get-server-info.json deleted file mode 100644 index 45240a4f..00000000 --- a/src/common/schemas/output/get-server-info.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getServerInfo", - "type": "object", - "properties": { - "buildVersion": { - "type": "string", - "description": "The version number of the running rippled version." - }, - "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, in milliseconds. If this number is not very, very low, then the rippled server is probably having serious load issues." - }, - "load": { - "type": "object", - "description": "*(Admin only)* Detailed information about the current load state of the server.", - "properties": { - "jobTypes": { - "type": "array", - "description": "*(Admin only)* Information about the rate of different types of jobs the server is doing and how much time it spends on each.", - "items": {"type": "object"} - }, - "threads": { - "type": "number", - "description": "*(Admin only)* The number of threads in the server’s main job pool, performing various operations." - } - }, - "required": ["jobTypes", "threads"] - }, - "lastClose": { - "type": "object", - "description": "Information about the last time the server closed a ledger.", - "properties": { - "convergeTimeS": { - "type": "number", - "description": "The time it took to reach a consensus for the last ledger closing, in seconds." - }, - "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." - }, - "pubkeyValidator": { - "type": "string", - "description": "*(Admin only)* Public key used by this node to sign ledger validations." - }, - "serverState": { - "type": "string", - "description": "A string indicating to what extent the server is participating in the network. See [Possible Server States](https://xrpl.org/rippled-server-states.html) for more details.", - "enum": ["disconnected", "connected", "syncing", "tracking", "full", "validating", "proposing"] - }, - "validatedLedger": { - "type": "object", - "description": "Information about the fully-validated ledger with the highest sequence number (the most recent).", - "properties": { - "age": { - "type": "integer", - "minimum": 0, - "description": "The time since the ledger was closed, in seconds." - }, - "baseFeeXRP": { - "$ref": "value", - "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 an uppercase hexadecimal string." - }, - "reserveBaseXRP": { - "$ref": "value", - "description": "Minimum amount of XRP necessary for every account to keep in reserve." - }, - "reserveIncrementXRP": { - "$ref": "value", - "description": "Amount of XRP added to the account reserve for each object an account owns in the ledger." - }, - "ledgerVersion": { - "type": "integer", - "minimum": 0, - "description": "Identifying ledger index of this ledger version." - } - }, - "additionalProperties": false, - "required": ["age", "baseFeeXRP", "hash", "reserveBaseXRP", "reserveIncrementXRP", "ledgerVersion"] - }, - "validationQuorum": { - "type": "number", - "description": "Minimum number of trusted validations required to validate a ledger version. Some circumstances may cause the server to require more validations." - } - }, - "required": ["buildVersion", "completeLedgers", "hostID", "ioLatencyMs", "lastClose", "loadFactor", "peers", "pubkeyNode", "serverState", "validatedLedger", "validationQuorum"], - "additionalProperties": false -} diff --git a/src/common/schemas/output/get-settings.json b/src/common/schemas/output/get-settings.json deleted file mode 100644 index 85fb38a1..00000000 --- a/src/common/schemas/output/get-settings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getSettings", - "$ref": "settingsPlusMemos", - "not": { - "required": ["memos"] - } -} diff --git a/src/common/schemas/output/get-transaction.json b/src/common/schemas/output/get-transaction.json deleted file mode 100644 index 150b3558..00000000 --- a/src/common/schemas/output/get-transaction.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getTransaction", - "description": "getTransaction response", - "link": "gettransaction", - "properties": { - "type": { - "$ref": "transactionType" - }, - "specification": { - "description": "A specification that would produce the same outcome as this transaction. *Exception:* For payment transactions, this omits the `destination.amount` field, to prevent misunderstanding. The structure of the specification depends on the value of the `type` field (see [Transaction Types](#transaction-types) for details). *Note:* This is **not** necessarily the same as the original specification." - }, - "outcome": { - "$ref": "outcome", - "description": "The outcome of the transaction (what effects it had)." - }, - "id": { - "$ref": "transactionHash", - "description": "A hash of the transaction that can be used to identify it." - }, - "address": { - "$ref": "address", - "description": "The address of the account that initiated the transaction." - }, - "sequence": { - "$ref": "sequence", - "description": "The account sequence number of the transaction for the account that initiated it." - }, - "rawTransaction": { - "description": "The raw transaction data as a JSON string. For advanced users only; exercise caution when interpreting this data.", - "type": "string" - } - }, - "required": [ - "id", - "address", - "sequence", - "type", - "specification", - "outcome" - ], - "additionalProperties": false, - "oneOf": [ - { - "properties": { - "type": { - "enum": [ - "payment" - ] - }, - "specification": { - "$ref": "getPayment" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "order" - ] - }, - "specification": { - "$ref": "order" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "orderCancellation" - ] - }, - "specification": { - "$ref": "orderCancellation" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "trustline" - ] - }, - "specification": { - "$ref": "trustline" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "settings" - ] - }, - "specification": { - "$ref": "getSettings" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "checkCreate" - ] - }, - "specification": { - "$ref": "checkCreate" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "checkCancel" - ] - }, - "specification": { - "$ref": "checkCancel" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "checkCash" - ] - }, - "specification": { - "$ref": "checkCash" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "escrowCreation" - ] - }, - "specification": { - "$ref": "escrowCreation" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "escrowCancellation" - ] - }, - "specification": { - "$ref": "escrowCancellation" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "escrowExecution" - ] - }, - "specification": { - "$ref": "escrowExecution" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "paymentChannelCreate" - ] - }, - "specification": { - "$ref": "paymentChannelCreate" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "paymentChannelFund" - ] - }, - "specification": { - "$ref": "paymentChannelFund" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "paymentChannelClaim" - ] - }, - "specification": { - "$ref": "paymentChannelClaim" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "depositPreauth" - ] - }, - "specification": { - "$ref": "depositPreauth" - } - } - }, - { - "properties": { - "type": { - "enum": [ - "accountDelete" - ] - }, - "specification": { - "$ref": "accountDelete" - } - } - } - ] -} diff --git a/src/common/schemas/output/get-transactions.json b/src/common/schemas/output/get-transactions.json deleted file mode 100644 index f0a3ab79..00000000 --- a/src/common/schemas/output/get-transactions.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getTransactions", - "type": "array", - "items": { - "$ref": "getTransaction" - } -} diff --git a/src/common/schemas/output/get-trustlines.json b/src/common/schemas/output/get-trustlines.json deleted file mode 100644 index b586998c..00000000 --- a/src/common/schemas/output/get-trustlines.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getTrustlines", - "type": "array", - "items": { - "properties": { - "specification": { - "$ref": "trustline", - "description": "A trust line specification that would produce this trust line in its current state." - }, - "counterparty": { - "properties": { - "limit": { - "$ref": "value", - "description": "The maximum amount that the counterparty can be owed through the trust line." - }, - "ripplingDisabled": { - "type": "boolean", - "description": "If true, payments cannot ripple through this trustline." - }, - "frozen": { - "type": "boolean", - "description": "If true, the trust line is frozen, which means that funds can only be sent directly to the counterparty." - }, - "authorized": { - "type": "boolean", - "description": "If true, the counterparty authorizes this party to hold issuances from the counterparty." - } - }, - "description": "Properties of the trustline from the perspective of the counterparty.", - "required": ["limit"], - "additionalProperties": false - }, - "state": { - "properties": { - "balance": { - "$ref": "signedValue", - "description": "The balance on the trust line, representing which party owes the other and by how much." - } - }, - "description": "Non-settings details of the trust line's state.", - "required": ["balance"], - "additionalProperties": false - } - }, - "required": ["specification", "counterparty", "state"], - "additionalProperties": false - } -} diff --git a/src/common/schemas/output/ledger-event.json b/src/common/schemas/output/ledger-event.json deleted file mode 100644 index 6b74e981..00000000 --- a/src/common/schemas/output/ledger-event.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "ledgerEvent", - "description": "A ledger event message", - "type": "object", - "properties": { - "baseFeeXRP": { - "$ref": "value", - "description": "Base fee, in XRP." - }, - "ledgerHash": { - "$ref": "hash256", - "description": "Unique hash of the ledger that was closed, as hex." - }, - "ledgerVersion": { - "$ref": "ledgerVersion", - "description": "Ledger version of the ledger that closed." - }, - "ledgerTimestamp": { - "type": "string", - "format": "date-time", - "description": "The time at which this ledger closed." - }, - "reserveBaseXRP": { - "$ref": "value", - "description": "The minimum reserve, in XRP, that is required for an account." - }, - "reserveIncrementXRP": { - "$ref": "value", - "description": "The increase in account reserve that is added for each item the account owns, such as offers or trust lines." - }, - "transactionCount": { - "type": "integer", - "minimum": 0, - "description": "Number of new transactions included in this ledger." - }, - "validatedLedgerVersions": { - "type": "string", - "description": "Range of ledgers that the server has available. This may be discontiguous." - } - }, - "addtionalProperties": false, - "required": ["baseFeeXRP", "ledgerHash", "ledgerTimestamp", - "reserveBaseXRP", "reserveIncrementXRP", "transactionCount", - "ledgerVersion", "validatedLedgerVersions"] -} diff --git a/src/common/schemas/output/order-change.json b/src/common/schemas/output/order-change.json deleted file mode 100644 index 9e52eb87..00000000 --- a/src/common/schemas/output/order-change.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "orderChange", - "type": "object", - "description": "A change to an order.", - "properties": { - "direction": { - "type": "string", - "enum": ["buy", "sell"], - "description": "Equal to \"buy\" for buy orders and \"sell\" for sell orders." - }, - "quantity": { - "$ref": "amount", - "description": "The amount to be bought or sold by the maker." - }, - "totalPrice": { - "$ref": "amount", - "description": "The total amount to be paid or received by the taker." - }, - "makerExchangeRate": { - "$ref": "value", - "description": "The exchange rate between the `quantity` currency and the `totalPrice` currency from the point of view of the maker." - }, - "sequence": { - "$ref": "sequence", - "description": "The order sequence number, used to identify the order for cancellation" - }, - "status": { - "enum": ["created", "filled", "partially-filled", "cancelled"], - "description": "The status of the order. One of \"created\", \"filled\", \"partially-filled\", \"cancelled\"." - }, - "expirationTime": { - "type": "string", - "format": "date-time", - "description": "The time after which the order expires, if any." - } - }, - "required": ["direction", "quantity", "totalPrice", "sequence", "status"], - "additionalProperties": false -} diff --git a/src/common/schemas/output/orderbook-orders.json b/src/common/schemas/output/orderbook-orders.json deleted file mode 100644 index 00e1a2aa..00000000 --- a/src/common/schemas/output/orderbook-orders.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "orderbookOrders", - "type": "array", - "items": { - "description": "An order in the order book.", - "type": "object", - "properties": { - "specification": { - "$ref": "order", - "description": "An order specification that would create an order equivalent to the current state of this order." - }, - "properties": { - "description": "Properties of the order not in the specification.", - "type": "object", - "properties": { - "maker": { - "$ref": "address", - "description": "The address of the account that submitted the order." - }, - "sequence": { - "$ref": "sequence", - "description": "The account sequence number of the transaction that created this order." - }, - "makerExchangeRate": { - "$ref": "value", - "description": "The exchange rate from the point of view of the account that submitted the order (also known as \"quality\")." - } - }, - "required": ["maker", "sequence", "makerExchangeRate"], - "addtionalProperties": false - }, - "state": { - "description": "The state of the order.", - "type": "object", - "properties": { - "fundedAmount": { - "$ref": "amount", - "description": "How much of the amount the maker would have to pay that the maker currently holds." - }, - "priceOfFundedAmount": { - "$ref": "amount", - "description": "How much the `fundedAmount` would convert to through the exchange rate of this order." - } - }, - "required": ["fundedAmount", "priceOfFundedAmount"], - "additionalProperties": false - }, - "data": { - "description": "The raw order data. This may include `owner_funds`, `Flags`, and other fields.", - "type": "object", - "additionalProperties": true - } - }, - "required": ["specification", "properties", "data"], - "additionalProperties": false - } -} diff --git a/src/common/schemas/output/outcome.json b/src/common/schemas/output/outcome.json deleted file mode 100644 index 249e4199..00000000 --- a/src/common/schemas/output/outcome.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "outcome", - "type": "object", - "description": "The outcome of the transaction (what effects it had).", - "properties": { - "result": { - "type": "string", - "description": "Result code returned by rippled. See [Transaction Results](https://xrpl.org/transaction-results.html) for a complete list." - }, - "timestamp": { - "type": "string", - "format": "date-time", - "description": "The timestamp when the transaction was validated. (May be missing when requesting transactions in binary mode.)" - }, - "fee": { - "$ref": "value", - "description": "The XRP fee that was charged for the transaction." - }, - "deliveredAmount": { - "$ref": "amount", - "description": "For payment transactions, it is impossible to reliably compute the actual delivered amount from the balanceChanges due to fixed precision. If the payment is not a partial payment and the transaction succeeded, the deliveredAmount should always be considered to be the amount specified in the transaction." - }, - "balanceChanges": { - "type": "object", - "additionalProperties": { - "type": "array", - "description": "Key is the XRP Ledger address; value is an array of signed amounts representing changes of balances for that address.", - "items": {"$ref": "balance"} - } - }, - "orderbookChanges": { - "type": "object", - "additionalProperties": { - "type": "array", - "description": "Key is the maker's XRP Ledger address; value is an array of changes", - "items": {"$ref": "orderChange"} - } - }, - "channelChanges": { - "type": "object", - "description": "Properties reflecting the details of the payment channel." - }, - "ledgerVersion": { - "$ref": "ledgerVersion", - "description": "The ledger version that the transaction was validated in." - }, - "indexInLedger": { - "type": "integer", - "minimum": 0, - "description": "The ordering index of the transaction in the ledger." - } - }, - "required": ["result", "fee", "balanceChanges", - "orderbookChanges", "ledgerVersion", "indexInLedger"], - "additionalProperties": false -} diff --git a/src/common/schemas/output/prepare.json b/src/common/schemas/output/prepare.json deleted file mode 100644 index 97202b24..00000000 --- a/src/common/schemas/output/prepare.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "prepare", - "description": "Result of prepare function", - "type": "object", - "properties": { - "txJSON": { - "type": "string", - "description": "The prepared transaction in rippled JSON format." - }, - "instructions": { - "description": "The instructions for how to execute the transaction after adding automatic defaults.", - "type": "object", - "properties": { - "fee": { - "$ref": "value", - "description": "The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee is multiplied by (N+1), where N is the number of signatures you plan to provide." - }, - "sequence": { - "$ref": "sequence", - "description": "The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set." - }, - "ticketSequence": { - "$ref": "ticket-sequence", - "description": "The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set." - }, - "maxLedgerVersion": { - "oneOf": [ - {"$ref": "ledgerVersion"}, - {"type": "null"} - ], - "description": "The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'." - } - }, - "additionalProperties": false, - "required": ["fee", "maxLedgerVersion"], - "anyOf": [ - { "required": - [ "sequence" ] }, - { "required": - [ "ticketSequence" ] } - ] - } - }, - "additionalProperties": false, - "required": ["txJSON", "instructions"] -} diff --git a/src/common/schemas/output/sign-payment-channel-claim.json b/src/common/schemas/output/sign-payment-channel-claim.json deleted file mode 100644 index 96129db4..00000000 --- a/src/common/schemas/output/sign-payment-channel-claim.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "signPaymentChannelClaim", - "type": "string", - "$ref": "signature", - "additionalProperties": false -} diff --git a/src/common/schemas/output/sign.json b/src/common/schemas/output/sign.json deleted file mode 100644 index b62e94be..00000000 --- a/src/common/schemas/output/sign.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "sign", - "type": "object", - "properties": { - "signedTransaction": { - "type": "string", - "pattern": "^[A-F0-9]+$", - "description": "The signed transaction represented as an uppercase hexadecimal string." - }, - "id": { - "$ref": "transactionHash", - "description": "The [Transaction ID](#transaction-id) of the signed transaction." - } - }, - "required": ["signedTransaction", "id"], - "additionalProperties": false -} diff --git a/src/common/schemas/output/submit.json b/src/common/schemas/output/submit.json deleted file mode 100644 index afc13132..00000000 --- a/src/common/schemas/output/submit.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "submit", - "type": "object", - "properties": { - "resultCode": { - "type": "string", - "description": "Deprecated: Use `engine_result` instead." - }, - "resultMessage": { - "type": "string", - "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://xrpl.org/transaction-results.html)" - }, - "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-json", - "description": "The complete transaction in JSON format." - } - }, - "required": ["resultCode", "resultMessage", "engine_result", "engine_result_code", "engine_result_message", "tx_blob", "tx_json"], - "additionalProperties": false -} diff --git a/src/common/schemas/output/verify-payment-channel-claim.json b/src/common/schemas/output/verify-payment-channel-claim.json deleted file mode 100644 index 26309718..00000000 --- a/src/common/schemas/output/verify-payment-channel-claim.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "verifyPaymentChannelClaim", - "type": "boolean", - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/account-delete.json b/src/common/schemas/specifications/account-delete.json deleted file mode 100644 index 6327da9b..00000000 --- a/src/common/schemas/specifications/account-delete.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "accountDelete", - "link": "account-delete", - "type": "object", - "properties": { - "destination": { - "$ref": "address", - "description": "Address of an account to receive any leftover XRP after deleting the sending account. Must be a funded account in the ledger, and must not be the sending account." - }, - "destinationTag": { - "$ref": "tag", - "description": "(Optional) Arbitrary destination tag that identifies a hosted recipient or other information for the recipient of the deleted account's leftover XRP." - }, - "destinationXAddress": { - "$ref": "address", - "description": "X-address of an account to receive any leftover XRP after deleting the sending account. Must be a funded account in the ledger, and must not be the sending account." - }, - "memos": {"$ref": "memos"} - }, - "anyOf": [ - { - "required": ["destination"] - }, - { - "required": ["destinationXAddress"] - } - ], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/check-cancel.json b/src/common/schemas/specifications/check-cancel.json deleted file mode 100644 index 676ce926..00000000 --- a/src/common/schemas/specifications/check-cancel.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "checkCancel", - "link": "check-cancel", - "type": "object", - "properties": { - "checkID": { - "$ref": "hash256", - "description": "The ID of the Check ledger object to cancel, as a 64-character hexadecimal string." - }, - "memos": {"$ref": "memos"} - }, - "required": ["checkID"], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/check-cash.json b/src/common/schemas/specifications/check-cash.json deleted file mode 100644 index 251e7a3d..00000000 --- a/src/common/schemas/specifications/check-cash.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "checkCash", - "link": "check-cash", - "type": "object", - "properties": { - "checkID": { - "$ref": "hash256", - "description": "The ID of the Check ledger object to cash, as a 64-character hexadecimal string." - }, - "amount": { - "$ref": "laxAmount", - "description": "Redeem the Check for exactly this amount, if possible. The currency must match that of the sendMax of the corresponding CheckCreate transaction. You must provide either this field or deliverMin." - }, - "deliverMin": { - "$ref": "laxAmount", - "description": "Redeem the Check for at least this amount and for as much as possible. The currency must match that of the sendMax of the corresponding CheckCreate transaction. You must provide either this field or amount." - }, - "memos": {"$ref": "memos"} - }, - "required": ["checkID"], - "oneOf": [ - {"required": ["amount"]}, - {"required": ["deliverMin"]} - ], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/check-create.json b/src/common/schemas/specifications/check-create.json deleted file mode 100644 index cf7cee2d..00000000 --- a/src/common/schemas/specifications/check-create.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "checkCreate", - "link": "check-create", - "type": "object", - "properties": { - "destination": { - "$ref": "address", - "description": "Address of the account that can cash the check." - }, - "sendMax": { - "$ref": "laxAmount", - "description": "Amount of source currency the check is allowed to debit the sender, including transfer fees on non-XRP currencies." - }, - "destinationTag": { - "$ref": "tag", - "description": "Destination tag that identifies the reason for the check, or a hosted recipient to pay." - }, - "expiration": { - "type": "string", - "format": "date-time", - "description": "Time after which the check is no longer valid." - }, - "invoiceID": { - "$ref": "hash256", - "description": "256-bit hash, as a 64-character hexadecimal string, representing a specific reason or identifier for this check." - }, - "memos": {"$ref": "memos"} - }, - "required": ["destination", "sendMax"], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/deposit-preauth.json b/src/common/schemas/specifications/deposit-preauth.json deleted file mode 100644 index 8412fb0c..00000000 --- a/src/common/schemas/specifications/deposit-preauth.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "depositPreauth", - "link": "deposit-preauth", - "type": "object", - "properties": { - "authorize": { - "$ref": "address", - "description": "Address of the account that can cash the check." - }, - "unauthorize": { - "$ref": "address", - "description": "Address of the account that can cash the check." - }, - "memos": {"$ref": "memos"} - }, - "oneOf": [ - {"required": ["authorize"]}, - {"required": ["unauthorize"]} - ], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/escrow-cancellation.json b/src/common/schemas/specifications/escrow-cancellation.json deleted file mode 100644 index 96753f0c..00000000 --- a/src/common/schemas/specifications/escrow-cancellation.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "escrowCancellation", - "link": "escrow-cancellation", - "type": "object", - "properties": { - "memos": {"$ref": "memos"}, - "owner": { - "$ref": "address", - "description": "The address of the owner of the escrow to cancel." - }, - "escrowSequence": { - "$ref": "sequence", - "description": "The [account sequence number](#account-sequence-number) of the [Escrow Creation](#escrow-creation) transaction for the escrow to cancel." - } - }, - "required": ["owner", "escrowSequence"], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/escrow-creation.json b/src/common/schemas/specifications/escrow-creation.json deleted file mode 100644 index e78112d5..00000000 --- a/src/common/schemas/specifications/escrow-creation.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "escrowCreation", - "link": "escrow-creation", - "type": "object", - "properties": { - "amount": { - "$ref": "value", - "description": "Amount of XRP for sender to escrow." - }, - "destination": { - "$ref": "address", - "description": "Address to receive escrowed XRP." - }, - "memos": {"$ref": "memos"}, - "condition": { - "type": "string", - "description": "A hex value representing a [PREIMAGE-SHA-256 crypto-condition](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1). If present, `fulfillment` is required upon execution.", - "pattern": "^[A-F0-9]{0,256}$" - }, - "allowCancelAfter": { - "type": "string", - "format": "date-time", - "description": "If present, the escrow may be cancelled after this time." - }, - "allowExecuteAfter": { - "type": "string", - "format": "date-time", - "description": "If present, the escrow can not be executed before this time." - }, - "sourceTag": { - "$ref": "tag", - "description": "Source tag." - }, - "destinationTag": { - "$ref": "tag", - "description": "Destination tag." - } - }, - "required": ["amount", "destination"], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/escrow-execution.json b/src/common/schemas/specifications/escrow-execution.json deleted file mode 100644 index 18e72e06..00000000 --- a/src/common/schemas/specifications/escrow-execution.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "escrowExecution", - "link": "escrow-execution", - "type": "object", - "properties": { - "memos": {"$ref": "memos"}, - "owner": { - "$ref": "address", - "description": "The address of the owner of the escrow to execute." - }, - "escrowSequence": { - "$ref": "sequence", - "description": "The [account sequence number](#account-sequence-number) of the [Escrow Creation](#escrow-creation) transaction for the escrow to execute." - }, - "condition": { - "type": "string", - "description": "A hex value representing a [PREIMAGE-SHA-256 crypto-condition](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1). This must match the original `condition` from the escrow creation transaction.", - "pattern": "^[A-F0-9]{0,256}$" - }, - "fulfillment": { - "type": "string", - "description": "A hex value representing the [PREIMAGE-SHA-256 crypto-condition](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1) fulfillment for `condition`.", - "pattern": "^[A-F0-9]+$" - } - }, - "required": ["owner", "escrowSequence"], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/get-payment.json b/src/common/schemas/specifications/get-payment.json deleted file mode 100644 index 7acc4394..00000000 --- a/src/common/schemas/specifications/get-payment.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "getPayment", - "description": "A specification of a payment in a response for getTransaction or getTransactions.", - "type": "object", - "properties": { - "source": { - "$ref": "sourceAdjustment", - "description": "The source of the funds to be sent." - }, - "destination": { - "$ref": "destinationAddressTag", - "description": "The destination of the funds to be sent. Since this is a payment response, the amount is not shown here. For the amount that the transaction delivered, see `outcome.deliveredAmount`." - }, - "paths": { - "type": "string", - "description": "The paths of trustlines and orders to use in executing the payment." - }, - "memos": {"$ref": "memos"}, - "invoiceID": { - "description": "A 256-bit hash that can be used to identify a particular payment.", - "$ref": "hash256" - }, - "allowPartialPayment": { - "description": "If true, this payment can deliver less than the full amount.", - "type": "boolean" - }, - "noDirectRipple": { - "description": "If true and paths are specified, the sender would like the XRP Ledger to disregard any direct paths from the source account to the destination account. This may be used to take advantage of an arbitrage opportunity or by gateways wishing to issue balances from a hot wallet to a user who has mistakenly set a trustline directly to the hot wallet.", - "type": "boolean" - }, - "limitQuality": { - "description": "Only take paths where all the conversions have an input:output ratio that is equal or better than the ratio of destination.amount:source.maxAmount.", - "type": "boolean" - } - }, - "required": ["source", "destination"], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/order-cancellation.json b/src/common/schemas/specifications/order-cancellation.json deleted file mode 100644 index 0122a843..00000000 --- a/src/common/schemas/specifications/order-cancellation.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "orderCancellation", - "link": "order-cancellation", - "type": "object", - "properties": { - "orderSequence": { - "$ref": "sequence", - "description": "The [account sequence number](#account-sequence-number) of the order to cancel." - }, - "memos": {"$ref": "memos"} - }, - "required": ["orderSequence"], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/order.json b/src/common/schemas/specifications/order.json deleted file mode 100644 index f1a31498..00000000 --- a/src/common/schemas/specifications/order.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "order", - "link": "order", - "type": "object", - "properties": { - "direction": { - "type": "string", - "enum": ["buy", "sell"], - "description": "Equal to \"buy\" for buy orders and \"sell\" for sell orders." - }, - "quantity": { - "$ref": "amount", - "description": "The amount of currency to buy or sell." - }, - "totalPrice": { - "$ref": "amount", - "description": "The total price to be paid for the `quantity` to be bought or sold." - }, - "immediateOrCancel": { - "type": "boolean", - "description": "Treat the offer as an [Immediate or Cancel order](http://en.wikipedia.org/wiki/Immediate_or_cancel). If enabled, do not create an object in the ledger that can be matched later: instead, only execute as much as can be fulfilled immediately. This cannot be used with `fillOrKill`." - }, - "fillOrKill": { - "type": "boolean", - "description": "Treat the offer as a [Fill or Kill order](http://en.wikipedia.org/wiki/Fill_or_kill). Only attempt to match existing offers in the ledger, and only do so if the entire quantity can be exchanged. This cannot be used with `immediateOrCancel`." - }, - "passive": { - "description": "If enabled, the offer does not consume offers that exactly match it, and instead becomes an Offer node in the ledger. It still consumes offers that cross it.", - "type": "boolean" - }, - "expirationTime": { - "type": "string", - "format": "date-time", - "description": "Time after which the offer is no longer active, as an [ISO 8601 date-time](https://en.wikipedia.org/wiki/ISO_8601)." - }, - "orderToReplace": { - "$ref": "sequence", - "description": "The [account sequence number](#account-sequence-number) of an order to cancel before the new order is created, effectively replacing the old order." - }, - "memos": {"$ref": "memos"} - }, - "required": ["direction", "quantity", "totalPrice"], - "additionalProperties": false, - "not": { - "description": "immediateOrCancel and fillOrKill are mutually exclusive", - "required": ["immediateOrCancel", "fillOrKill"] - } -} diff --git a/src/common/schemas/specifications/payment-channel-claim.json b/src/common/schemas/specifications/payment-channel-claim.json deleted file mode 100644 index 197dd4ec..00000000 --- a/src/common/schemas/specifications/payment-channel-claim.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "paymentChannelClaim", - "link": "payment-channel-claim", - "type": "object", - "properties": { - "channel": { - "$ref": "hash256", - "description": "256-bit hexadecimal channel identifier." - }, - "amount": { - "$ref": "value", - "description": "Amount of XRP authorized by this signature." - }, - "balance": { - "$ref": "value", - "description": "Total XRP balance delivered by this channel after claim is processed." - }, - "signature": { - "$ref": "signature", - "description": "Signed claim authorizing withdrawal of XRP from the channel. (Required except from the channel's source address.)" - }, - "publicKey": { - "$ref": "publicKey", - "description": "Public key of the channel. (For verifying the signature.)" - }, - "renew": { - "type": "boolean", - "description": "Clear the channel's expiration time." - }, - "close": { - "type": "boolean", - "description": "Request to close the channel. If the channel has no XRP remaining or the destination address requests it, closes the channel immediately (returning unclaimed XRP to the source address). Otherwise, sets the channel to expire after settleDelay seconds have passed." - }, - "memos": {"$ref": "memos"} - }, - "required": ["channel"], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/payment-channel-create.json b/src/common/schemas/specifications/payment-channel-create.json deleted file mode 100644 index b7bc11d7..00000000 --- a/src/common/schemas/specifications/payment-channel-create.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "paymentChannelCreate", - "link": "payment-channel-create", - "type": "object", - "properties": { - "amount": { - "$ref": "value", - "description": "Amount of XRP for sender to set aside in this channel." - }, - "destination": { - "$ref": "address", - "description": "Address to receive XRP claims against this channel." - }, - "settleDelay": { - "type": "number", - "description": "Amount of seconds the source address must wait before closing the channel if it has unclaimed XRP." - }, - "publicKey": { - "$ref": "publicKey", - "description": "Public key of the key pair the source may use to sign claims against this channel." - }, - "cancelAfter": { - "type": "string", - "format": "date-time", - "description": "Time when this channel expires. This expiration cannot be changed after creating the channel." - }, - "sourceTag": { - "$ref": "tag", - "description": "Source tag." - }, - "destinationTag": { - "$ref": "tag", - "description": "Destination tag." - }, - "memos": {"$ref": "memos"} - }, - "required": ["amount", "destination", "settleDelay", "publicKey"], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/payment-channel-fund.json b/src/common/schemas/specifications/payment-channel-fund.json deleted file mode 100644 index 98da5abc..00000000 --- a/src/common/schemas/specifications/payment-channel-fund.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "paymentChannelFund", - "link": "payment-channel-fund", - "type": "object", - "properties": { - "amount": { - "$ref": "value", - "description": "Amount of XRP to fund the channel with." - }, - "channel": { - "$ref": "hash256", - "description": "256-bit hexadecimal channel identifier." - }, - "expiration": { - "type": "string", - "format": "date-time", - "description": "New expiration for this channel. (This does not change the cancelAfter expiration, if the channel has one.) Cannot move the expiration sooner than settleDelay seconds from time of the request." - }, - "memos": {"$ref": "memos"} - }, - "required": ["amount", "channel"], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/payment.json b/src/common/schemas/specifications/payment.json deleted file mode 100644 index d36dedba..00000000 --- a/src/common/schemas/specifications/payment.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "payment", - "link": "payment", - "type": "object", - "properties": { - "source": { - "$ref": "sourceAdjustment", - "description": "The source of the funds to be sent." - }, - "destination": { - "$ref": "destinationAdjustment", - "description": "The destination of the funds to be sent." - }, - "paths": { - "type": "string", - "description": "The paths of trustlines and orders to use in executing the payment." - }, - "memos": {"$ref": "memos"}, - "invoiceID": { - "description": "A 256-bit hash that can be used to identify a particular payment.", - "$ref": "hash256" - }, - "allowPartialPayment": { - "description": "If true, this payment can deliver less than the full amount.", - "type": "boolean" - }, - "noDirectRipple": { - "description": "If true and paths are specified, the sender would like the XRP Ledger to disregard any direct paths from the source account to the destination account. This may be used to take advantage of an arbitrage opportunity or by gateways wishing to issue balances from a hot wallet to a user who has mistakenly set a trustline directly to the hot wallet.", - "type": "boolean" - }, - "limitQuality": { - "description": "Only take paths where all the conversions have an input:output ratio that is equal or better than the ratio of destination.amount:source.maxAmount.", - "type": "boolean" - } - }, - "required": ["source", "destination"], - "additionalProperties": false -} diff --git a/src/common/schemas/specifications/settings.json b/src/common/schemas/specifications/settings.json deleted file mode 100644 index 85442955..00000000 --- a/src/common/schemas/specifications/settings.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "settings", - "link": "settings", - "$ref": "settingsPlusMemos", - "oneOf": [ - { - "required": ["memos"], - "minProperties": 2, - "maxProperties": 2 - }, - { - "not": { - "required": ["memos"] - }, - "minProperties": 1, - "maxProperties": 1 - } - ] -} diff --git a/src/common/schemas/specifications/trustline.json b/src/common/schemas/specifications/trustline.json deleted file mode 100644 index 92bb8ebb..00000000 --- a/src/common/schemas/specifications/trustline.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "trustline", - "link": "trustline", - "type": "object", - "properties": { - "currency": { - "$ref": "currency", - "description": "The currency this trustline applies to." - }, - "counterparty": { - "$ref": "address", - "description": "The address of the account this trustline extends trust to." - }, - "limit": { - "$ref": "value", - "description": "The maximum amount that the owner of the trustline can be owed through the trustline." - }, - "qualityIn": { - "$ref": "quality", - "description": "Incoming balances on this trustline are valued at this ratio." - }, - "qualityOut": { - "$ref": "quality", - "description": "Outgoing balances on this trustline are valued at this ratio." - }, - "ripplingDisabled": { - "type": "boolean", - "description": "If true, payments cannot ripple through this trustline." - }, - "authorized": { - "type": "boolean", - "description": "If true, authorize the counterparty to hold issuances from this account." - }, - "frozen": { - "type": "boolean", - "description": "If true, the trustline is frozen, which means that funds can only be sent to the owner." - }, - "memos": {"$ref": "memos"} - }, - "required": ["currency", "counterparty", "limit"], - "additionalProperties": false -} diff --git a/src/common/validate.ts b/src/common/validate.ts deleted file mode 100644 index 7c97e422..00000000 --- a/src/common/validate.ts +++ /dev/null @@ -1,174 +0,0 @@ -import _ from "lodash"; - -import { ValidationError } from "./errors"; -import { schemaValidate } from "./schema-validator"; - -function error(text) { - return new ValidationError(text); -} - -function validateLedgerRange(options) { - if ( - options != null && - options.minLedgerVersion != null && - options.maxLedgerVersion != null - ) { - if (Number(options.minLedgerVersion) > Number(options.maxLedgerVersion)) { - throw error("minLedgerVersion must not be greater than maxLedgerVersion"); - } - } -} - -function validateOptions(schema, instance) { - schemaValidate(schema, instance); - validateLedgerRange(instance.options); -} - -export const getPaths = _.partial(schemaValidate, "getPathsParameters"); - -export const getTransactions = _.partial( - validateOptions, - "getTransactionsParameters" -); - -export const getSettings = _.partial(validateOptions, "getSettingsParameters"); - -export const getAccountInfo = _.partial( - validateOptions, - "getAccountInfoParameters" -); - -export const getTrustlines = _.partial( - validateOptions, - "getTrustlinesParameters" -); - -export const getBalances = _.partial(validateOptions, "getBalancesParameters"); - -export const getBalanceSheet = _.partial( - validateOptions, - "getBalanceSheetParameters" -); - -export const getOrders = _.partial(validateOptions, "getOrdersParameters"); - -export const getOrderbook = _.partial( - validateOptions, - "getOrderbookParameters" -); - -export const getTransaction = _.partial( - validateOptions, - "getTransactionParameters" -); - -export const getPaymentChannel = _.partial( - validateOptions, - "getPaymentChannelParameters" -); - -export const getLedger = _.partial(validateOptions, "getLedgerParameters"); - -export const preparePayment = _.partial( - schemaValidate, - "preparePaymentParameters" -); - -export const prepareOrder = _.partial(schemaValidate, "prepareOrderParameters"); - -export const prepareOrderCancellation = _.partial( - schemaValidate, - "prepareOrderCancellationParameters" -); - -export const prepareTrustline = _.partial( - schemaValidate, - "prepareTrustlineParameters" -); - -export const prepareSettings = _.partial( - schemaValidate, - "prepareSettingsParameters" -); - -export const prepareEscrowCreation = _.partial( - schemaValidate, - "prepareEscrowCreationParameters" -); - -export const prepareEscrowCancellation = _.partial( - schemaValidate, - "prepareEscrowCancellationParameters" -); - -export const prepareEscrowExecution = _.partial( - schemaValidate, - "prepareEscrowExecutionParameters" -); - -export const preparePaymentChannelCreate = _.partial( - schemaValidate, - "preparePaymentChannelCreateParameters" -); - -export const preparePaymentChannelFund = _.partial( - schemaValidate, - "preparePaymentChannelFundParameters" -); - -export const preparePaymentChannelClaim = _.partial( - schemaValidate, - "preparePaymentChannelClaimParameters" -); - -export const prepareCheckCreate = _.partial( - schemaValidate, - "prepareCheckCreateParameters" -); - -export const prepareCheckCash = _.partial( - schemaValidate, - "prepareCheckCashParameters" -); - -export const prepareCheckCancel = _.partial( - schemaValidate, - "prepareCheckCancelParameters" -); - -export const prepareTicketCreate = _.partial( - schemaValidate, - "prepareTicketParameters" -); - -export const sign = _.partial(schemaValidate, "signParameters"); - -export const combine = _.partial(schemaValidate, "combineParameters"); - -export const submit = _.partial(schemaValidate, "submitParameters"); - -export const computeLedgerHash = _.partial( - schemaValidate, - "computeLedgerHashParameters" -); - -export const generateAddress = _.partial( - schemaValidate, - "generateAddressParameters" -); - -export const signPaymentChannelClaim = _.partial( - schemaValidate, - "signPaymentChannelClaimParameters" -); - -export const verifyPaymentChannelClaim = _.partial( - schemaValidate, - "verifyPaymentChannelClaimParameters" -); - -export const apiOptions = _.partial(schemaValidate, "api-options"); - -export const instructions = _.partial(schemaValidate, "instructions"); - -export const tx_json = _.partial(schemaValidate, "tx-json"); diff --git a/src/ledger/balances.ts b/src/ledger/balances.ts index d36cf0ad..909c9852 100644 --- a/src/ledger/balances.ts +++ b/src/ledger/balances.ts @@ -1,6 +1,6 @@ import { Client } from ".."; import { Connection } from "../client"; -import { validate, ensureClassicAddress } from "../common"; +import { ensureClassicAddress } from "../common"; import { FormattedTrustline } from "../common/types/objects/trustlines"; import { GetTrustlinesOptions } from "./trustlines"; @@ -43,7 +43,7 @@ function formatBalances( return result; } -function getLedgerVersionHelper( +async function getLedgerVersionHelper( connection: Connection, optionValue?: number ): Promise { @@ -58,13 +58,11 @@ function getLedgerVersionHelper( .then((response) => response.result.ledger_index); } -function getBalances( +async function getBalances( this: Client, address: string, options: GetTrustlinesOptions = {} ): Promise { - validate.getTrustlines({ address, options }); - // Only support retrieving balances without a tag, // since we currently do not calculate balances // on a per-tag basis. Apps must interpret and @@ -74,7 +72,7 @@ function getBalances( return Promise.all([ getLedgerVersionHelper(this.connection, options.ledgerVersion).then( - (ledgerVersion) => utils.getXRPBalance(this, address, ledgerVersion) + async (ledgerVersion) => utils.getXRPBalance(this, address, ledgerVersion) ), this.getTrustlines(address, options), ]).then((results) => diff --git a/src/ledger/pathfind.ts b/src/ledger/pathfind.ts index 3347eb5a..a41f2922 100644 --- a/src/ledger/pathfind.ts +++ b/src/ledger/pathfind.ts @@ -3,7 +3,7 @@ import _ from "lodash"; import type { Client } from ".."; import { Connection } from "../client"; -import { validate, errors } from "../common"; +import { errors } from "../common"; import { RippledAmount, Amount } from "../common/types/objects"; import { RipplePathFindRequest } from "../models/methods"; import { toRippledAmount, xrpToDrops, dropsToXrp } from "../utils"; @@ -34,7 +34,7 @@ function addParams( ); } -function requestPathFind( +async function requestPathFind( connection: Connection, pathfind: PathFind ): Promise { @@ -110,7 +110,7 @@ function isRippledIOUAmount(amount: RippledAmount) { ); } -function conditionallyAddDirectXRPPath( +async function conditionallyAddDirectXRPPath( client: Client, address: string, paths: RippledPathsResponse @@ -191,12 +191,10 @@ function formatResponse(pathfind: PathFind, paths: RippledPathsResponse) { } } -function getPaths(this: Client, pathfind: PathFind): Promise { - validate.getPaths({ pathfind }); - +async function getPaths(this: Client, pathfind: PathFind): Promise { const address = pathfind.source.address; return requestPathFind(this.connection, pathfind) - .then((paths) => conditionallyAddDirectXRPPath(this, address, paths)) + .then(async (paths) => conditionallyAddDirectXRPPath(this, address, paths)) .then((paths) => filterSourceFundsLowPaths(pathfind, paths)) .then((paths) => formatResponse(pathfind, paths)); } diff --git a/src/ledger/trustlines.ts b/src/ledger/trustlines.ts index 00f21019..034c85d0 100644 --- a/src/ledger/trustlines.ts +++ b/src/ledger/trustlines.ts @@ -1,7 +1,7 @@ import _ from "lodash"; import type { Client } from ".."; -import { validate, ensureClassicAddress } from "../common"; +import { ensureClassicAddress } from "../common"; import { FormattedTrustline } from "../common/types/objects"; import parseAccountTrustline from "./parse/account-trustline"; @@ -25,9 +25,6 @@ async function getTrustlines( address: string, options: GetTrustlinesOptions = {} ): Promise { - // 1. Validate - validate.getTrustlines({ address, options }); - // Only support retrieving trustlines without a tag, // since it does not make sense to filter trustlines // by tag. diff --git a/src/transaction/check-cancel.ts b/src/transaction/check-cancel.ts index 223e47d5..9591160f 100644 --- a/src/transaction/check-cancel.ts +++ b/src/transaction/check-cancel.ts @@ -1,5 +1,4 @@ import { Client } from ".."; -import { validate } from "../common"; import { Instructions, Prepare, TransactionJSON } from "./types"; import { prepareTransaction } from "./utils"; @@ -21,16 +20,15 @@ function createCheckCancelTransaction( return txJSON; } -function prepareCheckCancel( +async function prepareCheckCancel( this: Client, address: string, checkCancel: CheckCancelParameters, instructions: Instructions = {} ): Promise { try { - validate.prepareCheckCancel({ address, checkCancel, instructions }); const txJSON = createCheckCancelTransaction(address, checkCancel); - return prepareTransaction(txJSON, this, instructions); + return await prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/check-cash.ts b/src/transaction/check-cash.ts index 33db67ca..1016d424 100644 --- a/src/transaction/check-cash.ts +++ b/src/transaction/check-cash.ts @@ -1,5 +1,4 @@ import { Client } from ".."; -import { validate } from "../common"; import { ValidationError } from "../common/errors"; import { Amount } from "../common/types/objects"; import { toRippledAmount } from "../utils"; @@ -41,16 +40,15 @@ function createCheckCashTransaction( return txJSON; } -function prepareCheckCash( +async function prepareCheckCash( this: Client, address: string, checkCash: CheckCashParameters, instructions: Instructions = {} ): Promise { try { - validate.prepareCheckCash({ address, checkCash, instructions }); const txJSON = createCheckCashTransaction(address, checkCash); - return utils.prepareTransaction(txJSON, this, instructions); + return await utils.prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/check-create.ts b/src/transaction/check-create.ts index 78dbe7d0..069560b7 100644 --- a/src/transaction/check-create.ts +++ b/src/transaction/check-create.ts @@ -1,5 +1,4 @@ import { Client } from ".."; -import { validate } from "../common"; import { Amount } from "../common/types/objects"; import { ISOTimeToRippleTime, toRippledAmount } from "../utils"; @@ -40,16 +39,15 @@ function createCheckCreateTransaction( return txJSON; } -function prepareCheckCreate( +async function prepareCheckCreate( this: Client, address: string, checkCreate: CheckCreateParameters, instructions: Instructions = {} ): Promise { try { - validate.prepareCheckCreate({ address, checkCreate, instructions }); const txJSON = createCheckCreateTransaction(address, checkCreate); - return utils.prepareTransaction(txJSON, this, instructions); + return await utils.prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/combine.ts b/src/transaction/combine.ts index 9be01079..5380c7f2 100644 --- a/src/transaction/combine.ts +++ b/src/transaction/combine.ts @@ -4,7 +4,6 @@ import { decodeAccountID } from "ripple-address-codec"; import binary from "ripple-binary-codec"; import { JsonObject } from "ripple-binary-codec/dist/types/serialized-type"; -import { validate } from "../common"; import { ValidationError } from "../common/errors"; import { computeBinaryTransactionHash } from "../utils/hashes"; @@ -68,8 +67,6 @@ function getTransactionWithAllSigners(transactions: JsonObject[]): JsonObject { * with a transaction id based on the combined transaction. */ function combine(signedTransactions: string[]): object { - validate.combine({ signedTransactions }); - const transactions: JsonObject[] = signedTransactions.map(binary.decode); validateTransactionEquivalence(transactions); diff --git a/src/transaction/escrow-cancellation.ts b/src/transaction/escrow-cancellation.ts index 4fa95e39..5e7bf0dd 100644 --- a/src/transaction/escrow-cancellation.ts +++ b/src/transaction/escrow-cancellation.ts @@ -4,8 +4,6 @@ import { Memo } from "../common/types/objects"; import { Instructions, Prepare, TransactionJSON } from "./types"; import * as utils from "./utils"; -const validate = utils.common.validate; - export interface EscrowCancellation { owner: string; escrowSequence: number; @@ -31,17 +29,12 @@ function createEscrowCancellationTransaction( return txJSON; } -function prepareEscrowCancellation( +async function prepareEscrowCancellation( this: Client, address: string, escrowCancellation: EscrowCancellation, instructions: Instructions = {} ): Promise { - validate.prepareEscrowCancellation({ - address, - escrowCancellation, - instructions, - }); const txJSON = createEscrowCancellationTransaction( address, escrowCancellation diff --git a/src/transaction/escrow-creation.ts b/src/transaction/escrow-creation.ts index 6fc03c28..65a71de7 100644 --- a/src/transaction/escrow-creation.ts +++ b/src/transaction/escrow-creation.ts @@ -1,5 +1,4 @@ import { Client } from ".."; -import { validate } from "../common"; import { Memo } from "../common/types/objects"; import { ISOTimeToRippleTime, xrpToDrops } from "../utils"; @@ -61,16 +60,15 @@ function createEscrowCreationTransaction( return txJSON; } -function prepareEscrowCreation( +async function prepareEscrowCreation( this: Client, address: string, escrowCreation: EscrowCreation, instructions: Instructions = {} ): Promise { try { - validate.prepareEscrowCreation({ address, escrowCreation, instructions }); const txJSON = createEscrowCreationTransaction(address, escrowCreation); - return utils.prepareTransaction(txJSON, this, instructions); + return await utils.prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/escrow-execution.ts b/src/transaction/escrow-execution.ts index 55df790f..db71452e 100644 --- a/src/transaction/escrow-execution.ts +++ b/src/transaction/escrow-execution.ts @@ -4,7 +4,6 @@ import { Memo } from "../common/types/objects"; import { Instructions, Prepare, TransactionJSON } from "./types"; import * as utils from "./utils"; -const validate = utils.common.validate; const ValidationError = utils.common.errors.ValidationError; export interface EscrowExecution { @@ -45,16 +44,15 @@ function createEscrowExecutionTransaction( return txJSON; } -function prepareEscrowExecution( +async function prepareEscrowExecution( this: Client, address: string, escrowExecution: EscrowExecution, instructions: Instructions = {} ): Promise { try { - validate.prepareEscrowExecution({ address, escrowExecution, instructions }); const txJSON = createEscrowExecutionTransaction(address, escrowExecution); - return utils.prepareTransaction(txJSON, this, instructions); + return await utils.prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/order.ts b/src/transaction/order.ts index 7972842c..c6c155b3 100644 --- a/src/transaction/order.ts +++ b/src/transaction/order.ts @@ -1,5 +1,4 @@ import { Client } from ".."; -import { validate } from "../common"; import { FormattedOrderSpecification } from "../common/types/objects/index"; import { ISOTimeToRippleTime, toRippledAmount } from "../utils"; @@ -51,16 +50,15 @@ function createOrderTransaction( return txJSON as OfferCreateTransaction; } -function prepareOrder( +async function prepareOrder( this: Client, address: string, order: FormattedOrderSpecification, instructions: Instructions = {} ): Promise { try { - validate.prepareOrder({ address, order, instructions }); const txJSON = createOrderTransaction(address, order); - return utils.prepareTransaction(txJSON, this, instructions); + return await utils.prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/ordercancellation.ts b/src/transaction/ordercancellation.ts index 0f7d38f4..2dce53bf 100644 --- a/src/transaction/ordercancellation.ts +++ b/src/transaction/ordercancellation.ts @@ -3,8 +3,6 @@ import { Client } from ".."; import { Instructions, Prepare, TransactionJSON } from "./types"; import * as utils from "./utils"; -const validate = utils.common.validate; - function createOrderCancellationTransaction( account: string, orderCancellation: any @@ -27,11 +25,6 @@ function prepareOrderCancellation( instructions: Instructions = {} ): Promise { try { - validate.prepareOrderCancellation({ - address, - orderCancellation, - instructions, - }); const txJSON = createOrderCancellationTransaction( address, orderCancellation diff --git a/src/transaction/payment-channel-claim.ts b/src/transaction/payment-channel-claim.ts index c61f8859..3acfb434 100644 --- a/src/transaction/payment-channel-claim.ts +++ b/src/transaction/payment-channel-claim.ts @@ -1,5 +1,4 @@ import { Client } from ".."; -import { validate } from "../common"; import { xrpToDrops } from "../utils"; import { Instructions, Prepare, TransactionJSON } from "./types"; @@ -68,23 +67,18 @@ function createPaymentChannelClaimTransaction( return txJSON; } -function preparePaymentChannelClaim( +async function preparePaymentChannelClaim( this: Client, address: string, paymentChannelClaim: PaymentChannelClaim, instructions: Instructions = {} ): Promise { try { - validate.preparePaymentChannelClaim({ - address, - paymentChannelClaim, - instructions, - }); const txJSON = createPaymentChannelClaimTransaction( address, paymentChannelClaim ); - return utils.prepareTransaction(txJSON, this, instructions); + return await utils.prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/payment-channel-create.ts b/src/transaction/payment-channel-create.ts index 6557e07e..fc384fef 100644 --- a/src/transaction/payment-channel-create.ts +++ b/src/transaction/payment-channel-create.ts @@ -1,5 +1,4 @@ import { Client } from ".."; -import { validate } from "../common"; import { ISOTimeToRippleTime, xrpToDrops } from "../utils"; import { Instructions, Prepare, TransactionJSON } from "./types"; @@ -41,23 +40,18 @@ function createPaymentChannelCreateTransaction( return txJSON; } -function preparePaymentChannelCreate( +async function preparePaymentChannelCreate( this: Client, address: string, paymentChannelCreate: PaymentChannelCreate, instructions: Instructions = {} ): Promise { try { - validate.preparePaymentChannelCreate({ - address, - paymentChannelCreate, - instructions, - }); const txJSON = createPaymentChannelCreateTransaction( address, paymentChannelCreate ); - return utils.prepareTransaction(txJSON, this, instructions); + return await utils.prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/payment-channel-fund.ts b/src/transaction/payment-channel-fund.ts index 1b68cafa..f2798ef0 100644 --- a/src/transaction/payment-channel-fund.ts +++ b/src/transaction/payment-channel-fund.ts @@ -1,5 +1,4 @@ import { Client } from ".."; -import { validate } from "../common"; import { ISOTimeToRippleTime, xrpToDrops } from "../utils"; import { Instructions, Prepare, TransactionJSON } from "./types"; @@ -29,23 +28,18 @@ function createPaymentChannelFundTransaction( return txJSON; } -function preparePaymentChannelFund( +async function preparePaymentChannelFund( this: Client, address: string, paymentChannelFund: PaymentChannelFund, instructions: Instructions = {} ): Promise { try { - validate.preparePaymentChannelFund({ - address, - paymentChannelFund, - instructions, - }); const txJSON = createPaymentChannelFundTransaction( address, paymentChannelFund ); - return utils.prepareTransaction(txJSON, this, instructions); + return await utils.prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/payment.ts b/src/transaction/payment.ts index 59338cbe..af034e94 100644 --- a/src/transaction/payment.ts +++ b/src/transaction/payment.ts @@ -14,7 +14,6 @@ import { Instructions, Prepare, TransactionJSON } from "./types"; import * as utils from "./utils"; import { getClassicAccountAndTag, ClassicAccountAndTag } from "./utils"; -const validate = utils.common.validate; const paymentFlags = utils.common.txFlags.Payment; const ValidationError = utils.common.errors.ValidationError; @@ -148,7 +147,6 @@ function createPaymentTransaction( address, undefined ); - if ( addressToVerifyAgainst.classicAccount !== sourceAddressAndTag.classicAccount ) { @@ -249,16 +247,15 @@ function createPaymentTransaction( return txJSON; } -function preparePayment( +async function preparePayment( this: Client, address: string, payment: Payment, instructions: Instructions = {} ): Promise { try { - validate.preparePayment({ address, payment, instructions }); const txJSON = createPaymentTransaction(address, payment); - return utils.prepareTransaction(txJSON, this, instructions); + return await utils.prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/settings.ts b/src/transaction/settings.ts index 648a4f0e..bec7aecd 100644 --- a/src/transaction/settings.ts +++ b/src/transaction/settings.ts @@ -13,7 +13,6 @@ import { } from "./types"; import * as utils from "./utils"; -const validate = utils.common.validate; const AccountSetFlags = utils.common.constants.AccountSetFlags; const AccountFields = utils.common.constants.AccountFields; @@ -151,17 +150,16 @@ function createSettingsTransaction( return txJSON; } -function prepareSettings( +async function prepareSettings( this: Client, address: string, settings: FormattedSettings, instructions: Instructions = {} ): Promise { try { - validate.prepareSettings({ address, settings, instructions }); const txJSON = createSettingsTransaction(address, settings); - return utils.prepareTransaction(txJSON, this, instructions); + return await utils.prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/sign.ts b/src/transaction/sign.ts index 4479db8f..245a01bc 100644 --- a/src/transaction/sign.ts +++ b/src/transaction/sign.ts @@ -11,8 +11,6 @@ import { computeBinaryTransactionHash } from "../utils/hashes"; import { SignOptions, KeyPair, TransactionJSON } from "./types"; import * as utils from "./utils"; -const validate = utils.common.validate; - function computeSignature(tx: object, privateKey: string, signAs?: string) { const signingData = signAs ? binaryCodec.encodeForMultisigning(tx, signAs) @@ -28,8 +26,6 @@ function signWithKeypair( signAs: "", } ): SignedTransaction { - validate.sign({ txJSON, keypair }); - const tx = JSON.parse(txJSON); if (tx.TxnSignature || tx.Signers) { throw new utils.common.errors.ValidationError( @@ -229,7 +225,6 @@ function sign( if (typeof secret === "string") { // we can't validate that the secret matches the account because // the secret could correspond to the regular key - validate.sign({ txJSON, secret }); return signWithKeypair( this, txJSON, diff --git a/src/transaction/ticket.ts b/src/transaction/ticket.ts index a0223c13..7b4a1421 100644 --- a/src/transaction/ticket.ts +++ b/src/transaction/ticket.ts @@ -5,7 +5,6 @@ import type { Client } from ".."; import { Prepare, TransactionJSON, Instructions } from "./types"; import * as utils from "./utils"; -const validate = utils.common.validate; const ValidationError = utils.common.errors.ValidationError; export interface Ticket { @@ -37,7 +36,6 @@ function prepareTicketCreate( instructions: Instructions = {} ): Promise { try { - validate.prepareTicketCreate({ address, ticketCount, instructions }); const txJSON = createTicketTransaction(address, ticketCount); return utils.prepareTransaction(txJSON, this, instructions); } catch (e) { diff --git a/src/transaction/trustline.ts b/src/transaction/trustline.ts index 794b8483..0ebb8bd1 100644 --- a/src/transaction/trustline.ts +++ b/src/transaction/trustline.ts @@ -6,7 +6,6 @@ import { FormattedTrustlineSpecification } from "../common/types/objects/trustli import { Instructions, Prepare, TransactionJSON } from "./types"; import * as utils from "./utils"; -const validate = utils.common.validate; const trustlineFlags = utils.common.txFlags.TrustSet; function convertQuality(quality) { @@ -57,16 +56,15 @@ function createTrustlineTransaction( return txJSON; } -function prepareTrustline( +async function prepareTrustline( this: Client, address: string, trustline: FormattedTrustlineSpecification, instructions: Instructions = {} ): Promise { try { - validate.prepareTrustline({ address, trustline, instructions }); const txJSON = createTrustlineTransaction(address, trustline); - return utils.prepareTransaction(txJSON, this, instructions); + return await utils.prepareTransaction(txJSON, this, instructions); } catch (e) { return Promise.reject(e); } diff --git a/src/transaction/utils.ts b/src/transaction/utils.ts index 1ae18366..7c1c0fb8 100644 --- a/src/transaction/utils.ts +++ b/src/transaction/utils.ts @@ -121,14 +121,11 @@ function getClassicAccountAndTag( }; } -function prepareTransaction( +async function prepareTransaction( txJSON: TransactionJSON, client: Client, instructions: Instructions ): Promise { - common.validate.instructions(instructions); - common.validate.tx_json(txJSON); - // We allow 0 values in the Sequence schema to support the Tickets feature // When a ticketSequence is used, sequence has to be 0 // We validate that a sequence with value 0 is not passed even if the json schema allows it @@ -247,7 +244,7 @@ function prepareTransaction( setCanonicalFlag(newTxJSON); - function prepareMaxLedgerVersion(): Promise { + async function prepareMaxLedgerVersion(): Promise { // Up to one of the following is allowed: // txJSON.LastLedgerSequence // instructions.maxLedgerVersion @@ -289,7 +286,7 @@ function prepareTransaction( }); } - function prepareFee(): Promise { + async function prepareFee(): Promise { // instructions.fee is scaled (for multi-signed transactions) while txJSON.Fee is not. // Due to this difference, we do NOT allow both to be set, as the behavior would be complex and // potentially ambiguous. @@ -323,7 +320,7 @@ function prepareTransaction( return Promise.resolve(); } const cushion = client._feeCushion; - return client.getFee(cushion).then((fee) => { + return client.getFee(cushion).then(async (fee) => { return client .request({ command: "fee" }) .then((response) => Number(response.result.drops.minimum_fee)) diff --git a/src/utils/generateAddress.ts b/src/utils/generateAddress.ts index a9115b5d..ee8f44c3 100644 --- a/src/utils/generateAddress.ts +++ b/src/utils/generateAddress.ts @@ -1,7 +1,7 @@ import { classicAddressToXAddress } from "ripple-address-codec"; import keypairs from "ripple-keypairs"; -import { errors, validate } from "../common"; +import { errors } from "../common"; import ECDSA from "../common/ecdsa"; export interface GeneratedAddress { @@ -31,7 +31,6 @@ export interface GenerateAddressOptions { function generateXAddress( options: GenerateAddressOptions = {} ): GeneratedAddress { - validate.generateAddress({ options }); try { const generateSeedOptions: { entropy?: Uint8Array; diff --git a/src/utils/signPaymentChannelClaim.ts b/src/utils/signPaymentChannelClaim.ts index 5cbbe67e..f5c46356 100644 --- a/src/utils/signPaymentChannelClaim.ts +++ b/src/utils/signPaymentChannelClaim.ts @@ -1,8 +1,6 @@ import binary from "ripple-binary-codec"; import keypairs from "ripple-keypairs"; -import { validate } from "../common"; - import { xrpToDrops } from "."; function signPaymentChannelClaim( @@ -10,7 +8,6 @@ function signPaymentChannelClaim( amount: string, privateKey: string ): string { - validate.signPaymentChannelClaim({ channel, amount, privateKey }); const signingData = binary.encodeForSigningClaim({ channel, amount: xrpToDrops(amount), diff --git a/src/utils/verifyPaymentChannelClaim.ts b/src/utils/verifyPaymentChannelClaim.ts index e11f91c5..4a4e0b73 100644 --- a/src/utils/verifyPaymentChannelClaim.ts +++ b/src/utils/verifyPaymentChannelClaim.ts @@ -1,8 +1,6 @@ import binary from "ripple-binary-codec"; import keypairs from "ripple-keypairs"; -import { validate } from "../common"; - import { xrpToDrops } from "."; function verifyPaymentChannelClaim( @@ -11,8 +9,6 @@ function verifyPaymentChannelClaim( signature: string, publicKey: string ): boolean { - validate.verifyPaymentChannelClaim({ channel, amount, signature, publicKey }); - const signingData = binary.encodeForSigningClaim({ channel, amount: xrpToDrops(amount), diff --git a/src/wallet/generateFaucetWallet.ts b/src/wallet/generateFaucetWallet.ts index d129e114..4ed86b85 100644 --- a/src/wallet/generateFaucetWallet.ts +++ b/src/wallet/generateFaucetWallet.ts @@ -1,9 +1,10 @@ import https = require("https"); +import { isValidClassicAddress } from "ripple-address-codec"; + import { Client, Wallet } from ".."; import { errors } from "../common"; import { RippledError } from "../common/errors"; -import { isValidAddress } from "../common/schema-validator"; import { GeneratedAddress } from "../utils/generateAddress"; export interface FaucetWallet { @@ -38,7 +39,7 @@ async function generateFaucetWallet( // Generate a new Wallet if no existing Wallet is provided or its address is invalid to fund const fundWallet = - wallet && isValidAddress(wallet.classicAddress) + wallet && isValidClassicAddress(wallet.classicAddress) ? wallet : Wallet.generate(); diff --git a/test/client.ts b/test/client.ts index a2c92f19..368eb962 100644 --- a/test/client.ts +++ b/test/client.ts @@ -2,8 +2,6 @@ import { assert } from "chai"; import _ from "lodash"; import { Client } from "xrpl-local"; -import { validate } from "xrpl-local/common"; -import * as schemaValidator from "xrpl-local/common/schema-validator"; import { RecursiveData, renameCounterpartyToIssuerInOrder, @@ -13,12 +11,9 @@ import { import { toRippledAmount } from "../src"; -import addresses from "./fixtures/addresses.json"; import setupClient from "./setupClient"; import { assertRejects } from "./testUtils"; -const address = addresses.ACCOUNT; - // how long before each test case times out const TIMEOUT = 20000; @@ -51,130 +46,53 @@ describe("Client", function () { // to test that connect() times out after 2 seconds. }); - describe("[private] schema-validator", function () { - it("valid", function () { - assert.doesNotThrow(function () { - schemaValidator.schemaValidate( - "hash256", - "0F7ED9F40742D8A513AE86029462B7A6768325583DF8EE21B7EC663019DD6A0F" - ); - }); - }); - - it("invalid", function () { - assert.throws(function () { - schemaValidator.schemaValidate("hash256", "invalid"); - }, this.client.errors.ValidationError); - }); - - it("invalid - empty value", function () { - assert.throws(function () { - schemaValidator.schemaValidate("hash256", ""); - }, this.client.errors.ValidationError); - }); - - it("schema not found error", function () { - assert.throws(function () { - schemaValidator.schemaValidate("unexisting", "anything"); - }, /no schema/); - }); - }); - describe("[private] validator", function () { - it("validateLedgerRange", function () { - const options = { - minLedgerVersion: 20000, - maxLedgerVersion: 10000, - }; - const thunk = _.partial(validate.getTransactions, { address, options }); - assert.throws(thunk, this.client.errors.ValidationError); - assert.throws( - thunk, - /minLedgerVersion must not be greater than maxLedgerVersion/ - ); - }); - - it("secret", function () { - function validateSecret(secret) { - validate.sign({ txJSON: "", secret }); - } - assert.doesNotThrow( - _.partial(validateSecret, "shzjfakiK79YQdMjy4h8cGGfQSV6u") - ); - assert.throws( - _.partial(validateSecret, "shzjfakiK79YQdMjy4h8cGGfQSV6v"), - this.client.errors.ValidationError - ); - assert.throws( - _.partial(validateSecret, 1), - this.client.errors.ValidationError - ); - assert.throws( - _.partial(validateSecret, ""), - this.client.errors.ValidationError - ); - assert.throws( - _.partial(validateSecret, "s!!!"), - this.client.errors.ValidationError - ); - assert.throws( - _.partial(validateSecret, "passphrase"), - this.client.errors.ValidationError - ); - // 32 0s is a valid hex repr of seed bytes - const hex = new Array(33).join("0"); - assert.throws( - _.partial(validateSecret, hex), - this.client.errors.ValidationError - ); - }); - }); - - it("common utils - toRippledAmount", async function () { - const amount = { issuer: "is", currency: "c", value: "v" }; - assert.deepEqual(toRippledAmount(amount), { - issuer: "is", - currency: "c", - value: "v", - }); - }); - - it("ledger utils - renameCounterpartyToIssuerInOrder", async function () { - const order = { - taker_gets: { counterparty: "1", currency: "XRP" }, - taker_pays: { counterparty: "1", currency: "XRP" }, - }; - const expected = { - taker_gets: { issuer: "1", currency: "XRP" }, - taker_pays: { issuer: "1", currency: "XRP" }, - }; - assert.deepEqual(renameCounterpartyToIssuerInOrder(order), expected); - }); - - it("ledger utils - compareTransactions", async function () { - // @ts-expect-error - assert.strictEqual(compareTransactions({}, {}), 0); - let first: any = { outcome: { ledgerVersion: 1, indexInLedger: 100 } }; - let second: any = { outcome: { ledgerVersion: 1, indexInLedger: 200 } }; - assert.strictEqual(compareTransactions(first, second), -1); - first = { outcome: { ledgerVersion: 1, indexInLedger: 100 } }; - second = { outcome: { ledgerVersion: 1, indexInLedger: 100 } }; - assert.strictEqual(compareTransactions(first, second), 0); - first = { outcome: { ledgerVersion: 1, indexInLedger: 200 } }; - second = { outcome: { ledgerVersion: 1, indexInLedger: 100 } }; - assert.strictEqual(compareTransactions(first, second), 1); - }); - - it("ledger utils - getRecursive", async function () { - function getter(marker) { - return new Promise((resolve, reject) => { - if (marker != null) { - reject(new Error()); - return; - } - resolve({ marker: "A", results: [1] }); + it("common utils - toRippledAmount", async function () { + const amount = { issuer: "is", currency: "c", value: "v" }; + assert.deepEqual(toRippledAmount(amount), { + issuer: "is", + currency: "c", + value: "v", }); - } - await assertRejects(getRecursive(getter, 10), Error); + }); + + it("ledger utils - renameCounterpartyToIssuerInOrder", async function () { + const order = { + taker_gets: { counterparty: "1", currency: "XRP" }, + taker_pays: { counterparty: "1", currency: "XRP" }, + }; + const expected = { + taker_gets: { issuer: "1", currency: "XRP" }, + taker_pays: { issuer: "1", currency: "XRP" }, + }; + assert.deepEqual(renameCounterpartyToIssuerInOrder(order), expected); + }); + + it("ledger utils - compareTransactions", async function () { + // @ts-expect-error + assert.strictEqual(compareTransactions({}, {}), 0); + let first: any = { outcome: { ledgerVersion: 1, indexInLedger: 100 } }; + let second: any = { outcome: { ledgerVersion: 1, indexInLedger: 200 } }; + assert.strictEqual(compareTransactions(first, second), -1); + first = { outcome: { ledgerVersion: 1, indexInLedger: 100 } }; + second = { outcome: { ledgerVersion: 1, indexInLedger: 100 } }; + assert.strictEqual(compareTransactions(first, second), 0); + first = { outcome: { ledgerVersion: 1, indexInLedger: 200 } }; + second = { outcome: { ledgerVersion: 1, indexInLedger: 100 } }; + assert.strictEqual(compareTransactions(first, second), 1); + }); + + it("ledger utils - getRecursive", async function () { + async function getter(marker) { + return new Promise((resolve, reject) => { + if (marker != null) { + reject(new Error()); + return; + } + resolve({ marker: "A", results: [1] }); + }); + } + await assertRejects(getRecursive(getter, 10), Error); + }); }); }); diff --git a/test/client/getPaths.ts b/test/client/getPaths.ts index c4242e28..73c6f3af 100644 --- a/test/client/getPaths.ts +++ b/test/client/getPaths.ts @@ -1,5 +1,3 @@ -import { assert } from "chai"; - import addresses from "../fixtures/addresses.json"; import requests from "../fixtures/requests"; import rippled from "../fixtures/rippled"; @@ -45,7 +43,7 @@ describe("client.getPaths", function () { // const response = await this.client.getPaths(REQUEST_FIXTURES.XrpToXrp) // assertResultMatch(response, RESPONSE_FIXTURES.XrpToXrp, 'getPaths') // }) - it("source with issuer", function () { + it("source with issuer", async function () { this.mockRippled.addResponse("ripple_path_find", rippledResponse); return assertRejects( this.client.getPaths(REQUEST_FIXTURES.issuer), @@ -58,41 +56,41 @@ describe("client.getPaths", function () { // this.client.errors.NotFoundError // ) // }) - it("invalid PathFind", function () { - this.mockRippled.addResponse("ripple_path_find", rippledResponse); - assert.throws(() => { - this.client.getPaths(REQUEST_FIXTURES.invalid); - }, /Cannot specify both source.amount/); - }); - it("does not accept currency", function () { + // it("invalid PathFind", function () { + // this.mockRippled.addResponse("ripple_path_find", rippledResponse); + // assert.throws(() => { + // this.client.getPaths(REQUEST_FIXTURES.invalid); + // }, /Cannot specify both source.amount/); + // }); + it("does not accept currency", async function () { this.mockRippled.addResponse("ripple_path_find", rippledResponse); return assertRejects( this.client.getPaths(REQUEST_FIXTURES.NotAcceptCurrency), this.client.errors.NotFoundError ); }); - it("no paths", function () { + it("no paths", async function () { this.mockRippled.addResponse("ripple_path_find", rippledResponse); return assertRejects( this.client.getPaths(REQUEST_FIXTURES.NoPaths), this.client.errors.NotFoundError ); }); - it("no paths source amount", function () { + it("no paths source amount", async function () { this.mockRippled.addResponse("ripple_path_find", rippledResponse); return assertRejects( this.client.getPaths(REQUEST_FIXTURES.NoPathsSource), this.client.errors.NotFoundError ); }); - it("no paths with source currencies", function () { + it("no paths with source currencies", async function () { this.mockRippled.addResponse("ripple_path_find", rippledResponse); return assertRejects( this.client.getPaths(REQUEST_FIXTURES.NoPathsWithCurrencies), this.client.errors.NotFoundError ); }); - it("error: srcActNotFound", function () { + it("error: srcActNotFound", async function () { this.mockRippled.addResponse("ripple_path_find", rippledResponse); return assertRejects( this.client.getPaths({ diff --git a/test/client/isValidAddress.ts b/test/client/isValidAddress.ts deleted file mode 100644 index 0134dbe8..00000000 --- a/test/client/isValidAddress.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { assert } from "chai"; - -import addresses from "../fixtures/addresses.json"; -import setupClient from "../setupClient"; - -describe("isValidAddress", function () { - beforeEach(setupClient.setup); - afterEach(setupClient.teardown); - - it("returns true for valid address", async function () { - assert(this.client.isValidAddress("rLczgQHxPhWtjkaQqn3Q6UM8AbRbbRvs5K")); - assert(this.client.isValidAddress(addresses.ACCOUNT_X)); - assert(this.client.isValidAddress(addresses.ACCOUNT_T)); - }); - - it("returns false for invalid address", async function () { - assert(!this.client.isValidAddress("foobar")); - assert(!this.client.isValidAddress(addresses.ACCOUNT_X.slice(0, -1))); - assert(!this.client.isValidAddress(addresses.ACCOUNT_T.slice(1))); - }); -}); diff --git a/test/client/isValidSecret.ts b/test/client/isValidSecret.ts deleted file mode 100644 index 2d727be1..00000000 --- a/test/client/isValidSecret.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { assert } from "chai"; - -import setupClient from "../setupClient"; - -describe("isValidSecret", function () { - beforeEach(setupClient.setup); - afterEach(setupClient.teardown); - - it("returns true for valid secret", async function () { - assert(this.client.isValidSecret("snsakdSrZSLkYpCXxfRkS4Sh96PMK")); - }); - - it("returns false for invalid secret", async function () { - assert(!this.client.isValidSecret("foobar")); - }); -}); diff --git a/test/client/prepareEscrowCreation.ts b/test/client/prepareEscrowCreation.ts index 846c33d1..2f82a331 100644 --- a/test/client/prepareEscrowCreation.ts +++ b/test/client/prepareEscrowCreation.ts @@ -3,7 +3,7 @@ import requests from "../fixtures/requests"; import responses from "../fixtures/responses"; import rippled from "../fixtures/rippled"; import setupClient from "../setupClient"; -import { assertRejects, assertResultMatch } from "../testUtils"; +import { assertResultMatch } from "../testUtils"; const instructionsWithMaxLedgerVersionOffset = { maxLedgerVersionOffset: 100 }; @@ -51,19 +51,19 @@ describe("client.prepareEscrowCreation", function () { assertResultMatch(result, responses.prepareEscrowCreation.full, "prepare"); }); - it("prepareEscrowCreation - invalid", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const escrow = { ...requests.prepareEscrowCreation.full }; - delete escrow.amount; // Make invalid - await assertRejects( - this.client.prepareEscrowCreation(addresses.ACCOUNT, escrow), - this.client.errors.ValidationError, - 'instance.escrowCreation requires property "amount"' - ); - }); + // it("prepareEscrowCreation - invalid", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const escrow = { ...requests.prepareEscrowCreation.full }; + // delete escrow.amount; // Make invalid + // await assertRejects( + // this.client.prepareEscrowCreation(addresses.ACCOUNT, escrow), + // this.client.errors.ValidationError, + // 'instance.escrowCreation requires property "amount"' + // ); + // }); it("with ticket", async function () { this.mockRippled.addResponse("server_info", rippled.server_info.normal); diff --git a/test/client/prepareOrder.ts b/test/client/prepareOrder.ts index 40d76167..e4dddfc5 100644 --- a/test/client/prepareOrder.ts +++ b/test/client/prepareOrder.ts @@ -2,7 +2,7 @@ import requests from "../fixtures/requests"; import responses from "../fixtures/responses"; import rippled from "../fixtures/rippled"; import setupClient from "../setupClient"; -import { assertRejects, assertResultMatch, addressTests } from "../testUtils"; +import { assertResultMatch, addressTests } from "../testUtils"; const instructionsWithMaxLedgerVersionOffset = { maxLedgerVersionOffset: 100 }; @@ -60,26 +60,26 @@ describe("client.prepareOrder", function () { assertResultMatch(result, responses.prepareOrder.sell, "prepare"); }); - it("invalid", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse( - "account_info", - rippled.account_info.normal - ); - const request = { ...requests.prepareOrder.sell }; - delete request.direction; // Make invalid - await assertRejects( - this.client.prepareOrder( - test.address, - request, - instructionsWithMaxLedgerVersionOffset - ), - this.client.errors.ValidationError, - 'instance.order requires property "direction"' - ); - }); + // it("invalid", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse( + // "account_info", + // rippled.account_info.normal + // ); + // const request = { ...requests.prepareOrder.sell }; + // delete request.direction; // Make invalid + // await assertRejects( + // this.client.prepareOrder( + // test.address, + // request, + // instructionsWithMaxLedgerVersionOffset + // ), + // this.client.errors.ValidationError, + // 'instance.order requires property "direction"' + // ); + // }); it("with ticket", async function () { this.mockRippled.addResponse("server_info", rippled.server_info.normal); diff --git a/test/client/prepareOrderCancellation.ts b/test/client/prepareOrderCancellation.ts index 71bf075d..0b074d6d 100644 --- a/test/client/prepareOrderCancellation.ts +++ b/test/client/prepareOrderCancellation.ts @@ -2,7 +2,7 @@ import requests from "../fixtures/requests"; import responses from "../fixtures/responses"; import rippled from "../fixtures/rippled"; import setupClient from "../setupClient"; -import { assertRejects, assertResultMatch, addressTests } from "../testUtils"; +import { assertResultMatch, addressTests } from "../testUtils"; const instructionsWithMaxLedgerVersionOffset = { maxLedgerVersionOffset: 100 }; @@ -73,25 +73,25 @@ describe("client.prepareOrderCancellation", function () { ); }); - it("invalid", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse( - "account_info", - rippled.account_info.normal - ); - const request = { - ...requests.prepareOrderCancellation.withMemos, - }; - delete request.orderSequence; // Make invalid + // it("invalid", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse( + // "account_info", + // rippled.account_info.normal + // ); + // const request = { + // ...requests.prepareOrderCancellation.withMemos, + // }; + // delete request.orderSequence; // Make invalid - await assertRejects( - this.client.prepareOrderCancellation(test.address, request), - this.client.errors.ValidationError, - 'instance.orderCancellation requires property "orderSequence"' - ); - }); + // await assertRejects( + // this.client.prepareOrderCancellation(test.address, request), + // this.client.errors.ValidationError, + // 'instance.orderCancellation requires property "orderSequence"' + // ); + // }); it("with ticket", async function () { this.mockRippled.addResponse("server_info", rippled.server_info.normal); diff --git a/test/client/preparePayment.ts b/test/client/preparePayment.ts index 95c9e59a..c5f2aca8 100644 --- a/test/client/preparePayment.ts +++ b/test/client/preparePayment.ts @@ -245,29 +245,29 @@ describe("client.preparePayment", function () { ); }); - it("rejects promise and does not throw when field is missing", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse( - "account_info", - rippled.account_info.normal - ); - // Marking as "any" to get around the fact that TS won't allow this. - const payment: any = { - source: { address: test.address }, - destination: { - address: RECIPIENT_ADDRESS, - amount: { value: "1000", currency: "drops" }, - }, - }; + // it("rejects promise and does not throw when field is missing", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse( + // "account_info", + // rippled.account_info.normal + // ); + // // Marking as "any" to get around the fact that TS won't allow this. + // const payment: any = { + // source: { address: test.address }, + // destination: { + // address: RECIPIENT_ADDRESS, + // amount: { value: "1000", currency: "drops" }, + // }, + // }; - return assertRejects( - this.client.preparePayment(test.address, payment), - ValidationError, - "instance.payment.source is not exactly one from ," - ); - }); + // return assertRejects( + // this.client.preparePayment(test.address, payment), + // ValidationError, + // "instance.payment.source is not exactly one from ," + // ); + // }); it("rejects promise and does not throw when fee exceeds maxFeeXRP", async function () { this.mockRippled.addResponse("server_info", rippled.server_info.normal); diff --git a/test/client/prepareSettings.ts b/test/client/prepareSettings.ts index 2e730832..4bbefb7a 100644 --- a/test/client/prepareSettings.ts +++ b/test/client/prepareSettings.ts @@ -246,34 +246,34 @@ describe("client.prepareSettings", function () { "prepare" ); }); - it("signers no threshold", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse( - "account_info", - rippled.account_info.normal - ); - const settings = requests.prepareSettings.signers.noThreshold; - try { - const response = await this.client.prepareSettings( - test.address, - settings, - instructionsWithMaxLedgerVersionOffset - ); - throw new Error( - `Expected method to reject. Prepared transaction: ${JSON.stringify( - response - )}` - ); - } catch (err) { - assert.strictEqual( - err.message, - 'instance.settings.signers requires property "threshold"' - ); - assert.strictEqual(err.name, "ValidationError"); - } - }); + // it("signers no threshold", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse( + // "account_info", + // rippled.account_info.normal + // ); + // const settings = requests.prepareSettings.signers.noThreshold; + // try { + // const response = await this.client.prepareSettings( + // test.address, + // settings, + // instructionsWithMaxLedgerVersionOffset + // ); + // throw new Error( + // `Expected method to reject. Prepared transaction: ${JSON.stringify( + // response + // )}` + // ); + // } catch (err) { + // assert.strictEqual( + // err.message, + // 'instance.settings.signers requires property "threshold"' + // ); + // assert.strictEqual(err.name, "ValidationError"); + // } + // }); it("signers no weights", async function () { this.mockRippled.addResponse("server_info", rippled.server_info.normal); this.mockRippled.addResponse("fee", rippled.fee); @@ -345,40 +345,40 @@ describe("client.prepareSettings", function () { "prepare" ); }); - it("invalid", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse( - "account_info", - rippled.account_info.normal - ); - // domain must be a string - const settings = { ...requests.prepareSettings.domain, domain: 123 }; - const localInstructions = { - signersCount: 4, - ...instructionsWithMaxLedgerVersionOffset, - }; + // it("invalid", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse( + // "account_info", + // rippled.account_info.normal + // ); + // // domain must be a string + // const settings = { ...requests.prepareSettings.domain, domain: 123 }; + // const localInstructions = { + // signersCount: 4, + // ...instructionsWithMaxLedgerVersionOffset, + // }; - try { - const response = await this.client.prepareSettings( - test.address, - settings, - localInstructions - ); - throw new Error( - `Expected method to reject. Prepared transaction: ${JSON.stringify( - response - )}` - ); - } catch (err) { - assert.strictEqual( - err.message, - "instance.settings.domain is not of a type(s) string" - ); - assert.strictEqual(err.name, "ValidationError"); - } - }); + // try { + // const response = await this.client.prepareSettings( + // test.address, + // settings, + // localInstructions + // ); + // throw new Error( + // `Expected method to reject. Prepared transaction: ${JSON.stringify( + // response + // )}` + // ); + // } catch (err) { + // assert.strictEqual( + // err.message, + // "instance.settings.domain is not of a type(s) string" + // ); + // assert.strictEqual(err.name, "ValidationError"); + // } + // }); it("offline", async function () { this.mockRippled.addResponse("server_info", rippled.server_info.normal); this.mockRippled.addResponse("fee", rippled.fee); diff --git a/test/client/prepareTransaction.ts b/test/client/prepareTransaction.ts index 4b827cb9..58647cbe 100644 --- a/test/client/prepareTransaction.ts +++ b/test/client/prepareTransaction.ts @@ -120,26 +120,26 @@ describe("client.prepareTransaction", function () { ); }); - it("rejects Promise when the Fee is capitalized in Instructions", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - Fee: "0.000022", // Intentionally capitalized in this test, but the correct field would be `fee` - }; - const txJSON = { - TransactionType: "DepositPreauth", - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - 'instance additionalProperty "Fee" exists in instance when not allowed' - ); - }); + // it("rejects Promise when the Fee is capitalized in Instructions", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // Fee: "0.000022", // Intentionally capitalized in this test, but the correct field would be `fee` + // }; + // const txJSON = { + // TransactionType: "DepositPreauth", + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // 'instance additionalProperty "Fee" exists in instance when not allowed' + // ); + // }); it("rejects Promise when the fee is specified in txJSON", async function () { this.mockRippled.addResponse("server_info", rippled.server_info.normal); @@ -262,51 +262,51 @@ describe("client.prepareTransaction", function () { ); }); - it("rejects Promise when the Sequence is capitalized in Instructions", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxFee: "0.000012", - Sequence: 100, // Intentionally capitalized in this test, but the correct field would be `sequence` - }; - const txJSON = { - TransactionType: "DepositPreauth", - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - 'instance additionalProperty "Sequence" exists in instance when not allowed' - ); - }); + // it("rejects Promise when the Sequence is capitalized in Instructions", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxFee: "0.000012", + // Sequence: 100, // Intentionally capitalized in this test, but the correct field would be `sequence` + // }; + // const txJSON = { + // TransactionType: "DepositPreauth", + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // 'instance additionalProperty "Sequence" exists in instance when not allowed' + // ); + // }); // LastLedgerSequence aka maxLedgerVersion/maxLedgerVersionOffset: - it("does not overwrite LastLedgerSequence in txJSON", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxFee: "0.000012", - Sequence: 100, // Intentionally capitalized in this test, but the correct field would be `sequence` - }; - const txJSON = { - TransactionType: "DepositPreauth", - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - 'instance additionalProperty "Sequence" exists in instance when not allowed' - ); - }); + // it("does not overwrite LastLedgerSequence in txJSON", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxFee: "0.000012", + // Sequence: 100, // Intentionally capitalized in this test, but the correct field would be `sequence` + // }; + // const txJSON = { + // TransactionType: "DepositPreauth", + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // 'instance additionalProperty "Sequence" exists in instance when not allowed' + // ); + // }); it("does not overwrite maxLedgerVersion in Instructions", async function () { this.mockRippled.addResponse("server_info", rippled.server_info.normal); @@ -365,141 +365,141 @@ describe("client.prepareTransaction", function () { return assertResultMatch(response, expected, "prepare"); }); - it("rejects Promise if txJSON.LastLedgerSequence and instructions.maxLedgerVersion both are set", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - maxLedgerVersion: 8900000, - }; - const txJSON = { - TransactionType: "DepositPreauth", - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - Fee: "16", - LastLedgerSequence: 8900000, - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - "`LastLedgerSequence` in txJSON and `maxLedgerVersion` in `instructions` cannot both be set" - ); - }); + // it("rejects Promise if txJSON.LastLedgerSequence and instructions.maxLedgerVersion both are set", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // maxLedgerVersion: 8900000, + // }; + // const txJSON = { + // TransactionType: "DepositPreauth", + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // Fee: "16", + // LastLedgerSequence: 8900000, + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // "`LastLedgerSequence` in txJSON and `maxLedgerVersion` in `instructions` cannot both be set" + // ); + // }); - it("rejects Promise if txJSON.LastLedgerSequence and instructions.maxLedgerVersionOffset both are set", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxLedgerVersionOffset: 123, - }; - const txJSON = { - TransactionType: "DepositPreauth", - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - Fee: "16", - LastLedgerSequence: 8900000, - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - "`LastLedgerSequence` in txJSON and `maxLedgerVersionOffset` in `instructions` cannot both be set" - ); - }); + // it("rejects Promise if txJSON.LastLedgerSequence and instructions.maxLedgerVersionOffset both are set", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxLedgerVersionOffset: 123, + // }; + // const txJSON = { + // TransactionType: "DepositPreauth", + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // Fee: "16", + // LastLedgerSequence: 8900000, + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // "`LastLedgerSequence` in txJSON and `maxLedgerVersionOffset` in `instructions` cannot both be set" + // ); + // }); - it("rejects Promise if instructions.maxLedgerVersion and instructions.maxLedgerVersionOffset both are set", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxLedgerVersion: 8900000, - maxLedgerVersionOffset: 123, - }; - const txJSON = { - TransactionType: "DepositPreauth", - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - Fee: "16", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - "instance is of prohibited type [object Object]" - ); - }); + // it("rejects Promise if instructions.maxLedgerVersion and instructions.maxLedgerVersionOffset both are set", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxLedgerVersion: 8900000, + // maxLedgerVersionOffset: 123, + // }; + // const txJSON = { + // TransactionType: "DepositPreauth", + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // Fee: "16", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // "instance is of prohibited type [object Object]" + // ); + // }); - it("rejects Promise if txJSON.LastLedgerSequence and instructions.maxLedgerVersion and instructions.maxLedgerVersionOffset all are set", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxLedgerVersion: 8900000, - maxLedgerVersionOffset: 123, - }; - const txJSON = { - TransactionType: "DepositPreauth", - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - Fee: "16", - LastLedgerSequence: 8900000, - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - "instance is of prohibited type [object Object]" - ); - }); + // it("rejects Promise if txJSON.LastLedgerSequence and instructions.maxLedgerVersion and instructions.maxLedgerVersionOffset all are set", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxLedgerVersion: 8900000, + // maxLedgerVersionOffset: 123, + // }; + // const txJSON = { + // TransactionType: "DepositPreauth", + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // Fee: "16", + // LastLedgerSequence: 8900000, + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // "instance is of prohibited type [object Object]" + // ); + // }); - it("rejects Promise when the maxLedgerVersion is capitalized in Instructions", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - MaxLedgerVersion: 8900000, // Intentionally capitalized in this test, but the correct field would be `maxLedgerVersion` - }; - const txJSON = { - TransactionType: "DepositPreauth", - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - 'instance additionalProperty "MaxLedgerVersion" exists in instance when not allowed' - ); - }); + // it("rejects Promise when the maxLedgerVersion is capitalized in Instructions", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // MaxLedgerVersion: 8900000, // Intentionally capitalized in this test, but the correct field would be `maxLedgerVersion` + // }; + // const txJSON = { + // TransactionType: "DepositPreauth", + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // 'instance additionalProperty "MaxLedgerVersion" exists in instance when not allowed' + // ); + // }); - it("rejects Promise when the maxLedgerVersion is specified in txJSON", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxLedgerVersion: 8900000, - maxLedgerVersionOffset: 123, - }; - const txJSON = { - TransactionType: "DepositPreauth", - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - Fee: "16", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - "instance is of prohibited type [object Object]" - ); - }); + // it("rejects Promise when the maxLedgerVersion is specified in txJSON", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxLedgerVersion: 8900000, + // maxLedgerVersionOffset: 123, + // }; + // const txJSON = { + // TransactionType: "DepositPreauth", + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // Fee: "16", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // "instance is of prohibited type [object Object]" + // ); + // }); it("rejects Promise when the maxLedgerVersionOffset is specified in txJSON", async function () { this.mockRippled.addResponse("server_info", rippled.server_info.normal); @@ -543,91 +543,91 @@ describe("client.prepareTransaction", function () { // Other errors: - it("rejects Promise when an unrecognized field is in Instructions", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxFee: "0.000012", - foo: "bar", - }; - const txJSON = { - TransactionType: "DepositPreauth", - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - 'instance additionalProperty "foo" exists in instance when not allowed' - ); - }); + // it("rejects Promise when an unrecognized field is in Instructions", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxFee: "0.000012", + // foo: "bar", + // }; + // const txJSON = { + // TransactionType: "DepositPreauth", + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // 'instance additionalProperty "foo" exists in instance when not allowed' + // ); + // }); - it("rejects Promise when Account is missing", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxFee: "0.000012", - }; - // Marking as "any" to get around the fact that TS won't allow this. - const txJSON: any = { - TransactionType: "DepositPreauth", - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - 'instance requires property "Account"' - ); - }); + // it("rejects Promise when Account is missing", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxFee: "0.000012", + // }; + // // Marking as "any" to get around the fact that TS won't allow this. + // const txJSON: any = { + // TransactionType: "DepositPreauth", + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // 'instance requires property "Account"' + // ); + // }); - it("rejects Promise when Account is not a string", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxFee: "0.000012", - }; - // Marking as "any" to get around the fact that TS won't allow this. - const txJSON: any = { - Account: 1234, - TransactionType: "DepositPreauth", - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - "instance.Account is not of a type(s) string,instance.Account is not exactly one from ," - ); - }); + // it("rejects Promise when Account is not a string", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxFee: "0.000012", + // }; + // // Marking as "any" to get around the fact that TS won't allow this. + // const txJSON: any = { + // Account: 1234, + // TransactionType: "DepositPreauth", + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // "instance.Account is not of a type(s) string,instance.Account is not exactly one from ," + // ); + // }); - it("rejects Promise when Account is invalid", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxFee: "0.000012", - }; - const txJSON = { - Account: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xkXXXX", // Invalid checksum - TransactionType: "DepositPreauth", - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - "instance.Account is not exactly one from ," - ); - }); + // it("rejects Promise when Account is invalid", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxFee: "0.000012", + // }; + // const txJSON = { + // Account: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xkXXXX", // Invalid checksum + // TransactionType: "DepositPreauth", + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // "instance.Account is not exactly one from ," + // ); + // }); // 'rejects Promise when Account is valid but non-existent on the ledger': async ( // client @@ -648,26 +648,26 @@ describe("client.prepareTransaction", function () { // ) // }, - it("rejects Promise when TransactionType is missing", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxFee: "0.000012", - }; - // Marking as "any" to get around the fact that TS won't allow this. - const txJSON: any = { - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - 'instance requires property "TransactionType"' - ); - }); + // it("rejects Promise when TransactionType is missing", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxFee: "0.000012", + // }; + // // Marking as "any" to get around the fact that TS won't allow this. + // const txJSON: any = { + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // 'instance requires property "TransactionType"' + // ); + // }); // Note: This transaction will fail at the `sign` step: // @@ -703,27 +703,27 @@ describe("client.prepareTransaction", function () { return assertResultMatch(response, expected, "prepare"); }); - it("rejects Promise when TransactionType is not a string", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ...instructionsWithMaxLedgerVersionOffset, - maxFee: "0.000012", - }; - // Marking as "any" to get around the fact that TS won't allow this. - const txJSON: any = { - Account: addresses.ACCOUNT, - TransactionType: 1234, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - "instance.TransactionType is not of a type(s) string" - ); - }); + // it("rejects Promise when TransactionType is not a string", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ...instructionsWithMaxLedgerVersionOffset, + // maxFee: "0.000012", + // }; + // // Marking as "any" to get around the fact that TS won't allow this. + // const txJSON: any = { + // Account: addresses.ACCOUNT, + // TransactionType: 1234, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // "instance.TransactionType is not of a type(s) string" + // ); + // }); // Note: This transaction will fail at the `submit` step: // @@ -1451,27 +1451,27 @@ describe("client.prepareTransaction", function () { ); }); - it("rejects Promise if both sequence and ticketSecuence are set", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse("account_info", rippled.account_info.normal); - const localInstructions = { - ticketSequence: 23, - sequence: 23, - }; - const txJSON = { - TransactionType: "DepositPreauth", - Account: addresses.ACCOUNT, - Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", - Fee: "16", - }; - await assertRejects( - this.client.prepareTransaction(txJSON, localInstructions), - ValidationError, - "instance is of prohibited type [object Object]" - ); - }); + // it("rejects Promise if both sequence and ticketSequence are set", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse("account_info", rippled.account_info.normal); + // const localInstructions = { + // ticketSequence: 23, + // sequence: 23, + // }; + // const txJSON = { + // TransactionType: "DepositPreauth", + // Account: addresses.ACCOUNT, + // Authorize: "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo", + // Fee: "16", + // }; + // await assertRejects( + // this.client.prepareTransaction(txJSON, localInstructions), + // ValidationError, + // "instance is of prohibited type [object Object]" + // ); + // }); it("sets sequence to 0 if a ticketSequence is passed", async function () { this.mockRippled.addResponse("server_info", rippled.server_info.normal); diff --git a/test/client/prepareTrustline.ts b/test/client/prepareTrustline.ts index 520f6819..99e0d158 100644 --- a/test/client/prepareTrustline.ts +++ b/test/client/prepareTrustline.ts @@ -2,7 +2,7 @@ import requests from "../fixtures/requests"; import responses from "../fixtures/responses"; import rippled from "../fixtures/rippled"; import setupClient from "../setupClient"; -import { assertRejects, assertResultMatch, addressTests } from "../testUtils"; +import { assertResultMatch, addressTests } from "../testUtils"; const instructionsWithMaxLedgerVersionOffset = { maxLedgerVersionOffset: 100 }; @@ -63,27 +63,27 @@ describe("client.prepareTrustline", function () { ); }); - it("invalid", async function () { - this.mockRippled.addResponse("server_info", rippled.server_info.normal); - this.mockRippled.addResponse("fee", rippled.fee); - this.mockRippled.addResponse("ledger_current", rippled.ledger_current); - this.mockRippled.addResponse( - "account_info", - rippled.account_info.normal - ); - const trustline = { ...requests.prepareTrustline.complex }; - delete trustline.limit; // Make invalid + // it("invalid", async function () { + // this.mockRippled.addResponse("server_info", rippled.server_info.normal); + // this.mockRippled.addResponse("fee", rippled.fee); + // this.mockRippled.addResponse("ledger_current", rippled.ledger_current); + // this.mockRippled.addResponse( + // "account_info", + // rippled.account_info.normal + // ); + // const trustline = { ...requests.prepareTrustline.complex }; + // delete trustline.limit; // Make invalid - await assertRejects( - this.client.prepareTrustline( - test.address, - trustline, - instructionsWithMaxLedgerVersionOffset - ), - this.client.errors.ValidationError, - 'instance.trustline requires property "limit"' - ); - }); + // await assertRejects( + // this.client.prepareTrustline( + // test.address, + // trustline, + // instructionsWithMaxLedgerVersionOffset + // ), + // this.client.errors.ValidationError, + // 'instance.trustline requires property "limit"' + // ); + // }); it("xtest.address-issuer", async function () { this.mockRippled.addResponse("server_info", rippled.server_info.normal); diff --git a/test/client/sign.ts b/test/client/sign.ts index b9229966..c5372637 100644 --- a/test/client/sign.ts +++ b/test/client/sign.ts @@ -1,8 +1,6 @@ import { assert } from "chai"; import binary from "ripple-binary-codec"; -import * as schemaValidator from "xrpl-local/common/schema-validator"; - import requests from "../fixtures/requests"; import responses from "../fixtures/responses"; import rippled from "../fixtures/rippled"; @@ -19,7 +17,6 @@ describe("client.sign", function () { const secret = "shsWGZcmZz6YsWWmcnpfr6fLTdtFV"; const result = this.client.sign(REQUEST_FIXTURES.normal.txJSON, secret); assert.deepEqual(result, RESPONSE_FIXTURES.normal); - schemaValidator.schemaValidate("sign", result); }); it("sign with lowercase hex data in memo (hex should be case insensitive)", async function () { @@ -59,7 +56,6 @@ describe("client.sign", function () { const secret = "snoPBrXtMeMyMHUVTgbuqAfg1SUTb"; const result = this.client.sign(REQUEST_FIXTURES.escrow.txJSON, secret); assert.deepEqual(result, RESPONSE_FIXTURES.escrow); - schemaValidator.schemaValidate("sign", result); }); it("signAs", async function () { @@ -80,7 +76,6 @@ describe("client.sign", function () { }; const result = this.client.sign(REQUEST_FIXTURES.normal.txJSON, keypair); assert.deepEqual(result, RESPONSE_FIXTURES.normal); - schemaValidator.schemaValidate("sign", result); }); it("withKeypair already signed", async function () { @@ -106,7 +101,6 @@ describe("client.sign", function () { }; const result = this.client.sign(REQUEST_FIXTURES.escrow.txJSON, keypair); assert.deepEqual(result, RESPONSE_FIXTURES.escrow); - schemaValidator.schemaValidate("sign", result); }); it("withKeypair signAs", async function () { @@ -148,7 +142,6 @@ describe("client.sign", function () { `Flags = ${decoded.Flags}, should be undefined` ); assert.deepEqual(result, expectedResult); - schemaValidator.schemaValidate("sign", result); }); it("sign succeeds with source.amount/destination.minAmount", async function () { @@ -169,7 +162,6 @@ describe("client.sign", function () { `Flags = ${decoded.Flags}, should be 2147614720` ); assert.deepEqual(result, expectedResult); - schemaValidator.schemaValidate("sign", result); }); it("throws when encoded tx does not match decoded tx - AccountSet", async function () { @@ -228,14 +220,12 @@ describe("client.sign", function () { }; assert.deepEqual(result, expectedResponse); - schemaValidator.schemaValidate("sign", result); }); it("sign with ticket", async function () { const secret = "sn7n5R1cR5Y3fRFkuWXA94Ts1frVJ"; const result = this.client.sign(REQUEST_FIXTURES.ticket.txJSON, secret); assert.deepEqual(result, RESPONSE_FIXTURES.ticket); - schemaValidator.schemaValidate("sign", result); }); addressTests.forEach(function (test) { @@ -312,7 +302,6 @@ describe("client.sign", function () { "12000022800200002400000001201B00EF81E661EC6386F26FC0FFFF0000000000000000000000005553440000000000054F6F784A58F9EFB0A9EB90B83464F9D166461968400000000000000C6940000000000000646AD3504529A0465E2E0000000000000000000000005553440000000000054F6F784A58F9EFB0A9EB90B83464F9D1664619732102F89EAEC7667B30F33D0687BBA86C3FE2A08CCA40A9186C5BDE2DAA6FA97A37D87446304402200A693FB5CA6B21250EBDFD8CFF526EE0DF7C9E4E31EB0660692E75E6A93BF5F802203CC39463DDA21386898CA31E18AD1A6828647D65741DD637BAD71BC83E29DB9481145E7B112523F68D2F5E879DB4EAC51C6698A693048314CA6EDC7A28252DAEA6F2045B24F4D7C333E146170112300000000000000000000000005553440000000000054F6F784A58F9EFB0A9EB90B83464F9D166461900", id: "78874FE5F5299FEE3EA85D3CF6C1FB1F1D46BB08F716662A3E3D1F0ADE4EF796", }); - schemaValidator.schemaValidate("sign", result); }); it("succeeds - prepared payment", async function () { @@ -347,7 +336,6 @@ describe("client.sign", function () { id: "88D6B913C66279EA31ADC25C5806C48B2D4E5680261666790A736E1961217700", }; assert.deepEqual(result, expectedResult); - schemaValidator.schemaValidate("sign", result); }); it("throws when encoded tx does not match decoded tx - prepared payment", async function () {