@typus/typus-sdk 1.2.92 → 1.2.93
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.
|
@@ -149,15 +149,15 @@ function parseTxHistory(datas, originPackage, vaults) {
|
|
|
149
149
|
}
|
|
150
150
|
})
|
|
151
151
|
.reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
|
|
152
|
-
var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, d_token, b_token, o_token, i, i, i, token, amount, deposit_amount, deposit_amount, balance, balance, profit, profit, token, amount, amount, token, amount, size, token, amount, token, amount, size, bidder_balance;
|
|
153
|
-
var _a;
|
|
154
|
-
var
|
|
155
|
-
return __generator(this, function (
|
|
156
|
-
switch (
|
|
152
|
+
var txHistory, functionType, action, Action, Amount, Index, Period, Vault, RiskLevel, Tails, Exp, d_token, b_token, o_token, i, i, i, token, amount, token, amount, amount, token, amount, token, amount, token, amount, token, amount, token, amount, deposit_amount, deposit_amount, balance, balance, profit, profit, token, amount, amount, token, amount, size, token, amount, token, amount, size, bidder_balance;
|
|
153
|
+
var _a, _b, _c;
|
|
154
|
+
var _d;
|
|
155
|
+
return __generator(this, function (_e) {
|
|
156
|
+
switch (_e.label) {
|
|
157
157
|
case 0: return [4 /*yield*/, promise];
|
|
158
158
|
case 1:
|
|
159
|
-
txHistory =
|
|
160
|
-
functionType = (
|
|
159
|
+
txHistory = _e.sent();
|
|
160
|
+
functionType = (_d = new RegExp("^([^::]+)::([^::]+)::([^<]+)").exec(event.type)) === null || _d === void 0 ? void 0 : _d.slice(1, 4);
|
|
161
161
|
action = functionType[2];
|
|
162
162
|
Tails = undefined;
|
|
163
163
|
Index = event.parsedJson.index || event.parsedJson.vault_index;
|
|
@@ -245,6 +245,122 @@ function parseTxHistory(datas, originPackage, vaults) {
|
|
|
245
245
|
return [2 /*return*/, txHistory];
|
|
246
246
|
}
|
|
247
247
|
break;
|
|
248
|
+
case "RaiseFundEvent":
|
|
249
|
+
Index = event.parsedJson.log[0];
|
|
250
|
+
_b = __read(parseVaultInfo(vaults, Index, action), 6), Period = _b[0], Vault = _b[1], RiskLevel = _b[2], d_token = _b[3], b_token = _b[4], o_token = _b[5];
|
|
251
|
+
token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.token.name);
|
|
252
|
+
if (event.parsedJson.log[4] > 0) {
|
|
253
|
+
// deposit
|
|
254
|
+
Action = "Deposit";
|
|
255
|
+
amount = Number(event.parsedJson.log[4]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
|
|
256
|
+
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
257
|
+
}
|
|
258
|
+
else if (event.parsedJson.log[5] > 0) {
|
|
259
|
+
// compound
|
|
260
|
+
Action = "Compound";
|
|
261
|
+
amount = Number(event.parsedJson.log[5]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
|
|
262
|
+
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
263
|
+
}
|
|
264
|
+
break;
|
|
265
|
+
case "ReduceFundEvent":
|
|
266
|
+
Index = event.parsedJson.log[0];
|
|
267
|
+
_c = __read(parseVaultInfo(vaults, Index, action), 6), Period = _c[0], Vault = _c[1], RiskLevel = _c[2], d_token = _c[3], b_token = _c[4], o_token = _c[5];
|
|
268
|
+
if (event.parsedJson.log[4] > 0) {
|
|
269
|
+
// withdraw
|
|
270
|
+
Action = "Withdraw";
|
|
271
|
+
token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.d_token.name);
|
|
272
|
+
amount = Number(event.parsedJson.log[4]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
|
|
273
|
+
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
274
|
+
txHistory.push({
|
|
275
|
+
Index: Index,
|
|
276
|
+
Period: Period,
|
|
277
|
+
Action: Action,
|
|
278
|
+
Amount: Amount,
|
|
279
|
+
Vault: Vault,
|
|
280
|
+
RiskLevel: RiskLevel,
|
|
281
|
+
Tails: Tails,
|
|
282
|
+
Exp: Exp,
|
|
283
|
+
Date: new Date(Number(event.timestampMs)),
|
|
284
|
+
txDigest: event.id.txDigest,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
if (event.parsedJson.log[5] > 0) {
|
|
288
|
+
// unsubscribe
|
|
289
|
+
Action = "Unsubscribe";
|
|
290
|
+
token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.d_token.name);
|
|
291
|
+
amount = Number(event.parsedJson.log[5]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
|
|
292
|
+
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
293
|
+
txHistory.push({
|
|
294
|
+
Index: Index,
|
|
295
|
+
Period: Period,
|
|
296
|
+
Action: Action,
|
|
297
|
+
Amount: Amount,
|
|
298
|
+
Vault: Vault,
|
|
299
|
+
RiskLevel: RiskLevel,
|
|
300
|
+
Tails: Tails,
|
|
301
|
+
Exp: Exp,
|
|
302
|
+
Date: new Date(Number(event.timestampMs)),
|
|
303
|
+
txDigest: event.id.txDigest,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
if (event.parsedJson.log[6] > 0) {
|
|
307
|
+
// harvest
|
|
308
|
+
Action = "Harvest";
|
|
309
|
+
token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.b_token.name);
|
|
310
|
+
amount = Number(event.parsedJson.log[6]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
|
|
311
|
+
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
312
|
+
txHistory.push({
|
|
313
|
+
Index: Index,
|
|
314
|
+
Period: Period,
|
|
315
|
+
Action: Action,
|
|
316
|
+
Amount: Amount,
|
|
317
|
+
Vault: Vault,
|
|
318
|
+
RiskLevel: RiskLevel,
|
|
319
|
+
Tails: Tails,
|
|
320
|
+
Exp: Exp,
|
|
321
|
+
Date: new Date(Number(event.timestampMs)),
|
|
322
|
+
txDigest: event.id.txDigest,
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
if (event.parsedJson.log[9] > 0) {
|
|
326
|
+
// claim
|
|
327
|
+
Action = "Claim";
|
|
328
|
+
token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.d_token.name);
|
|
329
|
+
amount = Number(event.parsedJson.log[9]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
|
|
330
|
+
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
331
|
+
txHistory.push({
|
|
332
|
+
Index: Index,
|
|
333
|
+
Period: Period,
|
|
334
|
+
Action: Action,
|
|
335
|
+
Amount: Amount,
|
|
336
|
+
Vault: Vault,
|
|
337
|
+
RiskLevel: RiskLevel,
|
|
338
|
+
Tails: Tails,
|
|
339
|
+
Exp: Exp,
|
|
340
|
+
Date: new Date(Number(event.timestampMs)),
|
|
341
|
+
txDigest: event.id.txDigest,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
if (event.parsedJson.log[10] > 0) {
|
|
345
|
+
// redeem
|
|
346
|
+
Action = "Redeem";
|
|
347
|
+
token = (0, token_1.typeArgToAsset)("0x" + event.parsedJson.i_token.name);
|
|
348
|
+
amount = Number(event.parsedJson.log[10]) / Math.pow(10, (0, token_1.assetToDecimal)(token));
|
|
349
|
+
Amount = "".concat((0, bignumber_js_1.default)(amount).toFixed(), " ").concat(token);
|
|
350
|
+
txHistory.push({
|
|
351
|
+
Index: Index,
|
|
352
|
+
Period: Period,
|
|
353
|
+
Action: Action,
|
|
354
|
+
Amount: Amount,
|
|
355
|
+
Vault: Vault,
|
|
356
|
+
RiskLevel: RiskLevel,
|
|
357
|
+
Tails: Tails,
|
|
358
|
+
Exp: Exp,
|
|
359
|
+
Date: new Date(Number(event.timestampMs)),
|
|
360
|
+
txDigest: event.id.txDigest,
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
return [2 /*return*/, txHistory];
|
|
248
364
|
case "NewStrategyEventV2":
|
|
249
365
|
Action = "Create Strategy";
|
|
250
366
|
deposit_amount = Number(event.parsedJson.deposit_amount) / Math.pow(10, (0, token_1.assetToDecimal)(b_token));
|