@bithomp/xrpl-api 3.0.7 → 3.0.9

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 (112) hide show
  1. package/lib/base58.d.ts +0 -1
  2. package/lib/base58.js +2 -3
  3. package/lib/client.js +6 -6
  4. package/lib/common/utils.js +9 -10
  5. package/lib/connection.d.ts +0 -1
  6. package/lib/faucet.js +5 -5
  7. package/lib/ledger/account_info.js +3 -4
  8. package/lib/ledger/account_lines.js +1 -2
  9. package/lib/ledger/account_namespace.js +1 -2
  10. package/lib/ledger/account_nfts.js +4 -5
  11. package/lib/ledger/account_objects.js +5 -6
  12. package/lib/ledger/account_offers.js +2 -3
  13. package/lib/ledger/account_tx.js +2 -3
  14. package/lib/ledger/amm_info.js +2 -3
  15. package/lib/ledger/book_offers.js +2 -3
  16. package/lib/ledger/currency.js +1 -2
  17. package/lib/ledger/fee.js +1 -2
  18. package/lib/ledger/gateway_balances.js +2 -3
  19. package/lib/ledger/ledger.js +2 -3
  20. package/lib/ledger/ledger_entry.js +4 -4
  21. package/lib/ledger/manifest.js +1 -2
  22. package/lib/ledger/nft_info.js +1 -2
  23. package/lib/ledger/server_definitions.js +1 -2
  24. package/lib/ledger/server_info.js +1 -2
  25. package/lib/ledger/transaction.d.ts +6 -1
  26. package/lib/ledger/transaction.js +66 -48
  27. package/lib/ledger/vl-v2.js +2 -3
  28. package/lib/ledger/vl.js +3 -4
  29. package/lib/models/account_info.js +5 -5
  30. package/lib/models/account_nfts.js +4 -5
  31. package/lib/models/account_object.js +3 -4
  32. package/lib/models/book_offers.js +1 -2
  33. package/lib/models/ledger.js +5 -5
  34. package/lib/models/manifest.d.ts +0 -1
  35. package/lib/models/manifest.js +3 -4
  36. package/lib/models/transaction.js +10 -11
  37. package/lib/models/vl.js +4 -5
  38. package/lib/parse/ledger/account-order.js +1 -2
  39. package/lib/parse/ledger/account.js +1 -2
  40. package/lib/parse/ledger/emit_details.js +1 -2
  41. package/lib/parse/ledger/flags.js +1 -2
  42. package/lib/parse/ledger/import.js +1 -2
  43. package/lib/parse/ledger/ledger.js +1 -2
  44. package/lib/parse/ledger/memos.js +2 -3
  45. package/lib/parse/ledger/orderbook-order.js +1 -2
  46. package/lib/parse/outcome/affected_objects.js +1 -2
  47. package/lib/parse/outcome/amm_changes.js +1 -2
  48. package/lib/parse/outcome/balance_changes.js +2 -3
  49. package/lib/parse/outcome/channel_changes.js +1 -2
  50. package/lib/parse/outcome/emitted_txns.js +1 -2
  51. package/lib/parse/outcome/escrow_changes.js +1 -2
  52. package/lib/parse/outcome/hooks_executions.js +1 -2
  53. package/lib/parse/outcome/locked_balance_changes.js +2 -3
  54. package/lib/parse/outcome/nftoken_changes.js +1 -2
  55. package/lib/parse/outcome/nftoken_offer_changes.js +1 -2
  56. package/lib/parse/outcome/orderbook_changes.js +1 -2
  57. package/lib/parse/outcome/orderbook_quality.js +1 -2
  58. package/lib/parse/outcome/unl_report_changes.js +1 -2
  59. package/lib/parse/outcome/uritoken_changes.js +1 -2
  60. package/lib/parse/outcome/uritoken_sell_offer_changes.js +1 -2
  61. package/lib/parse/outcome.js +1 -2
  62. package/lib/parse/specification/account-delete.js +2 -0
  63. package/lib/parse/specification/amendment.js +27 -0
  64. package/lib/parse/specification/amm-bid.js +3 -1
  65. package/lib/parse/specification/amm-create.js +3 -1
  66. package/lib/parse/specification/amm-delete.js +3 -1
  67. package/lib/parse/specification/amm-deposit.js +3 -1
  68. package/lib/parse/specification/amm-vote.js +3 -1
  69. package/lib/parse/specification/amm-withdraw.js +3 -1
  70. package/lib/parse/specification/check-cancel.js +3 -1
  71. package/lib/parse/specification/check-cash.js +3 -1
  72. package/lib/parse/specification/check-create.js +3 -1
  73. package/lib/parse/specification/clawback.js +3 -1
  74. package/lib/parse/specification/deposit-preauth.js +3 -1
  75. package/lib/parse/specification/escrow-cancel.js +2 -0
  76. package/lib/parse/specification/escrow-create.js +2 -0
  77. package/lib/parse/specification/escrow-finish.js +2 -0
  78. package/lib/parse/specification/fee-update.js +3 -1
  79. package/lib/parse/specification/import.js +2 -0
  80. package/lib/parse/specification/invoke.js +2 -0
  81. package/lib/parse/specification/nftoken-accept-offer.js +2 -0
  82. package/lib/parse/specification/nftoken-burn.js +2 -0
  83. package/lib/parse/specification/nftoken-cancel-offer.js +2 -0
  84. package/lib/parse/specification/nftoken-create-offer.js +2 -0
  85. package/lib/parse/specification/nftoken-mint.js +2 -0
  86. package/lib/parse/specification/offer-cancel.js +3 -1
  87. package/lib/parse/specification/offer-create.js +3 -1
  88. package/lib/parse/specification/payment-channel-claim.js +3 -1
  89. package/lib/parse/specification/payment-channel-create.js +3 -1
  90. package/lib/parse/specification/payment-channel-fund.js +3 -1
  91. package/lib/parse/specification/payment.js +3 -1
  92. package/lib/parse/specification/remit.js +2 -0
  93. package/lib/parse/specification/settings.js +2 -0
  94. package/lib/parse/specification/ticket-create.js +3 -1
  95. package/lib/parse/specification/trustline.js +3 -1
  96. package/lib/parse/specification/unl-report.js +2 -0
  97. package/lib/parse/specification/uritoken-burn.js +2 -0
  98. package/lib/parse/specification/uritoken-buy.js +2 -0
  99. package/lib/parse/specification/uritoken-cancel-sell-offer.js +2 -0
  100. package/lib/parse/specification/uritoken-create-sell-offer.js +2 -0
  101. package/lib/parse/specification/uritoken-mint.js +2 -3
  102. package/lib/parse/transaction.js +2 -3
  103. package/lib/parse/utils.d.ts +0 -1
  104. package/lib/parse/utils.js +12 -13
  105. package/lib/types/specification.d.ts +2 -0
  106. package/lib/v1/transaction/payment.js +1 -2
  107. package/lib/v1/utils.js +2 -3
  108. package/lib/validator.d.ts +0 -1
  109. package/lib/validator.js +5 -6
  110. package/lib/wallet.d.ts +0 -1
  111. package/lib/wallet.js +9 -9
  112. package/package.json +10 -10
@@ -23,7 +23,12 @@ 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.submitPaymentTransactionV1 = exports.getTransactionByCTID = exports.getTransaction = void 0;
26
+ exports.getTransaction = getTransaction;
27
+ exports.getTransactionByCTID = getTransactionByCTID;
28
+ exports.submitPaymentTransactionV1 = submitPaymentTransactionV1;
29
+ exports.getAccountPaymentParams = getAccountPaymentParams;
30
+ exports.getTxSubmitParams = getTxSubmitParams;
31
+ exports.submit = submit;
27
32
  const xrpl = __importStar(require("xrpl"));
28
33
  const ripple_binary_codec_1 = require("ripple-binary-codec");
29
34
  const Client = __importStar(require("../client"));
@@ -86,7 +91,6 @@ async function getTransaction(transaction, options = {}) {
86
91
  }
87
92
  return result;
88
93
  }
89
- exports.getTransaction = getTransaction;
90
94
  async function getTransactionByCTID(ctid, options = {}) {
91
95
  if (!(0, transaction_1.isCTID)(ctid)) {
92
96
  return {
@@ -158,7 +162,6 @@ async function getTransactionByCTID(ctid, options = {}) {
158
162
  }
159
163
  return result;
160
164
  }
161
- exports.getTransactionByCTID = getTransactionByCTID;
162
165
  async function submitPaymentTransactionV1(data, definitions, validateTx) {
163
166
  const connection = Client.findConnection("payment, submit, !clio");
164
167
  if (!connection) {
@@ -185,7 +188,12 @@ async function submitPaymentTransactionV1(data, definitions, validateTx) {
185
188
  memos: data.memos,
186
189
  };
187
190
  const transaction = (0, payment_1.createPaymentTransaction)(data.sourceAddress, txPayment);
188
- const submitParams = await getTxSubmitParams(data.sourceAddress, transaction, definitions, connection);
191
+ const skip = {
192
+ fee: data.fee ? true : false,
193
+ sequence: data.sequence ? true : false,
194
+ lastLedgerSequence: data.lastLedgerSequence ? true : false,
195
+ };
196
+ const submitParams = await getTxSubmitParams(data.sourceAddress, transaction, definitions, connection, skip);
189
197
  if ("error" in submitParams) {
190
198
  return submitParams;
191
199
  }
@@ -201,12 +209,16 @@ async function submitPaymentTransactionV1(data, definitions, validateTx) {
201
209
  else {
202
210
  transaction.Sequence = submitParams.sequence;
203
211
  }
204
- transaction.LastLedgerSequence = submitParams.lastLedgerSequence;
212
+ if (data.lastLedgerSequence) {
213
+ transaction.LastLedgerSequence = data.lastLedgerSequence;
214
+ }
215
+ else if (submitParams.lastLedgerSequence) {
216
+ transaction.LastLedgerSequence = submitParams.lastLedgerSequence;
217
+ }
205
218
  const wallet = (0, wallet_1.walletFromSeed)(data.secret, { seedAddress: transaction.Account });
206
219
  const signedTransaction = (0, wallet_1.signTransaction)(wallet, transaction, false, definitions, validateTx).tx_blob;
207
220
  return await submit(signedTransaction, { connection, definitions });
208
221
  }
209
- exports.submitPaymentTransactionV1 = submitPaymentTransactionV1;
210
222
  async function getAccountPaymentParams(account, connection) {
211
223
  try {
212
224
  connection = connection || Client.findConnection("submit") || undefined;
@@ -264,56 +276,64 @@ async function getAccountPaymentParams(account, connection) {
264
276
  };
265
277
  }
266
278
  }
267
- exports.getAccountPaymentParams = getAccountPaymentParams;
268
- async function getTxSubmitParams(account, tx, definitions, connection) {
279
+ async function getTxSubmitParams(account, tx, definitions, connection, skip) {
269
280
  try {
270
281
  connection = connection || Client.findConnection("submit") || undefined;
271
282
  if (!connection) {
272
283
  throw new Error("There is no connection");
273
284
  }
274
- const feePromise = new Promise(async (resolve, rejects) => {
275
- try {
276
- if (tx && typeof tx === "object") {
277
- tx = { ...tx, Sequence: 0, Fee: "0", SigningPubKey: "" };
285
+ let feePromise;
286
+ let sequencePromise;
287
+ let lastLedgerSequencePromise;
288
+ if (skip?.fee !== true) {
289
+ feePromise = new Promise(async (resolve, rejects) => {
290
+ try {
291
+ if (tx && typeof tx === "object") {
292
+ tx = { ...tx, Sequence: 0, Fee: "0", SigningPubKey: "" };
293
+ }
294
+ const baseFee = await Client.getFee({ connection, tx, definitions });
295
+ let fee = parseFloat(baseFee);
296
+ if (fee > FEE_LIMIT) {
297
+ fee = FEE_LIMIT;
298
+ }
299
+ resolve((0, common_1.xrpToDrops)(fee.toString()));
278
300
  }
279
- const baseFee = await Client.getFee({ connection, tx, definitions });
280
- let fee = parseFloat(baseFee);
281
- if (fee > FEE_LIMIT) {
282
- fee = FEE_LIMIT;
301
+ catch (e) {
302
+ rejects(e);
283
303
  }
284
- resolve((0, common_1.xrpToDrops)(fee.toString()));
285
- }
286
- catch (e) {
287
- rejects(e);
288
- }
289
- });
290
- const sequencePromise = new Promise(async (resolve, rejects) => {
291
- try {
292
- const accountData = await Client.getAccountInfoData(account, { connection });
293
- if (!accountData) {
294
- return rejects(new Error("Account not found"));
304
+ });
305
+ }
306
+ if (skip?.sequence !== true) {
307
+ sequencePromise = new Promise(async (resolve, rejects) => {
308
+ try {
309
+ const accountData = await Client.getAccountInfoData(account, { connection });
310
+ if (!accountData) {
311
+ return rejects(new Error("Account not found"));
312
+ }
313
+ if ("error" in accountData) {
314
+ return rejects(new Error(accountData.error));
315
+ }
316
+ resolve(accountData.Sequence);
295
317
  }
296
- if ("error" in accountData) {
297
- return rejects(new Error(accountData.error));
318
+ catch (e) {
319
+ rejects(e);
298
320
  }
299
- resolve(accountData.Sequence);
300
- }
301
- catch (e) {
302
- rejects(e);
303
- }
304
- });
305
- const lastLedgerSequencePromise = new Promise(async (resolve) => {
306
- try {
307
- const ledgerIndex = await Client.getLedgerIndex();
308
- if (ledgerIndex !== undefined) {
309
- resolve(ledgerIndex + MAX_LEDGERS_AWAIT);
321
+ });
322
+ }
323
+ if (skip?.lastLedgerSequence !== true) {
324
+ lastLedgerSequencePromise = new Promise(async (resolve) => {
325
+ try {
326
+ const ledgerIndex = await Client.getLedgerIndex();
327
+ if (ledgerIndex !== undefined) {
328
+ resolve(ledgerIndex + MAX_LEDGERS_AWAIT);
329
+ }
330
+ resolve(undefined);
310
331
  }
311
- resolve(undefined);
312
- }
313
- catch (e) {
314
- resolve(undefined);
315
- }
316
- });
332
+ catch (e) {
333
+ resolve(undefined);
334
+ }
335
+ });
336
+ }
317
337
  const result = await Promise.all([feePromise, sequencePromise, lastLedgerSequencePromise]);
318
338
  return {
319
339
  fee: result[0],
@@ -330,7 +350,6 @@ async function getTxSubmitParams(account, tx, definitions, connection) {
330
350
  };
331
351
  }
332
352
  }
333
- exports.getTxSubmitParams = getTxSubmitParams;
334
353
  async function submit(signedTransaction, options = {}) {
335
354
  const connection = options.connection || Client.findConnection("submit");
336
355
  if (!connection) {
@@ -364,7 +383,6 @@ async function submit(signedTransaction, options = {}) {
364
383
  const finalResult = await waitForFinalTransactionOutcome(txHash, lastLedger);
365
384
  return finalResult;
366
385
  }
367
- exports.submit = submit;
368
386
  async function waitForFinalTransactionOutcome(txHash, lastLedger) {
369
387
  await (0, utils_1.sleep)(LEDGER_CLOSE_TIME_AWAIT);
370
388
  const tx = await getTransaction(txHash);
@@ -23,7 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.createVLBlobV2 = exports.createVLv2 = void 0;
26
+ exports.createVLv2 = createVLv2;
27
+ exports.createVLBlobV2 = createVLBlobV2;
27
28
  const vl_1 = require("../models/vl");
28
29
  const manifest_1 = require("../models/manifest");
29
30
  const ledger_1 = require("../models/ledger");
@@ -99,7 +100,6 @@ async function createVLv2(masterKey, ephemeralKey, publishBlobs) {
99
100
  version: 2,
100
101
  };
101
102
  }
102
- exports.createVLv2 = createVLv2;
103
103
  async function createVLBlobV2(sequence, effective, expiration, validatorsPublicKeys) {
104
104
  const validators = await (0, vl_2.getVLBlobValidatorsManifest)(validatorsPublicKeys);
105
105
  return (0, common_1.removeUndefined)({
@@ -109,4 +109,3 @@ async function createVLBlobV2(sequence, effective, expiration, validatorsPublicK
109
109
  validators,
110
110
  });
111
111
  }
112
- exports.createVLBlobV2 = createVLBlobV2;
package/lib/ledger/vl.js CHANGED
@@ -23,7 +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.getVLBlobValidatorsManifest = exports.createVLBlob = exports.createVL = void 0;
26
+ exports.createVL = createVL;
27
+ exports.createVLBlob = createVLBlob;
28
+ exports.getVLBlobValidatorsManifest = getVLBlobValidatorsManifest;
27
29
  const Client = __importStar(require("../client"));
28
30
  const vl_1 = require("../models/vl");
29
31
  const manifest_1 = require("../models/manifest");
@@ -74,7 +76,6 @@ async function createVL(masterKey, ephemeralKey, sequence, expiration, validator
74
76
  version: 1,
75
77
  };
76
78
  }
77
- exports.createVL = createVL;
78
79
  async function createVLBlob(sequence, expiration, validatorsPublicKeys) {
79
80
  const validators = await getVLBlobValidatorsManifest(validatorsPublicKeys);
80
81
  return {
@@ -83,7 +84,6 @@ async function createVLBlob(sequence, expiration, validatorsPublicKeys) {
83
84
  validators,
84
85
  };
85
86
  }
86
- exports.createVLBlob = createVLBlob;
87
87
  async function getVLBlobValidatorsManifest(validatorsPublicKeys) {
88
88
  const connection = Client.findConnection("manifest");
89
89
  if (!connection) {
@@ -109,4 +109,3 @@ async function getVLBlobValidatorsManifest(validatorsPublicKeys) {
109
109
  });
110
110
  return validators;
111
111
  }
112
- exports.getVLBlobValidatorsManifest = getVLBlobValidatorsManifest;
@@ -3,7 +3,11 @@ 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.parseSignerListFlags = exports.parseAccountFields = exports.parseAccountFlags = exports.getSettings = exports.AccountFields = exports.SignerListFlagsKeys = exports.AccountSetFlags = exports.AccountRootFlagsKeys = void 0;
6
+ exports.AccountFields = exports.SignerListFlagsKeys = exports.AccountSetFlags = exports.AccountRootFlagsKeys = void 0;
7
+ exports.getSettings = getSettings;
8
+ exports.parseAccountFlags = parseAccountFlags;
9
+ exports.parseAccountFields = parseAccountFields;
10
+ exports.parseSignerListFlags = parseSignerListFlags;
7
11
  const xrpl_1 = require("xrpl");
8
12
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
13
  const common_1 = require("../common");
@@ -60,11 +64,9 @@ function getSettings(accountInfo, excludeFalse = true) {
60
64
  ...parsedFields,
61
65
  };
62
66
  }
63
- exports.getSettings = getSettings;
64
67
  function parseAccountFlags(value, options = {}) {
65
68
  return (0, flags_1.parseFlags)(value, exports.AccountRootFlagsKeys, options);
66
69
  }
67
- exports.parseAccountFlags = parseAccountFlags;
68
70
  function parseAccountFields(accountInfo, options = {}) {
69
71
  const settings = {};
70
72
  if (accountInfo.hasOwnProperty("signer_lists")) {
@@ -95,8 +97,6 @@ function parseAccountFields(accountInfo, options = {}) {
95
97
  }
96
98
  return settings;
97
99
  }
98
- exports.parseAccountFields = parseAccountFields;
99
100
  function parseSignerListFlags(value, options = {}) {
100
101
  return (0, flags_1.parseFlags)(value, exports.SignerListFlagsKeys, options);
101
102
  }
102
- exports.parseSignerListFlags = parseSignerListFlags;
@@ -3,7 +3,10 @@ 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.buildNFTokenID = exports.parseNFTokenID = exports.cipheredTaxon = exports.sortHelperAccountNFToken = void 0;
6
+ exports.sortHelperAccountNFToken = sortHelperAccountNFToken;
7
+ exports.cipheredTaxon = cipheredTaxon;
8
+ exports.parseNFTokenID = parseNFTokenID;
9
+ exports.buildNFTokenID = buildNFTokenID;
7
10
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
11
  const AddressCodec = require("ripple-address-codec");
9
12
  const utils_1 = require("../parse/utils");
@@ -20,7 +23,6 @@ function sortHelperAccountNFToken(a, b) {
20
23
  }
21
24
  return 0;
22
25
  }
23
- exports.sortHelperAccountNFToken = sortHelperAccountNFToken;
24
26
  function cipheredTaxon(tokenSeq, taxon) {
25
27
  const m = 384160001n;
26
28
  const c = 2459n;
@@ -29,7 +31,6 @@ function cipheredTaxon(tokenSeq, taxon) {
29
31
  const p2 = (p1 + c) % max;
30
32
  return (taxon ^ Number(p2)) >>> 0;
31
33
  }
32
- exports.cipheredTaxon = cipheredTaxon;
33
34
  function parseNFTokenID(nftokenID) {
34
35
  if (typeof nftokenID !== "string" || nftokenID.length !== 64) {
35
36
  return null;
@@ -48,7 +49,6 @@ function parseNFTokenID(nftokenID) {
48
49
  Sequence: sequence,
49
50
  };
50
51
  }
51
- exports.parseNFTokenID = parseNFTokenID;
52
52
  function buildNFTokenID(flags, transferFee, issuer, taxon, sequence) {
53
53
  const scrambledTaxon = cipheredTaxon(sequence, taxon);
54
54
  return (new bignumber_js_1.default(flags).toString(16).padStart(4, "0").toUpperCase() +
@@ -57,4 +57,3 @@ function buildNFTokenID(flags, transferFee, issuer, taxon, sequence) {
57
57
  new bignumber_js_1.default(scrambledTaxon).toString(16).padStart(8, "0").toUpperCase() +
58
58
  new bignumber_js_1.default(sequence).toString(16).padStart(8, "0").toUpperCase());
59
59
  }
60
- exports.buildNFTokenID = buildNFTokenID;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.accountObjectsToURITokens = exports.accountObjectsToNFTOffers = exports.accountObjectsToAccountLines = void 0;
3
+ exports.accountObjectsToAccountLines = accountObjectsToAccountLines;
4
+ exports.accountObjectsToNFTOffers = accountObjectsToNFTOffers;
5
+ exports.accountObjectsToURITokens = accountObjectsToURITokens;
4
6
  const xrpl_1 = require("xrpl");
5
7
  const { RippleStateFlags } = xrpl_1.LedgerEntry;
6
8
  const common_1 = require("../common");
@@ -13,7 +15,6 @@ function accountObjectsToAccountLines(account, accountObjects) {
13
15
  const accountLinesFormatted = notInDefaultState.map((node) => RippleStateToTrustLine(node, account));
14
16
  return accountLinesFormatted;
15
17
  }
16
- exports.accountObjectsToAccountLines = accountObjectsToAccountLines;
17
18
  const RippleStateToTrustLine = (ledgerEntry, account) => {
18
19
  const parties = [ledgerEntry.HighLimit, ledgerEntry.LowLimit];
19
20
  const [self, counterparty] = ledgerEntry.HighLimit.issuer === account ? parties : parties.reverse();
@@ -65,7 +66,6 @@ function accountObjectsToNFTOffers(accountObjects) {
65
66
  });
66
67
  return nftOffers;
67
68
  }
68
- exports.accountObjectsToNFTOffers = accountObjectsToNFTOffers;
69
69
  function accountObjectsToURITokens(accountObjects) {
70
70
  const uriTokenObjects = accountObjects.filter((obj) => {
71
71
  return obj.LedgerEntryType === "URIToken";
@@ -86,4 +86,3 @@ function accountObjectsToURITokens(accountObjects) {
86
86
  });
87
87
  return uriTokens;
88
88
  }
89
- exports.accountObjectsToURITokens = accountObjectsToURITokens;
@@ -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.formatBidsAndAsks = void 0;
6
+ exports.formatBidsAndAsks = formatBidsAndAsks;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
8
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
9
  const orderbook_order_1 = require("../parse/ledger/orderbook-order");
@@ -38,4 +38,3 @@ function formatBidsAndAsks(orderbook, offers) {
38
38
  const asks = alignedOrders.filter(lodash_1.default.partial(directionFilter, "sell"));
39
39
  return { bids, asks };
40
40
  }
41
- exports.formatBidsAndAsks = formatBidsAndAsks;
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ledgerTimeToISO8601 = exports.ledgerTimeToTimestamp = exports.ledgerTimeToUnixTime = exports.unixTimeToLedgerTime = exports.RIPPLE_UNIX_DIFF = void 0;
3
+ exports.RIPPLE_UNIX_DIFF = void 0;
4
+ exports.unixTimeToLedgerTime = unixTimeToLedgerTime;
5
+ exports.ledgerTimeToUnixTime = ledgerTimeToUnixTime;
6
+ exports.ledgerTimeToTimestamp = ledgerTimeToTimestamp;
7
+ exports.ledgerTimeToISO8601 = ledgerTimeToISO8601;
4
8
  exports.RIPPLE_UNIX_DIFF = 946684800;
5
9
  function unixTimeToLedgerTime(time) {
6
10
  return time - exports.RIPPLE_UNIX_DIFF;
7
11
  }
8
- exports.unixTimeToLedgerTime = unixTimeToLedgerTime;
9
12
  function ledgerTimeToUnixTime(ledgerTime) {
10
13
  return ledgerTime + exports.RIPPLE_UNIX_DIFF;
11
14
  }
12
- exports.ledgerTimeToUnixTime = ledgerTimeToUnixTime;
13
15
  function ledgerTimeToTimestamp(ledgerTime) {
14
16
  return ledgerTimeToUnixTime(ledgerTime) * 1000;
15
17
  }
16
- exports.ledgerTimeToTimestamp = ledgerTimeToTimestamp;
17
18
  function ledgerTimeToISO8601(ledgerTime) {
18
19
  return new Date(ledgerTimeToTimestamp(ledgerTime)).toISOString();
19
20
  }
20
- exports.ledgerTimeToISO8601 = ledgerTimeToISO8601;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export interface ManifestInterface {
3
2
  Sequence?: number;
4
3
  PublicKey?: string;
@@ -23,7 +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.generateManifest = exports.parseManifest = exports.decodeManifest = void 0;
26
+ exports.decodeManifest = decodeManifest;
27
+ exports.parseManifest = parseManifest;
28
+ exports.generateManifest = generateManifest;
27
29
  const ripple_binary_codec_1 = require("ripple-binary-codec");
28
30
  const ripple_address_codec_1 = require("ripple-address-codec");
29
31
  const Validator = __importStar(require("../validator"));
@@ -48,7 +50,6 @@ function decodeManifest(manifest) {
48
50
  }
49
51
  return manifestDecoded;
50
52
  }
51
- exports.decodeManifest = decodeManifest;
52
53
  function parseManifest(manifest) {
53
54
  const buf = Buffer.from(manifest, "base64");
54
55
  const decoded = {};
@@ -146,7 +147,6 @@ function parseManifest(manifest) {
146
147
  }
147
148
  return decoded;
148
149
  }
149
- exports.parseManifest = parseManifest;
150
150
  function generateManifest(manifest) {
151
151
  const verifyFields = [Buffer.from("MAN\x00", "utf-8")];
152
152
  const sequenceBuffer = Buffer.alloc(5);
@@ -183,4 +183,3 @@ function generateManifest(manifest) {
183
183
  }), "hex");
184
184
  return manifestBuffer.toString("base64");
185
185
  }
186
- exports.generateManifest = generateManifest;
@@ -3,30 +3,34 @@ 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.decodeCTID = exports.encodeCTID = exports.isCTID = exports.streamTxToTx = exports.ledgerTxToTx = exports.accountTxToTx = exports.getStreamTxDetails = exports.getLedgerTxDetails = exports.getAccountTxDetails = exports.getTxDetails = void 0;
6
+ exports.getTxDetails = getTxDetails;
7
+ exports.getAccountTxDetails = getAccountTxDetails;
8
+ exports.getLedgerTxDetails = getLedgerTxDetails;
9
+ exports.getStreamTxDetails = getStreamTxDetails;
10
+ exports.accountTxToTx = accountTxToTx;
11
+ exports.ledgerTxToTx = ledgerTxToTx;
12
+ exports.streamTxToTx = streamTxToTx;
13
+ exports.isCTID = isCTID;
14
+ exports.encodeCTID = encodeCTID;
15
+ exports.decodeCTID = decodeCTID;
7
16
  const lodash_1 = __importDefault(require("lodash"));
8
17
  const transaction_1 = require("../parse/transaction");
9
18
  const CTID_REGEX = /^[cC]{1}[a-fA-F0-9]{15}$/;
10
19
  function getTxDetails(tx, includeRawTransaction, nativeCurrency, definitions) {
11
20
  return (0, transaction_1.parseTransaction)(tx, includeRawTransaction, nativeCurrency, definitions);
12
21
  }
13
- exports.getTxDetails = getTxDetails;
14
22
  function getAccountTxDetails(tx, includeRawTransaction, nativeCurrency) {
15
23
  return getTxDetails(accountTxToTx(tx), includeRawTransaction, nativeCurrency);
16
24
  }
17
- exports.getAccountTxDetails = getAccountTxDetails;
18
25
  function getLedgerTxDetails(tx, ledgerIndex, closeTime, includeRawTransaction, nativeCurrency, definitions) {
19
26
  return getTxDetails(ledgerTxToTx(tx, ledgerIndex, closeTime), includeRawTransaction, nativeCurrency, definitions);
20
27
  }
21
- exports.getLedgerTxDetails = getLedgerTxDetails;
22
28
  function getStreamTxDetails(tx, includeRawTransaction, nativeCurrency, definitions) {
23
29
  return getTxDetails(streamTxToTx(tx), includeRawTransaction, nativeCurrency, definitions);
24
30
  }
25
- exports.getStreamTxDetails = getStreamTxDetails;
26
31
  function accountTxToTx(accountTx) {
27
32
  return Object.assign({}, accountTx.tx, { meta: accountTx.meta, validated: accountTx.validated });
28
33
  }
29
- exports.accountTxToTx = accountTxToTx;
30
34
  function ledgerTxToTx(ledgerTx, ledgerIndex, closeTime) {
31
35
  const tx = lodash_1.default.omit(ledgerTx, "metaData");
32
36
  return Object.assign({}, tx, {
@@ -36,7 +40,6 @@ function ledgerTxToTx(ledgerTx, ledgerIndex, closeTime) {
36
40
  validated: true,
37
41
  });
38
42
  }
39
- exports.ledgerTxToTx = ledgerTxToTx;
40
43
  function streamTxToTx(streamTx) {
41
44
  return Object.assign({}, streamTx.transaction, {
42
45
  meta: streamTx.meta,
@@ -44,7 +47,6 @@ function streamTxToTx(streamTx) {
44
47
  validated: streamTx.validated,
45
48
  });
46
49
  }
47
- exports.streamTxToTx = streamTxToTx;
48
50
  function isCTID(ctid) {
49
51
  let ctidValue;
50
52
  if (typeof ctid === "string") {
@@ -64,7 +66,6 @@ function isCTID(ctid) {
64
66
  }
65
67
  return true;
66
68
  }
67
- exports.isCTID = isCTID;
68
69
  function encodeCTID(ledgerIndex, txIndex, networkID) {
69
70
  if (typeof ledgerIndex !== "number") {
70
71
  throw new Error("ledgerIndex must be a number.");
@@ -88,7 +89,6 @@ function encodeCTID(ledgerIndex, txIndex, networkID) {
88
89
  .toString(16)
89
90
  .toUpperCase();
90
91
  }
91
- exports.encodeCTID = encodeCTID;
92
92
  function decodeCTID(ctid) {
93
93
  let ctidValue;
94
94
  if (typeof ctid === "string") {
@@ -115,4 +115,3 @@ function decodeCTID(ctid) {
115
115
  networkID,
116
116
  };
117
117
  }
118
- exports.decodeCTID = decodeCTID;
package/lib/models/vl.js CHANGED
@@ -23,7 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.parseValidationData = exports.encodeVLBlob = exports.isValidVL = exports.parseVL = void 0;
26
+ exports.parseVL = parseVL;
27
+ exports.isValidVL = isValidVL;
28
+ exports.encodeVLBlob = encodeVLBlob;
29
+ exports.parseValidationData = parseValidationData;
27
30
  const manifest_1 = require("./manifest");
28
31
  const utils_1 = require("../parse/utils");
29
32
  const ledger_1 = require("./ledger");
@@ -152,7 +155,6 @@ function parseVL(vl) {
152
155
  }
153
156
  return decoded;
154
157
  }
155
- exports.parseVL = parseVL;
156
158
  function isValidVL(vl) {
157
159
  let error = isValidVLFormat(vl);
158
160
  if (error) {
@@ -196,7 +198,6 @@ function isValidVL(vl) {
196
198
  }
197
199
  return error;
198
200
  }
199
- exports.isValidVL = isValidVL;
200
201
  function isValidVLFormat(vl) {
201
202
  const { version, public_key, manifest, blob } = vl;
202
203
  let error = null;
@@ -240,7 +241,6 @@ function decodeVLBlob(blob) {
240
241
  function encodeVLBlob(vlBlob) {
241
242
  return Buffer.from(JSON.stringify(vlBlob)).toString("base64");
242
243
  }
243
- exports.encodeVLBlob = encodeVLBlob;
244
244
  function isValidVLBlob(blob) {
245
245
  if (blob === null) {
246
246
  return "Blob is not valid";
@@ -479,4 +479,3 @@ function parseValidationData(data, publicKey) {
479
479
  decoded._verified = true;
480
480
  return decoded;
481
481
  }
482
- exports.parseValidationData = parseValidationData;
@@ -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.parseAccountOrder = void 0;
6
+ exports.parseAccountOrder = parseAccountOrder;
7
7
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
8
  const amount_1 = __importDefault(require("./amount"));
9
9
  const utils_1 = require("../utils");
@@ -36,4 +36,3 @@ function parseAccountOrder(address, order) {
36
36
  };
37
37
  return { specification, properties };
38
38
  }
39
- exports.parseAccountOrder = parseAccountOrder;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseAccount = void 0;
3
+ exports.parseAccount = parseAccount;
4
4
  const common_1 = require("../../common");
5
5
  function parseAccount(account) {
6
6
  return account === "" ? common_1.ACCOUNT_ZERO : account;
7
7
  }
8
- exports.parseAccount = parseAccount;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseEmittedDetails = void 0;
3
+ exports.parseEmittedDetails = parseEmittedDetails;
4
4
  function parseEmittedDetails(tx) {
5
5
  if (tx && tx.EmitDetails) {
6
6
  return {
@@ -12,4 +12,3 @@ function parseEmittedDetails(tx) {
12
12
  };
13
13
  }
14
14
  }
15
- exports.parseEmittedDetails = parseEmittedDetails;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseFlags = void 0;
3
+ exports.parseFlags = parseFlags;
4
4
  function parseFlags(value, keys, options = {}) {
5
5
  const flags = {};
6
6
  for (const flagName in keys) {
@@ -15,4 +15,3 @@ function parseFlags(value, keys, options = {}) {
15
15
  }
16
16
  return flags;
17
17
  }
18
- exports.parseFlags = parseFlags;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseImportBlob = void 0;
3
+ exports.parseImportBlob = parseImportBlob;
4
4
  const ripple_binary_codec_1 = require("ripple-binary-codec");
5
5
  const wallet_1 = require("../../wallet");
6
6
  const vl_1 = require("../../models/vl");
@@ -38,4 +38,3 @@ function parseImportBlob(blob) {
38
38
  return blob;
39
39
  }
40
40
  }
41
- exports.parseImportBlob = parseImportBlob;
@@ -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.parseLedger = void 0;
6
+ exports.parseLedger = parseLedger;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
8
  const common_1 = require("../../common");
9
9
  const models_1 = require("../../models");
@@ -58,4 +58,3 @@ function parseLedger(ledger, includeRawTransactions) {
58
58
  transactionHash: ledger.transaction_hash,
59
59
  }, parseTransactions(ledger.transactions, ledgerVersion, includeRawTransactions), parseState(ledger.accountState)));
60
60
  }
61
- exports.parseLedger = parseLedger;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formattedMemoToMemo = exports.parseMemos = void 0;
3
+ exports.parseMemos = parseMemos;
4
+ exports.formattedMemoToMemo = formattedMemoToMemo;
4
5
  const common_1 = require("../../common");
5
6
  const utils_1 = require("../utils");
6
7
  function parseMemos(tx) {
@@ -15,7 +16,6 @@ function parseMemos(tx) {
15
16
  });
16
17
  });
17
18
  }
18
- exports.parseMemos = parseMemos;
19
19
  function formattedMemoToMemo(memo) {
20
20
  return {
21
21
  Memo: (0, common_1.removeUndefined)({
@@ -25,4 +25,3 @@ function formattedMemoToMemo(memo) {
25
25
  }),
26
26
  };
27
27
  }
28
- exports.formattedMemoToMemo = formattedMemoToMemo;
@@ -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.parseOrderbookOrder = void 0;
6
+ exports.parseOrderbookOrder = parseOrderbookOrder;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
8
  const utils_1 = require("../utils");
9
9
  const common_1 = require("../../common");
@@ -36,4 +36,3 @@ function parseOrderbookOrder(data) {
36
36
  const state = lodash_1.default.isEmpty(available) ? undefined : available;
37
37
  return (0, common_1.removeUndefined)({ specification, properties, state, data });
38
38
  }
39
- exports.parseOrderbookOrder = parseOrderbookOrder;