@bithomp/xrpl-api 3.0.8 → 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 (111) 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.js +6 -7
  26. package/lib/ledger/vl-v2.js +2 -3
  27. package/lib/ledger/vl.js +3 -4
  28. package/lib/models/account_info.js +5 -5
  29. package/lib/models/account_nfts.js +4 -5
  30. package/lib/models/account_object.js +3 -4
  31. package/lib/models/book_offers.js +1 -2
  32. package/lib/models/ledger.js +5 -5
  33. package/lib/models/manifest.d.ts +0 -1
  34. package/lib/models/manifest.js +3 -4
  35. package/lib/models/transaction.js +10 -11
  36. package/lib/models/vl.js +4 -5
  37. package/lib/parse/ledger/account-order.js +1 -2
  38. package/lib/parse/ledger/account.js +1 -2
  39. package/lib/parse/ledger/emit_details.js +1 -2
  40. package/lib/parse/ledger/flags.js +1 -2
  41. package/lib/parse/ledger/import.js +1 -2
  42. package/lib/parse/ledger/ledger.js +1 -2
  43. package/lib/parse/ledger/memos.js +2 -3
  44. package/lib/parse/ledger/orderbook-order.js +1 -2
  45. package/lib/parse/outcome/affected_objects.js +1 -2
  46. package/lib/parse/outcome/amm_changes.js +1 -2
  47. package/lib/parse/outcome/balance_changes.js +2 -3
  48. package/lib/parse/outcome/channel_changes.js +1 -2
  49. package/lib/parse/outcome/emitted_txns.js +1 -2
  50. package/lib/parse/outcome/escrow_changes.js +1 -2
  51. package/lib/parse/outcome/hooks_executions.js +1 -2
  52. package/lib/parse/outcome/locked_balance_changes.js +2 -3
  53. package/lib/parse/outcome/nftoken_changes.js +1 -2
  54. package/lib/parse/outcome/nftoken_offer_changes.js +1 -2
  55. package/lib/parse/outcome/orderbook_changes.js +1 -2
  56. package/lib/parse/outcome/orderbook_quality.js +1 -2
  57. package/lib/parse/outcome/unl_report_changes.js +1 -2
  58. package/lib/parse/outcome/uritoken_changes.js +1 -2
  59. package/lib/parse/outcome/uritoken_sell_offer_changes.js +1 -2
  60. package/lib/parse/outcome.js +1 -2
  61. package/lib/parse/specification/account-delete.js +2 -0
  62. package/lib/parse/specification/amendment.js +27 -0
  63. package/lib/parse/specification/amm-bid.js +3 -1
  64. package/lib/parse/specification/amm-create.js +3 -1
  65. package/lib/parse/specification/amm-delete.js +3 -1
  66. package/lib/parse/specification/amm-deposit.js +3 -1
  67. package/lib/parse/specification/amm-vote.js +3 -1
  68. package/lib/parse/specification/amm-withdraw.js +3 -1
  69. package/lib/parse/specification/check-cancel.js +3 -1
  70. package/lib/parse/specification/check-cash.js +3 -1
  71. package/lib/parse/specification/check-create.js +3 -1
  72. package/lib/parse/specification/clawback.js +3 -1
  73. package/lib/parse/specification/deposit-preauth.js +3 -1
  74. package/lib/parse/specification/escrow-cancel.js +2 -0
  75. package/lib/parse/specification/escrow-create.js +2 -0
  76. package/lib/parse/specification/escrow-finish.js +2 -0
  77. package/lib/parse/specification/fee-update.js +3 -1
  78. package/lib/parse/specification/import.js +2 -0
  79. package/lib/parse/specification/invoke.js +2 -0
  80. package/lib/parse/specification/nftoken-accept-offer.js +2 -0
  81. package/lib/parse/specification/nftoken-burn.js +2 -0
  82. package/lib/parse/specification/nftoken-cancel-offer.js +2 -0
  83. package/lib/parse/specification/nftoken-create-offer.js +2 -0
  84. package/lib/parse/specification/nftoken-mint.js +2 -0
  85. package/lib/parse/specification/offer-cancel.js +3 -1
  86. package/lib/parse/specification/offer-create.js +3 -1
  87. package/lib/parse/specification/payment-channel-claim.js +3 -1
  88. package/lib/parse/specification/payment-channel-create.js +3 -1
  89. package/lib/parse/specification/payment-channel-fund.js +3 -1
  90. package/lib/parse/specification/payment.js +3 -1
  91. package/lib/parse/specification/remit.js +2 -0
  92. package/lib/parse/specification/settings.js +2 -0
  93. package/lib/parse/specification/ticket-create.js +3 -1
  94. package/lib/parse/specification/trustline.js +3 -1
  95. package/lib/parse/specification/unl-report.js +2 -0
  96. package/lib/parse/specification/uritoken-burn.js +2 -0
  97. package/lib/parse/specification/uritoken-buy.js +2 -0
  98. package/lib/parse/specification/uritoken-cancel-sell-offer.js +2 -0
  99. package/lib/parse/specification/uritoken-create-sell-offer.js +2 -0
  100. package/lib/parse/specification/uritoken-mint.js +2 -3
  101. package/lib/parse/transaction.js +2 -3
  102. package/lib/parse/utils.d.ts +0 -1
  103. package/lib/parse/utils.js +12 -13
  104. package/lib/types/specification.d.ts +2 -0
  105. package/lib/v1/transaction/payment.js +1 -2
  106. package/lib/v1/utils.js +2 -3
  107. package/lib/validator.d.ts +0 -1
  108. package/lib/validator.js +5 -6
  109. package/lib/wallet.d.ts +0 -1
  110. package/lib/wallet.js +9 -9
  111. package/package.json +8 -8
@@ -30,6 +30,7 @@ const assert = __importStar(require("assert"));
30
30
  const xrpl_1 = require("xrpl");
31
31
  const utils_1 = require("../utils");
32
32
  const amount_1 = __importDefault(require("../ledger/amount"));
33
+ const emit_details_1 = require("../ledger/emit_details");
33
34
  const memos_1 = require("../ledger/memos");
34
35
  const common_1 = require("../../common");
35
36
  function parseOfferCreate(tx) {
@@ -40,7 +41,6 @@ function parseOfferCreate(tx) {
40
41
  const quantity = direction === "buy" ? takerPaysAmount : takerGetsAmount;
41
42
  const totalPrice = direction === "buy" ? takerGetsAmount : takerPaysAmount;
42
43
  return (0, common_1.removeUndefined)({
43
- memos: (0, memos_1.parseMemos)(tx),
44
44
  direction: direction,
45
45
  quantity: quantity,
46
46
  totalPrice: totalPrice,
@@ -48,6 +48,8 @@ function parseOfferCreate(tx) {
48
48
  immediateOrCancel: (tx.Flags & xrpl_1.OfferCreateFlags.tfImmediateOrCancel) !== 0 || undefined,
49
49
  fillOrKill: (tx.Flags & xrpl_1.OfferCreateFlags.tfFillOrKill) !== 0 || undefined,
50
50
  expirationTime: (0, utils_1.parseTimestamp)(tx.Expiration),
51
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
52
+ memos: (0, memos_1.parseMemos)(tx),
51
53
  });
52
54
  }
53
55
  exports.default = parseOfferCreate;
@@ -30,11 +30,11 @@ const assert = __importStar(require("assert"));
30
30
  const xrpl_1 = require("xrpl");
31
31
  const common_1 = require("../../common");
32
32
  const ripple_amount_1 = __importDefault(require("../ledger/ripple-amount"));
33
+ const emit_details_1 = require("../ledger/emit_details");
33
34
  const memos_1 = require("../ledger/memos");
34
35
  function parsePaymentChannelClaim(tx) {
35
36
  assert.ok(tx.TransactionType === "PaymentChannelClaim");
36
37
  return (0, common_1.removeUndefined)({
37
- memos: (0, memos_1.parseMemos)(tx),
38
38
  channel: tx.Channel,
39
39
  balance: (0, ripple_amount_1.default)(tx.Balance),
40
40
  amount: (0, ripple_amount_1.default)(tx.Amount),
@@ -42,6 +42,8 @@ function parsePaymentChannelClaim(tx) {
42
42
  publicKey: tx.PublicKey,
43
43
  renew: Boolean(tx.Flags & xrpl_1.PaymentChannelClaimFlags.tfRenew) || undefined,
44
44
  close: Boolean(tx.Flags & xrpl_1.PaymentChannelClaimFlags.tfClose) || undefined,
45
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
46
+ memos: (0, memos_1.parseMemos)(tx),
45
47
  });
46
48
  }
47
49
  exports.default = parsePaymentChannelClaim;
@@ -30,6 +30,7 @@ const assert = __importStar(require("assert"));
30
30
  const common_1 = require("../../common");
31
31
  const utils_1 = require("../utils");
32
32
  const ripple_amount_1 = __importDefault(require("../ledger/ripple-amount"));
33
+ const emit_details_1 = require("../ledger/emit_details");
33
34
  const memos_1 = require("../ledger/memos");
34
35
  const account_1 = require("../ledger/account");
35
36
  function parsePaymentChannelCreate(tx) {
@@ -45,11 +46,12 @@ function parsePaymentChannelCreate(tx) {
45
46
  return (0, common_1.removeUndefined)({
46
47
  source: (0, common_1.removeUndefined)(source),
47
48
  destination: (0, common_1.removeUndefined)(destination),
48
- memos: (0, memos_1.parseMemos)(tx),
49
49
  amount: (0, ripple_amount_1.default)(tx.Amount),
50
50
  settleDelay: tx.SettleDelay,
51
51
  publicKey: tx.PublicKey,
52
52
  cancelAfter: tx.CancelAfter && (0, utils_1.parseTimestamp)(tx.CancelAfter),
53
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
54
+ memos: (0, memos_1.parseMemos)(tx),
53
55
  });
54
56
  }
55
57
  exports.default = parsePaymentChannelCreate;
@@ -30,14 +30,16 @@ const assert = __importStar(require("assert"));
30
30
  const common_1 = require("../../common");
31
31
  const utils_1 = require("../utils");
32
32
  const ripple_amount_1 = __importDefault(require("../ledger/ripple-amount"));
33
+ const emit_details_1 = require("../ledger/emit_details");
33
34
  const memos_1 = require("../ledger/memos");
34
35
  function parsePaymentChannelFund(tx) {
35
36
  assert.ok(tx.TransactionType === "PaymentChannelFund");
36
37
  return (0, common_1.removeUndefined)({
37
- memos: (0, memos_1.parseMemos)(tx),
38
38
  channel: tx.Channel,
39
39
  amount: (0, ripple_amount_1.default)(tx.Amount),
40
40
  expiration: tx.Expiration && (0, utils_1.parseTimestamp)(tx.Expiration),
41
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
42
+ memos: (0, memos_1.parseMemos)(tx),
41
43
  });
42
44
  }
43
45
  exports.default = parsePaymentChannelFund;
@@ -31,6 +31,7 @@ const xrpl_1 = require("xrpl");
31
31
  const utils_1 = require("../utils");
32
32
  const common_1 = require("../../common");
33
33
  const amount_1 = __importDefault(require("../ledger/amount"));
34
+ const emit_details_1 = require("../ledger/emit_details");
34
35
  const memos_1 = require("../ledger/memos");
35
36
  function isNoDirectRipple(tx) {
36
37
  return (tx.Flags & xrpl_1.PaymentFlags.tfNoRippleDirect) !== 0;
@@ -52,12 +53,13 @@ function parsePayment(tx) {
52
53
  return (0, common_1.removeUndefined)({
53
54
  source: (0, common_1.removeUndefined)(source),
54
55
  destination: (0, common_1.removeUndefined)(destination),
55
- memos: (0, memos_1.parseMemos)(tx),
56
56
  invoiceID: tx.InvoiceID,
57
57
  paths: tx.Paths ? JSON.stringify(tx.Paths) : undefined,
58
58
  allowPartialPayment: (0, utils_1.isPartialPayment)(tx) || undefined,
59
59
  noDirectRipple: isNoDirectRipple(tx) || undefined,
60
60
  limitQuality: isQualityLimited(tx) || undefined,
61
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
62
+ memos: (0, memos_1.parseMemos)(tx),
61
63
  });
62
64
  }
63
65
  exports.default = parsePayment;
@@ -28,6 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const assert = __importStar(require("assert"));
30
30
  const common_1 = require("../../common");
31
+ const emit_details_1 = require("../ledger/emit_details");
31
32
  const memos_1 = require("../ledger/memos");
32
33
  const account_1 = require("../ledger/account");
33
34
  const uritoken_flags_1 = __importDefault(require("../ledger/uritoken-flags"));
@@ -75,6 +76,7 @@ function parseRemit(tx) {
75
76
  blob: tx.Blob,
76
77
  inform: tx.Inform,
77
78
  invoiceID: tx.InvoiceID,
79
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
78
80
  memos: (0, memos_1.parseMemos)(tx),
79
81
  });
80
82
  }
@@ -31,6 +31,7 @@ const assert = __importStar(require("assert"));
31
31
  const account_info_1 = require("../../models/account_info");
32
32
  const common_1 = require("../../common");
33
33
  const fields_1 = __importDefault(require("../ledger/fields"));
34
+ const emit_details_1 = require("../ledger/emit_details");
34
35
  const memos_1 = require("../ledger/memos");
35
36
  function getAccountRootModifiedNode(tx) {
36
37
  const modifiedNodes = tx.meta.AffectedNodes.filter((node) => node.ModifiedNode?.LedgerEntryType === "AccountRoot");
@@ -73,6 +74,7 @@ function parseSettings(tx) {
73
74
  const txType = tx.TransactionType;
74
75
  assert.ok(txType === "AccountSet" || txType === "SetRegularKey" || txType === "SignerListSet");
75
76
  const baseSettings = (0, common_1.removeUndefined)({
77
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
76
78
  memos: (0, memos_1.parseMemos)(tx),
77
79
  });
78
80
  return Object.assign(baseSettings, parseSettingsFlags(tx), (0, fields_1.default)(tx));
@@ -25,12 +25,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const assert = __importStar(require("assert"));
27
27
  const common_1 = require("../../common");
28
+ const emit_details_1 = require("../ledger/emit_details");
28
29
  const memos_1 = require("../ledger/memos");
29
30
  function parseTicketCreate(tx) {
30
31
  assert.ok(tx.TransactionType === "TicketCreate");
31
32
  return (0, common_1.removeUndefined)({
32
- memos: (0, memos_1.parseMemos)(tx),
33
33
  ticketCount: tx.TicketCount,
34
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
35
+ memos: (0, memos_1.parseMemos)(tx),
34
36
  });
35
37
  }
36
38
  exports.default = parseTicketCreate;
@@ -27,6 +27,7 @@ const assert = __importStar(require("assert"));
27
27
  const xrpl_1 = require("xrpl");
28
28
  const utils_1 = require("../utils");
29
29
  const common_1 = require("../../common");
30
+ const emit_details_1 = require("../ledger/emit_details");
30
31
  const memos_1 = require("../ledger/memos");
31
32
  function parseFlag(flagsValue, trueValue, falseValue) {
32
33
  if (flagsValue & trueValue) {
@@ -43,12 +44,13 @@ function parseTrustline(tx) {
43
44
  limit: tx.LimitAmount.value,
44
45
  currency: tx.LimitAmount.currency,
45
46
  counterparty: tx.LimitAmount.issuer,
46
- memos: (0, memos_1.parseMemos)(tx),
47
47
  qualityIn: (0, utils_1.parseQuality)(tx.QualityIn),
48
48
  qualityOut: (0, utils_1.parseQuality)(tx.QualityOut),
49
49
  ripplingDisabled: parseFlag(tx.Flags, xrpl_1.TrustSetFlags.tfSetNoRipple, xrpl_1.TrustSetFlags.tfClearNoRipple),
50
50
  frozen: parseFlag(tx.Flags, xrpl_1.TrustSetFlags.tfSetFreeze, xrpl_1.TrustSetFlags.tfClearFreeze),
51
51
  authorized: parseFlag(tx.Flags, xrpl_1.TrustSetFlags.tfSetfAuth, 0),
52
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
53
+ memos: (0, memos_1.parseMemos)(tx),
52
54
  });
53
55
  }
54
56
  exports.default = parseTrustline;
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const assert = __importStar(require("assert"));
27
27
  const common_1 = require("../../common");
28
+ const emit_details_1 = require("../ledger/emit_details");
28
29
  const memos_1 = require("../ledger/memos");
29
30
  const account_1 = require("../ledger/account");
30
31
  function parseUNLReport(tx) {
@@ -38,6 +39,7 @@ function parseUNLReport(tx) {
38
39
  source: (0, common_1.removeUndefined)(source),
39
40
  activeValidator,
40
41
  importVLKey,
42
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
41
43
  memos: (0, memos_1.parseMemos)(tx),
42
44
  });
43
45
  }
@@ -25,11 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const assert = __importStar(require("assert"));
27
27
  const common_1 = require("../../common");
28
+ const emit_details_1 = require("../ledger/emit_details");
28
29
  const memos_1 = require("../ledger/memos");
29
30
  function parseNFTokenBurn(tx) {
30
31
  assert.ok(tx.TransactionType === "URITokenBurn");
31
32
  return (0, common_1.removeUndefined)({
32
33
  uritokenID: tx.URITokenID,
34
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
33
35
  memos: (0, memos_1.parseMemos)(tx),
34
36
  });
35
37
  }
@@ -25,12 +25,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const assert = __importStar(require("assert"));
27
27
  const common_1 = require("../../common");
28
+ const emit_details_1 = require("../ledger/emit_details");
28
29
  const memos_1 = require("../ledger/memos");
29
30
  function parseNFTokenBurn(tx) {
30
31
  assert.ok(tx.TransactionType === "URITokenBuy");
31
32
  return (0, common_1.removeUndefined)({
32
33
  uritokenID: tx.URITokenID,
33
34
  amount: tx.Amount,
35
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
34
36
  memos: (0, memos_1.parseMemos)(tx),
35
37
  });
36
38
  }
@@ -25,11 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const assert = __importStar(require("assert"));
27
27
  const common_1 = require("../../common");
28
+ const emit_details_1 = require("../ledger/emit_details");
28
29
  const memos_1 = require("../ledger/memos");
29
30
  function parseNFTokenBurn(tx) {
30
31
  assert.ok(tx.TransactionType === "URITokenCancelSellOffer");
31
32
  return (0, common_1.removeUndefined)({
32
33
  uritokenID: tx.URITokenID,
34
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
33
35
  memos: (0, memos_1.parseMemos)(tx),
34
36
  });
35
37
  }
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const assert = __importStar(require("assert"));
27
27
  const common_1 = require("../../common");
28
+ const emit_details_1 = require("../ledger/emit_details");
28
29
  const memos_1 = require("../ledger/memos");
29
30
  const account_1 = require("../ledger/account");
30
31
  function parseNFTokenBurn(tx) {
@@ -41,6 +42,7 @@ function parseNFTokenBurn(tx) {
41
42
  amount: tx.Amount,
42
43
  source: Object.keys(source).length > 0 ? source : undefined,
43
44
  destination: Object.keys(destination).length > 0 ? destination : undefined,
45
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
44
46
  memos: (0, memos_1.parseMemos)(tx),
45
47
  });
46
48
  }
@@ -28,13 +28,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const assert = __importStar(require("assert"));
30
30
  const common_1 = require("../../common");
31
- const memos_1 = require("../ledger/memos");
32
31
  const uritoken_flags_1 = __importDefault(require("../ledger/uritoken-flags"));
33
32
  const emit_details_1 = require("../ledger/emit_details");
33
+ const memos_1 = require("../ledger/memos");
34
34
  const account_1 = require("../ledger/account");
35
35
  function parseNFTokenMint(tx) {
36
36
  assert.ok(tx.TransactionType === "URITokenMint");
37
- const emittedDetails = (0, emit_details_1.parseEmittedDetails)(tx);
38
37
  const source = (0, common_1.removeUndefined)({
39
38
  address: (0, account_1.parseAccount)(tx.Account),
40
39
  tag: tx.SourceTag,
@@ -49,7 +48,7 @@ function parseNFTokenMint(tx) {
49
48
  amount: tx.Amount,
50
49
  source: Object.keys(source).length > 0 ? source : undefined,
51
50
  destination: Object.keys(destination).length > 0 ? destination : undefined,
52
- emittedDetails,
51
+ emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
53
52
  memos: (0, memos_1.parseMemos)(tx),
54
53
  });
55
54
  }
@@ -3,7 +3,8 @@ 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.parseTransaction = exports.parseTransactionType = void 0;
6
+ exports.parseTransactionType = parseTransactionType;
7
+ exports.parseTransaction = parseTransaction;
7
8
  const common_1 = require("../common");
8
9
  const account_1 = require("./ledger/account");
9
10
  const outcome_1 = require("./outcome");
@@ -94,7 +95,6 @@ const transactionTypeToType = {
94
95
  function parseTransactionType(type) {
95
96
  return transactionTypeToType[type] || type;
96
97
  }
97
- exports.parseTransactionType = parseTransactionType;
98
98
  const parserTypeFunc = {
99
99
  settings: settings_1.default,
100
100
  accountDelete: account_delete_1.default,
@@ -162,4 +162,3 @@ function parseTransaction(tx, includeRawTransaction, nativeCurrency, definitions
162
162
  rawTransaction: includeRawTransaction ? JSON.stringify(tx) : undefined,
163
163
  });
164
164
  }
165
- exports.parseTransaction = parseTransaction;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { TransactionMetadata } from "xrpl";
3
2
  import { FormattedIssuedCurrencyAmount } from "../types";
4
3
  declare function adjustQualityForXRP(quality: string, takerGetsCurrency: string, takerPaysCurrency: string): string;
@@ -3,7 +3,18 @@ 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.parseUint64 = exports.parseUint32 = exports.hexToBytes = exports.bytesToHex = exports.stringToHex = exports.hexToString = exports.normalizeNodes = exports.removeGenericCounterparty = exports.isPartialPayment = exports.adjustQualityForXRP = exports.parseTimestamp = exports.parseQuality = void 0;
6
+ exports.parseQuality = parseQuality;
7
+ exports.parseTimestamp = parseTimestamp;
8
+ exports.adjustQualityForXRP = adjustQualityForXRP;
9
+ exports.isPartialPayment = isPartialPayment;
10
+ exports.removeGenericCounterparty = removeGenericCounterparty;
11
+ exports.normalizeNodes = normalizeNodes;
12
+ exports.hexToString = hexToString;
13
+ exports.stringToHex = stringToHex;
14
+ exports.bytesToHex = bytesToHex;
15
+ exports.hexToBytes = hexToBytes;
16
+ exports.parseUint32 = parseUint32;
17
+ exports.parseUint64 = parseUint64;
7
18
  const lodash_1 = __importDefault(require("lodash"));
8
19
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
20
  const xrpl_1 = require("xrpl");
@@ -15,29 +26,24 @@ function adjustQualityForXRP(quality, takerGetsCurrency, takerPaysCurrency) {
15
26
  const shift = numeratorShift - denominatorShift;
16
27
  return shift === 0 ? quality : new bignumber_js_1.default(quality).shiftedBy(shift).toString();
17
28
  }
18
- exports.adjustQualityForXRP = adjustQualityForXRP;
19
29
  function parseQuality(quality) {
20
30
  if (typeof quality !== "number") {
21
31
  return undefined;
22
32
  }
23
33
  return new bignumber_js_1.default(quality).shiftedBy(-9).toNumber();
24
34
  }
25
- exports.parseQuality = parseQuality;
26
35
  function parseTimestamp(rippleTime) {
27
36
  if (typeof rippleTime !== "number") {
28
37
  return undefined;
29
38
  }
30
39
  return (0, models_1.ledgerTimeToISO8601)(rippleTime);
31
40
  }
32
- exports.parseTimestamp = parseTimestamp;
33
41
  function isPartialPayment(tx) {
34
42
  return (tx.Flags & xrpl_1.PaymentFlags.tfPartialPayment) !== 0;
35
43
  }
36
- exports.isPartialPayment = isPartialPayment;
37
44
  function removeGenericCounterparty(amount, address) {
38
45
  return amount.counterparty === address ? lodash_1.default.omit(amount, "counterparty") : amount;
39
46
  }
40
- exports.removeGenericCounterparty = removeGenericCounterparty;
41
47
  function normalizeNode(affectedNode) {
42
48
  const diffType = Object.keys(affectedNode)[0];
43
49
  const node = affectedNode[diffType];
@@ -56,19 +62,15 @@ function normalizeNodes(metadata) {
56
62
  }
57
63
  return metadata.AffectedNodes.map(normalizeNode);
58
64
  }
59
- exports.normalizeNodes = normalizeNodes;
60
65
  function hexToString(hex) {
61
66
  return hex ? Buffer.from(hex, "hex").toString("utf-8") : undefined;
62
67
  }
63
- exports.hexToString = hexToString;
64
68
  function stringToHex(value) {
65
69
  return value ? Buffer.from(value, "utf8").toString("hex").toUpperCase() : undefined;
66
70
  }
67
- exports.stringToHex = stringToHex;
68
71
  function bytesToHex(value) {
69
72
  return Buffer.from(value).toString("hex").toUpperCase();
70
73
  }
71
- exports.bytesToHex = bytesToHex;
72
74
  function hexToBytes(value) {
73
75
  if (value.length % 2 !== 0) {
74
76
  throw new Error("Invalid hex string length");
@@ -81,11 +83,9 @@ function hexToBytes(value) {
81
83
  }
82
84
  return Uint8Array.from(Buffer.from(value, "hex"));
83
85
  }
84
- exports.hexToBytes = hexToBytes;
85
86
  function parseUint32(buf, cur) {
86
87
  return ((BigInt(buf[cur]) << 24n) + (BigInt(buf[cur + 1]) << 16n) + (BigInt(buf[cur + 2]) << 8n) + BigInt(buf[cur + 3]) + "");
87
88
  }
88
- exports.parseUint32 = parseUint32;
89
89
  function parseUint64(buf, cur) {
90
90
  return ((BigInt(buf[cur]) << 56n) +
91
91
  (BigInt(buf[cur + 1]) << 48n) +
@@ -97,4 +97,3 @@ function parseUint64(buf, cur) {
97
97
  BigInt(buf[cur + 7]) +
98
98
  "");
99
99
  }
100
- exports.parseUint64 = parseUint64;
@@ -1,6 +1,8 @@
1
1
  import { FormattedSourceAddress } from "./account";
2
+ import { FormattedEmitDetails } from "./emit_details";
2
3
  import { FormattedMemo } from "./memos";
3
4
  export type FormattedBaseSpecification = {
4
5
  source?: FormattedSourceAddress;
6
+ emittedDetails?: FormattedEmitDetails;
5
7
  memos?: FormattedMemo[];
6
8
  };
@@ -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.createPaymentTransaction = void 0;
6
+ exports.createPaymentTransaction = createPaymentTransaction;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
8
  const xrpl_1 = require("xrpl");
9
9
  const common_1 = require("../../common");
@@ -128,4 +128,3 @@ function createPaymentTransaction(address, paymentArgument) {
128
128
  }
129
129
  return txJSON;
130
130
  }
131
- exports.createPaymentTransaction = createPaymentTransaction;
package/lib/v1/utils.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getClassicAccountAndTag = exports.toRippledAmount = void 0;
3
+ exports.toRippledAmount = toRippledAmount;
4
+ exports.getClassicAccountAndTag = getClassicAccountAndTag;
4
5
  const ripple_address_codec_1 = require("ripple-address-codec");
5
6
  const common_1 = require("../common");
6
7
  const client_1 = require("../client");
@@ -20,7 +21,6 @@ function toRippledAmount(amount) {
20
21
  value: amount.value,
21
22
  };
22
23
  }
23
- exports.toRippledAmount = toRippledAmount;
24
24
  function getClassicAccountAndTag(Account, expectedTag) {
25
25
  if ((0, ripple_address_codec_1.isValidXAddress)(Account)) {
26
26
  const classic = (0, ripple_address_codec_1.xAddressToClassicAddress)(Account);
@@ -39,4 +39,3 @@ function getClassicAccountAndTag(Account, expectedTag) {
39
39
  };
40
40
  }
41
41
  }
42
- exports.getClassicAccountAndTag = getClassicAccountAndTag;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare function classicAddressFromValidatorPK(pk: string | Buffer): string | null;
3
2
  export interface GenerateSecretsInterface {
4
3
  key_type: string;
package/lib/validator.js CHANGED
@@ -26,7 +26,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.verify2 = exports.verify = exports.sign = exports.generateSecrets = exports.classicAddressFromValidatorPK = void 0;
29
+ exports.classicAddressFromValidatorPK = classicAddressFromValidatorPK;
30
+ exports.generateSecrets = generateSecrets;
31
+ exports.sign = sign;
32
+ exports.verify = verify;
33
+ exports.verify2 = verify2;
30
34
  const assert = __importStar(require("assert"));
31
35
  const ripple_address_codec_1 = require("ripple-address-codec");
32
36
  const Crypto = __importStar(require("crypto"));
@@ -61,7 +65,6 @@ function classicAddressFromValidatorPK(pk) {
61
65
  const address = Base58.encode(dataToEncode);
62
66
  return address;
63
67
  }
64
- exports.classicAddressFromValidatorPK = classicAddressFromValidatorPK;
65
68
  function generateSecrets() {
66
69
  const keypair = Crypto.generateKeyPairSync("ed25519", {
67
70
  privateKeyEncoding: { format: "der", type: "pkcs8" },
@@ -81,7 +84,6 @@ function generateSecrets() {
81
84
  PublicKey,
82
85
  };
83
86
  }
84
- exports.generateSecrets = generateSecrets;
85
87
  function sign(message, secret) {
86
88
  if (typeof message === "string") {
87
89
  message = Buffer.from(message, "utf8");
@@ -94,7 +96,6 @@ function sign(message, secret) {
94
96
  }
95
97
  return rippleKeypairs.sign(message.toString("hex"), secret).toUpperCase();
96
98
  }
97
- exports.sign = sign;
98
99
  function verify(message, signature, publicKey) {
99
100
  if (typeof message === "string") {
100
101
  message = Buffer.from(message, "utf8");
@@ -110,7 +111,6 @@ function verify(message, signature, publicKey) {
110
111
  }
111
112
  return false;
112
113
  }
113
- exports.verify = verify;
114
114
  function verify2(message, signature, publicKey) {
115
115
  if (publicKey.slice(0, 1) === VALIDATOR_NODE_PUBLIC_KEY_PREFIX) {
116
116
  const publicKeyBuffer = (0, ripple_address_codec_1.decodeNodePublic)(publicKey);
@@ -131,4 +131,3 @@ function verify2(message, signature, publicKey) {
131
131
  }
132
132
  return false;
133
133
  }
134
- exports.verify2 = verify2;
package/lib/wallet.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Wallet, Transaction, ECDSA } from "xrpl";
3
2
  import { XrplDefinitionsBase, XrplDefinitions, DEFAULT_DEFINITIONS } from "ripple-binary-codec";
4
3
  interface GenerateAddressInterface {
package/lib/wallet.js CHANGED
@@ -26,7 +26,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.hashSignedTx = exports.DEFAULT_DEFINITIONS = exports.XrplDefinitions = exports.XrplDefinitionsBase = exports.verifyTransaction = exports.signTransaction = exports.checksumClassicAddress = exports.isValidClassicAddress = exports.generateAddress = exports.walletFromSeed = exports.isValidSecret = void 0;
29
+ exports.DEFAULT_DEFINITIONS = exports.XrplDefinitions = exports.XrplDefinitionsBase = void 0;
30
+ exports.isValidSecret = isValidSecret;
31
+ exports.walletFromSeed = walletFromSeed;
32
+ exports.generateAddress = generateAddress;
33
+ exports.isValidClassicAddress = isValidClassicAddress;
34
+ exports.checksumClassicAddress = checksumClassicAddress;
35
+ exports.signTransaction = signTransaction;
36
+ exports.verifyTransaction = verifyTransaction;
37
+ exports.hashSignedTx = hashSignedTx;
30
38
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
31
39
  const omitBy_1 = __importDefault(require("lodash/omitBy"));
32
40
  const Crypto = __importStar(require("crypto"));
@@ -52,7 +60,6 @@ function isValidSecret(secret) {
52
60
  }
53
61
  return false;
54
62
  }
55
- exports.isValidSecret = isValidSecret;
56
63
  function walletFromSeed(seed, options) {
57
64
  options = { ignoreSeedPayload: false, ...options };
58
65
  let algorithm = options.algorithm;
@@ -77,13 +84,11 @@ function walletFromSeed(seed, options) {
77
84
  const wallet = xrpl_1.Wallet.fromSeed(seed, { algorithm, masterAddress: options.masterAddress });
78
85
  return wallet;
79
86
  }
80
- exports.walletFromSeed = walletFromSeed;
81
87
  function generateAddress() {
82
88
  const wallet = xrpl_1.Wallet.generate();
83
89
  const { publicKey, privateKey, classicAddress, seed } = wallet;
84
90
  return { publicKey, privateKey, address: classicAddress, seed: seed };
85
91
  }
86
- exports.generateAddress = generateAddress;
87
92
  function isValidClassicAddress(address) {
88
93
  if (!address || address.length === 0) {
89
94
  return false;
@@ -101,14 +106,12 @@ function isValidClassicAddress(address) {
101
106
  }
102
107
  return true;
103
108
  }
104
- exports.isValidClassicAddress = isValidClassicAddress;
105
109
  function checksumClassicAddress(buffer) {
106
110
  const hash = buffer.slice(0, 21);
107
111
  const checksumPrepare = Crypto.createHash("sha256").update(Buffer.from(hash)).digest();
108
112
  const checksum = Crypto.createHash("sha256").update(checksumPrepare).digest();
109
113
  return checksum;
110
114
  }
111
- exports.checksumClassicAddress = checksumClassicAddress;
112
115
  function signTransaction(wallet, transaction, multisign, definitions, validateTx) {
113
116
  let multisignAddress = false;
114
117
  if (typeof multisign === "string" && multisign.startsWith("X")) {
@@ -144,14 +147,12 @@ function signTransaction(wallet, transaction, multisign, definitions, validateTx
144
147
  hash: hashSignedTx(serialized, definitions),
145
148
  };
146
149
  }
147
- exports.signTransaction = signTransaction;
148
150
  function verifyTransaction(wallet, signedTransaction) {
149
151
  const tx = typeof signedTransaction === "string" ? (0, ripple_binary_codec_1.decode)(signedTransaction) : signedTransaction;
150
152
  const messageHex = (0, ripple_binary_codec_1.encodeForSigning)(tx);
151
153
  const signature = tx.TxnSignature;
152
154
  return (0, ripple_keypairs_1.verify)(messageHex, signature, wallet.publicKey);
153
155
  }
154
- exports.verifyTransaction = verifyTransaction;
155
156
  function computeSignature(tx, privateKey, signAs, definitions) {
156
157
  if (signAs) {
157
158
  const classicAddress = (0, ripple_address_codec_1.isValidXAddress)(signAs) ? (0, ripple_address_codec_1.xAddressToClassicAddress)(signAs).classicAddress : signAs;
@@ -187,4 +188,3 @@ function hashSignedTx(tx, definitions, validateTx) {
187
188
  const prefix = HashPrefix.TRANSACTION_ID.toString(16).toUpperCase();
188
189
  return (0, common_1.sha512Half)(prefix.concat(txBlob));
189
190
  }
190
- exports.hashSignedTx = hashSignedTx;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bithomp/xrpl-api",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "description": "A Bithomp JavaScript/TypeScript library for interacting with the XRP Ledger",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -60,12 +60,12 @@
60
60
  "devDependencies": {
61
61
  "@types/chai": "^4.3.16",
62
62
  "@types/chai-as-promised": "^7.1.8",
63
- "@types/lodash": "^4.17.5",
63
+ "@types/lodash": "^4.17.6",
64
64
  "@types/mocha": "^10.0.7",
65
65
  "@types/nconf": "^0.10.6",
66
- "@types/node": "^20.14.8",
67
- "@typescript-eslint/eslint-plugin": "^7.13.1",
68
- "@typescript-eslint/parser": "^7.13.1",
66
+ "@types/node": "^20.14.10",
67
+ "@typescript-eslint/eslint-plugin": "^7.16.0",
68
+ "@typescript-eslint/parser": "^7.16.0",
69
69
  "chai": "^4.4.1",
70
70
  "chai-as-promised": "^7.1.2",
71
71
  "eslint": "^8.57.0",
@@ -73,10 +73,10 @@
73
73
  "eslint-plugin-chai-friendly": "^1.0.0",
74
74
  "eslint-plugin-import": "^2.29.1",
75
75
  "eslint-plugin-n": "^17.9.0",
76
- "eslint-plugin-promise": "^6.2.0",
77
- "mocha": "^10.4.0",
76
+ "eslint-plugin-promise": "^6.4.0",
77
+ "mocha": "^10.6.0",
78
78
  "nconf": "^0.12.1",
79
- "ts-jest": "^29.1.5",
79
+ "ts-jest": "^29.2.2",
80
80
  "ts-node": "^10.9.2",
81
81
  "typescript": "^5.4.5"
82
82
  }