@bithomp/xrpl-api 2.7.14 → 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.
Files changed (212) hide show
  1. package/lib/common/errors/index.d.ts +2 -2
  2. package/lib/common/errors/index.js +3 -3
  3. package/lib/common/errors/validation_error.d.ts +2 -2
  4. package/lib/common/errors/validation_error.js +2 -2
  5. package/lib/common/errors/xrpl_api_error.d.ts +9 -0
  6. package/lib/common/errors/xrpl_api_error.js +28 -0
  7. package/lib/common/utils.d.ts +1 -0
  8. package/lib/common/utils.js +17 -1
  9. package/lib/ledger/account_info.js +7 -0
  10. package/lib/ledger/account_offers.d.ts +1 -1
  11. package/lib/ledger/ledger.d.ts +1 -1
  12. package/lib/ledger/transaction.d.ts +3 -3
  13. package/lib/ledger/transaction.js +4 -4
  14. package/lib/models/account_info.d.ts +1 -1
  15. package/lib/models/account_lines.d.ts +2 -0
  16. package/lib/models/account_nfts.js +2 -1
  17. package/lib/models/account_object.d.ts +1 -1
  18. package/lib/models/account_object.js +9 -2
  19. package/lib/models/account_offers.d.ts +9 -0
  20. package/lib/models/account_offers.js +2 -0
  21. package/lib/models/account_uritokens.d.ts +1 -1
  22. package/lib/models/path_find.d.ts +11 -0
  23. package/lib/models/path_find.js +2 -0
  24. package/lib/models/transaction.d.ts +1 -1
  25. package/lib/models/vl.js +1 -1
  26. package/lib/parse/index.d.ts +1 -0
  27. package/lib/parse/index.js +2 -1
  28. package/lib/parse/ledger/account-order.d.ts +1 -1
  29. package/lib/parse/ledger/account-order.js +1 -1
  30. package/lib/parse/ledger/account-trustline.d.ts +1 -1
  31. package/lib/parse/ledger/amount.d.ts +1 -1
  32. package/lib/parse/ledger/currency-amount.d.ts +1 -1
  33. package/lib/parse/ledger/emit_details.d.ts +1 -1
  34. package/lib/parse/ledger/import.d.ts +1 -1
  35. package/lib/parse/ledger/index.d.ts +1 -1
  36. package/lib/parse/ledger/index.js +2 -2
  37. package/lib/parse/ledger/ledger.d.ts +1 -1
  38. package/lib/parse/ledger/memos.d.ts +3 -2
  39. package/lib/parse/ledger/memos.js +12 -1
  40. package/lib/parse/ledger/nftoken-flags.d.ts +1 -1
  41. package/lib/parse/ledger/nftoken-flags.js +1 -1
  42. package/lib/parse/ledger/nftoken-offer-flags.d.ts +1 -1
  43. package/lib/parse/ledger/nftoken-offer-flags.js +1 -1
  44. package/lib/parse/ledger/orderbook-order.d.ts +7 -2
  45. package/lib/parse/ledger/orderbook-order.js +1 -1
  46. package/lib/parse/ledger/pathfind.d.ts +3 -3
  47. package/lib/parse/ledger/ripple-amount.d.ts +1 -1
  48. package/lib/parse/ledger/uritoken-flags.d.ts +1 -1
  49. package/lib/parse/ledger/uritoken-flags.js +1 -1
  50. package/lib/parse/outcome/balance_changes.js +1 -1
  51. package/lib/parse/outcome/channel_changes.js +1 -1
  52. package/lib/parse/outcome/escrow_changes.d.ts +1 -1
  53. package/lib/parse/outcome/escrow_changes.js +3 -4
  54. package/lib/parse/outcome/locked_balance_changes.js +1 -1
  55. package/lib/parse/outcome/orderbook_changes.js +1 -1
  56. package/lib/parse/outcome/unl_report_changes.js +1 -1
  57. package/lib/parse/outcome.d.ts +1 -1
  58. package/lib/parse/specification/account-delete.d.ts +1 -1
  59. package/lib/parse/specification/account-delete.js +13 -7
  60. package/lib/parse/specification/amendment.d.ts +1 -1
  61. package/lib/parse/specification/amendment.js +2 -5
  62. package/lib/parse/specification/check-cancel.d.ts +1 -1
  63. package/lib/parse/specification/check-cancel.js +2 -5
  64. package/lib/parse/specification/check-cash.d.ts +1 -1
  65. package/lib/parse/specification/check-cash.js +2 -2
  66. package/lib/parse/specification/check-create.d.ts +1 -1
  67. package/lib/parse/specification/check-create.js +13 -4
  68. package/lib/parse/specification/deposit-preauth.d.ts +1 -1
  69. package/lib/parse/specification/deposit-preauth.js +2 -5
  70. package/lib/parse/specification/escrow-cancel.d.ts +1 -1
  71. package/lib/parse/specification/escrow-cancel.js +2 -5
  72. package/lib/parse/specification/escrow-create.d.ts +1 -1
  73. package/lib/parse/specification/escrow-create.js +2 -5
  74. package/lib/parse/specification/escrow-finish.d.ts +1 -1
  75. package/lib/parse/specification/escrow-finish.js +2 -5
  76. package/lib/parse/specification/fee-update.d.ts +1 -1
  77. package/lib/parse/specification/fee-update.js +2 -2
  78. package/lib/parse/specification/import.d.ts +1 -1
  79. package/lib/parse/specification/import.js +2 -5
  80. package/lib/parse/specification/invoke.d.ts +1 -1
  81. package/lib/parse/specification/invoke.js +2 -5
  82. package/lib/parse/specification/nftoken-accept-offer.d.ts +1 -1
  83. package/lib/parse/specification/nftoken-accept-offer.js +2 -5
  84. package/lib/parse/specification/nftoken-burn.d.ts +1 -1
  85. package/lib/parse/specification/nftoken-burn.js +2 -5
  86. package/lib/parse/specification/nftoken-cancel-offer.d.ts +1 -1
  87. package/lib/parse/specification/nftoken-cancel-offer.js +2 -5
  88. package/lib/parse/specification/nftoken-create-offer.d.ts +1 -1
  89. package/lib/parse/specification/nftoken-create-offer.js +12 -3
  90. package/lib/parse/specification/nftoken-mint.d.ts +1 -1
  91. package/lib/parse/specification/nftoken-mint.js +2 -2
  92. package/lib/parse/specification/offer-cancel.d.ts +1 -1
  93. package/lib/parse/specification/offer-cancel.js +2 -5
  94. package/lib/parse/specification/offer-create.d.ts +1 -1
  95. package/lib/parse/specification/offer-create.js +2 -2
  96. package/lib/parse/specification/payment-channel-claim.d.ts +1 -1
  97. package/lib/parse/specification/payment-channel-claim.js +2 -2
  98. package/lib/parse/specification/payment-channel-create.d.ts +1 -1
  99. package/lib/parse/specification/payment-channel-create.js +13 -5
  100. package/lib/parse/specification/payment-channel-fund.d.ts +1 -1
  101. package/lib/parse/specification/payment-channel-fund.js +2 -2
  102. package/lib/parse/specification/payment.d.ts +1 -1
  103. package/lib/parse/specification/payment.js +3 -7
  104. package/lib/parse/specification/remit.d.ts +1 -1
  105. package/lib/parse/specification/remit.js +2 -2
  106. package/lib/parse/specification/settings.js +2 -2
  107. package/lib/parse/specification/ticket-create.d.ts +1 -1
  108. package/lib/parse/specification/ticket-create.js +2 -5
  109. package/lib/parse/specification/trustline.d.ts +1 -1
  110. package/lib/parse/specification/trustline.js +2 -5
  111. package/lib/parse/specification/unl-report.d.ts +1 -1
  112. package/lib/parse/specification/unl-report.js +2 -5
  113. package/lib/parse/specification/uritoken-burn.d.ts +1 -1
  114. package/lib/parse/specification/uritoken-burn.js +2 -5
  115. package/lib/parse/specification/uritoken-buy.d.ts +1 -1
  116. package/lib/parse/specification/uritoken-buy.js +2 -5
  117. package/lib/parse/specification/uritoken-cancel-sell-offer.d.ts +1 -1
  118. package/lib/parse/specification/uritoken-cancel-sell-offer.js +2 -5
  119. package/lib/parse/specification/uritoken-create-sell-offer.d.ts +2 -2
  120. package/lib/parse/specification/uritoken-create-sell-offer.js +12 -6
  121. package/lib/parse/specification/uritoken-mint.d.ts +3 -3
  122. package/lib/parse/specification/uritoken-mint.js +14 -5
  123. package/lib/parse/transaction.d.ts +19 -19
  124. package/lib/parse/utils.d.ts +10 -1
  125. package/lib/parse/utils.js +49 -1
  126. package/lib/types/account.d.ts +15 -0
  127. package/lib/types/account.js +2 -0
  128. package/lib/types/adjustments.d.ts +16 -0
  129. package/lib/types/adjustments.js +2 -0
  130. package/lib/types/amendments.d.ts +4 -0
  131. package/lib/types/amendments.js +2 -0
  132. package/lib/types/checks.d.ts +18 -0
  133. package/lib/types/checks.js +2 -0
  134. package/lib/types/deposits.d.ts +5 -0
  135. package/lib/types/deposits.js +2 -0
  136. package/lib/types/emit_details.d.ts +7 -0
  137. package/lib/types/emit_details.js +2 -0
  138. package/lib/types/escrows.d.ts +23 -0
  139. package/lib/types/escrows.js +2 -0
  140. package/lib/types/fees.d.ts +7 -0
  141. package/lib/types/fees.js +2 -0
  142. package/lib/types/flags.d.ts +5 -0
  143. package/lib/types/flags.js +8 -0
  144. package/lib/types/hooks.d.ts +14 -0
  145. package/lib/types/hooks.js +2 -0
  146. package/lib/types/import.d.ts +23 -0
  147. package/lib/types/import.js +2 -0
  148. package/lib/types/index.d.ts +24 -1
  149. package/lib/types/index.js +38 -0
  150. package/lib/types/invoke.d.ts +6 -0
  151. package/lib/types/invoke.js +2 -0
  152. package/lib/types/ledger.d.ts +45 -0
  153. package/lib/types/ledger.js +2 -0
  154. package/lib/types/ledger_data.d.ts +10 -0
  155. package/lib/types/ledger_data.js +2 -0
  156. package/lib/types/ledger_entries.d.ts +158 -0
  157. package/lib/types/ledger_entries.js +2 -0
  158. package/lib/types/memos.d.ts +12 -0
  159. package/lib/types/memos.js +2 -0
  160. package/lib/types/nftokens.d.ts +50 -0
  161. package/lib/types/nftokens.js +13 -0
  162. package/lib/types/offers.d.ts +15 -0
  163. package/lib/types/offers.js +2 -0
  164. package/lib/types/outcome.d.ts +33 -0
  165. package/lib/types/outcome.js +2 -0
  166. package/lib/types/path_find.d.ts +28 -0
  167. package/lib/types/path_find.js +2 -0
  168. package/lib/types/payment_channels.d.ts +25 -0
  169. package/lib/types/payment_channels.js +2 -0
  170. package/lib/types/payments.d.ts +11 -0
  171. package/lib/types/payments.js +2 -0
  172. package/lib/types/queue_data.d.ts +15 -0
  173. package/lib/types/queue_data.js +2 -0
  174. package/lib/types/remits.d.ts +18 -0
  175. package/lib/types/remits.js +2 -0
  176. package/lib/types/settings.d.ts +34 -0
  177. package/lib/types/settings.js +2 -0
  178. package/lib/types/signers.d.ts +6 -0
  179. package/lib/types/signers.js +2 -0
  180. package/lib/types/specification.d.ts +4 -0
  181. package/lib/types/specification.js +2 -0
  182. package/lib/types/tickets.d.ts +4 -0
  183. package/lib/types/tickets.js +2 -0
  184. package/lib/types/transactions.d.ts +21 -0
  185. package/lib/types/transactions.js +2 -0
  186. package/lib/types/trustlines.d.ts +38 -0
  187. package/lib/types/trustlines.js +2 -0
  188. package/lib/types/unl_reports.d.ts +7 -0
  189. package/lib/types/unl_reports.js +2 -0
  190. package/lib/types/uri_tokens.d.ts +7 -0
  191. package/lib/types/uri_tokens.js +6 -0
  192. package/lib/types/uritokens.d.ts +39 -0
  193. package/lib/types/uritokens.js +6 -0
  194. package/lib/v1/common/types/objects/account.d.ts +2 -2
  195. package/lib/v1/common/types/objects/checks.d.ts +3 -2
  196. package/lib/v1/common/types/objects/nftokens.d.ts +3 -1
  197. package/lib/v1/common/types/objects/payment_channels.d.ts +3 -3
  198. package/lib/v1/common/types/objects/uritokens.d.ts +5 -2
  199. package/lib/v1/common/types/objects/uritokens.js +1 -1
  200. package/lib/v1/transaction/payment.d.ts +2 -2
  201. package/lib/v1/transaction/payment.js +9 -9
  202. package/lib/v1/transaction/types.d.ts +1 -34
  203. package/lib/v1/transaction/utils.d.ts +2 -3
  204. package/lib/v1/transaction/utils.js +19 -15
  205. package/lib/v1/types.d.ts +9 -0
  206. package/lib/v1/types.js +2 -0
  207. package/lib/v1/utils.d.ts +7 -0
  208. package/lib/v1/utils.js +42 -0
  209. package/lib/validator.js +5 -4
  210. package/lib/wallet.d.ts +3 -0
  211. package/lib/wallet.js +26 -1
  212. package/package.json +20 -20
@@ -1,3 +1,3 @@
1
- import { RippleError } from "./ripple_error";
1
+ import { XrplApiError } from "./xrpl_api_error";
2
2
  import { ValidationError } from "./validation_error";
3
- export { RippleError, ValidationError };
3
+ export { XrplApiError, ValidationError };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ValidationError = exports.RippleError = void 0;
4
- const ripple_error_1 = require("./ripple_error");
5
- Object.defineProperty(exports, "RippleError", { enumerable: true, get: function () { return ripple_error_1.RippleError; } });
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,4 +1,4 @@
1
- import { RippleError } from "./ripple_error";
2
- declare class ValidationError extends RippleError {
1
+ import { XrplApiError } from "./xrpl_api_error";
2
+ declare class ValidationError extends XrplApiError {
3
3
  }
4
4
  export { 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 ripple_error_1 = require("./ripple_error");
5
- class ValidationError extends ripple_error_1.RippleError {
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,9 @@
1
+ declare class XrplApiError extends Error {
2
+ name: string;
3
+ message: string;
4
+ data?: any;
5
+ constructor(message?: string, data?: any);
6
+ toString(): string;
7
+ inspect(): string;
8
+ }
9
+ export { XrplApiError };
@@ -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;
@@ -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;
@@ -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;
@@ -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 "../v1/common/types/objects";
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 "../v1/common/types/objects";
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 LegacyPaymentInterface {
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 legacyPayment(data: LegacyPaymentInterface, definitions?: XrplDefinitionsBase, validateTx?: boolean): Promise<TransactionResponse | FormattedTransaction | ErrorResponse>;
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.legacyPayment = exports.getTransactionByCTID = exports.getTransaction = void 0;
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 legacyPayment(data, definitions, validateTx) {
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 = xrpl.Wallet.fromSeed(data.secret);
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.legacyPayment = legacyPayment;
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 "../v1/common/types/objects/queue_data";
2
+ import { QueueData } from "../types/queue_data";
3
3
  export declare const AccountRootFlagsKeys: {
4
4
  passwordSpent: LedgerEntry.AccountRootFlags;
5
5
  requireDestTag: LedgerEntry.AccountRootFlags;
@@ -4,6 +4,8 @@ export interface Trustline {
4
4
  currency: string;
5
5
  limit: string;
6
6
  limit_peer: string;
7
+ lock_count?: number;
8
+ locked_balance?: string;
7
9
  quality_in: number;
8
10
  quality_out: number;
9
11
  no_ripple?: boolean;
@@ -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).toString("hex").toUpperCase() +
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 "../v1/common/types/objects";
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 {
@@ -25,15 +25,22 @@ const RippleStateToTrustLine = (ledgerEntry, account) => {
25
25
  const balance = ledgerEntry.HighLimit.issuer === account && ledgerEntry.Balance.value.startsWith("-")
26
26
  ? ledgerEntry.Balance.value.slice(1)
27
27
  : ledgerEntry.Balance.value;
28
- return {
28
+ const lockedBalance = ledgerEntry.LockedBalance?.value;
29
+ let lockCount = undefined;
30
+ if (lockedBalance) {
31
+ lockCount = ledgerEntry.LockCount;
32
+ }
33
+ return (0, common_1.removeUndefined)({
29
34
  account: counterparty.issuer,
30
35
  balance,
31
36
  currency: self.currency,
32
37
  limit: self.value,
33
38
  limit_peer: counterparty.value,
39
+ lock_count: lockCount,
40
+ locked_balance: lockedBalance,
34
41
  no_ripple,
35
42
  no_ripple_peer,
36
- };
43
+ });
37
44
  };
38
45
  function accountObjectsToNFTOffers(accountObjects) {
39
46
  const nftOfferObjects = accountObjects.filter((obj) => {
@@ -0,0 +1,9 @@
1
+ import { AccountOffer } from "xrpl";
2
+ export interface AccountOffers {
3
+ account: string;
4
+ offers?: AccountOffer[];
5
+ ledger_current_index?: number;
6
+ ledger_index?: number;
7
+ ledger_hash?: string;
8
+ marker?: unknown;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { Amount } from "../v1/common/types/objects";
1
+ import { Amount } from "../types";
2
2
  export interface URITokenInterface {
3
3
  Digest?: string;
4
4
  Flags: number;
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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 "../v1/transaction/types";
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("./utils");
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) {
@@ -1,3 +1,4 @@
1
1
  export * as Ledger from "./ledger";
2
+ export * as Utils from "./utils";
2
3
  export { parseOutcome } from "./outcome";
3
4
  export { parseTransactionType, parseTransaction } from "./transaction";
@@ -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");
@@ -1,4 +1,4 @@
1
- import { FormattedOfferCreateSpecification } from "../../v1/common/types/objects";
1
+ import { FormattedOfferCreateSpecification } from "../../types";
2
2
  export type FormattedAccountOrders = {
3
3
  account: string;
4
4
  offers?: FormattedAccountOrder[];
@@ -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("../../v1/common/types/objects/flags");
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 "../../v1/common/types/objects/trustlines";
1
+ import { Trustline, FormattedTrustline } from "../../types/trustlines";
2
2
  declare function parseAccountTrustline(trustline: Trustline): FormattedTrustline;
3
3
  export default parseAccountTrustline;
@@ -1,3 +1,3 @@
1
- import { FormattedIssuedCurrencyAmount, Amount } from "../../v1/common/types/objects";
1
+ import { FormattedIssuedCurrencyAmount, Amount } from "../../types";
2
2
  declare function parseAmount(amount: Amount): FormattedIssuedCurrencyAmount;
3
3
  export default parseAmount;
@@ -1,3 +1,3 @@
1
- import { FormattedAmount, Amount } from "../../v1/common/types/objects";
1
+ import { FormattedAmount, Amount } from "../../types";
2
2
  declare function parseCurrencyAmount(amount: Amount): FormattedAmount | undefined;
3
3
  export default parseCurrencyAmount;
@@ -1,2 +1,2 @@
1
- import { FormattedEmitDetails } from "../../v1/common/types/objects/emit_details";
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 "../../v1/common/types/objects";
1
+ import { FormattedImportBlobSpecification } from "../../types";
2
2
  export declare function parseImportBlob(blob: string): FormattedImportBlobSpecification | string;
@@ -1,4 +1,4 @@
1
1
  import parseAmount from "./amount";
2
- import parseMemos from "./memos";
2
+ import { parseMemos } from "./memos";
3
3
  export * from "../utils";
4
4
  export { parseAmount, parseMemos };
@@ -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 = __importDefault(require("./memos"));
24
- exports.parseMemos = memos_1.default;
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 "../../v1/common/types/objects";
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 "../../v1/common/types/objects";
1
+ import { FormattedMemo, Memo } from "../../types";
2
2
  declare function parseMemos(tx: any): FormattedMemo[] | undefined;
3
- export default parseMemos;
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.default = parseMemos;
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 "../../v1/common/types/objects/nftokens";
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("../../v1/common/types/objects/nftokens");
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 "../../v1/common/types/objects/nftokens";
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("../../v1/common/types/objects/nftokens");
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 { BookOffer } from "../../v1/common/types/commands";
2
- import { FormattedIssuedCurrencyAmount, FormattedOfferCreateSpecification } from "../../v1/common/types/objects";
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("../../v1/common/types/objects/flags");
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 "../../v1/common/types/objects/path_find";
2
- import { RippledPathsResponse } from "../../v1/common/types/commands/path_find";
3
- declare function parsePathfind(pathfindResult: RippledPathsResponse): GetPaths;
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,3 +1,3 @@
1
- import { Amount, FormattedAmount } from "../../v1/common/types/objects";
1
+ import { Amount, FormattedAmount } from "../../types";
2
2
  declare function parseRippledAmount(amount: Amount): FormattedAmount | undefined;
3
3
  export default parseRippledAmount;
@@ -1,4 +1,4 @@
1
- import { URITokenFlagsKeysInterface } from "../../v1/common/types/objects/uritokens";
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("../../v1/common/types/objects/uritokens");
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("../../v1/common/utils");
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("../../v1/common/utils");
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 "../../v1/common/types/objects/account";
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("../../v1/common/utils");
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, utils_2.parseTimestamp)(final.CancelAfter),
50
- allowExecuteAfter: (0, utils_2.parseTimestamp)(final.FinishAfter),
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("../../v1/common/utils");
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) {