@bithomp/xrpl-api 2.7.0 → 2.7.2
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.
- package/lib/parse/outcome/channel_changes.js +1 -1
- package/lib/parse/outcome/escrow_changes.d.ts +14 -11
- package/lib/parse/outcome/escrow_changes.js +15 -3
- package/lib/parse/outcome/nftoken_offer_changes.js +8 -8
- package/lib/parse/outcome/uritoken_sell_offer_changes.js +8 -1
- package/package.json +1 -1
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { FormattedSourceAddress, FormattedDestinationAddress } from "../../v1/common/types/objects/account";
|
|
2
|
-
|
|
3
|
-
status
|
|
4
|
-
escrowIndex
|
|
5
|
-
escrowSequence
|
|
6
|
-
amount
|
|
7
|
-
condition
|
|
8
|
-
source
|
|
9
|
-
destination
|
|
10
|
-
allowCancelAfter
|
|
11
|
-
allowExecuteAfter
|
|
12
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
|
59
|
-
const
|
|
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
|
-
|
|
74
|
-
|
|
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
|
|
89
|
-
const
|
|
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
|
-
|
|
104
|
-
|
|
103
|
+
previousTxnID,
|
|
104
|
+
previousTxnLgrSeq,
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -66,10 +66,17 @@ class URITokenSellOfferChanges {
|
|
|
66
66
|
else {
|
|
67
67
|
destination = node.FinalFields.Destination;
|
|
68
68
|
}
|
|
69
|
+
let amount;
|
|
70
|
+
if (node.PreviousFields.hasOwnProperty("Amount")) {
|
|
71
|
+
amount = node.PreviousFields.Amount;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
amount = node.FinalFields.Amount;
|
|
75
|
+
}
|
|
69
76
|
this.addChange(owner, {
|
|
70
77
|
status: "deleted",
|
|
71
78
|
uritokenID,
|
|
72
|
-
amount
|
|
79
|
+
amount,
|
|
73
80
|
destination,
|
|
74
81
|
});
|
|
75
82
|
}
|