@typus/typus-perp-sdk 1.1.7 → 1.1.8
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/dist/src/fetch.js +4 -3
- package/package.json +1 -1
package/dist/src/fetch.js
CHANGED
|
@@ -486,8 +486,9 @@ function getLiquidationPriceAndPnl(config, pythClient, input) {
|
|
|
486
486
|
}
|
|
487
487
|
finally { if (e_4) throw e_4.error; }
|
|
488
488
|
}
|
|
489
|
+
console.log(input.positions.slice(3, 4));
|
|
489
490
|
try {
|
|
490
|
-
for (_e = __values(input.positions), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
491
|
+
for (_e = __values(input.positions.slice(2, 3)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
491
492
|
position = _f.value;
|
|
492
493
|
TOKEN = (0, constants_1.typeArgToAsset)(position.collateralToken.name);
|
|
493
494
|
BASE_TOKEN = (0, constants_1.typeArgToAsset)(position.symbol.baseToken.name);
|
|
@@ -515,7 +516,7 @@ function getLiquidationPriceAndPnl(config, pythClient, input) {
|
|
|
515
516
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: input.user, transactionBlock: tx })];
|
|
516
517
|
case 2:
|
|
517
518
|
res = _k.sent();
|
|
518
|
-
results = res.results.slice(-input.positions.length).map(function (x) {
|
|
519
|
+
results = res.results ? res.results.slice(-input.positions.length).map(function (x) {
|
|
519
520
|
// console.log(x);
|
|
520
521
|
var liquidationPrice = Number(bcs_1.bcs.u64().parse(Uint8Array.from(x.returnValues[0][0])));
|
|
521
522
|
var isProfit = bcs_1.bcs.bool().parse(Uint8Array.from(x.returnValues[1][0]));
|
|
@@ -539,7 +540,7 @@ function getLiquidationPriceAndPnl(config, pythClient, input) {
|
|
|
539
540
|
closeFee: closeFee,
|
|
540
541
|
pnlAfterFee: pnl - cost,
|
|
541
542
|
};
|
|
542
|
-
});
|
|
543
|
+
}) : [];
|
|
543
544
|
// console.log(results);
|
|
544
545
|
return [2 /*return*/, results];
|
|
545
546
|
}
|