init
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
export declare class ExponentialBackoff {
|
||||
private readonly ms;
|
||||
private readonly max;
|
||||
private readonly factor;
|
||||
private readonly jitter;
|
||||
attempts: number;
|
||||
constructor(opts?: {
|
||||
min?: number;
|
||||
max?: number;
|
||||
});
|
||||
duration(): number;
|
||||
reset(): void;
|
||||
}
|
||||
//# sourceMappingURL=backoff.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"backoff.d.ts","sourceRoot":"","sources":["../../../src/common/backoff.ts"],"names":[],"mappings":"AAYA,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,QAAQ,EAAE,MAAM,CAAI;gBAER,IAAI,GAAE;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAM;IAQnD,QAAQ;IAaR,KAAK;CAGN"}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ExponentialBackoff = void 0;
|
||||
class ExponentialBackoff {
|
||||
constructor(opts = {}) {
|
||||
this.factor = 2;
|
||||
this.jitter = 0;
|
||||
this.attempts = 0;
|
||||
this.ms = opts.min || 100;
|
||||
this.max = opts.max || 10000;
|
||||
}
|
||||
duration() {
|
||||
var ms = this.ms * Math.pow(this.factor, this.attempts++);
|
||||
if (this.jitter) {
|
||||
var rand = Math.random();
|
||||
var deviation = Math.floor(rand * this.jitter * ms);
|
||||
ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
|
||||
}
|
||||
return Math.min(ms, this.max) | 0;
|
||||
}
|
||||
reset() {
|
||||
this.attempts = 0;
|
||||
}
|
||||
}
|
||||
exports.ExponentialBackoff = ExponentialBackoff;
|
||||
//# sourceMappingURL=backoff.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"backoff.js","sourceRoot":"","sources":["../../../src/common/backoff.ts"],"names":[],"mappings":";;;AAYA,MAAa,kBAAkB;IAO7B,YAAY,OAAqC,EAAE;QAJlC,WAAM,GAAW,CAAC,CAAA;QAClB,WAAM,GAAW,CAAC,CAAA;QACnC,aAAQ,GAAW,CAAC,CAAA;QAGlB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,CAAA;QACzB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,KAAK,CAAA;IAC9B,CAAC;IAKD,QAAQ;QACN,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;QACzD,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;YACxB,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;YACnD,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,CAAA;SACxE;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACnC,CAAC;IAKD,KAAK;QACH,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAA;IACnB,CAAC;CACF;AA/BD,gDA+BC"}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
declare function setPrototypeOf(object: any, prototype: any): void;
|
||||
declare function getConstructorName(object: object): string;
|
||||
export { getConstructorName, setPrototypeOf };
|
||||
//# sourceMappingURL=browser-hacks.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"browser-hacks.d.ts","sourceRoot":"","sources":["../../../src/common/browser-hacks.ts"],"names":[],"mappings":"AAAA,iBAAS,cAAc,CAAC,MAAM,KAAA,EAAE,SAAS,KAAA,QAMxC;AAED,iBAAS,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CASlD;AAED,OAAO,EAAC,kBAAkB,EAAE,cAAc,EAAC,CAAA"}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.setPrototypeOf = exports.getConstructorName = void 0;
|
||||
function setPrototypeOf(object, prototype) {
|
||||
Object.setPrototypeOf
|
||||
? Object.setPrototypeOf(object, prototype)
|
||||
:
|
||||
(object.__proto__ = prototype);
|
||||
}
|
||||
exports.setPrototypeOf = setPrototypeOf;
|
||||
function getConstructorName(object) {
|
||||
if (object.constructor.name) {
|
||||
return object.constructor.name;
|
||||
}
|
||||
const constructorString = object.constructor.toString();
|
||||
const functionConstructor = constructorString.match(/^function\s+([^(]*)/);
|
||||
const classConstructor = constructorString.match(/^class\s([^\s]*)/);
|
||||
return functionConstructor ? functionConstructor[1] : classConstructor[1];
|
||||
}
|
||||
exports.getConstructorName = getConstructorName;
|
||||
//# sourceMappingURL=browser-hacks.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"browser-hacks.js","sourceRoot":"","sources":["../../../src/common/browser-hacks.ts"],"names":[],"mappings":";;;AAAA,SAAS,cAAc,CAAC,MAAM,EAAE,SAAS;IAEvC,MAAM,CAAC,cAAc;QACnB,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC;QAC1C,CAAC;YACC,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC,CAAA;AACpC,CAAC;AAa2B,wCAAc;AAX1C,SAAS,kBAAkB,CAAC,MAAc;IACxC,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE;QAC3B,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAA;KAC/B;IAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAA;IACvD,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;IAC1E,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;IACpE,OAAO,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA;AAC3E,CAAC;AAEO,gDAAkB"}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
export interface ConnectionOptions {
|
||||
trace?: boolean | ((id: string, message: string) => void);
|
||||
proxy?: string;
|
||||
proxyAuthorization?: string;
|
||||
authorization?: string;
|
||||
trustedCertificates?: string[];
|
||||
key?: string;
|
||||
passphrase?: string;
|
||||
certificate?: string;
|
||||
timeout: number;
|
||||
connectionTimeout: number;
|
||||
}
|
||||
export declare type ConnectionUserOptions = Partial<ConnectionOptions>;
|
||||
export declare class Connection extends EventEmitter {
|
||||
private _url;
|
||||
private _ws;
|
||||
private _reconnectTimeoutID;
|
||||
private _heartbeatIntervalID;
|
||||
private _retryConnectionBackoff;
|
||||
private _trace;
|
||||
private _config;
|
||||
private _ledger;
|
||||
private _requestManager;
|
||||
private _connectionManager;
|
||||
constructor(url?: string, options?: ConnectionUserOptions);
|
||||
private _onMessage;
|
||||
private get _state();
|
||||
private get _shouldBeConnected();
|
||||
private _clearHeartbeatInterval;
|
||||
private _startHeartbeatInterval;
|
||||
private _heartbeat;
|
||||
private _waitForReady;
|
||||
private _subscribeToLedger;
|
||||
private _onConnectionFailed;
|
||||
isConnected(): boolean;
|
||||
connect(): Promise<void>;
|
||||
disconnect(): Promise<number | undefined>;
|
||||
reconnect(): Promise<void>;
|
||||
getFeeBase(): Promise<number>;
|
||||
getFeeRef(): Promise<number>;
|
||||
getLedgerVersion(): Promise<number>;
|
||||
getReserveBase(): Promise<number>;
|
||||
hasLedgerVersions(lowLedgerVersion: number, highLedgerVersion: number | undefined): Promise<boolean>;
|
||||
hasLedgerVersion(ledgerVersion: number): Promise<boolean>;
|
||||
request(request: any, timeout?: number): Promise<any>;
|
||||
getUrl(): string;
|
||||
}
|
||||
//# sourceMappingURL=connection.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/common/connection.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAA;AAmBnC,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC,CAAA;IACzD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAOD,oBAAY,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AA4Q9D,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,IAAI,CAAQ;IACpB,OAAO,CAAC,GAAG,CAAyB;IACpC,OAAO,CAAC,mBAAmB,CAA8B;IACzD,OAAO,CAAC,oBAAoB,CAA8B;IAC1D,OAAO,CAAC,uBAAuB,CAG7B;IAEF,OAAO,CAAC,MAAM,CAAkD;IAChE,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAAC,kBAAkB,CAA0B;gBAExC,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B;IAgB7D,OAAO,CAAC,UAAU;IA4BlB,OAAO,KAAK,MAAM,GAEjB;IAED,OAAO,KAAK,kBAAkB,GAE7B;IAED,OAAO,CAAC,uBAAuB,CAE9B;IAED,OAAO,CAAC,uBAAuB,CAM9B;IAMD,OAAO,CAAC,UAAU,CAMjB;IAMD,OAAO,CAAC,aAAa;YAYP,kBAAkB;IAoBhC,OAAO,CAAC,mBAAmB,CAyB1B;IAED,WAAW;IAIX,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA0FxB,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAoBnC,SAAS;IAST,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAK7B,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAK5B,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAKnC,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IASjC,iBAAiB,CACrB,gBAAgB,EAAE,MAAM,EACxB,iBAAiB,EAAE,MAAM,GAAG,SAAS,GACpC,OAAO,CAAC,OAAO,CAAC;IAab,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKzD,OAAO,CAAC,OAAO,KAAA,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAqBtD,MAAM,IAAI,MAAM;CAGjB"}
|
||||
+467
@@ -0,0 +1,467 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Connection = void 0;
|
||||
const _ = __importStar(require("lodash"));
|
||||
const events_1 = require("events");
|
||||
const url_1 = require("url");
|
||||
const ws_1 = __importDefault(require("ws"));
|
||||
const rangeset_1 = __importDefault(require("./rangeset"));
|
||||
const errors_1 = require("./errors");
|
||||
const backoff_1 = require("./backoff");
|
||||
const INTENTIONAL_DISCONNECT_CODE = 4000;
|
||||
function createWebSocket(url, config) {
|
||||
const options = {};
|
||||
if (config.proxy != null) {
|
||||
const parsedURL = url_1.parse(url);
|
||||
const parsedProxyURL = url_1.parse(config.proxy);
|
||||
const proxyOverrides = _.omitBy({
|
||||
secureEndpoint: parsedURL.protocol === 'wss:',
|
||||
secureProxy: parsedProxyURL.protocol === 'https:',
|
||||
auth: config.proxyAuthorization,
|
||||
ca: config.trustedCertificates,
|
||||
key: config.key,
|
||||
passphrase: config.passphrase,
|
||||
cert: config.certificate
|
||||
}, (value) => value == null);
|
||||
const proxyOptions = Object.assign({}, parsedProxyURL, proxyOverrides);
|
||||
let HttpsProxyAgent;
|
||||
try {
|
||||
HttpsProxyAgent = require('https-proxy-agent');
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error('"proxy" option is not supported in the browser');
|
||||
}
|
||||
options.agent = new HttpsProxyAgent(proxyOptions);
|
||||
}
|
||||
if (config.authorization != null) {
|
||||
const base64 = Buffer.from(config.authorization).toString('base64');
|
||||
options.headers = { Authorization: `Basic ${base64}` };
|
||||
}
|
||||
const optionsOverrides = _.omitBy({
|
||||
ca: config.trustedCertificates,
|
||||
key: config.key,
|
||||
passphrase: config.passphrase,
|
||||
cert: config.certificate
|
||||
}, (value) => value == null);
|
||||
const websocketOptions = Object.assign({}, options, optionsOverrides);
|
||||
const websocket = new ws_1.default(url, null, websocketOptions);
|
||||
if (typeof websocket.setMaxListeners === 'function') {
|
||||
websocket.setMaxListeners(Infinity);
|
||||
}
|
||||
return websocket;
|
||||
}
|
||||
function websocketSendAsync(ws, message) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ws.send(message, undefined, (error) => {
|
||||
if (error) {
|
||||
reject(new errors_1.DisconnectedError(error.message, error));
|
||||
}
|
||||
else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
class LedgerHistory {
|
||||
constructor() {
|
||||
this.feeBase = null;
|
||||
this.feeRef = null;
|
||||
this.latestVersion = null;
|
||||
this.reserveBase = null;
|
||||
this.availableVersions = new rangeset_1.default();
|
||||
}
|
||||
hasVersion(version) {
|
||||
return this.availableVersions.containsValue(version);
|
||||
}
|
||||
hasVersions(lowVersion, highVersion) {
|
||||
return this.availableVersions.containsRange(lowVersion, highVersion);
|
||||
}
|
||||
update(ledgerMessage) {
|
||||
this.feeBase = ledgerMessage.fee_base;
|
||||
this.feeRef = ledgerMessage.fee_ref;
|
||||
this.latestVersion = ledgerMessage.ledger_index;
|
||||
this.reserveBase = ledgerMessage.reserve_base;
|
||||
if (ledgerMessage.validated_ledgers) {
|
||||
this.availableVersions.reset();
|
||||
this.availableVersions.parseAndAddRanges(ledgerMessage.validated_ledgers);
|
||||
}
|
||||
else {
|
||||
this.availableVersions.addValue(this.latestVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
class ConnectionManager {
|
||||
constructor() {
|
||||
this.promisesAwaitingConnection = [];
|
||||
}
|
||||
resolveAllAwaiting() {
|
||||
this.promisesAwaitingConnection.map(({ resolve }) => resolve());
|
||||
this.promisesAwaitingConnection = [];
|
||||
}
|
||||
rejectAllAwaiting(error) {
|
||||
this.promisesAwaitingConnection.map(({ reject }) => reject(error));
|
||||
this.promisesAwaitingConnection = [];
|
||||
}
|
||||
awaitConnection() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.promisesAwaitingConnection.push({ resolve, reject });
|
||||
});
|
||||
}
|
||||
}
|
||||
class RequestManager {
|
||||
constructor() {
|
||||
this.nextId = 0;
|
||||
this.promisesAwaitingResponse = [];
|
||||
}
|
||||
cancel(id) {
|
||||
const { timer } = this.promisesAwaitingResponse[id];
|
||||
clearTimeout(timer);
|
||||
delete this.promisesAwaitingResponse[id];
|
||||
}
|
||||
resolve(id, data) {
|
||||
const { timer, resolve } = this.promisesAwaitingResponse[id];
|
||||
clearTimeout(timer);
|
||||
resolve(data);
|
||||
delete this.promisesAwaitingResponse[id];
|
||||
}
|
||||
reject(id, error) {
|
||||
const { timer, reject } = this.promisesAwaitingResponse[id];
|
||||
clearTimeout(timer);
|
||||
reject(error);
|
||||
delete this.promisesAwaitingResponse[id];
|
||||
}
|
||||
rejectAll(error) {
|
||||
this.promisesAwaitingResponse.forEach((_, id) => {
|
||||
this.reject(id, error);
|
||||
});
|
||||
}
|
||||
createRequest(data, timeout) {
|
||||
const newId = this.nextId++;
|
||||
const newData = JSON.stringify(Object.assign(Object.assign({}, data), { id: newId }));
|
||||
const timer = setTimeout(() => this.reject(newId, new errors_1.TimeoutError()), timeout);
|
||||
if (timer.unref) {
|
||||
timer.unref();
|
||||
}
|
||||
const newPromise = new Promise((resolve, reject) => {
|
||||
this.promisesAwaitingResponse[newId] = { resolve, reject, timer };
|
||||
});
|
||||
return [newId, newData, newPromise];
|
||||
}
|
||||
handleResponse(data) {
|
||||
if (!Number.isInteger(data.id) || data.id < 0) {
|
||||
throw new errors_1.ResponseFormatError('valid id not found in response', data);
|
||||
}
|
||||
if (!this.promisesAwaitingResponse[data.id]) {
|
||||
return;
|
||||
}
|
||||
if (data.status === 'error') {
|
||||
const error = new errors_1.RippledError(data.error_message || data.error, data);
|
||||
this.reject(data.id, error);
|
||||
return;
|
||||
}
|
||||
if (data.status !== 'success') {
|
||||
const error = new errors_1.ResponseFormatError(`unrecognized status: ${data.status}`, data);
|
||||
this.reject(data.id, error);
|
||||
return;
|
||||
}
|
||||
this.resolve(data.id, data.result);
|
||||
}
|
||||
}
|
||||
class Connection extends events_1.EventEmitter {
|
||||
constructor(url, options = {}) {
|
||||
super();
|
||||
this._ws = null;
|
||||
this._reconnectTimeoutID = null;
|
||||
this._heartbeatIntervalID = null;
|
||||
this._retryConnectionBackoff = new backoff_1.ExponentialBackoff({
|
||||
min: 100,
|
||||
max: 60 * 1000
|
||||
});
|
||||
this._trace = () => { };
|
||||
this._ledger = new LedgerHistory();
|
||||
this._requestManager = new RequestManager();
|
||||
this._connectionManager = new ConnectionManager();
|
||||
this._clearHeartbeatInterval = () => {
|
||||
clearInterval(this._heartbeatIntervalID);
|
||||
};
|
||||
this._startHeartbeatInterval = () => {
|
||||
this._clearHeartbeatInterval();
|
||||
this._heartbeatIntervalID = setInterval(() => this._heartbeat(), this._config.timeout);
|
||||
};
|
||||
this._heartbeat = () => {
|
||||
return this.request({ command: 'ping' }).catch(() => {
|
||||
return this.reconnect().catch((error) => {
|
||||
this.emit('error', 'reconnect', error.message, error);
|
||||
});
|
||||
});
|
||||
};
|
||||
this._onConnectionFailed = (errorOrCode) => {
|
||||
if (this._ws) {
|
||||
this._ws.removeAllListeners();
|
||||
this._ws.on('error', () => {
|
||||
});
|
||||
this._ws.close();
|
||||
this._ws = null;
|
||||
}
|
||||
if (typeof errorOrCode === 'number') {
|
||||
this._connectionManager.rejectAllAwaiting(new errors_1.NotConnectedError(`Connection failed with code ${errorOrCode}.`, {
|
||||
code: errorOrCode
|
||||
}));
|
||||
}
|
||||
else if (errorOrCode && errorOrCode.message) {
|
||||
this._connectionManager.rejectAllAwaiting(new errors_1.NotConnectedError(errorOrCode.message, errorOrCode));
|
||||
}
|
||||
else {
|
||||
this._connectionManager.rejectAllAwaiting(new errors_1.NotConnectedError('Connection failed.'));
|
||||
}
|
||||
};
|
||||
this.setMaxListeners(Infinity);
|
||||
this._url = url;
|
||||
this._config = Object.assign({ timeout: 20 * 1000, connectionTimeout: 5 * 1000 }, options);
|
||||
if (typeof options.trace === 'function') {
|
||||
this._trace = options.trace;
|
||||
}
|
||||
else if (options.trace === true) {
|
||||
this._trace = console.log;
|
||||
}
|
||||
}
|
||||
_onMessage(message) {
|
||||
this._trace('receive', message);
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(message);
|
||||
}
|
||||
catch (error) {
|
||||
this.emit('error', 'badMessage', error.message, message);
|
||||
return;
|
||||
}
|
||||
if (data.type == null && data.error) {
|
||||
this.emit('error', data.error, data.error_message, data);
|
||||
return;
|
||||
}
|
||||
if (data.type) {
|
||||
this.emit(data.type, data);
|
||||
}
|
||||
if (data.type === 'ledgerClosed') {
|
||||
this._ledger.update(data);
|
||||
}
|
||||
if (data.type === 'response') {
|
||||
try {
|
||||
this._requestManager.handleResponse(data);
|
||||
}
|
||||
catch (error) {
|
||||
this.emit('error', 'badMessage', error.message, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
get _state() {
|
||||
return this._ws ? this._ws.readyState : ws_1.default.CLOSED;
|
||||
}
|
||||
get _shouldBeConnected() {
|
||||
return this._ws !== null;
|
||||
}
|
||||
_waitForReady() {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!this._shouldBeConnected) {
|
||||
reject(new errors_1.NotConnectedError());
|
||||
}
|
||||
else if (this._state === ws_1.default.OPEN) {
|
||||
resolve();
|
||||
}
|
||||
else {
|
||||
this.once('connected', () => resolve());
|
||||
}
|
||||
});
|
||||
}
|
||||
_subscribeToLedger() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const data = yield this.request({
|
||||
command: 'subscribe',
|
||||
streams: ['ledger']
|
||||
});
|
||||
if (_.isEmpty(data) || !data.ledger_index) {
|
||||
try {
|
||||
yield this.disconnect();
|
||||
}
|
||||
catch (error) {
|
||||
}
|
||||
finally {
|
||||
throw new errors_1.RippledNotInitializedError('Rippled not initialized');
|
||||
}
|
||||
}
|
||||
this._ledger.update(data);
|
||||
});
|
||||
}
|
||||
isConnected() {
|
||||
return this._state === ws_1.default.OPEN;
|
||||
}
|
||||
connect() {
|
||||
if (this.isConnected()) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (this._state === ws_1.default.CONNECTING) {
|
||||
return this._connectionManager.awaitConnection();
|
||||
}
|
||||
if (!this._url) {
|
||||
return Promise.reject(new errors_1.ConnectionError('Cannot connect because no server was specified'));
|
||||
}
|
||||
if (this._ws) {
|
||||
return Promise.reject(new errors_1.RippleError('Websocket connection never cleaned up.', {
|
||||
state: this._state
|
||||
}));
|
||||
}
|
||||
const connectionTimeoutID = setTimeout(() => {
|
||||
this._onConnectionFailed(new errors_1.ConnectionError(`Error: connect() timed out after ${this._config.connectionTimeout} ms. ` +
|
||||
`If your internet connection is working, the rippled server may be blocked or inaccessible. ` +
|
||||
`You can also try setting the 'connectionTimeout' option in the RippleAPI constructor.`));
|
||||
}, this._config.connectionTimeout);
|
||||
this._ws = createWebSocket(this._url, this._config);
|
||||
this._ws.on('error', this._onConnectionFailed);
|
||||
this._ws.on('error', () => clearTimeout(connectionTimeoutID));
|
||||
this._ws.on('close', this._onConnectionFailed);
|
||||
this._ws.on('close', () => clearTimeout(connectionTimeoutID));
|
||||
this._ws.once('open', () => __awaiter(this, void 0, void 0, function* () {
|
||||
this._ws.removeAllListeners();
|
||||
clearTimeout(connectionTimeoutID);
|
||||
this._ws.on('message', (message) => this._onMessage(message));
|
||||
this._ws.on('error', (error) => this.emit('error', 'websocket', error.message, error));
|
||||
this._ws.once('close', (code) => {
|
||||
this._clearHeartbeatInterval();
|
||||
this._requestManager.rejectAll(new errors_1.DisconnectedError('websocket was closed'));
|
||||
this._ws.removeAllListeners();
|
||||
this._ws = null;
|
||||
this.emit('disconnected', code);
|
||||
if (code !== INTENTIONAL_DISCONNECT_CODE) {
|
||||
const retryTimeout = this._retryConnectionBackoff.duration();
|
||||
this._trace('reconnect', `Retrying connection in ${retryTimeout}ms.`);
|
||||
this.emit('reconnecting', this._retryConnectionBackoff.attempts);
|
||||
this._reconnectTimeoutID = setTimeout(() => {
|
||||
this.reconnect().catch((error) => {
|
||||
this.emit('error', 'reconnect', error.message, error);
|
||||
});
|
||||
}, retryTimeout);
|
||||
}
|
||||
});
|
||||
try {
|
||||
this._retryConnectionBackoff.reset();
|
||||
yield this._subscribeToLedger();
|
||||
this._startHeartbeatInterval();
|
||||
this._connectionManager.resolveAllAwaiting();
|
||||
this.emit('connected');
|
||||
}
|
||||
catch (error) {
|
||||
this._connectionManager.rejectAllAwaiting(error);
|
||||
yield this.disconnect().catch(() => { });
|
||||
}
|
||||
}));
|
||||
return this._connectionManager.awaitConnection();
|
||||
}
|
||||
disconnect() {
|
||||
clearTimeout(this._reconnectTimeoutID);
|
||||
this._reconnectTimeoutID = null;
|
||||
if (this._state === ws_1.default.CLOSED || !this._ws) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
this._ws.once('close', (code) => resolve(code));
|
||||
if (this._state !== ws_1.default.CLOSING) {
|
||||
this._ws.close(INTENTIONAL_DISCONNECT_CODE);
|
||||
}
|
||||
});
|
||||
}
|
||||
reconnect() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
this.emit('reconnect');
|
||||
yield this.disconnect();
|
||||
yield this.connect();
|
||||
});
|
||||
}
|
||||
getFeeBase() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this._waitForReady();
|
||||
return this._ledger.feeBase;
|
||||
});
|
||||
}
|
||||
getFeeRef() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this._waitForReady();
|
||||
return this._ledger.feeRef;
|
||||
});
|
||||
}
|
||||
getLedgerVersion() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this._waitForReady();
|
||||
return this._ledger.latestVersion;
|
||||
});
|
||||
}
|
||||
getReserveBase() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this._waitForReady();
|
||||
return this._ledger.reserveBase;
|
||||
});
|
||||
}
|
||||
hasLedgerVersions(lowLedgerVersion, highLedgerVersion) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!highLedgerVersion) {
|
||||
return this.hasLedgerVersion(lowLedgerVersion);
|
||||
}
|
||||
yield this._waitForReady();
|
||||
return this._ledger.hasVersions(lowLedgerVersion, highLedgerVersion);
|
||||
});
|
||||
}
|
||||
hasLedgerVersion(ledgerVersion) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield this._waitForReady();
|
||||
return this._ledger.hasVersion(ledgerVersion);
|
||||
});
|
||||
}
|
||||
request(request, timeout) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!this._shouldBeConnected) {
|
||||
throw new errors_1.NotConnectedError();
|
||||
}
|
||||
const [id, message, responsePromise] = this._requestManager.createRequest(request, timeout || this._config.timeout);
|
||||
this._trace('send', message);
|
||||
websocketSendAsync(this._ws, message).catch((error) => {
|
||||
this._requestManager.reject(id, error);
|
||||
});
|
||||
return responsePromise;
|
||||
});
|
||||
}
|
||||
getUrl() {
|
||||
return this._url;
|
||||
}
|
||||
}
|
||||
exports.Connection = Connection;
|
||||
//# sourceMappingURL=connection.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+62
@@ -0,0 +1,62 @@
|
||||
declare const AccountFlags: {
|
||||
passwordSpent: number;
|
||||
requireDestinationTag: number;
|
||||
requireAuthorization: number;
|
||||
depositAuth: number;
|
||||
disallowIncomingXRP: number;
|
||||
disableMasterKey: number;
|
||||
noFreeze: number;
|
||||
globalFreeze: number;
|
||||
defaultRipple: number;
|
||||
};
|
||||
export interface Settings {
|
||||
passwordSpent?: boolean;
|
||||
requireDestinationTag?: boolean;
|
||||
requireAuthorization?: boolean;
|
||||
depositAuth?: boolean;
|
||||
disallowIncomingXRP?: boolean;
|
||||
disableMasterKey?: boolean;
|
||||
noFreeze?: boolean;
|
||||
globalFreeze?: boolean;
|
||||
defaultRipple?: boolean;
|
||||
}
|
||||
declare const AccountSetFlags: {
|
||||
requireDestinationTag: number;
|
||||
requireAuthorization: number;
|
||||
depositAuth: number;
|
||||
disallowIncomingXRP: number;
|
||||
disableMasterKey: number;
|
||||
enableTransactionIDTracking: number;
|
||||
noFreeze: number;
|
||||
globalFreeze: number;
|
||||
defaultRipple: number;
|
||||
};
|
||||
declare const AccountFields: {
|
||||
EmailHash: {
|
||||
name: string;
|
||||
encoding: string;
|
||||
length: number;
|
||||
defaults: string;
|
||||
};
|
||||
WalletLocator: {
|
||||
name: string;
|
||||
};
|
||||
MessageKey: {
|
||||
name: string;
|
||||
};
|
||||
Domain: {
|
||||
name: string;
|
||||
encoding: string;
|
||||
};
|
||||
TransferRate: {
|
||||
name: string;
|
||||
defaults: number;
|
||||
shift: number;
|
||||
};
|
||||
TickSize: {
|
||||
name: string;
|
||||
defaults: number;
|
||||
};
|
||||
};
|
||||
export { AccountFields, AccountSetFlags, AccountFlags };
|
||||
//# sourceMappingURL=constants.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"AAgDA,QAAA,MAAM,YAAY;;;;;;;;;;CAUjB,CAAA;AAED,MAAM,WAAW,QAAQ;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,QAAA,MAAM,eAAe;;;;;;;;;;CAUpB,CAAA;AAED,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;CAYlB,CAAA;AAED,OAAO,EAAC,aAAa,EAAE,eAAe,EAAE,YAAY,EAAC,CAAA"}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AccountFlags = exports.AccountSetFlags = exports.AccountFields = void 0;
|
||||
const txflags_1 = require("./txflags");
|
||||
const accountRootFlags = {
|
||||
DefaultRipple: 0x00800000,
|
||||
DepositAuth: 0x01000000,
|
||||
DisableMaster: 0x00100000,
|
||||
DisallowXRP: 0x00080000,
|
||||
GlobalFreeze: 0x00400000,
|
||||
NoFreeze: 0x00200000,
|
||||
PasswordSpent: 0x00010000,
|
||||
RequireAuth: 0x00040000,
|
||||
RequireDestTag: 0x00020000
|
||||
};
|
||||
const AccountFlags = {
|
||||
passwordSpent: accountRootFlags.PasswordSpent,
|
||||
requireDestinationTag: accountRootFlags.RequireDestTag,
|
||||
requireAuthorization: accountRootFlags.RequireAuth,
|
||||
depositAuth: accountRootFlags.DepositAuth,
|
||||
disallowIncomingXRP: accountRootFlags.DisallowXRP,
|
||||
disableMasterKey: accountRootFlags.DisableMaster,
|
||||
noFreeze: accountRootFlags.NoFreeze,
|
||||
globalFreeze: accountRootFlags.GlobalFreeze,
|
||||
defaultRipple: accountRootFlags.DefaultRipple
|
||||
};
|
||||
exports.AccountFlags = AccountFlags;
|
||||
const AccountSetFlags = {
|
||||
requireDestinationTag: txflags_1.txFlagIndices.AccountSet.asfRequireDest,
|
||||
requireAuthorization: txflags_1.txFlagIndices.AccountSet.asfRequireAuth,
|
||||
depositAuth: txflags_1.txFlagIndices.AccountSet.asfDepositAuth,
|
||||
disallowIncomingXRP: txflags_1.txFlagIndices.AccountSet.asfDisallowXRP,
|
||||
disableMasterKey: txflags_1.txFlagIndices.AccountSet.asfDisableMaster,
|
||||
enableTransactionIDTracking: txflags_1.txFlagIndices.AccountSet.asfAccountTxnID,
|
||||
noFreeze: txflags_1.txFlagIndices.AccountSet.asfNoFreeze,
|
||||
globalFreeze: txflags_1.txFlagIndices.AccountSet.asfGlobalFreeze,
|
||||
defaultRipple: txflags_1.txFlagIndices.AccountSet.asfDefaultRipple
|
||||
};
|
||||
exports.AccountSetFlags = AccountSetFlags;
|
||||
const AccountFields = {
|
||||
EmailHash: {
|
||||
name: 'emailHash',
|
||||
encoding: 'hex',
|
||||
length: 32,
|
||||
defaults: '00000000000000000000000000000000'
|
||||
},
|
||||
WalletLocator: { name: 'walletLocator' },
|
||||
MessageKey: { name: 'messageKey' },
|
||||
Domain: { name: 'domain', encoding: 'hex' },
|
||||
TransferRate: { name: 'transferRate', defaults: 0, shift: 9 },
|
||||
TickSize: { name: 'tickSize', defaults: 0 }
|
||||
};
|
||||
exports.AccountFields = AccountFields;
|
||||
//# sourceMappingURL=constants.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AAGvC,MAAM,gBAAgB,GAAG;IAIvB,aAAa,EAAE,UAAU;IAMzB,WAAW,EAAE,UAAU;IAKvB,aAAa,EAAE,UAAU;IAKzB,WAAW,EAAE,UAAU;IAIvB,YAAY,EAAE,UAAU;IAKxB,QAAQ,EAAE,UAAU;IAKpB,aAAa,EAAE,UAAU;IAIzB,WAAW,EAAE,UAAU;IAIvB,cAAc,EAAE,UAAU;CAC3B,CAAA;AAED,MAAM,YAAY,GAAG;IACnB,aAAa,EAAE,gBAAgB,CAAC,aAAa;IAC7C,qBAAqB,EAAE,gBAAgB,CAAC,cAAc;IACtD,oBAAoB,EAAE,gBAAgB,CAAC,WAAW;IAClD,WAAW,EAAE,gBAAgB,CAAC,WAAW;IACzC,mBAAmB,EAAE,gBAAgB,CAAC,WAAW;IACjD,gBAAgB,EAAE,gBAAgB,CAAC,aAAa;IAChD,QAAQ,EAAE,gBAAgB,CAAC,QAAQ;IACnC,YAAY,EAAE,gBAAgB,CAAC,YAAY;IAC3C,aAAa,EAAE,gBAAgB,CAAC,aAAa;CAC9C,CAAA;AAwCuC,oCAAY;AA1BpD,MAAM,eAAe,GAAG;IACtB,qBAAqB,EAAE,uBAAa,CAAC,UAAU,CAAC,cAAc;IAC9D,oBAAoB,EAAE,uBAAa,CAAC,UAAU,CAAC,cAAc;IAC7D,WAAW,EAAE,uBAAa,CAAC,UAAU,CAAC,cAAc;IACpD,mBAAmB,EAAE,uBAAa,CAAC,UAAU,CAAC,cAAc;IAC5D,gBAAgB,EAAE,uBAAa,CAAC,UAAU,CAAC,gBAAgB;IAC3D,2BAA2B,EAAE,uBAAa,CAAC,UAAU,CAAC,eAAe;IACrE,QAAQ,EAAE,uBAAa,CAAC,UAAU,CAAC,WAAW;IAC9C,YAAY,EAAE,uBAAa,CAAC,UAAU,CAAC,eAAe;IACtD,aAAa,EAAE,uBAAa,CAAC,UAAU,CAAC,gBAAgB;CACzD,CAAA;AAgBsB,0CAAe;AAdtC,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE;QACT,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,kCAAkC;KAC7C;IACD,aAAa,EAAE,EAAC,IAAI,EAAE,eAAe,EAAC;IACtC,UAAU,EAAE,EAAC,IAAI,EAAE,YAAY,EAAC;IAChC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAC;IACzC,YAAY,EAAE,EAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAC;IAC3D,QAAQ,EAAE,EAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,EAAC;CAC1C,CAAA;AAEO,sCAAa"}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
declare class RippleError extends Error {
|
||||
name: string;
|
||||
message: string;
|
||||
data?: any;
|
||||
constructor(message?: string, data?: any);
|
||||
toString(): string;
|
||||
inspect(): string;
|
||||
}
|
||||
declare class RippledError extends RippleError {
|
||||
}
|
||||
declare class UnexpectedError extends RippleError {
|
||||
}
|
||||
declare class LedgerVersionError extends RippleError {
|
||||
}
|
||||
declare class ConnectionError extends RippleError {
|
||||
}
|
||||
declare class NotConnectedError extends ConnectionError {
|
||||
}
|
||||
declare class DisconnectedError extends ConnectionError {
|
||||
}
|
||||
declare class RippledNotInitializedError extends ConnectionError {
|
||||
}
|
||||
declare class TimeoutError extends ConnectionError {
|
||||
}
|
||||
declare class ResponseFormatError extends ConnectionError {
|
||||
}
|
||||
declare class ValidationError extends RippleError {
|
||||
}
|
||||
declare class XRPLFaucetError extends RippleError {
|
||||
}
|
||||
declare class NotFoundError extends RippleError {
|
||||
constructor(message?: string);
|
||||
}
|
||||
declare class MissingLedgerHistoryError extends RippleError {
|
||||
constructor(message?: string);
|
||||
}
|
||||
declare class PendingLedgerVersionError extends RippleError {
|
||||
constructor(message?: string);
|
||||
}
|
||||
export { RippleError, UnexpectedError, ConnectionError, RippledError, NotConnectedError, DisconnectedError, RippledNotInitializedError, TimeoutError, ResponseFormatError, ValidationError, NotFoundError, PendingLedgerVersionError, MissingLedgerHistoryError, LedgerVersionError, XRPLFaucetError };
|
||||
//# sourceMappingURL=errors.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/common/errors.ts"],"names":[],"mappings":"AAGA,cAAM,WAAY,SAAQ,KAAK;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,GAAG,CAAA;gBAEE,OAAO,SAAK,EAAE,IAAI,CAAC,EAAE,GAAG;IAWpC,QAAQ;IAYR,OAAO;CAGR;AAED,cAAM,YAAa,SAAQ,WAAW;CAAG;AAEzC,cAAM,eAAgB,SAAQ,WAAW;CAAG;AAE5C,cAAM,kBAAmB,SAAQ,WAAW;CAAG;AAE/C,cAAM,eAAgB,SAAQ,WAAW;CAAG;AAE5C,cAAM,iBAAkB,SAAQ,eAAe;CAAG;AAElD,cAAM,iBAAkB,SAAQ,eAAe;CAAG;AAElD,cAAM,0BAA2B,SAAQ,eAAe;CAAG;AAE3D,cAAM,YAAa,SAAQ,eAAe;CAAG;AAE7C,cAAM,mBAAoB,SAAQ,eAAe;CAAG;AAEpD,cAAM,eAAgB,SAAQ,WAAW;CAAG;AAE5C,cAAM,eAAgB,SAAQ,WAAW;CAAG;AAE5C,cAAM,aAAc,SAAQ,WAAW;gBACzB,OAAO,SAAc;CAGlC;AAED,cAAM,yBAA0B,SAAQ,WAAW;gBACrC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,cAAM,yBAA0B,SAAQ,WAAW;gBACrC,OAAO,CAAC,EAAE,MAAM;CAO7B;AAED,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,EAClB,eAAe,EAChB,CAAA"}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.XRPLFaucetError = exports.LedgerVersionError = exports.MissingLedgerHistoryError = exports.PendingLedgerVersionError = exports.NotFoundError = exports.ValidationError = exports.ResponseFormatError = exports.TimeoutError = exports.RippledNotInitializedError = exports.DisconnectedError = exports.NotConnectedError = exports.RippledError = exports.ConnectionError = exports.UnexpectedError = exports.RippleError = void 0;
|
||||
const util_1 = require("util");
|
||||
const browserHacks = __importStar(require("./browser-hacks"));
|
||||
class RippleError extends Error {
|
||||
constructor(message = '', data) {
|
||||
super(message);
|
||||
this.name = browserHacks.getConstructorName(this);
|
||||
this.message = message;
|
||||
this.data = data;
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
let result = '[' + this.name + '(' + this.message;
|
||||
if (this.data) {
|
||||
result += ', ' + util_1.inspect(this.data);
|
||||
}
|
||||
result += ')]';
|
||||
return result;
|
||||
}
|
||||
inspect() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
exports.RippleError = RippleError;
|
||||
class RippledError extends RippleError {
|
||||
}
|
||||
exports.RippledError = RippledError;
|
||||
class UnexpectedError extends RippleError {
|
||||
}
|
||||
exports.UnexpectedError = UnexpectedError;
|
||||
class LedgerVersionError extends RippleError {
|
||||
}
|
||||
exports.LedgerVersionError = LedgerVersionError;
|
||||
class ConnectionError extends RippleError {
|
||||
}
|
||||
exports.ConnectionError = ConnectionError;
|
||||
class NotConnectedError extends ConnectionError {
|
||||
}
|
||||
exports.NotConnectedError = NotConnectedError;
|
||||
class DisconnectedError extends ConnectionError {
|
||||
}
|
||||
exports.DisconnectedError = DisconnectedError;
|
||||
class RippledNotInitializedError extends ConnectionError {
|
||||
}
|
||||
exports.RippledNotInitializedError = RippledNotInitializedError;
|
||||
class TimeoutError extends ConnectionError {
|
||||
}
|
||||
exports.TimeoutError = TimeoutError;
|
||||
class ResponseFormatError extends ConnectionError {
|
||||
}
|
||||
exports.ResponseFormatError = ResponseFormatError;
|
||||
class ValidationError extends RippleError {
|
||||
}
|
||||
exports.ValidationError = ValidationError;
|
||||
class XRPLFaucetError extends RippleError {
|
||||
}
|
||||
exports.XRPLFaucetError = XRPLFaucetError;
|
||||
class NotFoundError extends RippleError {
|
||||
constructor(message = 'Not found') {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
exports.NotFoundError = NotFoundError;
|
||||
class MissingLedgerHistoryError extends RippleError {
|
||||
constructor(message) {
|
||||
super(message || 'Server is missing ledger history in the specified range');
|
||||
}
|
||||
}
|
||||
exports.MissingLedgerHistoryError = MissingLedgerHistoryError;
|
||||
class PendingLedgerVersionError extends RippleError {
|
||||
constructor(message) {
|
||||
super(message ||
|
||||
"maxLedgerVersion is greater than server's most recent" +
|
||||
' validated ledger');
|
||||
}
|
||||
}
|
||||
exports.PendingLedgerVersionError = PendingLedgerVersionError;
|
||||
//# sourceMappingURL=errors.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/common/errors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAC5B,8DAA+C;AAE/C,MAAM,WAAY,SAAQ,KAAK;IAK7B,YAAY,OAAO,GAAG,EAAE,EAAE,IAAU;QAClC,KAAK,CAAC,OAAO,CAAC,CAAA;QAEd,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAA;QACjD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,KAAK,CAAC,iBAAiB,EAAE;YAC3B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;SAChD;IACH,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,CAAA;QACjD,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,MAAM,IAAI,IAAI,GAAG,cAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;SACpC;QACD,MAAM,IAAI,IAAI,CAAA;QACd,OAAO,MAAM,CAAA;IACf,CAAC;IAKD,OAAO;QACL,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAA;IACxB,CAAC;CACF;AA+CC,kCAAW;AA7Cb,MAAM,YAAa,SAAQ,WAAW;CAAG;AAgDvC,oCAAY;AA9Cd,MAAM,eAAgB,SAAQ,WAAW;CAAG;AA4C1C,0CAAe;AA1CjB,MAAM,kBAAmB,SAAQ,WAAW;CAAG;AAsD7C,gDAAkB;AApDpB,MAAM,eAAgB,SAAQ,WAAW;CAAG;AAyC1C,0CAAe;AAvCjB,MAAM,iBAAkB,SAAQ,eAAe;CAAG;AAyChD,8CAAiB;AAvCnB,MAAM,iBAAkB,SAAQ,eAAe;CAAG;AAwChD,8CAAiB;AAtCnB,MAAM,0BAA2B,SAAQ,eAAe;CAAG;AAuCzD,gEAA0B;AArC5B,MAAM,YAAa,SAAQ,eAAe;CAAG;AAsC3C,oCAAY;AApCd,MAAM,mBAAoB,SAAQ,eAAe;CAAG;AAqClD,kDAAmB;AAnCrB,MAAM,eAAgB,SAAQ,WAAW;CAAG;AAoC1C,0CAAe;AAlCjB,MAAM,eAAgB,SAAQ,WAAW;CAAG;AAuC1C,0CAAe;AArCjB,MAAM,aAAc,SAAQ,WAAW;IACrC,YAAY,OAAO,GAAG,WAAW;QAC/B,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;CACF;AA6BC,sCAAa;AA3Bf,MAAM,yBAA0B,SAAQ,WAAW;IACjD,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,IAAI,yDAAyD,CAAC,CAAA;IAC7E,CAAC;CACF;AAyBC,8DAAyB;AAvB3B,MAAM,yBAA0B,SAAQ,WAAW;IACjD,YAAY,OAAgB;QAC1B,KAAK,CACH,OAAO;YACL,uDAAuD;gBACrD,mBAAmB,CACxB,CAAA;IACH,CAAC;CACF;AAcC,8DAAyB"}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
declare enum HashPrefix {
|
||||
TRANSACTION_ID = 1415073280,
|
||||
TRANSACTION_NODE = 1397638144,
|
||||
INNER_NODE = 1296649728,
|
||||
LEAF_NODE = 1296846336,
|
||||
TRANSACTION_SIGN = 1398036480,
|
||||
TRANSACTION_SIGN_TESTNET = 1937012736,
|
||||
TRANSACTION_MULTISIGN = 1397576704,
|
||||
LEDGER = 1280791040
|
||||
}
|
||||
export default HashPrefix;
|
||||
//# sourceMappingURL=hash-prefix.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"hash-prefix.d.ts","sourceRoot":"","sources":["../../../../src/common/hashes/hash-prefix.ts"],"names":[],"mappings":"AAaA,aAAK,UAAU;IAEb,cAAc,aAAa;IAG3B,gBAAgB,aAAa;IAG7B,UAAU,aAAa;IAGvB,SAAS,aAAa;IAGtB,gBAAgB,aAAa;IAG7B,wBAAwB,aAAa;IAGrC,qBAAqB,aAAa;IAGlC,MAAM,aAAa;CACpB;AAED,eAAe,UAAU,CAAA"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var HashPrefix;
|
||||
(function (HashPrefix) {
|
||||
HashPrefix[HashPrefix["TRANSACTION_ID"] = 1415073280] = "TRANSACTION_ID";
|
||||
HashPrefix[HashPrefix["TRANSACTION_NODE"] = 1397638144] = "TRANSACTION_NODE";
|
||||
HashPrefix[HashPrefix["INNER_NODE"] = 1296649728] = "INNER_NODE";
|
||||
HashPrefix[HashPrefix["LEAF_NODE"] = 1296846336] = "LEAF_NODE";
|
||||
HashPrefix[HashPrefix["TRANSACTION_SIGN"] = 1398036480] = "TRANSACTION_SIGN";
|
||||
HashPrefix[HashPrefix["TRANSACTION_SIGN_TESTNET"] = 1937012736] = "TRANSACTION_SIGN_TESTNET";
|
||||
HashPrefix[HashPrefix["TRANSACTION_MULTISIGN"] = 1397576704] = "TRANSACTION_MULTISIGN";
|
||||
HashPrefix[HashPrefix["LEDGER"] = 1280791040] = "LEDGER";
|
||||
})(HashPrefix || (HashPrefix = {}));
|
||||
exports.default = HashPrefix;
|
||||
//# sourceMappingURL=hash-prefix.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"hash-prefix.js","sourceRoot":"","sources":["../../../../src/common/hashes/hash-prefix.ts"],"names":[],"mappings":";;AAaA,IAAK,UAwBJ;AAxBD,WAAK,UAAU;IAEb,wEAA2B,CAAA;IAG3B,4EAA6B,CAAA;IAG7B,gEAAuB,CAAA;IAGvB,8DAAsB,CAAA;IAGtB,4EAA6B,CAAA;IAG7B,4FAAqC,CAAA;IAGrC,sFAAkC,CAAA;IAGlC,wDAAmB,CAAA;AACrB,CAAC,EAxBI,UAAU,KAAV,UAAU,QAwBd;AAED,kBAAe,UAAU,CAAA"}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
export declare const computeBinaryTransactionHash: (txBlobHex: string) => string;
|
||||
export declare const computeTransactionHash: (txJSON: any) => string;
|
||||
export declare const computeBinaryTransactionSigningHash: (txBlobHex: string) => string;
|
||||
export declare const computeAccountLedgerObjectID: (address: string) => string;
|
||||
export declare const computeSignerListLedgerObjectID: (address: string) => string;
|
||||
export declare const computeOrderID: (address: string, sequence: number) => string;
|
||||
export declare const computeTrustlineHash: (address1: string, address2: string, currency: string) => string;
|
||||
export declare const computeTransactionTreeHash: (transactions: any[]) => string;
|
||||
export declare const computeStateTreeHash: (entries: any[]) => string;
|
||||
export declare const computeLedgerHash: (ledgerHeader: any) => string;
|
||||
export declare const computeEscrowHash: (address: any, sequence: any) => string;
|
||||
export declare const computePaymentChannelHash: (address: any, dstAddress: any, sequence: any) => string;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/hashes/index.ts"],"names":[],"mappings":"AA6DA,eAAO,MAAM,4BAA4B,cAAe,MAAM,KAAG,MAGhE,CAAA;AAED,eAAO,MAAM,sBAAsB,WAAY,GAAG,KAAG,MAEpD,CAAA;AAUD,eAAO,MAAM,mCAAmC,cACnC,MAAM,KAChB,MAGF,CAAA;AAeD,eAAO,MAAM,4BAA4B,YAAa,MAAM,KAAG,MAE9D,CAAA;AAeD,eAAO,MAAM,+BAA+B,YAAa,MAAM,KAAG,MAIjE,CAAA;AAeD,eAAO,MAAM,cAAc,YAAa,MAAM,YAAY,MAAM,KAAG,MAGlE,CAAA;AAED,eAAO,MAAM,oBAAoB,aACrB,MAAM,YACN,MAAM,YACN,MAAM,KACf,MAcF,CAAA;AAED,eAAO,MAAM,0BAA0B,iBAAkB,GAAG,EAAE,KAAG,MAYhE,CAAA;AAED,eAAO,MAAM,oBAAoB,YAAa,GAAG,EAAE,KAAG,MASrD,CAAA;AAGD,eAAO,MAAM,iBAAiB,yBAAmB,MAchD,CAAA;AAED,eAAO,MAAM,iBAAiB,mCAAwB,MAIrD,CAAA;AAED,eAAO,MAAM,yBAAyB,oDAInC,MAOF,CAAA"}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.computePaymentChannelHash = exports.computeEscrowHash = exports.computeLedgerHash = exports.computeStateTreeHash = exports.computeTransactionTreeHash = exports.computeTrustlineHash = exports.computeOrderID = exports.computeSignerListLedgerObjectID = exports.computeAccountLedgerObjectID = exports.computeBinaryTransactionSigningHash = exports.computeTransactionHash = exports.computeBinaryTransactionHash = void 0;
|
||||
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
||||
const ripple_address_codec_1 = require("ripple-address-codec");
|
||||
const sha512Half_1 = __importDefault(require("./sha512Half"));
|
||||
const hash_prefix_1 = __importDefault(require("./hash-prefix"));
|
||||
const shamap_1 = require("./shamap");
|
||||
const ripple_binary_codec_1 = require("ripple-binary-codec");
|
||||
const ledgerspaces_1 = __importDefault(require("./ledgerspaces"));
|
||||
const padLeftZero = (string, length) => {
|
||||
return Array(length - string.length + 1).join('0') + string;
|
||||
};
|
||||
const intToHex = (integer, byteLength) => {
|
||||
return padLeftZero(Number(integer).toString(16), byteLength * 2);
|
||||
};
|
||||
const bytesToHex = (bytes) => {
|
||||
return Buffer.from(bytes).toString('hex');
|
||||
};
|
||||
const bigintToHex = (integerString, byteLength) => {
|
||||
const hex = new bignumber_js_1.default(integerString).toString(16);
|
||||
return padLeftZero(hex, byteLength * 2);
|
||||
};
|
||||
const ledgerSpaceHex = (name) => {
|
||||
return intToHex(ledgerspaces_1.default[name].charCodeAt(0), 2);
|
||||
};
|
||||
const addressToHex = (address) => {
|
||||
return Buffer.from(ripple_address_codec_1.decodeAccountID(address)).toString('hex');
|
||||
};
|
||||
const currencyToHex = (currency) => {
|
||||
if (currency.length === 3) {
|
||||
const bytes = new Array(20 + 1).join('0').split('').map(parseFloat);
|
||||
bytes[12] = currency.charCodeAt(0) & 0xff;
|
||||
bytes[13] = currency.charCodeAt(1) & 0xff;
|
||||
bytes[14] = currency.charCodeAt(2) & 0xff;
|
||||
return bytesToHex(bytes);
|
||||
}
|
||||
return currency;
|
||||
};
|
||||
const addLengthPrefix = (hex) => {
|
||||
const length = hex.length / 2;
|
||||
if (length <= 192) {
|
||||
return bytesToHex([length]) + hex;
|
||||
}
|
||||
else if (length <= 12480) {
|
||||
const x = length - 193;
|
||||
return bytesToHex([193 + (x >>> 8), x & 0xff]) + hex;
|
||||
}
|
||||
else if (length <= 918744) {
|
||||
const x = length - 12481;
|
||||
return bytesToHex([241 + (x >>> 16), (x >>> 8) & 0xff, x & 0xff]) + hex;
|
||||
}
|
||||
throw new Error('Variable integer overflow.');
|
||||
};
|
||||
exports.computeBinaryTransactionHash = (txBlobHex) => {
|
||||
const prefix = hash_prefix_1.default.TRANSACTION_ID.toString(16).toUpperCase();
|
||||
return sha512Half_1.default(prefix + txBlobHex);
|
||||
};
|
||||
exports.computeTransactionHash = (txJSON) => {
|
||||
return exports.computeBinaryTransactionHash(ripple_binary_codec_1.encode(txJSON));
|
||||
};
|
||||
exports.computeBinaryTransactionSigningHash = (txBlobHex) => {
|
||||
const prefix = hash_prefix_1.default.TRANSACTION_SIGN.toString(16).toUpperCase();
|
||||
return sha512Half_1.default(prefix + txBlobHex);
|
||||
};
|
||||
exports.computeAccountLedgerObjectID = (address) => {
|
||||
return sha512Half_1.default(ledgerSpaceHex('account') + addressToHex(address));
|
||||
};
|
||||
exports.computeSignerListLedgerObjectID = (address) => {
|
||||
return sha512Half_1.default(ledgerSpaceHex('signerList') + addressToHex(address) + '00000000');
|
||||
};
|
||||
exports.computeOrderID = (address, sequence) => {
|
||||
const prefix = '00' + intToHex(ledgerspaces_1.default.offer.charCodeAt(0), 1);
|
||||
return sha512Half_1.default(prefix + addressToHex(address) + intToHex(sequence, 4));
|
||||
};
|
||||
exports.computeTrustlineHash = (address1, address2, currency) => {
|
||||
const address1Hex = addressToHex(address1);
|
||||
const address2Hex = addressToHex(address2);
|
||||
const swap = new bignumber_js_1.default(address1Hex, 16).isGreaterThan(new bignumber_js_1.default(address2Hex, 16));
|
||||
const lowAddressHex = swap ? address2Hex : address1Hex;
|
||||
const highAddressHex = swap ? address1Hex : address2Hex;
|
||||
const prefix = ledgerSpaceHex('rippleState');
|
||||
return sha512Half_1.default(prefix + lowAddressHex + highAddressHex + currencyToHex(currency));
|
||||
};
|
||||
exports.computeTransactionTreeHash = (transactions) => {
|
||||
const shamap = new shamap_1.SHAMap();
|
||||
transactions.forEach((txJSON) => {
|
||||
const txBlobHex = ripple_binary_codec_1.encode(txJSON);
|
||||
const metaHex = ripple_binary_codec_1.encode(txJSON.metaData);
|
||||
const txHash = exports.computeBinaryTransactionHash(txBlobHex);
|
||||
const data = addLengthPrefix(txBlobHex) + addLengthPrefix(metaHex);
|
||||
shamap.addItem(txHash, data, shamap_1.NodeType.TRANSACTION_METADATA);
|
||||
});
|
||||
return shamap.hash;
|
||||
};
|
||||
exports.computeStateTreeHash = (entries) => {
|
||||
const shamap = new shamap_1.SHAMap();
|
||||
entries.forEach((ledgerEntry) => {
|
||||
const data = ripple_binary_codec_1.encode(ledgerEntry);
|
||||
shamap.addItem(ledgerEntry.index, data, shamap_1.NodeType.ACCOUNT_STATE);
|
||||
});
|
||||
return shamap.hash;
|
||||
};
|
||||
exports.computeLedgerHash = (ledgerHeader) => {
|
||||
const prefix = hash_prefix_1.default.LEDGER.toString(16).toUpperCase();
|
||||
return sha512Half_1.default(prefix +
|
||||
intToHex(ledgerHeader.ledger_index, 4) +
|
||||
bigintToHex(ledgerHeader.total_coins, 8) +
|
||||
ledgerHeader.parent_hash +
|
||||
ledgerHeader.transaction_hash +
|
||||
ledgerHeader.account_hash +
|
||||
intToHex(ledgerHeader.parent_close_time, 4) +
|
||||
intToHex(ledgerHeader.close_time, 4) +
|
||||
intToHex(ledgerHeader.close_time_resolution, 1) +
|
||||
intToHex(ledgerHeader.close_flags, 1));
|
||||
};
|
||||
exports.computeEscrowHash = (address, sequence) => {
|
||||
return sha512Half_1.default(ledgerSpaceHex('escrow') + addressToHex(address) + intToHex(sequence, 4));
|
||||
};
|
||||
exports.computePaymentChannelHash = (address, dstAddress, sequence) => {
|
||||
return sha512Half_1.default(ledgerSpaceHex('paychan') +
|
||||
addressToHex(address) +
|
||||
addressToHex(dstAddress) +
|
||||
intToHex(sequence, 4));
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+21
@@ -0,0 +1,21 @@
|
||||
declare const _default: {
|
||||
account: string;
|
||||
dirNode: string;
|
||||
generatorMap: string;
|
||||
rippleState: string;
|
||||
offer: string;
|
||||
ownerDir: string;
|
||||
bookDir: string;
|
||||
contract: string;
|
||||
skipList: string;
|
||||
escrow: string;
|
||||
amendment: string;
|
||||
feeSettings: string;
|
||||
ticket: string;
|
||||
signerList: string;
|
||||
paychan: string;
|
||||
check: string;
|
||||
depositPreauth: string;
|
||||
};
|
||||
export default _default;
|
||||
//# sourceMappingURL=ledgerspaces.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ledgerspaces.d.ts","sourceRoot":"","sources":["../../../../src/common/hashes/ledgerspaces.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,wBAkBC"}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = {
|
||||
account: 'a',
|
||||
dirNode: 'd',
|
||||
generatorMap: 'g',
|
||||
rippleState: 'r',
|
||||
offer: 'o',
|
||||
ownerDir: 'O',
|
||||
bookDir: 'B',
|
||||
contract: 'c',
|
||||
skipList: 's',
|
||||
escrow: 'u',
|
||||
amendment: 'f',
|
||||
feeSettings: 'e',
|
||||
ticket: 'T',
|
||||
signerList: 'S',
|
||||
paychan: 'x',
|
||||
check: 'C',
|
||||
depositPreauth: 'p'
|
||||
};
|
||||
//# sourceMappingURL=ledgerspaces.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ledgerspaces.js","sourceRoot":"","sources":["../../../../src/common/hashes/ledgerspaces.ts"],"names":[],"mappings":";;AAUA,kBAAe;IACb,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;IACZ,YAAY,EAAE,GAAG;IACjB,WAAW,EAAE,GAAG;IAChB,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,GAAG;IACZ,QAAQ,EAAE,GAAG;IACb,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,GAAG;IACX,SAAS,EAAE,GAAG;IACd,WAAW,EAAE,GAAG;IAChB,MAAM,EAAE,GAAG;IACX,UAAU,EAAE,GAAG;IACf,OAAO,EAAE,GAAG;IACZ,KAAK,EAAE,GAAG;IACV,cAAc,EAAE,GAAG;CACpB,CAAA"}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
declare const sha512Half: (hex: string) => string;
|
||||
export default sha512Half;
|
||||
//# sourceMappingURL=sha512Half.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sha512Half.d.ts","sourceRoot":"","sources":["../../../../src/common/hashes/sha512Half.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,UAAU,QAAS,MAAM,KAAG,MAMjC,CAAA;AAED,eAAe,UAAU,CAAA"}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const crypto_1 = require("crypto");
|
||||
const sha512Half = (hex) => {
|
||||
return crypto_1.createHash('sha512')
|
||||
.update(Buffer.from(hex, 'hex'))
|
||||
.digest('hex')
|
||||
.toUpperCase()
|
||||
.slice(0, 64);
|
||||
};
|
||||
exports.default = sha512Half;
|
||||
//# sourceMappingURL=sha512Half.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sha512Half.js","sourceRoot":"","sources":["../../../../src/common/hashes/sha512Half.ts"],"names":[],"mappings":";;AAAA,mCAAiC;AAEjC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAU,EAAE;IACzC,OAAO,mBAAU,CAAC,QAAQ,CAAC;SACxB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAC/B,MAAM,CAAC,KAAK,CAAC;SACb,WAAW,EAAE;SACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AACjB,CAAC,CAAA;AAED,kBAAe,UAAU,CAAA"}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
export declare enum NodeType {
|
||||
INNER = 1,
|
||||
TRANSACTION_NO_METADATA = 2,
|
||||
TRANSACTION_METADATA = 3,
|
||||
ACCOUNT_STATE = 4
|
||||
}
|
||||
export declare abstract class Node {
|
||||
constructor();
|
||||
addItem(_tag: string, _node: Node): void;
|
||||
get hash(): string | void;
|
||||
}
|
||||
export declare class InnerNode extends Node {
|
||||
leaves: {
|
||||
[slot: number]: Node;
|
||||
};
|
||||
type: NodeType;
|
||||
depth: number;
|
||||
empty: boolean;
|
||||
constructor(depth?: number);
|
||||
addItem(tag: string, node: Node): void;
|
||||
setNode(slot: number, node: Node): void;
|
||||
getNode(slot: number): Node;
|
||||
get hash(): string;
|
||||
}
|
||||
export declare class Leaf extends Node {
|
||||
tag: string;
|
||||
type: NodeType;
|
||||
data: string;
|
||||
constructor(tag: string, data: string, type: NodeType);
|
||||
get hash(): string | void;
|
||||
}
|
||||
export declare class SHAMap {
|
||||
root: InnerNode;
|
||||
constructor();
|
||||
addItem(tag: string, data: string, type: NodeType): void;
|
||||
get hash(): string;
|
||||
}
|
||||
//# sourceMappingURL=shamap.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"shamap.d.ts","sourceRoot":"","sources":["../../../../src/common/hashes/shamap.ts"],"names":[],"mappings":"AAKA,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,uBAAuB,IAAI;IAC3B,oBAAoB,IAAI;IACxB,aAAa,IAAI;CAClB;AAED,8BAAsB,IAAI;;IAQjB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI;IAK/C,IAAW,IAAI,IAAI,MAAM,GAAG,IAAI,CAE/B;CACF;AAED,qBAAa,SAAU,SAAQ,IAAI;IAC1B,MAAM,EAAE;QAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAC,CAAA;IAC9B,IAAI,EAAE,QAAQ,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;gBAOF,KAAK,GAAE,MAAU;IAc7B,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI;IAqCtC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI;IAavC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOlC,IAAW,IAAI,IAAI,MAAM,CAQxB;CACF;AAED,qBAAa,IAAK,SAAQ,IAAI;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;gBASA,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ;IAO5D,IAAW,IAAI,IAAI,MAAM,GAAG,IAAI,CAiB/B;CACF;AAED,qBAAa,MAAM;IACV,IAAI,EAAE,SAAS,CAAA;;IAUf,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI;IAI/D,IAAW,IAAI,IAAI,MAAM,CAExB;CACF"}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SHAMap = exports.Leaf = exports.InnerNode = exports.Node = exports.NodeType = void 0;
|
||||
const hash_prefix_1 = __importDefault(require("./hash-prefix"));
|
||||
const sha512Half_1 = __importDefault(require("./sha512Half"));
|
||||
const HEX_ZERO = '0000000000000000000000000000000000000000000000000000000000000000';
|
||||
var NodeType;
|
||||
(function (NodeType) {
|
||||
NodeType[NodeType["INNER"] = 1] = "INNER";
|
||||
NodeType[NodeType["TRANSACTION_NO_METADATA"] = 2] = "TRANSACTION_NO_METADATA";
|
||||
NodeType[NodeType["TRANSACTION_METADATA"] = 3] = "TRANSACTION_METADATA";
|
||||
NodeType[NodeType["ACCOUNT_STATE"] = 4] = "ACCOUNT_STATE";
|
||||
})(NodeType = exports.NodeType || (exports.NodeType = {}));
|
||||
class Node {
|
||||
constructor() { }
|
||||
addItem(_tag, _node) {
|
||||
throw new Error('Called unimplemented virtual method SHAMapTreeNode#addItem.');
|
||||
}
|
||||
get hash() {
|
||||
throw new Error('Called unimplemented virtual method SHAMapTreeNode#hash.');
|
||||
}
|
||||
}
|
||||
exports.Node = Node;
|
||||
class InnerNode extends Node {
|
||||
constructor(depth = 0) {
|
||||
super();
|
||||
this.leaves = {};
|
||||
this.type = NodeType.INNER;
|
||||
this.depth = depth;
|
||||
this.empty = true;
|
||||
}
|
||||
addItem(tag, node) {
|
||||
const existingNode = this.getNode(parseInt(tag[this.depth], 16));
|
||||
if (existingNode) {
|
||||
if (existingNode instanceof InnerNode) {
|
||||
existingNode.addItem(tag, node);
|
||||
}
|
||||
else if (existingNode instanceof Leaf) {
|
||||
if (existingNode.tag === tag) {
|
||||
throw new Error('Tried to add a node to a SHAMap that was already in there.');
|
||||
}
|
||||
else {
|
||||
const newInnerNode = new InnerNode(this.depth + 1);
|
||||
newInnerNode.addItem(existingNode.tag, existingNode);
|
||||
newInnerNode.addItem(tag, node);
|
||||
this.setNode(parseInt(tag[this.depth], 16), newInnerNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.setNode(parseInt(tag[this.depth], 16), node);
|
||||
}
|
||||
}
|
||||
setNode(slot, node) {
|
||||
if (slot < 0 || slot > 15) {
|
||||
throw new Error('Invalid slot: slot must be between 0-15.');
|
||||
}
|
||||
this.leaves[slot] = node;
|
||||
this.empty = false;
|
||||
}
|
||||
getNode(slot) {
|
||||
if (slot < 0 || slot > 15) {
|
||||
throw new Error('Invalid slot: slot must be between 0-15.');
|
||||
}
|
||||
return this.leaves[slot];
|
||||
}
|
||||
get hash() {
|
||||
if (this.empty)
|
||||
return HEX_ZERO;
|
||||
let hex = '';
|
||||
for (let i = 0; i < 16; i++) {
|
||||
hex += this.leaves[i] ? this.leaves[i].hash : HEX_ZERO;
|
||||
}
|
||||
const prefix = hash_prefix_1.default.INNER_NODE.toString(16);
|
||||
return sha512Half_1.default(prefix + hex);
|
||||
}
|
||||
}
|
||||
exports.InnerNode = InnerNode;
|
||||
class Leaf extends Node {
|
||||
constructor(tag, data, type) {
|
||||
super();
|
||||
this.tag = tag;
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
get hash() {
|
||||
switch (this.type) {
|
||||
case NodeType.ACCOUNT_STATE: {
|
||||
const leafPrefix = hash_prefix_1.default.LEAF_NODE.toString(16);
|
||||
return sha512Half_1.default(leafPrefix + this.data + this.tag);
|
||||
}
|
||||
case NodeType.TRANSACTION_NO_METADATA: {
|
||||
const txIDPrefix = hash_prefix_1.default.TRANSACTION_ID.toString(16);
|
||||
return sha512Half_1.default(txIDPrefix + this.data);
|
||||
}
|
||||
case NodeType.TRANSACTION_METADATA: {
|
||||
const txNodePrefix = hash_prefix_1.default.TRANSACTION_NODE.toString(16);
|
||||
return sha512Half_1.default(txNodePrefix + this.data + this.tag);
|
||||
}
|
||||
default:
|
||||
throw new Error('Tried to hash a SHAMap node of unknown type.');
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Leaf = Leaf;
|
||||
class SHAMap {
|
||||
constructor() {
|
||||
this.root = new InnerNode(0);
|
||||
}
|
||||
addItem(tag, data, type) {
|
||||
this.root.addItem(tag, new Leaf(tag, data, type));
|
||||
}
|
||||
get hash() {
|
||||
return this.root.hash;
|
||||
}
|
||||
}
|
||||
exports.SHAMap = SHAMap;
|
||||
//# sourceMappingURL=shamap.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"shamap.js","sourceRoot":"","sources":["../../../../src/common/hashes/shamap.ts"],"names":[],"mappings":"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"}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import * as constants from './constants';
|
||||
import * as errors from './errors';
|
||||
import * as validate from './validate';
|
||||
import * as serverInfo from './serverinfo';
|
||||
export declare function ensureClassicAddress(account: string): string;
|
||||
export { constants, errors, validate, serverInfo };
|
||||
export { dropsToXrp, xrpToDrops, toRippledAmount, removeUndefined, convertKeysFromSnakeCaseToCamelCase, iso8601ToRippleTime, rippleTimeToISO8601 } from './utils';
|
||||
export { Connection } from './connection';
|
||||
export { txFlags } from './txflags';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAA;AACtC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAA;AAG1C,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAkB5D;AAED,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAC,CAAA;AAChD,OAAO,EACL,UAAU,EACV,UAAU,EACV,eAAe,EACf,eAAe,EACf,mCAAmC,EACnC,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAA;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA"}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.serverInfo = exports.validate = exports.errors = exports.constants = exports.ensureClassicAddress = void 0;
|
||||
const constants = __importStar(require("./constants"));
|
||||
exports.constants = constants;
|
||||
const errors = __importStar(require("./errors"));
|
||||
exports.errors = errors;
|
||||
const validate = __importStar(require("./validate"));
|
||||
exports.validate = validate;
|
||||
const serverInfo = __importStar(require("./serverinfo"));
|
||||
exports.serverInfo = serverInfo;
|
||||
const ripple_address_codec_1 = require("ripple-address-codec");
|
||||
function ensureClassicAddress(account) {
|
||||
if (ripple_address_codec_1.isValidXAddress(account)) {
|
||||
const { classicAddress, tag } = ripple_address_codec_1.xAddressToClassicAddress(account);
|
||||
if (tag !== false) {
|
||||
throw new Error('This command does not support the use of a tag. Use an address without a tag.');
|
||||
}
|
||||
return classicAddress;
|
||||
}
|
||||
else {
|
||||
return account;
|
||||
}
|
||||
}
|
||||
exports.ensureClassicAddress = ensureClassicAddress;
|
||||
var utils_1 = require("./utils");
|
||||
Object.defineProperty(exports, "dropsToXrp", { enumerable: true, get: function () { return utils_1.dropsToXrp; } });
|
||||
Object.defineProperty(exports, "xrpToDrops", { enumerable: true, get: function () { return utils_1.xrpToDrops; } });
|
||||
Object.defineProperty(exports, "toRippledAmount", { enumerable: true, get: function () { return utils_1.toRippledAmount; } });
|
||||
Object.defineProperty(exports, "removeUndefined", { enumerable: true, get: function () { return utils_1.removeUndefined; } });
|
||||
Object.defineProperty(exports, "convertKeysFromSnakeCaseToCamelCase", { enumerable: true, get: function () { return utils_1.convertKeysFromSnakeCaseToCamelCase; } });
|
||||
Object.defineProperty(exports, "iso8601ToRippleTime", { enumerable: true, get: function () { return utils_1.iso8601ToRippleTime; } });
|
||||
Object.defineProperty(exports, "rippleTimeToISO8601", { enumerable: true, get: function () { return utils_1.rippleTimeToISO8601; } });
|
||||
var connection_1 = require("./connection");
|
||||
Object.defineProperty(exports, "Connection", { enumerable: true, get: function () { return connection_1.Connection; } });
|
||||
var txflags_1 = require("./txflags");
|
||||
Object.defineProperty(exports, "txFlags", { enumerable: true, get: function () { return txflags_1.txFlags; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AA0BhC,8BAAS;AAzBjB,iDAAkC;AAyBf,wBAAM;AAxBzB,qDAAsC;AAwBX,4BAAQ;AAvBnC,yDAA0C;AAuBL,gCAAU;AAtB/C,+DAA8E;AAE9E,SAAgB,oBAAoB,CAAC,OAAe;IAClD,IAAI,sCAAe,CAAC,OAAO,CAAC,EAAE;QAC5B,MAAM,EAAC,cAAc,EAAE,GAAG,EAAC,GAAG,+CAAwB,CAAC,OAAO,CAAC,CAAA;QAK/D,IAAI,GAAG,KAAK,KAAK,EAAE;YACjB,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAA;SACF;QAGD,OAAO,cAAc,CAAA;KACtB;SAAM;QACL,OAAO,OAAO,CAAA;KACf;AACH,CAAC;AAlBD,oDAkBC;AAGD,iCAQgB;AAPd,mGAAA,UAAU,OAAA;AACV,mGAAA,UAAU,OAAA;AACV,wGAAA,eAAe,OAAA;AACf,wGAAA,eAAe,OAAA;AACf,4HAAA,mCAAmC,OAAA;AACnC,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AAErB,2CAAuC;AAA/B,wGAAA,UAAU,OAAA;AAClB,qCAAiC;AAAzB,kGAAA,OAAO,OAAA"}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
declare class RangeSet {
|
||||
ranges: Array<[number, number]>;
|
||||
constructor();
|
||||
reset(): void;
|
||||
serialize(): string;
|
||||
addRange(start: number, end: number): void;
|
||||
addValue(value: number): void;
|
||||
parseAndAddRanges(rangesString: string): void;
|
||||
containsRange(start: number, end: number): boolean;
|
||||
containsValue(value: number): boolean;
|
||||
}
|
||||
export default RangeSet;
|
||||
//# sourceMappingURL=rangeset.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"rangeset.d.ts","sourceRoot":"","sources":["../../../src/common/rangeset.ts"],"names":[],"mappings":"AAmBA,cAAM,QAAQ;IACZ,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;;IAM/B,KAAK;IAIL,SAAS;IAMT,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAKnC,QAAQ,CAAC,KAAK,EAAE,MAAM;IAItB,iBAAiB,CAAC,YAAY,EAAE,MAAM;IAQtC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAIxC,aAAa,CAAC,KAAK,EAAE,MAAM;CAG5B;AAED,eAAe,QAAQ,CAAA"}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const _ = __importStar(require("lodash"));
|
||||
const assert = __importStar(require("assert"));
|
||||
function mergeIntervals(intervals) {
|
||||
const stack = [[-Infinity, -Infinity]];
|
||||
_.sortBy(intervals, (x) => x[0]).forEach((interval) => {
|
||||
const lastInterval = stack.pop();
|
||||
if (interval[0] <= lastInterval[1] + 1) {
|
||||
stack.push([lastInterval[0], Math.max(interval[1], lastInterval[1])]);
|
||||
}
|
||||
else {
|
||||
stack.push(lastInterval);
|
||||
stack.push(interval);
|
||||
}
|
||||
});
|
||||
return stack.slice(1);
|
||||
}
|
||||
class RangeSet {
|
||||
constructor() {
|
||||
this.reset();
|
||||
}
|
||||
reset() {
|
||||
this.ranges = [];
|
||||
}
|
||||
serialize() {
|
||||
return this.ranges
|
||||
.map((range) => range[0].toString() + '-' + range[1].toString())
|
||||
.join(',');
|
||||
}
|
||||
addRange(start, end) {
|
||||
assert.ok(start <= end, `invalid range ${start} <= ${end}`);
|
||||
this.ranges = mergeIntervals(this.ranges.concat([[start, end]]));
|
||||
}
|
||||
addValue(value) {
|
||||
this.addRange(value, value);
|
||||
}
|
||||
parseAndAddRanges(rangesString) {
|
||||
const rangeStrings = rangesString.split(',');
|
||||
rangeStrings.forEach((rangeString) => {
|
||||
const range = rangeString.split('-').map(Number);
|
||||
this.addRange(range[0], range.length === 1 ? range[0] : range[1]);
|
||||
});
|
||||
}
|
||||
containsRange(start, end) {
|
||||
return this.ranges.some((range) => range[0] <= start && range[1] >= end);
|
||||
}
|
||||
containsValue(value) {
|
||||
return this.containsRange(value, value);
|
||||
}
|
||||
}
|
||||
exports.default = RangeSet;
|
||||
//# sourceMappingURL=rangeset.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"rangeset.js","sourceRoot":"","sources":["../../../src/common/rangeset.ts"],"names":[],"mappings":"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"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { isValidSecret } from './utils';
|
||||
declare function schemaValidate(schemaName: string, object: any): void;
|
||||
declare function isValidAddress(address: string): boolean;
|
||||
export { schemaValidate, isValidSecret, isValidAddress };
|
||||
//# sourceMappingURL=schema-validator.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../../src/common/schema-validator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAA;AAkKrC,iBAAS,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI,CAU7D;AAED,iBAAS,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,OAAO,EAAC,cAAc,EAAE,aAAa,EAAE,cAAc,EAAC,CAAA"}
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isValidAddress = exports.isValidSecret = exports.schemaValidate = void 0;
|
||||
const _ = __importStar(require("lodash"));
|
||||
const assert = __importStar(require("assert"));
|
||||
const { Validator } = require('jsonschema');
|
||||
const errors_1 = require("./errors");
|
||||
const ripple_address_codec_1 = require("ripple-address-codec");
|
||||
const utils_1 = require("./utils");
|
||||
Object.defineProperty(exports, "isValidSecret", { enumerable: true, get: function () { return utils_1.isValidSecret; } });
|
||||
function loadSchemas() {
|
||||
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();
|
||||
validator.customFormats.xAddress = function (instance) {
|
||||
if (instance == null) {
|
||||
return true;
|
||||
}
|
||||
return ripple_address_codec_1.isValidXAddress(instance);
|
||||
};
|
||||
validator.customFormats.classicAddress = function (instance) {
|
||||
if (instance == null) {
|
||||
return true;
|
||||
}
|
||||
return isValidAddress(instance);
|
||||
};
|
||||
validator.customFormats.secret = function (instance) {
|
||||
if (instance == null) {
|
||||
return true;
|
||||
}
|
||||
return utils_1.isValidSecret(instance);
|
||||
};
|
||||
schemas.forEach((schema) => validator.addSchema(schema, '/' + schema.title));
|
||||
return validator;
|
||||
}
|
||||
const schemaValidator = loadSchemas();
|
||||
function schemaValidate(schemaName, object) {
|
||||
const schema = schemaValidator.getSchema('/' + schemaName);
|
||||
if (schema == null) {
|
||||
throw new errors_1.ValidationError('no schema for ' + schemaName);
|
||||
}
|
||||
const result = schemaValidator.validate(object, schema);
|
||||
if (!result.valid) {
|
||||
throw new errors_1.ValidationError(result.errors.join());
|
||||
}
|
||||
}
|
||||
exports.schemaValidate = schemaValidate;
|
||||
function isValidAddress(address) {
|
||||
return ripple_address_codec_1.isValidXAddress(address) || ripple_address_codec_1.isValidClassicAddress(address);
|
||||
}
|
||||
exports.isValidAddress = isValidAddress;
|
||||
//# sourceMappingURL=schema-validator.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+69
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"$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
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"$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
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"$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
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"$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
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"$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
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$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 `RippleAPI` constructor's `feeCushion`."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"$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
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"$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
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"$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
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"$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
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
Generated
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
Generated
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"$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"]}
|
||||
}
|
||||
]
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$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"}
|
||||
]
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$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
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "amount",
|
||||
"link": "amount",
|
||||
"description": "An Amount on the XRP Ledger",
|
||||
"allOf": [
|
||||
{"$ref": "amountbase"},
|
||||
{"required": ["value"]}
|
||||
]
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"$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"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"$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]*$"
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"$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}$"
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"$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)$"
|
||||
}
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"$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
|
||||
}
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "destinationAdjustment",
|
||||
"type": "object",
|
||||
"oneOf": [
|
||||
{"$ref": "destinationExactAdjustment"},
|
||||
{"$ref": "minAdjustment"}
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user