@typus/typus-sdk 1.0.84 → 1.0.86
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.
|
@@ -41,6 +41,7 @@ var token_1 = require("../token");
|
|
|
41
41
|
function getUserHistory(provider, originPackage, sender, startTimeMs) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function () {
|
|
43
43
|
var senderFilter, result, txHistory, nextPage;
|
|
44
|
+
var _this = this;
|
|
44
45
|
return __generator(this, function (_a) {
|
|
45
46
|
switch (_a.label) {
|
|
46
47
|
case 0:
|
|
@@ -67,9 +68,26 @@ function getUserHistory(provider, originPackage, sender, startTimeMs) {
|
|
|
67
68
|
return [3 /*break*/, 6];
|
|
68
69
|
}
|
|
69
70
|
return [3 /*break*/, 3];
|
|
70
|
-
case 6:
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
case 6: return [4 /*yield*/, txHistory.reduce(function (promise, currentValue) { return __awaiter(_this, void 0, void 0, function () {
|
|
72
|
+
var tx, i;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0: return [4 /*yield*/, promise];
|
|
76
|
+
case 1:
|
|
77
|
+
tx = _a.sent();
|
|
78
|
+
if (currentValue.Action == "IncentiveNewBid") {
|
|
79
|
+
i = tx.findIndex(function (x) { return x.txDigest == currentValue.txDigest && x.Action == "NewBid"; });
|
|
80
|
+
tx[i].BidPaidWithIncentive = tx[i].BidPaid - currentValue.IncentiveValue;
|
|
81
|
+
tx[i].IncentiveValue = currentValue.IncentiveValue;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
tx.push(currentValue);
|
|
85
|
+
}
|
|
86
|
+
return [2 /*return*/, tx];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}); }, Promise.resolve(new Array()))];
|
|
90
|
+
case 7: return [2 /*return*/, _a.sent()];
|
|
73
91
|
}
|
|
74
92
|
});
|
|
75
93
|
});
|
|
@@ -112,6 +130,9 @@ function parseTxHistory(datas, originPackage) {
|
|
|
112
130
|
Fee: Number(parsedJson.fee) / Math.pow(10, (0, token_1.assetToDecimal)(asset)),
|
|
113
131
|
BidSize: Number(parsedJson.size) / Math.pow(10, (0, token_1.assetToDecimal)(asset)),
|
|
114
132
|
BidPaid: Number(parsedJson.coin_value) / Math.pow(10, (0, token_1.assetToDecimal)(b_asset)),
|
|
133
|
+
BidPaidWithIncentive: undefined,
|
|
134
|
+
BidPaidAsset: b_asset,
|
|
135
|
+
IncentiveValue: Number(parsedJson.incentive_value) / Math.pow(10, (0, token_1.assetToDecimal)(asset)),
|
|
115
136
|
});
|
|
116
137
|
return [2 /*return*/, txHistory];
|
|
117
138
|
}
|