@bithomp/xrpl-api 3.6.11 → 3.6.14

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.
@@ -34,16 +34,18 @@ function computeBalanceChange(node) {
34
34
  value = parseValue(node.newFields.Balance);
35
35
  }
36
36
  else if (node.newFields.MPTAmount) {
37
- value = parseValue(node.newFields);
37
+ value = parseValue(node.newFields.MPTAmount);
38
38
  }
39
39
  else if (node.previousFields.Balance && node.finalFields.Balance) {
40
40
  value = parseValue(node.finalFields.Balance).minus(parseValue(node.previousFields.Balance));
41
41
  }
42
42
  else if (node.entryType === "MPToken" && (node.previousFields.MPTAmount || node.previousFields.LockedAmount)) {
43
- value = parseValue(node.finalFields.MPTAmount ?? 0)
44
- .minus(parseValue(node.previousFields.MPTAmount ?? 0))
45
- .plus(parseValue(node.finalFields.LockedAmount ?? 0))
46
- .minus(parseValue(node.previousFields.LockedAmount ?? 0));
43
+ value = parseValue(node.finalFields.MPTAmount ?? 0).minus(parseValue(node.previousFields.MPTAmount ?? 0));
44
+ if (node.previousFields.LockedAmount) {
45
+ value = value
46
+ .plus(parseValue(node.finalFields.LockedAmount ?? 0))
47
+ .minus(parseValue(node.previousFields.LockedAmount ?? 0));
48
+ }
47
49
  }
48
50
  else if (node.entryType === "MPTokenIssuance") {
49
51
  if (node.newFields.MaximumAmount) {
@@ -50,6 +50,7 @@ class MPTokenChanges {
50
50
  mptIssuanceID,
51
51
  account,
52
52
  amount: node.NewFields.MPTAmount,
53
+ lockedAmount: node.NewFields.LockedAmount,
53
54
  });
54
55
  }
55
56
  if (affectedNode.ModifiedNode) {
@@ -61,6 +62,15 @@ class MPTokenChanges {
61
62
  if (amountChange === "0") {
62
63
  amountChange = undefined;
63
64
  }
65
+ let lockedAmountChange = undefined;
66
+ if (node.PreviousFields.LockedAmount !== undefined) {
67
+ lockedAmountChange = new bignumber_js_1.default(node.FinalFields.LockedAmount ?? 0)
68
+ .minus(node.PreviousFields.LockedAmount ?? 0)
69
+ .toString();
70
+ if (lockedAmountChange === "0") {
71
+ lockedAmountChange = undefined;
72
+ }
73
+ }
64
74
  let flagsChange;
65
75
  if (node.PreviousFields?.Flags !== undefined) {
66
76
  flagsChange = (0, mptoken_flags_1.default)(node.PreviousFields.Flags);
@@ -71,7 +81,9 @@ class MPTokenChanges {
71
81
  mptIssuanceID,
72
82
  account,
73
83
  amount: node.FinalFields.MPTAmount,
84
+ lockedAmount: node.FinalFields.LockedAmount,
74
85
  amountChange,
86
+ lockedAmountChange,
75
87
  flagsChange,
76
88
  });
77
89
  }
@@ -84,6 +96,7 @@ class MPTokenChanges {
84
96
  mptIssuanceID,
85
97
  account,
86
98
  amount: node.FinalFields.MPTAmount,
99
+ lockedAmount: node.FinalFields.LockedAmount,
87
100
  });
88
101
  }
89
102
  }
@@ -50,6 +50,7 @@ class MPTokenIssuanceChanges {
50
50
  transferFee: node.NewFields.TransferFee,
51
51
  maximumAmount: node.NewFields.MaximumAmount,
52
52
  outstandingAmount: node.NewFields.OutstandingAmount,
53
+ lockedAmount: node.NewFields.LockedAmount,
53
54
  metadata: node.NewFields.Metadata,
54
55
  scale: node.NewFields.AssetScale,
55
56
  });
@@ -62,6 +63,23 @@ class MPTokenIssuanceChanges {
62
63
  if (outstandingAmountChange === "0") {
63
64
  outstandingAmountChange = undefined;
64
65
  }
66
+ let lockedAmountChange = undefined;
67
+ if (node.PreviousFields.LockedAmount !== undefined) {
68
+ lockedAmountChange = new bignumber_js_1.default(node.FinalFields.LockedAmount ?? 0)
69
+ .minus(new bignumber_js_1.default(node.PreviousFields.LockedAmount ?? 0))
70
+ .toString();
71
+ if (lockedAmountChange === "0") {
72
+ lockedAmountChange = undefined;
73
+ }
74
+ }
75
+ let lockedAmount = node.FinalFields.LockedAmount;
76
+ if (lockedAmount === undefined && lockedAmountChange !== undefined) {
77
+ lockedAmount = "0";
78
+ }
79
+ let flagsChange;
80
+ if (node.PreviousFields?.Flags !== undefined) {
81
+ flagsChange = (0, mptoken_issuance_flags_1.default)(node.PreviousFields.Flags);
82
+ }
65
83
  this.addChange(mptIssuanceID, {
66
84
  status: "modified",
67
85
  flags: (0, mptoken_issuance_flags_1.default)(node.FinalFields.Flags),
@@ -71,10 +89,12 @@ class MPTokenIssuanceChanges {
71
89
  transferFee: node.FinalFields.TransferFee,
72
90
  maximumAmount: node.FinalFields.MaximumAmount,
73
91
  outstandingAmount: node.FinalFields.OutstandingAmount,
92
+ lockedAmount,
74
93
  metadata: node.FinalFields.Metadata,
75
94
  scale: node.FinalFields.AssetScale,
76
95
  outstandingAmountChange,
77
- flagsChange: node.PreviousFields.hasOwnProperty("Flags") ? (0, mptoken_issuance_flags_1.default)(node.PreviousFields.Flags) : undefined,
96
+ lockedAmountChange,
97
+ flagsChange,
78
98
  });
79
99
  }
80
100
  if (affectedNode.DeletedNode) {
@@ -88,6 +108,7 @@ class MPTokenIssuanceChanges {
88
108
  transferFee: node.FinalFields.TransferFee,
89
109
  maximumAmount: node.FinalFields.MaximumAmount,
90
110
  outstandingAmount: node.FinalFields.OutstandingAmount,
111
+ lockedAmount: node.FinalFields.LockedAmount,
91
112
  metadata: node.FinalFields.Metadata,
92
113
  scale: node.FinalFields.AssetScale,
93
114
  });
@@ -35,6 +35,9 @@ const MPTOKEN_TYPES = [
35
35
  "MPTokenIssuanceDestroy",
36
36
  "Payment",
37
37
  "Clawback",
38
+ "EscrowFinish",
39
+ "EscrowCreate",
40
+ "EscrowCancel",
38
41
  ];
39
42
  const CREDENTIAL_TYPES = ["CredentialCreate", "CredentialAccept", "CredentialDelete"];
40
43
  const DELEGATE_TYPES = ["DelegateSet"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bithomp/xrpl-api",
3
- "version": "3.6.11",
3
+ "version": "3.6.14",
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",