@typus/typus-sdk 1.0.83 → 1.0.85
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.
|
@@ -86,7 +86,7 @@ function parseTxHistory(datas, originPackage) {
|
|
|
86
86
|
return type.startsWith(originPackage);
|
|
87
87
|
})
|
|
88
88
|
.reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
|
|
89
|
-
var txHistory, functionType, action, matches, typeArgs, assets, asset, parsedJson;
|
|
89
|
+
var txHistory, functionType, action, matches, typeArgs, assets, asset, b_asset, parsedJson, i, incentive_value;
|
|
90
90
|
var _a;
|
|
91
91
|
return __generator(this, function (_b) {
|
|
92
92
|
switch (_b.label) {
|
|
@@ -100,17 +100,26 @@ function parseTxHistory(datas, originPackage) {
|
|
|
100
100
|
typeArgs = matches[1].split(", ");
|
|
101
101
|
assets = (0, token_1.typeArgsToAssets)(typeArgs);
|
|
102
102
|
asset = action == "NewBid" ? assets[2] : assets[0];
|
|
103
|
+
b_asset = assets[1];
|
|
103
104
|
parsedJson = event.parsedJson;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
if (action == "IncentiveNewBid") {
|
|
106
|
+
i = txHistory.findIndex(function (x) { return x.txDigest == event.id.txDigest; });
|
|
107
|
+
incentive_value = Number(parsedJson.incentive_value) / Math.pow(10, (0, token_1.assetToDecimal)(asset));
|
|
108
|
+
txHistory[i].BidPaid = txHistory[i].BidPaid - incentive_value;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
txHistory.push({
|
|
112
|
+
Vault: parsedJson.index,
|
|
113
|
+
Action: action,
|
|
114
|
+
Date: new Date(Number(event.timestampMs)),
|
|
115
|
+
txDigest: event.id.txDigest,
|
|
116
|
+
Asset: asset,
|
|
117
|
+
Amount: Number(parsedJson.amount) / Math.pow(10, (0, token_1.assetToDecimal)(asset)),
|
|
118
|
+
Fee: Number(parsedJson.fee) / Math.pow(10, (0, token_1.assetToDecimal)(asset)),
|
|
119
|
+
BidSize: Number(parsedJson.size) / Math.pow(10, (0, token_1.assetToDecimal)(asset)),
|
|
120
|
+
BidPaid: Number(parsedJson.coin_value) / Math.pow(10, (0, token_1.assetToDecimal)(b_asset)),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
114
123
|
return [2 /*return*/, txHistory];
|
|
115
124
|
}
|
|
116
125
|
return [2 /*return*/];
|