@bithomp/xrpl-api 3.7.29 → 3.7.31

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.
@@ -245,6 +245,20 @@ function adjustBalancesForPaymentChannel(balanceChanges, metadata, nativeCurrenc
245
245
  { currency: channelChanges.amountChange.currency, value: channelChanges.amountChange.value },
246
246
  ]);
247
247
  }
248
+ else if (channelChanges.status === "deleted") {
249
+ let unlockedAmount = new bignumber_js_1.default(0);
250
+ if (channelChanges?.balanceChange) {
251
+ unlockedAmount = new bignumber_js_1.default(channelChanges?.balanceChange?.value || "0").abs();
252
+ }
253
+ else {
254
+ unlockedAmount = new bignumber_js_1.default(channelChanges.amount.value).minus(channelChanges?.balance?.value || "0");
255
+ }
256
+ if (!unlockedAmount.isZero()) {
257
+ adjustBalancesChanges(balanceChanges, channelChanges.source.address, [
258
+ { currency: channelChanges.amount.currency, value: `-${unlockedAmount.toString()}` },
259
+ ]);
260
+ }
261
+ }
248
262
  }
249
263
  else if (tx.TransactionType === "PaymentChannelClaim") {
250
264
  if (tx.Account === channelChanges.source.address && channelChanges.amountChange) {
@@ -68,24 +68,25 @@ function parseChangeAmount(node, type) {
68
68
  return lodash_1.default.assign({}, finalAmount, { value: value });
69
69
  }
70
70
  function parseOrderChange(node) {
71
- const flags = (0, offer_flags_1.default)(node.finalFields.Flags);
72
71
  const takerPays = parseChangeAmount(node, "TakerPays");
73
72
  const takerGets = parseChangeAmount(node, "TakerGets");
73
+ const fields = Object.keys(node.finalFields).length > 0 ? node.finalFields : node.newFields;
74
+ const flags = (0, offer_flags_1.default)(fields.Flags);
74
75
  const orderChange = (0, common_1.removeUndefined)({
75
76
  flags,
76
77
  takerGets,
77
78
  takerPays,
78
- sequence: (node.finalFields.Sequence || node.newFields.Sequence),
79
+ sequence: fields.Sequence,
79
80
  status: parseOrderStatus(node),
80
81
  makerExchangeRate: getQuality(node),
81
82
  expirationTime: getExpirationTime(node),
82
- domainID: node.finalFields.Domain,
83
+ domainID: fields.DomainID,
83
84
  direction: (node.finalFields.Flags & xrpl_1.LedgerEntry.OfferFlags.lsfSell) === 0 ? "buy" : "sell",
84
85
  quantity: flags.sell === true ? takerGets : takerPays,
85
86
  totalPrice: flags.sell === true ? takerPays : takerGets,
86
87
  });
87
88
  Object.defineProperty(orderChange, "account", {
88
- value: node.finalFields.Account || node.newFields.Account,
89
+ value: fields.Account,
89
90
  });
90
91
  return orderChange;
91
92
  }
@@ -64,6 +64,7 @@ function parseOfferCreate(tx, nativeCurrency) {
64
64
  takerGets,
65
65
  takerPays,
66
66
  expirationTime: (0, utils_1.parseTimestamp)(tx.Expiration),
67
+ domainID: tx.DomainID,
67
68
  emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
68
69
  memos: (0, memos_1.parseMemos)(tx),
69
70
  direction: (tx.Flags & xrpl_1.OfferCreateFlags.tfSell) === 0 ? "buy" : "sell",
@@ -36,6 +36,7 @@ export type FormattedOfferCreateSpecification = {
36
36
  takerPays: IssuedCurrencyAmount;
37
37
  expirationTime?: string;
38
38
  orderToReplace?: number;
39
+ domainID?: string;
39
40
  direction: string;
40
41
  immediateOrCancel?: boolean;
41
42
  fillOrKill?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bithomp/xrpl-api",
3
- "version": "3.7.29",
3
+ "version": "3.7.31",
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",
@@ -71,15 +71,15 @@
71
71
  "@types/mocha": "^10.0.10",
72
72
  "@types/nconf": "^0.10.7",
73
73
  "@types/node": "^25.2.3",
74
- "@typescript-eslint/eslint-plugin": "^8.55.0",
75
- "@typescript-eslint/parser": "^8.55.0",
74
+ "@typescript-eslint/eslint-plugin": "^8.56.0",
75
+ "@typescript-eslint/parser": "^8.56.0",
76
76
  "chai": "^6.2.2",
77
77
  "chai-as-promised": "^8.0.2",
78
78
  "eslint": "^9.39.2",
79
79
  "eslint-config-prettier": "^10.1.8",
80
80
  "eslint-plugin-chai-friendly": "^1.1.0",
81
81
  "eslint-plugin-import": "^2.32.0",
82
- "eslint-plugin-n": "^17.23.2",
82
+ "eslint-plugin-n": "^17.24.0",
83
83
  "eslint-plugin-promise": "^7.2.1",
84
84
  "mocha": "^11.7.5",
85
85
  "nconf": "^0.13.0",