@typus/typus-sdk 1.2.60 → 1.2.62
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/utils/typus-dov-single-v2/depositorPnl.js +1 -1
- package/lib/utils/typus-dov-single-v2/mfud-user-entry.js +0 -5
- package/lib/utils/typus-dov-single-v2/user-history.js +93 -91
- package/lib/utils/typus-nft/fetch.d.ts +6 -3
- package/lib/utils/typus-nft/fetch.js +24 -13
- package/package.json +1 -1
|
@@ -36,7 +36,7 @@ function getDepositorCashFlows(userHistory) {
|
|
|
36
36
|
for (var userHistory_1 = __values(userHistory), userHistory_1_1 = userHistory_1.next(); !userHistory_1_1.done; userHistory_1_1 = userHistory_1.next()) {
|
|
37
37
|
var history_1 = userHistory_1_1.value;
|
|
38
38
|
var index = history_1.Index;
|
|
39
|
-
if (history_1.Action.startsWith("Harvest")) {
|
|
39
|
+
if (history_1.Action.startsWith("Harvest Reward")) {
|
|
40
40
|
var _h = __read((_c = history_1.Amount) === null || _c === void 0 ? void 0 : _c.split(" "), 2), amount = _h[0], token = _h[1];
|
|
41
41
|
if (depositorCashFlows.has(index)) {
|
|
42
42
|
var depositorCashFlow = depositorCashFlows.get(index);
|
|
@@ -324,11 +324,6 @@ function getNewBidTx(input) {
|
|
|
324
324
|
arguments: [input.tx.object(input.mfudRegistry), input.tx.object(result[1])],
|
|
325
325
|
});
|
|
326
326
|
input.tx.transferObjects([input.tx.object(fud_coin)], input.user);
|
|
327
|
-
input.tx.moveCall({
|
|
328
|
-
target: "".concat(input.typusFrameworkPackageId, "::utils::transfer_coins"),
|
|
329
|
-
typeArguments: [input.typeArguments[1]],
|
|
330
|
-
arguments: [input.tx.makeMoveVec({ objects: [input.tx.object(result[1])] }), input.tx.pure(input.user)],
|
|
331
|
-
});
|
|
332
327
|
return input.tx;
|
|
333
328
|
}
|
|
334
329
|
exports.getNewBidTx = getNewBidTx;
|
|
@@ -439,97 +439,99 @@ function parseVaultInfo(vaults, Index, action) {
|
|
|
439
439
|
var b_token;
|
|
440
440
|
var o_token;
|
|
441
441
|
var period;
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
442
|
+
if (v) {
|
|
443
|
+
switch (v.info.period) {
|
|
444
|
+
case "0":
|
|
445
|
+
period = "Daily";
|
|
446
|
+
break;
|
|
447
|
+
case "1":
|
|
448
|
+
period = "Weekly";
|
|
449
|
+
break;
|
|
450
|
+
case "2":
|
|
451
|
+
period = "Monthly";
|
|
452
|
+
break;
|
|
453
|
+
case "3":
|
|
454
|
+
period = "Hourly";
|
|
455
|
+
break;
|
|
456
|
+
case "4":
|
|
457
|
+
period = "10 Minutes";
|
|
458
|
+
break;
|
|
459
|
+
default:
|
|
460
|
+
period = "";
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
Period = period;
|
|
464
|
+
var optionType = void 0;
|
|
465
|
+
switch (v.info.optionType) {
|
|
466
|
+
case "0":
|
|
467
|
+
switch (action) {
|
|
468
|
+
case "DepositEvent":
|
|
469
|
+
case "WithdrawEvent":
|
|
470
|
+
case "UnsubscribeEvent":
|
|
471
|
+
case "ClaimEvent":
|
|
472
|
+
case "CompoundEvent":
|
|
473
|
+
case "HarvestEvent":
|
|
474
|
+
case "RedeemEvent":
|
|
475
|
+
optionType = "Covered Call";
|
|
476
|
+
break;
|
|
477
|
+
default:
|
|
478
|
+
optionType = "Call";
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
break;
|
|
482
|
+
case "1":
|
|
483
|
+
switch (action) {
|
|
484
|
+
case "DepositEvent":
|
|
485
|
+
case "WithdrawEvent":
|
|
486
|
+
case "UnsubscribeEvent":
|
|
487
|
+
case "ClaimEvent":
|
|
488
|
+
case "CompoundEvent":
|
|
489
|
+
case "HarvestEvent":
|
|
490
|
+
case "RedeemEvent":
|
|
491
|
+
optionType = "Put Selling";
|
|
492
|
+
break;
|
|
493
|
+
default:
|
|
494
|
+
optionType = "Put";
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
break;
|
|
498
|
+
case "2":
|
|
499
|
+
optionType = "Call Spread";
|
|
500
|
+
break;
|
|
501
|
+
case "3":
|
|
502
|
+
optionType = "Put Spread";
|
|
503
|
+
break;
|
|
504
|
+
case "4":
|
|
505
|
+
optionType = "Capped Call";
|
|
506
|
+
break;
|
|
507
|
+
case "5":
|
|
508
|
+
optionType = "Capped Put";
|
|
509
|
+
break;
|
|
510
|
+
case "6":
|
|
511
|
+
optionType = "Capped Call";
|
|
512
|
+
break;
|
|
513
|
+
default:
|
|
514
|
+
optionType = "";
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
switch (v.config.riskLevel) {
|
|
518
|
+
case "1":
|
|
519
|
+
RiskLevel = "Conservative";
|
|
520
|
+
break;
|
|
521
|
+
case "2":
|
|
522
|
+
RiskLevel = "Moderate";
|
|
523
|
+
break;
|
|
524
|
+
case "3":
|
|
525
|
+
RiskLevel = "Aggressive";
|
|
526
|
+
break;
|
|
527
|
+
default:
|
|
528
|
+
RiskLevel = "";
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
Vault = "".concat(v.info.settlementBaseName, " ").concat(period, " ").concat(optionType);
|
|
532
|
+
d_token = (0, token_1.typeArgToAsset)("0x" + v.info.depositToken);
|
|
533
|
+
b_token = (0, token_1.typeArgToAsset)("0x" + v.info.bidToken);
|
|
534
|
+
o_token = (0, token_1.typeArgToAsset)("0x" + v.info.settlementBase);
|
|
529
535
|
}
|
|
530
|
-
Vault = "".concat(v.info.settlementBaseName, " ").concat(period, " ").concat(optionType);
|
|
531
|
-
d_token = (0, token_1.typeArgToAsset)("0x" + v.info.depositToken);
|
|
532
|
-
b_token = (0, token_1.typeArgToAsset)("0x" + v.info.bidToken);
|
|
533
|
-
o_token = (0, token_1.typeArgToAsset)("0x" + v.info.settlementBase);
|
|
534
536
|
return [Period, Vault, RiskLevel, d_token, b_token, o_token];
|
|
535
537
|
}
|
|
@@ -22,8 +22,11 @@ export interface kioskOwnerCap {
|
|
|
22
22
|
objectId: string;
|
|
23
23
|
kioskId: string;
|
|
24
24
|
}
|
|
25
|
-
export declare function getTailsIds(kioskClient: KioskClient, nftConfig: any,
|
|
26
|
-
export
|
|
25
|
+
export declare function getTailsIds(kioskClient: KioskClient, nftConfig: any, kioskOwnerCaps: kioskOwnerCap[]): Promise<TailsId[]>;
|
|
26
|
+
export interface TailsWithType extends Tails {
|
|
27
|
+
type: string | null | undefined;
|
|
28
|
+
}
|
|
29
|
+
export declare function getTails(provider: SuiClient, tailsIds: string[]): Promise<TailsWithType[]>;
|
|
27
30
|
export declare function getTailsDynamicField(provider: SuiClient, tailsIds: string[]): Promise<[Tails[], Map<string, string>]>;
|
|
28
31
|
export declare function getTailsKiosk(provider: SuiClient, tailsToDynamicField: Map<string, string>): Promise<Map<string, string>>;
|
|
29
32
|
export declare function getKioskOwner(provider: SuiClient, DynamicFieldToKiosk: Map<string, string>): Promise<Map<string, string>>;
|
|
@@ -43,7 +46,7 @@ export interface Tails {
|
|
|
43
46
|
}
|
|
44
47
|
export declare function getLevelExp(level: number): number | undefined;
|
|
45
48
|
export declare const LevelExpVec: number[];
|
|
46
|
-
export declare function getTableTails(provider: SuiClient, parentId: string): Promise<
|
|
49
|
+
export declare function getTableTails(provider: SuiClient, parentId: string): Promise<TailsWithType[]>;
|
|
47
50
|
export declare function getDiscountPool(provider: SuiClient, pool: string): Promise<DiscountPoolData>;
|
|
48
51
|
export interface DiscountPoolData {
|
|
49
52
|
id: string;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -146,7 +157,7 @@ function getWhitelistMap(nftConfig, wlTokens) {
|
|
|
146
157
|
});
|
|
147
158
|
}
|
|
148
159
|
exports.getWhitelistMap = getWhitelistMap;
|
|
149
|
-
function getTailsIds(kioskClient, nftConfig,
|
|
160
|
+
function getTailsIds(kioskClient, nftConfig, kioskOwnerCaps) {
|
|
150
161
|
return __awaiter(this, void 0, void 0, function () {
|
|
151
162
|
var Tails, _loop_1, kioskOwnerCaps_1, kioskOwnerCaps_1_1, kioskOwnerCap, e_1_1;
|
|
152
163
|
var e_1, _a;
|
|
@@ -217,24 +228,24 @@ function getTails(provider, tailsIds) {
|
|
|
217
228
|
return __awaiter(this, void 0, void 0, function () {
|
|
218
229
|
var Tails, len, results, results_1, results_1_1, result, fields, tails;
|
|
219
230
|
var e_2, _a;
|
|
220
|
-
var _b;
|
|
221
|
-
return __generator(this, function (
|
|
222
|
-
switch (
|
|
231
|
+
var _b, _c;
|
|
232
|
+
return __generator(this, function (_d) {
|
|
233
|
+
switch (_d.label) {
|
|
223
234
|
case 0:
|
|
224
235
|
Tails = [];
|
|
225
|
-
|
|
236
|
+
_d.label = 1;
|
|
226
237
|
case 1:
|
|
227
238
|
if (!(tailsIds.length > 0)) return [3 /*break*/, 3];
|
|
228
239
|
len = tailsIds.length > 50 ? 50 : tailsIds.length;
|
|
229
240
|
return [4 /*yield*/, provider.multiGetObjects({ ids: tailsIds.splice(0, len), options: { showContent: true } })];
|
|
230
241
|
case 2:
|
|
231
|
-
results =
|
|
242
|
+
results = _d.sent();
|
|
232
243
|
try {
|
|
233
244
|
for (results_1 = (e_2 = void 0, __values(results)), results_1_1 = results_1.next(); !results_1_1.done; results_1_1 = results_1.next()) {
|
|
234
245
|
result = results_1_1.value;
|
|
235
246
|
fields = (_b = result.data) === null || _b === void 0 ? void 0 : _b.content.fields;
|
|
236
247
|
tails = fieldsToTails(fields);
|
|
237
|
-
Tails.push(tails);
|
|
248
|
+
Tails.push(__assign(__assign({}, tails), { type: (_c = result.data) === null || _c === void 0 ? void 0 : _c.type }));
|
|
238
249
|
}
|
|
239
250
|
}
|
|
240
251
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -255,26 +266,26 @@ function getTailsDynamicField(provider, tailsIds) {
|
|
|
255
266
|
return __awaiter(this, void 0, void 0, function () {
|
|
256
267
|
var Tails, tailsToDynamicField, len, results, results_2, results_2_1, result, owner, fields, tails;
|
|
257
268
|
var e_3, _a;
|
|
258
|
-
var _b, _c;
|
|
259
|
-
return __generator(this, function (
|
|
260
|
-
switch (
|
|
269
|
+
var _b, _c, _d;
|
|
270
|
+
return __generator(this, function (_e) {
|
|
271
|
+
switch (_e.label) {
|
|
261
272
|
case 0:
|
|
262
273
|
Tails = [];
|
|
263
274
|
tailsToDynamicField = new Map();
|
|
264
|
-
|
|
275
|
+
_e.label = 1;
|
|
265
276
|
case 1:
|
|
266
277
|
if (!(tailsIds.length > 0)) return [3 /*break*/, 3];
|
|
267
278
|
len = tailsIds.length > 50 ? 50 : tailsIds.length;
|
|
268
279
|
return [4 /*yield*/, provider.multiGetObjects({ ids: tailsIds.splice(0, len), options: { showContent: true, showOwner: true } })];
|
|
269
280
|
case 2:
|
|
270
|
-
results =
|
|
281
|
+
results = _e.sent();
|
|
271
282
|
try {
|
|
272
283
|
for (results_2 = (e_3 = void 0, __values(results)), results_2_1 = results_2.next(); !results_2_1.done; results_2_1 = results_2.next()) {
|
|
273
284
|
result = results_2_1.value;
|
|
274
285
|
owner = (_b = result.data) === null || _b === void 0 ? void 0 : _b.owner.ObjectOwner;
|
|
275
286
|
fields = (_c = result.data) === null || _c === void 0 ? void 0 : _c.content.fields;
|
|
276
287
|
tails = fieldsToTails(fields);
|
|
277
|
-
Tails.push(tails);
|
|
288
|
+
Tails.push(__assign(__assign({}, tails), { type: (_d = result.data) === null || _d === void 0 ? void 0 : _d.type }));
|
|
278
289
|
if (owner) {
|
|
279
290
|
tailsToDynamicField.set(tails.id, owner);
|
|
280
291
|
}
|