@bithomp/xrpl-api 2.7.0 → 2.7.1

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.
@@ -40,7 +40,7 @@ function summarizePaymentChannel(node) {
40
40
  .toString(10);
41
41
  }
42
42
  if (node.PreviousTxnID) {
43
- summary.previousTxnId = node.PreviousTxnID;
43
+ summary.previousTxnID = node.PreviousTxnID;
44
44
  }
45
45
  return summary;
46
46
  }
@@ -1,13 +1,16 @@
1
1
  import { FormattedSourceAddress, FormattedDestinationAddress } from "../../v1/common/types/objects/account";
2
- declare function parseEscrowChanges(tx: any): {
3
- status: string | undefined;
4
- escrowIndex: any;
5
- escrowSequence: any;
6
- amount: any;
7
- condition: any;
8
- source: FormattedSourceAddress;
9
- destination: FormattedDestinationAddress;
10
- allowCancelAfter: string | undefined;
11
- allowExecuteAfter: string | undefined;
12
- } | undefined;
2
+ interface FormattedEscrowInterface {
3
+ status?: string;
4
+ escrowIndex?: number;
5
+ escrowSequence?: number;
6
+ amount?: string;
7
+ condition?: string;
8
+ source?: FormattedSourceAddress;
9
+ destination?: FormattedDestinationAddress;
10
+ allowCancelAfter?: string;
11
+ allowExecuteAfter?: string;
12
+ previousTxnID?: string;
13
+ previousTxnLgrSeq?: number;
14
+ }
15
+ declare function parseEscrowChanges(tx: any): FormattedEscrowInterface | undefined;
13
16
  export { parseEscrowChanges };
@@ -38,7 +38,7 @@ function summarizeEscrow(tx, node) {
38
38
  address: final.Destination,
39
39
  tag: final.DestinationTag,
40
40
  };
41
- const summary = (0, common_1.removeUndefined)({
41
+ const summary = {
42
42
  status: parseEscrowStatus(tx, node),
43
43
  escrowIndex: node.ledgerIndex,
44
44
  escrowSequence: parseEscrowSequence(tx),
@@ -48,8 +48,20 @@ function summarizeEscrow(tx, node) {
48
48
  destination: (0, common_1.removeUndefined)(destination),
49
49
  allowCancelAfter: (0, utils_2.parseTimestamp)(final.CancelAfter),
50
50
  allowExecuteAfter: (0, utils_2.parseTimestamp)(final.FinishAfter),
51
- });
52
- return summary;
51
+ };
52
+ if (final.PreviousTxnID) {
53
+ summary.previousTxnID = final.PreviousTxnID;
54
+ }
55
+ else if (node.diffType === "CreatedNode") {
56
+ summary.previousTxnID = tx.hash;
57
+ }
58
+ if (final.PreviousTxnLgrSeq) {
59
+ summary.previousTxnLgrSeq = final.PreviousTxnLgrSeq;
60
+ }
61
+ else if (node.diffType === "CreatedNode") {
62
+ summary.previousTxnLgrSeq = tx.ledger_index;
63
+ }
64
+ return (0, common_1.removeUndefined)(summary);
53
65
  }
54
66
  function parseEscrowChanges(tx) {
55
67
  const escrows = (0, utils_1.normalizeNodes)(tx.meta).filter((n) => {
@@ -55,8 +55,8 @@ class NFTokenOfferChanges {
55
55
  const owner = affectedNode.CreatedNode.NewFields.Owner;
56
56
  const index = affectedNode.CreatedNode.LedgerIndex;
57
57
  const destination = affectedNode.CreatedNode.NewFields.Destination;
58
- const prevTxHash = affectedNode.CreatedNode.NewFields.PreviousTxnID;
59
- const prevLedgerIndex = affectedNode.CreatedNode.NewFields.PreviousTxnLgrSeq;
58
+ const previousTxnID = affectedNode.CreatedNode.NewFields.PreviousTxnID;
59
+ const previousTxnLgrSeq = affectedNode.CreatedNode.NewFields.PreviousTxnLgrSeq;
60
60
  let expiration = affectedNode.CreatedNode.NewFields.Expiration;
61
61
  if (typeof expiration === "number") {
62
62
  expiration = (0, ledger_1.ledgerTimeToUnixTime)(expiration);
@@ -70,8 +70,8 @@ class NFTokenOfferChanges {
70
70
  destination,
71
71
  expiration,
72
72
  index,
73
- prevTxHash,
74
- prevLedgerIndex,
73
+ previousTxnID,
74
+ previousTxnLgrSeq,
75
75
  });
76
76
  }
77
77
  isNFTokensDeleteOfferNode(affectedNode) {
@@ -85,8 +85,8 @@ class NFTokenOfferChanges {
85
85
  const owner = affectedNode.DeletedNode.FinalFields.Owner;
86
86
  const index = affectedNode.DeletedNode.LedgerIndex;
87
87
  const destination = affectedNode.DeletedNode.FinalFields.Destination;
88
- const prevTxHash = affectedNode.DeletedNode.FinalFields.PreviousTxnID;
89
- const prevLedgerIndex = affectedNode.DeletedNode.FinalFields.PreviousTxnLgrSeq;
88
+ const previousTxnID = affectedNode.DeletedNode.FinalFields.PreviousTxnID;
89
+ const previousTxnLgrSeq = affectedNode.DeletedNode.FinalFields.PreviousTxnLgrSeq;
90
90
  let expiration = affectedNode.DeletedNode.FinalFields.Expiration;
91
91
  if (typeof expiration === "number") {
92
92
  expiration = (0, ledger_1.ledgerTimeToUnixTime)(expiration);
@@ -100,8 +100,8 @@ class NFTokenOfferChanges {
100
100
  destination,
101
101
  expiration,
102
102
  index,
103
- prevTxHash,
104
- prevLedgerIndex,
103
+ previousTxnID,
104
+ previousTxnLgrSeq,
105
105
  });
106
106
  }
107
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bithomp/xrpl-api",
3
- "version": "2.7.0",
3
+ "version": "2.7.1",
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",