@bithomp/xrpl-api 2.7.15 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/errors/index.d.ts +2 -2
- package/lib/common/errors/index.js +3 -3
- package/lib/common/errors/validation_error.d.ts +2 -2
- package/lib/common/errors/validation_error.js +2 -2
- package/lib/common/errors/xrpl_api_error.d.ts +9 -0
- package/lib/common/errors/xrpl_api_error.js +28 -0
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.js +17 -1
- package/lib/ledger/account_info.js +7 -0
- package/lib/ledger/account_offers.d.ts +1 -1
- package/lib/ledger/ledger.d.ts +1 -1
- package/lib/ledger/transaction.d.ts +3 -3
- package/lib/ledger/transaction.js +4 -4
- package/lib/models/account_info.d.ts +1 -1
- package/lib/models/account_nfts.js +2 -1
- package/lib/models/account_object.d.ts +1 -1
- package/lib/models/account_offers.d.ts +9 -0
- package/lib/models/account_offers.js +2 -0
- package/lib/models/account_uritokens.d.ts +1 -1
- package/lib/models/path_find.d.ts +11 -0
- package/lib/models/path_find.js +2 -0
- package/lib/models/transaction.d.ts +1 -1
- package/lib/models/vl.js +1 -1
- package/lib/parse/index.d.ts +1 -0
- package/lib/parse/index.js +2 -1
- package/lib/parse/ledger/account-order.d.ts +1 -1
- package/lib/parse/ledger/account-order.js +1 -1
- package/lib/parse/ledger/account-trustline.d.ts +1 -1
- package/lib/parse/ledger/amount.d.ts +1 -1
- package/lib/parse/ledger/currency-amount.d.ts +1 -1
- package/lib/parse/ledger/emit_details.d.ts +1 -1
- package/lib/parse/ledger/import.d.ts +1 -1
- package/lib/parse/ledger/index.d.ts +1 -1
- package/lib/parse/ledger/index.js +2 -2
- package/lib/parse/ledger/ledger.d.ts +1 -1
- package/lib/parse/ledger/memos.d.ts +3 -2
- package/lib/parse/ledger/memos.js +12 -1
- package/lib/parse/ledger/nftoken-flags.d.ts +1 -1
- package/lib/parse/ledger/nftoken-flags.js +1 -1
- package/lib/parse/ledger/nftoken-offer-flags.d.ts +1 -1
- package/lib/parse/ledger/nftoken-offer-flags.js +1 -1
- package/lib/parse/ledger/orderbook-order.d.ts +7 -2
- package/lib/parse/ledger/orderbook-order.js +1 -1
- package/lib/parse/ledger/pathfind.d.ts +3 -3
- package/lib/parse/ledger/ripple-amount.d.ts +1 -1
- package/lib/parse/ledger/uritoken-flags.d.ts +1 -1
- package/lib/parse/ledger/uritoken-flags.js +1 -1
- package/lib/parse/outcome/balance_changes.js +1 -1
- package/lib/parse/outcome/channel_changes.js +1 -1
- package/lib/parse/outcome/escrow_changes.d.ts +1 -1
- package/lib/parse/outcome/escrow_changes.js +3 -4
- package/lib/parse/outcome/locked_balance_changes.js +1 -1
- package/lib/parse/outcome/orderbook_changes.js +1 -1
- package/lib/parse/outcome/unl_report_changes.js +1 -1
- package/lib/parse/outcome.d.ts +1 -1
- package/lib/parse/specification/account-delete.d.ts +1 -1
- package/lib/parse/specification/account-delete.js +13 -7
- package/lib/parse/specification/amendment.d.ts +1 -1
- package/lib/parse/specification/amendment.js +2 -5
- package/lib/parse/specification/check-cancel.d.ts +1 -1
- package/lib/parse/specification/check-cancel.js +2 -5
- package/lib/parse/specification/check-cash.d.ts +1 -1
- package/lib/parse/specification/check-cash.js +2 -2
- package/lib/parse/specification/check-create.d.ts +1 -1
- package/lib/parse/specification/check-create.js +13 -4
- package/lib/parse/specification/deposit-preauth.d.ts +1 -1
- package/lib/parse/specification/deposit-preauth.js +2 -5
- package/lib/parse/specification/escrow-cancel.d.ts +1 -1
- package/lib/parse/specification/escrow-cancel.js +2 -5
- package/lib/parse/specification/escrow-create.d.ts +1 -1
- package/lib/parse/specification/escrow-create.js +2 -5
- package/lib/parse/specification/escrow-finish.d.ts +1 -1
- package/lib/parse/specification/escrow-finish.js +2 -5
- package/lib/parse/specification/fee-update.d.ts +1 -1
- package/lib/parse/specification/fee-update.js +2 -2
- package/lib/parse/specification/import.d.ts +1 -1
- package/lib/parse/specification/import.js +2 -5
- package/lib/parse/specification/invoke.d.ts +1 -1
- package/lib/parse/specification/invoke.js +2 -5
- package/lib/parse/specification/nftoken-accept-offer.d.ts +1 -1
- package/lib/parse/specification/nftoken-accept-offer.js +2 -5
- package/lib/parse/specification/nftoken-burn.d.ts +1 -1
- package/lib/parse/specification/nftoken-burn.js +2 -5
- package/lib/parse/specification/nftoken-cancel-offer.d.ts +1 -1
- package/lib/parse/specification/nftoken-cancel-offer.js +2 -5
- package/lib/parse/specification/nftoken-create-offer.d.ts +1 -1
- package/lib/parse/specification/nftoken-create-offer.js +12 -3
- package/lib/parse/specification/nftoken-mint.d.ts +1 -1
- package/lib/parse/specification/nftoken-mint.js +2 -2
- package/lib/parse/specification/offer-cancel.d.ts +1 -1
- package/lib/parse/specification/offer-cancel.js +2 -5
- package/lib/parse/specification/offer-create.d.ts +1 -1
- package/lib/parse/specification/offer-create.js +2 -2
- package/lib/parse/specification/payment-channel-claim.d.ts +1 -1
- package/lib/parse/specification/payment-channel-claim.js +2 -2
- package/lib/parse/specification/payment-channel-create.d.ts +1 -1
- package/lib/parse/specification/payment-channel-create.js +13 -5
- package/lib/parse/specification/payment-channel-fund.d.ts +1 -1
- package/lib/parse/specification/payment-channel-fund.js +2 -2
- package/lib/parse/specification/payment.d.ts +1 -1
- package/lib/parse/specification/payment.js +3 -7
- package/lib/parse/specification/remit.d.ts +1 -1
- package/lib/parse/specification/remit.js +2 -2
- package/lib/parse/specification/settings.js +2 -2
- package/lib/parse/specification/ticket-create.d.ts +1 -1
- package/lib/parse/specification/ticket-create.js +2 -5
- package/lib/parse/specification/trustline.d.ts +1 -1
- package/lib/parse/specification/trustline.js +2 -5
- package/lib/parse/specification/unl-report.d.ts +1 -1
- package/lib/parse/specification/unl-report.js +2 -5
- package/lib/parse/specification/uritoken-burn.d.ts +1 -1
- package/lib/parse/specification/uritoken-burn.js +2 -5
- package/lib/parse/specification/uritoken-buy.d.ts +1 -1
- package/lib/parse/specification/uritoken-buy.js +2 -5
- package/lib/parse/specification/uritoken-cancel-sell-offer.d.ts +1 -1
- package/lib/parse/specification/uritoken-cancel-sell-offer.js +2 -5
- package/lib/parse/specification/uritoken-create-sell-offer.d.ts +2 -2
- package/lib/parse/specification/uritoken-create-sell-offer.js +12 -6
- package/lib/parse/specification/uritoken-mint.d.ts +3 -3
- package/lib/parse/specification/uritoken-mint.js +14 -5
- package/lib/parse/transaction.d.ts +19 -19
- package/lib/parse/utils.d.ts +10 -1
- package/lib/parse/utils.js +49 -1
- package/lib/types/account.d.ts +15 -0
- package/lib/types/account.js +2 -0
- package/lib/types/adjustments.d.ts +16 -0
- package/lib/types/adjustments.js +2 -0
- package/lib/types/amendments.d.ts +4 -0
- package/lib/types/amendments.js +2 -0
- package/lib/types/checks.d.ts +18 -0
- package/lib/types/checks.js +2 -0
- package/lib/types/deposits.d.ts +5 -0
- package/lib/types/deposits.js +2 -0
- package/lib/types/emit_details.d.ts +7 -0
- package/lib/types/emit_details.js +2 -0
- package/lib/types/escrows.d.ts +23 -0
- package/lib/types/escrows.js +2 -0
- package/lib/types/fees.d.ts +7 -0
- package/lib/types/fees.js +2 -0
- package/lib/types/flags.d.ts +5 -0
- package/lib/types/flags.js +8 -0
- package/lib/types/hooks.d.ts +14 -0
- package/lib/types/hooks.js +2 -0
- package/lib/types/import.d.ts +23 -0
- package/lib/types/import.js +2 -0
- package/lib/types/index.d.ts +24 -1
- package/lib/types/index.js +38 -0
- package/lib/types/invoke.d.ts +6 -0
- package/lib/types/invoke.js +2 -0
- package/lib/types/ledger.d.ts +45 -0
- package/lib/types/ledger.js +2 -0
- package/lib/types/ledger_data.d.ts +10 -0
- package/lib/types/ledger_data.js +2 -0
- package/lib/types/ledger_entries.d.ts +158 -0
- package/lib/types/ledger_entries.js +2 -0
- package/lib/types/memos.d.ts +12 -0
- package/lib/types/memos.js +2 -0
- package/lib/types/nftokens.d.ts +50 -0
- package/lib/types/nftokens.js +13 -0
- package/lib/types/offers.d.ts +15 -0
- package/lib/types/offers.js +2 -0
- package/lib/types/outcome.d.ts +33 -0
- package/lib/types/outcome.js +2 -0
- package/lib/types/path_find.d.ts +28 -0
- package/lib/types/path_find.js +2 -0
- package/lib/types/payment_channels.d.ts +25 -0
- package/lib/types/payment_channels.js +2 -0
- package/lib/types/payments.d.ts +11 -0
- package/lib/types/payments.js +2 -0
- package/lib/types/queue_data.d.ts +15 -0
- package/lib/types/queue_data.js +2 -0
- package/lib/types/remits.d.ts +18 -0
- package/lib/types/remits.js +2 -0
- package/lib/types/settings.d.ts +34 -0
- package/lib/types/settings.js +2 -0
- package/lib/types/signers.d.ts +6 -0
- package/lib/types/signers.js +2 -0
- package/lib/types/specification.d.ts +4 -0
- package/lib/types/specification.js +2 -0
- package/lib/types/tickets.d.ts +4 -0
- package/lib/types/tickets.js +2 -0
- package/lib/types/transactions.d.ts +21 -0
- package/lib/types/transactions.js +2 -0
- package/lib/types/trustlines.d.ts +38 -0
- package/lib/types/trustlines.js +2 -0
- package/lib/types/unl_reports.d.ts +7 -0
- package/lib/types/unl_reports.js +2 -0
- package/lib/types/uri_tokens.d.ts +7 -0
- package/lib/types/uri_tokens.js +6 -0
- package/lib/types/uritokens.d.ts +39 -0
- package/lib/types/uritokens.js +6 -0
- package/lib/v1/common/types/objects/account.d.ts +2 -2
- package/lib/v1/common/types/objects/checks.d.ts +3 -2
- package/lib/v1/common/types/objects/nftokens.d.ts +3 -1
- package/lib/v1/common/types/objects/payment_channels.d.ts +3 -3
- package/lib/v1/common/types/objects/uritokens.d.ts +5 -2
- package/lib/v1/common/types/objects/uritokens.js +1 -1
- package/lib/v1/transaction/payment.d.ts +2 -2
- package/lib/v1/transaction/payment.js +9 -9
- package/lib/v1/transaction/types.d.ts +1 -34
- package/lib/v1/transaction/utils.d.ts +2 -3
- package/lib/v1/transaction/utils.js +19 -15
- package/lib/v1/types.d.ts +9 -0
- package/lib/v1/types.js +2 -0
- package/lib/v1/utils.d.ts +7 -0
- package/lib/v1/utils.js +42 -0
- package/lib/validator.js +5 -4
- package/lib/wallet.d.ts +3 -0
- package/lib/wallet.js +26 -1
- package/package.json +20 -20
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { XrplApiError } from "./xrpl_api_error";
|
|
2
2
|
import { ValidationError } from "./validation_error";
|
|
3
|
-
export {
|
|
3
|
+
export { XrplApiError, ValidationError };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValidationError = exports.
|
|
4
|
-
const
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.ValidationError = exports.XrplApiError = void 0;
|
|
4
|
+
const xrpl_api_error_1 = require("./xrpl_api_error");
|
|
5
|
+
Object.defineProperty(exports, "XrplApiError", { enumerable: true, get: function () { return xrpl_api_error_1.XrplApiError; } });
|
|
6
6
|
const validation_error_1 = require("./validation_error");
|
|
7
7
|
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.ValidationError; } });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ValidationError = void 0;
|
|
4
|
-
const
|
|
5
|
-
class ValidationError extends
|
|
4
|
+
const xrpl_api_error_1 = require("./xrpl_api_error");
|
|
5
|
+
class ValidationError extends xrpl_api_error_1.XrplApiError {
|
|
6
6
|
}
|
|
7
7
|
exports.ValidationError = ValidationError;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XrplApiError = void 0;
|
|
4
|
+
const util_1 = require("util");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
class XrplApiError extends Error {
|
|
7
|
+
constructor(message = "", data) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = (0, utils_1.getConstructorName)(this);
|
|
10
|
+
this.message = message;
|
|
11
|
+
this.data = data;
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
toString() {
|
|
17
|
+
let result = `[${this.name}(${this.message}`;
|
|
18
|
+
if (this.data) {
|
|
19
|
+
result += `, ${(0, util_1.inspect)(this.data)}`;
|
|
20
|
+
}
|
|
21
|
+
result += ")]";
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
inspect() {
|
|
25
|
+
return this.toString();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.XrplApiError = XrplApiError;
|
package/lib/common/utils.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export declare function parseMarker(marker?: any): any;
|
|
|
8
8
|
export declare function dropsToXrp(drops: BigNumber.Value): string;
|
|
9
9
|
export declare function xrpToDrops(xrp: BigNumber.Value): string;
|
|
10
10
|
export declare function removeUndefined<T extends object>(obj: T): T;
|
|
11
|
+
export declare function getConstructorName(object: object): string | undefined;
|
package/lib/common/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.removeUndefined = exports.xrpToDrops = exports.dropsToXrp = exports.parseMarker = exports.createMarker = exports.sleep = exports.compareTransactions = exports.signum = void 0;
|
|
6
|
+
exports.getConstructorName = exports.removeUndefined = exports.xrpToDrops = exports.dropsToXrp = exports.parseMarker = exports.createMarker = exports.sleep = exports.compareTransactions = exports.signum = void 0;
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
9
|
const errors_1 = require("./errors");
|
|
@@ -111,3 +111,19 @@ function removeUndefined(obj) {
|
|
|
111
111
|
return lodash_1.default.omitBy(obj, (value) => value == null);
|
|
112
112
|
}
|
|
113
113
|
exports.removeUndefined = removeUndefined;
|
|
114
|
+
function getConstructorName(object) {
|
|
115
|
+
if (object.constructor.name) {
|
|
116
|
+
return object.constructor.name;
|
|
117
|
+
}
|
|
118
|
+
const constructorString = object.constructor.toString();
|
|
119
|
+
const functionConstructor = constructorString.match(/^function\s+([^(]*)/);
|
|
120
|
+
const classConstructor = constructorString.match(/^class\s([^\s]*)/);
|
|
121
|
+
if (functionConstructor) {
|
|
122
|
+
return functionConstructor[1];
|
|
123
|
+
}
|
|
124
|
+
else if (classConstructor) {
|
|
125
|
+
return classConstructor[1];
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
exports.getConstructorName = getConstructorName;
|
|
@@ -55,6 +55,13 @@ async function getAccountInfo(account, options = {}) {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
const result = response.result;
|
|
58
|
+
if (!result) {
|
|
59
|
+
return {
|
|
60
|
+
account,
|
|
61
|
+
status: "error",
|
|
62
|
+
error: "invalidResponse",
|
|
63
|
+
};
|
|
64
|
+
}
|
|
58
65
|
if (result.signer_lists) {
|
|
59
66
|
result.account_data.signer_lists = result.signer_lists.slice();
|
|
60
67
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LedgerIndex } from "../models/ledger";
|
|
2
|
+
import { AccountOffers } from "../models/account_offers";
|
|
2
3
|
import { ErrorResponse } from "../models/base_model";
|
|
3
4
|
import { FormattedAccountOrders } from "../parse/ledger/account-order";
|
|
4
|
-
import { AccountOffers } from "../v1/common/types/commands/account_offers";
|
|
5
5
|
export interface GetAccountOffers {
|
|
6
6
|
ledgerIndex?: LedgerIndex;
|
|
7
7
|
limit?: number;
|
package/lib/ledger/ledger.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Connection } from "../connection";
|
|
2
2
|
import { LedgerIndex } from "../models/ledger";
|
|
3
3
|
import { ErrorResponse } from "../models/base_model";
|
|
4
|
-
import { FormattedLedger } from "../
|
|
4
|
+
import { FormattedLedger } from "../types";
|
|
5
5
|
export interface GetLedgerOptions {
|
|
6
6
|
ledgerIndex?: LedgerIndex;
|
|
7
7
|
transactions?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { XrplDefinitionsBase } from "ripple-binary-codec";
|
|
2
2
|
import { Connection } from "../connection";
|
|
3
|
-
import { FormattedMemo } from "../
|
|
3
|
+
import { FormattedMemo } from "../types";
|
|
4
4
|
import { ErrorResponse } from "../models/base_model";
|
|
5
5
|
import { TransactionResponse, FormattedTransaction, AccountPaymentParamsInterface } from "../models/transaction";
|
|
6
6
|
export interface GetTransactionOptions {
|
|
@@ -16,7 +16,7 @@ export interface GetTransactionOptions {
|
|
|
16
16
|
}
|
|
17
17
|
export declare function getTransaction(transaction: string, options?: GetTransactionOptions): Promise<TransactionResponse | FormattedTransaction | ErrorResponse>;
|
|
18
18
|
export declare function getTransactionByCTID(ctid: string, options?: GetTransactionOptions): Promise<TransactionResponse | FormattedTransaction | ErrorResponse>;
|
|
19
|
-
interface
|
|
19
|
+
interface SubmitPaymentTransactionV1Interface {
|
|
20
20
|
sourceAddress: string;
|
|
21
21
|
sourceTag?: number;
|
|
22
22
|
sourceValue: string;
|
|
@@ -30,7 +30,7 @@ interface LegacyPaymentInterface {
|
|
|
30
30
|
secret: string;
|
|
31
31
|
fee?: string;
|
|
32
32
|
}
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function submitPaymentTransactionV1(data: SubmitPaymentTransactionV1Interface, definitions?: XrplDefinitionsBase, validateTx?: boolean): Promise<TransactionResponse | FormattedTransaction | ErrorResponse>;
|
|
34
34
|
export declare function getAccountPaymentParams(account: string, connection?: Connection): Promise<AccountPaymentParamsInterface | ErrorResponse>;
|
|
35
35
|
export declare function getTxSubmitParams(account: string, tx?: string | any, definitions?: XrplDefinitionsBase, connection?: Connection): Promise<AccountPaymentParamsInterface | ErrorResponse>;
|
|
36
36
|
export interface SubmitOptionsInterface {
|
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.submit = exports.getTxSubmitParams = exports.getAccountPaymentParams = exports.
|
|
26
|
+
exports.submit = exports.getTxSubmitParams = exports.getAccountPaymentParams = exports.submitPaymentTransactionV1 = exports.getTransactionByCTID = exports.getTransaction = void 0;
|
|
27
27
|
const xrpl = __importStar(require("xrpl"));
|
|
28
28
|
const ripple_binary_codec_1 = require("ripple-binary-codec");
|
|
29
29
|
const Client = __importStar(require("../client"));
|
|
@@ -158,7 +158,7 @@ async function getTransactionByCTID(ctid, options = {}) {
|
|
|
158
158
|
return result;
|
|
159
159
|
}
|
|
160
160
|
exports.getTransactionByCTID = getTransactionByCTID;
|
|
161
|
-
async function
|
|
161
|
+
async function submitPaymentTransactionV1(data, definitions, validateTx) {
|
|
162
162
|
const connection = Client.findConnection("payment, submit, !clio");
|
|
163
163
|
if (!connection) {
|
|
164
164
|
throw new Error("There is no connection");
|
|
@@ -196,11 +196,11 @@ async function legacyPayment(data, definitions, validateTx) {
|
|
|
196
196
|
}
|
|
197
197
|
transaction.Sequence = submitParams.sequence;
|
|
198
198
|
transaction.LastLedgerSequence = submitParams.lastLedgerSequence;
|
|
199
|
-
const wallet =
|
|
199
|
+
const wallet = (0, wallet_1.walletFromSeed)(data.secret);
|
|
200
200
|
const signedTransaction = (0, wallet_1.signTransaction)(wallet, transaction, false, definitions, validateTx).tx_blob;
|
|
201
201
|
return await submit(signedTransaction, { connection, definitions });
|
|
202
202
|
}
|
|
203
|
-
exports.
|
|
203
|
+
exports.submitPaymentTransactionV1 = submitPaymentTransactionV1;
|
|
204
204
|
async function getAccountPaymentParams(account, connection) {
|
|
205
205
|
try {
|
|
206
206
|
connection = connection || Client.findConnection("submit") || undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LedgerEntry, AccountSetAsfFlags } from "xrpl";
|
|
2
|
-
import { QueueData } from "../
|
|
2
|
+
import { QueueData } from "../types/queue_data";
|
|
3
3
|
export declare const AccountRootFlagsKeys: {
|
|
4
4
|
passwordSpent: LedgerEntry.AccountRootFlags;
|
|
5
5
|
requireDestTag: LedgerEntry.AccountRootFlags;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.buildNFTokenID = exports.parseNFTokenID = exports.cipheredTaxon = exports.sortHelperAccountNFToken = void 0;
|
|
7
7
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
8
|
const AddressCodec = require("ripple-address-codec");
|
|
9
|
+
const utils_1 = require("../parse/utils");
|
|
9
10
|
function sortHelperAccountNFToken(a, b) {
|
|
10
11
|
const cmpIssuer = a.Issuer.localeCompare(b.Issuer);
|
|
11
12
|
if (cmpIssuer !== 0) {
|
|
@@ -52,7 +53,7 @@ function buildNFTokenID(flags, transferFee, issuer, taxon, sequence) {
|
|
|
52
53
|
const scrambledTaxon = cipheredTaxon(sequence, taxon);
|
|
53
54
|
return (new bignumber_js_1.default(flags).toString(16).padStart(4, "0").toUpperCase() +
|
|
54
55
|
new bignumber_js_1.default(transferFee).toString(16).padStart(4, "0").toUpperCase() +
|
|
55
|
-
AddressCodec.decodeAccountID(issuer).
|
|
56
|
+
(0, utils_1.bytesToHex)(AddressCodec.decodeAccountID(issuer).buffer) +
|
|
56
57
|
new bignumber_js_1.default(scrambledTaxon).toString(16).padStart(8, "0").toUpperCase() +
|
|
57
58
|
new bignumber_js_1.default(sequence).toString(16).padStart(8, "0").toUpperCase());
|
|
58
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LedgerEntry } from "xrpl";
|
|
2
2
|
import { Trustline } from "./account_lines";
|
|
3
|
-
import { Amount } from "../
|
|
3
|
+
import { Amount } from "../types";
|
|
4
4
|
export type AccountObject = LedgerEntry.Check | LedgerEntry.DepositPreauth | LedgerEntry.Escrow | LedgerEntry.Offer | LedgerEntry.PayChannel | LedgerEntry.SignerList | LedgerEntry.Ticket | LedgerEntry.RippleState;
|
|
5
5
|
export type AccountObjectType = "check" | "escrow" | "offer" | "payment_channel" | "signer_list" | "state" | "ticket" | "nft_offer";
|
|
6
6
|
export interface AccountObjects {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Amount, PathFindPathOption } from "xrpl";
|
|
2
|
+
export interface PathFindResponseResult {
|
|
3
|
+
alternatives: PathFindPathOption[];
|
|
4
|
+
destination_account: string;
|
|
5
|
+
destination_amount: Amount;
|
|
6
|
+
source_account: string;
|
|
7
|
+
full_reply: boolean;
|
|
8
|
+
id?: number | string;
|
|
9
|
+
closed?: true;
|
|
10
|
+
status?: true;
|
|
11
|
+
}
|
|
@@ -2,7 +2,7 @@ import { Transaction, TransactionMetadata } from "xrpl";
|
|
|
2
2
|
import { XrplDefinitionsBase } from "ripple-binary-codec";
|
|
3
3
|
import { FormattedSpecification, FormattedTransaction } from "../parse/transaction";
|
|
4
4
|
export { FormattedTransaction } from "../parse/transaction";
|
|
5
|
-
import { Outcome } from "../
|
|
5
|
+
import { Outcome } from "../types/outcome";
|
|
6
6
|
export interface TransactionBaseResponse {
|
|
7
7
|
hash: string;
|
|
8
8
|
ledger_index?: number;
|
package/lib/models/vl.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.parseValidationData = exports.encodeVLBlob = exports.isValidVL = exports.parseVL = void 0;
|
|
27
27
|
const manifest_1 = require("./manifest");
|
|
28
|
-
const utils_1 = require("
|
|
28
|
+
const utils_1 = require("../parse/utils");
|
|
29
29
|
const ledger_1 = require("./ledger");
|
|
30
30
|
const Validator = __importStar(require("../validator"));
|
|
31
31
|
function parseVL(vl) {
|
package/lib/parse/index.d.ts
CHANGED
package/lib/parse/index.js
CHANGED
|
@@ -23,8 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.parseTransaction = exports.parseTransactionType = exports.parseOutcome = exports.Ledger = void 0;
|
|
26
|
+
exports.parseTransaction = exports.parseTransactionType = exports.parseOutcome = exports.Utils = exports.Ledger = void 0;
|
|
27
27
|
exports.Ledger = __importStar(require("./ledger"));
|
|
28
|
+
exports.Utils = __importStar(require("./utils"));
|
|
28
29
|
var outcome_1 = require("./outcome");
|
|
29
30
|
Object.defineProperty(exports, "parseOutcome", { enumerable: true, get: function () { return outcome_1.parseOutcome; } });
|
|
30
31
|
var transaction_1 = require("./transaction");
|
|
@@ -8,7 +8,7 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
|
8
8
|
const amount_1 = __importDefault(require("./amount"));
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
10
|
const common_1 = require("../../common");
|
|
11
|
-
const flags_1 = require("../../
|
|
11
|
+
const flags_1 = require("../../types/flags");
|
|
12
12
|
function computeQuality(takerGets, takerPays) {
|
|
13
13
|
const quotient = new bignumber_js_1.default(takerPays.value).dividedBy(takerGets.value);
|
|
14
14
|
return quotient.precision(16, bignumber_js_1.default.ROUND_HALF_UP).toString();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Trustline, FormattedTrustline } from "../../
|
|
1
|
+
import { Trustline, FormattedTrustline } from "../../types/trustlines";
|
|
2
2
|
declare function parseAccountTrustline(trustline: Trustline): FormattedTrustline;
|
|
3
3
|
export default parseAccountTrustline;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FormattedEmitDetails } from "../../
|
|
1
|
+
import { FormattedEmitDetails } from "../../types/emit_details";
|
|
2
2
|
export declare function parseEmittedDetails(tx: any): FormattedEmitDetails | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FormattedImportBlobSpecification } from "../../
|
|
1
|
+
import { FormattedImportBlobSpecification } from "../../types";
|
|
2
2
|
export declare function parseImportBlob(blob: string): FormattedImportBlobSpecification | string;
|
|
@@ -20,6 +20,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.parseMemos = exports.parseAmount = void 0;
|
|
21
21
|
const amount_1 = __importDefault(require("./amount"));
|
|
22
22
|
exports.parseAmount = amount_1.default;
|
|
23
|
-
const memos_1 =
|
|
24
|
-
exports
|
|
23
|
+
const memos_1 = require("./memos");
|
|
24
|
+
Object.defineProperty(exports, "parseMemos", { enumerable: true, get: function () { return memos_1.parseMemos; } });
|
|
25
25
|
__exportStar(require("../utils"), exports);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Ledger, FormattedLedger } from "../../
|
|
1
|
+
import { Ledger, FormattedLedger } from "../../types";
|
|
2
2
|
export declare function parseLedger(ledger: Ledger, includeRawTransactions: boolean): FormattedLedger;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { FormattedMemo } from "../../
|
|
1
|
+
import { FormattedMemo, Memo } from "../../types";
|
|
2
2
|
declare function parseMemos(tx: any): FormattedMemo[] | undefined;
|
|
3
|
-
|
|
3
|
+
declare function formattedMemoToMemo(memo: FormattedMemo): Memo;
|
|
4
|
+
export { parseMemos, formattedMemoToMemo };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formattedMemoToMemo = exports.parseMemos = void 0;
|
|
3
4
|
const common_1 = require("../../common");
|
|
4
5
|
const utils_1 = require("../utils");
|
|
5
6
|
function parseMemos(tx) {
|
|
@@ -14,4 +15,14 @@ function parseMemos(tx) {
|
|
|
14
15
|
});
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
|
-
exports.
|
|
18
|
+
exports.parseMemos = parseMemos;
|
|
19
|
+
function formattedMemoToMemo(memo) {
|
|
20
|
+
return {
|
|
21
|
+
Memo: (0, common_1.removeUndefined)({
|
|
22
|
+
MemoData: (0, utils_1.stringToHex)(memo.data),
|
|
23
|
+
MemoType: (0, utils_1.stringToHex)(memo.type),
|
|
24
|
+
MemoFormat: (0, utils_1.stringToHex)(memo.format),
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.formattedMemoToMemo = formattedMemoToMemo;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NFTokenFlagsKeysInterface } from "../../
|
|
1
|
+
import { NFTokenFlagsKeysInterface } from "../../types/nftokens";
|
|
2
2
|
declare function parseNFTokenFlags(value: number, options?: {
|
|
3
3
|
excludeFalse?: boolean;
|
|
4
4
|
}): NFTokenFlagsKeysInterface;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const nftokens_1 = require("../../
|
|
3
|
+
const nftokens_1 = require("../../types/nftokens");
|
|
4
4
|
const flags_1 = require("./flags");
|
|
5
5
|
function parseNFTokenFlags(value, options = {}) {
|
|
6
6
|
return (0, flags_1.parseFlags)(value, nftokens_1.NFTokenFlagsKeys, options);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NFTokenOfferFlagsKeysInterface } from "../../
|
|
1
|
+
import { NFTokenOfferFlagsKeysInterface } from "../../types/nftokens";
|
|
2
2
|
declare function parseNFTOfferFlags(value: number, options?: {
|
|
3
3
|
excludeFalse?: boolean;
|
|
4
4
|
}): NFTokenOfferFlagsKeysInterface;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const nftokens_1 = require("../../
|
|
3
|
+
const nftokens_1 = require("../../types/nftokens");
|
|
4
4
|
const flags_1 = require("./flags");
|
|
5
5
|
function parseNFTOfferFlags(value, options = {}) {
|
|
6
6
|
return (0, flags_1.parseFlags)(value, nftokens_1.NFTokenOfferFlagsKeys, options);
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Amount, OfferLedgerEntry, FormattedIssuedCurrencyAmount, FormattedOfferCreateSpecification } from "../../types";
|
|
2
|
+
export interface BookOffer extends OfferLedgerEntry {
|
|
3
|
+
quality?: string;
|
|
4
|
+
owner_funds?: string;
|
|
5
|
+
taker_gets_funded?: Amount;
|
|
6
|
+
taker_pays_funded?: Amount;
|
|
7
|
+
}
|
|
3
8
|
export type FormattedOrderbookOrder = {
|
|
4
9
|
specification: FormattedOfferCreateSpecification;
|
|
5
10
|
properties: {
|
|
@@ -7,7 +7,7 @@ exports.parseOrderbookOrder = void 0;
|
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const common_1 = require("../../common");
|
|
10
|
-
const flags_1 = require("../../
|
|
10
|
+
const flags_1 = require("../../types/flags");
|
|
11
11
|
const amount_1 = __importDefault(require("./amount"));
|
|
12
12
|
function parseOrderbookOrder(data) {
|
|
13
13
|
const direction = (data.Flags & flags_1.orderFlags.Sell) === 0 ? "buy" : "sell";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GetPaths } from "../../
|
|
2
|
-
import {
|
|
3
|
-
declare function parsePathfind(pathfindResult:
|
|
1
|
+
import { GetPaths } from "../../types/path_find";
|
|
2
|
+
import { PathFindResponseResult } from "../../models/path_find";
|
|
3
|
+
declare function parsePathfind(pathfindResult: PathFindResponseResult): GetPaths;
|
|
4
4
|
export default parsePathfind;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { URITokenFlagsKeysInterface } from "../../
|
|
1
|
+
import { URITokenFlagsKeysInterface } from "../../types/uritokens";
|
|
2
2
|
declare function parseURITokenFlags(value: number, options?: {
|
|
3
3
|
excludeFalse?: boolean;
|
|
4
4
|
}): URITokenFlagsKeysInterface;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const uritokens_1 = require("../../
|
|
3
|
+
const uritokens_1 = require("../../types/uritokens");
|
|
4
4
|
const flags_1 = require("./flags");
|
|
5
5
|
function parseURITokenFlags(value, options = {}) {
|
|
6
6
|
return (0, flags_1.parseFlags)(value, uritokens_1.URITokenFlagsKeys, options);
|
|
@@ -7,7 +7,7 @@ exports.parseFinalBalances = exports.parseBalanceChanges = void 0;
|
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
9
|
const common_1 = require("../../common");
|
|
10
|
-
const utils_1 = require("
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
11
|
const client_1 = require("../../client");
|
|
12
12
|
function groupByAddress(balanceChanges) {
|
|
13
13
|
const grouped = lodash_1.default.groupBy(balanceChanges, function (node) {
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.parseChannelChanges = void 0;
|
|
7
7
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
-
const utils_1 = require("
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
9
|
function parsePaymentChannelStatus(node) {
|
|
10
10
|
if (node.diffType === "CreatedNode") {
|
|
11
11
|
return "created";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormattedSourceAddress, FormattedDestinationAddress } from "../../
|
|
1
|
+
import { FormattedSourceAddress, FormattedDestinationAddress } from "../../types/account";
|
|
2
2
|
interface FormattedEscrowSummaryInterface {
|
|
3
3
|
status?: string;
|
|
4
4
|
escrowIndex?: number;
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseEscrowChanges = void 0;
|
|
4
4
|
const common_1 = require("../../common");
|
|
5
|
-
const utils_1 = require("
|
|
6
|
-
const utils_2 = require("../utils");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
7
6
|
function parseEscrowStatus(tx, node) {
|
|
8
7
|
if (node.diffType === "CreatedNode") {
|
|
9
8
|
return "created";
|
|
@@ -46,8 +45,8 @@ function summarizeEscrow(tx, node) {
|
|
|
46
45
|
condition: final.Condition,
|
|
47
46
|
source: (0, common_1.removeUndefined)(source),
|
|
48
47
|
destination: (0, common_1.removeUndefined)(destination),
|
|
49
|
-
allowCancelAfter: (0,
|
|
50
|
-
allowExecuteAfter: (0,
|
|
48
|
+
allowCancelAfter: (0, utils_1.parseTimestamp)(final.CancelAfter),
|
|
49
|
+
allowExecuteAfter: (0, utils_1.parseTimestamp)(final.FinishAfter),
|
|
51
50
|
};
|
|
52
51
|
if (final.PreviousTxnID) {
|
|
53
52
|
summary.previousTxnID = final.PreviousTxnID;
|
|
@@ -7,7 +7,7 @@ exports.parseFinalLockedBalances = exports.parseLockedBalanceChanges = void 0;
|
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
8
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
9
|
const common_1 = require("../../common");
|
|
10
|
-
const utils_1 = require("
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
11
|
const client_1 = require("../../client");
|
|
12
12
|
function groupByAddress(lockedBalanceChanges) {
|
|
13
13
|
const grouped = lodash_1.default.groupBy(lockedBalanceChanges, function (node) {
|
|
@@ -9,7 +9,7 @@ const bignumber_js_1 = require("bignumber.js");
|
|
|
9
9
|
const BigNumber = bignumber_js_1.BigNumber.clone({ DECIMAL_PLACES: 40 });
|
|
10
10
|
const common_1 = require("../../common");
|
|
11
11
|
const models_1 = require("../../models");
|
|
12
|
-
const utils_1 = require("
|
|
12
|
+
const utils_1 = require("../utils");
|
|
13
13
|
const orderbook_quality_1 = require("./orderbook_quality");
|
|
14
14
|
const currency_amount_1 = __importDefault(require("../ledger/currency-amount"));
|
|
15
15
|
const client_1 = require("../../client");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseUNLReportChanges = void 0;
|
|
4
4
|
const common_1 = require("../../common");
|
|
5
|
-
const utils_1 = require("
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
6
|
function summarizeUNLReport(tx, node) {
|
|
7
7
|
const final = node.diffType === "CreatedNode" ? node.newFields : node.finalFields;
|
|
8
8
|
if (tx.ImportVLKey && final.ImportVLKeys) {
|
package/lib/parse/outcome.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { XrplDefinitionsBase } from "ripple-binary-codec";
|
|
2
|
-
import { Outcome } from "../
|
|
2
|
+
import { Outcome } from "../types/outcome";
|
|
3
3
|
declare function parseOutcome(tx: any, nativeCurrency?: string, definitions?: XrplDefinitionsBase): Outcome | undefined;
|
|
4
4
|
export { parseOutcome };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FormattedAccountDeleteSpecification } from "../../
|
|
1
|
+
import { FormattedAccountDeleteSpecification } from "../../types/account";
|
|
2
2
|
declare function parseAccountDelete(tx: any): FormattedAccountDeleteSpecification;
|
|
3
3
|
export default parseAccountDelete;
|