@typus/typus-sdk 1.1.22 → 1.1.24
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.
|
@@ -3,9 +3,10 @@ import { Vault } from "./view-function";
|
|
|
3
3
|
export declare function getUserHistory(provider: JsonRpcProvider, originPackage: string, vaults: {
|
|
4
4
|
[key: string]: Vault;
|
|
5
5
|
}, sender: string, startTimeMs: number): Promise<TxHistory[]>;
|
|
6
|
-
interface TxHistory {
|
|
7
|
-
Index: string;
|
|
6
|
+
export interface TxHistory {
|
|
7
|
+
Index: string | undefined;
|
|
8
8
|
Action: string;
|
|
9
|
+
Period: string | undefined;
|
|
9
10
|
Amount: string | undefined;
|
|
10
11
|
Vault: string | undefined;
|
|
11
12
|
RiskLevel: string | undefined;
|
|
@@ -14,4 +15,3 @@ interface TxHistory {
|
|
|
14
15
|
Date: Date;
|
|
15
16
|
txDigest: string;
|
|
16
17
|
}
|
|
17
|
-
export {};
|
|
@@ -89,15 +89,16 @@ function parseTxHistory(datas, originPackage, vaults) {
|
|
|
89
89
|
return type.startsWith(originPackage) || type.includes("typus_nft::First") || type.includes("typus_nft::ExpUpEvent");
|
|
90
90
|
})
|
|
91
91
|
.reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
|
|
92
|
-
var txHistory, functionType, action, Action, Amount, Vault, RiskLevel, Tails, Exp, o_token, v, period, optionType, i, i, token, amount, amount, token, amount, size, token, amount, i, b_token, size, bidder_balance;
|
|
93
|
-
var _a
|
|
94
|
-
return __generator(this, function (
|
|
95
|
-
switch (
|
|
92
|
+
var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, o_token, v, period, optionType, i, i, token, amount, amount, token, amount, size, token, amount, i, b_token, size, bidder_balance;
|
|
93
|
+
var _a;
|
|
94
|
+
return __generator(this, function (_b) {
|
|
95
|
+
switch (_b.label) {
|
|
96
96
|
case 0: return [4 /*yield*/, promise];
|
|
97
97
|
case 1:
|
|
98
|
-
txHistory =
|
|
98
|
+
txHistory = _b.sent();
|
|
99
99
|
functionType = (_a = new RegExp("^([^::]+)::([^::]+)::([^<]+)").exec(event.type)) === null || _a === void 0 ? void 0 : _a.slice(1, 4);
|
|
100
100
|
action = functionType[2];
|
|
101
|
+
Index = event.parsedJson.index;
|
|
101
102
|
if (event.parsedJson.index) {
|
|
102
103
|
v = vaults[event.parsedJson.index];
|
|
103
104
|
if (v) {
|
|
@@ -122,6 +123,7 @@ function parseTxHistory(datas, originPackage, vaults) {
|
|
|
122
123
|
period = "";
|
|
123
124
|
break;
|
|
124
125
|
}
|
|
126
|
+
Period = period;
|
|
125
127
|
optionType = void 0;
|
|
126
128
|
switch (v.info.optionType) {
|
|
127
129
|
case "0":
|
|
@@ -243,11 +245,13 @@ function parseTxHistory(datas, originPackage, vaults) {
|
|
|
243
245
|
amount = Number(event.parsedJson.amount) / Math.pow(10, Number(event.parsedJson.decimal));
|
|
244
246
|
Action = action.slice(0, action.length - 5);
|
|
245
247
|
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
248
|
+
Index = event.parsedJson.index;
|
|
246
249
|
if (i != -1) {
|
|
247
250
|
txHistory[i].Action = Action;
|
|
248
251
|
txHistory[i].Amount = Amount;
|
|
249
252
|
txHistory[i].Vault = Vault;
|
|
250
253
|
txHistory[i].RiskLevel = RiskLevel;
|
|
254
|
+
txHistory[i].Index = Index;
|
|
251
255
|
return [2 /*return*/, txHistory];
|
|
252
256
|
}
|
|
253
257
|
break;
|
|
@@ -292,7 +296,8 @@ function parseTxHistory(datas, originPackage, vaults) {
|
|
|
292
296
|
return [2 /*return*/, txHistory];
|
|
293
297
|
}
|
|
294
298
|
txHistory.push({
|
|
295
|
-
Index:
|
|
299
|
+
Index: Index,
|
|
300
|
+
Period: Period,
|
|
296
301
|
Action: Action,
|
|
297
302
|
Amount: Amount,
|
|
298
303
|
Vault: Vault,
|