@typus/typus-sdk 1.2.80 → 1.2.82
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.
|
@@ -84,6 +84,7 @@ var vault_1 = require("./vault");
|
|
|
84
84
|
var token_1 = require("./token");
|
|
85
85
|
var tools_1 = require("../../tools");
|
|
86
86
|
var view_function_2 = require("../../auto-bid/view-function");
|
|
87
|
+
var token_2 = require("../../token");
|
|
87
88
|
var PriceDecimal = (0, bignumber_js_1.default)(10).pow(8);
|
|
88
89
|
exports.tokenOrder = {
|
|
89
90
|
// Basically it's a to z but put SUI at first
|
|
@@ -210,7 +211,7 @@ exports.calcBreakEvenPrice = calcBreakEvenPrice;
|
|
|
210
211
|
var calcEstPnl = function (live, incentive, bidSize, optionType, assets, strikes, bidShare, deliveryPrice, oTokenPrice) {
|
|
211
212
|
var profit = "0";
|
|
212
213
|
var cost = "0";
|
|
213
|
-
var _a = __read(assets, 3), dToken = _a[0], bToken = _a[1], oToken = _a[2];
|
|
214
|
+
var _a = __read((0, token_2.typeArgsToAssets)(assets), 3), dToken = _a[0], bToken = _a[1], oToken = _a[2];
|
|
214
215
|
var dTokenWrappedName = (0, token_1.getTokenName)({ token: dToken, wrapped: true });
|
|
215
216
|
var bTokenWrappedName = (0, token_1.getTokenName)({ token: bToken, wrapped: true });
|
|
216
217
|
var estPnls = [];
|
|
@@ -249,10 +250,10 @@ var calcEstPnl = function (live, incentive, bidSize, optionType, assets, strikes
|
|
|
249
250
|
if (!live) {
|
|
250
251
|
estPnls.push({
|
|
251
252
|
value: profit,
|
|
252
|
-
token:
|
|
253
|
+
token: assets[0],
|
|
253
254
|
});
|
|
254
255
|
if (dToken !== bToken) {
|
|
255
|
-
estPnls.push({ value: "-" + cost, token:
|
|
256
|
+
estPnls.push({ value: "-" + cost, token: assets[1] });
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
259
|
return estPnls;
|
|
@@ -330,7 +331,7 @@ var parseBidReceipt = function (vaults, bidReceipts) {
|
|
|
330
331
|
exports.parseBidReceipt = parseBidReceipt;
|
|
331
332
|
var parseBid = function (bidVaultInfo, bidShare, auction, oTokenPrice, isAutoBid) {
|
|
332
333
|
var _a, _b;
|
|
333
|
-
var vaultInfo = bidVaultInfo.vaultInfo, _c = bidVaultInfo.vaultInfo, info = _c.info, _d = _c.info, index = _d.index, bTokenDecimal = _d.bTokenDecimal, oTokenDecimal = _d.oTokenDecimal, optionType = _d.optionType, period = _d.period, _e = _c.config, lotSize = _e.bidLotSize, bidIncentiveBp = _e.bidIncentiveBp, u64Padding = _e.u64Padding, receipt = bidVaultInfo.receipt;
|
|
334
|
+
var vaultInfo = bidVaultInfo.vaultInfo, _c = bidVaultInfo.vaultInfo, info = _c.info, _d = _c.info, index = _d.index, bTokenDecimal = _d.bTokenDecimal, oTokenDecimal = _d.oTokenDecimal, optionType = _d.optionType, period = _d.period, depositToken = _d.depositToken, bidToken = _d.bidToken, settlementBase = _d.settlementBase, _e = _c.config, lotSize = _e.bidLotSize, bidIncentiveBp = _e.bidIncentiveBp, u64Padding = _e.u64Padding, receipt = bidVaultInfo.receipt;
|
|
334
335
|
var incentiveRate = (0, exports.calcIncentiveRate)(bidIncentiveBp);
|
|
335
336
|
var _f = __read((0, vault_1.parseAssets)(info), 3), dToken = _f[0], bToken = _f[1], oToken = _f[2];
|
|
336
337
|
var oTokenName = (0, token_1.getTokenName)({ token: oToken });
|
|
@@ -360,7 +361,7 @@ var parseBid = function (bidVaultInfo, bidShare, auction, oTokenPrice, isAutoBid
|
|
|
360
361
|
var defaultMinBidSize = (0, bignumber_js_1.default)(lotSize).div((0, bignumber_js_1.default)(10).pow(oTokenDecimal));
|
|
361
362
|
var bidSize = bidsSize.toFixed((0, tools_1.countFloating)(defaultMinBidSize.toNumber()));
|
|
362
363
|
var settlePrice = (0, bignumber_js_1.default)((_b = bidShare.bidVault.u64Padding[0]) !== null && _b !== void 0 ? _b : "0").div(PriceDecimal);
|
|
363
|
-
var estPnls = (0, exports.calcEstPnl)(live, incentiveRate, bidSize, optionType, [
|
|
364
|
+
var estPnls = (0, exports.calcEstPnl)(live, incentiveRate, bidSize, optionType, [depositToken, bidToken, settlementBase], strikes, bidShare, deliveryPrice.toString(), oTokenPrice);
|
|
364
365
|
return {
|
|
365
366
|
vaultIndex: index,
|
|
366
367
|
auctionName: "".concat(tokenLabel, " ").concat(periodLabel, " ").concat(optionTypeLabel),
|
|
@@ -375,7 +376,7 @@ var parseBid = function (bidVaultInfo, bidShare, auction, oTokenPrice, isAutoBid
|
|
|
375
376
|
value: (0, bignumber_js_1.default)(bidSize)
|
|
376
377
|
.div((0, bignumber_js_1.default)(10).pow(oToken === "MFUD" ? 6 : 0))
|
|
377
378
|
.toString(),
|
|
378
|
-
token:
|
|
379
|
+
token: settlementBase,
|
|
379
380
|
},
|
|
380
381
|
breakEvenPrice: (0, bignumber_js_1.default)(breakEvenPrice)
|
|
381
382
|
.div((0, bignumber_js_1.default)(10).pow(oToken === "MFUD" ? 6 : 0))
|