@bithomp/xrpl-api 3.3.10 → 3.4.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 (135) hide show
  1. package/lib/ledger/account_tx.js +11 -0
  2. package/lib/models/transaction.d.ts +1 -0
  3. package/lib/models/transaction.js +15 -0
  4. package/lib/models/transactions/SetRemarks.d.ts +3 -0
  5. package/lib/models/transactions/SetRemarks.js +2 -0
  6. package/lib/parse/ledger/delegate.d.ts +2 -0
  7. package/lib/parse/ledger/delegate.js +11 -0
  8. package/lib/parse/ledger/index.d.ts +2 -1
  9. package/lib/parse/ledger/index.js +4 -1
  10. package/lib/parse/ledger/permissions.d.ts +2 -0
  11. package/lib/parse/ledger/permissions.js +9 -0
  12. package/lib/parse/ledger/remark-flags.d.ts +5 -0
  13. package/lib/parse/ledger/remark-flags.js +8 -0
  14. package/lib/parse/ledger/remarks.d.ts +3 -0
  15. package/lib/parse/ledger/remarks.js +47 -0
  16. package/lib/parse/outcome/delegate_changes.d.ts +12 -0
  17. package/lib/parse/outcome/delegate_changes.js +59 -0
  18. package/lib/parse/outcome/index.d.ts +2 -0
  19. package/lib/parse/outcome/index.js +5 -1
  20. package/lib/parse/outcome/oracle_changes.d.ts +3 -3
  21. package/lib/parse/outcome/remarks_changes.d.ts +14 -0
  22. package/lib/parse/outcome/remarks_changes.js +68 -0
  23. package/lib/parse/outcome.js +22 -0
  24. package/lib/parse/specification/account-delete.d.ts +2 -1
  25. package/lib/parse/specification/account-delete.js +2 -0
  26. package/lib/parse/specification/amm-bid.d.ts +2 -1
  27. package/lib/parse/specification/amm-bid.js +2 -0
  28. package/lib/parse/specification/amm-clawback.d.ts +2 -1
  29. package/lib/parse/specification/amm-clawback.js +2 -0
  30. package/lib/parse/specification/amm-create.d.ts +2 -1
  31. package/lib/parse/specification/amm-create.js +2 -0
  32. package/lib/parse/specification/amm-delete.d.ts +2 -1
  33. package/lib/parse/specification/amm-delete.js +2 -0
  34. package/lib/parse/specification/amm-deposit.d.ts +2 -1
  35. package/lib/parse/specification/amm-deposit.js +2 -0
  36. package/lib/parse/specification/amm-vote.d.ts +2 -1
  37. package/lib/parse/specification/amm-vote.js +2 -0
  38. package/lib/parse/specification/amm-withdraw.d.ts +2 -1
  39. package/lib/parse/specification/amm-withdraw.js +2 -0
  40. package/lib/parse/specification/check-cancel.d.ts +2 -1
  41. package/lib/parse/specification/check-cancel.js +2 -0
  42. package/lib/parse/specification/check-cash.d.ts +2 -1
  43. package/lib/parse/specification/check-cash.js +2 -0
  44. package/lib/parse/specification/check-create.d.ts +2 -1
  45. package/lib/parse/specification/check-create.js +2 -0
  46. package/lib/parse/specification/clawback.d.ts +2 -1
  47. package/lib/parse/specification/clawback.js +2 -0
  48. package/lib/parse/specification/delegate-set.d.ts +4 -0
  49. package/lib/parse/specification/delegate-set.js +58 -0
  50. package/lib/parse/specification/deposit-preauth.d.ts +2 -1
  51. package/lib/parse/specification/deposit-preauth.js +2 -0
  52. package/lib/parse/specification/did-delete.d.ts +2 -1
  53. package/lib/parse/specification/did-delete.js +2 -0
  54. package/lib/parse/specification/did-set.d.ts +2 -1
  55. package/lib/parse/specification/did-set.js +2 -0
  56. package/lib/parse/specification/escrow-cancel.d.ts +2 -1
  57. package/lib/parse/specification/escrow-cancel.js +2 -0
  58. package/lib/parse/specification/escrow-create.d.ts +2 -1
  59. package/lib/parse/specification/escrow-create.js +2 -0
  60. package/lib/parse/specification/escrow-finish.d.ts +2 -1
  61. package/lib/parse/specification/escrow-finish.js +2 -0
  62. package/lib/parse/specification/mptoken-authorize.d.ts +2 -1
  63. package/lib/parse/specification/mptoken-authorize.js +2 -0
  64. package/lib/parse/specification/mptoken-issuance-create.d.ts +2 -1
  65. package/lib/parse/specification/mptoken-issuance-create.js +2 -0
  66. package/lib/parse/specification/mptoken-issuance-destroy.d.ts +2 -1
  67. package/lib/parse/specification/mptoken-issuance-destroy.js +2 -0
  68. package/lib/parse/specification/mptoken-issuance-set.d.ts +2 -1
  69. package/lib/parse/specification/mptoken-issuance-set.js +2 -0
  70. package/lib/parse/specification/nftoken-accept-offer.d.ts +2 -1
  71. package/lib/parse/specification/nftoken-accept-offer.js +2 -0
  72. package/lib/parse/specification/nftoken-burn.d.ts +2 -1
  73. package/lib/parse/specification/nftoken-burn.js +2 -0
  74. package/lib/parse/specification/nftoken-cancel-offer.d.ts +2 -1
  75. package/lib/parse/specification/nftoken-cancel-offer.js +2 -0
  76. package/lib/parse/specification/nftoken-create-offer.d.ts +2 -1
  77. package/lib/parse/specification/nftoken-create-offer.js +2 -0
  78. package/lib/parse/specification/nftoken-mint.d.ts +2 -1
  79. package/lib/parse/specification/nftoken-mint.js +2 -0
  80. package/lib/parse/specification/nftoken-modify.d.ts +2 -1
  81. package/lib/parse/specification/nftoken-modify.js +2 -0
  82. package/lib/parse/specification/offer-cancel.d.ts +2 -1
  83. package/lib/parse/specification/offer-cancel.js +2 -0
  84. package/lib/parse/specification/offer-create.d.ts +3 -2
  85. package/lib/parse/specification/offer-create.js +2 -0
  86. package/lib/parse/specification/oracle-delete.d.ts +2 -1
  87. package/lib/parse/specification/oracle-delete.js +2 -0
  88. package/lib/parse/specification/oracle-set.d.ts +2 -1
  89. package/lib/parse/specification/oracle-set.js +2 -0
  90. package/lib/parse/specification/payment-channel-claim.d.ts +2 -1
  91. package/lib/parse/specification/payment-channel-claim.js +2 -2
  92. package/lib/parse/specification/payment-channel-create.d.ts +2 -1
  93. package/lib/parse/specification/payment-channel-create.js +2 -0
  94. package/lib/parse/specification/payment-channel-fund.d.ts +2 -1
  95. package/lib/parse/specification/payment-channel-fund.js +2 -0
  96. package/lib/parse/specification/payment.d.ts +2 -1
  97. package/lib/parse/specification/payment.js +2 -0
  98. package/lib/parse/specification/set-remarks.d.ts +3 -0
  99. package/lib/parse/specification/set-remarks.js +56 -0
  100. package/lib/parse/specification/settings.js +2 -0
  101. package/lib/parse/specification/ticket-create.d.ts +2 -1
  102. package/lib/parse/specification/ticket-create.js +2 -0
  103. package/lib/parse/specification/trust-set.d.ts +4 -0
  104. package/lib/parse/specification/trust-set.js +74 -0
  105. package/lib/parse/specification/trustline.js +2 -0
  106. package/lib/parse/specification/unrecognized.d.ts +2 -1
  107. package/lib/parse/specification/unrecognized.js +2 -0
  108. package/lib/parse/specification/uritoken-burn.d.ts +2 -2
  109. package/lib/parse/specification/uritoken-burn.js +2 -2
  110. package/lib/parse/specification/uritoken-buy.d.ts +2 -2
  111. package/lib/parse/specification/uritoken-buy.js +2 -2
  112. package/lib/parse/specification/uritoken-cancel-sell-offer.d.ts +2 -2
  113. package/lib/parse/specification/uritoken-cancel-sell-offer.js +2 -2
  114. package/lib/parse/specification/uritoken-create-sell-offer.d.ts +2 -2
  115. package/lib/parse/specification/uritoken-create-sell-offer.js +2 -2
  116. package/lib/parse/specification/uritoken-mint.d.ts +2 -2
  117. package/lib/parse/specification/uritoken-mint.js +2 -2
  118. package/lib/parse/transaction.d.ts +3 -1
  119. package/lib/parse/transaction.js +8 -2
  120. package/lib/types/checks.d.ts +4 -4
  121. package/lib/types/delegate.d.ts +5 -0
  122. package/lib/types/delegate.js +2 -0
  123. package/lib/types/deposits.d.ts +2 -2
  124. package/lib/types/did.d.ts +3 -3
  125. package/lib/types/escrows.d.ts +3 -3
  126. package/lib/types/index.d.ts +2 -1
  127. package/lib/types/index.js +2 -1
  128. package/lib/types/mptokens.d.ts +1 -1
  129. package/lib/types/nftokens.d.ts +3 -3
  130. package/lib/types/oracle.d.ts +4 -12
  131. package/lib/types/payment_channels.d.ts +2 -4
  132. package/lib/types/remarks.d.ts +24 -0
  133. package/lib/types/remarks.js +6 -0
  134. package/lib/types/specification.d.ts +1 -0
  135. package/package.json +6 -6
@@ -112,6 +112,17 @@ async function getTransactions(account, options = { limit: DEFAULT_LIMIT }) {
112
112
  }
113
113
  }
114
114
  }
115
+ if (Array.isArray(result.transactions)) {
116
+ for (const transaction of result.transactions) {
117
+ const tx = transaction.tx || transaction;
118
+ if (!tx.hasOwnProperty("ctid")) {
119
+ const ctid = (0, transaction_1.encodeCTIDforTransaction)(transaction, connection.getNetworkID());
120
+ if (ctid) {
121
+ tx.ctid = ctid;
122
+ }
123
+ }
124
+ }
125
+ }
115
126
  const newMarker = (0, utils_1.createMarker)(connection.hash, result.marker);
116
127
  if (newMarker) {
117
128
  result.marker = newMarker;
@@ -41,6 +41,7 @@ export declare function accountTxToTx(accountTx: AccountTransaction): Transactio
41
41
  export declare function ledgerTxToTx(ledgerTx: LedgerTransaction, ledgerIndex: number, closeTime: number): TransactionResponse;
42
42
  export declare function streamTxToTx(streamTx: StreamTransaction): TransactionResponse;
43
43
  export declare function isCTID(ctid: string | bigint): boolean;
44
+ export declare function encodeCTIDforTransaction(transaction: TransactionResponse, networkID: number): string | undefined;
44
45
  export declare function encodeCTID(ledgerIndex: number, txIndex: number, networkID: number): string;
45
46
  export interface DecodeCTIDInterface {
46
47
  ledgerIndex: number;
@@ -11,6 +11,7 @@ exports.accountTxToTx = accountTxToTx;
11
11
  exports.ledgerTxToTx = ledgerTxToTx;
12
12
  exports.streamTxToTx = streamTxToTx;
13
13
  exports.isCTID = isCTID;
14
+ exports.encodeCTIDforTransaction = encodeCTIDforTransaction;
14
15
  exports.encodeCTID = encodeCTID;
15
16
  exports.decodeCTID = decodeCTID;
16
17
  const lodash_1 = __importDefault(require("lodash"));
@@ -66,6 +67,20 @@ function isCTID(ctid) {
66
67
  }
67
68
  return true;
68
69
  }
70
+ function encodeCTIDforTransaction(transaction, networkID) {
71
+ const tx = (transaction.tx || transaction);
72
+ if (!tx.ledger_index) {
73
+ return undefined;
74
+ }
75
+ const meta = (transaction.meta || transaction.metaData);
76
+ if (!meta || !meta.TransactionIndex) {
77
+ return undefined;
78
+ }
79
+ if (typeof networkID !== "number") {
80
+ return undefined;
81
+ }
82
+ return encodeCTID(tx.ledger_index, meta.TransactionIndex, networkID);
83
+ }
69
84
  function encodeCTID(ledgerIndex, txIndex, networkID) {
70
85
  if (typeof ledgerIndex !== "number") {
71
86
  throw new Error("ledgerIndex must be a number.");
@@ -0,0 +1,3 @@
1
+ export declare const enum SetRemarksFlags {
2
+ tfImmutable = 1
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { FormattedSignerRegularKey } from "../../types/account";
2
+ export declare function parseDelegate(tx: any): FormattedSignerRegularKey | undefined;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseDelegate = parseDelegate;
4
+ const common_1 = require("../../common");
5
+ function parseDelegate(tx) {
6
+ if (tx && tx.Delegate) {
7
+ return (0, common_1.removeUndefined)({
8
+ address: tx.Delegate,
9
+ });
10
+ }
11
+ }
@@ -1,5 +1,6 @@
1
1
  import parseAmount from "./amount";
2
2
  import { parseMemos } from "./memos";
3
+ import { parseRemarks, REMARKS_SUPPORTED_ENTRIES } from "./remarks";
3
4
  export * from "./account";
4
5
  export * from "../utils";
5
- export { parseAmount, parseMemos };
6
+ export { parseAmount, parseMemos, parseRemarks, REMARKS_SUPPORTED_ENTRIES };
@@ -17,10 +17,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.parseMemos = exports.parseAmount = void 0;
20
+ exports.REMARKS_SUPPORTED_ENTRIES = exports.parseRemarks = exports.parseMemos = exports.parseAmount = void 0;
21
21
  const amount_1 = __importDefault(require("./amount"));
22
22
  exports.parseAmount = amount_1.default;
23
23
  const memos_1 = require("./memos");
24
24
  Object.defineProperty(exports, "parseMemos", { enumerable: true, get: function () { return memos_1.parseMemos; } });
25
+ const remarks_1 = require("./remarks");
26
+ Object.defineProperty(exports, "parseRemarks", { enumerable: true, get: function () { return remarks_1.parseRemarks; } });
27
+ Object.defineProperty(exports, "REMARKS_SUPPORTED_ENTRIES", { enumerable: true, get: function () { return remarks_1.REMARKS_SUPPORTED_ENTRIES; } });
25
28
  __exportStar(require("./account"), exports);
26
29
  __exportStar(require("../utils"), exports);
@@ -0,0 +1,2 @@
1
+ import { Permission } from "xrpl";
2
+ export declare function parsePermissions(permissions: Permission[]): string[];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parsePermissions = parsePermissions;
4
+ function parsePermissions(permissions) {
5
+ if (!permissions) {
6
+ return [];
7
+ }
8
+ return permissions.map((perm) => perm.Permission.PermissionValue).sort();
9
+ }
@@ -0,0 +1,5 @@
1
+ import { RemarksFlagsKeysInterface } from "../../types/remarks";
2
+ declare function parseRemarkFlags(value: number, options?: {
3
+ excludeFalse?: boolean;
4
+ }): RemarksFlagsKeysInterface;
5
+ export default parseRemarkFlags;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const remarks_1 = require("../../types/remarks");
4
+ const flags_1 = require("./flags");
5
+ function parseRemarkFlags(value, options = {}) {
6
+ return (0, flags_1.parseFlags)(value, remarks_1.RemarksFlagsKeys, options);
7
+ }
8
+ exports.default = parseRemarkFlags;
@@ -0,0 +1,3 @@
1
+ import { FormattedRemark, Remark } from "../../types";
2
+ export declare const REMARKS_SUPPORTED_ENTRIES: string[];
3
+ export declare function parseRemarks(remarks: Remark[]): FormattedRemark[];
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.REMARKS_SUPPORTED_ENTRIES = void 0;
7
+ exports.parseRemarks = parseRemarks;
8
+ const common_1 = require("../../common");
9
+ const utils_1 = require("../utils");
10
+ const remark_flags_1 = __importDefault(require("./remark-flags"));
11
+ exports.REMARKS_SUPPORTED_ENTRIES = [
12
+ "AccountRoot",
13
+ "Offer",
14
+ "Escrow",
15
+ "Ticket",
16
+ "PayChannel",
17
+ "Check",
18
+ "DepositPreauth",
19
+ "URIToken",
20
+ "RippleState",
21
+ ];
22
+ function parseRemarks(remarks) {
23
+ if (!Array.isArray(remarks)) {
24
+ return [];
25
+ }
26
+ return remarks.map((remark) => {
27
+ return (0, common_1.removeUndefined)(parseRemark(remark));
28
+ });
29
+ }
30
+ function parseRemark(remark) {
31
+ const { RemarkName, RemarkValue, Flags } = remark.Remark;
32
+ return (0, common_1.removeUndefined)({
33
+ name: (0, utils_1.hexToString)(RemarkName),
34
+ value: decodeData(RemarkValue),
35
+ flags: (0, remark_flags_1.default)(Flags),
36
+ });
37
+ }
38
+ function decodeData(data) {
39
+ if (!data) {
40
+ return undefined;
41
+ }
42
+ const decoded = (0, utils_1.hexToString)(data);
43
+ if (decoded && decoded.includes("�")) {
44
+ return data;
45
+ }
46
+ return decoded;
47
+ }
@@ -0,0 +1,12 @@
1
+ import { TransactionMetadata } from "xrpl";
2
+ interface FormattedDelegateSummaryInterface {
3
+ status?: "created" | "modified" | "deleted";
4
+ delegateIndex: string;
5
+ account?: string;
6
+ authorize?: string;
7
+ permissions?: string[];
8
+ permissionsChange?: string[];
9
+ previousTxnID?: string;
10
+ }
11
+ declare function parseDelegateChanges(metadata: TransactionMetadata): FormattedDelegateSummaryInterface | undefined;
12
+ export { parseDelegateChanges };
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseDelegateChanges = parseDelegateChanges;
4
+ const utils_1 = require("../utils");
5
+ const permissions_1 = require("../ledger/permissions");
6
+ function parseDelegateStatus(node) {
7
+ if (node.diffType === "CreatedNode") {
8
+ return "created";
9
+ }
10
+ if (node.diffType === "ModifiedNode") {
11
+ return "modified";
12
+ }
13
+ if (node.diffType === "DeletedNode") {
14
+ return "deleted";
15
+ }
16
+ return undefined;
17
+ }
18
+ function summarizeDelegate(node) {
19
+ const final = node.diffType === "CreatedNode" ? node.newFields : node.finalFields;
20
+ const prev = node.previousFields;
21
+ const summary = {
22
+ status: parseDelegateStatus(node),
23
+ delegateIndex: node.ledgerIndex,
24
+ account: final.Account,
25
+ authorize: final.Authorize,
26
+ permissions: (0, permissions_1.parsePermissions)(final.Permissions),
27
+ };
28
+ if (node.diffType === "ModifiedNode") {
29
+ summary.permissionsChange = [];
30
+ const prevPermissions = (0, permissions_1.parsePermissions)(prev.Permissions);
31
+ const finalPermissions = summary.permissions || [];
32
+ const addedPermissions = finalPermissions.filter((perm) => !prevPermissions.includes(perm));
33
+ const removedPermissions = prevPermissions.filter((perm) => !finalPermissions.includes(perm));
34
+ if (addedPermissions.length > 0) {
35
+ summary.permissionsChange.push(...addedPermissions);
36
+ }
37
+ if (removedPermissions.length > 0) {
38
+ summary.permissionsChange.push(...removedPermissions);
39
+ }
40
+ if (summary.permissionsChange.length === 0) {
41
+ summary.permissionsChange = undefined;
42
+ }
43
+ }
44
+ if (node.PreviousTxnID) {
45
+ summary.previousTxnID = node.PreviousTxnID;
46
+ }
47
+ return summary;
48
+ }
49
+ function parseDelegateChanges(metadata) {
50
+ const affectedNodes = metadata.AffectedNodes.filter((affectedNode) => {
51
+ const node = affectedNode.CreatedNode || affectedNode.ModifiedNode || affectedNode.DeletedNode;
52
+ return node.LedgerEntryType === "Delegate";
53
+ });
54
+ if (affectedNodes.length !== 1) {
55
+ return undefined;
56
+ }
57
+ const normalizedNode = (0, utils_1.normalizeNode)(affectedNodes[0]);
58
+ return summarizeDelegate(normalizedNode);
59
+ }
@@ -18,3 +18,5 @@ export { parseOracleChanges } from "./oracle_changes";
18
18
  export { parseDeliveredAmount } from "./delivered_amount";
19
19
  export { parseMPTokenIssuanceChanges } from "./mptoken_issuance_changes";
20
20
  export { parseMPTokenChanges } from "./mptoken_changes";
21
+ export { parseDelegateChanges } from "./delegate_changes";
22
+ export { parseRemarksChanges } from "./remarks_changes";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseMPTokenChanges = exports.parseMPTokenIssuanceChanges = exports.parseDeliveredAmount = exports.parseOracleChanges = exports.parseDIDChanges = exports.parseAmmChanges = exports.parseUNLReportChanges = exports.parseEscrowChanges = exports.parseEmittedTxns = exports.parseHooksExecutions = exports.parseOrderbookChanges = exports.parseCheckChanges = exports.parseChannelChanges = exports.parseLockedBalanceChanges = exports.parseBalanceChanges = exports.parseURITokenSellOfferChanges = exports.parseURITokenChanges = exports.parseNFTokenOfferChanges = exports.parseNFTokenChanges = exports.parseAffectedObjects = void 0;
3
+ exports.parseRemarksChanges = exports.parseDelegateChanges = exports.parseMPTokenChanges = exports.parseMPTokenIssuanceChanges = exports.parseDeliveredAmount = exports.parseOracleChanges = exports.parseDIDChanges = exports.parseAmmChanges = exports.parseUNLReportChanges = exports.parseEscrowChanges = exports.parseEmittedTxns = exports.parseHooksExecutions = exports.parseOrderbookChanges = exports.parseCheckChanges = exports.parseChannelChanges = exports.parseLockedBalanceChanges = exports.parseBalanceChanges = exports.parseURITokenSellOfferChanges = exports.parseURITokenChanges = exports.parseNFTokenOfferChanges = exports.parseNFTokenChanges = exports.parseAffectedObjects = void 0;
4
4
  var affected_objects_1 = require("./affected_objects");
5
5
  Object.defineProperty(exports, "parseAffectedObjects", { enumerable: true, get: function () { return affected_objects_1.parseAffectedObjects; } });
6
6
  var nftoken_changes_1 = require("./nftoken_changes");
@@ -41,3 +41,7 @@ var mptoken_issuance_changes_1 = require("./mptoken_issuance_changes");
41
41
  Object.defineProperty(exports, "parseMPTokenIssuanceChanges", { enumerable: true, get: function () { return mptoken_issuance_changes_1.parseMPTokenIssuanceChanges; } });
42
42
  var mptoken_changes_1 = require("./mptoken_changes");
43
43
  Object.defineProperty(exports, "parseMPTokenChanges", { enumerable: true, get: function () { return mptoken_changes_1.parseMPTokenChanges; } });
44
+ var delegate_changes_1 = require("./delegate_changes");
45
+ Object.defineProperty(exports, "parseDelegateChanges", { enumerable: true, get: function () { return delegate_changes_1.parseDelegateChanges; } });
46
+ var remarks_changes_1 = require("./remarks_changes");
47
+ Object.defineProperty(exports, "parseRemarksChanges", { enumerable: true, get: function () { return remarks_changes_1.parseRemarksChanges; } });
@@ -1,5 +1,5 @@
1
- import { TransactionMetadata } from "xrpl";
2
- import { OraclePriceDataSeriesInterface, FormattedOraclePriceDataSeriesInterface } from "../../types";
1
+ import { TransactionMetadata, PriceData } from "xrpl";
2
+ import { FormattedOraclePriceDataSeriesInterface } from "../../types";
3
3
  interface FormattedOracleSummaryInterface {
4
4
  status?: "created" | "modified" | "deleted";
5
5
  oracleID?: string;
@@ -24,6 +24,6 @@ interface FormattedPriceDataSeriesChanges {
24
24
  scaleChange?: number;
25
25
  originalPriceChange?: string;
26
26
  }
27
- declare function parsePriceDataSeries(series: OraclePriceDataSeriesInterface): FormattedOraclePriceDataSeriesInterface;
27
+ declare function parsePriceDataSeries(series: PriceData): FormattedOraclePriceDataSeriesInterface;
28
28
  declare function parseOracleChanges(metadata: TransactionMetadata): FormattedOracleSummaryInterface | undefined;
29
29
  export { parseOracleChanges, parsePriceDataSeries };
@@ -0,0 +1,14 @@
1
+ import { FormattedRemark } from "../../types";
2
+ type FormattedRemarkSummaryInterface = {
3
+ status?: "created" | "modified" | "deleted";
4
+ previousValue?: string;
5
+ } & FormattedRemark;
6
+ interface FormattedRemarksSummaryInterface {
7
+ status?: "created" | "modified" | "deleted";
8
+ objectID: string;
9
+ entryType?: string;
10
+ remarks?: FormattedRemarkSummaryInterface[];
11
+ previousTxnID?: string;
12
+ }
13
+ declare function parseRemarksChanges(tx: any): FormattedRemarksSummaryInterface | undefined;
14
+ export { parseRemarksChanges };
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseRemarksChanges = parseRemarksChanges;
4
+ const utils_1 = require("../utils");
5
+ const remarks_1 = require("../ledger/remarks");
6
+ function parseEntryRemarks(node) {
7
+ const final = node.diffType === "CreatedNode" ? node.newFields : node.finalFields;
8
+ const prev = node.previousFields;
9
+ if (!final.Remarks && !prev.Remarks) {
10
+ return undefined;
11
+ }
12
+ const remarks = ((0, remarks_1.parseRemarks)(final.Remarks) || []);
13
+ if (prev.Remarks) {
14
+ const previousRemarks = (0, remarks_1.parseRemarks)(prev.Remarks) || [];
15
+ remarks.forEach((remark) => {
16
+ const previousRemark = previousRemarks.find((r) => r.name === remark.name);
17
+ if (previousRemark) {
18
+ if (previousRemark.value !== remark.value) {
19
+ remark.status = "modified";
20
+ remark.previousValue = previousRemark.value;
21
+ }
22
+ }
23
+ else {
24
+ remark.status = "created";
25
+ }
26
+ });
27
+ previousRemarks.forEach((previousRemark) => {
28
+ if (!remarks.some((r) => r.name === previousRemark.name)) {
29
+ remarks.push({
30
+ ...previousRemark,
31
+ status: "deleted",
32
+ });
33
+ }
34
+ });
35
+ }
36
+ else {
37
+ remarks.forEach((remark) => {
38
+ remark.status = "created";
39
+ });
40
+ }
41
+ return remarks;
42
+ }
43
+ function summarizeRemarks(node) {
44
+ const summary = {
45
+ objectID: node.ledgerIndex,
46
+ entryType: node.entryType,
47
+ remarks: parseEntryRemarks(node),
48
+ };
49
+ if (node.PreviousTxnID) {
50
+ summary.previousTxnID = node.PreviousTxnID;
51
+ }
52
+ return summary;
53
+ }
54
+ function parseRemarksChanges(tx) {
55
+ if (!tx.ObjectID || !tx.meta || !Array.isArray(tx.meta.AffectedNodes)) {
56
+ return undefined;
57
+ }
58
+ const metadata = tx.meta;
59
+ const affectedNodes = metadata.AffectedNodes.filter((affectedNode) => {
60
+ const node = affectedNode.CreatedNode || affectedNode.ModifiedNode || affectedNode.DeletedNode;
61
+ return node.LedgerIndex === tx.ObjectID;
62
+ });
63
+ if (affectedNodes.length !== 1) {
64
+ return undefined;
65
+ }
66
+ const normalizedNode = (0, utils_1.normalizeNode)(affectedNodes[0]);
67
+ return summarizeRemarks(normalizedNode);
68
+ }
@@ -36,6 +36,8 @@ const MPTOKEN_TYPES = [
36
36
  "Payment",
37
37
  "Clawback",
38
38
  ];
39
+ const DELEGATE_TYPES = ["DelegateSet"];
40
+ const REMARKS_TYPES = ["SetRemarks"];
39
41
  function parseOutcome(tx, nativeCurrency, definitions) {
40
42
  const metadata = tx.meta || tx.metaData;
41
43
  if (!metadata) {
@@ -62,6 +64,8 @@ function parseOutcome(tx, nativeCurrency, definitions) {
62
64
  oracleChanges: getOracleChanges(tx),
63
65
  mptokenIssuanceChanges: getMPTokenIssuanceChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
64
66
  mptokenChanges: getMPTokenChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
67
+ delegateChanges: getDelegateChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
68
+ remarksChanges: getRemarksChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
65
69
  unlReportChanges: getUNLReportChanges(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
66
70
  hooksExecutions: getHooksExecutions(tx, nativeCurrency || (0, client_1.getNativeCurrency)()),
67
71
  emittedTxns: getEmittedTxns(tx, nativeCurrency || (0, client_1.getNativeCurrency)(), definitions),
@@ -198,3 +202,21 @@ function getMPTokenIssuanceChanges(tx, nativeCurrency) {
198
202
  const mptokenIssuanceChanges = (0, index_1.parseMPTokenIssuanceChanges)(tx);
199
203
  return Object.keys(mptokenIssuanceChanges).length > 0 ? mptokenIssuanceChanges : undefined;
200
204
  }
205
+ function getDelegateChanges(tx, nativeCurrency) {
206
+ if (nativeCurrency !== "XRP") {
207
+ return undefined;
208
+ }
209
+ if (!DELEGATE_TYPES.includes(tx.TransactionType)) {
210
+ return undefined;
211
+ }
212
+ return (0, index_1.parseDelegateChanges)(tx.meta);
213
+ }
214
+ function getRemarksChanges(tx, nativeCurrency) {
215
+ if (nativeCurrency !== "XAH") {
216
+ return undefined;
217
+ }
218
+ if (!REMARKS_TYPES.includes(tx.TransactionType)) {
219
+ return undefined;
220
+ }
221
+ return (0, index_1.parseRemarksChanges)(tx);
222
+ }
@@ -1,3 +1,4 @@
1
+ import { AccountDelete } from "xrpl";
1
2
  import { FormattedAccountDeleteSpecification } from "../../types/account";
2
- declare function parseAccountDelete(tx: any): FormattedAccountDeleteSpecification;
3
+ declare function parseAccountDelete(tx: AccountDelete): FormattedAccountDeleteSpecification;
3
4
  export default parseAccountDelete;
@@ -39,6 +39,7 @@ const emit_details_1 = require("../ledger/emit_details");
39
39
  const memos_1 = require("../ledger/memos");
40
40
  const signers_1 = require("../ledger/signers");
41
41
  const regular_key_1 = require("../ledger/regular-key");
42
+ const delegate_1 = require("../ledger/delegate");
42
43
  const source_1 = require("../ledger/source");
43
44
  const destination_1 = require("../ledger/destination");
44
45
  function parseAccountDelete(tx) {
@@ -46,6 +47,7 @@ function parseAccountDelete(tx) {
46
47
  return (0, common_1.removeUndefined)({
47
48
  signers: (0, signers_1.parseSigners)(tx),
48
49
  signer: (0, regular_key_1.parseSignerRegularKey)(tx),
50
+ delegate: (0, delegate_1.parseDelegate)(tx),
49
51
  source: (0, source_1.parseSource)(tx),
50
52
  destination: (0, destination_1.parseDestination)(tx),
51
53
  emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
@@ -1,3 +1,4 @@
1
+ import { AMMBid } from "xrpl";
1
2
  import { FormattedAmmBidSpecification } from "../../types/amm";
2
- declare function parseAmmBid(tx: any): FormattedAmmBidSpecification;
3
+ declare function parseAmmBid(tx: AMMBid): FormattedAmmBidSpecification;
3
4
  export default parseAmmBid;
@@ -44,12 +44,14 @@ const auth_accounts_1 = __importDefault(require("../ledger/auth-accounts"));
44
44
  const memos_1 = require("../ledger/memos");
45
45
  const signers_1 = require("../ledger/signers");
46
46
  const regular_key_1 = require("../ledger/regular-key");
47
+ const delegate_1 = require("../ledger/delegate");
47
48
  const source_1 = require("../ledger/source");
48
49
  function parseAmmBid(tx) {
49
50
  assert.ok(tx.TransactionType === "AMMBid");
50
51
  return (0, common_1.removeUndefined)({
51
52
  signers: (0, signers_1.parseSigners)(tx),
52
53
  signer: (0, regular_key_1.parseSignerRegularKey)(tx),
54
+ delegate: (0, delegate_1.parseDelegate)(tx),
53
55
  source: (0, source_1.parseSource)(tx),
54
56
  asset: (0, asset_1.default)(tx.Asset),
55
57
  asset2: (0, asset_1.default)(tx.Asset2),
@@ -1,3 +1,4 @@
1
+ import { AMMClawback } from "xrpl";
1
2
  import { FormattedAmmClawbackSpecification } from "../../types/amm";
2
- declare function parseAmmClawback(tx: any): FormattedAmmClawbackSpecification;
3
+ declare function parseAmmClawback(tx: AMMClawback): FormattedAmmClawbackSpecification;
3
4
  export default parseAmmClawback;
@@ -44,6 +44,7 @@ const memos_1 = require("../ledger/memos");
44
44
  const account_1 = require("../ledger/account");
45
45
  const signers_1 = require("../ledger/signers");
46
46
  const regular_key_1 = require("../ledger/regular-key");
47
+ const delegate_1 = require("../ledger/delegate");
47
48
  const source_1 = require("../ledger/source");
48
49
  const amm_clawback_flags_1 = __importDefault(require("../ledger/amm-clawback-flags"));
49
50
  function parseAmmClawback(tx) {
@@ -51,6 +52,7 @@ function parseAmmClawback(tx) {
51
52
  return (0, common_1.removeUndefined)({
52
53
  signers: (0, signers_1.parseSigners)(tx),
53
54
  signer: (0, regular_key_1.parseSignerRegularKey)(tx),
55
+ delegate: (0, delegate_1.parseDelegate)(tx),
54
56
  source: (0, source_1.parseSource)(tx),
55
57
  asset: (0, asset_1.default)(tx.Asset),
56
58
  asset2: (0, asset_1.default)(tx.Asset2),
@@ -1,3 +1,4 @@
1
+ import { AMMCreate } from "xrpl";
1
2
  import { FormattedAmmCreateSpecification } from "../../types/amm";
2
- declare function parseAmmCreate(tx: any): FormattedAmmCreateSpecification;
3
+ declare function parseAmmCreate(tx: AMMCreate): FormattedAmmCreateSpecification;
3
4
  export default parseAmmCreate;
@@ -42,12 +42,14 @@ const amount_1 = __importDefault(require("../ledger/amount"));
42
42
  const memos_1 = require("../ledger/memos");
43
43
  const signers_1 = require("../ledger/signers");
44
44
  const regular_key_1 = require("../ledger/regular-key");
45
+ const delegate_1 = require("../ledger/delegate");
45
46
  const source_1 = require("../ledger/source");
46
47
  function parseAmmCreate(tx) {
47
48
  assert.ok(tx.TransactionType === "AMMCreate");
48
49
  return (0, common_1.removeUndefined)({
49
50
  signers: (0, signers_1.parseSigners)(tx),
50
51
  signer: (0, regular_key_1.parseSignerRegularKey)(tx),
52
+ delegate: (0, delegate_1.parseDelegate)(tx),
51
53
  source: (0, source_1.parseSource)(tx),
52
54
  amount: (0, amount_1.default)(tx.Amount),
53
55
  amount2: (0, amount_1.default)(tx.Amount2),
@@ -1,3 +1,4 @@
1
+ import { AMMDelete } from "xrpl";
1
2
  import { FormattedAmmDeleteSpecification } from "../../types/amm";
2
- declare function parseAmmDelete(tx: any): FormattedAmmDeleteSpecification;
3
+ declare function parseAmmDelete(tx: AMMDelete): FormattedAmmDeleteSpecification;
3
4
  export default parseAmmDelete;
@@ -42,12 +42,14 @@ const asset_1 = __importDefault(require("../ledger/asset"));
42
42
  const memos_1 = require("../ledger/memos");
43
43
  const signers_1 = require("../ledger/signers");
44
44
  const regular_key_1 = require("../ledger/regular-key");
45
+ const delegate_1 = require("../ledger/delegate");
45
46
  const source_1 = require("../ledger/source");
46
47
  function parseAmmDelete(tx) {
47
48
  assert.ok(tx.TransactionType === "AMMDelete");
48
49
  return (0, common_1.removeUndefined)({
49
50
  signers: (0, signers_1.parseSigners)(tx),
50
51
  signer: (0, regular_key_1.parseSignerRegularKey)(tx),
52
+ delegate: (0, delegate_1.parseDelegate)(tx),
51
53
  source: (0, source_1.parseSource)(tx),
52
54
  asset: (0, asset_1.default)(tx.Asset),
53
55
  asset2: (0, asset_1.default)(tx.Asset2),
@@ -1,3 +1,4 @@
1
+ import { AMMDeposit } from "xrpl";
1
2
  import { FormattedAmmDepositSpecification } from "../../types/amm";
2
- declare function parseAmmDeposit(tx: any): FormattedAmmDepositSpecification;
3
+ declare function parseAmmDeposit(tx: AMMDeposit): FormattedAmmDepositSpecification;
3
4
  export default parseAmmDeposit;
@@ -43,6 +43,7 @@ const asset_1 = __importDefault(require("../ledger/asset"));
43
43
  const memos_1 = require("../ledger/memos");
44
44
  const signers_1 = require("../ledger/signers");
45
45
  const regular_key_1 = require("../ledger/regular-key");
46
+ const delegate_1 = require("../ledger/delegate");
46
47
  const source_1 = require("../ledger/source");
47
48
  const amm_deposit_flags_1 = __importDefault(require("../ledger/amm-deposit-flags"));
48
49
  function parseAmmDeposit(tx) {
@@ -50,6 +51,7 @@ function parseAmmDeposit(tx) {
50
51
  return (0, common_1.removeUndefined)({
51
52
  signers: (0, signers_1.parseSigners)(tx),
52
53
  signer: (0, regular_key_1.parseSignerRegularKey)(tx),
54
+ delegate: (0, delegate_1.parseDelegate)(tx),
53
55
  source: (0, source_1.parseSource)(tx),
54
56
  asset: (0, asset_1.default)(tx.Asset),
55
57
  asset2: (0, asset_1.default)(tx.Asset2),
@@ -1,3 +1,4 @@
1
+ import { AMMVote } from "xrpl";
1
2
  import { FormattedAmmVoteSpecification } from "../../types/amm";
2
- declare function parseAmmVote(tx: any): FormattedAmmVoteSpecification;
3
+ declare function parseAmmVote(tx: AMMVote): FormattedAmmVoteSpecification;
3
4
  export default parseAmmVote;
@@ -42,12 +42,14 @@ const asset_1 = __importDefault(require("../ledger/asset"));
42
42
  const memos_1 = require("../ledger/memos");
43
43
  const signers_1 = require("../ledger/signers");
44
44
  const regular_key_1 = require("../ledger/regular-key");
45
+ const delegate_1 = require("../ledger/delegate");
45
46
  const source_1 = require("../ledger/source");
46
47
  function parseAmmVote(tx) {
47
48
  assert.ok(tx.TransactionType === "AMMVote");
48
49
  return (0, common_1.removeUndefined)({
49
50
  signers: (0, signers_1.parseSigners)(tx),
50
51
  signer: (0, regular_key_1.parseSignerRegularKey)(tx),
52
+ delegate: (0, delegate_1.parseDelegate)(tx),
51
53
  source: (0, source_1.parseSource)(tx),
52
54
  asset: (0, asset_1.default)(tx.Asset),
53
55
  asset2: (0, asset_1.default)(tx.Asset2),
@@ -1,3 +1,4 @@
1
+ import { AMMWithdraw } from "xrpl";
1
2
  import { FormattedAmmWithdrawSpecification } from "../../types/amm";
2
- declare function parseAmmDeposit(tx: any): FormattedAmmWithdrawSpecification;
3
+ declare function parseAmmDeposit(tx: AMMWithdraw): FormattedAmmWithdrawSpecification;
3
4
  export default parseAmmDeposit;
@@ -43,6 +43,7 @@ const asset_1 = __importDefault(require("../ledger/asset"));
43
43
  const memos_1 = require("../ledger/memos");
44
44
  const signers_1 = require("../ledger/signers");
45
45
  const regular_key_1 = require("../ledger/regular-key");
46
+ const delegate_1 = require("../ledger/delegate");
46
47
  const source_1 = require("../ledger/source");
47
48
  const amm_withdraw_flags_1 = __importDefault(require("../ledger/amm-withdraw-flags"));
48
49
  function parseAmmDeposit(tx) {
@@ -50,6 +51,7 @@ function parseAmmDeposit(tx) {
50
51
  return (0, common_1.removeUndefined)({
51
52
  signers: (0, signers_1.parseSigners)(tx),
52
53
  signer: (0, regular_key_1.parseSignerRegularKey)(tx),
54
+ delegate: (0, delegate_1.parseDelegate)(tx),
53
55
  source: (0, source_1.parseSource)(tx),
54
56
  asset: (0, asset_1.default)(tx.Asset),
55
57
  asset2: (0, asset_1.default)(tx.Asset2),
@@ -1,3 +1,4 @@
1
+ import { CheckCancel } from "xrpl";
1
2
  import { FormattedCheckCancelSpecification } from "../../types/checks";
2
- declare function parseCheckCancel(tx: any): FormattedCheckCancelSpecification;
3
+ declare function parseCheckCancel(tx: CheckCancel): FormattedCheckCancelSpecification;
3
4
  export default parseCheckCancel;